home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / RTLWIN32.PAK / DBT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  10.6 KB  |  371 lines

  1. /*****************************************************************************
  2.  *
  3.  *  Copyright (c) 1993-1996 Microsoft Corporation
  4.  *
  5.  *  Title:      DBT.H - Equates for WM_DEVICECHANGE and BroadcastSystemMessage
  6.  *
  7.  *  Version:    4.00
  8.  *
  9.  *  Date:       24-May-1993
  10.  *
  11.  *  Author:     rjc
  12.  *
  13.  *----------------------------------------------------------------------------
  14.  *
  15.  *  Change log:
  16.  *
  17.  *     DATE     REV                 DESCRIPTION
  18.  *  ----------- --- ----------------------------------------------------------
  19.  *
  20.  *****************************************************************************/
  21.  
  22. #ifndef _DBT_H
  23. #define    _DBT_H
  24. #pragma option -b
  25.  
  26. #ifdef __BORLANDC__
  27. #pragma option -b.
  28.   #include <pshpack8.h>
  29. #pragma option -b
  30. #endif
  31.  
  32. /*
  33.  * BroadcastSpecialMessage constants.
  34.  */
  35. #define WM_DEVICECHANGE        0x0219
  36.  
  37. /* XLATOFF */
  38. #ifdef    IS_32
  39. #define    DBTFAR
  40. #else
  41. #define    DBTFAR    far
  42. #endif
  43. /* XLATON */
  44.  
  45. /*
  46.  * Broadcast message and receipient flags.
  47.  *
  48.  * Note that there is a third "flag". If the wParam has:
  49.  *
  50.  * bit 15 on:    lparam is a pointer and bit 14 is meaningfull.
  51.  * bit 15 off:    lparam is just a UNLONG data type.
  52.  *
  53.  * bit 14 on:    lparam is a pointer to an ASCIIZ string.
  54.  * bit 14 off:    lparam is a pointer to a binary struture starting with
  55.  *        a dword describing the length of the structure.
  56.  */
  57. #define BSF_QUERY        0x00000001
  58. #define BSF_IGNORECURRENTTASK    0x00000002    /* Meaningless for VxDs */
  59. #define BSF_FLUSHDISK        0x00000004    /* Shouldn't be used by VxDs */
  60. #define BSF_NOHANG              0x00000008
  61. #define BSF_POSTMESSAGE        0x00000010
  62. #define BSF_FORCEIFHUNG         0x00000020
  63. #define BSF_NOTIMEOUTIFNOTHUNG  0x00000040
  64. #define    BSF_MSGSRV32ISOK    0x80000000    /* Called synchronously from PM API */
  65. #define    BSF_MSGSRV32ISOK_BIT    31        /* Called synchronously from PM API */
  66.  
  67. #define BSM_ALLCOMPONENTS    0x00000000
  68. #define BSM_VXDS                0x00000001
  69. #define BSM_NETDRIVER           0x00000002
  70. #define BSM_INSTALLABLEDRIVERS  0x00000004
  71. #define BSM_APPLICATIONS        0x00000008
  72.  
  73. /*
  74.  * Message = WM_DEVICECHANGE
  75.  * wParam  = DBT_APPYBEGIN
  76.  * lParam  = (not used)
  77.  *
  78.  *    'Appy-time is now available.  This message is itself sent
  79.  *    at 'Appy-time.
  80.  *
  81.  * Message = WM_DEVICECHANGE
  82.  * wParam  = DBT_APPYEND
  83.  * lParam  = (not used)
  84.  *
  85.  *    'Appy-time is no longer available.  This message is *NOT* sent
  86.  *    at 'Appy-time.  (It cannot be, because 'Appy-time is gone.)
  87.  *
  88.  * NOTE!  It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
  89.  * multiple times during a single Windows session.  Each appearance of
  90.  * 'Appy-time is bracketed by these two messages, but 'Appy-time may
  91.  * momentarily become unavailable during otherwise normal Windows
  92.  * processing.  The current status of 'Appy-time availability can always
  93.  * be obtained from a call to _SHELL_QueryAppyTimeAvailable.
  94.  */
  95. #define DBT_APPYBEGIN            0x0000
  96. #define DBT_APPYEND            0x0001
  97.  
  98. /*
  99.  * Message = WM_DEVICECHANGE
  100.  * wParam  = DBT_DEVNODES_CHANGED
  101.  * lParam  = 0
  102.  *
  103.  *    send when configmg finished a process tree batch. Some devnodes
  104.  *    may have been added or removed. This is used by ring3 people which
  105.  *    need to be refreshed whenever any devnode changed occur (like
  106.  *    device manager). People specific to certain devices should use
  107.  *    DBT_DEVICE* instead.
  108.  */
  109.  
  110. #define DBT_DEVNODES_CHANGED            0x0007
  111.  
  112. /*
  113.  * Message = WM_DEVICECHANGE
  114.  * wParam  = DBT_QUERYCHANGECONFIG
  115.  * lParam  = 0
  116.  *
  117.  *      sent to ask if a config change is allowed
  118.  */
  119.  
  120. #define DBT_QUERYCHANGECONFIG           0x0017
  121.  
  122. /*
  123.  * Message = WM_DEVICECHANGE
  124.  * wParam  = DBT_CONFIGCHANGED
  125.  * lParam  = 0
  126.  *
  127.  *      sent when a config has changed
  128.  */
  129.  
  130. #define DBT_CONFIGCHANGED               0x0018
  131.  
  132. /*
  133.  * Message = WM_DEVICECHANGE
  134.  * wParam  = DBT_CONFIGCHANGECANCELED
  135.  * lParam  = 0
  136.  *
  137.  *      someone cancelled the config change
  138.  */
  139.  
  140. #define DBT_CONFIGCHANGECANCELED        0x0019
  141.  
  142. /*
  143.  * Message = WM_DEVICECHANGE
  144.  * wParam  = DBT_MONITORCHANGE
  145.  * lParam  = new resolution to use (LOWORD=x, HIWORD=y)
  146.  *           if 0, use the default res for current config
  147.  *
  148.  *      this message is sent when the display monitor has changed
  149.  *      and the system should change the display mode to match it.
  150.  */
  151.  
  152. #define DBT_MONITORCHANGE               0x001B
  153.  
  154. /*
  155.  * Message = WM_DEVICECHANGE
  156.  * wParam  = DBT_SHELLLOGGEDON
  157.  * lParam  = 0
  158.  *
  159.  *    The shell has finished login on: VxD can now do Shell_EXEC.
  160.  */
  161.  
  162. #define    DBT_SHELLLOGGEDON        0x0020
  163.  
  164. /*
  165.  * Message = WM_DEVICECHANGE
  166.  * wParam  = DBT_CONFIGMGAPI
  167.  * lParam  = CONFIGMG API Packet
  168.  *
  169.  *    CONFIGMG ring 3 call.
  170.  */
  171. #define    DBT_CONFIGMGAPI32        0x0022
  172.  
  173. /*
  174.  * Message = WM_DEVICECHANGE
  175.  * wParam  = DBT_VOLLOCK*
  176.  * lParam  = pointer to VolLockBroadcast structure described below
  177.  *
  178.  *    Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
  179.  *    All these messages pass a pointer to a struct which has no pointers.
  180.  */
  181.  
  182. #define DBT_VOLLOCKQUERYLOCK    0x8041
  183. #define DBT_VOLLOCKLOCKTAKEN    0x8042
  184. #define DBT_VOLLOCKLOCKFAILED    0x8043
  185. #define DBT_VOLLOCKQUERYUNLOCK    0x8044
  186. #define DBT_VOLLOCKLOCKRELEASED    0x8045
  187. #define DBT_VOLLOCKUNLOCKFAILED    0x8046
  188.  
  189. /*
  190.  * Device broadcast header
  191.  */
  192.  
  193. struct _DEV_BROADCAST_HDR {    /* */
  194.     DWORD    dbch_size;
  195.     DWORD    dbch_devicetype;
  196.     DWORD       dbch_reserved;
  197. };
  198.  
  199. typedef struct     _DEV_BROADCAST_HDR    DEV_BROADCAST_HDR;
  200. typedef        DEV_BROADCAST_HDR    DBTFAR *PDEV_BROADCAST_HDR;
  201.  
  202. /*
  203.  * Structure for volume lock broadcast
  204.  */
  205.  
  206. typedef struct VolLockBroadcast VolLockBroadcast;
  207. typedef VolLockBroadcast *pVolLockBroadcast;
  208. struct VolLockBroadcast {
  209.     struct    _DEV_BROADCAST_HDR vlb_dbh;
  210.     DWORD    vlb_owner;        // thread on which lock request is being issued
  211.     BYTE    vlb_perms;        // lock permission flags defined below
  212.     BYTE    vlb_lockType;    // type of lock
  213.     BYTE    vlb_drive;        // drive on which lock is issued
  214.     BYTE    vlb_flags;        // miscellaneous flags
  215. };
  216.  
  217. /*
  218.  * Values for vlb_perms
  219.  */
  220. #define LOCKP_ALLOW_WRITES        0x01    // Bit 0 set - allow writes
  221. #define LOCKP_FAIL_WRITES        0x00    // Bit 0 clear - fail writes
  222. #define LOCKP_FAIL_MEM_MAPPING    0x02    // Bit 1 set - fail memory mappings
  223. #define LOCKP_ALLOW_MEM_MAPPING    0x00    // Bit 1 clear - allow memory mappings
  224. #define LOCKP_USER_MASK            0x03    // Mask for user lock flags
  225. #define LOCKP_LOCK_FOR_FORMAT    0x04    // Level 0 lock for format
  226.  
  227. /*
  228.  * Values for vlb_flags
  229.  */
  230. #define LOCKF_LOGICAL_LOCK        0x00    // Bit 0 clear - logical lock
  231. #define LOCKF_PHYSICAL_LOCK        0x01    // Bit 0 set - physical lock
  232.  
  233.  
  234. /*
  235.  * Message = WM_DEVICECHANGE
  236.  * wParam  = DBT_NODISKSPACE
  237.  * lParam  = drive number of drive that is out of disk space (1-based)
  238.  *
  239.  * Message issued by IFS manager when it detects that a drive is run out of
  240.  * free space.
  241.  */
  242.  
  243. #define DBT_NO_DISK_SPACE        0x0047
  244.  
  245.  
  246. #define DBT_CONFIGMGPRIVATE    0x7FFF
  247.  
  248. /*
  249.  * The following messages are for WM_DEVICECHANGE. The immediate list
  250.  * is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
  251.  * STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
  252.  *
  253.  */
  254. #define DBT_DEVICEARRIVAL        0x8000    // system detected a new device
  255. #define DBT_DEVICEQUERYREMOVE        0x8001    // wants to remove, may fail
  256. #define DBT_DEVICEQUERYREMOVEFAILED    0x8002  // removal aborted         
  257. #define DBT_DEVICEREMOVEPENDING        0x8003  // about to remove, still avail.
  258. #define DBT_DEVICEREMOVECOMPLETE    0x8004  // device is gone
  259. #define DBT_DEVICETYPESPECIFIC        0x8005  // type specific event
  260.  
  261. #define DBT_DEVTYP_OEM            0x00000000  // oem-defined device type
  262. #define DBT_DEVTYP_DEVNODE        0x00000001  // devnode number
  263. #define DBT_DEVTYP_VOLUME        0x00000002  // logical volume
  264. #define DBT_DEVTYP_PORT            0x00000003  // serial, parallel
  265. #define DBT_DEVTYP_NET            0x00000004  // network resource
  266.  
  267. struct _DEV_BROADCAST_HEADER { /* */
  268.     DWORD    dbcd_size;
  269.     DWORD    dbcd_devicetype;
  270.     DWORD       dbcd_reserved;
  271. };
  272.  
  273. struct _DEV_BROADCAST_OEM {    /* */
  274.     DWORD    dbco_size;
  275.     DWORD    dbco_devicetype;
  276.     DWORD       dbco_reserved;
  277.     DWORD    dbco_identifier;
  278.     DWORD    dbco_suppfunc;
  279. };
  280.  
  281. typedef struct     _DEV_BROADCAST_OEM    DEV_BROADCAST_OEM;
  282. typedef        DEV_BROADCAST_OEM    DBTFAR *PDEV_BROADCAST_OEM;
  283.  
  284. struct _DEV_BROADCAST_DEVNODE { /* */
  285.     DWORD    dbcd_size;
  286.     DWORD    dbcd_devicetype;
  287.     DWORD       dbcd_reserved;
  288.     DWORD    dbcd_devnode;
  289. };
  290.  
  291. typedef struct     _DEV_BROADCAST_DEVNODE    DEV_BROADCAST_DEVNODE;
  292. typedef        DEV_BROADCAST_DEVNODE    DBTFAR *PDEV_BROADCAST_DEVNODE;
  293.  
  294. struct _DEV_BROADCAST_VOLUME { /* */
  295.     DWORD    dbcv_size;
  296.     DWORD    dbcv_devicetype;
  297.     DWORD       dbcv_reserved;
  298.     DWORD    dbcv_unitmask;
  299.     WORD    dbcv_flags;
  300. };
  301.  
  302. typedef struct     _DEV_BROADCAST_VOLUME    DEV_BROADCAST_VOLUME;
  303. typedef        DEV_BROADCAST_VOLUME    DBTFAR *PDEV_BROADCAST_VOLUME;
  304.  
  305. #define DBTF_MEDIA    0x0001        // media comings and goings
  306. #define DBTF_NET    0x0002        // network volume
  307.  
  308. struct _DEV_BROADCAST_PORT { /* */
  309.     DWORD    dbcp_size;
  310.     DWORD    dbcp_devicetype;
  311.     DWORD       dbcp_reserved;
  312.     char    dbcp_name[1];
  313. };
  314.  
  315. typedef struct     _DEV_BROADCAST_PORT    DEV_BROADCAST_PORT;
  316. typedef        DEV_BROADCAST_PORT    DBTFAR *PDEV_BROADCAST_PORT;
  317.  
  318. struct _DEV_BROADCAST_NET { /* */
  319.     DWORD    dbcn_size;
  320.     DWORD    dbcn_devicetype;
  321.     DWORD       dbcn_reserved;
  322.     DWORD    dbcn_resource;
  323.     DWORD    dbcn_flags;
  324. };
  325.  
  326. typedef struct     _DEV_BROADCAST_NET    DEV_BROADCAST_NET;
  327. typedef        DEV_BROADCAST_NET    DBTFAR *PDEV_BROADCAST_NET;
  328.  
  329. #define DBTF_RESOURCE    0x00000001    // network resource
  330. #define DBTF_XPORT        0x00000002    // new transport coming or going
  331. #define DBTF_SLOWNET    0x00000004  // new incoming transport is slow
  332.                     // (dbcn_resource undefined for now)
  333.  
  334. #define    DBT_VPOWERDAPI    0x8100        // VPOWERD API for Win95
  335.  
  336. /*
  337.  *  User-defined message types all use wParam = 0xFFFF with the
  338.  *  lParam a pointer to the structure below.
  339.  *
  340.  *  dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
  341.  *
  342.  *  dbud_szName contains a case-sensitive ASCIIZ name which names the
  343.  *  message.  The message name consists of the vendor name, a backslash,
  344.  *  then arbitrary user-defined ASCIIZ text.  For example:
  345.  *
  346.  *    "WidgetWare\QueryScannerShutdown"
  347.  *    "WidgetWare\Video Q39S\AdapterReady"
  348.  *
  349.  *  After the ASCIIZ name, arbitrary information may be provided.
  350.  *  Make sure that dbud_dbh.dbch_size is big enough to encompass
  351.  *  all the data.  And remember that nothing in the structure may
  352.  *  contain pointers.
  353.  */
  354.  
  355. #define DBT_USERDEFINED    0xFFFF
  356.  
  357. struct _DEV_BROADCAST_USERDEFINED { /* */
  358.     struct _DEV_BROADCAST_HDR dbud_dbh;
  359.     char    dbud_szName[1];        /* ASCIIZ name */
  360. /*  BYTE    dbud_rgbUserDefined[];*/ /* User-defined contents */
  361. };
  362.  
  363. #ifdef __BORLANDC__
  364. #pragma option -b.
  365.   #include <poppack.h>
  366. #pragma option -b
  367. #endif
  368.  
  369. #pragma option -b.
  370. #endif    // _DBT_H
  371.