home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / dbt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  10.8 KB  |  354 lines

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