📄 jwawinioctl.pas
字号:
{******************************************************************************}
{ }
{ I/O Control Codes API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: winioctl.h, released June 2000. The original Pascal }
{ code is: WinIoCtl.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 JwaWinIoctl;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "WinIoCtl.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
JwaWinNT, JwaWinType;
//
// Device interface class GUIDs.
//
// need these GUIDs outside conditional includes so that user can
// #include <winioctl.h> in precompiled header
// #include <initguid.h> in a single source file
// #include <winioctl.h> in that source file a second time to instantiate the GUIDs
//
const
GUID_DEVINTERFACE_DISK: TGUID = (
D1:$53f56307; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_DISK}
GUID_DEVINTERFACE_CDROM: TGUID = (
D1:$53f56308; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_CDROM}
GUID_DEVINTERFACE_PARTITION: TGUID = (
D1:$53f5630a; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_PARTITION}
GUID_DEVINTERFACE_TAPE: TGUID = (
D1:$53f5630b; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_TAPE}
GUID_DEVINTERFACE_WRITEONCEDISK: TGUID = (
D1:$53f5630c; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_WRITEONCEDISK}
GUID_DEVINTERFACE_VOLUME: TGUID = (
D1:$53f5630d; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_VOLUME}
GUID_DEVINTERFACE_MEDIUMCHANGER: TGUID = (
D1:$53f56310; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_MEDIUMCHANGER}
GUID_DEVINTERFACE_FLOPPY: TGUID = (
D1:$53f56311; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_FLOPPY}
GUID_DEVINTERFACE_CDCHANGER: TGUID = (
D1:$53f56312; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_CDCHANGER}
GUID_DEVINTERFACE_STORAGEPORT: TGUID = (
D1:$2accfe60; D2:$c130; D3:$11d2; D4:($b0, $82, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM GUID_DEVINTERFACE_STORAGEPORT}
GUID_DEVINTERFACE_COMPORT: TGUID = (
D1:$86e0d1e0; D2:$8089; D3:$11d0; D4:($9c, $e4, $08, $00, $3e, $30, $1f, $73));
{$EXTERNALSYM GUID_DEVINTERFACE_COMPORT}
GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR: TGUID = (
D1:$4D36E978; D2:$E325; D3:$11CE; D4:($BF, $C1, $08, $00, $2B, $E1, $03, $18));
{$EXTERNALSYM GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR}
//
// Obsolete device interface class GUID names.
// (use of above GUID_DEVINTERFACE_* names is recommended).
//
// MVB: Note that these "constants" are in reality aliases for the list above. Unfortunately you can't
// define a GUID without using a type constant and you can't alias a type constant in Delphi...
DiskClassGuid: TGUID = (
D1:$53f56307; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM DiskClassGuid}
CdRomClassGuid: TGUID = (
D1:$53f56308; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM CdRomClassGuid}
PartitionClassGuid: TGUID = (
D1:$53f5630a; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM PartitionClassGuid}
TapeClassGuid: TGUID = (
D1:$53f5630b; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM TapeClassGuid}
WriteOnceDiskClassGuid: TGUID = (
D1:$53f5630c; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM WriteOnceDiskClassGuid}
VolumeClassGuid: TGUID = (
D1:$53f5630d; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM VolumeClassGuid}
MediumChangerClassGuid: TGUID = (
D1:$53f56310; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM MediumChangerClassGuid}
FloppyClassGuid: TGUID = (
D1:$53f56311; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM FloppyClassGuid}
CdChangerClassGuid: TGUID = (
D1:$53f56312; D2:$b6bf; D3:$11d0; D4:($94, $f2, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM CdChangerClassGuid}
StoragePortClassGuid: TGUID = (
D1:$2accfe60; D2:$c130; D3:$11d2; D4:($b0, $82, $00, $a0, $c9, $1e, $fb, $8b));
{$EXTERNALSYM StoragePortClassGuid}
GUID_CLASS_COMPORT: TGUID = (
D1:$86e0d1e0; D2:$8089; D3:$11d0; D4:($9c, $e4, $08, $00, $3e, $30, $1f, $73));
{$EXTERNALSYM GUID_CLASS_COMPORT}
GUID_SERENUM_BUS_ENUMERATOR: TGUID = (
D1:$4D36E978; D2:$E325; D3:$11CE; D4:($BF, $C1, $08, $00, $2B, $E1, $03, $18));
{$EXTERNALSYM GUID_SERENUM_BUS_ENUMERATOR}
//
// Define the various device type values. Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//
type
DEVICE_TYPE = DWORD;
{$EXTERNALSYM DEVICE_TYPE}
const
FILE_DEVICE_BEEP = $00000001;
{$EXTERNALSYM FILE_DEVICE_BEEP}
FILE_DEVICE_CD_ROM = $00000002;
{$EXTERNALSYM FILE_DEVICE_CD_ROM}
FILE_DEVICE_CD_ROM_FILE_SYSTEM = $00000003;
{$EXTERNALSYM FILE_DEVICE_CD_ROM_FILE_SYSTEM}
FILE_DEVICE_CONTROLLER = $00000004;
{$EXTERNALSYM FILE_DEVICE_CONTROLLER}
FILE_DEVICE_DATALINK = $00000005;
{$EXTERNALSYM FILE_DEVICE_DATALINK}
FILE_DEVICE_DFS = $00000006;
{$EXTERNALSYM FILE_DEVICE_DFS}
FILE_DEVICE_DISK = $00000007;
{$EXTERNALSYM FILE_DEVICE_DISK}
FILE_DEVICE_DISK_FILE_SYSTEM = $00000008;
{$EXTERNALSYM FILE_DEVICE_DISK_FILE_SYSTEM}
FILE_DEVICE_FILE_SYSTEM = $00000009;
{$EXTERNALSYM FILE_DEVICE_FILE_SYSTEM}
FILE_DEVICE_INPORT_PORT = $0000000a;
{$EXTERNALSYM FILE_DEVICE_INPORT_PORT}
FILE_DEVICE_KEYBOARD = $0000000b;
{$EXTERNALSYM FILE_DEVICE_KEYBOARD}
FILE_DEVICE_MAILSLOT = $0000000c;
{$EXTERNALSYM FILE_DEVICE_MAILSLOT}
FILE_DEVICE_MIDI_IN = $0000000d;
{$EXTERNALSYM FILE_DEVICE_MIDI_IN}
FILE_DEVICE_MIDI_OUT = $0000000e;
{$EXTERNALSYM FILE_DEVICE_MIDI_OUT}
FILE_DEVICE_MOUSE = $0000000f;
{$EXTERNALSYM FILE_DEVICE_MOUSE}
FILE_DEVICE_MULTI_UNC_PROVIDER = $00000010;
{$EXTERNALSYM FILE_DEVICE_MULTI_UNC_PROVIDER}
FILE_DEVICE_NAMED_PIPE = $00000011;
{$EXTERNALSYM FILE_DEVICE_NAMED_PIPE}
FILE_DEVICE_NETWORK = $00000012;
{$EXTERNALSYM FILE_DEVICE_NETWORK}
FILE_DEVICE_NETWORK_BROWSER = $00000013;
{$EXTERNALSYM FILE_DEVICE_NETWORK_BROWSER}
FILE_DEVICE_NETWORK_FILE_SYSTEM = $00000014;
{$EXTERNALSYM FILE_DEVICE_NETWORK_FILE_SYSTEM}
FILE_DEVICE_NULL = $00000015;
{$EXTERNALSYM FILE_DEVICE_NULL}
FILE_DEVICE_PARALLEL_PORT = $00000016;
{$EXTERNALSYM FILE_DEVICE_PARALLEL_PORT}
FILE_DEVICE_PHYSICAL_NETCARD = $00000017;
{$EXTERNALSYM FILE_DEVICE_PHYSICAL_NETCARD}
FILE_DEVICE_PRINTER = $00000018;
{$EXTERNALSYM FILE_DEVICE_PRINTER}
FILE_DEVICE_SCANNER = $00000019;
{$EXTERNALSYM FILE_DEVICE_SCANNER}
FILE_DEVICE_SERIAL_MOUSE_PORT = $0000001a;
{$EXTERNALSYM FILE_DEVICE_SERIAL_MOUSE_PORT}
FILE_DEVICE_SERIAL_PORT = $0000001b;
{$EXTERNALSYM FILE_DEVICE_SERIAL_PORT}
FILE_DEVICE_SCREEN = $0000001c;
{$EXTERNALSYM FILE_DEVICE_SCREEN}
FILE_DEVICE_SOUND = $0000001d;
{$EXTERNALSYM FILE_DEVICE_SOUND}
FILE_DEVICE_STREAMS = $0000001e;
{$EXTERNALSYM FILE_DEVICE_STREAMS}
FILE_DEVICE_TAPE = $0000001f;
{$EXTERNALSYM FILE_DEVICE_TAPE}
FILE_DEVICE_TAPE_FILE_SYSTEM = $00000020;
{$EXTERNALSYM FILE_DEVICE_TAPE_FILE_SYSTEM}
FILE_DEVICE_TRANSPORT = $00000021;
{$EXTERNALSYM FILE_DEVICE_TRANSPORT}
FILE_DEVICE_UNKNOWN = $00000022;
{$EXTERNALSYM FILE_DEVICE_UNKNOWN}
FILE_DEVICE_VIDEO = $00000023;
{$EXTERNALSYM FILE_DEVICE_VIDEO}
FILE_DEVICE_VIRTUAL_DISK = $00000024;
{$EXTERNALSYM FILE_DEVICE_VIRTUAL_DISK}
FILE_DEVICE_WAVE_IN = $00000025;
{$EXTERNALSYM FILE_DEVICE_WAVE_IN}
FILE_DEVICE_WAVE_OUT = $00000026;
{$EXTERNALSYM FILE_DEVICE_WAVE_OUT}
FILE_DEVICE_8042_PORT = $00000027;
{$EXTERNALSYM FILE_DEVICE_8042_PORT}
FILE_DEVICE_NETWORK_REDIRECTOR = $00000028;
{$EXTERNALSYM FILE_DEVICE_NETWORK_REDIRECTOR}
FILE_DEVICE_BATTERY = $00000029;
{$EXTERNALSYM FILE_DEVICE_BATTERY}
FILE_DEVICE_BUS_EXTENDER = $0000002a;
{$EXTERNALSYM FILE_DEVICE_BUS_EXTENDER}
FILE_DEVICE_MODEM = $0000002b;
{$EXTERNALSYM FILE_DEVICE_MODEM}
FILE_DEVICE_VDM = $0000002c;
{$EXTERNALSYM FILE_DEVICE_VDM}
FILE_DEVICE_MASS_STORAGE = $0000002d;
{$EXTERNALSYM FILE_DEVICE_MASS_STORAGE}
FILE_DEVICE_SMB = $0000002e;
{$EXTERNALSYM FILE_DEVICE_SMB}
FILE_DEVICE_KS = $0000002f;
{$EXTERNALSYM FILE_DEVICE_KS}
FILE_DEVICE_CHANGER = $00000030;
{$EXTERNALSYM FILE_DEVICE_CHANGER}
FILE_DEVICE_SMARTCARD = $00000031;
{$EXTERNALSYM FILE_DEVICE_SMARTCARD}
FILE_DEVICE_ACPI = $00000032;
{$EXTERNALSYM FILE_DEVICE_ACPI}
FILE_DEVICE_DVD = $00000033;
{$EXTERNALSYM FILE_DEVICE_DVD}
FILE_DEVICE_FULLSCREEN_VIDEO = $00000034;
{$EXTERNALSYM FILE_DEVICE_FULLSCREEN_VIDEO}
FILE_DEVICE_DFS_FILE_SYSTEM = $00000035;
{$EXTERNALSYM FILE_DEVICE_DFS_FILE_SYSTEM}
FILE_DEVICE_DFS_VOLUME = $00000036;
{$EXTERNALSYM FILE_DEVICE_DFS_VOLUME}
FILE_DEVICE_SERENUM = $00000037;
{$EXTERNALSYM FILE_DEVICE_SERENUM}
FILE_DEVICE_TERMSRV = $00000038;
{$EXTERNALSYM FILE_DEVICE_TERMSRV}
FILE_DEVICE_KSEC = $00000039;
{$EXTERNALSYM FILE_DEVICE_KSEC}
FILE_DEVICE_FIPS = $0000003A;
{$EXTERNALSYM FILE_DEVICE_FIPS}
FILE_DEVICE_INFINIBAND = $0000003B;
{$EXTERNALSYM FILE_DEVICE_INFINIBAND}
//
// Macro definition for defining IOCTL and FSCTL function control codes. Note
// that function codes 0-2047 are reserved for Microsoft Corporation, and
// 2048-4095 are reserved for customers.
//
function CTL_CODE(DeviceType, Func, Method, Access: WORD): DWORD;
{$EXTERNALSYM CTL_CODE}
//
// Macro to extract device type out of the device io control code
//
function DEVICE_TYPE_FROM_CTL_CODE(CtrlCode: DWORD): WORD;
{$EXTERNALSYM DEVICE_TYPE_FROM_CTL_CODE}
//
// Define the method codes for how buffers are passed for I/O and FS controls
//
const
METHOD_BUFFERED = 0;
{$EXTERNALSYM METHOD_BUFFERED}
METHOD_IN_DIRECT = 1;
{$EXTERNALSYM METHOD_IN_DIRECT}
METHOD_OUT_DIRECT = 2;
{$EXTERNALSYM METHOD_OUT_DIRECT}
METHOD_NEITHER = 3;
{$EXTERNALSYM METHOD_NEITHER}
//
// Define some easier to comprehend aliases:
// METHOD_DIRECT_TO_HARDWARE (writes, aka METHOD_IN_DIRECT)
// METHOD_DIRECT_FROM_HARDWARE (reads, aka METHOD_OUT_DIRECT)
//
METHOD_DIRECT_TO_HARDWARE = METHOD_OUT_DIRECT;
{$EXTERNALSYM METHOD_DIRECT_TO_HARDWARE}
METHOD_DIRECT_FROM_HARDWARE = METHOD_IN_DIRECT;
{$EXTERNALSYM METHOD_DIRECT_FROM_HARDWARE}
//
// Define the access check value for any access
//
//
// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
// constants *MUST* always be in sync.
//
//
// FILE_SPECIAL_ACCESS is checked by the NT I/O system the same as FILE_ANY_ACCESS.
// The file systems, however, may add additional access checks for I/O and FS controls
// that use this value.
//
const
FILE_ANY_ACCESS = 0;
{$EXTERNALSYM FILE_ANY_ACCESS}
FILE_SPECIAL_ACCESS = FILE_ANY_ACCESS;
{$EXTERNALSYM FILE_SPECIAL_ACCESS}
FILE_READ_ACCESS = $0001; // file & pipe
{$EXTERNALSYM FILE_READ_ACCESS}
FILE_WRITE_ACCESS = $0002; // file & pipe
{$EXTERNALSYM FILE_WRITE_ACCESS}
//
// IoControlCode values for storage devices
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -