JwaDbt.pas
上传用户:davidchvip
上传日期:2009-07-28
资源大小:1749k
文件大小:23k
源码类别:

Windows编程

开发平台:

Delphi

  1. {******************************************************************************}
  2. {                                                                       }
  3. { Equates for WM_DEVICECHANGE and BroadcastSystemMessage for Object Pascal     }
  4. {                                                                       }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
  6. { Corporation. All Rights Reserved.                                            }
  7. {                 }
  8. { The original file is: dbt.h, released June 2000. The original Pascal         }
  9. { code is: Dbt.pas, released December 2000. The initial developer of the       }
  10. { Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
  11. {                                                                              }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
  13. { Marcel van Brakel. All Rights Reserved.                                      }
  14. {                 }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  16. {                }
  17. { You may retrieve the latest version of this file at the Project JEDI home    }
  18. { page, located at http://delphi-jedi.org or my personal homepage located at   }
  19. { http://members.chello.nl/m.vanbrakel2                                        }
  20. {                }
  21. { The contents of this file are used with permission, subject to the Mozilla   }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at      }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  25. {                                                                              }
  26. { Software distributed under the License is distributed on an "AS IS" basis,   }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License.    }
  29. {                                                                              }
  30. { Alternatively, the contents of this file may be used under the terms of the  }
  31. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  32. { provisions of the LGPL License are applicable instead of those above.        }
  33. { If you wish to allow use of your version of this file only under the terms   }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting  the provisions above and  }
  36. { replace  them with the notice and other provisions required by the LGPL      }
  37. { License.  If you do not delete the provisions above, a recipient may use     }
  38. { your version of this file under either the MPL or the LGPL License.          }
  39. {                 }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. {                 }
  42. {******************************************************************************}
  43. unit JwaDbt;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "dbt.h"'}
  47. {$HPPEMIT ''}
  48. {$I WINDEFINES.INC}
  49. interface
  50. uses
  51.   JwaWinType, JwaWinUser;
  52. //
  53. // BroadcastSpecialMessage constants.
  54. //
  55. const
  56.   WM_DEVICECHANGE = $0219;
  57.   {$EXTERNALSYM WM_DEVICECHANGE}
  58. (*
  59.  * Broadcast message and receipient flags.
  60.  *
  61.  * Note that there is a third "flag". If the wParam has:
  62.  *
  63.  * bit 15 on:   lparam is a pointer and bit 14 is meaningfull.
  64.  * bit 15 off:  lparam is just a UNLONG data type.
  65.  *
  66.  * bit 14 on:   lparam is a pointer to an ASCIIZ string.
  67.  * bit 14 off:  lparam is a pointer to a binary struture starting with
  68.  *              a dword describing the length of the structure.
  69.  *)
  70.   BSF_QUERY              = $00000001;
  71.   {$EXTERNALSYM BSF_QUERY}
  72.   BSF_IGNORECURRENTTASK  = $00000002;     // Meaningless for VxDs
  73.   {$EXTERNALSYM BSF_IGNORECURRENTTASK}
  74.   BSF_FLUSHDISK          = $00000004;     // Shouldn't be used by VxDs
  75.   {$EXTERNALSYM BSF_FLUSHDISK}
  76.   BSF_NOHANG             = $00000008;
  77.   {$EXTERNALSYM BSF_NOHANG}
  78.   BSF_POSTMESSAGE        = $00000010;
  79.   {$EXTERNALSYM BSF_POSTMESSAGE}
  80.   BSF_FORCEIFHUNG        = $00000020;
  81.   {$EXTERNALSYM BSF_FORCEIFHUNG}
  82.   BSF_NOTIMEOUTIFNOTHUNG = $00000040;
  83.   {$EXTERNALSYM BSF_NOTIMEOUTIFNOTHUNG}
  84.   BSF_MSGSRV32ISOK       = $80000000;     // Called synchronously from PM API
  85.   {$EXTERNALSYM BSF_MSGSRV32ISOK}
  86.   BSF_MSGSRV32ISOK_BIT   = 31;            // Called synchronously from PM API
  87.   {$EXTERNALSYM BSF_MSGSRV32ISOK_BIT}
  88.   BSM_ALLCOMPONENTS      = $00000000;
  89.   {$EXTERNALSYM BSM_ALLCOMPONENTS}
  90.   BSM_VXDS               = $00000001;
  91.   {$EXTERNALSYM BSM_VXDS}
  92.   BSM_NETDRIVER          = $00000002;
  93.   {$EXTERNALSYM BSM_NETDRIVER}
  94.   BSM_INSTALLABLEDRIVERS = $00000004;
  95.   {$EXTERNALSYM BSM_INSTALLABLEDRIVERS}
  96.   BSM_APPLICATIONS       = $00000008;
  97.   {$EXTERNALSYM BSM_APPLICATIONS}
  98. (*
  99.  * Message = WM_DEVICECHANGE
  100.  * wParam  = DBT_APPYBEGIN
  101.  * lParam  = (not used)
  102.  *
  103.  *      'Appy-time is now available.  This message is itself sent
  104.  *      at 'Appy-time.
  105.  *
  106.  * Message = WM_DEVICECHANGE
  107.  * wParam  = DBT_APPYEND
  108.  * lParam  = (not used)
  109.  *
  110.  *      'Appy-time is no longer available.  This message is *NOT* sent
  111.  *      at 'Appy-time.  (It cannot be, because 'Appy-time is gone.)
  112.  *
  113.  * NOTE!  It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
  114.  * multiple times during a single Windows session.  Each appearance of
  115.  * 'Appy-time is bracketed by these two messages, but 'Appy-time may
  116.  * momentarily become unavailable during otherwise normal Windows
  117.  * processing.  The current status of 'Appy-time availability can always
  118.  * be obtained from a call to _SHELL_QueryAppyTimeAvailable.
  119.  *)
  120.   DBT_APPYBEGIN = $0000;
  121.   {$EXTERNALSYM DBT_APPYBEGIN}
  122.   DBT_APPYEND   = $0001;
  123.   {$EXTERNALSYM DBT_APPYEND}
  124. (*
  125.  * Message = WM_DEVICECHANGE
  126.  * wParam  = DBT_DEVNODES_CHANGED
  127.  * lParam  = 0
  128.  *
  129.  *      send when configmg finished a process tree batch. Some devnodes
  130.  *      may have been added or removed. This is used by ring3 people which
  131.  *      need to be refreshed whenever any devnode changed occur (like
  132.  *      device manager). People specific to certain devices should use
  133.  *      DBT_DEVICE* instead.
  134.  *)
  135.   DBT_DEVNODES_CHANGED = $0007;
  136.   {$EXTERNALSYM DBT_DEVNODES_CHANGED}
  137. (*
  138.  * Message = WM_DEVICECHANGE
  139.  * wParam  = DBT_QUERYCHANGECONFIG
  140.  * lParam  = 0
  141.  *
  142.  *      sent to ask if a config change is allowed
  143.  *)
  144.   DBT_QUERYCHANGECONFIG = $0017;
  145.   {$EXTERNALSYM DBT_QUERYCHANGECONFIG}
  146. (*
  147.  * Message = WM_DEVICECHANGE
  148.  * wParam  = DBT_CONFIGCHANGED
  149.  * lParam  = 0
  150.  *
  151.  *      sent when a config has changed
  152.  *)
  153.   DBT_CONFIGCHANGED = $0018;
  154.   {$EXTERNALSYM DBT_CONFIGCHANGED}
  155. (*
  156.  * Message = WM_DEVICECHANGE
  157.  * wParam  = DBT_CONFIGCHANGECANCELED
  158.  * lParam  = 0
  159.  *
  160.  *      someone cancelled the config change
  161.  *)
  162.   DBT_CONFIGCHANGECANCELED = $0019;
  163.   {$EXTERNALSYM DBT_CONFIGCHANGECANCELED}
  164. (*
  165.  * Message = WM_DEVICECHANGE
  166.  * wParam  = DBT_MONITORCHANGE
  167.  * lParam  = new resolution to use (LOWORD=x, HIWORD=y)
  168.  *           if 0, use the default res for current config
  169.  *
  170.  *      this message is sent when the display monitor has changed
  171.  *      and the system should change the display mode to match it.
  172.  *)
  173.   DBT_MONITORCHANGE = $001B;
  174.   {$EXTERNALSYM DBT_MONITORCHANGE}
  175. (*
  176.  * Message = WM_DEVICECHANGE
  177.  * wParam  = DBT_SHELLLOGGEDON
  178.  * lParam  = 0
  179.  *
  180.  *      The shell has finished login on: VxD can now do Shell_EXEC.
  181.  *)
  182.   DBT_SHELLLOGGEDON = $0020;
  183.   {$EXTERNALSYM DBT_SHELLLOGGEDON}
  184. (*
  185.  * Message = WM_DEVICECHANGE
  186.  * wParam  = DBT_CONFIGMGAPI
  187.  * lParam  = CONFIGMG API Packet
  188.  *
  189.  *      CONFIGMG ring 3 call.
  190.  *)
  191.   DBT_CONFIGMGAPI32 = $0022;
  192.   {$EXTERNALSYM DBT_CONFIGMGAPI32}
  193. (*
  194.  * Message = WM_DEVICECHANGE
  195.  * wParam  = DBT_VXDINITCOMPLETE
  196.  * lParam  = 0
  197.  *
  198.  *      CONFIGMG ring 3 call.
  199.  *)
  200.   DBT_VXDINITCOMPLETE = $0023;
  201.   {$EXTERNALSYM DBT_VXDINITCOMPLETE}
  202. (*
  203.  * Message = WM_DEVICECHANGE
  204.  * wParam  = DBT_VOLLOCK*
  205.  * lParam  = pointer to VolLockBroadcast structure described below
  206.  *
  207.  *      Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
  208.  *      All these messages pass a pointer to a struct which has no pointers.
  209.  *)
  210.   DBT_VOLLOCKQUERYLOCK    = $8041;
  211.   {$EXTERNALSYM DBT_VOLLOCKQUERYLOCK}
  212.   DBT_VOLLOCKLOCKTAKEN    = $8042;
  213.   {$EXTERNALSYM DBT_VOLLOCKLOCKTAKEN}
  214.   DBT_VOLLOCKLOCKFAILED   = $8043;
  215.   {$EXTERNALSYM DBT_VOLLOCKLOCKFAILED}
  216.   DBT_VOLLOCKQUERYUNLOCK  = $8044;
  217.   {$EXTERNALSYM DBT_VOLLOCKQUERYUNLOCK}
  218.   DBT_VOLLOCKLOCKRELEASED = $8045;
  219.   {$EXTERNALSYM DBT_VOLLOCKLOCKRELEASED}
  220.   DBT_VOLLOCKUNLOCKFAILED = $8046;
  221.   {$EXTERNALSYM DBT_VOLLOCKUNLOCKFAILED}
  222. (*
  223.  * Device broadcast header
  224.  *)
  225. type
  226.   _DEV_BROADCAST_HDR = record
  227.     dbch_size: DWORD;
  228.     dbch_devicetype: DWORD;
  229.     dbch_reserved: DWORD;
  230.   end;
  231.   {$EXTERNALSYM _DEV_BROADCAST_HDR}
  232.   DEV_BROADCAST_HDR = _DEV_BROADCAST_HDR;
  233.   {$EXTERNALSYM DEV_BROADCAST_HDR}
  234.   PDEV_BROADCAST_HDR = ^DEV_BROADCAST_HDR;
  235.   {$EXTERNALSYM PDEV_BROADCAST_HDR}
  236.   TDevBroadcastHdr = DEV_BROADCAST_HDR;
  237.   PDevBroadcastHdr = PDEV_BROADCAST_HDR;
  238. (*
  239.  * Structure for volume lock broadcast
  240.  *)
  241.   VolLockBroadcast = record
  242.     vlb_dbh: DEV_BROADCAST_HDR;
  243.     vlb_owner: DWORD;   // thread on which lock request is being issued
  244.     vlb_perms: BYTE;    // lock permission flags defined below
  245.     vlb_lockType: BYTE; // type of lock
  246.     vlb_drive: BYTE;    // drive on which lock is issued
  247.     vlb_flags: BYTE;    // miscellaneous flags
  248.   end;
  249.   {$EXTERNALSYM VolLockBroadcast}
  250.   TVollockbroadcast = VolLockBroadcast;
  251.   PVollockbroadcast = ^VolLockBroadcast;
  252. (*
  253.  * Values for vlb_perms
  254.  *)
  255. const
  256.   LOCKP_ALLOW_WRITES      = $01; // Bit 0 set - allow writes
  257.   {$EXTERNALSYM LOCKP_ALLOW_WRITES}
  258.   LOCKP_FAIL_WRITES       = $00; // Bit 0 clear - fail writes
  259.   {$EXTERNALSYM LOCKP_FAIL_WRITES}
  260.   LOCKP_FAIL_MEM_MAPPING  = $02; // Bit 1 set - fail memory mappings
  261.   {$EXTERNALSYM LOCKP_FAIL_MEM_MAPPING}
  262.   LOCKP_ALLOW_MEM_MAPPING = $00; // Bit 1 clear - allow memory mappings
  263.   {$EXTERNALSYM LOCKP_ALLOW_MEM_MAPPING}
  264.   LOCKP_USER_MASK         = $03; // Mask for user lock flags
  265.   {$EXTERNALSYM LOCKP_USER_MASK}
  266.   LOCKP_LOCK_FOR_FORMAT   = $04; // Level 0 lock for format
  267.   {$EXTERNALSYM LOCKP_LOCK_FOR_FORMAT}
  268. (*
  269.  * Values for vlb_flags
  270.  *)
  271.   LOCKF_LOGICAL_LOCK  = $00; // Bit 0 clear - logical lock
  272.   {$EXTERNALSYM LOCKF_LOGICAL_LOCK}
  273.   LOCKF_PHYSICAL_LOCK = $01; // Bit 0 set - physical lock
  274.   {$EXTERNALSYM LOCKF_PHYSICAL_LOCK}
  275. (*
  276.  * Message = WM_DEVICECHANGE
  277.  * wParam  = DBT_NODISKSPACE
  278.  * lParam  = drive number of drive that is out of disk space (1-based)
  279.  *
  280.  * Message issued by IFS manager when it detects that a drive is run out of
  281.  * free space.
  282.  *)
  283.   DBT_NO_DISK_SPACE = $0047;
  284.   {$EXTERNALSYM DBT_NO_DISK_SPACE}
  285. (*
  286.  * Message = WM_DEVICECHANGE
  287.  * wParam  = DBT_LOW_DISK_SPACE
  288.  * lParam  = drive number of drive that is low on disk space (1-based)
  289.  *
  290.  * Message issued by VFAT when it detects that a drive it has mounted
  291.  * has the remaning free space below a threshold specified by the
  292.  * registry or by a disk space management application.
  293.  * The broadcast is issued by VFAT ONLY when space is either allocated
  294.  * or freed by VFAT.
  295.  *)
  296.   DBT_LOW_DISK_SPACE = $0048;
  297.   {$EXTERNALSYM DBT_LOW_DISK_SPACE}
  298.   DBT_CONFIGMGPRIVATE = $7FFF;
  299.   {$EXTERNALSYM DBT_CONFIGMGPRIVATE}
  300. (*
  301.  * The following messages are for WM_DEVICECHANGE. The immediate list
  302.  * is for the wParam. ALL THESE MESSAGES PASS A POINTER TO A STRUCT
  303.  * STARTING WITH A DWORD SIZE AND HAVING NO POINTER IN THE STRUCT.
  304.  *
  305.  *)
  306.   DBT_DEVICEARRIVAL           = $8000; // system detected a new device
  307.   {$EXTERNALSYM DBT_DEVICEARRIVAL}
  308.   DBT_DEVICEQUERYREMOVE       = $8001; // wants to remove, may fail
  309.   {$EXTERNALSYM DBT_DEVICEQUERYREMOVE}
  310.   DBT_DEVICEQUERYREMOVEFAILED = $8002; // removal aborted
  311.   {$EXTERNALSYM DBT_DEVICEQUERYREMOVEFAILED}
  312.   DBT_DEVICEREMOVEPENDING     = $8003; // about to remove, still avail.
  313.   {$EXTERNALSYM DBT_DEVICEREMOVEPENDING}
  314.   DBT_DEVICEREMOVECOMPLETE    = $8004; // device is gone
  315.   {$EXTERNALSYM DBT_DEVICEREMOVECOMPLETE}
  316.   DBT_DEVICETYPESPECIFIC      = $8005; // type specific event
  317.   {$EXTERNALSYM DBT_DEVICETYPESPECIFIC}
  318.   DBT_CUSTOMEVENT             = $8006; // user-defined event
  319.   {$EXTERNALSYM DBT_CUSTOMEVENT}
  320.   DBT_DEVTYP_OEM     = $00000000; // oem-defined device type
  321.   {$EXTERNALSYM DBT_DEVTYP_OEM}
  322.   DBT_DEVTYP_DEVNODE = $00000001; // devnode number
  323.   {$EXTERNALSYM DBT_DEVTYP_DEVNODE}
  324.   DBT_DEVTYP_VOLUME  = $00000002; // logical volume
  325.   {$EXTERNALSYM DBT_DEVTYP_VOLUME}
  326.   DBT_DEVTYP_PORT    = $00000003; // serial, parallel
  327.   {$EXTERNALSYM DBT_DEVTYP_PORT}
  328.   DBT_DEVTYP_NET     = $00000004; // network resource
  329.   {$EXTERNALSYM DBT_DEVTYP_NET}
  330.   DBT_DEVTYP_DEVICEINTERFACE = $00000005; // device interface class
  331.   {$EXTERNALSYM DBT_DEVTYP_DEVICEINTERFACE}
  332.   DBT_DEVTYP_HANDLE          = $00000006; // file system handle
  333.   {$EXTERNALSYM DBT_DEVTYP_HANDLE}
  334. type
  335.   _DEV_BROADCAST_HEADER = record
  336.     dbcd_size: DWORD;
  337.     dbcd_devicetype: DWORD;
  338.     dbcd_reserved: DWORD;
  339.   end;
  340.   {$EXTERNALSYM _DEV_BROADCAST_HEADER}
  341.   TDevBroadcastHeader = _DEV_BROADCAST_HEADER;
  342.   PDevBroadcastHeader = ^_DEV_BROADCAST_HEADER;
  343.   PDEV_BROADCAST_OEM = ^DEV_BROADCAST_OEM;
  344.   {$EXTERNALSYM PDEV_BROADCAST_OEM}
  345.   _DEV_BROADCAST_OEM = record
  346.     dbco_size: DWORD;
  347.     dbco_devicetype: DWORD;
  348.     dbco_reserved: DWORD;
  349.     dbco_identifier: DWORD;
  350.     dbco_suppfunc: DWORD;
  351.   end;
  352.   {$EXTERNALSYM _DEV_BROADCAST_OEM}
  353.   DEV_BROADCAST_OEM = _DEV_BROADCAST_OEM;
  354.   {$EXTERNALSYM DEV_BROADCAST_OEM}
  355.   TDevBroadcastOem = DEV_BROADCAST_OEM;
  356.   PDevBroadcastOem = PDEV_BROADCAST_OEM;
  357.   PDEV_BROADCAST_DEVNODE = ^DEV_BROADCAST_DEVNODE;
  358.   {$EXTERNALSYM PDEV_BROADCAST_DEVNODE}
  359.   _DEV_BROADCAST_DEVNODE = record
  360.     dbcd_size: DWORD;
  361.     dbcd_devicetype: DWORD;
  362.     dbcd_reserved: DWORD;
  363.     dbcd_devnode: DWORD;
  364.   end;
  365.   {$EXTERNALSYM _DEV_BROADCAST_DEVNODE}
  366.   DEV_BROADCAST_DEVNODE = _DEV_BROADCAST_DEVNODE;
  367.   {$EXTERNALSYM DEV_BROADCAST_DEVNODE}
  368.   TDevBroadcastDevNode = DEV_BROADCAST_DEVNODE;
  369.   PDevBroadcastDevNode = PDEV_BROADCAST_DEVNODE;
  370.   PDEV_BROADCAST_VOLUME = ^DEV_BROADCAST_VOLUME;
  371.   {$EXTERNALSYM PDEV_BROADCAST_VOLUME}
  372.   _DEV_BROADCAST_VOLUME = record
  373.     dbcv_size: DWORD;
  374.     dbcv_devicetype: DWORD;
  375.     dbcv_reserved: DWORD;
  376.     dbcv_unitmask: DWORD;
  377.     dbcv_flags: WORD;
  378.   end;
  379.   {$EXTERNALSYM _DEV_BROADCAST_VOLUME}
  380.   DEV_BROADCAST_VOLUME = _DEV_BROADCAST_VOLUME;
  381.   {$EXTERNALSYM DEV_BROADCAST_VOLUME}
  382.   TDevBroadcastVolume = DEV_BROADCAST_VOLUME;
  383.   PDevBroadcastVolume = PDEV_BROADCAST_VOLUME;
  384. const
  385.   DBTF_MEDIA = $0001; // media comings and goings
  386.   {$EXTERNALSYM DBTF_MEDIA}
  387.   DBTF_NET   = $0002; // network volume
  388.   {$EXTERNALSYM DBTF_NET}
  389. type
  390.   PDEV_BROADCAST_PORT_A = ^DEV_BROADCAST_PORT_A;
  391.   {$EXTERNALSYM PDEV_BROADCAST_PORT_A}
  392.   _DEV_BROADCAST_PORT_A = record
  393.     dbcp_size: DWORD;
  394.     dbcp_devicetype: DWORD;
  395.     dbcp_reserved: DWORD;
  396.     dbcp_name: array [0..0] of Char;
  397.   end;
  398.   {$EXTERNALSYM _DEV_BROADCAST_PORT_A}
  399.   DEV_BROADCAST_PORT_A = _DEV_BROADCAST_PORT_A;
  400.   {$EXTERNALSYM DEV_BROADCAST_PORT_A}
  401.   TDevBroadcastPortA = DEV_BROADCAST_PORT_A;
  402.   PDevBroadcastPortA = PDEV_BROADCAST_PORT_A;
  403.   PDEV_BROADCAST_PORT_W = ^DEV_BROADCAST_PORT_W;
  404.   {$EXTERNALSYM PDEV_BROADCAST_PORT_W}
  405.   _DEV_BROADCAST_PORT_W = record
  406.     dbcp_size: DWORD;
  407.     dbcp_devicetype: DWORD;
  408.     dbcp_reserved: DWORD;
  409.     dbcp_name: array [0..0] of WideChar;
  410.   end;
  411.   {$EXTERNALSYM _DEV_BROADCAST_PORT_W}
  412.   DEV_BROADCAST_PORT_W = _DEV_BROADCAST_PORT_W;
  413.   {$EXTERNALSYM DEV_BROADCAST_PORT_W}
  414.   TDevBroadcastPortW = DEV_BROADCAST_PORT_W;
  415.   PDevBroadcastPortW = PDEV_BROADCAST_PORT_W;
  416. {$IFDEF UNICODE}
  417.   DEV_BROADCAST_PORT = DEV_BROADCAST_PORT_W;
  418.   {$EXTERNALSYM DEV_BROADCAST_PORT}
  419.   PDEV_BROADCAST_PORT = PDEV_BROADCAST_PORT_W;
  420.   {$EXTERNALSYM PDEV_BROADCAST_PORT}
  421.   TDevBroadcastPort = TDevBroadcastPortW;
  422.   PDevBroadcastPort = PDevBroadcastPortW;
  423. {$ELSE}
  424.   DEV_BROADCAST_PORT = DEV_BROADCAST_PORT_A;
  425.   {$EXTERNALSYM DEV_BROADCAST_PORT}
  426.   PDEV_BROADCAST_PORT = PDEV_BROADCAST_PORT_A;
  427.   {$EXTERNALSYM PDEV_BROADCAST_PORT}
  428.   TDevBroadcastPort = TDevBroadcastPortA;
  429.   PDevBroadcastPort = PDevBroadcastPortA;
  430. {$ENDIF}
  431.   PDEV_BROADCAST_NET = ^DEV_BROADCAST_NET;
  432.   {$EXTERNALSYM PDEV_BROADCAST_NET}
  433.   _DEV_BROADCAST_NET = record
  434.     dbcn_size: DWORD;
  435.     dbcn_devicetype: DWORD;
  436.     dbcn_reserved: DWORD;
  437.     dbcn_resource: DWORD;
  438.     dbcn_flags: DWORD;
  439.   end;
  440.   {$EXTERNALSYM _DEV_BROADCAST_NET}
  441.   DEV_BROADCAST_NET = _DEV_BROADCAST_NET;
  442.   {$EXTERNALSYM DEV_BROADCAST_NET}
  443.   TDevBroadcastNet = DEV_BROADCAST_NET;
  444.   PDevBroadcastNet = PDEV_BROADCAST_NET;
  445.   PDEV_BROADCAST_DEVICEINTERFACE_A = ^DEV_BROADCAST_DEVICEINTERFACE_A;
  446.   {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE_A}
  447.   _DEV_BROADCAST_DEVICEINTERFACE_A = record
  448.     dbcc_size: DWORD;
  449.     dbcc_devicetype: DWORD;
  450.     dbcc_reserved: DWORD;
  451.     dbcc_classguid: GUID;
  452.     dbcc_name: array [0..0] of char;
  453.   end;
  454.   {$EXTERNALSYM _DEV_BROADCAST_DEVICEINTERFACE_A}
  455.   DEV_BROADCAST_DEVICEINTERFACE_A = _DEV_BROADCAST_DEVICEINTERFACE_A;
  456.   {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE_A}
  457.   TDevBroadcastDeviceInterfaceA = DEV_BROADCAST_DEVICEINTERFACE_A;
  458.   PDevBroadcastDeviceInterfaceA = PDEV_BROADCAST_DEVICEINTERFACE_A;
  459.   PDEV_BROADCAST_DEVICEINTERFACE_W = ^DEV_BROADCAST_DEVICEINTERFACE_W;
  460.   {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE_W}
  461.   _DEV_BROADCAST_DEVICEINTERFACE_W = record
  462.     dbcc_size: DWORD;
  463.     dbcc_devicetype: DWORD;
  464.     dbcc_reserved: DWORD;
  465.     dbcc_classguid: GUID;
  466.     dbcc_name: array [0..0] of wchar_t;
  467.   end;
  468.   {$EXTERNALSYM _DEV_BROADCAST_DEVICEINTERFACE_W}
  469.   DEV_BROADCAST_DEVICEINTERFACE_W = _DEV_BROADCAST_DEVICEINTERFACE_W;
  470.   {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE_W}
  471.   TDevBroadcastDeviceInterfaceW = DEV_BROADCAST_DEVICEINTERFACE_W;
  472.   PDevBroadcastDeviceInterfaceW = PDEV_BROADCAST_DEVICEINTERFACE_W;
  473. {$IFDEF UNICODE}
  474.   DEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE_W;
  475.   {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE}
  476.   PDEV_BROADCAST_DEVICEINTERFACE = PDEV_BROADCAST_DEVICEINTERFACE_W;
  477.   {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE}
  478.   TDevBroadcastDeviceInterface = TDevBroadcastDeviceInterfaceW;
  479.   PDevBroadcastDeviceInterface = PDevBroadcastDeviceInterfaceW;
  480. {$ELSE}
  481.   DEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE_A;
  482.   {$EXTERNALSYM DEV_BROADCAST_DEVICEINTERFACE}
  483.   PDEV_BROADCAST_DEVICEINTERFACE = PDEV_BROADCAST_DEVICEINTERFACE_A;
  484.   {$EXTERNALSYM PDEV_BROADCAST_DEVICEINTERFACE}
  485.   TDevBroadcastDeviceInterface = TDevBroadcastDeviceInterfaceA;
  486.   PDevBroadcastDeviceInterface = PDevBroadcastDeviceInterfaceA;
  487. {$ENDIF}
  488.   PDEV_BROADCAST_HANDLE = ^DEV_BROADCAST_HANDLE;
  489.   {$EXTERNALSYM PDEV_BROADCAST_HANDLE}
  490.   _DEV_BROADCAST_HANDLE = record
  491.     dbch_size: DWORD;
  492.     dbch_devicetype: DWORD;
  493.     dbch_reserved: DWORD;
  494.     dbch_handle: HANDLE;         // file handle used in call to RegisterDeviceNotification
  495.     dbch_hdevnotify: HDEVNOTIFY; // returned from RegisterDeviceNotification
  496.     //
  497.     // The following 3 fields are only valid if wParam is DBT_CUSTOMEVENT.
  498.     //
  499.     dbch_eventguid: GUID;
  500.     dbch_nameoffset: LONG;           // offset (bytes) of variable-length string buffer (-1 if none)
  501.     dbch_data: array [0..0] of BYTE; // variable-sized buffer, potentially containing binary and/or text data
  502.   end;
  503.   {$EXTERNALSYM _DEV_BROADCAST_HANDLE}
  504.   DEV_BROADCAST_HANDLE = _DEV_BROADCAST_HANDLE;
  505.   {$EXTERNALSYM DEV_BROADCAST_HANDLE}
  506.   TDevBroadcastHandle = DEV_BROADCAST_HANDLE;
  507.   PDevBroadcastHandle = PDEV_BROADCAST_HANDLE;
  508. //
  509. // Define 32-bit and 64-bit versions of the DEV_BROADCAST_HANDLE structure
  510. // for WOW64.  These must be kept in sync with the above structure.
  511. //
  512.   PDEV_BROADCAST_HANDLE32 = ^DEV_BROADCAST_HANDLE32;
  513.   {$EXTERNALSYM PDEV_BROADCAST_HANDLE32}
  514.   _DEV_BROADCAST_HANDLE32 = record
  515.     dbch_size: DWORD;
  516.     dbch_devicetype: DWORD;
  517.     dbch_reserved: DWORD;
  518.     dbch_handle: ULONG32;
  519.     dbch_hdevnotify: ULONG32;
  520.     dbch_eventguid: GUID;
  521.     dbch_nameoffset: LONG;
  522.     dbch_data: array [0..0] of BYTE;
  523.   end;
  524.   {$EXTERNALSYM _DEV_BROADCAST_HANDLE32}
  525.   DEV_BROADCAST_HANDLE32 = _DEV_BROADCAST_HANDLE32;
  526.   {$EXTERNALSYM DEV_BROADCAST_HANDLE32}
  527.   TDevBroadcastHandle32 = DEV_BROADCAST_HANDLE32;
  528.   PDevBroadcastHandle32 = PDEV_BROADCAST_HANDLE32;
  529.   PDEV_BROADCAST_HANDLE64 = ^DEV_BROADCAST_HANDLE64;
  530.   {$EXTERNALSYM PDEV_BROADCAST_HANDLE64}
  531.   _DEV_BROADCAST_HANDLE64 = record
  532.     dbch_size: DWORD;
  533.     dbch_devicetype: DWORD;
  534.     dbch_reserved: DWORD;
  535.     dbch_handle: ULONG64;
  536.     dbch_hdevnotify: ULONG64;
  537.     dbch_eventguid: GUID;
  538.     dbch_nameoffset: LONG;
  539.     dbch_data: array [0..0] of BYTE;
  540.   end;
  541.   {$EXTERNALSYM _DEV_BROADCAST_HANDLE64}
  542.   DEV_BROADCAST_HANDLE64 = _DEV_BROADCAST_HANDLE64;
  543.   {$EXTERNALSYM DEV_BROADCAST_HANDLE64}
  544.   TDevBroadcastHandle64 = DEV_BROADCAST_HANDLE64;
  545.   PDevBroadcastHandle64 = PDEV_BROADCAST_HANDLE64;
  546. const
  547.   DBTF_RESOURCE = $00000001; // network resource
  548.   {$EXTERNALSYM DBTF_RESOURCE}
  549.   DBTF_XPORT    = $00000002; // new transport coming or going
  550.   {$EXTERNALSYM DBTF_XPORT}
  551.   DBTF_SLOWNET  = $00000004; // new incoming transport is slow
  552.   {$EXTERNALSYM DBTF_SLOWNET}
  553.                              // (dbcn_resource undefined for now)
  554.   DBT_VPOWERDAPI = $8100; // VPOWERD API for Win95
  555.   {$EXTERNALSYM DBT_VPOWERDAPI}
  556. (*
  557.  *  User-defined message types all use wParam = 0xFFFF with the
  558.  *  lParam a pointer to the structure below.
  559.  *
  560.  *  dbud_dbh - DEV_BROADCAST_HEADER must be filled in as usual.
  561.  *
  562.  *  dbud_szName contains a case-sensitive ASCIIZ name which names the
  563.  *  message.  The message name consists of the vendor name, a backslash,
  564.  *  then arbitrary user-defined ASCIIZ text.  For example:
  565.  *
  566.  *      "WidgetWareQueryScannerShutdown"
  567.  *      "WidgetWareVideo Q39SAdapterReady"
  568.  *
  569.  *  After the ASCIIZ name, arbitrary information may be provided.
  570.  *  Make sure that dbud_dbh.dbch_size is big enough to encompass
  571.  *  all the data.  And remember that nothing in the structure may
  572.  *  contain pointers.
  573.  *)
  574.   DBT_USERDEFINED = $FFFF;
  575.   {$EXTERNALSYM DBT_USERDEFINED}
  576. type
  577.   PDEV_BROADCAST_USERDEFINED = ^DEV_BROADCAST_USERDEFINED;
  578.   {$EXTERNALSYM PDEV_BROADCAST_USERDEFINED}
  579.   _DEV_BROADCAST_USERDEFINED = record
  580.     dbud_dbh: DEV_BROADCAST_HDR;
  581.     dbud_szName: array [0..0] of Char;
  582.     //  BYTE        dbud_rgbUserDefined[];*/ /* User-defined contents */
  583.   end;
  584.   {$EXTERNALSYM _DEV_BROADCAST_USERDEFINED}
  585.   DEV_BROADCAST_USERDEFINED = _DEV_BROADCAST_USERDEFINED;
  586.   {$EXTERNALSYM DEV_BROADCAST_USERDEFINED}
  587.   TDevBroadcastUserDefined = DEV_BROADCAST_USERDEFINED;
  588.   PDevBroadcastUserDefined = PDEV_BROADCAST_USERDEFINED;
  589. implementation
  590. end.