diff --git a/reactos/base/applications/dxdiag/dxdiag.rbuild b/reactos/base/applications/dxdiag/dxdiag.rbuild index cfe81811090..c8e69c255cd 100644 --- a/reactos/base/applications/dxdiag/dxdiag.rbuild +++ b/reactos/base/applications/dxdiag/dxdiag.rbuild @@ -14,6 +14,8 @@ version dinput8 dxguid + dsound + version system.c display.c sound.c diff --git a/reactos/base/applications/dxdiag/lang/en-US.rc b/reactos/base/applications/dxdiag/lang/en-US.rc index 46e8e63cab5..6f1b7636a60 100644 --- a/reactos/base/applications/dxdiag/lang/en-US.rc +++ b/reactos/base/applications/dxdiag/lang/en-US.rc @@ -81,6 +81,8 @@ IDD_NETWORK_DIALOG DIALOGEX DISCARDABLE 0, 0, 362, 190 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN + GROUPBOX "Registered DirectPlay Service Provider", -1, 10, 10, 352, 80 + CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 332, 60 END IDD_HELP_DIALOG DIALOGEX DISCARDABLE 0, 0, 362, 190 @@ -115,4 +117,18 @@ BEGIN IDS_DEVICE_FORCEFEEDBACK "Force Feedback-Driver" IDS_NOT_APPLICABLE "Not applicable" IDS_OPTION_YES "Yes" + IDS_DIRECTPLAY_COL_NAME1 "Name" + IDS_DIRECTPLAY_COL_NAME2 "Registry" + IDS_DIRECTPLAY_COL_NAME3 "File" + IDS_DIRECTPLAY_COL_NAME4 "Version" + IDS_DIRECTPLAY8_MODEMSP "DirectPlay8-Modem Service Provider" + IDS_DIRECTPLAY8_SERIALSP "DirectPlay8 Serial Service Provider" + IDS_DIRECTPLAY8_IPXSP "DirectPlay8 IPX Service Provider" + IDS_DIRECTPLAY8_TCPSP "DirectPlay8-TCP/IP Service Provider" + IDS_DIRECTPLAY_TCPCONN "Internet TCP/IP Connection For DirectPlay" + IDS_DIRECTPLAY_IPXCONN "IPX Connection For DirectPlay" + IDS_DIRECTPLAY_MODEMCONN "Modem Connection For DirectPlay" + IDS_DIRECTPLAY_SERIALCONN "Serial Connection For DirectPlay" + IDS_REG_SUCCESS "OK" + IDS_REG_FAIL "Error" END diff --git a/reactos/base/applications/dxdiag/lang/fr-FR.rc b/reactos/base/applications/dxdiag/lang/fr-FR.rc index a95c8a886d0..3484b7be18a 100644 --- a/reactos/base/applications/dxdiag/lang/fr-FR.rc +++ b/reactos/base/applications/dxdiag/lang/fr-FR.rc @@ -81,6 +81,8 @@ IDD_NETWORK_DIALOG DIALOGEX DISCARDABLE 0, 0, 362, 190 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN + GROUPBOX "Registered DirectPlay Service Provider", -1, 10, 10, 352, 80 + CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 332, 60 END IDD_HELP_DIALOG DIALOGEX DISCARDABLE 0, 0, 362, 190 @@ -115,4 +117,18 @@ BEGIN IDS_DEVICE_FORCEFEEDBACK "Force Feedback-Driver" IDS_NOT_APPLICABLE "Not applicable" IDS_OPTION_YES "Yes" + IDS_DIRECTPLAY_COL_NAME1 "Name" + IDS_DIRECTPLAY_COL_NAME2 "Registry" + IDS_DIRECTPLAY_COL_NAME3 "File" + IDS_DIRECTPLAY_COL_NAME4 "Version" + IDS_DIRECTPLAY8_MODEMSP "DirectPlay8-Modem Service Provider" + IDS_DIRECTPLAY8_SERIALSP "DirectPlay8 Serial Service Provider" + IDS_DIRECTPLAY8_IPXSP "DirectPlay8 IPX Service Provider" + IDS_DIRECTPLAY8_TCPSP "DirectPlay8-TCP/IP Service Provider" + IDS_DIRECTPLAY_TCPCONN "Internet TCP/IP Connection For DirectPlay" + IDS_DIRECTPLAY_IPXCONN "IPX Connection For DirectPlay" + IDS_DIRECTPLAY_MODEMCONN "Modem Connection For DirectPlay" + IDS_DIRECTPLAY_SERIALCONN "Serial Connection For DirectPlay" + IDS_REG_SUCCESS "OK" + IDS_REG_FAIL "Error" END diff --git a/reactos/base/applications/dxdiag/lang/pl-PL.rc b/reactos/base/applications/dxdiag/lang/pl-PL.rc index faf82f0c0b9..32f721d5c95 100644 --- a/reactos/base/applications/dxdiag/lang/pl-PL.rc +++ b/reactos/base/applications/dxdiag/lang/pl-PL.rc @@ -94,6 +94,8 @@ IDD_HELP_DIALOG DIALOGEX DISCARDABLE 0, 0, 362, 190 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN + GROUPBOX "Registered DirectPlay Service Provider", -1, 10, 10, 352, 80 + CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 332, 60 END STRINGTABLE DISCARDABLE @@ -122,5 +124,18 @@ BEGIN IDS_DEVICE_FORCEFEEDBACK "Force Feedback-Driver" IDS_NOT_APPLICABLE "Not applicable" IDS_OPTION_YES "Yes" - + IDS_DIRECTPLAY_COL_NAME1 "Name" + IDS_DIRECTPLAY_COL_NAME2 "Registry" + IDS_DIRECTPLAY_COL_NAME3 "File" + IDS_DIRECTPLAY_COL_NAME4 "Version" + IDS_DIRECTPLAY8_MODEMSP "DirectPlay8-Modem Service Provider" + IDS_DIRECTPLAY8_SERIALSP "DirectPlay8 Serial Service Provider" + IDS_DIRECTPLAY8_IPXSP "DirectPlay8 IPX Service Provider" + IDS_DIRECTPLAY8_TCPSP "DirectPlay8-TCP/IP Service Provider" + IDS_DIRECTPLAY_TCPCONN "Internet TCP/IP Connection For DirectPlay" + IDS_DIRECTPLAY_IPXCONN "IPX Connection For DirectPlay" + IDS_DIRECTPLAY_MODEMCONN "Modem Connection For DirectPlay" + IDS_DIRECTPLAY_SERIALCONN "Serial Connection For DirectPlay" + IDS_REG_SUCCESS "OK" + IDS_REG_FAIL "Error" END diff --git a/reactos/base/applications/dxdiag/lang/ru-RU.rc b/reactos/base/applications/dxdiag/lang/ru-RU.rc index c41d9a804aa..d0eb5315a03 100644 --- a/reactos/base/applications/dxdiag/lang/ru-RU.rc +++ b/reactos/base/applications/dxdiag/lang/ru-RU.rc @@ -87,6 +87,8 @@ IDD_HELP_DIALOG DIALOGEX DISCARDABLE 0, 0, 362, 190 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN + GROUPBOX "Registered DirectPlay Service Provider", -1, 10, 10, 352, 80 + CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 332, 60 END STRINGTABLE DISCARDABLE @@ -115,5 +117,18 @@ BEGIN IDS_DEVICE_FORCEFEEDBACK "Force Feedback-Driver" IDS_NOT_APPLICABLE "Í/Ä" IDS_OPTION_YES "Äà" - + IDS_DIRECTPLAY_COL_NAME1 "Name" + IDS_DIRECTPLAY_COL_NAME2 "Registry" + IDS_DIRECTPLAY_COL_NAME3 "File" + IDS_DIRECTPLAY_COL_NAME4 "Version" + IDS_DIRECTPLAY8_MODEMSP "DirectPlay8-Modem Service Provider" + IDS_DIRECTPLAY8_SERIALSP "DirectPlay8 Serial Service Provider" + IDS_DIRECTPLAY8_IPXSP "DirectPlay8 IPX Service Provider" + IDS_DIRECTPLAY8_TCPSP "DirectPlay8-TCP/IP Service Provider" + IDS_DIRECTPLAY_TCPCONN "Internet TCP/IP Connection For DirectPlay" + IDS_DIRECTPLAY_IPXCONN "IPX Connection For DirectPlay" + IDS_DIRECTPLAY_MODEMCONN "Modem Connection For DirectPlay" + IDS_DIRECTPLAY_SERIALCONN "Serial Connection For DirectPlay" + IDS_REG_SUCCESS "OK" + IDS_REG_FAIL "Error" END diff --git a/reactos/base/applications/dxdiag/network.c b/reactos/base/applications/dxdiag/network.c index 24d5f821a3b..6fd69b5a069 100644 --- a/reactos/base/applications/dxdiag/network.c +++ b/reactos/base/applications/dxdiag/network.c @@ -9,6 +9,298 @@ #include "precomp.h" +typedef struct +{ + WCHAR Guid[40]; + UINT ResourceID; +}DIRECTPLAY_GUID; + +typedef struct _LANGANDCODEPAGE_ + { + WORD lang; + WORD code; +} LANGANDCODEPAGE, *LPLANGANDCODEPAGE; + +static DIRECTPLAY_GUID DirectPlay8SP[] = +{ + { + L"{6D4A3650-628D-11D2-AE0F-006097B01411}", + IDS_DIRECTPLAY8_MODEMSP + }, + { + L"{743B5D60-628D-11D2-AE0F-006097B01411}", + IDS_DIRECTPLAY8_SERIALSP + }, + { + L"{53934290-628D-11D2-AE0F-006097B01411}", + IDS_DIRECTPLAY8_IPXSP + }, + { + L"{EBFE7BA0-628D-11D2-AE0F-006097B01411}", + IDS_DIRECTPLAY8_TCPSP + } +}; + +static DIRECTPLAY_GUID DirectPlaySP[] = +{ + { + L"{36E95EE0-8577-11cf-960C-0080C7534E82}", + IDS_DIRECTPLAY_TCPCONN + }, + { + L"685BC400-9D2C-11cf-A9CD-00AA006886E3", + IDS_DIRECTPLAY_IPXCONN + }, + { + L"{44EAA760-CB68-11cf-9C4E-00A0C905425E}", + IDS_DIRECTPLAY_MODEMCONN + }, + { + L"{0F1D6860-88D9-11cf-9C4E-00A0C905425E}", + IDS_DIRECTPLAY_SERIALCONN + } +}; + +static +VOID +InitListViewColumns(HWND hDlgCtrl) +{ + WCHAR szText[256]; + LVCOLUMNW lvcolumn; + INT Index; + + ZeroMemory(&lvcolumn, sizeof(LVCOLUMNW)); + lvcolumn.pszText = szText; + lvcolumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH; + lvcolumn.fmt = LVCFMT_LEFT; + lvcolumn.cx = 200; + + for(Index = 0; Index < 4; Index++) + { + szText[0] = L'\0'; + LoadStringW(hInst, IDS_DIRECTPLAY_COL_NAME1 + Index, szText, sizeof(szText) / sizeof(WCHAR)); + szText[(sizeof(szText) / sizeof(WCHAR))-1] = L'\0'; + if (Index) + lvcolumn.cx = 98; + if (SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, Index, (LPARAM)&lvcolumn) == -1) + return; + } +} + +UINT +FindProviderIndex(LPCWSTR szGuid, DIRECTPLAY_GUID * PreDefProviders) +{ + UINT Index; + for(Index = 0; Index < 4; Index++) + { + if (!wcsncmp(PreDefProviders[Index].Guid, szGuid, 40)) + return Index; + } + return UINT_MAX; +} +static +BOOL +GetFileVersion(WCHAR * szAppName, WCHAR * szVer) +{ + UINT VerSize; + DWORD DummyHandle; + LPVOID pBuf; + WORD lang = 0; + WORD code = 0; + LPLANGANDCODEPAGE lplangcode; + WCHAR szBuffer[100]; + WCHAR * pResult; + BOOL bResult = FALSE; + + static const WCHAR wFormat[] = L"\\StringFileInfo\\%04x%04x\\FileVersion"; + static const WCHAR wTranslation[] = L"VarFileInfo\\Translation"; + + /* query version info size */ + VerSize = GetFileVersionInfoSizeW(szAppName, &DummyHandle); + if (!VerSize) + return FALSE; + + + /* allocate buffer */ + pBuf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, VerSize); + if (!pBuf) + return FALSE; + + + /* query version info */ + if(!GetFileVersionInfoW(szAppName, 0, VerSize, pBuf)) + { + HeapFree(GetProcessHeap(), 0, pBuf); + return FALSE; + } + + /* query lang code */ + if(VerQueryValueW(pBuf, wTranslation, (LPVOID *)&lplangcode, &VerSize)) + { + /* FIXME find language from current locale / if not available, + * default to english + * for now default to first available language + */ + lang = lplangcode->lang; + code = lplangcode->code; + } + /* set up format */ + swprintf(szBuffer, wFormat, lang, code); + /* query manufacturer */ + pResult = NULL; + bResult = VerQueryValueW(pBuf, szBuffer, (LPVOID *)&pResult, &VerSize); + + if (VerSize && bResult && pResult) + { + wcscpy(szVer, pResult); + bResult = TRUE; + } + + HeapFree(GetProcessHeap(), 0, pBuf); + return bResult; +} + +static +BOOL +EnumerateServiceProviders(HKEY hKey, HWND hDlgCtrl, DIRECTPLAY_GUID * PreDefProviders) +{ + DWORD dwIndex = 0; + LONG result; + WCHAR szName[50]; + WCHAR szGUID[40]; + WCHAR szTemp[63]; + WCHAR szResult[MAX_PATH+20] = {0}; + DWORD RegProviders = 0; + DWORD ProviderIndex; + DWORD dwName; + LVITEMW Item; + INT ItemCount; + LRESULT lResult; + + + ItemCount = ListView_GetItemCount(hDlgCtrl); + ZeroMemory(&Item, sizeof(LVITEMW)); + Item.mask = LVIF_TEXT; + Item.pszText = szResult; + Item.iItem = ItemCount; + /* insert all predefined items first */ + for(dwIndex = 0; dwIndex < 4; dwIndex++) + { + Item.iItem = ItemCount + dwIndex; + Item.iSubItem = 0; + szResult[0] = L'\0'; + LoadStringW(hInst, PreDefProviders[dwIndex].ResourceID, szResult, sizeof(szResult)/sizeof(WCHAR)); + szResult[(sizeof(szResult)/sizeof(WCHAR))-1] = L'\0'; + lResult = SendMessageW(hDlgCtrl, LVM_INSERTITEM, 0, (LPARAM)&Item); + szResult[0] = L'\0'; + LoadStringW(hInst, IDS_REG_FAIL, szResult, sizeof(szResult)/sizeof(WCHAR)); + szResult[(sizeof(szResult)/sizeof(WCHAR))-1] = L'\0'; + Item.iItem = lResult; + Item.iSubItem = 1; + lResult = SendMessageW(hDlgCtrl, LVM_SETITEM, 0, (LPARAM)&Item); + } + + dwIndex = 0; + do + { + dwName = sizeof(szName) / sizeof(WCHAR); + result = RegEnumKeyEx(hKey, dwIndex, szName, &dwName, NULL, NULL, NULL, NULL); + if (result == ERROR_SUCCESS) + { + szName[(sizeof(szName)/sizeof(WCHAR))-1] = L'\0'; + + ProviderIndex = UINT_MAX; + if (GetRegValue(hKey, szName, L"GUID", REG_SZ, szGUID, sizeof(szGUID))) + ProviderIndex = FindProviderIndex(szGUID, PreDefProviders); + else + ProviderIndex = UINT_MAX; + + szResult[0] = L'\0'; + /* check if the 'Path' key is available */ + if (!GetRegValue(hKey, szName, L"Path", REG_SZ, szResult, sizeof(szResult))) + { + /* retrieve the path by lookup the CLSID */ + wcscpy(szTemp, L"CLSID\\"); + wcscpy(&szTemp[6], szGUID); + wcscpy(&szTemp[44], L"\\InProcServer32"); + if (!GetRegValue(HKEY_CLASSES_ROOT, szTemp, NULL, REG_SZ, szResult, sizeof(szResult))) + szResult[0] = L'\0'; + } + if (szResult[0]) + { + /* insert path name */ + Item.iSubItem = 2; + Item.iItem = ProviderIndex + ItemCount; + SendMessageW(hDlgCtrl, LVM_SETITEM, 0, (LPARAM)&Item); + /* retrieve file version */ + if (!GetFileVersion(szResult, szTemp)) + { + szTemp[0] = L'\0'; + LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTemp, sizeof(szTemp)/sizeof(WCHAR)); + szTemp[(sizeof(szTemp)/sizeof(WCHAR))-1] = L'\0'; + } + Item.iSubItem = 3; + Item.pszText = szTemp; + SendMessageW(hDlgCtrl, LVM_SETITEM, 0, (LPARAM)&Item); + Item.pszText = szResult; + } + + if (ProviderIndex != UINT_MAX) + { + RegProviders |= (1 << ProviderIndex); + szResult[0] = L'\0'; + LoadStringW(hInst, IDS_REG_SUCCESS, szResult, sizeof(szResult)); + Item.iSubItem = 1; + + Item.iItem = ProviderIndex + ItemCount; + szResult[(sizeof(szResult)/sizeof(WCHAR))-1] = L'\0'; + SendMessageW(hDlgCtrl, LVM_SETITEM, 0, (LPARAM)&Item); + } + } + dwIndex++; + }while(result != ERROR_NO_MORE_ITEMS); + + /* check if all providers have been registered */ +// if (RegProviders == 15) + return TRUE; + return FALSE; +} + + + +static +void +InitializeDirectPlayDialog(HWND hwndDlg) +{ + HKEY hKey; + LONG result; + HWND hDlgCtrl; + + /* open DirectPlay8 key */ + result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectPlay8\\Service Providers", 0, KEY_READ, &hKey); + if (result != ERROR_SUCCESS) + return; + + hDlgCtrl = GetDlgItem(hwndDlg, IDC_LIST_PROVIDER); + /* initialize list ctrl */ + InitListViewColumns(hDlgCtrl); + + /* enumerate providers */ + result = EnumerateServiceProviders(hKey, hDlgCtrl, DirectPlay8SP); + RegCloseKey(hKey); + if (!result) + return; + + /* open DirectPlay key */ + result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectPlay\\Service Providers", 0, KEY_READ, &hKey); + if (result != ERROR_SUCCESS) + return; + + /* enumerate providers */ + result = EnumerateServiceProviders(hKey, hDlgCtrl, DirectPlaySP); + RegCloseKey(hKey); +} + INT_PTR CALLBACK NetworkPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { @@ -18,6 +310,7 @@ NetworkPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: { SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); + InitializeDirectPlayDialog(hDlg); return TRUE; } } diff --git a/reactos/base/applications/dxdiag/precomp.h b/reactos/base/applications/dxdiag/precomp.h index 60e484dc765..f71dea5a600 100644 --- a/reactos/base/applications/dxdiag/precomp.h +++ b/reactos/base/applications/dxdiag/precomp.h @@ -2,14 +2,16 @@ #define PRECOMP_H__ #define DIRECTINPUT_VERSION 0x0800 - +#define DIRECTSOUND_VERSION 0x0800 #include #include +#include #include #include #include #include +#include #include "resource.h" typedef struct diff --git a/reactos/base/applications/dxdiag/resource.h b/reactos/base/applications/dxdiag/resource.h index f3c6efc3738..2fd37a0123e 100644 --- a/reactos/base/applications/dxdiag/resource.h +++ b/reactos/base/applications/dxdiag/resource.h @@ -40,6 +40,11 @@ #define IDC_TREE_PORT 6001 #define IDC_RICH_INFO 6002 +/* DirectPlay dialog constants */ +#define IDC_LIST_PROVIDER 7000 + + + /* string resource constants */ #define IDS_MAIN_DIALOG 10000 #define IDS_SYSTEM_DIALOG 10001 @@ -65,6 +70,20 @@ #define IDS_DEVICE_FORCEFEEDBACK 10021 #define IDS_NOT_APPLICABLE 10100 #define IDS_OPTION_YES 10101 +#define IDS_DIRECTPLAY_COL_NAME1 10102 +#define IDS_DIRECTPLAY_COL_NAME2 10103 +#define IDS_DIRECTPLAY_COL_NAME3 10104 +#define IDS_DIRECTPLAY_COL_NAME4 10105 +#define IDS_DIRECTPLAY8_MODEMSP 10106 +#define IDS_DIRECTPLAY8_SERIALSP 10107 +#define IDS_DIRECTPLAY8_IPXSP 10108 +#define IDS_DIRECTPLAY8_TCPSP 10109 +#define IDS_DIRECTPLAY_TCPCONN 10110 +#define IDS_DIRECTPLAY_IPXCONN 10111 +#define IDS_DIRECTPLAY_MODEMCONN 10112 +#define IDS_DIRECTPLAY_SERIALCONN 10113 +#define IDS_REG_FAIL 10114 +#define IDS_REG_SUCCESS 10115 /* icon resource constants */ #define IDI_APPICON 20000