ReactOS 0.4.15-dev-8100-g1887773
hwpage.cpp File Reference
#include "precomp.h"
#include "properties.h"
#include "resource.h"
Include dependency graph for hwpage.cpp:

Go to the source code of this file.

Classes

struct  _HWDEVINFO
 
struct  _HWCLASSDEVINFO
 
struct  _HARDWARE_PAGE_DATA
 

Macros

#define CX_TYPECOLUMN_WIDTH   80
 

Typedefs

typedef struct _HWDEVINFO HWDEVINFO
 
typedef struct _HWDEVINFOPHWDEVINFO
 
typedef struct _HWCLASSDEVINFO HWCLASSDEVINFO
 
typedef struct _HWCLASSDEVINFOPHWCLASSDEVINFO
 
typedef struct _HARDWARE_PAGE_DATA HARDWARE_PAGE_DATA
 
typedef struct _HARDWARE_PAGE_DATAPHARDWARE_PAGE_DATA
 

Functions

static VOID InitializeDevicesList (IN PHARDWARE_PAGE_DATA hpd)
 
static BOOL DisplaySelectedDeviceProperties (IN PHARDWARE_PAGE_DATA hpd)
 
static VOID UpdateControlStates (IN PHARDWARE_PAGE_DATA hpd)
 
static VOID FreeDevicesList (IN PHARDWARE_PAGE_DATA hpd)
 
static VOID BuildDevicesList (IN PHARDWARE_PAGE_DATA hpd)
 
static BOOL DeviceIdMatch (IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN LPCWSTR lpDeviceId)
 
static VOID FillDevicesListViewControl (IN PHARDWARE_PAGE_DATA hpd, IN LPCWSTR lpSelectDeviceId OPTIONAL, IN GUID *SelectedClassGuid OPTIONAL)
 
static VOID UpdateDevicesListViewControl (IN PHARDWARE_PAGE_DATA hpd)
 
static LRESULT CALLBACK ParentSubWndProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID HardwareDlgResize (IN PHARDWARE_PAGE_DATA hpd, IN INT cx, IN INT cy)
 
static VOID EnableTroubleShoot (PHARDWARE_PAGE_DATA hpd, BOOL Enable)
 
static INT_PTR CALLBACK HardwareDlgProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
HWND WINAPI DeviceCreateHardwarePageEx (IN HWND hWndParent, IN LPGUID lpGuids, IN UINT uNumberOfGuids, IN HWPAGE_DISPLAYMODE DisplayMode)
 
HWND WINAPI DeviceCreateHardwarePage (IN HWND hWndParent, IN LPGUID lpGuid)
 

Macro Definition Documentation

◆ CX_TYPECOLUMN_WIDTH

#define CX_TYPECOLUMN_WIDTH   80

Definition at line 67 of file hwpage.cpp.

Typedef Documentation

◆ HARDWARE_PAGE_DATA

◆ HWCLASSDEVINFO

◆ HWDEVINFO

◆ PHARDWARE_PAGE_DATA

◆ PHWCLASSDEVINFO

◆ PHWDEVINFO

Function Documentation

◆ BuildDevicesList()

static VOID BuildDevicesList ( IN PHARDWARE_PAGE_DATA  hpd)
static

Definition at line 270 of file hwpage.cpp.

