ReactOS 0.4.17-dev-1190-g4c812f4
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 "restypes.h"
13#include "devmgmt.h"
14#include "DeviceView.h"
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 m_hRefreshThread(NULL),
46 m_RefreshDirty(false),
47 m_DirtyScanForChanges(false)
48{
50}
51
53{
54}
55
56bool
58{
59 // Get the device image list
62 if (bSuccess == FALSE)
63 return false;
64
65 // Create the main treeview
68 NULL,
71 0, 0, 0, 0,
75 NULL);
76 if (m_hTreeView)
77 {
78 // Set the image list against the treeview
82
83 // Give the treeview arrows instead of +/- boxes (on Win7)
84 SetWindowTheme(m_hTreeView, L"explorer", NULL);
85
86 // Create the root node
89 }
90
91
92
93 return !!(m_hTreeView);
94}
95
96bool
98{
100
102 {
105 }
106
107 return true;
108}
109
112 _In_ int x,
113 _In_ int y,
114 _In_ int cx,
115 _In_ int cy
116 )
117{
118 // Resize the treeview
120 NULL,
121 x,
122 y,
123 cx,
124 cy,
126
127 return 0;
128}
129
132 _In_ LPNMHDR NmHdr
133 )
134{
135 TVHITTESTINFO hitInfo;
137
138 GetCursorPos(&hitInfo.pt);
139 ScreenToClient(m_hTreeView, &hitInfo.pt);
140
141 // Check if we are trying to double-click an item
143 if (hItem != NULL && (hitInfo.flags & (TVHT_ONITEM | TVHT_ONITEMICON)))
144 {
146 }
147
148 return 0;
149}
150
153 _In_ LPNMHDR NmHdr
154 )
155{
156 TVHITTESTINFO hitInfo;
158
159 GetCursorPos(&hitInfo.pt);
160 ScreenToClient(m_hTreeView, &hitInfo.pt);
161
163 if (hItem != NULL && (hitInfo.flags & (TVHT_ONITEM | TVHT_ONITEMICON)))
164 {
166 }
167
168 return 0;
169}
170
174 )
175{
177
178 RECT rc;
180 hSelected,
181 &rc,
182 TRUE))
183 {
184 POINT pt;
185 if (GetCursorPos(&pt) &&
187 PtInRect(&rc, pt))
188 {
190 if (Node)
191 {
192 // Create the context menu
193 HMENU hContextMenu = CreatePopupMenu();
194
195 // Add the actions for this node
196 BuildActionMenuForNode(hContextMenu, Node, false);
197
198 INT xPos = GET_X_LPARAM(lParam);
199 INT yPos = GET_Y_LPARAM(lParam);
200
201 // Display the menu
202 TrackPopupMenuEx(hContextMenu,
204 xPos,
205 yPos,
207 NULL);
208
209 DestroyMenu(hContextMenu);
210 }
211 }
212 }
213
214 return 0;
215}
216
217
218void
221 _In_ bool ScanForChanges,
222 _In_ bool UpdateView
223 )
224{
225 // Enum devices on a separate thread to keep the gui responsive
226
228
229 // Overlapping refreshes free each other's nodes, so let the running one pick this up when it completes
231 {
232 m_RefreshDirty = true;
233 m_DirtyScanForChanges |= ScanForChanges;
234 return;
235 }
236
239 ThreadData->This = this;
240 ThreadData->ScanForChanges = ScanForChanges;
241 ThreadData->UpdateView = UpdateView;
242
244 0,
247 0,
248 NULL);
249 if (m_hRefreshThread == NULL)
250 delete ThreadData;
251}
252
256)
257{
258 switch (Action)
259 {
260 case IDM_PROPERTIES:
261 {
263 break;
264 }
265
267 {
269 true,
270 true);
271 break;
272 }
273
274 case IDM_ENABLE_DRV:
275 {
276 bool NeedsReboot;
277 if (EnableSelectedDevice(true, NeedsReboot) &&
278 NeedsReboot)
279 {
280 MessageBox(m_hMainWnd, L"Rebooting", L"Enable", MB_OK);
281 }
282 break;
283 }
284
285 case IDM_DISABLE_DRV:
286 {
287 bool NeedsReboot;
288 EnableSelectedDevice(false, NeedsReboot);
289 break;
290 }
291
292 case IDM_UPDATE_DRV:
293 {
294 bool NeedsReboot;
295 UpdateSelectedDevice(NeedsReboot);
296 break;
297 }
298
300 {
302 break;
303 }
304
305 case IDM_ADD_HARDWARE:
306 {
308 break;
309 }
310 }
311
312 return 0;
313}
314
315void
317{
319 if (Node && Node->HasProperties())
320 {
322 NULL,
323 Node->GetDeviceId(),
324 1,//DPF_EXTENDED,
325 FALSE);
326 }
327}
328
329void
331{
333}
334
335bool
337 _In_ HMENU OwnerMenu,
338 _In_ bool MainMenu
339 )
340{
342 if (Node)
343 {
344 BuildActionMenuForNode(OwnerMenu, Node, MainMenu);
345 return true;
346 }
347
348 return false;
349}
350
351CNode*
353{
354 TV_ITEM TvItem;
355 TvItem.hItem = TreeView_GetSelection(m_hTreeView);
356 return GetNode(&TvItem);
357}
358
359
360
361// PRIVATE METHODS *******************************************/
362
363bool
365{
367 return (m_hTreeRoot != NULL);
368}
369
370bool
372 _In_ ULONG ClassIndex,
373 _Out_ LPGUID ClassGuid,
374 _Out_ HDEVINFO *hDevInfo
375 )
376{
377 CONFIGRET cr;
378
379 // Get the next class in the list
380 cr = CM_Enumerate_Classes(ClassIndex,
381 ClassGuid,
382 0);
383 if (cr != CR_SUCCESS)
384 return false;
385
386 // We only want the devices for this class
387 *hDevInfo = SetupDiGetClassDevsW(ClassGuid,
388 NULL,
389 NULL,
391
392 return (hDevInfo != INVALID_HANDLE_VALUE);
393}
394
395unsigned int __stdcall CDeviceView::RefreshThread(void *Param)
396{
398 CDeviceView *This = ThreadData->This;
399
400 // Get a copy of the currently selected node
401 CNode *LastSelectedNode = This->GetSelectedNode();
402 if (LastSelectedNode == nullptr || (LastSelectedNode->GetNodeType() == RootNode))
403 {
404 LastSelectedNode = new CRootNode(*This->m_RootNode);
405 }
406 else if (LastSelectedNode->GetNodeType() == ClassNode)
407 {
408 LastSelectedNode = new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode));
409 }
410 else if (LastSelectedNode->GetNodeType() == DeviceNode)
411 {
412 LastSelectedNode = new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode));
413 }
414
415 // Empty the treeview
416 This->EmptyDeviceView();
417
418 // Refresh the devices only if requested
419 if (ThreadData->ScanForChanges)
420 {
421 This->RefreshDeviceList();
422 }
423
424 // Re-add the root node to the tree
425 if (This->AddRootDevice() == false)
426 {
427 PostMessageW(This->m_hMainWnd, WM_REFRESH_COMPLETE, 0, 0);
428 delete ThreadData;
429 return 0;
430 }
431
432 // display the type of view the user wants
433 switch (This->m_ViewType)
434 {
435 case DevicesByType:
436 (void)This->ListDevicesByType();
437 break;
438
440 (VOID)This->ListDevicesByConnection();
441 break;
442
443 case ResourcesByType:
444 (VOID)This->ListResourcesByType();
445 break;
446
448 break;
449 }
450
451 This->SelectNode(LastSelectedNode);
452
453 PostMessageW(This->m_hMainWnd, WM_REFRESH_COMPLETE, 0, 0);
454 delete ThreadData;
455
456 return 0;
457}
458
459VOID
461{
462 bool ScanForChanges;
463
464 if (m_hRefreshThread == NULL)
465 return;
466
469
470 // Pick up any changes that came in while the last refresh was running
471 if (m_RefreshDirty)
472 {
473 ScanForChanges = m_DirtyScanForChanges;
474 m_RefreshDirty = false;
475 m_DirtyScanForChanges = false;
476 Refresh(m_ViewType, ScanForChanges, true);
477 }
478}
479
480bool
482{
485 HDEVINFO hDevInfo;
486 HTREEITEM hTreeItem = NULL;
487 GUID ClassGuid;
488 INT ClassIndex;
489 BOOL bClassSuccess, bSuccess;
490
491 ClassIndex = 0;
492 do
493 {
494 // Loop through all the device classes
495 bClassSuccess = GetNextClass(ClassIndex, &ClassGuid, &hDevInfo);
496 if (bClassSuccess)
497 {
498 bool AddedParent = false;
499 INT DeviceIndex = 0;
500 bool MoreItems = false;
501
502 // Get the cached class node
503 ClassNode = GetClassNode(&ClassGuid);
504 if (ClassNode == nullptr)
505 {
506 ClassIndex++;
507 continue;
508 }
509
510 // Check if this is a hidden class
511 if (IsEqualGUID(ClassGuid, GUID_DEVCLASS_LEGACYDRIVER) ||
512 IsEqualGUID(ClassGuid, GUID_DEVCLASS_VOLUME))
513 {
514 // Ignore this device if we aren't displaying hidden devices
515 if (m_ShowHidden == FALSE)
516 {
517 ClassIndex++;
518 continue;
519 }
520 }
521
522 do
523 {
524 // Get a handle to all the devices in this class
528 bSuccess = SetupDiEnumDeviceInfo(hDevInfo,
529 DeviceIndex,
531 if (bSuccess == FALSE && GetLastError() == ERROR_NO_MORE_ITEMS)
532 MoreItems = false;
533
534 if (bSuccess)
535 {
536 MoreItems = true;
537
538 // Get the cached device node
540 if (DeviceNode == nullptr)
541 {
542 DeviceIndex++;
543 continue;
544 }
545
546 // Check if this is a hidden device
547 if (DeviceNode->IsHidden())
548 {
549 // Ignore this device if we aren't displaying hidden devices
550 if (m_ShowHidden == FALSE)
551 {
552 DeviceIndex++;
553 continue;
554 }
555 }
556
557 // We have a device, we need to add the parent if it hasn't yet been added
558 if (AddedParent == false)
559 {
560 // Insert the new class under the root item
562 ClassNode);
563 AddedParent = true;
564 }
565
566 // Add the device under the class item node
568
569 // Expand the class if it has a problem device
570 if (DeviceNode->HasProblem())
571 {
573 hTreeItem,
574 TVE_EXPAND);
575 }
576 }
577
578 DeviceIndex++;
579
580 } while (MoreItems);
581
582 // If this class has devices, sort them alphabetically
583 if (AddedParent == true)
584 {
586 hTreeItem,
587 0);
588 }
589 }
590
591 ClassIndex++;
592
593 } while (bClassSuccess);
594
595 // Sort the classes alphabetically
598 0);
599
600 // Expand the root item
603 TVE_EXPAND);
604
605 // Pre-select the root item
608
609 return 0;
610}
611
612bool
614{
615 // Walk the device tree and add all the devices
617
618 // Expand the root item
621 TVE_EXPAND);
622
623 return true;
624}
625
626bool
628{
629 HTREEITEM hMemoryTreeItem = NULL;
630 HTREEITEM hPortTreeItem = NULL;
631 HTREEITEM hDmaTreeItem = NULL;
632 HTREEITEM hIrqTreeItem = NULL;
633
635 hMemoryTreeItem = InsertIntoTreeView(m_hTreeRoot,
636 MemoryNode);
637
639 hPortTreeItem = InsertIntoTreeView(m_hTreeRoot,
640 PortNode);
641
643 hDmaTreeItem = InsertIntoTreeView(m_hTreeRoot,
644 DmaNode);
645
647 hIrqTreeItem = InsertIntoTreeView(m_hTreeRoot,
648 IrqNode);
649
650 // Walk the device tree and add all the resources
652 hMemoryTreeItem,
653 hPortTreeItem,
654 hDmaTreeItem,
655 hIrqTreeItem);
656
657 // Sort the resource types alphabetically
660 0);
661
662 // Expand the root item
665 TVE_EXPAND);
666
667 return true;
668}
669
670
671bool
674 _In_ HTREEITEM hMemoryTreeItem,
675 _In_ HTREEITEM hPortTreeItem,
676 _In_ HTREEITEM hDmaTreeItem,
677 _In_ HTREEITEM hIrqTreeItem
678 )
679{
681 bool bSuccess;
682 ULONG Index;
683
684 // Check if the parent has any child devices
686 return true;
687
688 // Get the cached device node
690 DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
691 if (DeviceNode == nullptr)
692 {
693 return false;
694 }
695
696 PCM_RESOURCE_LIST pResourceList = (PCM_RESOURCE_LIST)GetResourceList(DeviceNode->GetDeviceId());
697 if (pResourceList)
698 {
699
700 for (Index = 0; Index < pResourceList->List[0].PartialResourceList.Count; Index++)
701 {
703
705 {
707 InsertIntoTreeView(hIrqTreeItem, resNode);
708 }
709 else if (Descriptor->Type == CmResourceTypePort)
710 {
712 InsertIntoTreeView(hPortTreeItem, resNode);
713 }
714 else if (Descriptor->Type == CmResourceTypeMemory)
715 {
717 InsertIntoTreeView(hMemoryTreeItem, resNode);
718 }
719 else if (Descriptor->Type == CmResourceTypeDma)
720 {
722 InsertIntoTreeView(hDmaTreeItem, resNode);
723 }
724 }
725
726 HeapFree(GetProcessHeap(), 0, pResourceList);
727 }
728
729 RecurseResources(Device, hMemoryTreeItem, hPortTreeItem, hDmaTreeItem, hIrqTreeItem);
730
731 // Check for siblings
732 for (;;)
733 {
734 // Check if the parent device has anything at the same level
735 bSuccess = GetSiblingDevice(Device, &Device);
736 if (bSuccess == FALSE)
737 break;
738
739 DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
740 if (DeviceNode == nullptr)
741 {
742 continue;
743 }
744
745 PCM_RESOURCE_LIST pResourceList = (PCM_RESOURCE_LIST)GetResourceList(DeviceNode->GetDeviceId());
746 if (pResourceList)
747 {
748 for (Index = 0; Index < pResourceList->List[0].PartialResourceList.Count; Index++)
749 {
751
753 {
755 InsertIntoTreeView(hIrqTreeItem, resNode);
756 }
757 else if (Descriptor->Type == CmResourceTypePort)
758 {
760 InsertIntoTreeView(hPortTreeItem, resNode);
761 }
762 else if (Descriptor->Type == CmResourceTypeMemory)
763 {
765 InsertIntoTreeView(hMemoryTreeItem, resNode);
766 }
767 else if (Descriptor->Type == CmResourceTypeDma)
768 {
770 InsertIntoTreeView(hDmaTreeItem, resNode);
771 }
772 }
773
774 HeapFree(GetProcessHeap(), 0, pResourceList);
775 }
776
777 RecurseResources(Device, hMemoryTreeItem, hPortTreeItem, hDmaTreeItem, hIrqTreeItem);
778 }
779
781 hMemoryTreeItem,
782 0);
783
785 hPortTreeItem,
786 0);
787
789 hIrqTreeItem,
790 0);
791
793 hDmaTreeItem,
794 0);
795
796 return true;
797}
798
799
800bool
803 _In_ HTREEITEM hParentTreeItem
804 )
805{
806 HTREEITEM hDevItem = NULL;
808 bool HasProblem = false;
809 bool bSuccess;
810
811 // Check if the parent has any child devices
813 return true;
814
815 // Get the cached device node
817 DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
818 if (DeviceNode == nullptr)
819 {
820 return false;
821 }
822
823 // Don't show hidden devices if not requested
824 if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
825 {
826 // Add this device to the tree under its parent
827 hDevItem = InsertIntoTreeView(hParentTreeItem,
828 DeviceNode);
829 if (hDevItem)
830 {
831 // Check if this child has any children itself
832 if (!RecurseChildDevices(Device, hDevItem))
833 HasProblem = true;
834 }
835
836 if (DeviceNode->HasProblem())
837 {
838 HasProblem = true;
839 }
840 }
841
842
843 // Check for siblings
844 for (;;)
845 {
846 // Check if the parent device has anything at the same level
847 bSuccess = GetSiblingDevice(Device, &Device);
848 if (bSuccess == FALSE)
849 break;
850
851 DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device));
852 if (DeviceNode == nullptr)
853 {
854 continue;
855 }
856
857 // Don't show hidden devices if not requested
858 if ((m_ShowHidden == TRUE) || (!(DeviceNode->IsHidden())))
859 {
860 if (DeviceNode->HasProblem())
861 {
862 HasProblem = true;
863 }
864
865 // Add this device to the tree under its parent
866 hDevItem = InsertIntoTreeView(hParentTreeItem,
867 DeviceNode);
868 if (hDevItem)
869 {
870 // Check if this child has any children itself
871 if (!RecurseChildDevices(Device, hDevItem))
872 HasProblem = true;
873 }
874 }
875 }
876
878 hParentTreeItem,
879 0);
880
881 // Expand the class if it has a problem device
882 if (HasProblem == true)
883 {
885 hParentTreeItem,
886 TVE_EXPAND);
887 }
888
889 // If there was a problem, expand the ancestors
890 if (HasProblem)
891 return false;
892
893 return true;
894}
895
896bool
898 _In_ bool Enable,
899 _Out_ bool &NeedsReboot
900 )
901{
902 CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
903 if (Node == nullptr)
904 return false;
905
906 if (Enable == false)
907 {
908 CAtlStringW str;
909 if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE))
910 {
912 str,
913 Node->GetDisplayName(),
915 {
916 return false;
917 }
918 }
919 }
920
921 return Node->EnableDevice(Enable, NeedsReboot);
922}
923
924bool
926 _Out_ bool &NeedsReboot
927 )
928{
929 CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
930 if (Node == nullptr)
931 return false;
932
933 DWORD dwReboot;
934 if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot))
935 {
936 NeedsReboot = false;
937 return true;
938 }
939
940 return false;
941}
942
943bool
945 )
946{
947 CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
948 if (Node == nullptr)
949 return false;
950
951 CAtlStringW str;
952 if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL))
953 {
955 str,
956 Node->GetDisplayName(),
958 {
959 return false;
960 }
961 }
962
963 return Node->UninstallDevice();
964}
965
966bool
968{
969 PADDHARDWAREWIZARD pAddHardwareWizard;
971
972 hModule = LoadLibraryW(L"hdwwiz.cpl");
973 if (hModule == NULL)
974 return false;
975
976 pAddHardwareWizard = (PADDHARDWAREWIZARD)GetProcAddress(hModule,
977 "AddHardwareWizard");
978 if (pAddHardwareWizard == NULL)
979 {
981 return false;
982 }
983
984 pAddHardwareWizard(m_hMainWnd, NULL);
985
987 return true;
988}
989
990bool
992 _In_ DEVINST ParentDevInst,
993 _Out_ PDEVINST DevInst
994)
995{
996 CONFIGRET cr;
997 cr = CM_Get_Child(DevInst,
998 ParentDevInst,
999 0);
1000 return (cr == CR_SUCCESS);
1001}
1002
1003bool
1005 _In_ DEVINST PrevDevice,
1006 _Out_ PDEVINST DevInst
1007)
1008{
1009 CONFIGRET cr;
1010 cr = CM_Get_Sibling(DevInst,
1011 PrevDevice,
1012 0);
1013 return (cr == CR_SUCCESS);
1014}
1015
1018 _In_opt_ HTREEITEM hParent,
1019 _In_ CNode *Node
1020 )
1021{
1022 LPWSTR lpLabel;
1023 lpLabel = Node->GetDisplayName();
1024
1025 TV_ITEMW tvi;
1026 TV_INSERTSTRUCT tvins;
1027 ZeroMemory(&tvi, sizeof(tvi));
1028 ZeroMemory(&tvins, sizeof(tvins));
1029
1031 tvi.pszText = lpLabel;
1032 tvi.cchTextMax = wcslen(lpLabel);
1033 tvi.lParam = (LPARAM)Node;
1034 tvi.iImage = Node->GetClassImage();
1035 tvi.iSelectedImage = Node->GetClassImage();
1036
1037 // try to cast it to a device node. This will only succeed if it's the correct type
1038 CDeviceNode *DeviceNode = dynamic_cast<CDeviceNode *>(Node);
1039 if (DeviceNode && DeviceNode->GetOverlayImage())
1040 {
1041 tvi.mask |= TVIF_STATE;
1042 tvi.stateMask = TVIS_OVERLAYMASK;
1043 tvi.state = INDEXTOOVERLAYMASK(DeviceNode->GetOverlayImage());
1044 }
1045
1046 tvins.item = tvi;
1047 tvins.hParent = hParent;
1048
1049 return TreeView_InsertItem(m_hTreeView, &tvins);
1050}
1051
1052void
1054 _In_ HMENU OwnerMenu,
1055 _In_ CNode *Node,
1056 _In_ bool MainMenu
1057 )
1058{
1059 // Create a separator structure
1060 MENUITEMINFOW MenuSeparator = { 0 };
1061 MenuSeparator.cbSize = sizeof(MENUITEMINFOW);
1062 MenuSeparator.fType = MFT_SEPARATOR;
1063
1064 // Setup the
1065 MENUITEMINFOW MenuItemInfo = { 0 };
1066 MenuItemInfo.cbSize = sizeof(MENUITEMINFOW);
1067 MenuItemInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_SUBMENU;
1068 MenuItemInfo.fType = MFT_STRING;
1069
1070 CAtlStringW String;
1071 int i = 0;
1072
1073 // Device nodes have extra data
1074 if (Node->GetNodeType() == DeviceNode)
1075 {
1076 CDeviceNode *DeviceNode = dynamic_cast<CDeviceNode *>(Node);
1077
1078 if (DeviceNode->CanUpdate())
1079 {
1081 MenuItemInfo.wID = IDM_UPDATE_DRV;
1082 MenuItemInfo.dwTypeData = String.GetBuffer();
1083 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1084 i++;
1085 }
1086
1087 if (DeviceNode->IsDisabled())
1088 {
1090 MenuItemInfo.wID = IDM_ENABLE_DRV;
1091 MenuItemInfo.dwTypeData = String.GetBuffer();
1092 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1093 i++;
1094 }
1095
1096 if (DeviceNode->CanDisable() && !DeviceNode->IsDisabled())
1097 {
1099 MenuItemInfo.wID = IDM_DISABLE_DRV;
1100 MenuItemInfo.dwTypeData = String.GetBuffer();
1101 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1102 i++;
1103 }
1104
1105 if (DeviceNode->CanUninstall())
1106 {
1108 MenuItemInfo.wID = IDM_UNINSTALL_DRV;
1109 MenuItemInfo.dwTypeData = String.GetBuffer();
1110 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1111 i++;
1112 }
1113
1114 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeparator);
1115 i++;
1116 }
1117
1118 // All nodes have the scan option
1119 String.LoadStringW(g_hThisInstance, IDS_MENU_SCAN);
1120 MenuItemInfo.wID = IDM_SCAN_HARDWARE;
1121 MenuItemInfo.dwTypeData = String.GetBuffer();
1122 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1123 i++;
1124
1125 if ((Node->GetNodeType() == RootNode) || (MainMenu == true))
1126 {
1127 String.LoadStringW(g_hThisInstance, IDS_MENU_ADD);
1128 MenuItemInfo.wID = IDM_ADD_HARDWARE;
1129 MenuItemInfo.dwTypeData = String.GetBuffer();
1130 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1131 i++;
1132 }
1133
1134 if (Node->HasProperties())
1135 {
1136 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuSeparator);
1137 i++;
1138
1140 MenuItemInfo.wID = IDM_PROPERTIES;
1141 MenuItemInfo.dwTypeData = String.GetBuffer();
1142 InsertMenuItemW(OwnerMenu, i, TRUE, &MenuItemInfo);
1143 i++;
1144
1146 }
1147}
1148
1151 _In_ HTREEITEM hParentItem,
1152 _In_ CNode *Node
1153 )
1154{
1155 HTREEITEM FoundItem;
1157 TVITEMW tvItem;
1158 CNode *FoundNode;
1159
1160 // Check if this node has any children
1161 hItem = TreeView_GetChild(m_hTreeView, hParentItem);
1162 if (hItem == NULL)
1163 return NULL;
1164
1165 // The lParam contains the node pointer data
1166 tvItem.hItem = hItem;
1167 tvItem.mask = TVIF_PARAM;
1168 if (TreeView_GetItem(m_hTreeView, &tvItem) &&
1169 tvItem.lParam != NULL)
1170 {
1171 // check for a matching node
1172 FoundNode = reinterpret_cast<CNode *>(tvItem.lParam);
1173 if ((FoundNode->GetNodeType() == Node->GetNodeType()) &&
1174 (IsEqualGUID(*FoundNode->GetClassGuid(), *Node->GetClassGuid())))
1175 {
1176 // check if this is a class node, or a device with matching ID's
1177 if ((FoundNode->GetNodeType() == ClassNode) ||
1178 (wcscmp(FoundNode->GetDeviceId(), Node->GetDeviceId()) == 0))
1179 {
1180 return hItem;
1181 }
1182 }
1183 }
1184
1185 // This node may have its own children
1186 FoundItem = RecurseFindDevice(hItem, Node);
1187 if (FoundItem)
1188 return FoundItem;
1189
1190 // Loop all the siblings
1191 for (;;)
1192 {
1193 // Get the next item at this level
1195 if (hItem == NULL)
1196 break;
1197
1198 // The lParam contains the node pointer data
1199 tvItem.hItem = hItem;
1200 tvItem.mask = TVIF_PARAM;
1201 if (TreeView_GetItem(m_hTreeView, &tvItem))
1202 {
1203 // check for a matching class
1204 FoundNode = reinterpret_cast<CNode *>(tvItem.lParam);
1205 if ((FoundNode->GetNodeType() == Node->GetNodeType()) &&
1206 (IsEqualGUID(*FoundNode->GetClassGuid(), *Node->GetClassGuid())))
1207 {
1208 // check if this is a class node, or a device with matching ID's
1209 if ((FoundNode->GetNodeType() == ClassNode) ||
1210 (wcscmp(FoundNode->GetDeviceId(), Node->GetDeviceId()) == 0))
1211 {
1212 return hItem;
1213 }
1214 }
1215 }
1216
1217 // This node may have its own children
1218 FoundItem = RecurseFindDevice(hItem, Node);
1219 if (FoundItem)
1220 return FoundItem;
1221 }
1222
1223 return hItem;
1224}
1225
1226void
1228 _In_ CNode *Node
1229 )
1230{
1232
1233 // Check if there are any items in the tree
1235 if (hRoot == NULL)
1236 return;
1237
1238 // If we don't want to set select a node, just select root
1239 if (Node == nullptr || Node->GetNodeType() == RootNode)
1240 {
1242 return;
1243 }
1244
1245 // Scan the tree looking for the node we want
1247 if (hItem)
1248 {
1250 }
1251 else
1252 {
1254 }
1255}
1256
1257
1258void
1260{
1262}
1263
1264
1267 _In_ LPGUID ClassGuid
1268 )
1269{
1270 POSITION Pos;
1271 CClassNode *Node = nullptr;
1272
1273 Pos = m_ClassNodeList.GetHeadPosition();
1274 if (Pos == NULL)
1275 return nullptr;
1276
1277 do
1278 {
1279 Node = m_ClassNodeList.GetNext(Pos);
1280 if (IsEqualGUID(*Node->GetClassGuid(), *ClassGuid))
1281 {
1282 ATLASSERT(Node->GetNodeType() == ClassNode);
1283 break;
1284 }
1285
1286 Node = nullptr;
1287
1288 } while (Pos != NULL);
1289
1290 return Node;
1291}
1292
1296 )
1297{
1298 POSITION Pos;
1299 CDeviceNode *Node = nullptr;
1300
1301 Pos = m_DeviceNodeList.GetHeadPosition();
1302 if (Pos == NULL)
1303 return nullptr;
1304
1305 do
1306 {
1307 Node = m_DeviceNodeList.GetNext(Pos);
1308 if (Node->GetDeviceInst() == Device)
1309 {
1310 ATLASSERT(Node->GetNodeType() == DeviceNode);
1311 break;
1312 }
1313
1314 Node = nullptr;
1315
1316 } while (Pos != NULL);
1317
1318 return Node;
1319}
1320
1322 _In_ LPTV_ITEMW TvItem
1323 )
1324{
1325 TvItem->mask = TVIF_PARAM;
1326 if (TreeView_GetItem(m_hTreeView, TvItem))
1327 {
1328 return (CNode *)TvItem->lParam;
1329 }
1330 return nullptr;
1331}
1332
1333void
1335{
1336 CNode *Node;
1337
1338 while (!m_ClassNodeList.IsEmpty())
1339 {
1340 Node = m_ClassNodeList.RemoveTail();
1341 delete Node;
1342 }
1343
1344 while (!m_DeviceNodeList.IsEmpty())
1345 {
1346 Node = m_DeviceNodeList.RemoveTail();
1347 delete Node;
1348 }
1349}
1350
1351bool
1353{
1354 GUID ClassGuid;
1357 HDEVINFO hDevInfo;
1359 DWORD i;
1360 BOOL Success;
1361
1362 ULONG ClassIndex = 0;
1363
1364 EmptyLists();
1365
1366 if (m_RootNode) delete m_RootNode;
1369
1370 // Loop through all the classes
1371 do
1372 {
1373 Success = GetNextClass(ClassIndex, &ClassGuid, &hDevInfo);
1374 if (Success)
1375 {
1376 // Create a new class node and add it to the list
1377 ClassNode = new CClassNode(&ClassGuid, &m_ImageListData);
1378 if (ClassNode->SetupNode())
1379 {
1380 m_ClassNodeList.AddTail(ClassNode);
1381 }
1382
1384 }
1385 ClassIndex++;
1386 } while (Success);
1387
1388 // Get all the devices on the local machine
1389 hDevInfo = SetupDiGetClassDevsW(NULL,
1390 0,
1391 0,
1393 if (hDevInfo == INVALID_HANDLE_VALUE)
1394 {
1395 return false;
1396 }
1397
1398 // loop though all the devices
1400 for (i = 0;; i++)
1401 {
1402 // Get the devinst for this device
1404 if (Success == FALSE)
1405 break;
1406
1407 // create a new device node and add it to the list
1409 if (DeviceNode->SetupNode())
1410 {
1412 }
1413 else
1414 {
1416 }
1417 }
1418
1420
1421 return TRUE;
1422}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
VOID(WINAPI * PADDHARDWAREWIZARD)(HWND hwnd, LPWSTR lpName)
Definition: DeviceView.cpp:23
ViewType
Definition: DeviceView.h:9
@ DevicesByConnection
Definition: DeviceView.h:11
@ ResourcesByType
Definition: DeviceView.h:12
@ ResourcesByConnection
Definition: DeviceView.h:13
@ DevicesByType
Definition: DeviceView.h:10
#define WM_REFRESH_COMPLETE
Definition: DeviceView.h:16
@ ClassNode
Definition: Node.h:8
@ DeviceNode
Definition: Node.h:9
Type
Definition: Type.h:7
#define VOID
Definition: acefi.h:82
#define IDS_TYPE_DMA
Definition: resource.h:224
#define IDS_TYPE_PORT
Definition: resource.h:221
#define IDS_TYPE_MEMORY
Definition: resource.h:223
#define IDM_PROPERTIES
Definition: resources.h:9
DEVNODE * PDEVINST
Definition: cfgmgr32.h:77
DWORD DEVINST
Definition: cfgmgr32.h:76
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define CR_SUCCESS
Definition: cfgmgr32.h:842
CONFIGRET WINAPI CM_Get_Child(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:2623
CONFIGRET WINAPI CM_Enumerate_Classes(_In_ ULONG ulClassIndex, _Out_ LPGUID ClassGuid, _In_ ULONG ulFlags)
Definition: cfgmgr.c:2077
CONFIGRET WINAPI CM_Get_Sibling(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:5695
~CDeviceView(void)
Definition: DeviceView.cpp:52
HWND m_hMainWnd
Definition: DeviceView.h:21
CAtlList< CClassNode * > m_ClassNodeList
Definition: DeviceView.h:30
bool RunAddHardwareWizard()
Definition: DeviceView.cpp:967
void EmptyLists()
bool RecurseResources(_In_ DEVINST ParentDevice, _In_ HTREEITEM hMemoryTreeItem, _In_ HTREEITEM hPortTreeItem, _In_ HTREEITEM hDmaTreeItem, _In_ HTREEITEM hIrqTreeItem)
Definition: DeviceView.cpp:672
void BuildActionMenuForNode(_In_ HMENU OwnerMenu, _In_ CNode *Node, _In_ bool MainMenu)
CNode * GetSelectedNode()
Definition: DeviceView.cpp:352
LRESULT OnSize(_In_ int x, _In_ int y, _In_ int cx, _In_ int cy)
Definition: DeviceView.cpp:111
VOID OnRefreshComplete()
Definition: DeviceView.cpp:460
HWND m_hTreeView
Definition: DeviceView.h:22
bool RecurseChildDevices(_In_ DEVINST ParentDevice, _In_ HTREEITEM hParentTreeItem)
Definition: DeviceView.cpp:801
VOID DisplayPropertySheet()
Definition: DeviceView.cpp:316
bool EnableSelectedDevice(_In_ bool Enable, _Out_ bool &NeedsReboot)
Definition: DeviceView.cpp:897
HTREEITEM RecurseFindDevice(_In_ HTREEITEM hParentItem, _In_ CNode *Node)
VOID SetFocus()
Definition: DeviceView.cpp:330
CNode * GetNode(_In_ LPTV_ITEMW TvItem)
bool RefreshDeviceList()
bool m_RefreshDirty
Definition: DeviceView.h:34
CRootNode * m_RootNode
Definition: DeviceView.h:29
bool ListDevicesByType()
Definition: DeviceView.cpp:481
bool GetChildDevice(_In_ DEVINST ParentDevInst, _Out_ PDEVINST DevInst)
Definition: DeviceView.cpp:991
void EmptyDeviceView()
bool UninstallSelectedDevice()
Definition: DeviceView.cpp:944
void SelectNode(_In_ CNode *Node)
ViewType GetCurrentView()
Definition: DeviceView.h:86
bool AddRootDevice()
Definition: DeviceView.cpp:364
bool m_DirtyScanForChanges
Definition: DeviceView.h:35
bool GetNextClass(_In_ ULONG ClassIndex, _Out_ LPGUID ClassGuid, _Out_ HDEVINFO *hDevInfo)
Definition: DeviceView.cpp:371
CDeviceNode * GetDeviceNode(_In_ DEVINST Device)
bool ListResourcesByType()
Definition: DeviceView.cpp:627
HTREEITEM m_hTreeRoot
Definition: DeviceView.h:26
CAtlList< CDeviceNode * > m_DeviceNodeList
Definition: DeviceView.h:31
HTREEITEM InsertIntoTreeView(_In_opt_ HTREEITEM hParent, _In_ CNode *Node)
bool GetSiblingDevice(_In_ DEVINST PrevDevice, _Out_ PDEVINST DevInst)
ViewType m_ViewType
Definition: DeviceView.h:25
static unsigned int __stdcall RefreshThread(void *Param)
Definition: DeviceView.cpp:395
VOID Refresh(_In_ ViewType Type, _In_ bool ScanForChanges, _In_ bool UpdateView)
Definition: DeviceView.cpp:219
CClassNode * GetClassNode(_In_ LPGUID ClassGuid)
bool UpdateSelectedDevice(_Out_ bool &NeedsReboot)
Definition: DeviceView.cpp:925
CDeviceView(HWND hMainWnd)
Definition: DeviceView.cpp:35
bool Uninitialize()
Definition: DeviceView.cpp:97
HANDLE m_hRefreshThread
Definition: DeviceView.h:33
LRESULT OnAction(UINT Action)
Definition: DeviceView.cpp:254
SP_CLASSIMAGELIST_DATA m_ImageListData
Definition: DeviceView.h:32
LRESULT OnRightClick(_In_ LPNMHDR NmHdr)
Definition: DeviceView.cpp:152
bool Initialize()
Definition: DeviceView.cpp:57
bool CreateActionMenu(_In_ HMENU OwnerMenu, _In_ bool MainMenu)
Definition: DeviceView.cpp:336
LRESULT OnContextMenu(_In_ LPARAM lParam)
Definition: DeviceView.cpp:172
bool m_ShowHidden
Definition: DeviceView.h:27
LRESULT OnDoubleClick(_In_ LPNMHDR NmHdr)
Definition: DeviceView.cpp:131
bool ListDevicesByConnection()
Definition: DeviceView.cpp:613
Definition: Node.h:15
LPGUID GetClassGuid()
Definition: Node.h:39
LPWSTR GetDeviceId()
Definition: Node.h:42
NodeType GetNodeType()
Definition: Node.h:38
virtual bool SetupNode()
Definition: RootNode.cpp:27
DEVINST GetDeviceInst()
Definition: RootNode.h:15
LPARAM lParam
Definition: combotst.c:139
ush Pos
Definition: deflate.h:92
HINSTANCE g_hThisInstance
Definition: MainWindow.cpp:25
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
union node Node
Definition: types.h:1255
#define IDC_PROPERTIES
Definition: resource.h:35
HMODULE hModule
Definition: animate.c:44
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FreeLibrary(x)
Definition: compat.h:748
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define HeapFree(x, y, z)
Definition: compat.h:735
#define LoadLibraryW(x)
Definition: compat.h:747
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
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
Definition: stubs.cpp:24
#define IDS_MENU_SCAN
Definition: resource.h:61
#define IDM_UPDATE_DRV
Definition: resource.h:26
#define IDC_TREEVIEW
Definition: resource.h:13
#define IDS_CONFIRM_DISABLE
Definition: resource.h:53
#define IDM_SCAN_HARDWARE
Definition: resource.h:23
#define IDS_MENU_DISABLE
Definition: resource.h:59
#define IDS_MENU_PROPERTIES
Definition: resource.h:63
#define IDM_UNINSTALL_DRV
Definition: resource.h:27
#define IDS_MENU_UNINSTALL
Definition: resource.h:60
#define IDS_TYPE_IRQ
Definition: resource.h:97
#define IDM_ENABLE_DRV
Definition: resource.h:24
#define IDS_MENU_UPDATE
Definition: resource.h:57
#define IDM_DISABLE_DRV
Definition: resource.h:25
#define IDS_MENU_ENABLE
Definition: resource.h:58
#define IDS_MENU_ADD
Definition: resource.h:62
#define IDS_CONFIRM_UNINSTALL
Definition: resource.h:54
#define IDM_ADD_HARDWARE
Definition: resource.h:28
#define __stdcall
Definition: corecrt.h:120
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_ACRTIMP uintptr_t __cdecl _beginthreadex(void *, unsigned int, _beginthreadex_start_routine_t, void *, unsigned int, unsigned int *)
Definition: thread.c:207
#define false
Definition: stdbool.h:25
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:85
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:322
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:2030
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2535
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:3182
#define pt(x, y)
Definition: drawing.c:79
#define L(x)
Definition: resources.c:13
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
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
unsigned int UINT
Definition: sysinfo.c:13
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
void Refresh(void)
Definition: magnifier.c:317
HWND hMainWnd
Definition: magnifier.c:32
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
static HTREEITEM hRoot
Definition: treeview.c:383
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_VISIBLE
Definition: pedump.c:620
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define TVS_LINESATROOT
Definition: commctrl.h:3254
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3422
#define TVIF_TEXT
Definition: commctrl.h:3271
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3486
#define TVHT_ONITEM
Definition: commctrl.h:3532
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3425
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3471
#define TreeView_SortChildren(hwnd, hitem, recurse)
Definition: commctrl.h:3547
#define TVIF_IMAGE
Definition: commctrl.h:3272
#define TVSIL_NORMAL
Definition: commctrl.h:3448
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3257
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3478
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3495
#define TVS_HASLINES
Definition: commctrl.h:3253
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
Definition: commctrl.h:3434
#define TVE_EXPAND
Definition: commctrl.h:3428
#define TV_INSERTSTRUCT
Definition: commctrl.h:3382
#define TV_ITEMW
Definition: commctrl.h:3302
#define WC_TREEVIEW
Definition: commctrl.h:3250
#define TV_ITEM
Definition: commctrl.h:3305
#define TreeView_GetRoot(hwnd)
Definition: commctrl.h:3480
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3472
#define TVIS_OVERLAYMASK
Definition: commctrl.h:3292
#define TVS_HASBUTTONS
Definition: commctrl.h:3252
#define TVHT_ONITEMICON
Definition: commctrl.h:3530
#define LPTV_ITEMW
Definition: commctrl.h:3300
#define INDEXTOOVERLAYMASK(i)
Definition: commctrl.h:425
#define TVIF_PARAM
Definition: commctrl.h:3273
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3452
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3518
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3417
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3276
#define TVIF_STATE
Definition: commctrl.h:3274
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MIIM_STRING
Definition: winuser.h:738
#define MIIM_ID
Definition: winuser.h:733
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TPM_RIGHTBUTTON
Definition: winuser.h:2416
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:3074
#define MB_YESNO
Definition: winuser.h:828
#define MFT_SEPARATOR
Definition: winuser.h:755
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define MIIM_SUBMENU
Definition: winuser.h:734
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)
#define MB_OK
Definition: winuser.h:801
#define MB_ICONWARNING
Definition: winuser.h:797
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MessageBox
Definition: winuser.h:5988
#define MB_DEFBUTTON2
Definition: winuser.h:810
#define MFT_STRING
Definition: winuser.h:757
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define IDYES
Definition: winuser.h:846
#define SWP_NOZORDER
Definition: winuser.h:1258
#define MIIM_DATA
Definition: winuser.h:737
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
struct tagMENUITEMINFOW MENUITEMINFOW
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
PVOID GetResourceList(LPWSTR pszDeviceID)
Definition: hwresource.cpp:299
#define CmResourceTypeMemory
Definition: restypes.h:106
struct _CM_RESOURCE_LIST * PCM_RESOURCE_LIST
#define CmResourceTypeDma
Definition: restypes.h:107
#define CmResourceTypePort
Definition: restypes.h:104
#define CmResourceTypeInterrupt
Definition: restypes.h:105
const WCHAR * str
struct _SP_CLASSIMAGELIST_DATA SP_CLASSIMAGELIST_DATA
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1559
#define DIGCF_ALLCLASSES
Definition: setupapi.h:175
#define DIGCF_PRESENT
Definition: setupapi.h:174
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
Definition: dcommon.idl:28
CDeviceView * This
Definition: DeviceView.cpp:27
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:145
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: restypes.h:150
LPWSTR dwTypeData
Definition: winuser.h:3377
HTREEITEM hItem
Definition: commctrl.h:3322
LPARAM lParam
Definition: commctrl.h:3330
UINT mask
Definition: commctrl.h:3321
static void UpdateView(TreeListData *pData)
Definition: treelist.c:1636
HTREEITEM hItem
Definition: treelist.h:37
uint16_t * LPWSTR
Definition: typedefs.h:56
PVOID HANDLE
Definition: typedefs.h:73
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
Definition: dlist.c:348
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
_Must_inspect_result_ _In_ WDFDEVICE ParentDevice
Definition: wdfpdo.h:220
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LPCSTR lpName
Definition: winbase.h:2519
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299