1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * Authors: Vladimir Vlasov
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_dbt.d)
9  */
10 module core.sys.windows.dbt;
11 version (Windows):
12 
13 version (ANSI) {} else version = Unicode;
14 
15 import core.sys.windows.w32api, core.sys.windows.windef;
16 import core.sys.windows.basetyps; // for GUID
17 
18 // FIXME: clean up Windows version support
19 
20 enum : DWORD {
21     DBT_NO_DISK_SPACE           = 0x47,
22     DBT_CONFIGMGPRIVATE         = 0x7FFF,
23     DBT_DEVICEARRIVAL           = 0x8000,
24     DBT_DEVICEQUERYREMOVE       = 0x8001,
25     DBT_DEVICEQUERYREMOVEFAILED = 0x8002,
26     DBT_DEVICEREMOVEPENDING     = 0x8003,
27     DBT_DEVICEREMOVECOMPLETE    = 0x8004,
28     DBT_DEVICETYPESPECIFIC      = 0x8005,
29     DBT_DEVTYP_OEM              = 0,
30     DBT_DEVTYP_DEVNODE,
31     DBT_DEVTYP_VOLUME,
32     DBT_DEVTYP_PORT,
33     DBT_DEVTYP_NET,
34     DBT_DEVTYP_DEVICEINTERFACE,
35     DBT_DEVTYP_HANDLE        // = 6
36 }
37 
38 enum : DWORD {
39     DBT_APPYBEGIN,
40     DBT_APPYEND,
41     DBT_DEVNODES_CHANGED     = 7,
42     DBT_QUERYCHANGECONFIG    = 0x17,
43     DBT_CONFIGCHANGED        = 0x18,
44     DBT_CONFIGCHANGECANCELED = 0x19,
45     DBT_MONITORCHANGE        = 0x1B,
46     DBT_SHELLLOGGEDON        = 32,
47     DBT_CONFIGMGAPI32        = 34,
48     DBT_VXDINITCOMPLETE      = 35,
49     DBT_VOLLOCKQUERYLOCK     = 0x8041,
50     DBT_VOLLOCKLOCKTAKEN     = 0x8042,
51     DBT_VOLLOCKLOCKFAILED    = 0x8043,
52     DBT_VOLLOCKQUERYUNLOCK   = 0x8044,
53     DBT_VOLLOCKLOCKRELEASED  = 0x8045,
54     DBT_VOLLOCKUNLOCKFAILED  = 0x8046,
55     DBT_USERDEFINED          = 0xFFFF
56 }
57 
58 enum : WORD {
59     DBTF_MEDIA = 1,
60     DBTF_NET   = 2
61 }
62 
63 enum : DWORD {
64     BSM_ALLCOMPONENTS      = 0,
65     BSM_APPLICATIONS       = 8,
66     BSM_ALLDESKTOPS        = 16,
67     BSM_INSTALLABLEDRIVERS = 4,
68     BSM_NETDRIVER          = 2,
69     BSM_VXDS               = 1,
70     BSF_FLUSHDISK          = 0x00000004,
71     BSF_FORCEIFHUNG        = 0x00000020,
72     BSF_IGNORECURRENTTASK  = 0x00000002,
73     BSF_NOHANG             = 0x00000008,
74     BSF_NOTIMEOUTIFNOTHUNG = 0x00000040,
75     BSF_POSTMESSAGE        = 0x00000010,
76     BSF_QUERY              = 0x00000001,
77     BSF_MSGSRV32ISOK_BIT   = 31,
78     BSF_MSGSRV32ISOK       = 0x80000000
79 }
80 
81 //static if (_WIN32_WINNT >= 0x500) {
82     enum : DWORD {
83         BSF_ALLOWSFW          = 0x00000080,
84         BSF_SENDNOTIFYMESSAGE = 0x00000100
85     }
86 //}
87 
88 static if (_WIN32_WINNT >= 0x501) {
89     enum : DWORD {
90         BSF_LUID        = 0x00000400,
91         BSF_RETURNHDESK = 0x00000200
92     }
93 }
94 
95 struct DEV_BROADCAST_HDR {
96     DWORD dbch_size = DEV_BROADCAST_HDR.sizeof;
97     DWORD dbch_devicetype;
98     DWORD dbch_reserved;
99 }
100 alias DEV_BROADCAST_HDR* PDEV_BROADCAST_HDR;
101 
102 struct DEV_BROADCAST_OEM {
103     DWORD dbco_size = DEV_BROADCAST_OEM.sizeof;
104     DWORD dbco_devicetype;
105     DWORD dbco_reserved;
106     DWORD dbco_identifier;
107     DWORD dbco_suppfunc;
108 }
109 alias DEV_BROADCAST_OEM* PDEV_BROADCAST_OEM;
110 
111 struct DEV_BROADCAST_PORT_A {
112     DWORD dbcp_size = DEV_BROADCAST_PORT_A.sizeof;
113     DWORD dbcp_devicetype;
114     DWORD dbcp_reserved;
115     char  _dbcp_name = 0;
116     char* dbcp_name() return { return &_dbcp_name; }
117 }
118 alias DEV_BROADCAST_PORT_A* PDEV_BROADCAST_PORT_A;
119 
120 struct DEV_BROADCAST_PORT_W {
121     DWORD  dbcp_size = DEV_BROADCAST_PORT_W.sizeof;
122     DWORD  dbcp_devicetype;
123     DWORD  dbcp_reserved;
124     WCHAR  _dbcp_name = 0;
125     WCHAR* dbcp_name() return { return &_dbcp_name; }
126 }
127 alias DEV_BROADCAST_PORT_W* PDEV_BROADCAST_PORT_W;
128 
129 struct DEV_BROADCAST_USERDEFINED {
130     DEV_BROADCAST_HDR dbud_dbh;
131     char  _dbud_szName = 0;
132     char* dbud_szName() return { return &_dbud_szName; }
133 }
134 
135 struct DEV_BROADCAST_VOLUME {
136     DWORD dbcv_size = DEV_BROADCAST_VOLUME.sizeof;
137     DWORD dbcv_devicetype;
138     DWORD dbcv_reserved;
139     DWORD dbcv_unitmask;
140     WORD  dbcv_flags;
141 }
142 alias DEV_BROADCAST_VOLUME* PDEV_BROADCAST_VOLUME;
143 
144 version (Unicode) {
145     alias DEV_BROADCAST_PORT_W DEV_BROADCAST_PORT;
146 } else {
147     alias DEV_BROADCAST_PORT_A DEV_BROADCAST_PORT;
148 }
149 alias DEV_BROADCAST_PORT* PDEV_BROADCAST_PORT;
150 
151 //static if (_WIN32_WINNT >= 0x500) {
152     struct DEV_BROADCAST_DEVICEINTERFACE_A {
153         DWORD dbcc_size = DEV_BROADCAST_DEVICEINTERFACE_A.sizeof;
154         DWORD dbcc_devicetype;
155         DWORD dbcc_reserved;
156         GUID  dbcc_classguid;
157         char  _dbcc_name;
158         char* dbcc_name() return { return &_dbcc_name; }
159     }
160     alias DEV_BROADCAST_DEVICEINTERFACE_A* PDEV_BROADCAST_DEVICEINTERFACE_A;
161 
162     struct DEV_BROADCAST_DEVICEINTERFACE_W {
163         DWORD  dbcc_size = DEV_BROADCAST_DEVICEINTERFACE_W.sizeof;
164         DWORD  dbcc_devicetype;
165         DWORD  dbcc_reserved;
166         GUID   dbcc_classguid;
167         WCHAR  _dbcc_name = 0;
168         WCHAR* dbcc_name() return { return &_dbcc_name; }
169     }
170     alias DEV_BROADCAST_DEVICEINTERFACE_W* PDEV_BROADCAST_DEVICEINTERFACE_W;
171 
172     version (Unicode) {
173         alias DEV_BROADCAST_DEVICEINTERFACE_W DEV_BROADCAST_DEVICEINTERFACE;
174     } else {
175         alias DEV_BROADCAST_DEVICEINTERFACE_A DEV_BROADCAST_DEVICEINTERFACE;
176     }
177     alias DEV_BROADCAST_DEVICEINTERFACE* PDEV_BROADCAST_DEVICEINTERFACE;
178 
179     struct DEV_BROADCAST_HANDLE {
180         DWORD  dbch_size = DEV_BROADCAST_HANDLE.sizeof;
181         DWORD  dbch_devicetype;
182         DWORD  dbch_reserved;
183         HANDLE dbch_handle;
184         DWORD  dbch_hdevnotify;
185         GUID   dbch_eventguid;
186         LONG   dbch_nameoffset;
187         BYTE   _dbch_data;
188         BYTE*  dbch_data() return { return &_dbch_data; }
189     }
190     alias DEV_BROADCAST_HANDLE* PDEV_BROADCAST_HANDLE;
191 //}