271{
272 PHWCLASSDEVINFO ClassDevInfo, LastClassDevInfo;
273 SP_DEVINFO_DATA DevInfoData;
274
275 DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
276
277 ClassDevInfo = hpd->ClassDevInfo;
278 LastClassDevInfo = ClassDevInfo + hpd->NumberOfGuids;
279
280 while (ClassDevInfo != LastClassDevInfo)
281 {
282 ClassDevInfo->ImageIndex = -1;
283
284 /* open a class device handle for the GUID we're processing */
285 ClassDevInfo->hDevInfo = SetupDiGetClassDevs(&ClassDevInfo->Guid,
286 NULL,
287 hpd->hWnd,
289 if (ClassDevInfo->hDevInfo != INVALID_HANDLE_VALUE)
290 {
291 DWORD MemberIndex = 0;
292
293 SetupDiGetClassImageIndex(&hpd->ClassImageListData,
294 &ClassDevInfo->Guid,
295 &ClassDevInfo->ImageIndex);
296
297 /* enumerate all devices in the class */
298 while (SetupDiEnumDeviceInfo(ClassDevInfo->hDevInfo,
299 MemberIndex++,
300 &DevInfoData))
301 {
302 BOOL HideDevice = FALSE;
303
304 if (ClassDevInfo->HwDevInfo != NULL)
305 {
307 0,
308 ClassDevInfo->HwDevInfo,
309 (ClassDevInfo->ItemCount + 1) *
310 sizeof(HWDEVINFO));
311 if (HwNewDevInfo != NULL)
312 {
313 ClassDevInfo->HwDevInfo = HwNewDevInfo;
314 }
315 else
316 {
317 ERR("Unable to allocate memory for %d SP_DEVINFO_DATA structures!\n",
318 ClassDevInfo->ItemCount + 1);
319 break;
320 }
321 }
322 else
323 {
324 ClassDevInfo->HwDevInfo = (PHWDEVINFO)HeapAlloc(GetProcessHeap(),
325 0,
326 sizeof(HWDEVINFO));
327 if (ClassDevInfo->HwDevInfo == NULL)
328 {
329 ERR("Unable to allocate memory for a SP_DEVINFO_DATA structures!\n");
330 break;
331 }
332 }
333
334 /* Find out if the device should be hidden by default */
335 IsDeviceHidden(DevInfoData.DevInst,
336 NULL,
337 &HideDevice);
338
339 /* save all information for the current device */
340 ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].ClassDevInfo = ClassDevInfo;
341 ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount].DevInfoData = DevInfoData;
342 ClassDevInfo->HwDevInfo[ClassDevInfo->ItemCount++].HideDevice = HideDevice;
343 }
344 }
345
346 ClassDevInfo++;
347 }
348}
#define ERR(fmt,...)
Definition: debug.h:113
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
BOOL IsDeviceHidden(IN DEVINST DevInst, IN HMACHINE hMachine, OUT BOOL *IsHidden)
Definition: misc.cpp:687
BOOL WINAPI SetupDiGetClassImageIndex(IN PSP_CLASSIMAGELIST_DATA ClassImageListData, IN CONST GUID *ClassGuid, OUT PINT ImageIndex)
Definition: devclass.c:277
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1787
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _HWDEVINFO * PHWDEVINFO
struct _HWDEVINFO HWDEVINFO
#define DIGCF_PROFILE
Definition: setupapi.h:173
#define SetupDiGetClassDevs
Definition: setupapi.h:2593
#define DIGCF_PRESENT
Definition: setupapi.h:171
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
PHWDEVINFO HwDevInfo
Definition: hwpage.cpp:46
HDEVINFO hDevInfo
Definition: hwpage.cpp:43
struct _HWCLASSDEVINFO * ClassDevInfo
Definition: hwpage.cpp:35
BOOL HideDevice
Definition: hwpage.cpp:37
SP_DEVINFO_DATA DevInfoData
Definition: hwpage.cpp:36

Referenced by FillDevicesListViewControl().

◆ DeviceCreateHardwarePage()

HWND WINAPI DeviceCreateHardwarePage ( IN HWND  hWndParent,
IN LPGUID  lpGuid 
)

Definition at line 1107 of file hwpage.cpp.

1109{
1111 lpGuid,
1112 1,
1114}
@ HWPD_LARGELIST
Definition: main.h:25
HWND WINAPI DeviceCreateHardwarePageEx(IN HWND hWndParent, IN LPGUID lpGuids, IN UINT uNumberOfGuids, IN HWPAGE_DISPLAYMODE DisplayMode)
Definition: hwpage.cpp:1021

◆ DeviceCreateHardwarePageEx()

HWND WINAPI DeviceCreateHardwarePageEx ( IN HWND  hWndParent,
IN LPGUID  lpGuids,
IN UINT  uNumberOfGuids,
IN HWPAGE_DISPLAYMODE  DisplayMode 
)

Definition at line 1021 of file hwpage.cpp.

1025{
1027
1028 /* allocate the HARDWARE_PAGE_DATA structure. Make sure it is
1029 zeroed because the initialization code assumes that in
1030 failure cases! */
1033 DYNAMIC_FIELD_OFFSET(HARDWARE_PAGE_DATA,
1034 ClassDevInfo[uNumberOfGuids]));
1035 if (hpd != NULL)
1036 {
1037 HWND hWnd;
1038 UINT i;
1039
1041
1042 /* initialize the HARDWARE_PAGE_DATA structure */
1043 hpd->NumberOfGuids = uNumberOfGuids;
1044 for (i = 0;
1045 i < uNumberOfGuids;
1046 i++)
1047 {
1049 hpd->ClassDevInfo[i].Guid = lpGuids[i];
1050 }
1051
1052 /* load comctl32.dll dynamically */
1054 if (hpd->hComCtl32 == NULL)
1055 {
1056 goto Cleanup;
1057 }
1058
1059 /* create the dialog */
1062 hWndParent,
1064 (LPARAM)hpd);
1065 if (hWnd != NULL)
1066 {
1067 return hWnd;
1068 }
1069 else
1070 {
1071Cleanup:
1072 /* oops, something went wrong... */
1073 if (hpd->hComCtl32 != NULL)
1074 {
1075 FreeLibrary(hpd->hComCtl32);
1076 }
1077
1079 0,
1080 hpd);
1081 }
1082 }
1083
1084 return NULL;
1085}
HWND hWnd
Definition: settings.c:17
static HINSTANCE hDllInstance
Definition: clb.c:30
@ HWPD_STANDARDLIST
Definition: main.h:24
@ HWPD_MAX
Definition: main.h:26
#define IDD_HARDWARE
Definition: resource.h:30
#define FreeLibrary(x)
Definition: compat.h:748
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HINSTANCE LoadAndInitComctl32(VOID)
Definition: misc.cpp:1106
static const WCHAR Cleanup[]
Definition: register.c:80
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct _HARDWARE_PAGE_DATA * PHARDWARE_PAGE_DATA
static INT_PTR CALLBACK HardwareDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: hwpage.cpp:798
unsigned int UINT
Definition: ndis.h:50
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:117
HINSTANCE hComCtl32
Definition: hwpage.cpp:53
HWCLASSDEVINFO ClassDevInfo[1]
Definition: hwpage.cpp:63
HWPAGE_DISPLAYMODE DisplayMode
Definition: hwpage.cpp:56
LONG_PTR LPARAM
Definition: windef.h:208
#define CreateDialogParam
Definition: winuser.h:5752
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by DeviceCreateHardwarePage().

