1 /**
2  * @file dbt.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _DBT_H
25 #define _DBT_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 #define DBT_NO_DISK_SPACE	0x47
33 #define DBT_CONFIGMGPRIVATE	0x7FFF
34 #define DBT_DEVICEARRIVAL	0x8000
35 #define DBT_DEVICEQUERYREMOVE	0x8001
36 #define DBT_DEVICEQUERYREMOVEFAILED	0x8002
37 #define DBT_DEVICEREMOVEPENDING	0x8003
38 #define DBT_DEVICEREMOVECOMPLETE	0x8004
39 #define DBT_DEVICETYPESPECIFIC	0x8005
40 #define DBT_DEVTYP_OEM	0
41 #define DBT_DEVTYP_DEVNODE	1
42 #define DBT_DEVTYP_VOLUME	2
43 #define DBT_DEVTYP_PORT	3
44 #define DBT_DEVTYP_NET	4
45 #define DBT_APPYBEGIN 0
46 #define DBT_APPYEND 1
47 #define DBT_DEVNODES_CHANGED 7
48 #define DBT_QUERYCHANGECONFIG 0x17
49 #define DBT_CONFIGCHANGED 0x18
50 #define DBT_CONFIGCHANGECANCELED 0x19
51 #define DBT_MONITORCHANGE 0x1B
52 #define DBT_SHELLLOGGEDON 32
53 #define DBT_CONFIGMGAPI32 34
54 #define DBT_VXDINITCOMPLETE 35
55 #define DBT_VOLLOCKQUERYLOCK 0x8041
56 #define DBT_VOLLOCKLOCKTAKEN 0x8042
57 #define DBT_VOLLOCKLOCKFAILED 0x8043
58 #define DBT_VOLLOCKQUERYUNLOCK 0x8044
59 #define DBT_VOLLOCKLOCKRELEASED 0x8045
60 #define DBT_VOLLOCKUNLOCKFAILED 0x8046
61 #define DBT_USERDEFINED 0xFFFF
62 #define DBTF_MEDIA	1
63 #define DBTF_NET	2
64 
65 /* Also defined in winuser.h */
66 #define BSM_ALLCOMPONENTS	0
67 #define BSM_APPLICATIONS	8
68 #define BSM_ALLDESKTOPS		16
69 #define BSM_INSTALLABLEDRIVERS	4
70 #define BSM_NETDRIVER	2
71 #define BSM_VXDS	1
72 #define BSF_FLUSHDISK 0x00000004
73 #define BSF_FORCEIFHUNG 0x00000020
74 #define BSF_IGNORECURRENTTASK 0x00000002
75 #define BSF_NOHANG 0x00000008
76 #define BSF_NOTIMEOUTIFNOTHUNG 0x00000040
77 #define BSF_POSTMESSAGE 0x00000010
78 #define BSF_QUERY 0x00000001
79 
80 #define BSF_MSGSRV32ISOK_BIT 31
81 #define BSF_MSGSRV32ISOK 0x80000000
82 
83 typedef struct _DEV_BROADCAST_HDR {
84 	DWORD dbch_size;
85 	DWORD dbch_devicetype;
86 	DWORD dbch_reserved;
87 } DEV_BROADCAST_HDR,*PDEV_BROADCAST_HDR;
88 typedef struct _DEV_BROADCAST_OEM {
89 	DWORD dbco_size;
90 	DWORD dbco_devicetype;
91 	DWORD dbco_reserved;
92 	DWORD dbco_identifier;
93 	DWORD dbco_suppfunc;
94 } DEV_BROADCAST_OEM,*PDEV_BROADCAST_OEM;
95 typedef struct _DEV_BROADCAST_PORT_A {
96 	DWORD dbcp_size;
97 	DWORD dbcp_devicetype;
98 	DWORD dbcp_reserved;
99 	char dbcp_name[1];
100 } DEV_BROADCAST_PORT_A, *PDEV_BROADCAST_PORT_A;
101 typedef struct _DEV_BROADCAST_PORT_W {
102 	DWORD dbcp_size;
103 	DWORD dbcp_devicetype;
104 	DWORD dbcp_reserved;
105 	wchar_t dbcp_name[1];
106 } DEV_BROADCAST_PORT_W, *PDEV_BROADCAST_PORT_W;
107 typedef struct _DEV_BROADCAST_USERDEFINED {
108 	struct _DEV_BROADCAST_HDR dbud_dbh;
109 	char dbud_szName[1];
110 } DEV_BROADCAST_USERDEFINED;
111 typedef struct _DEV_BROADCAST_VOLUME {
112 	DWORD dbcv_size;
113 	DWORD dbcv_devicetype;
114 	DWORD dbcv_reserved;
115 	DWORD dbcv_unitmask;
116 	WORD dbcv_flags;
117 } DEV_BROADCAST_VOLUME,*PDEV_BROADCAST_VOLUME;
118 
119 typedef __AW(DEV_BROADCAST_PORT_) DEV_BROADCAST_PORT, *PDEV_BROADCAST_PORT;
120 
121 #if (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= _WIN32_WINNT_WIN2K)
122 #define DBT_DEVTYP_DEVICEINTERFACE 5
123 #define DBT_DEVTYP_HANDLE 6
124 #define BSF_ALLOWSFW 0x00000080
125 #define BSF_SENDNOTIFYMESSAGE 0x00000100
126 typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A {
127  DWORD dbcc_size;
128  DWORD dbcc_devicetype;
129  DWORD dbcc_reserved;
130  GUID dbcc_classguid;
131  char dbcc_name[1];
132 } DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A;
133 typedef struct _DEV_BROADCAST_DEVICEINTERFACE_W {
134  DWORD dbcc_size;
135  DWORD dbcc_devicetype;
136  DWORD dbcc_reserved;
137  GUID dbcc_classguid;
138  wchar_t dbcc_name[1];
139 } DEV_BROADCAST_DEVICEINTERFACE_W, *PDEV_BROADCAST_DEVICEINTERFACE_W;
140 
141 typedef __AW(DEV_BROADCAST_DEVICEINTERFACE_) DEV_BROADCAST_DEVICEINTERFACE;
142 typedef __AW(PDEV_BROADCAST_DEVICEINTERFACE_) PDEV_BROADCAST_DEVICEINTERFACE;
143 
144 typedef struct _DEV_BROADCAST_HANDLE {
145  DWORD dbch_size;
146  DWORD dbch_devicetype;
147  DWORD dbch_reserved;
148  HANDLE dbch_handle;
149  DWORD dbch_hdevnotify;
150  GUID dbch_eventguid;
151  LONG dbch_nameoffset;
152  BYTE dbch_data[1];
153 } DEV_BROADCAST_HANDLE, *PDEV_BROADCAST_HANDLE;
154 #endif /* (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500) */
155 
156 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
157 #define BSF_LUID 0x00000400
158 #define BSF_RETURNHDESK 0x00000200
159 #endif /* (_WIN32_WINNT >= 0x0501) */
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 #endif
165