[DEVMGR]
[reactos.git] / reactos / dll / win32 / devmgr / devmgmt / Node.h
1 #pragma once
2
3 #define DISPLAY_NAME_LEN 256
4 #define ROOT_NAME_SIZE MAX_COMPUTERNAME_LENGTH + 1
5
6 enum NodeType
7 {
8 NodeClass,
9 NodeDevice
10 };
11
12 typedef ULONG Actions;
13 #define Update 0x01
14 #define Enable 0x02
15 #define Disable 0x04
16 #define Uninstall 0x08
17
18
19 class CNode
20 {
21 private:
22 PSP_CLASSIMAGELIST_DATA m_ImageListData;
23 NodeType m_NodeType;
24 DEVINST m_DevInst;
25 Actions m_Actions;
26 LPWSTR m_DeviceId;
27 WCHAR m_DisplayName[DISPLAY_NAME_LEN];
28 GUID m_ClassGuid;
29 INT m_ClassImage;
30 ULONG m_Status;
31 ULONG m_ProblemNumber;
32 INT m_OverlayImage;
33
34 public:
35 CNode(
36 _In_ LPGUID ClassGuid,
37 _In_ PSP_CLASSIMAGELIST_DATA ImageListData
38 );
39
40 CNode(
41 _In_ DEVINST Device,
42 _In_ PSP_CLASSIMAGELIST_DATA ImageListData
43 );
44
45 ~CNode();
46
47 bool Setup();
48
49 LPGUID GetClassGuid() { return &m_ClassGuid; }
50 DEVINST GetDeviceInst() { return m_DevInst; }
51
52 LPWSTR GetDisplayName() { return m_DisplayName; }
53 INT GetClassImage() { return m_ClassImage; }
54 INT GetOverlayImage() { return m_OverlayImage; }
55 LPWSTR GetDeviceId() { return m_DeviceId; }
56 Actions GetActions() { return m_Actions; }
57
58 bool HasProblem() { return !!(m_ProblemNumber); }
59 bool HasProperties();
60 bool IsHidden();
61 bool CanDisable();
62 bool IsDisabled();
63 bool IsStarted();
64 bool IsInstalled();
65 bool CanInstall() { return TRUE; } // unimplemented
66 bool CanUninstall() { return TRUE; } // unimplemented
67
68 private:
69 bool SetupClassNode();
70 bool SetupDeviceNode();
71 void Cleanup();
72
73 DWORD ConvertResourceDescriptorToString(
74 _Inout_z_ LPWSTR ResourceDescriptor,
75 _In_ DWORD ResourceDescriptorSize
76 );
77 };
78