#define NDEBUG
#include <debug.h>
-typedef VOID (WINAPI *PINITCOMMONCONTROLS)(VOID);
-
-typedef enum
-{
- HWPD_STANDARDLIST = 0,
- HWPD_LARGELIST,
- HWPD_MAX = HWPD_LARGELIST
-} HWPAGE_DISPLAYMODE, *PHWPAGE_DISPLAYMODE;
-
typedef struct _HWDEVINFO
{
struct _HWCLASSDEVINFO *ClassDevInfo;
SP_DEVINFO_DATA DevInfoData;
+ BOOL HideDevice;
} HWDEVINFO, *PHWDEVINFO;
typedef struct _HWCLASSDEVINFO
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);
- }
+ Ret = DisplayDeviceAdvancedProperties(hpd->hWnd,
+ NULL,
+ HwDevInfo->ClassDevInfo->hDevInfo,
+ &HwDevInfo->DevInfoData,
+ hpd->hComCtl32,
+ NULL,
+ 0) != -1;
}
return Ret;
if (HwDevInfo != NULL)
{
/* update static controls */
- CONFIGRET cRet;
- DWORD RegDataType;
- ULONG DataSize;
WCHAR szBuffer[256];
LPWSTR szFormatted = NULL;
/* get the manufacturer string */
- if (!SetupDiGetDeviceRegistryProperty(HwDevInfo->ClassDevInfo->hDevInfo,
- &HwDevInfo->DevInfoData,
- SPDRP_MFG,
- &RegDataType,
- (PBYTE)szBuffer,
- sizeof(szBuffer),
- NULL) ||
- 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,
+ if (GetDeviceManufacturerString(HwDevInfo->ClassDevInfo->hDevInfo,
+ &HwDevInfo->DevInfoData,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0])) &&
+ LoadAndFormatString(hDllInstance,
IDS_MANUFACTURER,
&szFormatted,
szBuffer) != 0)
}
/* get the location string */
- DataSize = sizeof(szBuffer);
- cRet = CM_Get_DevNode_Registry_Property(HwDevInfo->DevInfoData.DevInst,
- CM_DRP_LOCATION_INFORMATION,
- &RegDataType,
- szBuffer,
- &DataSize,
- 0);
- if (cRet != CR_SUCCESS ||
- RegDataType != REG_SZ)
- {
- szBuffer[0] = L'\0';
- LoadString(hDllInstance,
- IDS_UNKNOWN,
- szBuffer,
- sizeof(szBuffer) / sizeof(szBuffer[0]));
- }
- /* FIXME - check string for NULL termination! */
-
- if (szBuffer[0] >= L'0' && szBuffer[0] <= L'9')
- {
- /* convert the string to an integer value and create a
- formatted string */
- ULONG ulLocation = (ULONG)wcstoul(szBuffer,
- NULL,
- 10);
- if (LoadAndFormatString(hDllInstance,
- IDS_LOCATIONSTR,
- &szFormatted,
- ulLocation,
- szBuffer) != 0)
- {
- wcsncpy(szBuffer,
- szFormatted,
- (sizeof(szBuffer) / sizeof(szBuffer[0])) - 1);
- szBuffer[(sizeof(szBuffer) / sizeof(szBuffer[0])) - 1] = L'\0';
- LocalFree((HLOCAL)szFormatted);
- }
- }
-
- if (LoadAndFormatString(hDllInstance,
+ if (GetDeviceLocationString(HwDevInfo->DevInfoData.DevInst,
+ 0,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0])) &&
+ LoadAndFormatString(hDllInstance,
IDS_LOCATION,
&szFormatted,
szBuffer) != 0)
LocalFree((HLOCAL)szFormatted);
}
- /* FIXME - get the device status text */
- LoadString(hDllInstance,
- IDS_UNKNOWN,
- szBuffer,
- sizeof(szBuffer) / sizeof(szBuffer[0]));
-
- if (LoadAndFormatString(hDllInstance,
+ if (GetDeviceStatusString(HwDevInfo->DevInfoData.DevInst,
+ NULL,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0])) &&
+ LoadAndFormatString(hDllInstance,
IDS_STATUS,
&szFormatted,
szBuffer) != 0)
ClassDevInfo->hDevInfo = SetupDiGetClassDevs(&ClassDevInfo->Guid,
NULL,
hpd->hWnd,
- DIGCF_PRESENT);
+ DIGCF_PRESENT | DIGCF_PROFILE);
if (ClassDevInfo->hDevInfo != INVALID_HANDLE_VALUE)
{
DWORD MemberIndex = 0;
MemberIndex++,
&DevInfoData))
{
+ BOOL HideDevice = FALSE;
+
if (ClassDevInfo->HwDevInfo != NULL)
{
PHWDEVINFO HwNewDevInfo = HeapReAlloc(GetProcessHeap(),
}
}
+ /* Find out if the device should be hidden by default */
+ IsDeviceHidden(DevInfoData.DevInst,
+ NULL,
+ &HideDevice);
+
/* save all information for the current device */
ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].ClassDevInfo = ClassDevInfo;
- ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount++].DevInfoData = DevInfoData;
+ ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].DevInfoData = DevInfoData;
+ ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount++].HideDevice = HideDevice;
}
}
while (HwDevInfo != LastHwDevInfo)
{
- DWORD RegDataType;
INT iItem;
LVITEM li;
/* get the device name */
- if ((SetupDiGetDeviceRegistryProperty(ClassDevInfo->hDevInfo,
- &HwDevInfo->DevInfoData,
- SPDRP_FRIENDLYNAME,
- &RegDataType,
- (PBYTE)szBuffer,
- sizeof(szBuffer),
- NULL) ||
- SetupDiGetDeviceRegistryProperty(ClassDevInfo->hDevInfo,
- &HwDevInfo->DevInfoData,
- SPDRP_DEVICEDESC,
- &RegDataType,
- (PBYTE)szBuffer,
- sizeof(szBuffer),
- NULL)) &&
- RegDataType == REG_SZ)
+ if (!HwDevInfo->HideDevice &&
+ GetDeviceDescriptionString(ClassDevInfo->hDevInfo,
+ &HwDevInfo->DevInfoData,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0])))
{
- /* FIXME - check string for NULL termination! */
-
li.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT | LVIF_IMAGE;
li.iItem = ItemCount;
li.iSubItem = 0;
ItemCount++;
/* get the device type for the second column */
- if (SetupDiGetClassDescription(&ClassDevInfo->Guid,
- szBuffer,
- sizeof(szBuffer) / sizeof(szBuffer[0]),
- NULL))
+ if (GetDeviceTypeString(&HwDevInfo->DevInfoData,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(szBuffer[0])))
{
li.mask = LVIF_TEXT;
li.iItem = iItem;
li.iSubItem = 1;
ListView_SetItem(hpd->hWndDevList,
- &li);
+ &li);
}
}
}
IN LPARAM lParam)
{
PHARDWARE_PAGE_DATA hpd;
+ INT_PTR Ret = FALSE;
hpd = (PHARDWARE_PAGE_DATA)GetWindowLongPtr(hwndDlg,
DWL_USER);
}
break;
}
+
+ case NM_DBLCLK:
+ {
+ DisplaySelectedDeviceProperties(hpd);
+ break;
+ }
}
}
break;
EnableTroubleShoot(hpd,
GetWindowTextLength(hwndDlg) != 0);
}
+ Ret = TRUE;
break;
}
}
}
- return FALSE;
+ return Ret;
}
* RETURN VALUE
* Returns the handle of the hardware page window that has been created or
* NULL if it failed.
+ *
+ * @implemented
*/
HWND
WINAPI
IN HWPAGE_DISPLAYMODE DisplayMode)
{
PHARDWARE_PAGE_DATA hpd;
- PINITCOMMONCONTROLS pInitCommonControls;
/* allocate the HARDWARE_PAGE_DATA structure. Make sure it is
zeroed because the initialization code assumes that in
}
/* load comctl32.dll dynamically */
- hpd->hComCtl32 = LoadLibrary(TEXT("comctl32.dll"));
+ hpd->hComCtl32 = LoadAndInitComctl32();
if (hpd->hComCtl32 == NULL)
{
goto Cleanup;
}
- /* initialize the common controls */
- pInitCommonControls = (PINITCOMMONCONTROLS)GetProcAddress(hpd->hComCtl32,
- "InitCommonControls");
- if (pInitCommonControls == NULL)
- {
- goto Cleanup;
- }
- pInitCommonControls();
-
/* create the dialog */
hWnd = CreateDialogParam(hDllInstance,
MAKEINTRESOURCE(IDD_HARDWARE),
* Returns the handle of the hardware page window that has been created or
* NULL if it failed.
*
- * REVISIONS
- *
- * NOTE
- *
+ * @implemented
*/
HWND
WINAPI