--- trunk/reactos/lib/devmgr/hwpage.c 2005-11-26 01:56:07 UTC (rev 19598)
+++ trunk/reactos/lib/devmgr/hwpage.c 2005-11-26 02:12:58 UTC (rev 19599)
@@ -126,6 +126,70 @@
}
+static BOOL
+DisplaySelectedDeviceProperties(IN PHARDWARE_PAGE_DATA hpd)
+{
+ PHWDEVINFO HwDevInfo;
+ BOOL Ret = FALSE;
+
+ HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
+ if (HwDevInfo != NULL)
+ {
+ PWSTR szDeviceInstanceId = NULL;
+ DWORD DeviceInstanceIdLen = 0;
+
+ /* find out how much size is needed for the buffer */
+ if (SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
+ &HwDevInfo->DevInfoData,
+ NULL,
+ 0,
+ &DeviceInstanceIdLen))
+ {
+ DPRINT1("SetupDiGetDeviceInterfaceDetail unexpectedly returned TRUE!\n");
+ goto Cleanup;
+ }
+
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ {
+ goto Cleanup;
+ }
+
+ szDeviceInstanceId = HeapAlloc(GetProcessHeap(),
+ 0,
+ DeviceInstanceIdLen * sizeof(WCHAR));
+ if (szDeviceInstanceId == NULL)
+ {
+ goto Cleanup;
+ }
+
+ /* read the device instance id */
+ if (!SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
+ &HwDevInfo->DevInfoData,
+ szDeviceInstanceId,
+ DeviceInstanceIdLen,
+ &DeviceInstanceIdLen))
+ {
+ goto Cleanup;
+ }
+
+ /* display the properties dialog */
+ Ret = DeviceAdvancedProperties(hpd->hWnd,
+ NULL,
+ szDeviceInstanceId) >= 0;
+
+Cleanup:
+ if (szDeviceInstanceId != NULL)
+ {
+ HeapFree(GetProcessHeap(),
+ 0,
+ szDeviceInstanceId);
+ }
+ }
+
+ return Ret;
+}
+
+
static VOID
UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
{
@@ -158,6 +222,10 @@
RegDataType != REG_SZ)
{
szBuffer[0] = L'\0';
+ LoadString(hDllInstance,
+ IDS_UNKNOWN,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0]));
}
/* FIXME - check string for NULL termination! */
if (LoadAndFormatString(hDllInstance,
@@ -183,15 +251,10 @@
RegDataType != REG_SZ)
{
szBuffer[0] = L'\0';
-
- if (cRet == CR_NO_SUCH_REGISTRY_KEY ||
- cRet == CR_NO_SUCH_VALUE)
- {
- LoadString(hDllInstance,
- IDS_UNKNOWN,
- szBuffer,
- sizeof(szBuffer) / sizeof(szBuffer[0]));
- }
+ LoadString(hDllInstance,
+ IDS_UNKNOWN,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0]));
}
/* FIXME - check string for NULL termination! */
@@ -756,8 +819,7 @@
case IDC_PROPERTIES:
{
- /* FIXME - display the properties dialog for the currently
- selected device */
+ DisplaySelectedDeviceProperties(hpd);
break;
}
}
--- trunk/reactos/lib/devmgr/precomp.h 2005-11-26 01:56:07 UTC (rev 19598)
+++ trunk/reactos/lib/devmgr/precomp.h 2005-11-26 02:12:58 UTC (rev 19599)
@@ -145,19 +145,41 @@
int
WINAPI
DevicePropertiesExA(HWND hWndParent,
- HINSTANCE hInst,
LPCSTR lpMachineName,
LPCSTR lpDeviceID,
+ HINSTANCE hInst,
DWORD Unknown);
int
WINAPI
DevicePropertiesExW(HWND hWndParent,
- HINSTANCE hInst,
LPCWSTR lpMachineName,
LPCWSTR lpDeviceID,
+ HINSTANCE hInst,
DWORD Unknown);
+#ifdef UNICODE
+#define DeviceManager_Execute DeviceManager_ExecuteW
+#define DeviceProperties_RunDLL DeviceProperties_RunDLLW
+#define DeviceProperties DevicePropertiesW
+#define DeviceProblemText DeviceProblemTextW
+#define DeviceProblemWizard DeviceProblemWizardW
+#define DeviceProblemWizard_RunDLL DeviceProblemWizard_RunDLLW
+#define DeviceManagerPrint DeviceManagerPrintW
+#define DeviceAdvancedProperties DeviceAdvancedPropertiesW
+#define DevicePropertiesEx DevicePropertiesExW
+#else
+#define DeviceManager_Execute DeviceManager_ExecuteA
+#define DeviceProperties_RunDLL DeviceProperties_RunDLLA
+#define DeviceProperties DevicePropertiesA
+#define DeviceProblemText DeviceProblemTextA
+#define DeviceProblemWizard DeviceProblemWizardA
+#define DeviceProblemWizard_RunDLL DeviceProblemWizard_RunDLLA
+#define DeviceManagerPrint DeviceManagerPrintA
+#define DeviceAdvancedProperties DeviceAdvancedPropertiesA
+#define DevicePropertiesEx DevicePropertiesExA
+#endif
+
/* MISC.C */
DWORD
--- trunk/reactos/lib/devmgr/stubs.c 2005-11-26 01:56:07 UTC (rev 19598)
+++ trunk/reactos/lib/devmgr/stubs.c 2005-11-26 02:12:58 UTC (rev 19599)
@@ -640,9 +640,9 @@
int
WINAPI
DevicePropertiesExA(HWND hWndParent,
- HINSTANCE hInst,
LPCSTR lpMachineName,
LPCSTR lpDeviceID,
+ HINSTANCE hInst,
DWORD Unknown)
{
UNIMPLEMENTED;
@@ -678,9 +678,9 @@
int
WINAPI
DevicePropertiesExW(HWND hWndParent,
- HINSTANCE hInst,
LPCWSTR lpMachineName,
LPCWSTR lpDeviceID,
+ HINSTANCE hInst,
DWORD Unknown)
{
UNIMPLEMENTED;