18 #define CLASS_NAME_LEN 256 19 #define CLASS_DESC_LEN 256 20 #define ROOT_NAME_SIZE MAX_COMPUTERNAME_LENGTH + 1 40 m_hPropertyDialog(
NULL),
218 _In_ bool ScanForChanges,
390 CNode *LastSelectedNode =
This->GetSelectedNode();
397 LastSelectedNode =
new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode));
401 LastSelectedNode =
new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode));
405 This->EmptyDeviceView();
408 if (
This->AddRootDevice() ==
false)
414 This->RefreshDeviceList();
418 switch (
This->m_ViewType)
425 (
VOID)
This->ListDevicesByConnection();
435 This->SelectNode(LastSelectedNode);
458 bClassSuccess =
GetNextClass(ClassIndex, &ClassGuid, &hDevInfo);
461 bool AddedParent =
false;
463 bool MoreItems =
false;
474 if (
IsEqualGUID(ClassGuid, GUID_DEVCLASS_LEGACYDRIVER) ||
521 if (AddedParent ==
false)
546 if (AddedParent ==
true)
556 }
while (bClassSuccess);
597 bool HasProblem =
false;
671 if (HasProblem ==
true)
688 _Out_ bool &NeedsReboot
702 Node->GetDisplayName(),
710 return Node->EnableDevice(
Enable, NeedsReboot);
715 _Out_ bool &NeedsReboot
745 Node->GetDisplayName(),
752 return Node->UninstallDevice();
766 "AddHardwareWizard");
767 if (pAddHardwareWizard ==
NULL)
812 lpLabel =
Node->GetDisplayName();
820 tvi.pszText = lpLabel;
821 tvi.cchTextMax =
wcslen(lpLabel);
823 tvi.iImage =
Node->GetClassImage();
824 tvi.iSelectedImage =
Node->GetClassImage();
836 tvins.hParent = hParent;
914 if ((
Node->GetNodeType() ==
RootNode) || (MainMenu ==
true))
923 if (
Node->HasProperties())
961 FoundNode = reinterpret_cast<CNode *>(tvItem.
lParam);
993 FoundNode = reinterpret_cast<CNode *>(tvItem.
lParam);
1117 return (
CNode *)TvItem->lParam;
1151 ULONG ClassIndex = 0;
#define IDS_CONFIRM_DISABLE
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
bool RecurseChildDevices(_In_ DEVINST ParentDevice, _In_ HTREEITEM hParentTreeItem)
bool RunAddHardwareWizard()
#define TreeView_SortChildren(hwnd, hitem, recurse)
#define TreeView_GetItemRect(hwnd, hitem, prc, code)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
#define ERROR_NO_MORE_ITEMS
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
#define TreeView_DeleteAllItems(hwnd)
VOID Refresh(_In_ ViewType Type, _In_ bool ScanForChanges, _In_ bool UpdateView)
#define TreeView_GetChild(hwnd, hitem)
CAtlList< CClassNode * > m_ClassNodeList
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
CONFIGRET WINAPI CM_Enumerate_Classes(_In_ ULONG ulClassIndex, _Out_ LPGUID ClassGuid, _In_ ULONG ulFlags)
bool CreateActionMenu(_In_ HMENU OwnerMenu, _In_ bool MainMenu)
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
HINSTANCE g_hThisInstance
GLint GLint GLint GLint GLint x
CONFIGRET WINAPI CM_Get_Sibling(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define TreeView_GetNextSibling(hwnd, hitem)
#define TVIF_SELECTEDIMAGE
_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)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
bool UpdateSelectedDevice(_Out_ bool &NeedsReboot)
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
_Must_inspect_result_ _In_ WDFDEVICE ParentDevice
#define TreeView_InsertItem(hwnd, lpis)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
HTREEITEM RecurseFindDevice(_In_ HTREEITEM hParentItem, _In_ CNode *Node)
CDeviceNode * GetDeviceNode(_In_ DEVINST Device)
ViewType GetCurrentView()
#define IDM_UNINSTALL_DRV
bool UninstallSelectedDevice()
CAtlList< CDeviceNode * > m_DeviceNodeList
bool EnableSelectedDevice(_In_ bool Enable, _Out_ bool &NeedsReboot)
CONFIGRET WINAPI CM_Get_Child(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
LRESULT OnDoubleClick(_In_ LPNMHDR NmHdr)
_Out_opt_ int _Out_opt_ int * cy
CNode * GetSelectedNode()
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
#define TreeView_SetImageList(hwnd, himl, iImage)
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
CStringT< wchar_t, StrTraitATL< wchar_t, ChTraitsCRT< wchar_t > > > CAtlStringW
VOID DisplayPropertySheet()
LRESULT OnAction(UINT Action)
bool GetNextClass(_In_ ULONG ClassIndex, _Out_ LPGUID ClassGuid, _Out_ HDEVINFO *hDevInfo)
static void UpdateView(TreeListData *pData)
#define TreeView_GetSelection(hwnd)
#define TreeView_HitTest(hwnd, lpht)
bool GetSiblingDevice(_In_ DEVINST PrevDevice, _Out_ PDEVINST DevInst)
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
void SelectNode(_In_ CNode *Node)
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
CNode * GetNode(_In_ LPTV_ITEMW TvItem)
LRESULT OnSize(_In_ int x, _In_ int y, _In_ int cx, _In_ int cy)
HTREEITEM InsertIntoTreeView(_In_opt_ HTREEITEM hParent, _In_ CNode *Node)
BOOL WINAPI InstallDevInst(IN HWND hWndParent, IN LPCWSTR InstanceId, IN BOOL bUpdate, OUT LPDWORD lpReboot)
#define INDEXTOOVERLAYMASK(i)
VOID(WINAPI * PADDHARDWAREWIZARD)(HWND hwnd, LPWSTR lpName)
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)
_Must_inspect_result_ _In_ WDFDEVICE Device
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define IDS_CONFIRM_UNINSTALL
#define IDM_SCAN_HARDWARE
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define TreeView_GetRoot(hwnd)
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
CDeviceView(HWND hMainWnd)
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
#define TreeView_SelectItem(hwnd, hitem)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
#define IDS_MENU_PROPERTIES
GLint GLint GLint GLint GLint GLint y
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define TVS_SHOWSELALWAYS
HMENU WINAPI CreatePopupMenu(void)
#define IDS_MENU_UNINSTALL
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
bool GetChildDevice(_In_ DEVINST ParentDevInst, _Out_ PDEVINST DevInst)
CClassNode * GetClassNode(_In_ LPGUID ClassGuid)
static unsigned int __stdcall RefreshThread(void *Param)
#define GetProcAddress(x, y)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
struct _SP_CLASSIMAGELIST_DATA SP_CLASSIMAGELIST_DATA
void BuildActionMenuForNode(_In_ HMENU OwnerMenu, _In_ CNode *Node, _In_ bool MainMenu)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define TreeView_Expand(hwnd, hitem, code)
INT_PTR WINAPI DevicePropertiesExW(IN HWND hWndParent OPTIONAL, IN LPCWSTR lpMachineName OPTIONAL, IN LPCWSTR lpDeviceID OPTIONAL, IN DWORD dwFlags OPTIONAL, IN BOOL bShowDevMgr)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
LRESULT OnRightClick(_In_ LPNMHDR NmHdr)
struct tagMENUITEMINFOW MENUITEMINFOW
bool ListDevicesByConnection()
SP_CLASSIMAGELIST_DATA m_ImageListData
#define TreeView_GetItem(hwnd, pitem)
PCONFIGURATION_COMPONENT_DATA RootNode