home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / dbt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  16.3 KB  |  490 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. #ifndef _WCHAR_T_DEFINED
  37. typedef unsigned short wchar_t;
  38. #define _WCHAR_T_DEFINED
  39. #endif
  40.  
  41. #ifndef GUID_DEFINED
  42.     #define GUID_DEFINED
  43.     typedef struct _GUID {
  44.         ULONG   Data1;
  45.         unsigned short Data2;
  46.         unsigned short Data3;
  47.         unsigned char Data4[8];
  48.     } GUID;
  49. #endif // !defined(GUID_DEFINED)
  50.  
  51. /*
  52.  * Broadcast message and receipient flags.
  53.  *
  54.  * Note that there is a third "flag". If the wParam has:
  55.  *
  56.  * bit 15 on:   lparam is a pointer and bit 14 is meaningfull.
  57.  * bit 15 off:  lparam is just a UNLONG data type.
  58.  *
  59.  * bit 14 on:   lparam is a pointer to an ASCIIZ string.
  60.  * bit 14 off:  lparam is a pointer to a binary struture starting with
  61.  *              a dword describing the length of the structure.
  62.  */
  63. #define BSF_QUERY               0x00000001
  64. #define BSF_IGNORECURRENTTASK   0x00000002      /* Meaningless for VxDs */
  65. #define BSF_FLUSHDISK           0x00000004      /* Shouldn't be used by VxDs */
  66. #define BSF_NOHANG              0x00000008
  67. #define BSF_POSTMESSAGE         0x00000010
  68. #define BSF_FORCEIFHUNG         0x00000020
  69. #define BSF_NOTIMEOUTIFNOTHUNG  0x00000040
  70. #define BSF_MSGSRV32ISOK        0x80000000      /* Called synchronously from PM API */
  71. #define BSF_MSGSRV32ISOK_BIT    31              /* Called synchronously from PM API */
  72.  
  73. #define BSM_ALLCOMPONENTS       0x00000000
  74. #define BSM_VXDS                0x00000001
  75. #define BSM_NETDRIVER           0x00000002
  76. #define BSM_INSTALLABLEDRIVERS  0x00000004
  77. #define BSM_APPLICATIONS        0x00000008
  78.  
  79. /*
  80.  * Message = WM_DEVICECHANGE
  81.  * wParam  = DBT_APPYBEGIN
  82.  * lParam  = (not used)
  83.  *
  84.  *      'Appy-time is now available.  This message is itself sent
  85.  *      at 'Appy-time.
  86.  *
  87.  * Message = WM_DEVICECHANGE
  88.  * wParam  = DBT_APPYEND
  89.  * lParam  = (not used)
  90.  *
  91.  *      'Appy-time is no longer available.  This message is *NOT* sent
  92.  *      at 'Appy-time.  (It cannot be, because 'Appy-time is gone.)
  93.  *
  94.  * NOTE!  It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
  95.  * multiple times during a single Windows session.  Each appearance of
  96.  * 'Appy-time is bracketed by these two messages, but 'Appy-time may
  97.  * momentarily become unavailable during otherwise normal Windows
  98.  * processing.  The current status of 'Appy-time availability can always
  99.  * be obtained from a call to _SHELL_QueryAppyTimeAvailable.
  100.  */
  101. #define DBT_APPYBEGIN                   0x0000
  102. #define DBT_APPYEND                     0x0001
  103.  
  104. /*
  105.  * Message = WM_DEVICECHANGE
  106.  * wParam  = DBT_DEVNODES_CHANGED
  107.  * lParam  = 0
  108.  *
  109.  *      send when configmg finished a process tree batch. Some devnodes
  110.  *      may have been added or removed. This is used by ring3 people which
  111.  *      need to be refreshed whenever any devnode changed occur (like
  112.  *      device manager). People specific to certain devices should use
  113.  *      DBT_DEVICE* instead.
  114.  */
  115.  
  116. #define DBT_DEVNODES_CHANGED            0x0007
  117.  
  118. /*
  119.  * Message = WM_DEVICECHANGE
  120.  * wParam  = DBT_QUERYCHANGECONFIG
  121.  * lParam  = 0
  122.  *
  123.  *      sent to ask if a config change is allowed
  124.  */
  125.  
  126. #define DBT_QUERYCHANGECONFIG           0x0017
  127.  
  128. /*
  129.  * Message = WM_DEVICECHANGE
  130.  * wParam  = DBT_CONFIGCHANGED
  131.  * lParam  = 0
  132.  *
  133.  *      sent when a config has changed
  134.  */
  135.  
  136. #define DBT_CONFIGCHANGED               0x0018
  137.  
  138. /*
  139.  * Message = WM_DEVICECHANGE
  140.  * wParam  = DBT_CONFIGCHANGECANCELED
  141.  * lParam  = 0
  142.  *
  143.  *      someone cancelled the config change
  144.  */
  145.  
  146. #define DBT_CONFIGCHANGECANCELED        0x0019
  147.  
  148. /*
  149.  * Message = WM_DEVICECHANGE
  150.  * wParam  = DBT_MONITORCHANGE
  151.  * lParam  = new resolution to use (LOWORD=x, HIWORD=y)
  152.  *           if 0, use the default res for current config
  153.  *
  154.  *      this message is sent when the display monitor has changed
  155.  *      and the system should change the display mode to match it.
  156.  */
  157.  
  158. #define DBT_MONITORCHANGE               0x001B
  159.  
  160. /*
  161.  * Message = WM_DEVICECHANGE
  162.  * wParam  = DBT_SHELLLOGGEDON
  163.  * lParam  = 0
  164.  *
  165.  *      The shell has finished login on: VxD can now do Shell_EXEC.
  166.  */
  167.  
  168. #define DBT_SHELLLOGGEDON               0x0020
  169.  
  170. /*
  171.  * Message = WM_DEVICECHANGE
  172.  * wParam  = DBT_CONFIGMGAPI
  173.  * lParam  = CONFIGMG API Packet
  174.  *
  175.  *      CONFIGMG ring 3 call.
  176.  */
  177. #define DBT_CONFIGMGAPI32               0x0022
  178.  
  179. /*
  180.  * Message = WM_DEVICECHANGE
  181.  * wParam  = DBT_VXDINITCOMPLETE
  182.  * lParam  = 0
  183.  *
  184.  *      CONFIGMG ring 3 call.
  185.  */
  186. #define DBT_VXDINITCOMPLETE             0x0023
  187.  
  188. /*
  189.  * Message = WM_DEVICECHANGE
  190.  * wParam  = DBT_VOLLOCK*
  191.  * lParam  = pointer to VolLockBroadcast structure described below
  192.  *
  193.  *      Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
  194.  *      All these messages pass a pointer to a struct which has no pointers.
  195.  */
  196.  
  197. #define DBT_VOLLOCKQUERYLOCK    0x8041
  198. #define DBT_VOLLOCKLOCKTAKEN    0x8042
  199. #define DBT_VOLLOCKLOCKFAILED   0x8043
  200. #define DBT_VOLLOCKQUERYUNLOCK  0x8044
  201. #define DBT_VOLLOCKLOCKRELEASED 0x8045
  202. #define DBT_VOLLOCKUNLOCKFAILED 0x8046
  203.  
  204. /*
  205.  * Device broadcast header
  206.  */
  207.  
  208. struct _DEV_BROADCAST_HDR {     /* */
  209.     DWORD       dbch_size;
  210.     DWORD       dbch_devicetype;
  211.     DWORD       dbch_reserved;
  212. };
  213.  
  214. typedef struct  _DEV_BROADCAST_HDR      DEV_BROADCAST_HDR;
  215. typedef         DEV_BROADCAST_HDR       DBTFAR *PDEV_BROADCAST_HDR;
  216.  
  217. /*
  218.  * Structure for volume lock broadcast
  219.  */
  220.  
  221. typedef struct VolLockBroadcast VolLockBroadcast;
  222. typedef VolLockBroadcast *pVolLockBroadcast;
  223. struct VolLockBroadcast {
  224.         struct  _DEV_BROADCAST_HDR vlb_dbh;
  225.         DWORD   vlb_owner;              // thread on which lock request is being issued
  226.         BYTE    vlb_perms;              // lock permission flags defined below
  227.         BYTE    vlb_lockType;           // type of lock
  228.         BYTE    vlb_drive;              // drive on which lock is issued
  229.         BYTE    vlb_flags;              // miscellaneous flags
  230. };
  231.  
  232. /*
  233.  * Values for vlb_perms
  234.  */
  235. #define LOCKP_ALLOW_WRITES              0x01    // Bit 0 set - allow writes
  236. #define LOCKP_FAIL_WRITES               0x00    // Bit 0 clear - fail writes
  237. #define LOCKP_FAIL_MEM_MAPPING          0x02    // Bit 1 set - fail memory mappings
  238. #define LOCKP_ALLOW_MEM_MAPPING         0x00    // Bit 1 clear - allow memory mappings
  239. #define LOCKP_USER_MASK                 0x03    // Mask for user lock flags
  240. #define LOCKP_LOCK_FOR_FORMAT           0x04    // Level 0 lock for format
  241.  
  242. /*
  243.  * Values for vlb_flags
  244.  */
  245. #define LOCKF_LOGICAL_LOCK              0x00    // Bit 0 clear - logical lock
  246. #define LOCKF_PHYSICAL_LOCK             0x01    // Bit 0 set - physical lock
  247.  
  248. /*
  249.  * Message = WM_DEVICECHANGE
  250.  * wParam  = DBT_NODISKSPACE
  251.  * lParam  = drive number of drive that is out of disk space (1-based)
  252.  *
  253.  * Message issued by IFS manager when it detects that a drive is run out of
  254.  * free space.
  255.  */
  256.  
  257. #define DBT_NO_DISK_SPACE               0x0047
  258.  
  259. /*
  260.  * Message = WM_DEVICECHANGE
  261.  * wParam  = DBT_LOW_DISK_SPACE
  262.  * lParam  = drive number of drive that is low on disk space (1-based)
  263.  *
  264.  * Message issued by VFAT when it detects that a drive it has mounted
  265.  * has the remaning free space below a threshold specified by the
  266.  * registry or by a disk space management application.
  267.  * The broadcast is issued by VFAT ONLY when space is either allocated
  268.  * or freed by VFAT.
  269.  */
  270.  
  271. #define DBT_LOW_DISK_SPACE      0x0048
  272.  
  273. #define DBT_CONFIGMGPRIVATE             0x7FFF
  274.  
  275. /*
  276.  * The following messages are for WM_DEVICECHANGE. The immediate list
  277.  * is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
  278.  * STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
  279.  *
  280.  */
  281. #define DBT_DEVICEARRIVAL               0x8000  // system detected a new device
  282. #define DBT_DEVICEQUERYREMOVE           0x8001  // wants to remove, may fail
  283. #define DBT_DEVICEQUERYREMOVEFAILED     0x8002  // removal aborted
  284. #define DBT_DEVICEREMOVEPENDING         0x8003  // about to remove, still avail.
  285. #define DBT_DEVICEREMOVECOMPLETE        0x8004  // device is gone
  286. #define DBT_DEVICETYPESPECIFIC          0x8005  // type specific event
  287. #if(WINVER >= 0x040A)
  288. #define DBT_CUSTOMEVENT                 0x8006  // user-defined event
  289. #endif /* WINVER >= 0x040A */
  290.  
  291. #define DBT_DEVTYP_OEM                  0x00000000  // oem-defined device type
  292. #define DBT_DEVTYP_DEVNODE              0x00000001  // devnode number
  293. #define DBT_DEVTYP_VOLUME               0x00000002  // logical volume
  294. #define DBT_DEVTYP_PORT                 0x00000003  // serial, parallel
  295. #define DBT_DEVTYP_NET                  0x00000004  // network resource
  296.  
  297. #if(WINVER >= 0x040A)
  298. #define DBT_DEVTYP_DEVICEINTERFACE      0x00000005  // device interface class
  299. #define DBT_DEVTYP_HANDLE               0x00000006  // file system handle
  300. #endif /* WINVER >= 0x040A */
  301.  
  302. struct _DEV_BROADCAST_HEADER { /* */
  303.     DWORD       dbcd_size;
  304.     DWORD       dbcd_devicetype;
  305.     DWORD       dbcd_reserved;
  306. };
  307.  
  308. struct _DEV_BROADCAST_OEM {     /* */
  309.     DWORD       dbco_size;
  310.     DWORD       dbco_devicetype;
  311.     DWORD       dbco_reserved;
  312.     DWORD       dbco_identifier;
  313.     DWORD       dbco_suppfunc;
  314. };
  315.  
  316. typedef struct  _DEV_BROADCAST_OEM      DEV_BROADCAST_OEM;
  317. typedef         DEV_BROADCAST_OEM       DBTFAR *PDEV_BROADCAST_OEM;
  318.  
  319. struct _DEV_BROADCAST_DEVNODE { /* */
  320.     DWORD       dbcd_size;
  321.     DWORD       dbcd_devicetype;
  322.     DWORD       dbcd_reserved;
  323.     DWORD       dbcd_devnode;
  324. };
  325.  
  326. typedef struct  _DEV_BROADCAST_DEVNODE  DEV_BROADCAST_DEVNODE;
  327. typedef         DEV_BROADCAST_DEVNODE   DBTFAR *PDEV_BROADCAST_DEVNODE;
  328.  
  329. typedef struct _DEV_BROADCAST_VOLUME_A { /* */
  330.     DWORD       dbcv_size;
  331.     DWORD       dbcv_devicetype;
  332.     DWORD       dbcv_reserved;
  333.     DWORD       dbcv_unitmask;
  334.     WORD        dbcv_flags;
  335.     char        dbcv_name[1];
  336. } DEV_BROADCAST_VOLUME_A, *PDEV_BROADCAST_VOLUME_A;
  337.  
  338. typedef struct _DEV_BROADCAST_VOLUME_W { /* */
  339.     DWORD       dbcv_size;
  340.     DWORD       dbcv_devicetype;
  341.     DWORD       dbcv_reserved;
  342.     DWORD       dbcv_unitmask;
  343.     WORD        dbcv_flags;
  344.     wchar_t     dbcv_name[1];
  345. } DEV_BROADCAST_VOLUME_W, *PDEV_BROADCAST_VOLUME_W;
  346.  
  347. #ifdef UNICODE
  348. typedef DEV_BROADCAST_VOLUME_W   DEV_BROADCAST_VOLUME;
  349. typedef PDEV_BROADCAST_VOLUME_W  PDEV_BROADCAST_VOLUME;
  350. #else
  351. typedef DEV_BROADCAST_VOLUME_A   DEV_BROADCAST_VOLUME;
  352. typedef PDEV_BROADCAST_VOLUME_A  PDEV_BROADCAST_VOLUME;
  353. #endif
  354.  
  355. #define DBTF_MEDIA      0x0001          // media comings and goings
  356. #define DBTF_NET        0x0002          // network volume
  357.  
  358. typedef struct _DEV_BROADCAST_PORT_A {
  359.     DWORD       dbcp_size;
  360.     DWORD       dbcp_devicetype;
  361.     DWORD       dbcp_reserved;
  362.     char        dbcp_name[1];
  363. } DEV_BROADCAST_PORT_A, *PDEV_BROADCAST_PORT_A;
  364.  
  365. typedef struct _DEV_BROADCAST_PORT_W {
  366.     DWORD       dbcp_size;
  367.     DWORD       dbcp_devicetype;
  368.     DWORD       dbcp_reserved;
  369.     wchar_t     dbcp_name[1];
  370. } DEV_BROADCAST_PORT_W, DBTFAR *PDEV_BROADCAST_PORT_W;
  371.  
  372. #ifdef UNICODE
  373. typedef DEV_BROADCAST_PORT_W     DEV_BROADCAST_PORT;
  374. typedef PDEV_BROADCAST_PORT_W    PDEV_BROADCAST_PORT;
  375. #else
  376. typedef DEV_BROADCAST_PORT_A     DEV_BROADCAST_PORT;
  377. typedef PDEV_BROADCAST_PORT_A    PDEV_BROADCAST_PORT;
  378. #endif
  379.  
  380. struct _DEV_BROADCAST_NET { /* */
  381.     DWORD       dbcn_size;
  382.     DWORD       dbcn_devicetype;
  383.     DWORD       dbcn_reserved;
  384.     DWORD       dbcn_resource;
  385.     DWORD       dbcn_flags;
  386. };
  387.  
  388. typedef struct  _DEV_BROADCAST_NET      DEV_BROADCAST_NET;
  389. typedef         DEV_BROADCAST_NET       DBTFAR *PDEV_BROADCAST_NET;
  390.  
  391. #if(WINVER >= 0x040A)
  392.  
  393. typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A {
  394.     DWORD       dbcc_size;
  395.     DWORD       dbcc_devicetype;
  396.     DWORD       dbcc_reserved;
  397.     GUID        dbcc_classguid;
  398.     char        dbcc_name[1];
  399. } DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A;
  400.  
  401. typedef struct _DEV_BROADCAST_DEVICEINTERFACE_W {
  402.     DWORD       dbcc_size;
  403.     DWORD       dbcc_devicetype;
  404.     DWORD       dbcc_reserved;
  405.     GUID        dbcc_classguid;
  406.     wchar_t     dbcc_name[1];
  407. } DEV_BROADCAST_DEVICEINTERFACE_W, *PDEV_BROADCAST_DEVICEINTERFACE_W;
  408.  
  409. #ifdef UNICODE
  410. typedef DEV_BROADCAST_DEVICEINTERFACE_W   DEV_BROADCAST_DEVICEINTERFACE;
  411. typedef PDEV_BROADCAST_DEVICEINTERFACE_W  PDEV_BROADCAST_DEVICEINTERFACE;
  412. #else
  413. typedef DEV_BROADCAST_DEVICEINTERFACE_A   DEV_BROADCAST_DEVICEINTERFACE;
  414. typedef PDEV_BROADCAST_DEVICEINTERFACE_A  PDEV_BROADCAST_DEVICEINTERFACE;
  415. #endif
  416.  
  417. typedef struct _DEV_BROADCAST_HANDLE {
  418.     DWORD       dbch_size;
  419.     DWORD       dbch_devicetype;
  420.     DWORD       dbch_reserved;
  421.     DWORD       dbch_handle;     // file handle used in call to RegisterDeviceNotification
  422.     DWORD       dbch_hdevnotify; // HDEVNOTIFY returned from RegisterDeviceNotification
  423.     //
  424.     // The following 3 fields are only valid if wParam is DBT_CUSTOMEVENT.
  425.     //
  426.     GUID        dbch_eventguid;
  427.     LONG        dbch_nameoffset; // offset (bytes) of variable-length string buffer (-1 if none)
  428.     BYTE        dbch_data[1];    // variable-sized buffer, potentially containing binary and/or text data
  429. } DEV_BROADCAST_HANDLE, *PDEV_BROADCAST_HANDLE;
  430.  
  431. #endif /* WINVER >= 0x040A */
  432.  
  433. #define DBTF_RESOURCE   0x00000001      // network resource
  434. #define DBTF_XPORT      0x00000002      // new transport coming or going
  435. #define DBTF_SLOWNET    0x00000004      // new incoming transport is slow
  436.                                         // (dbcn_resource undefined for now)
  437.  
  438. #define DBT_VPOWERDAPI  0x8100          // VPOWERD API for Win95
  439.  
  440. /*
  441.  *  User-defined message types all use wParam = 0xFFFF with the
  442.  *  lParam a pointer to the structure below.
  443.  *
  444.  *  dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
  445.  *
  446.  *  dbud_szName contains a case-sensitive ASCIIZ name which names the
  447.  *  message.  The message name consists of the vendor name, a backslash,
  448.  *  then arbitrary user-defined ASCIIZ text.  For example:
  449.  *
  450.  *      "WidgetWare\QueryScannerShutdown"
  451.  *      "WidgetWare\Video Q39S\AdapterReady"
  452.  *
  453.  *  After the ASCIIZ name, arbitrary information may be provided.
  454.  *  Make sure that dbud_dbh.dbch_size is big enough to encompass
  455.  *  all the data.  And remember that nothing in the structure may
  456.  *  contain pointers.
  457.  */
  458.  
  459. #define DBT_USERDEFINED 0xFFFF
  460.  
  461. struct _DEV_BROADCAST_USERDEFINED { /* */
  462.     struct _DEV_BROADCAST_HDR dbud_dbh;
  463.     char        dbud_szName[1];     /* ASCIIZ name */
  464. /*  BYTE        dbud_rgbUserDefined[];*/ /* User-defined contents */
  465. };
  466.  
  467. /*
  468.  *  Obsolete definitions--do not use.
  469.  */
  470. #if(WINVER >= 0x040A)
  471.  
  472. #define DBT_DEVTYP_INTERFACEDEVICE  DBT_DEVTYP_DEVICEINTERFACE
  473.  
  474. typedef DEV_BROADCAST_DEVICEINTERFACE_W   DEV_BROADCAST_INTERFACEDEVICE_W;
  475. typedef PDEV_BROADCAST_DEVICEINTERFACE_W  PDEV_BROADCAST_INTERFACEDEVICE_W;
  476. typedef DEV_BROADCAST_DEVICEINTERFACE_A   DEV_BROADCAST_INTERFACEDEVICE_A;
  477. typedef PDEV_BROADCAST_DEVICEINTERFACE_A  PDEV_BROADCAST_INTERFACEDEVICE_A;
  478. #ifdef UNICODE
  479. typedef DEV_BROADCAST_INTERFACEDEVICE_W   DEV_BROADCAST_INTERFACEDEVICE;
  480. typedef PDEV_BROADCAST_INTERFACEDEVICE_W  PDEV_BROADCAST_INTERFACEDEVICE;
  481. #else
  482. typedef DEV_BROADCAST_INTERFACEDEVICE_A   DEV_BROADCAST_INTERFACEDEVICE;
  483. typedef PDEV_BROADCAST_INTERFACEDEVICE_A  PDEV_BROADCAST_INTERFACEDEVICE;
  484. #endif
  485.  
  486. #endif /* WINVER >= 0x040A */
  487.  
  488. #endif  // _DBT_H
  489.  
  490.