📄 jwadbt.pas
字号:
{******************************************************************************}
{ }
{ Equates for WM_DEVICECHANGE and BroadcastSystemMessage for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: dbt.h, released June 2000. The original Pascal }
{ code is: Dbt.pas, released December 2000. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
unit JwaDbt;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "dbt.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
JwaWinType, JwaWinUser;
//
// BroadcastSpecialMessage constants.
//
const
WM_DEVICECHANGE = $0219;
{$EXTERNALSYM WM_DEVICECHANGE}
(*
* Broadcast message and receipient flags.
*
* Note that there is a third "flag". If the wParam has:
*
* bit 15 on: lparam is a pointer and bit 14 is meaningfull.
* bit 15 off: lparam is just a UNLONG data type.
*
* bit 14 on: lparam is a pointer to an ASCIIZ string.
* bit 14 off: lparam is a pointer to a binary struture starting with
* a dword describing the length of the structure.
*)
BSF_QUERY = $00000001;
{$EXTERNALSYM BSF_QUERY}
BSF_IGNORECURRENTTASK = $00000002; // Meaningless for VxDs
{$EXTERNALSYM BSF_IGNORECURRENTTASK}
BSF_FLUSHDISK = $00000004; // Shouldn't be used by VxDs
{$EXTERNALSYM BSF_FLUSHDISK}
BSF_NOHANG = $00000008;
{$EXTERNALSYM BSF_NOHANG}
BSF_POSTMESSAGE = $00000010;
{$EXTERNALSYM BSF_POSTMESSAGE}
BSF_FORCEIFHUNG = $00000020;
{$EXTERNALSYM BSF_FORCEIFHUNG}
BSF_NOTIMEOUTIFNOTHUNG = $00000040;
{$EXTERNALSYM BSF_NOTIMEOUTIFNOTHUNG}
BSF_MSGSRV32ISOK = $80000000; // Called synchronously from PM API
{$EXTERNALSYM BSF_MSGSRV32ISOK}
BSF_MSGSRV32ISOK_BIT = 31; // Called synchronously from PM API
{$EXTERNALSYM BSF_MSGSRV32ISOK_BIT}
BSM_ALLCOMPONENTS = $00000000;
{$EXTERNALSYM BSM_ALLCOMPONENTS}
BSM_VXDS = $00000001;
{$EXTERNALSYM BSM_VXDS}
BSM_NETDRIVER = $00000002;
{$EXTERNALSYM BSM_NETDRIVER}
BSM_INSTALLABLEDRIVERS = $00000004;
{$EXTERNALSYM BSM_INSTALLABLEDRIVERS}
BSM_APPLICATIONS = $00000008;
{$EXTERNALSYM BSM_APPLICATIONS}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_APPYBEGIN
* lParam = (not used)
*
* 'Appy-time is now available. This message is itself sent
* at 'Appy-time.
*
* Message = WM_DEVICECHANGE
* wParam = DBT_APPYEND
* lParam = (not used)
*
* 'Appy-time is no longer available. This message is *NOT* sent
* at 'Appy-time. (It cannot be, because 'Appy-time is gone.)
*
* NOTE! It is possible for DBT_APPYBEGIN and DBT_APPYEND to be sent
* multiple times during a single Windows session. Each appearance of
* 'Appy-time is bracketed by these two messages, but 'Appy-time may
* momentarily become unavailable during otherwise normal Windows
* processing. The current status of 'Appy-time availability can always
* be obtained from a call to _SHELL_QueryAppyTimeAvailable.
*)
DBT_APPYBEGIN = $0000;
{$EXTERNALSYM DBT_APPYBEGIN}
DBT_APPYEND = $0001;
{$EXTERNALSYM DBT_APPYEND}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_DEVNODES_CHANGED
* lParam = 0
*
* send when configmg finished a process tree batch. Some devnodes
* may have been added or removed. This is used by ring3 people which
* need to be refreshed whenever any devnode changed occur (like
* device manager). People specific to certain devices should use
* DBT_DEVICE* instead.
*)
DBT_DEVNODES_CHANGED = $0007;
{$EXTERNALSYM DBT_DEVNODES_CHANGED}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_QUERYCHANGECONFIG
* lParam = 0
*
* sent to ask if a config change is allowed
*)
DBT_QUERYCHANGECONFIG = $0017;
{$EXTERNALSYM DBT_QUERYCHANGECONFIG}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_CONFIGCHANGED
* lParam = 0
*
* sent when a config has changed
*)
DBT_CONFIGCHANGED = $0018;
{$EXTERNALSYM DBT_CONFIGCHANGED}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_CONFIGCHANGECANCELED
* lParam = 0
*
* someone cancelled the config change
*)
DBT_CONFIGCHANGECANCELED = $0019;
{$EXTERNALSYM DBT_CONFIGCHANGECANCELED}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_MONITORCHANGE
* lParam = new resolution to use (LOWORD=x, HIWORD=y)
* if 0, use the default res for current config
*
* this message is sent when the display monitor has changed
* and the system should change the display mode to match it.
*)
DBT_MONITORCHANGE = $001B;
{$EXTERNALSYM DBT_MONITORCHANGE}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_SHELLLOGGEDON
* lParam = 0
*
* The shell has finished login on: VxD can now do Shell_EXEC.
*)
DBT_SHELLLOGGEDON = $0020;
{$EXTERNALSYM DBT_SHELLLOGGEDON}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_CONFIGMGAPI
* lParam = CONFIGMG API Packet
*
* CONFIGMG ring 3 call.
*)
DBT_CONFIGMGAPI32 = $0022;
{$EXTERNALSYM DBT_CONFIGMGAPI32}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_VXDINITCOMPLETE
* lParam = 0
*
* CONFIGMG ring 3 call.
*)
DBT_VXDINITCOMPLETE = $0023;
{$EXTERNALSYM DBT_VXDINITCOMPLETE}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_VOLLOCK*
* lParam = pointer to VolLockBroadcast structure described below
*
* Messages issued by IFSMGR for volume locking purposes on WM_DEVICECHANGE.
* All these messages pass a pointer to a struct which has no pointers.
*)
DBT_VOLLOCKQUERYLOCK = $8041;
{$EXTERNALSYM DBT_VOLLOCKQUERYLOCK}
DBT_VOLLOCKLOCKTAKEN = $8042;
{$EXTERNALSYM DBT_VOLLOCKLOCKTAKEN}
DBT_VOLLOCKLOCKFAILED = $8043;
{$EXTERNALSYM DBT_VOLLOCKLOCKFAILED}
DBT_VOLLOCKQUERYUNLOCK = $8044;
{$EXTERNALSYM DBT_VOLLOCKQUERYUNLOCK}
DBT_VOLLOCKLOCKRELEASED = $8045;
{$EXTERNALSYM DBT_VOLLOCKLOCKRELEASED}
DBT_VOLLOCKUNLOCKFAILED = $8046;
{$EXTERNALSYM DBT_VOLLOCKUNLOCKFAILED}
(*
* Device broadcast header
*)
type
_DEV_BROADCAST_HDR = record
dbch_size: DWORD;
dbch_devicetype: DWORD;
dbch_reserved: DWORD;
end;
{$EXTERNALSYM _DEV_BROADCAST_HDR}
DEV_BROADCAST_HDR = _DEV_BROADCAST_HDR;
{$EXTERNALSYM DEV_BROADCAST_HDR}
PDEV_BROADCAST_HDR = ^DEV_BROADCAST_HDR;
{$EXTERNALSYM PDEV_BROADCAST_HDR}
TDevBroadcastHdr = DEV_BROADCAST_HDR;
PDevBroadcastHdr = PDEV_BROADCAST_HDR;
(*
* Structure for volume lock broadcast
*)
VolLockBroadcast = record
vlb_dbh: DEV_BROADCAST_HDR;
vlb_owner: DWORD; // thread on which lock request is being issued
vlb_perms: BYTE; // lock permission flags defined below
vlb_lockType: BYTE; // type of lock
vlb_drive: BYTE; // drive on which lock is issued
vlb_flags: BYTE; // miscellaneous flags
end;
{$EXTERNALSYM VolLockBroadcast}
TVollockbroadcast = VolLockBroadcast;
PVollockbroadcast = ^VolLockBroadcast;
(*
* Values for vlb_perms
*)
const
LOCKP_ALLOW_WRITES = $01; // Bit 0 set - allow writes
{$EXTERNALSYM LOCKP_ALLOW_WRITES}
LOCKP_FAIL_WRITES = $00; // Bit 0 clear - fail writes
{$EXTERNALSYM LOCKP_FAIL_WRITES}
LOCKP_FAIL_MEM_MAPPING = $02; // Bit 1 set - fail memory mappings
{$EXTERNALSYM LOCKP_FAIL_MEM_MAPPING}
LOCKP_ALLOW_MEM_MAPPING = $00; // Bit 1 clear - allow memory mappings
{$EXTERNALSYM LOCKP_ALLOW_MEM_MAPPING}
LOCKP_USER_MASK = $03; // Mask for user lock flags
{$EXTERNALSYM LOCKP_USER_MASK}
LOCKP_LOCK_FOR_FORMAT = $04; // Level 0 lock for format
{$EXTERNALSYM LOCKP_LOCK_FOR_FORMAT}
(*
* Values for vlb_flags
*)
LOCKF_LOGICAL_LOCK = $00; // Bit 0 clear - logical lock
{$EXTERNALSYM LOCKF_LOGICAL_LOCK}
LOCKF_PHYSICAL_LOCK = $01; // Bit 0 set - physical lock
{$EXTERNALSYM LOCKF_PHYSICAL_LOCK}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_NODISKSPACE
* lParam = drive number of drive that is out of disk space (1-based)
*
* Message issued by IFS manager when it detects that a drive is run out of
* free space.
*)
DBT_NO_DISK_SPACE = $0047;
{$EXTERNALSYM DBT_NO_DISK_SPACE}
(*
* Message = WM_DEVICECHANGE
* wParam = DBT_LOW_DISK_SPACE
* lParam = drive number of drive that is low on disk space (1-based)
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -