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