Author: janderwald
Date: Sun May 4 08:58:45 2008
New Revision: 33269
URL:
http://svn.reactos.org/svn/reactos?rev=33269&view=rev
Log:
- retrieve more information for DirectSound adapters
- use dxdiag parent window for dialogs which have pushbuttons
- restore window size after finishing DirectDraw tests
- use wsprintfW over swprintf- cut off build info from version string
Modified:
trunk/reactos/base/applications/dxdiag/display.c
trunk/reactos/base/applications/dxdiag/dxdiag.rbuild
trunk/reactos/base/applications/dxdiag/input.c
trunk/reactos/base/applications/dxdiag/lang/de-DE.rc
trunk/reactos/base/applications/dxdiag/lang/en-US.rc
trunk/reactos/base/applications/dxdiag/lang/fr-FR.rc
trunk/reactos/base/applications/dxdiag/lang/pl-PL.rc
trunk/reactos/base/applications/dxdiag/lang/ru-RU.rc
trunk/reactos/base/applications/dxdiag/network.c
trunk/reactos/base/applications/dxdiag/precomp.h
trunk/reactos/base/applications/dxdiag/sound.c
trunk/reactos/base/applications/dxdiag/system.c
Modified: trunk/reactos/base/applications/dxdiag/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/d…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/display.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/display.c [iso-8859-1] Sun May 4 08:58:45
2008
@@ -56,7 +56,7 @@
LPCWSTR pFile;
LPWSTR pBuffer;
LPCWSTR pFullPath = (LPCWSTR)Param1;
- WCHAR szVer[30];
+ WCHAR szVer[60];
LRESULT Length, fLength;
HWND * hDlgCtrls = (HWND *)Context;
@@ -158,38 +158,65 @@
SetupCloseFileQueue(hQueue);
}
+static
+void
+SetDeviceDetails(HWND * hDlgCtrls, LPCGUID classGUID, LPGUID * deviceGUID)
+{
+ HDEVINFO hInfo;
+ DWORD dwIndex = 0;
+ SP_DEVINFO_DATA InfoData;
+ WCHAR szText[100];
+
+ /* create the setup list */
+ hInfo = SetupDiGetClassDevsW(classGUID, NULL, NULL, DIGCF_PRESENT|DIGCF_PROFILE);
+ if (hInfo == INVALID_HANDLE_VALUE)
+ return;
+
+ do
+ {
+ ZeroMemory(&InfoData, sizeof(InfoData));
+ InfoData.cbSize = sizeof(InfoData);
+
+ if (SetupDiEnumDeviceInfo(hInfo, dwIndex, &InfoData))
+ {
+ /* set device name */
+ if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_DEVICEDESC,
NULL, (PBYTE)szText, sizeof(szText), NULL))
+ SendMessageW(hDlgCtrls[0], WM_SETTEXT, 0, (LPARAM)szText);
+
+ /* set the manufacturer name */
+ if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_MFG, NULL,
(PBYTE)szText, sizeof(szText), NULL))
+ SendMessageW(hDlgCtrls[1], WM_SETTEXT, 0, (LPARAM)szText);
+
+ /* FIXME
+ * we currently enumerate only the first adapter
+ */
+ EnumerateDrivers(&hDlgCtrls[2], hInfo, &InfoData);
+ break;
+ }
+
+ if (GetLastError() == ERROR_NO_MORE_ITEMS)
+ break;
+
+ dwIndex++;
+ }while(TRUE);
+
+ /* destroy the setup list */
+ SetupDiDestroyDeviceInfoList(hInfo);
+}
+
static
BOOL
-InitializeDialog(HWND hwndDlg)
-{
- HDEVINFO hInfo;
- SP_DEVICE_INTERFACE_DATA InterfaceData;
- SP_DEVINFO_DATA InfoData;
- DWORD dwIndex = 0;
+InitializeDialog(HWND hwndDlg, PDISPLAY_DEVICEW pDispDevice)
+{
WCHAR szText[100];
WCHAR szFormat[30];
HKEY hKey;
- HWND hDlgCtrls[3];
+ HWND hDlgCtrls[5];
DWORD dwMemory;
DEVMODE DevMode;
- DISPLAY_DEVICEW DispDevice;
-
- /// FIXME
- /// use initialization context
- ///
- ZeroMemory(&DispDevice, sizeof(DISPLAY_DEVICEW));
- DispDevice.cb = sizeof(DISPLAY_DEVICEW);
- if (!EnumDisplayDevicesW(NULL, 0, &DispDevice, 0))
- return FALSE;
-
- /* query display device adapter */
- ZeroMemory(&DispDevice, sizeof(DISPLAY_DEVICEW));
- DispDevice.cb = sizeof(DISPLAY_DEVICEW);
- if (!EnumDisplayDevicesW(NULL, 0, &DispDevice, 0))
- return FALSE;
-
- if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, &DispDevice.DeviceKey[18], 0, KEY_READ,
&hKey) != ERROR_SUCCESS)
+
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, &pDispDevice->DeviceKey[18], 0,
KEY_READ, &hKey) != ERROR_SUCCESS)
return FALSE;
if (GetRegValue(hKey, NULL, L"HardwareInformation.ChipType", REG_BINARY,
szText, sizeof(szText)))
@@ -215,70 +242,38 @@
szFormat[0] = L'\0';
if (LoadStringW(hInst, IDS_FORMAT_ADAPTER_MEM, szFormat,
sizeof(szFormat)/sizeof(WCHAR)))
szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
- swprintf(szText, szFormat, dwMemory);
+ wsprintfW(szText, szFormat, dwMemory);
SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MEM, WM_SETTEXT, 0,
(LPARAM)szText);
}
/* retrieve current display mode */
DevMode.dmSize = sizeof(DEVMODE);
- if (EnumDisplaySettingsW(DispDevice.DeviceName, ENUM_CURRENT_SETTINGS,
&DevMode))
+ if (EnumDisplaySettingsW(pDispDevice->DeviceName, ENUM_CURRENT_SETTINGS,
&DevMode))
{
szFormat[0] = L'\0';
if (LoadStringW(hInst, IDS_FORMAT_ADAPTER_MODE, szFormat,
sizeof(szFormat)/sizeof(WCHAR)))
szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
- swprintf(szText, szFormat, DevMode.dmPelsWidth, DevMode.dmPelsHeight,
DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency);
+ wsprintfW(szText, szFormat, DevMode.dmPelsWidth, DevMode.dmPelsHeight,
DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency);
SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MODE, WM_SETTEXT, 0,
(LPARAM)szText);
}
/* query attached monitor */
- wcscpy(szText, DispDevice.DeviceName);
- ZeroMemory(&DispDevice, sizeof(DISPLAY_DEVICEW));
- DispDevice.cb = sizeof(DISPLAY_DEVICEW);
- if (EnumDisplayDevicesW(szText, 0, &DispDevice, 0))
+ wcscpy(szText, pDispDevice->DeviceName);
+ ZeroMemory(pDispDevice, sizeof(DISPLAY_DEVICEW));
+ pDispDevice->cb = sizeof(DISPLAY_DEVICEW);
+ if (EnumDisplayDevicesW(szText, 0, pDispDevice, 0))
{
/* set monitor name */
- SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MONITOR, WM_SETTEXT, 0,
(LPARAM)DispDevice.DeviceString);
- }
-
-
- hInfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_DISPLAY, NULL, hwndDlg,
DIGCF_PRESENT|DIGCF_PROFILE);
- if (hInfo == INVALID_HANDLE_VALUE)
- return FALSE;
-
- do
- {
- ZeroMemory(&InterfaceData, sizeof(InterfaceData));
- InterfaceData.cbSize = sizeof(InterfaceData);
- InfoData.cbSize = sizeof(InfoData);
-
- if (SetupDiEnumDeviceInfo(hInfo, dwIndex, &InfoData))
- {
- /* set device name */
- if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_DEVICEDESC,
NULL, (PBYTE)szText, sizeof(szText), NULL))
- SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_ID, WM_SETTEXT, 0,
(LPARAM)szText);
-
- /* set the manufacturer name */
- if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_MFG, NULL,
(PBYTE)szText, sizeof(szText), NULL))
- SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_VENDOR, WM_SETTEXT, 0,
(LPARAM)szText);
-
- /* FIXME
- * we currently enumerate only the first adapter
- */
- hDlgCtrls[0] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DRIVER);
- hDlgCtrls[1] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VERSION);
- hDlgCtrls[2] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DATE);
- EnumerateDrivers(hDlgCtrls, hInfo, &InfoData);
- break;
- }
-
- if (GetLastError() == ERROR_NO_MORE_ITEMS)
- break;
-
- dwIndex++;
- }while(TRUE);
-
-
- SetupDiDestroyDeviceInfoList(hInfo);
+ SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MONITOR, WM_SETTEXT, 0,
(LPARAM)pDispDevice->DeviceString);
+ }
+
+ hDlgCtrls[0] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_ID);
+ hDlgCtrls[1] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VENDOR);
+ hDlgCtrls[2] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DRIVER);
+ hDlgCtrls[3] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VERSION);
+ hDlgCtrls[4] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DATE);
+
+ SetDeviceDetails(hDlgCtrls, &GUID_DEVCLASS_DISPLAY, NULL);
return TRUE;
}
@@ -313,15 +308,18 @@
break;
pContext->hDisplayWnd = hDlgs;
- hwndDlg = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_DISPLAY_DIALOG),
pContext->hTabCtrl, DisplayPageWndProc, (LPARAM)pContext);
+ hwndDlg = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_DISPLAY_DIALOG),
pContext->hMainDialog, DisplayPageWndProc, (LPARAM)pContext);
if (!hwndDlg)
break;
+
+ /* initialize the dialog */
+ InitializeDialog(hwndDlg, &DispDevice);
szDisplay[0] = L'\0';
LoadStringW(hInst, IDS_DISPLAY_DIALOG, szDisplay,
sizeof(szDisplay)/sizeof(WCHAR));
szDisplay[(sizeof(szDisplay)/sizeof(WCHAR))-1] = L'\0';
- swprintf (szText, L"%s %u", szDisplay, pContext->NumDisplayAdapter +
1);
+ wsprintfW (szText, L"%s %u", szDisplay, pContext->NumDisplayAdapter
+ 1);
InsertTabCtrlItem(GetDlgItem(pContext->hMainDialog, IDC_TAB_CONTROL),
pContext->NumDisplayAdapter + 1, szText);
hDlgs[pContext->NumDisplayAdapter] = hwndDlg;
@@ -335,6 +333,7 @@
INT_PTR CALLBACK
DisplayPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
+ RECT rect;
PDXDIAG_CONTEXT pContext = (PDXDIAG_CONTEXT)GetWindowLongPtr(hDlg, DWLP_USER);
switch (message)
{
@@ -343,7 +342,6 @@
pContext = (PDXDIAG_CONTEXT) lParam;
SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pContext);
SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER |
SWP_NOSIZE | SWP_NOZORDER);
- InitializeDialog(hDlg);
return TRUE;
}
case WM_COMMAND:
@@ -351,9 +349,10 @@
switch(LOWORD(wParam))
{
case IDC_BUTTON_TESTDD:
+ GetWindowRect(pContext->hMainDialog, &rect);
/* FIXME log result errors */
DDTests();
- /* FIXME resize window */
+ SetWindowPos(pContext->hMainDialog, NULL, rect.left, rect.top,
rect.right, rect.bottom, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
break;
}
break;
Modified: trunk/reactos/base/applications/dxdiag/dxdiag.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/d…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/dxdiag.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/dxdiag.rbuild [iso-8859-1] Sun May 4 08:58:45
2008
@@ -19,6 +19,7 @@
<library>ddraw</library>
<library>version</library>
<library>gdi32</library>
+ <library>winmm</library>
<file>system.c</file>
<file>display.c</file>
<file>sound.c</file>
Modified: trunk/reactos/base/applications/dxdiag/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/i…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/input.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/input.c [iso-8859-1] Sun May 4 08:58:45 2008
@@ -82,12 +82,12 @@
{
/* set manufacturer id */
dwManufacturerID = LOWORD(VendorID.dwData);
- swprintf(szText, L"0x%04X", dwManufacturerID);
+ wsprintfW(szText, L"0x%04X", dwManufacturerID);
Item.iSubItem = 3;
SendMessageW(pContext->hDevList, LVM_SETITEM, lResult, (LPARAM)&Item);
/* set product id */
dwProductID = HIWORD(VendorID.dwData);
- swprintf(szText, L"0x%04X", dwProductID);
+ wsprintfW(szText, L"0x%04X", dwProductID);
Item.iSubItem = 4;
SendMessageW(pContext->hDevList, LVM_SETITEM, lResult, (LPARAM)&Item);
}
Modified: trunk/reactos/base/applications/dxdiag/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/l…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/lang/de-DE.rc [iso-8859-1] Sun May 4 08:58:45
2008
@@ -130,7 +130,7 @@
LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10
LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10
GROUPBOX "ReactX-Funktionen", -1, 10, 115, 450, 60
- CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
WS_TABSTOP, 120, 135, 80, 17
+ CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17
RTEXT "Einstellung der Sound-\nhardwarebeschleunigung:", -1, 20, 135, 90,
20
PUSHBUTTON "DirectSound testen", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 13
GROUPBOX "Hinweise", -1, 10, 180, 450, 40
Modified: trunk/reactos/base/applications/dxdiag/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/l…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/lang/en-US.rc [iso-8859-1] Sun May 4 08:58:45
2008
@@ -130,7 +130,7 @@
LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10
LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10
GROUPBOX "ReactX-Features", -1, 10, 115, 450, 60
- CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
WS_TABSTOP, 120, 135, 80, 17
+ CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17
RTEXT "Hardware Sound\nAcceleration Level:", -1, 20, 135, 90, 20
PUSHBUTTON "Test DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 13
GROUPBOX "Notes", -1, 10, 180, 450, 40
Modified: trunk/reactos/base/applications/dxdiag/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/l…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/lang/fr-FR.rc [iso-8859-1] Sun May 4 08:58:45
2008
@@ -130,7 +130,7 @@
LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10
LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10
GROUPBOX "ReactX-Features", -1, 10, 115, 450, 60
- CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
WS_TABSTOP, 120, 135, 80, 17
+ CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17
RTEXT "Hardware Sound\nAcceleration Level:", -1, 20, 135, 90, 20
PUSHBUTTON "Test DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 13
GROUPBOX "Notes", -1, 10, 180, 450, 40
Modified: trunk/reactos/base/applications/dxdiag/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/l…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/lang/pl-PL.rc [iso-8859-1] Sun May 4 08:58:45
2008
@@ -137,7 +137,7 @@
LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10
LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10
GROUPBOX "ReactX-", -1, 10, 115, 450, 60
- CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
WS_TABSTOP, 120, 135, 80, 17
+ CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17
RTEXT "Przyspiesznie sprzêtowe\nPoziom:", -1, 20, 135, 90, 20
PUSHBUTTON "Testuj DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 13
GROUPBOX "Uwagi", -1, 10, 180, 450, 40
Modified: trunk/reactos/base/applications/dxdiag/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/l…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/lang/ru-RU.rc [iso-8859-1] Sun May 4 08:58:45
2008
@@ -130,7 +130,7 @@
LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10
LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10
GROUPBOX "ReactX-Features", -1, 10, 115, 450, 60
- CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
WS_TABSTOP, 120, 135, 80, 17
+ CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM |
TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17
RTEXT "Hardware Sound\nAcceleration Level:", -1, 20, 135, 90, 20
PUSHBUTTON "Test DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 13
GROUPBOX "Notes", -1, 10, 180, 450, 40
Modified: trunk/reactos/base/applications/dxdiag/network.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/n…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/network.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/network.c [iso-8859-1] Sun May 4 08:58:45
2008
@@ -111,6 +111,7 @@
WCHAR szBuffer[100];
WCHAR * pResult;
BOOL bResult = FALSE;
+ BOOL bVer;
static const WCHAR wFormat[] = L"\\StringFileInfo\\%04x%04x\\FileVersion";
static const WCHAR wTranslation[] = L"VarFileInfo\\Translation";
@@ -145,14 +146,20 @@
code = lplangcode->code;
}
/* set up format */
- swprintf(szBuffer, wFormat, lang, code);
+ wsprintfW(szBuffer, wFormat, lang, code);
/* query manufacturer */
pResult = NULL;
- bResult = VerQueryValueW(pBuf, szBuffer, (LPVOID *)&pResult, &VerSize);
-
- if (VerSize < szVerSize && bResult && pResult)
+ bVer = VerQueryValueW(pBuf, szBuffer, (LPVOID *)&pResult, &VerSize);
+
+ if (VerSize < szVerSize && bVer && pResult)
{
wcscpy(szVer, pResult);
+ pResult = wcschr(szVer, L' ');
+ if (pResult)
+ {
+ /* cut off build info */
+ VerSize = (pResult - szVer);
+ }
if (GetLocaleInfoW(MAKELCID(lang, SORT_DEFAULT), LOCALE_SLANGUAGE,
&szVer[VerSize], szVerSize-VerSize))
{
szVer[VerSize-1] = L' ';
Modified: trunk/reactos/base/applications/dxdiag/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/p…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/precomp.h [iso-8859-1] Sun May 4 08:58:45
2008
@@ -9,12 +9,14 @@
#include <stdio.h>
#include <windows.h>
#include <limits.h>
+#include <mmsystem.h>
#include <setupapi.h>
#include <commctrl.h>
#include <dinput.h>
#include <ddraw.h>
#include <dsound.h>
+#include <mmreg.h>
#include "resource.h"
typedef struct
@@ -45,7 +47,7 @@
BOOL GetRegValue(HKEY hBaseKey, LPWSTR SubKey, LPWSTR ValueName, DWORD Type, LPWSTR
Result, DWORD Size);
VOID InsertTabCtrlItem(HWND hDlgCtrl, INT Position, LPWSTR uId);
-
+VOID EnumerateDrivers(PVOID Context, HDEVINFO hList, PSP_DEVINFO_DATA pInfoData);
/* DirectDraw tests */
VOID DDTests();
Modified: trunk/reactos/base/applications/dxdiag/sound.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/s…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/sound.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/sound.c [iso-8859-1] Sun May 4 08:58:45 2008
@@ -8,6 +8,97 @@
*/
#include "precomp.h"
+//#include <initguid.h>
+#include <devguid.h>
+
+static
+void
+SetDeviceDetails(HWND hwndDlg, LPCGUID classGUID, LPCWSTR lpcstrDescription)
+{
+ HDEVINFO hInfo;
+ DWORD dwIndex = 0;
+ SP_DEVINFO_DATA InfoData;
+ WCHAR szText[100];
+ HWND hDlgCtrls[3];
+ WAVEOUTCAPSW waveOut;
+ UINT numDev;
+ MMRESULT errCode;
+
+ /* enumerate waveout devices */
+ numDev = waveOutGetNumDevs();
+ if (numDev)
+ {
+ do
+ {
+ ZeroMemory(&waveOut, sizeof(waveOut));
+ errCode = waveOutGetDevCapsW(dwIndex++, &waveOut, sizeof(waveOut));
+ if (!wcsncmp(lpcstrDescription, waveOut.szPname, min(MAXPNAMELEN,
wcslen(waveOut.szPname))))
+ {
+ /* set the product id */
+ SetDlgItemInt(hwndDlg, IDC_STATIC_DSOUND_PRODUCTID, waveOut.wPid,
FALSE);
+ /* set the vendor id */
+ SetDlgItemInt(hwndDlg, IDC_STATIC_DSOUND_VENDORID, waveOut.wMid,
FALSE);
+ /* check if its a wdm audio driver */
+ if (waveOut.wPid == MM_MSFT_WDMAUDIO_WAVEOUT)
+ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_TYPE, WM_SETTEXT,
0, (LPARAM)L"WDM");
+
+ /* check if device is default device */
+ szText[0] = L'\0';
+ if (dwIndex - 1 == 0) /* FIXME assume default playback device is
device 0 */
+ LoadStringW(hInst, IDS_OPTION_YES, szText,
sizeof(szText)/sizeof(WCHAR));
+ else
+ LoadStringW(hInst, IDS_OPTION_NO, szText,
sizeof(szText)/sizeof(WCHAR));
+
+ szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
+ /* set default device info */
+ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_STANDARD, WM_SETTEXT,
0, (LPARAM)szText);
+ break;
+ }
+ }while(errCode == MMSYSERR_NOERROR && dwIndex < numDev);
+ }
+
+ dwIndex = 0;
+ /* create the setup list */
+ hInfo = SetupDiGetClassDevsW(classGUID, NULL, NULL, DIGCF_PRESENT|DIGCF_PROFILE);
+ if (hInfo == INVALID_HANDLE_VALUE)
+ return;
+
+ do
+ {
+ ZeroMemory(&InfoData, sizeof(InfoData));
+ InfoData.cbSize = sizeof(InfoData);
+
+ if (SetupDiEnumDeviceInfo(hInfo, dwIndex, &InfoData))
+ {
+ /* set device name */
+ if (SetupDiGetDeviceInstanceId(hInfo, &InfoData, szText,
sizeof(szText)/sizeof(WCHAR), NULL))
+ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_DEVICEID, WM_SETTEXT, 0,
(LPARAM)szText);
+
+ /* set the manufacturer name */
+ if (SetupDiGetDeviceRegistryPropertyW(hInfo, &InfoData, SPDRP_MFG, NULL,
(PBYTE)szText, sizeof(szText), NULL))
+ SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_PROVIDER, WM_SETTEXT, 0,
(LPARAM)szText);
+
+ /* FIXME
+ * we currently enumerate only the first adapter
+ */
+ hDlgCtrls[0] = GetDlgItem(hwndDlg, IDC_STATIC_DSOUND_DRIVER);
+ hDlgCtrls[1] = GetDlgItem(hwndDlg, IDC_STATIC_DSOUND_VERSION);
+ hDlgCtrls[2] = GetDlgItem(hwndDlg, IDC_STATIC_DSOUND_DATE);
+ EnumerateDrivers(hDlgCtrls, hInfo, &InfoData);
+ break;
+ }
+
+ if (GetLastError() == ERROR_NO_MORE_ITEMS)
+ break;
+
+ dwIndex++;
+ }while(TRUE);
+
+ /* destroy the setup list */
+ SetupDiDestroyDeviceInfoList(hInfo);
+}
+
+
BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription, LPCWSTR
lpcstrModule, LPVOID lpContext)
{
@@ -29,22 +120,35 @@
return FALSE;
pContext->hSoundWnd = hDlgs;
- hwndDlg = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_SOUND_DIALOG),
pContext->hTabCtrl, SoundPageWndProc, (LPARAM)pContext);
+ hwndDlg = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_SOUND_DIALOG),
pContext->hMainDialog, SoundPageWndProc, (LPARAM)pContext);
if (!hwndDlg)
return FALSE;
+ /* set device name */
+ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_NAME, WM_SETTEXT, 0,
(LPARAM)lpcstrDescription);
+
+ /* set range for slider */
+ SendDlgItemMessageW(hwndDlg, IDC_SLIDER_DSOUND, TBM_SETRANGE, TRUE, MAKELONG(0, 3));
+
+ /* FIXME set correct position */
+ SendDlgItemMessageW(hwndDlg, IDC_SLIDER_DSOUND, TBM_SETSEL, FALSE, 0);
+
+ /* set further device details */
+ SetDeviceDetails(hwndDlg, &GUID_DEVCLASS_MEDIA, lpcstrDescription);
+
+
+
+ /* load sound resource string */
szSound[0] = L'\0';
LoadStringW(hInst, IDS_SOUND_DIALOG, szSound, sizeof(szSound)/sizeof(WCHAR));
szSound[(sizeof(szSound)/sizeof(WCHAR))-1] = L'\0';
-
- swprintf (szText, L"%s %u", szSound, pContext->NumSoundAdapter + 1);
-
-
+ /* output the device id */
+ wsprintfW (szText, L"%s %u", szSound, pContext->NumSoundAdapter + 1);
+ /* insert it into general tab */
InsertTabCtrlItem(pContext->hTabCtrl, pContext->NumDisplayAdapter +
pContext->NumSoundAdapter + 1, szText);
-
+ /* store dialog window */
hDlgs[pContext->NumSoundAdapter] = hwndDlg;
pContext->NumSoundAdapter++;
-
return TRUE;
}
@@ -68,14 +172,20 @@
INT_PTR CALLBACK
SoundPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
- switch (message) {
+ switch (message)
+ {
case WM_INITDIALOG:
{
SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER |
SWP_NOSIZE | SWP_NOZORDER);
- //InitializeDirectSoundPage(hDlg);
return TRUE;
+ }
+ case WM_COMMAND:
+ {
+ if (LOWORD(wParam) == IDC_BUTTON_TESTDSOUND)
+ {
+ return FALSE;
+ }
+ break;
}
}
Modified: trunk/reactos/base/applications/dxdiag/system.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/s…
==============================================================================
--- trunk/reactos/base/applications/dxdiag/system.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/dxdiag/system.c [iso-8859-1] Sun May 4 08:58:45 2008
@@ -108,28 +108,28 @@
switch(Length)
{
case PRODUCT_ULTIMATE:
- swprintf(szBuffer, L"Windows Vista Ultimate (6.0, Build
%04u)", info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Ultimate (6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
case PRODUCT_HOME_BASIC:
- swprintf(szBuffer, L"Windows Vista Home Basic (6.0, Build
%04u)", info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Home Basic (6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
case PRODUCT_HOME_PREMIUM:
- swprintf(szBuffer, L"Windows Vista Home Premimum (6.0, Build
%04u)", info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Home Premimum (6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
case PRODUCT_ENTERPRISE:
- swprintf(szBuffer, L"Windows Vista Enterprise (6.0, Build
%04u)", info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Enterprise (6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
case PRODUCT_HOME_BASIC_N:
- swprintf(szBuffer, L"Windows Vista Home Basic N(6.0, Build
%04u)", info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Home Basic N(6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
case PRODUCT_BUSINESS:
- swprintf(szBuffer, L"Windows Vista Business(6.0, Build %04u)",
info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Business(6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
case PRODUCT_STARTER:
- swprintf(szBuffer, L"Windows Vista Starter(6.0, Build %04u)",
info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Starter(6.0, Build %04u)",
info.dwBuildNumber);
return TRUE;
case PRODUCT_BUSINESS_N:
- swprintf(szBuffer, L"Windows Vista Business N(6.0, Build
%04u)", info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista Business N(6.0, Build
%04u)", info.dwBuildNumber);
return TRUE;
default:
return FALSE;
@@ -189,7 +189,7 @@
// if (GetVistaVersion(szBuffer))
// return TRUE;
- swprintf(szBuffer, L"Windows Vista (6.0, Build %04u)",
info.dwBuildNumber);
+ wsprintfW(szBuffer, L"Windows Vista (6.0, Build %04u)",
info.dwBuildNumber);
return TRUE;
}
}
@@ -295,7 +295,7 @@
LoadStringW(hInst, IDS_FORMAT_UNIPROC, szFormat, sizeof(szFormat) /
sizeof(WCHAR));
szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
- swprintf(szTime, szFormat, szDesc, SysInfo.dwNumberOfProcessors);
+ wsprintfW(szTime, szFormat, szDesc, SysInfo.dwNumberOfProcessors);
SendDlgItemMessageW(hwndDlg, IDC_STATIC_PROC, WM_SETTEXT, 0, (LPARAM)szTime);
}
@@ -308,7 +308,7 @@
{
/* set total mem string */
szFormat[(sizeof(szFormat) / sizeof(WCHAR))-1] = L'\0';
- swprintf(szTime, szFormat, (mem.ullTotalPhys/1048576));
+ wsprintfW(szTime, szFormat, (mem.ullTotalPhys/1048576));
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MEM, WM_SETTEXT, 0, (LPARAM)szTime);
}
@@ -319,7 +319,7 @@
UsedBytes = (mem.ullTotalPageFile-mem.ullAvailPageFile)/1048576;
szFormat[(sizeof(szFormat) / sizeof(WCHAR))-1] = L'\0';
- swprintf(szTime, szFormat, (UsedBytes), (AvailableBytes));
+ wsprintfW(szTime, szFormat, (UsedBytes), (AvailableBytes));
SendDlgItemMessageW(hwndDlg, IDC_STATIC_SWAP, WM_SETTEXT, 0,
(LPARAM)szTime);
}
}