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