ReactOS  0.4.14-dev-593-g1793dcc
DeviceView.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Device Manager
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: dll/win32/devmgr/devmgmt/DeviceView.cpp
5  * PURPOSE: Implements the tree view which contains the devices
6  * COPYRIGHT: Copyright 2015 Ged Murphy <gedmurphy@reactos.org>
7  */
8 
9 
10 
11 #include "precomp.h"
12 #include "devmgmt.h"
13 #include "DeviceView.h"
14 
15 
16 // DATA ********************************************/
17 
18 #define CLASS_NAME_LEN 256
19 #define CLASS_DESC_LEN 256
20 #define ROOT_NAME_SIZE MAX_COMPUTERNAME_LENGTH + 1
21 
22 
24 
26 {
30 };
31 
32 
33 // PUBLIC METHODS ************************************/
34 
37  ) :
38  m_hMainWnd(hMainWnd),
39  m_hTreeView(NULL),
40  m_hPropertyDialog(NULL),
41  m_hMenu(NULL),
42  m_ViewType(DevicesByType),
43  m_ShowHidden(false),
44  m_RootNode(NULL)
45 {
47 }
48 
50 {
51 }
52 
53 bool
55 {
56  // Get the device image list
59  if (bSuccess == FALSE)
60  return false;
61 
62  // Create the main treeview
65  NULL,
68  0, 0, 0, 0,
69  m_hMainWnd,
72  NULL);
73  if (m_hTreeView)
74  {
75  // Set the image list against the treeview
78  TVSIL_NORMAL);
79 
80  // Give the treeview arrows instead of +/- boxes (on Win7)
81  SetWindowTheme(m_hTreeView, L"explorer", NULL);
82 
83  // Create the root node
86  }
87 
88 
89 
90  return !!(m_hTreeView);
91 }
92 
93 bool
95 {
97 
99  {
102  }
103 
104  return true;
105 }
106 
107 LRESULT
109  _In_ int x,
110  _In_ int y,
111  _In_ int cx,
112  _In_ int cy
113  )
114 {
115  // Resize the treeview
117  NULL,
118  x,
119  y,
120  cx,
121  cy,
122  SWP_NOZORDER);
123 
124  return 0;
125 }
126 
127 LRESULT
129  _In_ LPNMHDR NmHdr
130  )
131 {
132  TVHITTESTINFO hitInfo;
134 
135  GetCursorPos(&hitInfo.pt);
136  ScreenToClient(m_hTreeView, &hitInfo.pt);
137 
138  hItem = TreeView_HitTest(m_hTreeView, &hitInfo);
139  if (hItem != NULL && (hitInfo.flags & (TVHT_ONITEM | TVHT_ONITEMICON)))
140  {
142  }
143 
144  return 0;
145 }
146 
147 LRESULT
150  )
151 {
153 
154  RECT rc;
156  hSelected,
157  &rc,
158  TRUE))
159  {
160  POINT pt;
161  if (GetCursorPos(&pt) &&
163  PtInRect(&rc, pt))
164  {
166  if (Node)
167  {
168  // Create the context menu
169  HMENU hContextMenu = CreatePopupMenu();
170 
171  // Add the actions for this node
172  BuildActionMenuForNode(hContextMenu, Node, false);
173 
174  INT xPos = GET_X_LPARAM(lParam);
175  INT yPos = GET_Y_LPARAM(lParam);
176 
177  // Display the menu
178  TrackPopupMenuEx(hContextMenu,
180  xPos,
181  yPos,
182  m_hMainWnd,
183  NULL);
184 
185  DestroyMenu(hContextMenu);
186  }
187  }
188  }
189 
190  return 0;
191 }
192 
193 
194 void
197  _In_ bool ScanForChanges,
198  _In_ bool UpdateView
199  )
200 {
201  // Enum devices on a separate thread to keep the gui responsive
202 
203  m_ViewType = Type;
204 
207  ThreadData->This = this;
208  ThreadData->ScanForChanges = ScanForChanges;
209  ThreadData->UpdateView = UpdateView;
210 
211  HANDLE hThread;
213  0,
215  ThreadData,
216  0,
217  NULL);
219 }
220 
221 LRESULT
224 )
225 {
226  switch (Action)
227  {
228  case IDM_PROPERTIES:
229  {
231  break;
232  }
233 
234  case IDM_SCAN_HARDWARE:
235  {
237  true,
238  true);
239  break;
240  }
241 
242  case IDM_ENABLE_DRV:
243  {
244  bool NeedsReboot;
245  if (EnableSelectedDevice(true, NeedsReboot) &&
246  NeedsReboot)
247  {
248  MessageBox(m_hMainWnd, L"Rebooting", L"Enable", MB_OK);
249  }
250  break;
251  }
252 
253  case IDM_DISABLE_DRV:
254  {
255  bool NeedsReboot;
256  EnableSelectedDevice(false, NeedsReboot);
257  break;
258  }
259 
260  case IDM_UPDATE_DRV:
261  {
262  bool NeedsReboot;
263  UpdateSelectedDevice(NeedsReboot);
264  break;
265  }
266 
267  case IDM_UNINSTALL_DRV:
268  {
270  break;
271  }
272 
273  case IDM_ADD_HARDWARE:
274  {
276  break;
277  }
278  }
279 
280  return 0;
281 }
282 
283 void
285 {
287  if (Node && Node->HasProperties())
288  {
290  NULL,
291  Node->GetDeviceId(),
292  1,//DPF_EXTENDED,
293  FALSE);
294  }
295 }
296 
297 void
299 {
301 }
302 
303 bool
305  _In_ HMENU OwnerMenu,
306  _In_ bool MainMenu
307  )
308 {
310  if (Node)
311  {
312  BuildActionMenuForNode(OwnerMenu, Node, MainMenu);
313  return true;
314  }
315 
316  return false;
317 }
318 
319 CNode*
321 {
322  TV_ITEM TvItem;
323  TvItem.hItem = TreeView_GetSelection(m_hTreeView);
324  return GetNode(&TvItem);
325 }
326 
327 
328 
329 // PRIVATE METHODS *******************************************/
330 
331 bool
333 {
335  return (m_hTreeRoot != NULL);
336 }
337 
338 bool
340  _In_ ULONG ClassIndex,
341  _Out_ LPGUID ClassGuid,
342  _Out_ HDEVINFO *hDevInfo
343  )
344 {
345  CONFIGRET cr;
346 
347  // Get the next class in the list
348  cr = CM_Enumerate_Classes(ClassIndex,
349  ClassGuid,
350  0);
351  if (cr != CR_SUCCESS)
352  return false;
353 
354  // Check if this is the unknown class
355  if (IsEqualGUID(*ClassGuid, GUID_DEVCLASS_UNKNOWN))
356  {
357  // Get device info for all devices
358  *hDevInfo = SetupDiGetClassDevsW(NULL,
359  NULL,
360  NULL,
362  }
363  else
364  {
365  // We only want the devices for this class
366  *hDevInfo = SetupDiGetClassDevsW(ClassGuid,
367  NULL,
368  NULL,
369  DIGCF_PRESENT);
370  }
371 
372  return (hDevInfo != INVALID_HANDLE_VALUE);
373 }
374 
375 unsigned int __stdcall CDeviceView::RefreshThread(void *Param)
376 {
378  CDeviceView *This = ThreadData->This;
379 
380  // Get a copy of the currently selected node
381  CNode *LastSelectedNode = This->GetSelectedNode();
382  if (LastSelectedNode == nullptr || (LastSelectedNode->GetNodeType() == RootNode))
383  {
384  LastSelectedNode = new CRootNode(*This->m_RootNode);
385  }
386  else if (LastSelectedNode->GetNodeType() == ClassNode)
387  {
388  LastSelectedNode = new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode));
389  }
390  else if (LastSelectedNode->GetNodeType() == DeviceNode)
391  {
392  LastSelectedNode = new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode));
393  }
394 
395  // Empty the treeview
396  This->EmptyDeviceView();
397 
398  // Re-add the root node to the tree
399  if (This->AddRootDevice() == false)
400  return 0;
401 
402  // Refresh the devices only if requested
403  if (ThreadData->ScanForChanges)
404  {
405  This->RefreshDeviceList();
406  }
407 
408  // display the type of view the user wants
409  switch (This->m_ViewType)
410  {
411  case DevicesByType:
412  (void)This->ListDevicesByType();
413  break;
414 
415  case DevicesByConnection:
416  (VOID)This->ListDevicesByConnection();
417  break;
418 
419  case ResourcesByType:
420  break;
421 
423  break;
424  }
425 
426  This->SelectNode(LastSelectedNode);
427 
428  delete ThreadData;
429 
430  return 0;
431 }
432 
433 
434 bool
436 {
439  HDEVINFO hDevInfo;
440  HTREEITEM hTreeItem = NULL;
441  GUID ClassGuid;
442  INT ClassIndex;
443  BOOL bClassSuccess, bSuccess;
444 
445  ClassIndex = 0;
446  do
447  {
448  // Loop through all the device classes
449  bClassSuccess = GetNextClass(ClassIndex, &ClassGuid, &hDevInfo);
450  if (bClassSuccess)
451  {
452  bool bClassUnknown = false;
453  bool AddedParent = false;
454  INT DeviceIndex = 0;
455  bool MoreItems = false;
456 
457  // Get the cached class node
458  ClassNode = GetClassNode(&ClassGuid);
459  if (ClassNode == nullptr)
460  {
461  ATLASSERT(FALSE);
462  ClassIndex++;
463  continue;
464  }
465 
466  // Set a flag is this is the (special case) unknown class
467  if (IsEqualGUID(ClassGuid, GUID_DEVCLASS_UNKNOWN))
468  bClassUnknown = true;
469 
470  // Check if this is a hidden class
471  if (IsEqualGUID(ClassGuid, GUID_DEVCLASS_LEGACYDRIVER) ||
472  IsEqualGUID(ClassGuid, GUID_DEVCLASS_VOLUME))
473  {
474  // Ignore this device if we aren't displaying hidden devices
475  if (m_ShowHidden == FALSE)
476  {
477  ClassIndex++;
478  continue;
479  }
480  }
481 
482  do
483  {
484  // Get a handle to all the devices in this class
488  bSuccess = SetupDiEnumDeviceInfo(hDevInfo,
489  DeviceIndex,
490  &DeviceInfoData);
492  MoreItems = false;
493 
494  if (bSuccess)
495  {
496  MoreItems = true;
497 
498  // The unknown class handle contains all devices on the system,
499  // and we're just looking for the ones with a null GUID
500  if (bClassUnknown)
501  {
503  {
504  // This is a known device, we aren't interested in it
505  DeviceIndex++;
506  continue;
507  }
508  }
509 
510  // Get the cached device node
512  if (DeviceNode == nullptr)
513  {
514  ATLASSERT(bClassUnknown == true);
515  DeviceIndex++;
516  continue;
517  }
518 
519  // Check if this is a hidden device
520  if (DeviceNode->IsHidden())
521  {
522  // Ignore this device if we aren't displaying hidden devices
523  if (m_ShowHidden == FALSE)
524  {
525  DeviceIndex++;
526  continue;
527  }
528  }
529 
530  // We have a device, we need to add the parent if it hasn't yet been added
531  if (AddedParent == false)
532  {
533  // Insert the new class under the root item
534  hTreeItem = InsertIntoTreeView(m_hTreeRoot,
535  ClassNode);
536  AddedParent = true;
537  }
538 
539  // Add the device under the class item node
540  (void)InsertIntoTreeView(hTreeItem, DeviceNode);
541 
542  // Expand the class if it has a problem device
543  if (DeviceNode->HasProblem())
544  {
546  hTreeItem,
547  TVE_EXPAND);
548  }
549  }
550 
551  DeviceIndex++;
552 
553  } while (MoreItems);
554 
555  // If this class has devices, sort them alphabetically
556  if (AddedParent == true)
557  {
559  hTreeItem,
560  0);
561  }
562  }
563 
564  ClassIndex++;
565 
566  } while (bClassSuccess);
567 
568  // Sort the classes alphabetically
570  m_hTreeRoot,
571  0);
572 
573  // Expand the root item
575  m_hTreeRoot,
576  TVE_EXPAND);
577 
578  // Pre-select the root item
580  m_hTreeRoot);
581 
582  return 0;
583 }
584 
585 bool
587 {
588  // Walk the device tree and add all the devices
590 
591  // Expand the root item
593  m_hTreeRoot,
594  TVE_EXPAND);
595 
596  return true;
597 }
598 
599 bool
601  _In_ DEVINST ParentDevice,
602  _In_ HTREEITEM hParentTreeItem
603  )
604 {
605  HTREEITEM hDevItem = NULL;
606  DEVINST Device;
607  bool HasProblem = false;
608  bool bSuccess;
609 
610  // Check if the parent has any child devices
611  if (GetChildDevice(ParentDevice, &Device) == FALSE)
612  return true;
613 
614  // Get the cached device node
616  DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
617  if (DeviceNode == nullptr)
618  {
619  ATLASSERT(FALSE);
620  return false;
621  }
622 
623  // Don't show hidden devices if not requested
624  if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
625  {
626  // Add this device to the tree under its parent
627  hDevItem = InsertIntoTreeView(hParentTreeItem,
628  DeviceNode);
629  if (hDevItem)
630  {
631  // Check if this child has any children itself
632  if (!RecurseChildDevices(Device, hDevItem))
633  HasProblem = true;
634  }
635 
636  if (DeviceNode->HasProblem())
637  {
638  HasProblem = true;
639  }
640  }
641 
642 
643  // Check for siblings
644  for (;;)
645  {
646  // Check if the parent device has anything at the same level
648  if (bSuccess == FALSE)
649  break;
650 
651  DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
652  if (DeviceNode == nullptr)
653  {
654  ATLASSERT(FALSE);
655  }
656 
657  // Don't show hidden devices if not requested
658  if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
659  {
660  if (DeviceNode->HasProblem())
661  {
662  HasProblem = true;
663  }
664 
665  // Add this device to the tree under its parent
666  hDevItem = InsertIntoTreeView(hParentTreeItem,
667  DeviceNode);
668  if (hDevItem)
669  {
670  // Check if this child has any children itself
671  if (!RecurseChildDevices(Device, hDevItem))
672  HasProblem = true;
673  }
674  }
675  }
676 
678  hParentTreeItem,
679  0);
680 
681  // Expand the class if it has a problem device
682  if (HasProblem == true)
683  {
685  hParentTreeItem,
686  TVE_EXPAND);
687  }
688 
689  // If there was a problem, expand the ancestors
690  if (HasProblem)
691  return false;
692 
693  return true;
694 }
695 
696 bool
698  _In_ bool Enable,
699  _Out_ bool &NeedsReboot
700  )
701 {
702  CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
703  if (Node == nullptr)
704  return false;
705 
706  if (Enable == false)
707  {
709  if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE))
710  {
712  str,
713  Node->GetDisplayName(),
715  {
716  return false;
717  }
718  }
719  }
720 
721  return Node->EnableDevice(Enable, NeedsReboot);
722 }
723 
724 bool
726  _Out_ bool &NeedsReboot
727  )
728 {
729  CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
730  if (Node == nullptr)
731  return false;
732 
733  DWORD dwReboot;
734  if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot))
735  {
736  NeedsReboot = false;
737  return true;
738  }
739 
740  return false;
741 }
742 
743 bool
745  )
746 {
747  CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
748  if (Node == nullptr)
749  return false;
750 
752  if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL))
753  {
755  str,
756  Node->GetDisplayName(),
758  {
759  return false;
760  }
761  }
762 
763  return Node->UninstallDevice();
764 }
765 
766 bool
768 {
769  PADDHARDWAREWIZARD pAddHardwareWizard;
771 
772  hModule = LoadLibraryW(L"hdwwiz.cpl");
773  if (hModule == NULL)
774  return false;
775 
776  pAddHardwareWizard = (PADDHARDWAREWIZARD)GetProcAddress(hModule,
777  "AddHardwareWizard");
778  if (pAddHardwareWizard == NULL)
779  {
781  return false;
782  }
783 
784  pAddHardwareWizard(m_hMainWnd, NULL);
785 
787  return true;
788 }
789 
790 bool
792  _In_ DEVINST ParentDevInst,
793  _Out_ PDEVINST DevInst
794 )
795 {
796  CONFIGRET cr;
797  cr = CM_Get_Child(DevInst,
798  ParentDevInst,
799  0);
800  return (cr == CR_SUCCESS);
801 }
802 
803 bool
805  _In_ DEVINST PrevDevice,
806  _Out_ PDEVINST DevInst
807 )
808 {
809  CONFIGRET cr;
810  cr = CM_Get_Sibling(DevInst,
811  PrevDevice,
812  0);
813  return (cr == CR_SUCCESS);
814 }
815 
816 HTREEITEM
819  _In_ CNode *Node
820  )
821 {
822  LPWSTR lpLabel;
823  lpLabel = Node->GetDisplayName();
824 
825  TV_ITEMW tvi;
826  TV_INSERTSTRUCT tvins;
827  ZeroMemory(&tvi, sizeof(tvi));
828  ZeroMemory(&tvins, sizeof(tvins));
829 
831  tvi.pszText = lpLabel;
832  tvi.cchTextMax = wcslen(lpLabel);
833  tvi.lParam = (LPARAM)Node;
834  tvi.iImage = Node->GetClassImage();
835  tvi.iSelectedImage = Node->GetClassImage();
836 
837  // try to cast it to a device node. This will only succeed if it's the correct type
838  CDeviceNode *DeviceNode = dynamic_cast<CDeviceNode *>(Node);
839  if (DeviceNode && DeviceNode->GetOverlayImage())
840  {
841  tvi.mask |= TVIF_STATE;
842  tvi.stateMask = TVIS_OVERLAYMASK;
843  tvi.state = INDEXTOOVERLAYMASK(DeviceNode->GetOverlayImage());
844  }
845 
846  tvins.item = tvi;
847  tvins.hParent = hParent;
848 
849  return TreeView_InsertItem(m_hTreeView, &tvins);
850 }
851 
852 void
854  _In_ HMENU OwnerMenu,
855  _In_ CNode *Node,
856  _In_ bool MainMenu
857  )
858 {
859  // Create a separator structure
860  MENUITEMINFOW MenuSeparator = { 0 };
861  MenuSeparator.cbSize = sizeof(MENUITEMINFOW);
862  MenuSeparator.fType = MFT_SEPARATOR;
863 
864  // Setup the
865  MENUITEMINFOW MenuItemInfo = { 0 };
866  MenuItemInfo.cbSize = sizeof(MENUITEMINFOW);
867  MenuItemInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_SUBMENU;
868  MenuItemInfo.fType = MFT_STRING;
869 
871  int i = 0;
872 
873  // Device nodes have extra data
874  if (Node->GetNodeType() == DeviceNode)
875  {
876  CDeviceNode *DeviceNode = dynamic_cast<CDeviceNode *>(Node);
877 
878  if (DeviceNode->CanUpdate())
879  {
880  String.LoadStringW(g_hThisInstance, IDS_MENU_UPDATE);
881  MenuItemInfo.wID = IDM_UPDATE_DRV;
882  MenuItemInfo.dwTypeData = String.GetBuffer();
883  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
884  i++;
885  }
886 
887  if (DeviceNode->IsDisabled())
888  {
889  String.LoadStringW(g_hThisInstance, IDS_MENU_ENABLE);
890  MenuItemInfo.wID = IDM_ENABLE_DRV;
891  MenuItemInfo.dwTypeData = String.GetBuffer();
892  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
893  i++;
894  }
895 
896  if (DeviceNode->CanDisable() && !DeviceNode->IsDisabled())
897  {
899  MenuItemInfo.wID = IDM_DISABLE_DRV;
900  MenuItemInfo.dwTypeData = String.GetBuffer();
901  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
902  i++;
903  }
904 
905  if (DeviceNode->CanUninstall())
906  {
908  MenuItemInfo.wID = IDM_UNINSTALL_DRV;
909  MenuItemInfo.dwTypeData = String.GetBuffer();
910  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
911  i++;
912  }
913 
914  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeparator);
915  i++;
916  }
917 
918  // All nodes have the scan option
919  String.LoadStringW(g_hThisInstance, IDS_MENU_SCAN);
920  MenuItemInfo.wID = IDM_SCAN_HARDWARE;
921  MenuItemInfo.dwTypeData = String.GetBuffer();
922  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
923  i++;
924 
925  if ((Node->GetNodeType() == RootNode) || (MainMenu == true))
926  {
927  String.LoadStringW(g_hThisInstance, IDS_MENU_ADD);
928  MenuItemInfo.wID = IDM_ADD_HARDWARE;
929  MenuItemInfo.dwTypeData = String.GetBuffer();
930  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
931  i++;
932  }
933 
934  if (Node->HasProperties())
935  {
936  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeparator);
937  i++;
938 
940  MenuItemInfo.wID = IDM_PROPERTIES;
941  MenuItemInfo.dwTypeData = String.GetBuffer();
942  InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
943  i++;
944 
946  }
947 }
948 
949 HTREEITEM
951  _In_ HTREEITEM hParentItem,
952  _In_ CNode *Node
953  )
954 {
955  HTREEITEM FoundItem;
957  TVITEMW tvItem;
958  CNode *FoundNode;
959 
960  // Check if this node has any children
961  hItem = TreeView_GetChild(m_hTreeView, hParentItem);
962  if (hItem == NULL)
963  return NULL;
964 
965  // The lParam contains the node pointer data
966  tvItem.hItem = hItem;
967  tvItem.mask = TVIF_PARAM;
968  if (TreeView_GetItem(m_hTreeView, &tvItem) &&
969  tvItem.lParam != NULL)
970  {
971  // check for a matching node
972  FoundNode = reinterpret_cast<CNode *>(tvItem.lParam);
973  if ((FoundNode->GetNodeType() == Node->GetNodeType()) &&
974  (IsEqualGUID(*FoundNode->GetClassGuid(), *Node->GetClassGuid())))
975  {
976  // check if this is a class node, or a device with matching ID's
977  if ((FoundNode->GetNodeType() == ClassNode) ||
978  (wcscmp(FoundNode->GetDeviceId(), Node->GetDeviceId()) == 0))
979  {
980  return hItem;
981  }
982  }
983  }
984 
985  // This node may have its own children
986  FoundItem = RecurseFindDevice(hItem, Node);
987  if (FoundItem)
988  return FoundItem;
989 
990  // Loop all the siblings
991  for (;;)
992  {
993  // Get the next item at this level
995  if (hItem == NULL)
996  break;
997 
998  // The lParam contains the node pointer data
999  tvItem.hItem = hItem;
1000  tvItem.mask = TVIF_PARAM;
1001  if (TreeView_GetItem(m_hTreeView, &tvItem))
1002  {
1003  // check for a matching class
1004  FoundNode = reinterpret_cast<CNode *>(tvItem.lParam);
1005  if ((FoundNode->GetNodeType() == Node->GetNodeType()) &&
1006  (IsEqualGUID(*FoundNode->GetClassGuid(), *Node->GetClassGuid())))
1007  {
1008  // check if this is a class node, or a device with matching ID's
1009  if ((FoundNode->GetNodeType() == ClassNode) ||
1010  (wcscmp(FoundNode->GetDeviceId(), Node->GetDeviceId()) == 0))
1011  {
1012  return hItem;
1013  }
1014  }
1015  }
1016 
1017  // This node may have its own children
1018  FoundItem = RecurseFindDevice(hItem, Node);
1019  if (FoundItem)
1020  return FoundItem;
1021  }
1022 
1023  return hItem;
1024 }
1025 
1026 void
1028  _In_ CNode *Node
1029  )
1030 {
1032 
1033  // Check if there are any items in the tree
1035  if (hRoot == NULL)
1036  return;
1037 
1038  // If we don't want to set select a node, just select root
1039  if (Node == nullptr || Node->GetNodeType() == RootNode)
1040  {
1042  return;
1043  }
1044 
1045  // Scan the tree looking for the node we want
1047  if (hItem)
1048  {
1050  }
1051  else
1052  {
1054  }
1055 }
1056 
1057 
1058 void
1060 {
1062 }
1063 
1064 
1065 CClassNode*
1067  _In_ LPGUID ClassGuid
1068  )
1069 {
1070  POSITION Pos;
1071  CClassNode *Node = nullptr;
1072 
1073  Pos = m_ClassNodeList.GetHeadPosition();
1074  if (Pos == NULL)
1075  return nullptr;
1076 
1077  do
1078  {
1079  Node = m_ClassNodeList.GetNext(Pos);
1080  if (IsEqualGUID(*Node->GetClassGuid(), *ClassGuid))
1081  {
1082  ATLASSERT(Node->GetNodeType() == ClassNode);
1083  break;
1084  }
1085 
1086  Node = nullptr;
1087 
1088  } while (Pos != NULL);
1089 
1090  return Node;
1091 }
1092 
1093 CDeviceNode*
1096  )
1097 {
1098  POSITION Pos;
1099  CDeviceNode *Node = nullptr;
1100 
1101  Pos = m_DeviceNodeList.GetHeadPosition();
1102  if (Pos == NULL)
1103  return nullptr;
1104 
1105  do
1106  {
1107  Node = m_DeviceNodeList.GetNext(Pos);
1108  if (Node->GetDeviceInst() == Device)
1109  {
1110  ATLASSERT(Node->GetNodeType() == DeviceNode);
1111  break;
1112  }
1113 
1114  Node = nullptr;
1115 
1116  } while (Pos != NULL);
1117 
1118  return Node;
1119 }
1120 
1122  _In_ LPTV_ITEMW TvItem
1123  )
1124 {
1125  TvItem->mask = TVIF_PARAM;
1126  if (TreeView_GetItem(m_hTreeView, TvItem))
1127  {
1128  return (CNode *)TvItem->lParam;
1129  }
1130  return nullptr;
1131 }
1132 
1133 void
1135 {
1136  CNode *Node;
1137 
1138  while (!m_ClassNodeList.IsEmpty())
1139  {
1140  Node = m_ClassNodeList.RemoveTail();
1141  delete Node;
1142  }
1143 
1144  while (!m_DeviceNodeList.IsEmpty())
1145  {
1146  Node = m_DeviceNodeList.RemoveTail();
1147  delete Node;
1148  }
1149 }
1150 
1151 bool
1153 {
1154  GUID ClassGuid;
1157  HDEVINFO hDevInfo;
1159  DWORD i;
1160  BOOL Success;
1161 
1162  ULONG ClassIndex = 0;
1163 
1164  EmptyLists();
1165 
1166  if (m_RootNode) delete m_RootNode;
1168  m_RootNode->SetupNode();
1169 
1170  // Loop through all the classes
1171  do
1172  {
1173  Success = GetNextClass(ClassIndex, &ClassGuid, &hDevInfo);
1174  if (Success)
1175  {
1176  // Create a new class node and add it to the list
1177  ClassNode = new CClassNode(&ClassGuid, &m_ImageListData);
1178  if (ClassNode->SetupNode())
1179  {
1180  m_ClassNodeList.AddTail(ClassNode);
1181  }
1182 
1183  SetupDiDestroyDeviceInfoList(hDevInfo);
1184  }
1185  ClassIndex++;
1186  } while (Success);
1187 
1188  // Get all the devices on the local machine
1189  hDevInfo = SetupDiGetClassDevsW(NULL,
1190  0,
1191  0,
1193  if (hDevInfo == INVALID_HANDLE_VALUE)
1194  {
1195  return false;
1196  }
1197 
1198  // loop though all the devices
1200  for (i = 0;; i++)
1201  {
1202  // Get the devinst for this device
1204  if (Success == FALSE)
1205  break;
1206 
1207  // create a new device node and add it to the list
1209  /* FIXME: Start of Hack for CORE-5643 */
1210  if (!DeviceNode->IsInstalled())
1211  continue;
1212  /* FIXME: End of Hack for CORE-5643 */
1213 
1214  if (DeviceNode->SetupNode())
1215  {
1216  m_DeviceNodeList.AddTail(DeviceNode);
1217  }
1218  else
1219  {
1220  ATLASSERT(FALSE);
1221  }
1222  }
1223 
1224  SetupDiDestroyDeviceInfoList(hDevInfo);
1225 
1226  return TRUE;
1227 }
#define IDS_CONFIRM_DISABLE
Definition: resource.h:52
#define IDS_MENU_ADD
Definition: resource.h:61
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDM_UPDATE_DRV
Definition: resource.h:25
#define MFT_STRING
Definition: winuser.h:741
bool RecurseChildDevices(_In_ DEVINST ParentDevice, _In_ HTREEITEM hParentTreeItem)
Definition: DeviceView.cpp:600
#define TRUE
Definition: types.h:120
bool RunAddHardwareWizard()
Definition: DeviceView.cpp:767
#define TreeView_SortChildren(hwnd, hitem, recurse)
Definition: commctrl.h:3538
#define CloseHandle
Definition: compat.h:406
VOID SetFocus()
Definition: DeviceView.cpp:298
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3425
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
bool RefreshDeviceList()
Type
Definition: Type.h:6
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
#define IDYES
Definition: winuser.h:829
#define TV_ITEMW
Definition: commctrl.h:3293
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2297
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3413
#define pt(x, y)
Definition: drawing.c:79
VOID Refresh(_In_ ViewType Type, _In_ bool ScanForChanges, _In_ bool UpdateView)
Definition: DeviceView.cpp:195
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3462
#define TVS_LINESATROOT
Definition: commctrl.h:3245
CAtlList< CClassNode * > m_ClassNodeList
Definition: DeviceView.h:27
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
#define IDS_MENU_SCAN
Definition: resource.h:60
CONFIGRET WINAPI CM_Enumerate_Classes(_In_ ULONG ulClassIndex, _Out_ LPGUID ClassGuid, _In_ ULONG ulFlags)
Definition: cfgmgr.c:1983
bool CreateActionMenu(_In_ HMENU OwnerMenu, _In_ bool MainMenu)
Definition: DeviceView.cpp:304
ush Pos
Definition: deflate.h:92
_In_ LPCSTR lpName
Definition: winbase.h:2746
LPARAM lParam
Definition: commctrl.h:3321
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1642
HINSTANCE g_hThisInstance
Definition: MainWindow.cpp:26
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
CONFIGRET WINAPI CM_Get_Sibling(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:5443
~CDeviceView(void)
Definition: DeviceView.cpp:49
LPWSTR dwTypeData
Definition: winuser.h:3244
static WCHAR String[]
Definition: stringtable.c:55
#define WS_CHILD
Definition: pedump.c:617
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3463
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3267
#define SWP_NOZORDER
Definition: winuser.h:1232
UINT mask
Definition: commctrl.h:3312
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
LRESULT OnContextMenu(_In_ LPARAM lParam)
Definition: DeviceView.cpp:148
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
bool UpdateSelectedDevice(_Out_ bool &NeedsReboot)
Definition: DeviceView.cpp:725
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:441
int32_t INT
Definition: typedefs.h:56
#define TVHT_ONITEMICON
Definition: commctrl.h:3521
static BOOLEAN bSuccess
Definition: drive.cpp:419
#define _In_opt_
Definition: no_sal2.h:213
#define MB_ICONWARNING
Definition: winuser.h:780
ViewType m_ViewType
Definition: DeviceView.h:22
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
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
#define MIIM_SUBMENU
Definition: winuser.h:718
HWND m_hTreeView
Definition: DeviceView.h:19
HTREEITEM RecurseFindDevice(_In_ HTREEITEM hParentItem, _In_ CNode *Node)
Definition: DeviceView.cpp:950
CDeviceNode * GetDeviceNode(_In_ DEVINST Device)
#define MB_YESNO
Definition: winuser.h:811
ViewType GetCurrentView()
Definition: DeviceView.h:74
#define IDM_UNINSTALL_DRV
Definition: resource.h:26
bool UninstallSelectedDevice()
Definition: DeviceView.cpp:744
unsigned int BOOL
Definition: ntddk_ex.h:94
CAtlList< CDeviceNode * > m_DeviceNodeList
Definition: DeviceView.h:28
union node Node
Definition: types.h:1255
#define LPTV_ITEMW
Definition: commctrl.h:3291
static HTREEITEM hRoot
Definition: treeview.c:381
#define TVS_HASBUTTONS
Definition: commctrl.h:3243
bool EnableSelectedDevice(_In_ bool Enable, _Out_ bool &NeedsReboot)
Definition: DeviceView.cpp:697
CONFIGRET WINAPI CM_Get_Child(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:2518
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
#define CR_SUCCESS
Definition: cfgmgr32.h:842
NodeType GetNodeType()
Definition: Node.h:36
void EmptyLists()
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
HTREEITEM hItem
Definition: treelist.h:37
const WCHAR * str
#define TVIS_OVERLAYMASK
Definition: commctrl.h:3283
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
CNode * GetSelectedNode()
Definition: DeviceView.cpp:320
#define _Out_
Definition: no_sal2.h:323
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:85
LONG_PTR LPARAM
Definition: windef.h:208
virtual bool SetupNode()
Definition: RootNode.cpp:27
HWND m_hMainWnd
Definition: DeviceView.h:18
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3443
Definition: Node.h:12
Definition: Node.h:8
#define MIIM_ID
Definition: winuser.h:717
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
CStringT< wchar_t, StrTraitATL< wchar_t, ChTraitsCRT< wchar_t > > > CAtlStringW
Definition: atlstr.h:126
VOID DisplayPropertySheet()
Definition: DeviceView.cpp:284
LRESULT OnAction(UINT Action)
Definition: DeviceView.cpp:222
bool GetNextClass(_In_ ULONG ClassIndex, _Out_ LPGUID ClassGuid, _Out_ HDEVINFO *hDevInfo)
Definition: DeviceView.cpp:339
bool Initialize()
Definition: DeviceView.cpp:54
static void UpdateView(TreeListData *pData)
Definition: treelist.c:1636
#define FreeLibrary(x)
Definition: compat.h:413
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
LPGUID GetClassGuid()
Definition: Node.h:37
#define WC_TREEVIEW
Definition: commctrl.h:3241
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3509
bool GetSiblingDevice(_In_ DEVINST PrevDevice, _Out_ PDEVINST DevInst)
Definition: DeviceView.cpp:804
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
HTREEITEM m_hTreeRoot
Definition: DeviceView.h:23
bool ListDevicesByType()
Definition: DeviceView.cpp:435
#define WINAPI
Definition: msvc.h:6
bool AddRootDevice()
Definition: DeviceView.cpp:332
bool Uninitialize()
Definition: DeviceView.cpp:94
void SelectNode(_In_ CNode *Node)
ViewType
Definition: DeviceView.h:6
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
#define IDC_PROPERTIES
Definition: resource.h:32
void EmptyDeviceView()
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
CNode * GetNode(_In_ LPTV_ITEMW TvItem)
LRESULT OnSize(_In_ int x, _In_ int y, _In_ int cx, _In_ int cy)
Definition: DeviceView.cpp:108
#define __stdcall
Definition: typedefs.h:25
HTREEITEM InsertIntoTreeView(_In_opt_ HTREEITEM hParent, _In_ CNode *Node)
Definition: DeviceView.cpp:817
#define IDM_ADD_HARDWARE
Definition: resource.h:27
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: stubs.cpp:24
#define TVE_EXPAND
Definition: commctrl.h:3419
Definition: Node.h:9
#define INDEXTOOVERLAYMASK(i)
Definition: commctrl.h:421
#define MFT_SEPARATOR
Definition: winuser.h:739
VOID(WINAPI * PADDHARDWAREWIZARD)(HWND hwnd, LPWSTR lpName)
Definition: DeviceView.cpp:23
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
HWND hMainWnd
Definition: magnifier.c:32
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
CDeviceView * This
Definition: DeviceView.cpp:27
#define VOID
Definition: acefi.h:82
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
#define IDM_PROPERTIES
Definition: resources.h:9
#define IDC_TREEVIEW
Definition: resource.h:12
#define GUID_NULL
Definition: ks.h:106
#define false
Definition: stdbool.h:38
#define MessageBox
Definition: winuser.h:5797
#define IDS_MENU_DISABLE
Definition: resource.h:58
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define IDS_CONFIRM_UNINSTALL
Definition: resource.h:53
LPWSTR GetDeviceId()
Definition: Node.h:40
#define _In_
Definition: no_sal2.h:204
#define MIIM_STRING
Definition: winuser.h:722
#define IDM_SCAN_HARDWARE
Definition: resource.h:22
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DEVINST GetDeviceInst()
Definition: RootNode.h:15
#define TV_ITEM
Definition: commctrl.h:3296
#define WS_BORDER
Definition: pedump.c:625
DWORD DEVINST
Definition: cfgmgr32.h:76
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define TreeView_GetRoot(hwnd)
Definition: commctrl.h:3471
CDeviceView(HWND hMainWnd)
Definition: DeviceView.cpp:35
#define IDM_DISABLE_DRV
Definition: resource.h:24
#define TVIF_TEXT
Definition: commctrl.h:3262
#define IDS_MENU_ENABLE
Definition: resource.h:57
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3477
#define TVIF_IMAGE
Definition: commctrl.h:3263
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define MB_OK
Definition: winuser.h:784
#define IDS_MENU_PROPERTIES
Definition: resource.h:62
HTREEITEM hItem
Definition: commctrl.h:3313
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HANDLE hThread
Definition: wizard.c:27
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
DEVNODE * PDEVINST
Definition: cfgmgr32.h:77
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3248
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define IDS_MENU_UNINSTALL
Definition: resource.h:59
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define MB_DEFBUTTON2
Definition: winuser.h:793
#define TVS_HASLINES
Definition: commctrl.h:3244
_Out_opt_ int * cx
Definition: commctrl.h:581
#define TVSIL_NORMAL
Definition: commctrl.h:3439
bool GetChildDevice(_In_ DEVINST ParentDevInst, _Out_ PDEVINST DevInst)
Definition: DeviceView.cpp:791
#define IDS_MENU_UPDATE
Definition: resource.h:56
unsigned int ULONG
Definition: retypes.h:1
#define TVIF_STATE
Definition: commctrl.h:3265
CClassNode * GetClassNode(_In_ LPGUID ClassGuid)
static unsigned int __stdcall RefreshThread(void *Param)
Definition: DeviceView.cpp:375
#define GetProcAddress(x, y)
Definition: compat.h:418
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define TVIF_PARAM
Definition: commctrl.h:3264
struct _SP_CLASSIMAGELIST_DATA SP_CLASSIMAGELIST_DATA
void BuildActionMenuForNode(_In_ HMENU OwnerMenu, _In_ CNode *Node, _In_ bool MainMenu)
Definition: DeviceView.cpp:853
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
bool m_ShowHidden
Definition: DeviceView.h:24
#define MIIM_DATA
Definition: winuser.h:721
LONG_PTR LRESULT
Definition: windef.h:209
#define TVHT_ONITEM
Definition: commctrl.h:3523
#define TV_INSERTSTRUCT
Definition: commctrl.h:3373
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3416
#define WS_VISIBLE
Definition: pedump.c:620
INT_PTR WINAPI DevicePropertiesExW(IN HWND hWndParent OPTIONAL, IN LPCWSTR lpMachineName OPTIONAL, IN LPCWSTR lpDeviceID OPTIONAL, IN DWORD dwFlags OPTIONAL, IN BOOL bShowDevMgr)
Definition: api.cpp:272
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
LRESULT OnRightClick(_In_ LPNMHDR NmHdr)
Definition: DeviceView.cpp:128
struct tagMENUITEMINFOW MENUITEMINFOW
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
bool ListDevicesByConnection()
Definition: DeviceView.cpp:586
#define IDM_ENABLE_DRV
Definition: resource.h:23
SP_CLASSIMAGELIST_DATA m_ImageListData
Definition: DeviceView.h:29
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3486
CRootNode * m_RootNode
Definition: DeviceView.h:26
HMODULE hModule
Definition: animate.c:44
#define DIGCF_PRESENT
Definition: setupapi.h:171
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
Definition: dlist.c:348