display the advanced device properties

svn path=/trunk/; revision=19599
This commit is contained in:
Thomas Bluemel
2005-11-26 02:12:58 +00:00
parent 7740269260
commit a1bf8bb339
3 changed files with 99 additions and 15 deletions
+73 -11
View File
@@ -126,6 +126,70 @@ InitializeDevicesList(IN PHARDWARE_PAGE_DATA hpd)
}
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 @@ UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
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 @@ UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
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 @@ HardwareDlgProc(IN HWND hwndDlg,
case IDC_PROPERTIES:
{
/* FIXME - display the properties dialog for the currently
selected device */
DisplaySelectedDeviceProperties(hpd);
break;
}
}
+24 -2
View File
@@ -145,19 +145,41 @@ DeviceCreateHardwarePageEx(HWND hWndParent,
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
+2 -2
View File
@@ -640,9 +640,9 @@ DeviceAdvancedPropertiesW(HWND hWndParent,
int
WINAPI
DevicePropertiesExA(HWND hWndParent,
HINSTANCE hInst,
LPCSTR lpMachineName,
LPCSTR lpDeviceID,
HINSTANCE hInst,
DWORD Unknown)
{
UNIMPLEMENTED;
@@ -678,9 +678,9 @@ DevicePropertiesExA(HWND hWndParent,
int
WINAPI
DevicePropertiesExW(HWND hWndParent,
HINSTANCE hInst,
LPCWSTR lpMachineName,
LPCWSTR lpDeviceID,
HINSTANCE hInst,
DWORD Unknown)
{
UNIMPLEMENTED;