◆ DeviceIdMatch()

static BOOL DeviceIdMatch ( IN HDEVINFO  DeviceInfoSet,
IN PSP_DEVINFO_DATA  DeviceInfoData,
IN LPCWSTR  lpDeviceId 
)
static

Definition at line 352 of file hwpage.cpp.

355{
356 DWORD DevIdLen;
357 LPWSTR lpQueriedDeviceId;
358 BOOL Ret = FALSE;
359
362 NULL,
363 0,
364 &DevIdLen) &&
366 {
367 if (DevIdLen == wcslen(lpDeviceId) + 1)
368 {
369 lpQueriedDeviceId = (LPWSTR)HeapAlloc(GetProcessHeap(),
370 0,
371 DevIdLen * sizeof(WCHAR));
372 if (lpQueriedDeviceId != NULL)
373 {
376 lpQueriedDeviceId,
377 DevIdLen,
378 NULL))
379 {
380 Ret = (wcscmp(lpDeviceId,
381 lpQueriedDeviceId) == 0);
382 }
383
385 0,
386 lpQueriedDeviceId);
387 }
388 }
389 }
390
391 return Ret;
392}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define SetupDiGetDeviceInstanceId
Definition: setupapi.h:2600
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1528
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FillDevicesListViewControl().

◆ DisplaySelectedDeviceProperties()

static BOOL DisplaySelectedDeviceProperties ( IN PHARDWARE_PAGE_DATA  hpd)
static

Definition at line 122 of file hwpage.cpp.

123{
124 PHWDEVINFO HwDevInfo;
125 SP_DEVINFO_DATA DevInfoData;
126 BOOL Ret = FALSE;
127
128 HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
129 if (HwDevInfo != NULL)
130 {
131 /* make a copy of the SP_DEVINFO_DATA structure on the stack, it may
132 become invalid in case the devices are updated */
133 DevInfoData = HwDevInfo->DevInfoData;
134
135 /* display the advanced properties */
136 Ret = DisplayDeviceAdvancedProperties(hpd->hWnd,
137 NULL,
138 HwDevInfo->ClassDevInfo->hDevInfo,
139 &DevInfoData,
140 hpd->hComCtl32,
141 NULL,
142 0) != -1;
143 }
144
145 return Ret;
146}
INT_PTR DisplayDeviceAdvancedProperties(IN HWND hWndParent, IN LPCWSTR lpDeviceID OPTIONAL, IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN HINSTANCE hComCtl32, IN LPCWSTR lpMachineName, IN DWORD dwFlags)
Definition: advprop.cpp:2940
LPARAM ListViewGetSelectedItemData(IN HWND hwnd)
Definition: misc.c:134

Referenced by HardwareDlgProc().

◆ EnableTroubleShoot()

static VOID EnableTroubleShoot ( PHARDWARE_PAGE_DATA  hpd,
BOOL  Enable 
)
static

Definition at line 785 of file hwpage.cpp.

787{
788 HWND hBtnTroubleShoot = GetDlgItem(hpd->hWnd,
790
791 ShowWindow(hBtnTroubleShoot,
793}
#define IDC_TROUBLESHOOT
Definition: resource.h:239
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SW_SHOW
Definition: winuser.h:775

Referenced by HardwareDlgProc().

◆ FillDevicesListViewControl()

static VOID FillDevicesListViewControl ( IN PHARDWARE_PAGE_DATA  hpd,
IN LPCWSTR lpSelectDeviceId  OPTIONAL,
IN GUID *SelectedClassGuid  OPTIONAL 
)
static

Definition at line 396 of file hwpage.cpp.

399{
400 PHWCLASSDEVINFO ClassDevInfo, LastClassDevInfo;
401 PHWDEVINFO HwDevInfo, LastHwDevInfo;
402 WCHAR szBuffer[255];
403 BOOL SelectedInClass;
404 INT ItemCount = 0;
405
406 BuildDevicesList(hpd);
407
408 ClassDevInfo = hpd->ClassDevInfo;
409 LastClassDevInfo = ClassDevInfo + hpd->NumberOfGuids;
410
411 while (ClassDevInfo != LastClassDevInfo)
412 {
413 if (ClassDevInfo->HwDevInfo != NULL)
414 {
415 HwDevInfo = ClassDevInfo->HwDevInfo;
416 LastHwDevInfo = HwDevInfo + ClassDevInfo->ItemCount;
417
418 SelectedInClass = (SelectedClassGuid != NULL &&
419 IsEqualGUID(*SelectedClassGuid,
420 ClassDevInfo->Guid));
421 while (HwDevInfo != LastHwDevInfo)
422 {
423 INT iItem;
424 LVITEM li = {0};
425
426 /* get the device name */
427 if (!HwDevInfo->HideDevice &&
429 &HwDevInfo->DevInfoData,
430 szBuffer,
431 sizeof(szBuffer) / sizeof(szBuffer[0])))
432 {
434 li.iItem = ItemCount;
435 if ((ItemCount == 0 && lpSelectDeviceId == NULL) ||
436 (SelectedInClass &&
437 DeviceIdMatch(ClassDevInfo->hDevInfo,
438 &HwDevInfo->DevInfoData,
439 lpSelectDeviceId)))
440 {
441 li.state = LVIS_SELECTED;
442 }
443 li.stateMask = LVIS_SELECTED;
444 li.pszText = szBuffer;
445 li.iImage = ClassDevInfo->ImageIndex;
446 li.lParam = (LPARAM)HwDevInfo;
447
448 iItem = ListView_InsertItem(hpd->hWndDevList,
449 &li);
450 if (iItem != -1)
451 {
452 ItemCount++;
453
454 /* get the device type for the second column */
455 if (GetDeviceTypeString(&HwDevInfo->DevInfoData,
456 szBuffer,
457 sizeof(szBuffer) / sizeof(szBuffer[0])))
458 {
459 li.mask = LVIF_TEXT;
460 li.iItem = iItem;
461 li.iSubItem = 1;
462
463 (void)ListView_SetItem(hpd->hWndDevList,
464 &li);
465 }
466 }
467 }
468
469 HwDevInfo++;
470 }
471 }
472
473 ClassDevInfo++;
474 }
475
476 /* update the controls */
478}
BOOL GetDeviceTypeString(IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:849
BOOL GetDeviceDescriptionString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:880
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
static VOID UpdateControlStates(IN PHARDWARE_PAGE_DATA hpd)
Definition: hwpage.cpp:150
static BOOL DeviceIdMatch(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN LPCWSTR lpDeviceId)
Definition: hwpage.cpp:352
static VOID BuildDevicesList(IN PHARDWARE_PAGE_DATA hpd)
Definition: hwpage.cpp:270
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVITEM
Definition: commctrl.h:2375
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_TEXT
Definition: commctrl.h:2309
#define ListView_SetItem(hwnd, pitem)
Definition: commctrl.h:2401
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
int32_t INT
Definition: typedefs.h:58

Referenced by HardwareDlgProc(), and UpdateDevicesListViewControl().

◆ FreeDevicesList()

static VOID FreeDevicesList ( IN PHARDWARE_PAGE_DATA  hpd)
static

Definition at line 237 of file hwpage.cpp.

238{
239 PHWCLASSDEVINFO ClassDevInfo, LastClassDevInfo;
240
241 ClassDevInfo = hpd->ClassDevInfo;
242 LastClassDevInfo = ClassDevInfo + hpd->NumberOfGuids;
243
244 /* free the device info set handles and structures */
245 while (ClassDevInfo != LastClassDevInfo)
246 {
247 if (ClassDevInfo->hDevInfo != INVALID_HANDLE_VALUE)
248 {
250 ClassDevInfo->hDevInfo = INVALID_HANDLE_VALUE;
251 }
252
253 ClassDevInfo->ItemCount = 0;
254 ClassDevInfo->ImageIndex = 0;
255
256 if (ClassDevInfo->HwDevInfo != NULL)
257 {
259 0,
260 ClassDevInfo->HwDevInfo);
261 ClassDevInfo->HwDevInfo = NULL;
262 }
263
264 ClassDevInfo++;
265 }
266}
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2893

Referenced by HardwareDlgProc(), and UpdateDevicesListViewControl().

◆ HardwareDlgProc()

static INT_PTR CALLBACK HardwareDlgProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 798 of file hwpage.cpp.

802{
804 INT_PTR Ret = FALSE;
805
807
808 if (hpd != NULL || uMsg == WM_INITDIALOG)
809 {
810 switch (uMsg)
811 {
812 case WM_NOTIFY:
813 {
814 NMHDR *pnmh = (NMHDR*)lParam;
815 if (pnmh->hwndFrom == hpd->hWndDevList)
816 {
817 switch (pnmh->code)
818 {
819 case LVN_ITEMCHANGED:
820 {
822
823 if ((pnmv->uChanged & LVIF_STATE) &&
824 ((pnmv->uOldState & (LVIS_FOCUSED | LVIS_SELECTED)) ||
825 (pnmv->uNewState & (LVIS_FOCUSED | LVIS_SELECTED))))
826 {
828 }
829 break;
830 }
831
832 case NM_DBLCLK:
833 {
835 break;
836 }
837 }
838 }
839 break;
840 }
841
842 case WM_COMMAND:
843 {
844 switch (LOWORD(wParam))
845 {
846 case IDC_TROUBLESHOOT:
847 {
848 /* FIXME - start the help using the command in the window text */
849 break;
850 }
851
852 case IDC_PROPERTIES:
853 {
855 break;
856 }
857 }
858 break;
859 }
860
861 case WM_SIZE:
863 (INT)LOWORD(lParam),
864 (INT)HIWORD(lParam));
865 break;
866
867 case WM_SETTEXT:
868 {
869 LPCWSTR szWndText = (LPCWSTR)lParam;
871 (szWndText != NULL && szWndText[0] != L'\0'));
872 break;
873 }
874
875 case WM_DEVICECHANGE:
876 {
877 /* FIXME - don't call UpdateDevicesListViewControl for all events */
879 Ret = TRUE;
880 break;
881 }
882
883 case WM_INITDIALOG:
884 {
886 if (hpd != NULL)
887 {
889
890 hpd->hWnd = hwndDlg;
891 SetWindowLongPtr(hwndDlg, DWLP_USER, (DWORD_PTR)hpd);
892
894
896
897 /* calculate the size of the devices list view control */
898 hpd->hWndDevList = GetDlgItem(hwndDlg,
900 if (hpd->hWndDevList != NULL)
901 {
902 RECT rcClient;
904 &rcClient);
905 hpd->DevListViewHeight = rcClient.bottom;
906
907 if (hpd->DisplayMode == HWPD_LARGELIST)
908 {
909 hpd->DevListViewHeight = (hpd->DevListViewHeight * 3) / 2;
910 }
911 }
912
913 /* subclass the parent window */
914 hWndParent = GetAncestor(hwndDlg,
915 GA_PARENT);
916 if (hWndParent != NULL)
917 {
918 RECT rcClient;
919
921 &rcClient) &&
922 SetWindowPos(hwndDlg,
923 NULL,
924 0,
925 0,
926 rcClient.right,
927 rcClient.bottom,
929 {
930 /* subclass the parent window. This is not safe
931 if the parent window belongs to another thread! */
935
936 if (hpd->ParentOldWndProc != NULL &&
938 L"DevMgrSubClassInfo",
939 (HANDLE)hpd))
940 {
941 hpd->hWndParent = hWndParent;
942 }
943 }
944 }
945
946 /* initialize the devices list view control */
948
949 /* fill the devices list view control */
951 NULL,
952 NULL);
953
954 /* decide whether to show or hide the troubleshoot button */
956 GetWindowTextLength(hwndDlg) != 0);
957 }
958 Ret = TRUE;
959 break;
960 }
961
962 case WM_DESTROY:
963 {
964 /* zero hpd pointer in window data, because it can be used later (WM_DESTROY has not to be last message) */
966
967 /* free devices list */
968 FreeDevicesList(hpd);
969
970 /* restore the old window proc of the subclassed parent window */
971 if (hpd->hWndParent != NULL && hpd->ParentOldWndProc != NULL)
972 {
976 }
977
979 {
981 }
982
983 /* free the reference to comctl32 */
985 hpd->hComCtl32 = NULL;
986
987 /* free the allocated resources */
989 0,
990 hpd);
991 break;
992 }
993 }
994 }
995
996 return Ret;
997}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define IDC_PROPERTIES
Definition: resource.h:32
#define IDC_LV_DEVICES
Definition: resource.h:234
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:85
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:322
static BOOL DisplaySelectedDeviceProperties(IN PHARDWARE_PAGE_DATA hpd)
Definition: hwpage.cpp:122
static VOID EnableTroubleShoot(PHARDWARE_PAGE_DATA hpd, BOOL Enable)
Definition: hwpage.cpp:785
static VOID FreeDevicesList(IN PHARDWARE_PAGE_DATA hpd)
Definition: hwpage.cpp:237
static VOID UpdateDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd)
Definition: hwpage.cpp:482
static VOID InitializeDevicesList(IN PHARDWARE_PAGE_DATA hpd)
Definition: hwpage.cpp:70
static LRESULT CALLBACK ParentSubWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: hwpage.cpp:544
static VOID HardwareDlgResize(IN PHARDWARE_PAGE_DATA hpd, IN INT cx, IN INT cy)
Definition: hwpage.cpp:600
static VOID FillDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd, IN LPCWSTR lpSelectDeviceId OPTIONAL, IN GUID *SelectedClassGuid OPTIONAL)
Definition: hwpage.cpp:396
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define WM_NOTIFY
Definition: richedit.h:61
struct _SP_CLASSIMAGELIST_DATA SP_CLASSIMAGELIST_DATA
SP_CLASSIMAGELIST_DATA ClassImageListData
Definition: hwpage.cpp:55
WNDPROC ParentOldWndProc
Definition: hwpage.cpp:59
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
UINT uNewState
Definition: commctrl.h:3036
UINT uOldState
Definition: commctrl.h:3037
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:872
#define GetWindowTextLength
Definition: winuser.h:5799
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetProp
Definition: winuser.h:5851
#define WM_SIZE
Definition: winuser.h:1611
#define WM_COMMAND
Definition: winuser.h:1740
#define GA_PARENT
Definition: winuser.h:2788
#define WM_INITDIALOG
Definition: winuser.h:1739
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define WM_SETTEXT
Definition: winuser.h:1617
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_DESTROY
Definition: winuser.h:1609
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define SWP_NOZORDER
Definition: winuser.h:1247
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by DeviceCreateHardwarePageEx().

◆ HardwareDlgResize()

static VOID HardwareDlgResize ( IN PHARDWARE_PAGE_DATA  hpd,
IN INT  cx,
IN INT  cy 
)
static

Definition at line 600 of file hwpage.cpp.

603{
604 HDWP dwp;
605 HWND hControl, hButton;
606 INT Width, x, y;
607 RECT rc, rcButton;
608 POINT pt = {0};
609 POINT ptMargin = {0};
610 POINT ptMarginGroup = {0};
611
612 /* use left margin of the IDC_DEVICES label as the right
613 margin of all controls outside the group box */
614 hControl = GetDlgItem(hpd->hWnd,
616 GetWindowRect(hControl,
617 &rc);
618 MapWindowPoints(hControl,
619 hpd->hWnd,
620 &ptMargin,
621 1);
622
623 Width = cx - (2 * ptMargin.x);
624
625 if ((dwp = BeginDeferWindowPos(8)))
626 {
627 /* rc already has the window rect of IDC_DEVICES! */
628 if (!(dwp = DeferWindowPos(dwp,
629 hControl,
630 NULL,
631 0,
632 0,
633 Width,
634 rc.bottom - rc.top,
636 {
637 return;
638 }
639
640 /* resize the devices list view control */
641 GetWindowRect(hpd->hWndDevList,
642 &rc);
643 MapWindowPoints(hpd->hWndDevList,
644 hpd->hWnd,
645 &pt,
646 1);
647 y = pt.y + hpd->DevListViewHeight + ptMargin.y;
648 if (!(dwp = DeferWindowPos(dwp,
649 hpd->hWndDevList,
650 NULL,
651 0,
652 0,
653 Width,
654 hpd->DevListViewHeight,
656 {
657 return;
658 }
659
660 /* resize the group box control */
661 hControl = GetDlgItem(hpd->hWnd,
663 GetWindowRect(hControl,
664 &rc);
665 if (!(dwp = DeferWindowPos(dwp,
666 hControl,
667 NULL,
668 ptMargin.x,
669 y,
670 Width,
671 cy - y - ptMargin.y,
672 SWP_NOZORDER)))
673 {
674 return;
675 }
676
677 /* use left margin of the IDC_MANUFACTURER label as the right
678 margin of all controls inside the group box */
679 hControl = GetDlgItem(hpd->hWnd,
681 GetWindowRect(hControl,
682 &rc);
683 MapWindowPoints(hControl,
684 hpd->hWnd,
685 &ptMarginGroup,
686 1);
687
688 ptMarginGroup.y = ptMargin.y * 2;
689 Width = cx - (2 * ptMarginGroup.x);
690 y += ptMarginGroup.y;
691 if (!(dwp = DeferWindowPos(dwp,
692 hControl,
693 NULL,
694 ptMarginGroup.x,
695 y,
696 Width,
697 rc.bottom - rc.top,
698 SWP_NOZORDER)))
699 {
700 return;
701 }
702 y += rc.bottom - rc.top + (ptMargin.y / 2);
703
704 /* resize the IDC_LOCATION label */
705 hControl = GetDlgItem(hpd->hWnd,
707 GetWindowRect(hControl,
708 &rc);
709 if (!(dwp = DeferWindowPos(dwp,
710 hControl,
711 NULL,
712 ptMarginGroup.x,
713 y,
714 Width,
715 rc.bottom - rc.top,
716 SWP_NOZORDER)))
717 {
718 return;
719 }
720 y += rc.bottom - rc.top + (ptMargin.y / 2);
721
722 /* measure the size of the buttons */
723 hButton = GetDlgItem(hpd->hWnd,
725 GetWindowRect(hButton,
726 &rcButton);
727
728 /* resize the IDC_STATUS label */
729 hControl = GetDlgItem(hpd->hWnd,
730 IDC_STATUS);
731 GetWindowRect(hControl,
732 &rc);
733 if (!(dwp = DeferWindowPos(dwp,
734 hControl,
735 NULL,
736 ptMarginGroup.x,
737 y,
738 Width,
739 cy - y - (3 * ptMargin.y) -
740 (rcButton.bottom - rcButton.top),
741 SWP_NOZORDER)))
742 {
743 return;
744 }
745
746 /* move the IDC_PROPERTIES button */
747 y = cy - (2 * ptMargin.y) - (rcButton.bottom - rcButton.top);
748 x = cx - ptMarginGroup.x - (rcButton.right - rcButton.left);
749 if (!(dwp = DeferWindowPos(dwp,
750 hButton,
751 NULL,
752 x,
753 y,
754 0,
755 0,
757 {
758 return;
759 }
760
761 /* move the IDC_TROUBLESHOOT button */
762 hButton = GetDlgItem(hpd->hWnd,
764 GetWindowRect(hButton,
765 &rcButton);
766 x -= (ptMargin.x / 2) + (rcButton.right - rcButton.left);
767 if (!(dwp = DeferWindowPos(dwp,
768 hButton,
769 NULL,
770 x,
771 y,
772 0,
773 0,
775 {
776 return;
777 }
778
780 }
781}
#define IDC_STATUS
Definition: resource.h:41
#define IDC_LOCATION
Definition: resource.h:237
#define IDC_DEVICES
Definition: resource.h:233
#define IDC_MANUFACTURER
Definition: resource.h:236
#define IDC_PROPERTIESGROUP
Definition: resource.h:235
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HDWP WINAPI BeginDeferWindowPos(_In_ int)

Referenced by HardwareDlgProc().

◆ InitializeDevicesList()

static VOID InitializeDevicesList ( IN PHARDWARE_PAGE_DATA  hpd)
static

Definition at line 70 of file hwpage.cpp.

71{
72 LVCOLUMN lvc;
73 RECT rcClient;
74 WCHAR szColName[255];
75 int iCol = 0;
76
77 /* set the list view style */
80
81 /* set the list view image list */
82 if (hpd->ClassImageListData.ImageList != NULL)
83 {
84 (void)ListView_SetImageList(hpd->hWndDevList,
85 hpd->ClassImageListData.ImageList,
87 }
88
89 GetClientRect(hpd->hWndDevList,
90 &rcClient);
91
92 /* add the list view columns */
93 lvc.mask = LVCF_TEXT | LVCF_WIDTH;
94 lvc.fmt = LVCFMT_LEFT;
95 lvc.pszText = szColName;
96
99 szColName,
100 sizeof(szColName) / sizeof(szColName[0])))
101 {
102 lvc.cx = rcClient.right - CX_TYPECOLUMN_WIDTH -
104 (void)ListView_InsertColumn(hpd->hWndDevList,
105 iCol++,
106 &lvc);
107 }
109 IDS_TYPE,
110 szColName,
111 sizeof(szColName) / sizeof(szColName[0])))
112 {
113 lvc.cx = CX_TYPECOLUMN_WIDTH;
114 (void)ListView_InsertColumn(hpd->hWndDevList,
115 iCol++,
116 &lvc);
117 }
118}
#define IDS_NAME
Definition: resource.h:90
#define IDS_TYPE
Definition: resource.h:103
#define CX_TYPECOLUMN_WIDTH
Definition: hwpage.cpp:67
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVCOLUMN
Definition: commctrl.h:2581
#define SM_CXVSCROLL
Definition: winuser.h:961
#define LoadString
Definition: winuser.h:5819
int WINAPI GetSystemMetrics(_In_ int)

Referenced by HardwareDlgProc().

◆ ParentSubWndProc()

static LRESULT CALLBACK ParentSubWndProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 544 of file hwpage.cpp.

548{
550
552 L"DevMgrSubClassInfo");
553 if (hpd != NULL)
554 {
555 if (uMsg == WM_SIZE)
556 {
557 /* resize the hardware page */
558 SetWindowPos(hpd->hWnd,
559 NULL,
560 0,
561 0,
562 LOWORD(lParam),
563 HIWORD(lParam),
565 }
566 else if (uMsg == WM_DEVICECHANGE && IsWindowVisible(hpd->hWnd))
567 {
568 /* forward a WM_DEVICECHANGE message to the hardware
569 page which wouldn't get the message itself as it is
570 a child window */
571 SendMessage(hpd->hWnd,
573 wParam,
574 lParam);
575 }
576
577 /* pass the message the the old window proc */
579 hwnd,
580 uMsg,
581 wParam,
582 lParam);
583 }
584 else
585 {
586 /* this is not a good idea if the subclassed window was an ansi
587 window, but we failed finding out the previous window proc
588 so we can't use CallWindowProc. This should rarely - if ever -
589 happen. */
590
591 return DefWindowProc(hwnd,
592 uMsg,
593 wParam,
594 lParam);
595 }
596}
#define DefWindowProc
Definition: ros2win.h:31
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CallWindowProc
Definition: winuser.h:5735
#define GetProp
Definition: winuser.h:5792
#define SendMessage
Definition: winuser.h:5843
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by HardwareDlgProc().

◆ UpdateControlStates()

static VOID UpdateControlStates ( IN PHARDWARE_PAGE_DATA  hpd)
static

Definition at line 150 of file hwpage.cpp.

151{
152 PHWDEVINFO HwDevInfo;
153 HWND hBtnTroubleShoot, hBtnProperties;
154
155 hBtnTroubleShoot = GetDlgItem(hpd->hWnd,
157 hBtnProperties = GetDlgItem(hpd->hWnd,
159
160 HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
161 if (HwDevInfo != NULL)
162 {
163 /* update static controls */
164 WCHAR szBuffer[256];
165 LPWSTR szFormatted = NULL;
166
167 /* get the manufacturer string */
168 if (GetDeviceManufacturerString(HwDevInfo->ClassDevInfo->hDevInfo,
169 &HwDevInfo->DevInfoData,
170 szBuffer,
171 sizeof(szBuffer) / sizeof(szBuffer[0])) &&
174 &szFormatted,
175 szBuffer) != 0)
176 {
177 SetDlgItemText(hpd->hWnd,
179 szFormatted);
180 LocalFree((HLOCAL)szFormatted);
181 }
182
183 /* get the location string */
184 if (GetDeviceLocationString(HwDevInfo->ClassDevInfo->hDevInfo,
185 &HwDevInfo->DevInfoData,
186 0,
187 szBuffer,
188 sizeof(szBuffer) / sizeof(szBuffer[0])) &&
191 &szFormatted,
192 szBuffer) != 0)
193 {
194 SetDlgItemText(hpd->hWnd,
196 szFormatted);
197 LocalFree((HLOCAL)szFormatted);
198 }
199
201 NULL,
202 szBuffer,
203 sizeof(szBuffer) / sizeof(szBuffer[0])) &&
206 &szFormatted,
207 szBuffer) != 0)
208 {
209 SetDlgItemText(hpd->hWnd,
211 szFormatted);
212 LocalFree((HLOCAL)szFormatted);
213 }
214 }
215 else
216 {
217 /* clear static controls */
218 SetDlgItemText(hpd->hWnd,
220 NULL);
221 SetDlgItemText(hpd->hWnd,
223 NULL);
224 SetDlgItemText(hpd->hWnd,
226 NULL);
227 }
228
229 EnableWindow(hBtnTroubleShoot,
230 HwDevInfo != NULL);
231 EnableWindow(hBtnProperties,
232 HwDevInfo != NULL);
233}
#define IDS_STATUS
Definition: resource.h:22
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPTSTR *lpTarget,...)
Definition: misc.c:85
BOOL GetDeviceLocationString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, IN DEVINST dnParentDevInst OPTIONAL, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:318
BOOL GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:281
BOOL GetDeviceStatusString(IN DEVINST DevInst, IN HMACHINE hMachine, OUT LPWSTR szBuffer, IN DWORD BufferSize)
Definition: misc.cpp:443
#define IDS_LOCATION
Definition: resource.h:105
#define IDS_MANUFACTURER
Definition: resource.h:104
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SetDlgItemText
Definition: winuser.h:5849

Referenced by FillDevicesListViewControl(), and HardwareDlgProc().

◆ UpdateDevicesListViewControl()

static VOID UpdateDevicesListViewControl ( IN PHARDWARE_PAGE_DATA  hpd)
static

Definition at line 482 of file hwpage.cpp.

483{
484 PHWDEVINFO HwDevInfo;
485 GUID SelectedClassGuid = {0};
486 LPWSTR lpDeviceId = NULL;
487
488 /* if a device currently is selected, remember the device id so we can
489 select the device after the update if still present */
490 HwDevInfo = (PHWDEVINFO)ListViewGetSelectedItemData(hpd->hWndDevList);
491 if (HwDevInfo != NULL)
492 {
493 DWORD DevIdLen;
494 if (!SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
495 &HwDevInfo->DevInfoData,
496 NULL,
497 0,
498 &DevIdLen) &&
500 {
501 SelectedClassGuid = HwDevInfo->DevInfoData.ClassGuid;
502 lpDeviceId = (LPWSTR)HeapAlloc(GetProcessHeap(),
503 0,
504 DevIdLen * sizeof(WCHAR));
505 if (lpDeviceId != NULL &&
506 !SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
507 &HwDevInfo->DevInfoData,
508 lpDeviceId,
509 DevIdLen,
510 NULL))
511 {
513 0,
514 lpDeviceId);
515 lpDeviceId = NULL;
516 }
517 }
518 }
519
520 /* clear the devices list view control */
521 (void)ListView_DeleteAllItems(hpd->hWndDevList);
522
523 /* free the device list */
524 FreeDevicesList(hpd);
525
526 /* build rebuild the device list and fill the list box again */
528 lpDeviceId,
529 (lpDeviceId != NULL ?
530 &SelectedClassGuid :
531 NULL));
532
533 if (lpDeviceId != NULL)
534 {
536 0,
537 lpDeviceId);
538 }
539}
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414

Referenced by HardwareDlgProc().