mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3495 lines
80 KiB
3495 lines
80 KiB
/*++ BUILD Version: 0013 // Increment this if a change has global effects
|
|
|
|
Copyright (c) 1989 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
io.h
|
|
|
|
Abstract:
|
|
|
|
This module contains the internal structure definitions and APIs used by
|
|
the NT I/O system.
|
|
|
|
Author:
|
|
|
|
Darryl E. Havens (darrylh) 12-Apr-1989
|
|
|
|
|
|
Revision History:
|
|
|
|
|
|
--*/
|
|
|
|
#ifndef _IO_
|
|
#define _IO_
|
|
|
|
// begin_ntddk begin_nthal begin_ntifs
|
|
//
|
|
// Define I/O system data structure type codes. Each major data structure in
|
|
// the I/O system has a type code The type field in each structure is at the
|
|
// same offset. The following values can be used to determine which type of
|
|
// data structure a pointer refers to.
|
|
//
|
|
|
|
#define IO_TYPE_ADAPTER 0x00000001
|
|
#define IO_TYPE_CONTROLLER 0x00000002
|
|
#define IO_TYPE_DEVICE 0x00000003
|
|
#define IO_TYPE_DRIVER 0x00000004
|
|
#define IO_TYPE_FILE 0x00000005
|
|
#define IO_TYPE_IRP 0x00000006
|
|
#define IO_TYPE_MASTER_ADAPTER 0x00000007
|
|
#define IO_TYPE_OPEN_PACKET 0x00000008
|
|
#define IO_TYPE_TIMER 0x00000009
|
|
#define IO_TYPE_VPB 0x0000000a
|
|
#define IO_TYPE_ERROR_LOG 0x0000000b
|
|
#define IO_TYPE_ERROR_MESSAGE 0x0000000c
|
|
#define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0000000d
|
|
|
|
//
|
|
// Define the major function codes for IRPs. The lower 128 codes, from 0x00 to
|
|
// 0x7f are reserved to Microsoft. The upper 128 codes, from 0x80 to 0xff, are
|
|
// reserved to customers of Microsoft.
|
|
//
|
|
|
|
#define IRP_MJ_CREATE 0x00
|
|
#define IRP_MJ_CREATE_NAMED_PIPE 0x01
|
|
#define IRP_MJ_CLOSE 0x02
|
|
#define IRP_MJ_READ 0x03
|
|
#define IRP_MJ_WRITE 0x04
|
|
#define IRP_MJ_QUERY_INFORMATION 0x05
|
|
#define IRP_MJ_SET_INFORMATION 0x06
|
|
#define IRP_MJ_QUERY_EA 0x07
|
|
#define IRP_MJ_SET_EA 0x08
|
|
#define IRP_MJ_FLUSH_BUFFERS 0x09
|
|
#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
|
|
#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
|
|
#define IRP_MJ_DIRECTORY_CONTROL 0x0c
|
|
#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
|
|
#define IRP_MJ_DEVICE_CONTROL 0x0e
|
|
#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
|
|
#define IRP_MJ_SHUTDOWN 0x10
|
|
#define IRP_MJ_LOCK_CONTROL 0x11
|
|
#define IRP_MJ_CLEANUP 0x12
|
|
#define IRP_MJ_CREATE_MAILSLOT 0x13
|
|
#define IRP_MJ_QUERY_SECURITY 0x14
|
|
#define IRP_MJ_SET_SECURITY 0x15
|
|
#define IRP_MJ_QUERY_POWER 0x16
|
|
#define IRP_MJ_SET_POWER 0x17
|
|
#define IRP_MJ_DEVICE_CHANGE 0x18
|
|
#define IRP_MJ_QUERY_QUOTA 0x19
|
|
#define IRP_MJ_SET_QUOTA 0x1a
|
|
#define IRP_MJ_PNP_POWER 0x1b
|
|
#define IRP_MJ_MAXIMUM_FUNCTION 0x1b
|
|
|
|
//
|
|
// Make the Scsi major code the same as internal device control.
|
|
//
|
|
|
|
#define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL
|
|
|
|
//
|
|
// Define the minor function codes for IRPs. The lower 128 codes, from 0x00 to
|
|
// 0x7f are reserved to Microsoft. The upper 128 codes, from 0x80 to 0xff, are
|
|
// reserved to customers of Microsoft.
|
|
//
|
|
|
|
//
|
|
// Directory control minor function codes
|
|
//
|
|
|
|
#define IRP_MN_QUERY_DIRECTORY 0x01
|
|
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
|
|
#define IRP_MN_QUERY_OLE_DIRECTORY 0x03
|
|
|
|
//
|
|
// File system control minor function codes. Note that "user request" is
|
|
// assumed to be zero by both the I/O system and file systems. Do not change
|
|
// this value.
|
|
//
|
|
|
|
#define IRP_MN_USER_FS_REQUEST 0x00
|
|
#define IRP_MN_MOUNT_VOLUME 0x01
|
|
#define IRP_MN_VERIFY_VOLUME 0x02
|
|
#define IRP_MN_LOAD_FILE_SYSTEM 0x03
|
|
|
|
//
|
|
// Lock control minor function codes
|
|
//
|
|
|
|
#define IRP_MN_LOCK 0x01
|
|
#define IRP_MN_UNLOCK_SINGLE 0x02
|
|
#define IRP_MN_UNLOCK_ALL 0x03
|
|
#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
|
|
|
|
//
|
|
// Read and Write minor function codes for file systems supporting Lan Manager
|
|
// software. All of these subfunction codes are invalid if the file has been
|
|
// opened with FO_NO_INTERMEDIATE_BUFFERING. They are also invalid in combi-
|
|
// nation with synchronous calls (Irp Flag or file open option).
|
|
//
|
|
// Note that "normal" is assumed to be zero by both the I/O system and file
|
|
// systems. Do not change this value.
|
|
//
|
|
|
|
#define IRP_MN_NORMAL 0x00
|
|
#define IRP_MN_DPC 0x01
|
|
#define IRP_MN_MDL 0x02
|
|
#define IRP_MN_COMPLETE 0x04
|
|
#define IRP_MN_COMPRESSED 0x08
|
|
|
|
#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
|
|
#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
|
|
#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
|
|
|
|
//
|
|
// Device Control Request minor function codes for SCSI support. Note that
|
|
// user requests are assumed to be zero.
|
|
//
|
|
|
|
#define IRP_MN_SCSI_CLASS 0x01
|
|
|
|
//
|
|
// PNP/Power minor function codes.
|
|
//
|
|
|
|
#define IRP_MN_START_DEVICE 0x00
|
|
#define IRP_MN_QUERY_REMOVE_DEVICE 0x01
|
|
#define IRP_MN_REMOVE_DEVICE 0x02
|
|
#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
|
|
#define IRP_MN_STOP_DEVICE 0x04
|
|
#define IRP_MN_QUERY_STOP_DEVICE 0x05
|
|
#define IRP_MN_CANCEL_STOP_DEVICE 0x06
|
|
|
|
//
|
|
// Define option flags for IoCreateFile. Note that these values must be
|
|
// exactly the same as the SL_... flags for a create function. Note also
|
|
// that there are flags that may be passed to IoCreateFile that are not
|
|
// placed in the stack location for the create IRP. These flags start in
|
|
// the next byte.
|
|
//
|
|
|
|
#define IO_FORCE_ACCESS_CHECK 0x0001
|
|
#define IO_OPEN_PAGING_FILE 0x0002
|
|
#define IO_OPEN_TARGET_DIRECTORY 0x0004
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// Flags not passed to driver
|
|
//
|
|
|
|
#define IO_NO_PARAMETER_CHECKING 0x0100
|
|
#define IO_CHECK_CREATE_PARAMETERS 0x0200
|
|
#define IO_ATTACH_DEVICE 0x0400
|
|
|
|
//
|
|
// Define kernel-only, internal option flags
|
|
//
|
|
|
|
#define IO_ATTACH_DEVICE_API 0x80000000
|
|
|
|
//
|
|
// Define Information fields for whether or not a REPARSE or a REMOUNT has
|
|
// occurred in the file system.
|
|
//
|
|
|
|
#define IO_REPARSE 0x0
|
|
#define IO_REMOUNT 0x1
|
|
|
|
// end_ntifs
|
|
|
|
//
|
|
// Define the driver interfaces required to write memory dumps.
|
|
//
|
|
|
|
//
|
|
// Define stall routine type for the dump driver.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PSTALL_ROUTINE) (
|
|
IN ULONG Delay
|
|
);
|
|
|
|
//
|
|
// Define the interfaces for the dump driver's routines.
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PDUMP_DRIVER_OPEN) (
|
|
IN LARGE_INTEGER PartitionOffset
|
|
);
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PDUMP_DRIVER_WRITE) (
|
|
IN PLARGE_INTEGER DiskByteOffset,
|
|
IN PMDL Mdl
|
|
);
|
|
|
|
|
|
typedef
|
|
VOID
|
|
(*PDUMP_DRIVER_FINISH) (
|
|
VOID
|
|
);
|
|
|
|
struct _ADAPTER_OBJECT;
|
|
|
|
//
|
|
// This is the information passed from the system to the disk dump driver
|
|
// during the driver's initialization.
|
|
//
|
|
|
|
typedef struct _INITIALIZATION_CONTEXT {
|
|
ULONG Length;
|
|
ULONG DiskSignature;
|
|
PVOID MemoryBlock;
|
|
PVOID CommonBuffer[2];
|
|
PHYSICAL_ADDRESS PhysicalAddress[2];
|
|
PSTALL_ROUTINE StallRoutine;
|
|
PDUMP_DRIVER_OPEN OpenRoutine;
|
|
PDUMP_DRIVER_WRITE WriteRoutine;
|
|
PDUMP_DRIVER_FINISH FinishRoutine;
|
|
struct _ADAPTER_OBJECT *AdapterObject;
|
|
PVOID MappedRegisterBase;
|
|
PVOID PortConfiguration;
|
|
} INITIALIZATION_CONTEXT, *PINITIALIZATION_CONTEXT;
|
|
|
|
// begin_ntddk begin_ntifs
|
|
//
|
|
// Define callout routine type for use in IoQueryDeviceDescription().
|
|
//
|
|
|
|
typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(
|
|
IN PVOID Context,
|
|
IN PUNICODE_STRING PathName,
|
|
IN INTERFACE_TYPE BusType,
|
|
IN ULONG BusNumber,
|
|
IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
|
|
IN CONFIGURATION_TYPE ControllerType,
|
|
IN ULONG ControllerNumber,
|
|
IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
|
|
IN CONFIGURATION_TYPE PeripheralType,
|
|
IN ULONG PeripheralNumber,
|
|
IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
|
|
);
|
|
|
|
//
|
|
// Defines the order of the information in the array of
|
|
// PKEY_VALUE_FULL_INFORMATION.
|
|
//
|
|
|
|
typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
|
|
IoQueryDeviceIdentifier = 0,
|
|
IoQueryDeviceConfigurationData,
|
|
IoQueryDeviceComponentInformation,
|
|
IoQueryDeviceMaxData
|
|
} IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
|
|
|
|
//
|
|
// Define the objects that can be created by IoCreateFile.
|
|
//
|
|
|
|
typedef enum _CREATE_FILE_TYPE {
|
|
CreateFileTypeNone,
|
|
CreateFileTypeNamedPipe,
|
|
CreateFileTypeMailslot
|
|
} CREATE_FILE_TYPE;
|
|
|
|
// end_ntddk
|
|
|
|
//
|
|
// Define the named pipe create parameters structure used for internal calls
|
|
// to IoCreateFile when a named pipe is being created. This structure allows
|
|
// code invoking this routine to pass information specific to this function
|
|
// when creating a named pipe.
|
|
//
|
|
|
|
typedef struct _NAMED_PIPE_CREATE_PARAMETERS {
|
|
ULONG NamedPipeType;
|
|
ULONG ReadMode;
|
|
ULONG CompletionMode;
|
|
ULONG MaximumInstances;
|
|
ULONG InboundQuota;
|
|
ULONG OutboundQuota;
|
|
LARGE_INTEGER DefaultTimeout;
|
|
BOOLEAN TimeoutSpecified;
|
|
} NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS;
|
|
|
|
//
|
|
// Define the mailslot create parameters structure used for internal calls
|
|
// to IoCreateFile when a mailslot is being created. This structure allows
|
|
// code invoking this routine to pass information specific to this function
|
|
// when creating a mailslot.
|
|
//
|
|
|
|
typedef struct _MAILSLOT_CREATE_PARAMETERS {
|
|
ULONG MailslotQuota;
|
|
ULONG MaximumMessageSize;
|
|
LARGE_INTEGER ReadTimeout;
|
|
BOOLEAN TimeoutSpecified;
|
|
} MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS;
|
|
|
|
// begin_ntddk begin_nthal
|
|
//
|
|
// Define the structures used by the I/O system
|
|
//
|
|
|
|
//
|
|
// Define empty typedefs for the _IRP, _DEVICE_OBJECT, and _DRIVER_OBJECT
|
|
// structures so they may be referenced by function types before they are
|
|
// actually defined.
|
|
//
|
|
|
|
struct _DEVICE_OBJECT;
|
|
struct _DRIVER_OBJECT;
|
|
struct _DRIVE_LAYOUT_INFORMATION;
|
|
struct _DISK_PARTITION;
|
|
struct _FILE_OBJECT;
|
|
struct _IRP;
|
|
struct _SCSI_REQUEST_BLOCK;
|
|
|
|
//
|
|
// Define the I/O version of a DPC routine.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PIO_DPC_ROUTINE) (
|
|
IN PKDPC Dpc,
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN struct _IRP *Irp,
|
|
IN PVOID Context
|
|
);
|
|
|
|
//
|
|
// Define driver timer routine type.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PIO_TIMER_ROUTINE) (
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN PVOID Context
|
|
);
|
|
|
|
//
|
|
// Define driver initialization routine type.
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PDRIVER_INITIALIZE) (
|
|
IN struct _DRIVER_OBJECT *DriverObject,
|
|
IN PUNICODE_STRING RegistryPath
|
|
);
|
|
|
|
//
|
|
// Define driver reinitialization routine type.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PDRIVER_REINITIALIZE) (
|
|
IN struct _DRIVER_OBJECT *DriverObject,
|
|
IN PVOID Context,
|
|
IN ULONG Count
|
|
);
|
|
|
|
//
|
|
// Define driver cancel routine type.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PDRIVER_CANCEL) (
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN struct _IRP *Irp
|
|
);
|
|
|
|
//
|
|
// Define driver dispatch routine type.
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PDRIVER_DISPATCH) (
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN struct _IRP *Irp
|
|
);
|
|
|
|
//
|
|
// Define driver start I/O routine type.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PDRIVER_STARTIO) (
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN struct _IRP *Irp
|
|
);
|
|
|
|
//
|
|
// Define driver unload routine type.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PDRIVER_UNLOAD) (
|
|
IN struct _DRIVER_OBJECT *DriverObject
|
|
);
|
|
|
|
#ifdef _PNP_POWER_
|
|
|
|
//
|
|
// Define driver reconfiguration operations
|
|
//
|
|
|
|
typedef enum _DRIVER_RECONFIGURE_OPERATION {
|
|
QueryReconfigureResources,
|
|
ReconfigureResources,
|
|
CancelReconfigureQuery,
|
|
QueryHardwareProfileChange,
|
|
HardwareProfileChanged
|
|
} DRIVER_RECONFIGURE_OPERATION;
|
|
|
|
//
|
|
// Define driver ReconfigureDevice routine type
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PDRIVER_RECONFIGURE_DEVICE) (
|
|
IN struct _DRIVER_OBJECT *DriverObject,
|
|
IN struct _DEVICE_OBJECT *DeviceObject OPTIONAL,
|
|
IN DRIVER_RECONFIGURE_OPERATION Operation,
|
|
IN PCM_RESOURCE_LIST CmResources
|
|
);
|
|
|
|
#endif // _PNP_POWER_
|
|
|
|
//
|
|
// Define driver AddDevice routine type.
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PDRIVER_ADD_DEVICE) (
|
|
IN struct _DRIVER_OBJECT *DriverObject,
|
|
IN OUT struct _DEVICE_OBJECT **PhysicalDeviceObject
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// Define driver FS notification change routine type.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PDRIVER_FS_NOTIFICATION) (
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN BOOLEAN FsActive
|
|
);
|
|
|
|
// begin_ntddk
|
|
|
|
//
|
|
// Define fast I/O procedure prototypes.
|
|
//
|
|
// Fast I/O read and write procedures.
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_CHECK_IF_POSSIBLE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN BOOLEAN Wait,
|
|
IN ULONG LockKey,
|
|
IN BOOLEAN CheckForReadOperation,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_READ) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN BOOLEAN Wait,
|
|
IN ULONG LockKey,
|
|
OUT PVOID Buffer,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_WRITE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN BOOLEAN Wait,
|
|
IN ULONG LockKey,
|
|
IN PVOID Buffer,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// Fast I/O query basic and standard information procedures.
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_QUERY_BASIC_INFO) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN BOOLEAN Wait,
|
|
OUT PFILE_BASIC_INFORMATION Buffer,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_QUERY_STANDARD_INFO) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN BOOLEAN Wait,
|
|
OUT PFILE_STANDARD_INFORMATION Buffer,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// Fast I/O lock and unlock procedures.
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_LOCK) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN PLARGE_INTEGER Length,
|
|
PEPROCESS ProcessId,
|
|
ULONG Key,
|
|
BOOLEAN FailImmediately,
|
|
BOOLEAN ExclusiveLock,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_UNLOCK_SINGLE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN PLARGE_INTEGER Length,
|
|
PEPROCESS ProcessId,
|
|
ULONG Key,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_UNLOCK_ALL) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
PEPROCESS ProcessId,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_UNLOCK_ALL_BY_KEY) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
PVOID ProcessId,
|
|
ULONG Key,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// Fast I/O device control procedure.
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_DEVICE_CONTROL) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN BOOLEAN Wait,
|
|
IN PVOID InputBuffer OPTIONAL,
|
|
IN ULONG InputBufferLength,
|
|
OUT PVOID OutputBuffer OPTIONAL,
|
|
IN ULONG OutputBufferLength,
|
|
IN ULONG IoControlCode,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// Define callbacks for NtCreateSection to synchronize correctly with
|
|
// the file system. It pre-acquires the resources that will be needed
|
|
// when calling to query and set file/allocation size in the file system.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PFAST_IO_ACQUIRE_FILE) (
|
|
IN struct _FILE_OBJECT *FileObject
|
|
);
|
|
|
|
typedef
|
|
VOID
|
|
(*PFAST_IO_RELEASE_FILE) (
|
|
IN struct _FILE_OBJECT *FileObject
|
|
);
|
|
|
|
//
|
|
// Define callback for drivers that have device objects attached to lower-
|
|
// level drivers' device objects. This callback is made when the lower-level
|
|
// driver is deleting its device object.
|
|
//
|
|
|
|
typedef
|
|
VOID
|
|
(*PFAST_IO_DETACH_DEVICE) (
|
|
IN struct _DEVICE_OBJECT *SourceDevice,
|
|
IN struct _DEVICE_OBJECT *TargetDevice
|
|
);
|
|
|
|
//
|
|
// This structure is used by the server to quickly get the information needed
|
|
// to service a server open call. It is takes what would be two fast io calls
|
|
// one for basic information and the other for standard information and makes
|
|
// it into one call.
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_QUERY_NETWORK_OPEN_INFO) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN BOOLEAN Wait,
|
|
OUT struct _FILE_NETWORK_OPEN_INFORMATION *Buffer,
|
|
OUT struct _IO_STATUS_BLOCK *IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// Define Mdl-based routines for the server to call
|
|
//
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_MDL_READ) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN ULONG LockKey,
|
|
OUT PMDL *MdlChain,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_MDL_READ_COMPLETE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PMDL MdlChain,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_PREPARE_MDL_WRITE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN ULONG LockKey,
|
|
OUT PMDL *MdlChain,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_MDL_WRITE_COMPLETE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN PMDL MdlChain,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// If this routine is present, it will be called by FsRtl
|
|
// to acquire the file for the mapped page writer.
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PFAST_IO_ACQUIRE_FOR_MOD_WRITE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER EndingOffset,
|
|
OUT struct _ERESOURCE **ResourceToRelease,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PFAST_IO_RELEASE_FOR_MOD_WRITE) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN struct _ERESOURCE *ResourceToRelease,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// If this routine is present, it will be called by FsRtl
|
|
// to acquire the file for the mapped page writer.
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PFAST_IO_ACQUIRE_FOR_CCFLUSH) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PFAST_IO_RELEASE_FOR_CCFLUSH) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_READ_COMPRESSED) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN ULONG LockKey,
|
|
OUT PVOID Buffer,
|
|
OUT PMDL *MdlChain,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
|
|
IN ULONG CompressedDataInfoLength,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_WRITE_COMPRESSED) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN ULONG Length,
|
|
IN ULONG LockKey,
|
|
IN PVOID Buffer,
|
|
OUT PMDL *MdlChain,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
IN struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
|
|
IN ULONG CompressedDataInfoLength,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PMDL MdlChain,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED) (
|
|
IN struct _FILE_OBJECT *FileObject,
|
|
IN PLARGE_INTEGER FileOffset,
|
|
IN PMDL MdlChain,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
typedef
|
|
BOOLEAN
|
|
(*PFAST_IO_QUERY_OPEN) (
|
|
IN struct _IRP *Irp,
|
|
OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
|
|
IN struct _DEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
//
|
|
// Define the structure to describe the Fast I/O dispatch routines. Any
|
|
// additions made to this structure MUST be added monotonically to the end
|
|
// of the structure, and fields CANNOT be removed from the middle.
|
|
//
|
|
|
|
typedef struct _FAST_IO_DISPATCH {
|
|
ULONG SizeOfFastIoDispatch;
|
|
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
|
|
PFAST_IO_READ FastIoRead;
|
|
PFAST_IO_WRITE FastIoWrite;
|
|
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
|
|
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
|
|
PFAST_IO_LOCK FastIoLock;
|
|
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
|
|
PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
|
|
PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
|
|
PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
|
|
PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
|
|
PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
|
|
PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
|
|
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
|
|
PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
|
|
PFAST_IO_MDL_READ MdlRead;
|
|
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
|
|
PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
|
|
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
|
|
PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
|
|
PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
|
|
PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
|
|
PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
|
|
PFAST_IO_QUERY_OPEN FastIoQueryOpen;
|
|
PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
|
|
PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
|
|
PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
|
|
} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
|
|
|
|
// end_ntddk
|
|
|
|
// begin_ntddk begin_nthal
|
|
//
|
|
// Define the actions that a driver execution routine may request of the
|
|
// adapter/controller allocation routines upon return.
|
|
//
|
|
|
|
typedef enum _IO_ALLOCATION_ACTION {
|
|
KeepObject = 1,
|
|
DeallocateObject,
|
|
DeallocateObjectKeepRegisters
|
|
} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
|
|
|
|
//
|
|
// Define device driver adapter/controller execution routine.
|
|
//
|
|
|
|
typedef
|
|
IO_ALLOCATION_ACTION
|
|
(*PDRIVER_CONTROL) (
|
|
IN struct _DEVICE_OBJECT *DeviceObject,
|
|
IN struct _IRP *Irp,
|
|
IN PVOID MapRegisterBase,
|
|
IN PVOID Context
|
|
);
|
|
|
|
// end_ntddk end_nthal end_ntifs
|
|
|
|
//
|
|
// Define the I/O system's structure for a connected interrupt. This is
|
|
// useful for connecting an ISR to several different processors.
|
|
//
|
|
|
|
typedef struct _IO_INTERRUPT_STRUCTURE {
|
|
KINTERRUPT InterruptObject;
|
|
PKINTERRUPT InterruptArray[MAXIMUM_PROCESSORS];
|
|
KSPIN_LOCK SpinLock;
|
|
} IO_INTERRUPT_STRUCTURE, *PIO_INTERRUPT_STRUCTURE;
|
|
|
|
// begin_ntddk begin_ntifs
|
|
//
|
|
// Define the I/O system's security context type for use by file system's
|
|
// when checking access to volumes, files, and directories.
|
|
//
|
|
|
|
typedef struct _IO_SECURITY_CONTEXT {
|
|
PSECURITY_QUALITY_OF_SERVICE SecurityQos;
|
|
PACCESS_STATE AccessState;
|
|
ACCESS_MASK DesiredAccess;
|
|
ULONG FullCreateOptions;
|
|
} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
|
|
|
|
// end_ntddk end_ntifs
|
|
|
|
//
|
|
// Define the I/O system's version of a timer.
|
|
//
|
|
|
|
typedef struct _IO_TIMER {
|
|
CSHORT Type;
|
|
CSHORT TimerFlag;
|
|
LIST_ENTRY TimerList;
|
|
PIO_TIMER_ROUTINE TimerRoutine;
|
|
PVOID Context;
|
|
struct _DEVICE_OBJECT *DeviceObject;
|
|
} IO_TIMER, *PIO_TIMER;
|
|
|
|
// begin_ntddk begin_nthal begin_ntifs
|
|
//
|
|
// Define Volume Parameter Block (VPB) flags.
|
|
//
|
|
|
|
#define VPB_MOUNTED 0x00000001
|
|
#define VPB_LOCKED 0x00000002
|
|
#define VPB_PERSISTENT 0x00000004
|
|
|
|
//
|
|
// Volume Parameter Block (VPB)
|
|
//
|
|
|
|
#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR)) // 32 characters
|
|
|
|
typedef struct _VPB {
|
|
CSHORT Type;
|
|
CSHORT Size;
|
|
USHORT Flags;
|
|
USHORT VolumeLabelLength; // in bytes
|
|
struct _DEVICE_OBJECT *DeviceObject;
|
|
struct _DEVICE_OBJECT *RealDevice;
|
|
ULONG SerialNumber;
|
|
ULONG ReferenceCount;
|
|
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
|
|
} VPB, *PVPB;
|
|
|
|
//
|
|
// Define object type specific fields of various objects used by the I/O system
|
|
//
|
|
|
|
typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; // ntndis
|
|
|
|
//
|
|
// Define Wait Context Block (WCB)
|
|
//
|
|
|
|
typedef struct _WAIT_CONTEXT_BLOCK {
|
|
KDEVICE_QUEUE_ENTRY WaitQueueEntry;
|
|
PDRIVER_CONTROL DeviceRoutine;
|
|
PVOID DeviceContext;
|
|
ULONG NumberOfMapRegisters;
|
|
PVOID DeviceObject;
|
|
PVOID CurrentIrp;
|
|
PKDPC BufferChainingDpc;
|
|
} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
|
|
|
|
typedef struct _CONTROLLER_OBJECT {
|
|
CSHORT Type;
|
|
CSHORT Size;
|
|
PVOID ControllerExtension;
|
|
KDEVICE_QUEUE DeviceWaitQueue;
|
|
|
|
ULONG Spare1;
|
|
LARGE_INTEGER Spare2;
|
|
|
|
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
|
|
|
|
|
|
//
|
|
// Define Device Object (DO) flags
|
|
//
|
|
|
|
#define DO_VERIFY_VOLUME 0x00000002
|
|
#define DO_BUFFERED_IO 0x00000004
|
|
#define DO_EXCLUSIVE 0x00000008
|
|
#define DO_DIRECT_IO 0x00000010
|
|
#define DO_MAP_IO_BUFFER 0x00000020
|
|
#define DO_DEVICE_HAS_NAME 0x00000040
|
|
#define DO_DEVICE_INITIALIZING 0x00000080
|
|
#define DO_SYSTEM_BOOT_PARTITION 0x00000100
|
|
#define DO_LONG_TERM_REQUESTS 0x00000200
|
|
#define DO_NEVER_LAST_DEVICE 0x00000400
|
|
#define DO_SHUTDOWN_REGISTERED 0x00000800
|
|
|
|
//
|
|
// Device Object structure definition
|
|
//
|
|
|
|
typedef struct _DEVICE_OBJECT {
|
|
CSHORT Type;
|
|
USHORT Size;
|
|
LONG ReferenceCount;
|
|
struct _DRIVER_OBJECT *DriverObject;
|
|
struct _DEVICE_OBJECT *NextDevice;
|
|
struct _DEVICE_OBJECT *AttachedDevice;
|
|
struct _IRP *CurrentIrp;
|
|
PIO_TIMER Timer;
|
|
ULONG Flags; // See above: DO_...
|
|
ULONG Characteristics; // See ntioapi: FILE_...
|
|
PVPB Vpb;
|
|
PVOID DeviceExtension;
|
|
DEVICE_TYPE DeviceType;
|
|
CCHAR StackSize;
|
|
union {
|
|
LIST_ENTRY ListEntry;
|
|
WAIT_CONTEXT_BLOCK Wcb;
|
|
} Queue;
|
|
ULONG AlignmentRequirement;
|
|
KDEVICE_QUEUE DeviceQueue;
|
|
KDPC Dpc;
|
|
|
|
//
|
|
// The following field is for exclusive use by the filesystem to keep
|
|
// track of the number of Fsp threads currently using the device
|
|
//
|
|
|
|
ULONG ActiveThreadCount;
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
|
KEVENT DeviceLock;
|
|
|
|
USHORT SectorSize;
|
|
USHORT Spare1;
|
|
|
|
struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
|
|
PVOID Reserved;
|
|
} DEVICE_OBJECT;
|
|
typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT; // ntndis
|
|
|
|
|
|
//
|
|
// Define the Device Object Extension Flags
|
|
//
|
|
|
|
#define DOE_UNLOAD_PENDING 0x00000001
|
|
#define DOE_DELETE_PENDING 0x00000002
|
|
|
|
typedef struct _DEVOBJ_EXTENSION {
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
CSHORT Type;
|
|
USHORT Size;
|
|
|
|
//
|
|
// Public part of the DeviceObjectExtension structure
|
|
//
|
|
|
|
PDEVICE_OBJECT DeviceObject; // owning device object
|
|
|
|
#ifdef _PNP_POWER_
|
|
|
|
//
|
|
// Shared Power Management fields
|
|
//
|
|
|
|
ULONG IdleCount; // SHARED field via PoSetDeviceBusy()
|
|
POWER_STATE CurrentPowerState;
|
|
ULONG CurrentDevicePowerState;
|
|
BOOLEAN StartIoQueueHolding; // PO & IO
|
|
BOOLEAN UseAsyncPowerUp;
|
|
BOOLEAN PowerControlNeeded;
|
|
BOOLEAN PowerControlPagable;
|
|
|
|
//
|
|
// Note: any new shared fields get added here.
|
|
//
|
|
|
|
|
|
// end_ntddk end_nthal end_ntifs
|
|
|
|
//
|
|
// Internal fields for the DeviceObjectExtension. These fields
|
|
// are not exported outside the system and no driver or filesystem
|
|
// will touch them.
|
|
//
|
|
|
|
//
|
|
// Internal Power Management fields
|
|
//
|
|
|
|
// holding queue for StartIO
|
|
KDEVICE_QUEUE DeviceHoldingQueue;
|
|
|
|
// power state information
|
|
LIST_ENTRY PowerStateChange;
|
|
POWER_STATE PendingPowerState;
|
|
ULONG PendingDevicePowerState;
|
|
BOOLEAN SetPowerUpPending;
|
|
struct _IRP *CurrentSetPowerIrp; // shared between PO & IO
|
|
|
|
// suspend/hibernate
|
|
LIST_ENTRY AllDeviceObjects;
|
|
BOOLEAN Suspending;
|
|
|
|
// idle state information
|
|
LIST_ENTRY IdleList;
|
|
ULONG MaxIdleCount;
|
|
|
|
// begin_ntddk begin_nthal begin_ntifs
|
|
|
|
#endif // _PNP_POWER_
|
|
|
|
//
|
|
// Device object extension flags. Protected by the IopDatabaseLock.
|
|
//
|
|
|
|
ULONG ExtensionFlags;
|
|
|
|
} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
|
|
|
|
//
|
|
// Define Driver Object (DRVO) flags
|
|
//
|
|
|
|
#define DRVO_UNLOAD_INVOKED 0x00000001
|
|
|
|
typedef struct _DRIVER_EXTENSION {
|
|
|
|
//
|
|
// Back pointer to Driver Object
|
|
//
|
|
|
|
struct _DRIVER_OBJECT *DriverObject;
|
|
|
|
//
|
|
// The AddDevice entry point is called by the Plug & Play manager
|
|
// to inform the driver when a new device instance arrives that this
|
|
// driver must control.
|
|
//
|
|
|
|
PDRIVER_ADD_DEVICE AddDevice;
|
|
|
|
//
|
|
// The count field is used to count the number of times the driver has
|
|
// had its registered reinitialization routine invoked.
|
|
//
|
|
|
|
ULONG Count;
|
|
|
|
//
|
|
// The service name field is used by the pnp manager to determine
|
|
// where the driver related info is stored in the registry.
|
|
//
|
|
|
|
UNICODE_STRING ServiceKeyName;
|
|
|
|
} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
|
|
|
|
typedef struct _DRIVER_OBJECT {
|
|
CSHORT Type;
|
|
CSHORT Size;
|
|
|
|
//
|
|
// The following links all of the devices created by a single driver
|
|
// together on a list, and the Flags word provides an extensible flag
|
|
// location for driver objects.
|
|
//
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
ULONG Flags;
|
|
|
|
//
|
|
// The following section describes where the driver is loaded. The count
|
|
// field is used to count the number of times the driver has had its
|
|
// registered reinitialization routine invoked.
|
|
//
|
|
|
|
PVOID DriverStart;
|
|
ULONG DriverSize;
|
|
PVOID DriverSection;
|
|
PDRIVER_EXTENSION DriverExtension;
|
|
|
|
//
|
|
// The driver name field is used by the error log thread
|
|
// determine the name of the driver that an I/O request is/was bound.
|
|
//
|
|
|
|
UNICODE_STRING DriverName;
|
|
|
|
//
|
|
// The following section is for registry support. Thise is a pointer
|
|
// to the path to the hardware information in the registry
|
|
//
|
|
|
|
PUNICODE_STRING HardwareDatabase;
|
|
|
|
//
|
|
// The following section contains the optional pointer to an array of
|
|
// alternate entry points to a driver for "fast I/O" support. Fast I/O
|
|
// is performed by invoking the driver routine directly with separate
|
|
// parameters, rather than using the standard IRP call mechanism. Note
|
|
// that these functions may only be used for synchronous I/O, and when
|
|
// the file is cached.
|
|
//
|
|
|
|
PFAST_IO_DISPATCH FastIoDispatch;
|
|
|
|
//
|
|
// The following section describes the entry points to this particular
|
|
// driver. Note that the major function dispatch table must be the last
|
|
// field in the object so that it remains extensible.
|
|
//
|
|
|
|
PDRIVER_INITIALIZE DriverInit;
|
|
PDRIVER_STARTIO DriverStartIo;
|
|
PDRIVER_UNLOAD DriverUnload;
|
|
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
|
|
|
|
} DRIVER_OBJECT;
|
|
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; // ntndis
|
|
|
|
|
|
// end_ntddk end_ntifs
|
|
|
|
//
|
|
// Device Handler Object. There is one of these objects per PnP
|
|
// device. This object is given to the device driver as a PVOID
|
|
// and is used by the driver to refer to a particular device.
|
|
//
|
|
|
|
typedef struct _DEVICE_HANDLER_OBJECT {
|
|
CSHORT Type;
|
|
USHORT Size;
|
|
|
|
//
|
|
// Indentifies which bus extender this device handler
|
|
// object is associated with
|
|
//
|
|
|
|
struct _BUS_HANDLER *BusHandler;
|
|
|
|
//
|
|
// The associated SlotNumber for this device handler
|
|
//
|
|
|
|
ULONG SlotNumber;
|
|
|
|
// end_nthal
|
|
|
|
//
|
|
// System internal fields
|
|
//
|
|
|
|
//
|
|
// Pnp stuff
|
|
//
|
|
|
|
UNICODE_STRING ServiceKeyName;
|
|
ULONG InstanceOrdinal;
|
|
|
|
// begin_nthal
|
|
|
|
|
|
} DEVICE_HANDLER_OBJECT, *PDEVICE_HANDLER_OBJECT;
|
|
|
|
// begin_ntddk begin_ntifs
|
|
|
|
//
|
|
// The following structure is pointed to by the SectionObject pointer field
|
|
// of a file object, and is allocated by the various NT file systems.
|
|
//
|
|
|
|
typedef struct _SECTION_OBJECT_POINTERS {
|
|
PVOID DataSectionObject;
|
|
PVOID SharedCacheMap;
|
|
PVOID ImageSectionObject;
|
|
} SECTION_OBJECT_POINTERS;
|
|
typedef SECTION_OBJECT_POINTERS *PSECTION_OBJECT_POINTERS;
|
|
|
|
//
|
|
// Define the format of a completion message.
|
|
//
|
|
|
|
typedef struct _IO_COMPLETION_CONTEXT {
|
|
PVOID Port;
|
|
ULONG Key;
|
|
} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
|
|
|
|
//
|
|
// Define File Object (FO) flags
|
|
//
|
|
|
|
#define FO_FILE_OPEN 0x00000001
|
|
#define FO_SYNCHRONOUS_IO 0x00000002
|
|
#define FO_ALERTABLE_IO 0x00000004
|
|
#define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
|
|
#define FO_WRITE_THROUGH 0x00000010
|
|
#define FO_SEQUENTIAL_ONLY 0x00000020
|
|
#define FO_CACHE_SUPPORTED 0x00000040
|
|
#define FO_NAMED_PIPE 0x00000080
|
|
#define FO_STREAM_FILE 0x00000100
|
|
#define FO_MAILSLOT 0x00000200
|
|
#define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
|
|
#define FO_DIRECT_DEVICE_OPEN 0x00000800
|
|
#define FO_FILE_MODIFIED 0x00001000
|
|
#define FO_FILE_SIZE_CHANGED 0x00002000
|
|
#define FO_CLEANUP_COMPLETE 0x00004000
|
|
#define FO_TEMPORARY_FILE 0x00008000
|
|
#define FO_DELETE_ON_CLOSE 0x00010000
|
|
#define FO_OPENED_CASE_SENSITIVE 0x00020000
|
|
#define FO_HANDLE_CREATED 0x00040000
|
|
#define FO_FILE_FAST_IO_READ 0x00080000
|
|
#define FO_FILE_OLE_ACCESS 0x00100000
|
|
|
|
typedef struct _FILE_OBJECT {
|
|
CSHORT Type;
|
|
CSHORT Size;
|
|
PDEVICE_OBJECT DeviceObject;
|
|
PVPB Vpb;
|
|
PVOID FsContext;
|
|
PVOID FsContext2;
|
|
PSECTION_OBJECT_POINTERS SectionObjectPointer;
|
|
PVOID PrivateCacheMap;
|
|
NTSTATUS FinalStatus;
|
|
struct _FILE_OBJECT *RelatedFileObject;
|
|
BOOLEAN LockOperation;
|
|
BOOLEAN DeletePending;
|
|
BOOLEAN ReadAccess;
|
|
BOOLEAN WriteAccess;
|
|
BOOLEAN DeleteAccess;
|
|
BOOLEAN SharedRead;
|
|
BOOLEAN SharedWrite;
|
|
BOOLEAN SharedDelete;
|
|
ULONG Flags;
|
|
UNICODE_STRING FileName;
|
|
LARGE_INTEGER CurrentByteOffset;
|
|
ULONG Waiters;
|
|
ULONG Busy;
|
|
PVOID LastLock;
|
|
KEVENT Lock;
|
|
KEVENT Event;
|
|
PIO_COMPLETION_CONTEXT CompletionContext;
|
|
} FILE_OBJECT;
|
|
typedef struct _FILE_OBJECT *PFILE_OBJECT; // ntndis
|
|
|
|
//
|
|
// Define I/O Request Packet (IRP) flags
|
|
//
|
|
|
|
#define IRP_NOCACHE 0x00000001
|
|
#define IRP_PAGING_IO 0x00000002
|
|
#define IRP_MOUNT_COMPLETION 0x00000002
|
|
#define IRP_SYNCHRONOUS_API 0x00000004
|
|
#define IRP_ASSOCIATED_IRP 0x00000008
|
|
#define IRP_BUFFERED_IO 0x00000010
|
|
#define IRP_DEALLOCATE_BUFFER 0x00000020
|
|
#define IRP_INPUT_OPERATION 0x00000040
|
|
#define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
|
|
#define IRP_CREATE_OPERATION 0x00000080
|
|
#define IRP_READ_OPERATION 0x00000100
|
|
#define IRP_WRITE_OPERATION 0x00000200
|
|
#define IRP_CLOSE_OPERATION 0x00000400
|
|
#define IRP_DEFER_IO_COMPLETION 0x00000800
|
|
#define IRP_OB_QUERY_NAME 0x00001000
|
|
#define IRP_HOLD_DEVICE_QUEUE 0x00002000
|
|
|
|
//
|
|
// Define I/O request packet (IRP) alternate flags for allocation control.
|
|
//
|
|
|
|
#define IRP_QUOTA_CHARGED 0x01
|
|
#define IRP_ALLOCATED_MUST_SUCCEED 0x02
|
|
#define IRP_ALLOCATED_FIXED_SIZE 0x04
|
|
|
|
//
|
|
// I/O Request Packet (IRP) definition
|
|
//
|
|
|
|
typedef struct _IRP {
|
|
CSHORT Type;
|
|
USHORT Size;
|
|
|
|
//
|
|
// Define the common fields used to control the IRP.
|
|
//
|
|
|
|
//
|
|
// Define a pointer to the Memory Descriptor List (MDL) for this I/O
|
|
// request. This field is only used if the I/O is "direct I/O".
|
|
//
|
|
|
|
PMDL MdlAddress;
|
|
|
|
//
|
|
// Flags word - used to remember various flags.
|
|
//
|
|
|
|
ULONG Flags;
|
|
|
|
//
|
|
// The following union is used for one of three purposes:
|
|
//
|
|
// 1. This IRP is an associated IRP. The field is a pointer to a master
|
|
// IRP.
|
|
//
|
|
// 2. This is the master IRP. The field is the count of the number of
|
|
// IRPs which must complete (associated IRPs) before the master can
|
|
// complete.
|
|
//
|
|
// 3. This operation is being buffered and the field is the address of
|
|
// the system space buffer.
|
|
//
|
|
|
|
union {
|
|
struct _IRP *MasterIrp;
|
|
LONG IrpCount;
|
|
PVOID SystemBuffer;
|
|
} AssociatedIrp;
|
|
|
|
//
|
|
// Thread list entry - allows queueing the IRP to the thread pending I/O
|
|
// request packet list.
|
|
//
|
|
|
|
LIST_ENTRY ThreadListEntry;
|
|
|
|
//
|
|
// I/O status - final status of operation.
|
|
//
|
|
|
|
IO_STATUS_BLOCK IoStatus;
|
|
|
|
//
|
|
// Requestor mode - mode of the original requestor of this operation.
|
|
//
|
|
|
|
KPROCESSOR_MODE RequestorMode;
|
|
|
|
//
|
|
// Pending returned - TRUE if pending was initially returned as the
|
|
// status for this packet.
|
|
//
|
|
|
|
BOOLEAN PendingReturned;
|
|
|
|
//
|
|
// Stack state information.
|
|
//
|
|
|
|
CHAR StackCount;
|
|
CHAR CurrentLocation;
|
|
|
|
//
|
|
// Cancel - packet has been canceled.
|
|
//
|
|
|
|
BOOLEAN Cancel;
|
|
|
|
//
|
|
// Cancel Irql - Irql at which the cancel spinlock was acquired.
|
|
//
|
|
|
|
KIRQL CancelIrql;
|
|
|
|
//
|
|
// ApcEnvironment - Used to save the APC environment at the time that the
|
|
// packet was initialized.
|
|
//
|
|
|
|
CCHAR ApcEnvironment;
|
|
|
|
//
|
|
// Allocation control flags.
|
|
//
|
|
|
|
UCHAR AllocationFlags;
|
|
|
|
//
|
|
// User parameters.
|
|
//
|
|
|
|
PIO_STATUS_BLOCK UserIosb;
|
|
PKEVENT UserEvent;
|
|
union {
|
|
struct {
|
|
PIO_APC_ROUTINE UserApcRoutine;
|
|
PVOID UserApcContext;
|
|
} AsynchronousParameters;
|
|
LARGE_INTEGER AllocationSize;
|
|
} Overlay;
|
|
|
|
//
|
|
// CancelRoutine - Used to contain the address of a cancel routine supplied
|
|
// by a device driver when the IRP is in a cancelable state.
|
|
//
|
|
|
|
PDRIVER_CANCEL CancelRoutine;
|
|
|
|
//
|
|
// Note that the UserBuffer parameter is outside of the stack so that I/O
|
|
// completion can copy data back into the user's address space without
|
|
// having to know exactly which service was being invoked. The length
|
|
// of the copy is stored in the second half of the I/O status block. If
|
|
// the UserBuffer field is NULL, then no copy is performed.
|
|
//
|
|
|
|
PVOID UserBuffer;
|
|
|
|
//
|
|
// Kernel structures
|
|
//
|
|
// The following section contains kernel structures which the IRP needs
|
|
// in order to place various work information in kernel controller system
|
|
// queues. Because the size and alignment cannot be controlled, they are
|
|
// placed here at the end so they just hang off and do not affect the
|
|
// alignment of other fields in the IRP.
|
|
//
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
union {
|
|
|
|
//
|
|
// DeviceQueueEntry - The device queue entry field is used to
|
|
// queue the IRP to the device driver device queue.
|
|
//
|
|
|
|
KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
|
|
|
|
struct {
|
|
|
|
//
|
|
// The following are available to the driver to use in
|
|
// whatever manner is desired, while the driver owns the
|
|
// packet.
|
|
//
|
|
|
|
PVOID DriverContext[4];
|
|
|
|
} ;
|
|
|
|
} ;
|
|
|
|
//
|
|
// Thread - pointer to caller's Thread Control Block.
|
|
//
|
|
|
|
PETHREAD Thread;
|
|
|
|
//
|
|
// Auxiliary buffer - pointer to any auxiliary buffer that is
|
|
// required to pass information to a driver that is not contained
|
|
// in a normal buffer.
|
|
//
|
|
|
|
PCHAR AuxiliaryBuffer;
|
|
|
|
//
|
|
// List entry - used to queue the packet to completion queue, among
|
|
// others.
|
|
//
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
//
|
|
// Current stack location - contains a pointer to the current
|
|
// IO_STACK_LOCATION structure in the IRP stack. This field
|
|
// should never be directly accessed by drivers. They should
|
|
// use the standard functions.
|
|
//
|
|
|
|
struct _IO_STACK_LOCATION *CurrentStackLocation;
|
|
|
|
//
|
|
// Original file object - pointer to the original file object
|
|
// that was used to open the file. This field is owned by the
|
|
// I/O system and should not be used by any other drivers.
|
|
//
|
|
|
|
PFILE_OBJECT OriginalFileObject;
|
|
|
|
} Overlay;
|
|
|
|
//
|
|
// APC - This APC control block is used for the special kernel APC as
|
|
// well as for the caller's APC, if one was specified in the original
|
|
// argument list. If so, then the APC is reused for the normal APC for
|
|
// whatever mode the caller was in and the "special" routine that is
|
|
// invoked before the APC gets control simply deallocates the IRP.
|
|
//
|
|
|
|
KAPC Apc;
|
|
|
|
//
|
|
// CompletionKey - This is the key that is used to distinguish
|
|
// individual I/O operations initiated on a single file handle.
|
|
//
|
|
|
|
ULONG CompletionKey;
|
|
|
|
} Tail;
|
|
|
|
} IRP, *PIRP;
|
|
|
|
//
|
|
// Define completion routine types for use in stack locations in an IRP
|
|
//
|
|
|
|
typedef
|
|
NTSTATUS
|
|
(*PIO_COMPLETION_ROUTINE) (
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN PIRP Irp,
|
|
IN PVOID Context
|
|
);
|
|
|
|
//
|
|
// Define stack location control flags
|
|
//
|
|
|
|
#define SL_PENDING_RETURNED 0x01
|
|
#define SL_INVOKE_ON_CANCEL 0x20
|
|
#define SL_INVOKE_ON_SUCCESS 0x40
|
|
#define SL_INVOKE_ON_ERROR 0x80
|
|
|
|
//
|
|
// Define flags for various functions
|
|
//
|
|
|
|
//
|
|
// Create / Create Named Pipe
|
|
//
|
|
// The following flags must exactly match those in the IoCreateFile call's
|
|
// options. The case sensitive flag is added in later, by the parse routine,
|
|
// and is not an actual option to open. Rather, it is part of the object
|
|
// manager's attributes structure.
|
|
//
|
|
|
|
#define SL_FORCE_ACCESS_CHECK 0x01
|
|
#define SL_OPEN_PAGING_FILE 0x02
|
|
#define SL_OPEN_TARGET_DIRECTORY 0x04
|
|
|
|
#define SL_CASE_SENSITIVE 0x80
|
|
|
|
//
|
|
// Read / Write
|
|
//
|
|
|
|
#define SL_KEY_SPECIFIED 0x01
|
|
#define SL_OVERRIDE_VERIFY_VOLUME 0x02
|
|
#define SL_WRITE_THROUGH 0x04
|
|
#define SL_FT_SEQUENTIAL_WRITE 0x08
|
|
|
|
//
|
|
// Device I/O Control
|
|
//
|
|
//
|
|
// Same SL_OVERRIDE_VERIFY_VOLUME as for read/write above.
|
|
//
|
|
|
|
//
|
|
// Lock
|
|
//
|
|
|
|
#define SL_FAIL_IMMEDIATELY 0x01
|
|
#define SL_EXCLUSIVE_LOCK 0x02
|
|
|
|
//
|
|
// QueryDirectory / QueryEa
|
|
//
|
|
|
|
#define SL_RESTART_SCAN 0x01
|
|
#define SL_RETURN_SINGLE_ENTRY 0x02
|
|
#define SL_INDEX_SPECIFIED 0x04
|
|
|
|
//
|
|
// NotifyDirectory
|
|
//
|
|
|
|
#define SL_WATCH_TREE 0x01
|
|
|
|
//
|
|
// FileSystemControl
|
|
//
|
|
// minor: mount/verify volume
|
|
//
|
|
|
|
#define SL_ALLOW_RAW_MOUNT 0x01
|
|
|
|
//
|
|
// Define I/O Request Packet (IRP) stack locations
|
|
//
|
|
|
|
#if !defined(_ALPHA_)
|
|
#include "pshpack4.h"
|
|
#endif
|
|
typedef struct _IO_STACK_LOCATION {
|
|
UCHAR MajorFunction;
|
|
UCHAR MinorFunction;
|
|
UCHAR Flags;
|
|
UCHAR Control;
|
|
|
|
//
|
|
// The following user parameters are based on the service that is being
|
|
// invoked. Drivers and file systems can determine which set to use based
|
|
// on the above major and minor function codes.
|
|
//
|
|
|
|
union {
|
|
|
|
//
|
|
// System service parameters for: NtCreateFile
|
|
//
|
|
|
|
struct {
|
|
PIO_SECURITY_CONTEXT SecurityContext;
|
|
ULONG Options;
|
|
USHORT FileAttributes;
|
|
USHORT ShareAccess;
|
|
ULONG EaLength;
|
|
} Create;
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// System service parameters for: NtCreateNamedPipeFile
|
|
//
|
|
// Notice that the fields in the following parameter structure must
|
|
// match those for the create structure other than the last longword.
|
|
// This is so that no distinctions need be made by the I/O system's
|
|
// parse routine other than for the last longword.
|
|
//
|
|
|
|
struct {
|
|
PIO_SECURITY_CONTEXT SecurityContext;
|
|
ULONG Options;
|
|
USHORT Reserved;
|
|
USHORT ShareAccess;
|
|
PNAMED_PIPE_CREATE_PARAMETERS Parameters;
|
|
} CreatePipe;
|
|
|
|
//
|
|
// System service parameters for: NtCreateMailslotFile
|
|
//
|
|
// Notice that the fields in the following parameter structure must
|
|
// match those for the create structure other than the last longword.
|
|
// This is so that no distinctions need be made by the I/O system's
|
|
// parse routine other than for the last longword.
|
|
//
|
|
|
|
struct {
|
|
PIO_SECURITY_CONTEXT SecurityContext;
|
|
ULONG Options;
|
|
USHORT Reserved;
|
|
USHORT ShareAccess;
|
|
PMAILSLOT_CREATE_PARAMETERS Parameters;
|
|
} CreateMailslot;
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//
|
|
// System service parameters for: NtReadFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
ULONG Key;
|
|
LARGE_INTEGER ByteOffset;
|
|
} Read;
|
|
|
|
//
|
|
// System service parameters for: NtWriteFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
ULONG Key;
|
|
LARGE_INTEGER ByteOffset;
|
|
} Write;
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// System service parameters for: NtQueryDirectoryFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
PSTRING FileName;
|
|
FILE_INFORMATION_CLASS FileInformationClass;
|
|
ULONG FileIndex;
|
|
} QueryDirectory;
|
|
|
|
//
|
|
// System service parameters for: NtNotifyChangeDirectoryFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
ULONG CompletionFilter;
|
|
} NotifyDirectory;
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//
|
|
// System service parameters for: NtQueryInformationFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
FILE_INFORMATION_CLASS FileInformationClass;
|
|
} QueryFile;
|
|
|
|
//
|
|
// System service parameters for: NtSetInformationFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
FILE_INFORMATION_CLASS FileInformationClass;
|
|
PFILE_OBJECT FileObject;
|
|
union {
|
|
struct {
|
|
BOOLEAN ReplaceIfExists;
|
|
BOOLEAN AdvanceOnly;
|
|
};
|
|
ULONG ClusterCount;
|
|
HANDLE DeleteHandle;
|
|
};
|
|
} SetFile;
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// System service parameters for: NtQueryEaFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
PVOID EaList;
|
|
ULONG EaListLength;
|
|
ULONG EaIndex;
|
|
} QueryEa;
|
|
|
|
//
|
|
// System service parameters for: NtSetEaFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
} SetEa;
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//
|
|
// System service parameters for: NtQueryVolumeInformationFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
FS_INFORMATION_CLASS FsInformationClass;
|
|
} QueryVolume;
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// System service parameters for: NtSetVolumeInformationFile
|
|
//
|
|
|
|
struct {
|
|
ULONG Length;
|
|
FS_INFORMATION_CLASS FsInformationClass;
|
|
} SetVolume;
|
|
|
|
//
|
|
// System service parameters for: NtFsControlFile
|
|
//
|
|
// Note that the user's output buffer is stored in the UserBuffer field
|
|
// and the user's input buffer is stored in the SystemBuffer field.
|
|
//
|
|
|
|
struct {
|
|
ULONG OutputBufferLength;
|
|
ULONG InputBufferLength;
|
|
ULONG FsControlCode;
|
|
PVOID Type3InputBuffer;
|
|
} FileSystemControl;
|
|
|
|
//
|
|
// System service parameters for: NtLockFile/NtUnlockFile
|
|
//
|
|
|
|
struct {
|
|
PLARGE_INTEGER Length;
|
|
ULONG Key;
|
|
LARGE_INTEGER ByteOffset;
|
|
} LockControl;
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//
|
|
// System service parameters for: NtFlushBuffersFile
|
|
//
|
|
// No extra user-supplied parameters.
|
|
//
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// System service parameters for: NtCancelIoFile
|
|
//
|
|
// No extra user-supplied parameters.
|
|
//
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//
|
|
// System service parameters for: NtDeviceIoControlFile
|
|
//
|
|
// Note that the user's output buffer is stored in the UserBuffer field
|
|
// and the user's input buffer is stored in the SystemBuffer field.
|
|
//
|
|
|
|
struct {
|
|
ULONG OutputBufferLength;
|
|
ULONG InputBufferLength;
|
|
ULONG IoControlCode;
|
|
PVOID Type3InputBuffer;
|
|
} DeviceIoControl;
|
|
|
|
//
|
|
// System service parameters for: NtQuerySecurityObject
|
|
//
|
|
|
|
struct {
|
|
SECURITY_INFORMATION SecurityInformation;
|
|
ULONG Length;
|
|
} QuerySecurity;
|
|
|
|
//
|
|
// System service parameters for: NtSetSecurityObject
|
|
//
|
|
|
|
struct {
|
|
SECURITY_INFORMATION SecurityInformation;
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
|
} SetSecurity;
|
|
|
|
//
|
|
// Non-system service parameters.
|
|
//
|
|
// Parameters for MountVolume
|
|
//
|
|
|
|
struct {
|
|
PVPB Vpb;
|
|
PDEVICE_OBJECT DeviceObject;
|
|
} MountVolume;
|
|
|
|
//
|
|
// Parameters for VerifyVolume
|
|
//
|
|
|
|
struct {
|
|
PVPB Vpb;
|
|
PDEVICE_OBJECT DeviceObject;
|
|
} VerifyVolume;
|
|
|
|
//
|
|
// Parameters for Scsi with internal device contorl.
|
|
//
|
|
|
|
struct {
|
|
struct _SCSI_REQUEST_BLOCK *Srb;
|
|
} Scsi;
|
|
|
|
#ifdef _PNP_POWER_
|
|
//
|
|
// Parameters for device power control.
|
|
//
|
|
|
|
struct {
|
|
POWER_STATE PowerState;
|
|
ULONG DevicePowerState;
|
|
} SetPower;
|
|
|
|
//
|
|
// Parameters for device removal irp
|
|
//
|
|
|
|
struct {
|
|
PDEVICE_OBJECT DeviceToRemove;
|
|
} RemoveDevice;
|
|
|
|
#endif // _PNP_POWER_
|
|
|
|
//
|
|
// Parameters for StartDevice
|
|
//
|
|
|
|
struct {
|
|
PCM_RESOURCE_LIST AllocatedResources;
|
|
} StartDevice;
|
|
|
|
//
|
|
// Parameters for Cleanup
|
|
//
|
|
// No extra parameters supplied
|
|
//
|
|
|
|
//
|
|
// Others - driver-specific
|
|
//
|
|
|
|
struct {
|
|
PVOID Argument1;
|
|
PVOID Argument2;
|
|
PVOID Argument3;
|
|
PVOID Argument4;
|
|
} Others;
|
|
|
|
} Parameters;
|
|
|
|
//
|
|
// Save a pointer to this device driver's device object for this request
|
|
// so it can be passed to the completion routine if needed.
|
|
//
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
//
|
|
// The following location contains a pointer to the file object for this
|
|
//
|
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
//
|
|
// The following routine is invoked depending on the flags in the above
|
|
// flags field.
|
|
//
|
|
|
|
PIO_COMPLETION_ROUTINE CompletionRoutine;
|
|
|
|
//
|
|
// The following is used to store the address of the context parameter
|
|
// that should be passed to the CompletionRoutine.
|
|
//
|
|
|
|
PVOID Context;
|
|
|
|
} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
|
|
#if !defined(_ALPHA_)
|
|
#include "poppack.h"
|
|
#endif
|
|
|
|
//
|
|
// Define the share access structure used by file systems to determine
|
|
// whether or not another accessor may open the file.
|
|
//
|
|
|
|
typedef struct _SHARE_ACCESS {
|
|
ULONG OpenCount;
|
|
ULONG Readers;
|
|
ULONG Writers;
|
|
ULONG Deleters;
|
|
ULONG SharedRead;
|
|
ULONG SharedWrite;
|
|
ULONG SharedDelete;
|
|
} SHARE_ACCESS, *PSHARE_ACCESS;
|
|
|
|
// begin_nthal
|
|
|
|
//
|
|
// The following structure is used by drivers that are initializing to
|
|
// determine the number of devices of a particular type that have already
|
|
// been initialized. It is also used to track whether or not the AtDisk
|
|
// address range has already been claimed. Finally, it is used by the
|
|
// NtQuerySystemInformation system service to return device type counts.
|
|
//
|
|
|
|
typedef struct _CONFIGURATION_INFORMATION {
|
|
|
|
//
|
|
// This field indicates the total number of disks in the system. This
|
|
// number should be used by the driver to determine the name of new
|
|
// disks. This field should be updated by the driver as it finds new
|
|
// disks.
|
|
//
|
|
|
|
ULONG DiskCount; // Count of hard disks thus far
|
|
ULONG FloppyCount; // Count of floppy disks thus far
|
|
ULONG CdRomCount; // Count of CD-ROM drives thus far
|
|
ULONG TapeCount; // Count of tape drives thus far
|
|
ULONG ScsiPortCount; // Count of SCSI port adapters thus far
|
|
ULONG SerialCount; // Count of serial devices thus far
|
|
ULONG ParallelCount; // Count of parallel devices thus far
|
|
|
|
//
|
|
// These next two fields indicate ownership of one of the two IO address
|
|
// spaces that are used by WD1003-compatable disk controllers.
|
|
//
|
|
|
|
BOOLEAN AtDiskPrimaryAddressClaimed; // 0x1F0 - 0x1FF
|
|
BOOLEAN AtDiskSecondaryAddressClaimed; // 0x170 - 0x17F
|
|
|
|
} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
|
|
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//
|
|
// The following are global counters used by the I/O system to indicate the
|
|
// amount of I/O being performed in the system. The first three counters
|
|
// are just that, counts of operations that have been requested, while the
|
|
// last three counters track the amount of data transferred for each type
|
|
// of I/O request.
|
|
//
|
|
|
|
extern KSPIN_LOCK IoStatisticsLock;
|
|
extern ULONG IoReadOperationCount;
|
|
extern ULONG IoWriteOperationCount;
|
|
extern ULONG IoOtherOperationCount;
|
|
extern LARGE_INTEGER IoReadTransferCount;
|
|
extern LARGE_INTEGER IoWriteTransferCount;
|
|
extern LARGE_INTEGER IoOtherTransferCount;
|
|
|
|
//
|
|
// It is difficult for cached file systems to properly charge quota
|
|
// for the storage that they allocate on behalf of user file handles,
|
|
// so the following amount of additional quota is charged against each
|
|
// handle as a "best guess" as to the amount of quota the file system
|
|
// will allocate on behalf of this handle.
|
|
//
|
|
|
|
//
|
|
// These numbers are totally arbitrary, and can be changed if it turns out
|
|
// that the file systems actually allocate more (or less) on behalf of
|
|
// their file objects. The non-paged pool charge constant is added to the
|
|
// size of a FILE_OBJECT to get the actual charge amount.
|
|
//
|
|
|
|
#define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64
|
|
#define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024
|
|
|
|
|
|
// begin_ntddk begin_nthal
|
|
//
|
|
// Public I/O routine definitions
|
|
//
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoAcquireCancelSpinLock(
|
|
OUT PKIRQL Irql
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoAcquireVpbSpinLock(
|
|
OUT PKIRQL Irql
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoAllocateAdapterChannel(
|
|
IN PADAPTER_OBJECT AdapterObject,
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN ULONG NumberOfMapRegisters,
|
|
IN PDRIVER_CONTROL ExecutionRoutine,
|
|
IN PVOID Context
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoAllocateController(
|
|
IN PCONTROLLER_OBJECT ControllerObject,
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN PDRIVER_CONTROL ExecutionRoutine,
|
|
IN PVOID Context
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PVOID
|
|
IoAllocateErrorLogEntry(
|
|
IN PVOID IoObject,
|
|
IN UCHAR EntrySize
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PIRP
|
|
IoAllocateIrp(
|
|
IN CCHAR StackSize,
|
|
IN BOOLEAN ChargeQuota
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PMDL
|
|
IoAllocateMdl(
|
|
IN PVOID VirtualAddress,
|
|
IN ULONG Length,
|
|
IN BOOLEAN SecondaryBuffer,
|
|
IN BOOLEAN ChargeQuota,
|
|
IN OUT PIRP Irp OPTIONAL
|
|
);
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoAssignArcName(
|
|
// IN PUNICODE_STRING ArcName,
|
|
// IN PUNICODE_STRING DeviceName
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked by drivers of bootable media to create a symbolic
|
|
// link between the ARC name of their device and its NT name. This allows
|
|
// the system to determine which device in the system was actually booted
|
|
// from since the ARC firmware only deals in ARC names, and NT only deals
|
|
// in NT names.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// ArcName - Supplies the Unicode string representing the ARC name.
|
|
//
|
|
// DeviceName - Supplies the name to which the ARCname refers.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoAssignArcName( ArcName, DeviceName ) ( \
|
|
IoCreateSymbolicLink( (ArcName), (DeviceName) ) )
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoAssignResources (
|
|
IN PUNICODE_STRING RegistryPath,
|
|
IN PUNICODE_STRING DriverClassName OPTIONAL,
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
|
|
IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
|
IN OUT PCM_RESOURCE_LIST *AllocatedResources
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoAsynchronousPageWrite(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN PMDL MemoryDescriptorList,
|
|
IN PLARGE_INTEGER StartingOffset,
|
|
IN PIO_APC_ROUTINE ApcRoutine,
|
|
IN PVOID ApcContext,
|
|
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
|
OUT PIRP *Irp OPTIONAL
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoAttachDevice(
|
|
IN PDEVICE_OBJECT SourceDevice,
|
|
IN PUNICODE_STRING TargetDevice,
|
|
OUT PDEVICE_OBJECT *AttachedDevice
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoAttachDeviceByPointer(
|
|
IN PDEVICE_OBJECT SourceDevice,
|
|
IN PDEVICE_OBJECT TargetDevice
|
|
);
|
|
|
|
PDEVICE_OBJECT
|
|
IoAttachDeviceToDeviceStack(
|
|
IN PDEVICE_OBJECT SourceDevice,
|
|
IN PDEVICE_OBJECT TargetDevice
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PIRP
|
|
IoBuildAsynchronousFsdRequest(
|
|
IN ULONG MajorFunction,
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN OUT PVOID Buffer OPTIONAL,
|
|
IN ULONG Length OPTIONAL,
|
|
IN PLARGE_INTEGER StartingOffset OPTIONAL,
|
|
IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PIRP
|
|
IoBuildDeviceIoControlRequest(
|
|
IN ULONG IoControlCode,
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN PVOID InputBuffer OPTIONAL,
|
|
IN ULONG InputBufferLength,
|
|
OUT PVOID OutputBuffer OPTIONAL,
|
|
IN ULONG OutputBufferLength,
|
|
IN BOOLEAN InternalDeviceIoControl,
|
|
IN PKEVENT Event,
|
|
OUT PIO_STATUS_BLOCK IoStatusBlock
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoBuildPartialMdl(
|
|
IN PMDL SourceMdl,
|
|
IN OUT PMDL TargetMdl,
|
|
IN PVOID VirtualAddress,
|
|
IN ULONG Length
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PIRP
|
|
IoBuildSynchronousFsdRequest(
|
|
IN ULONG MajorFunction,
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN OUT PVOID Buffer OPTIONAL,
|
|
IN ULONG Length OPTIONAL,
|
|
IN PLARGE_INTEGER StartingOffset OPTIONAL,
|
|
IN PKEVENT Event,
|
|
OUT PIO_STATUS_BLOCK IoStatusBlock
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
FASTCALL
|
|
IofCallDriver(
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN OUT PIRP Irp
|
|
);
|
|
|
|
#define IoCallDriver(a,b) \
|
|
IofCallDriver(a,b)
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoCancelIrp(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoCancelThreadIo(
|
|
IN PETHREAD Thread
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCheckDesiredAccess(
|
|
IN OUT PACCESS_MASK DesiredAccess,
|
|
IN ACCESS_MASK GrantedAccess
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCheckEaBufferValidity(
|
|
IN PFILE_FULL_EA_INFORMATION EaBuffer,
|
|
IN ULONG EaLength,
|
|
OUT PULONG ErrorOffset
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCheckFunctionAccess(
|
|
IN ACCESS_MASK GrantedAccess,
|
|
IN UCHAR MajorFunction,
|
|
IN UCHAR MinorFunction,
|
|
IN ULONG IoControlCode,
|
|
IN PFILE_INFORMATION_CLASS FileInformationClass OPTIONAL,
|
|
IN PFS_INFORMATION_CLASS FsInformationClass OPTIONAL
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCheckShareAccess(
|
|
IN ACCESS_MASK DesiredAccess,
|
|
IN ULONG DesiredShareAccess,
|
|
IN OUT PFILE_OBJECT FileObject,
|
|
IN OUT PSHARE_ACCESS ShareAccess,
|
|
IN BOOLEAN Update
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
FASTCALL
|
|
IofCompleteRequest(
|
|
IN PIRP Irp,
|
|
IN CCHAR PriorityBoost
|
|
);
|
|
|
|
#define IoCompleteRequest(a,b) \
|
|
IofCompleteRequest(a,b)
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoConnectInterrupt(
|
|
OUT PKINTERRUPT *InterruptObject,
|
|
IN PKSERVICE_ROUTINE ServiceRoutine,
|
|
IN PVOID ServiceContext,
|
|
IN PKSPIN_LOCK SpinLock OPTIONAL,
|
|
IN ULONG Vector,
|
|
IN KIRQL Irql,
|
|
IN KIRQL SynchronizeIrql,
|
|
IN KINTERRUPT_MODE InterruptMode,
|
|
IN BOOLEAN ShareVector,
|
|
IN KAFFINITY ProcessorEnableMask,
|
|
IN BOOLEAN FloatingSave
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PCONTROLLER_OBJECT
|
|
IoCreateController(
|
|
IN ULONG Size
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCreateDevice(
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN ULONG DeviceExtensionSize,
|
|
IN PUNICODE_STRING DeviceName OPTIONAL,
|
|
IN DEVICE_TYPE DeviceType,
|
|
IN ULONG DeviceCharacteristics,
|
|
IN BOOLEAN Exclusive,
|
|
OUT PDEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCreateFile(
|
|
OUT PHANDLE FileHandle,
|
|
IN ACCESS_MASK DesiredAccess,
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
|
IN PLARGE_INTEGER AllocationSize OPTIONAL,
|
|
IN ULONG FileAttributes,
|
|
IN ULONG ShareAccess,
|
|
IN ULONG Disposition,
|
|
IN ULONG CreateOptions,
|
|
IN PVOID EaBuffer OPTIONAL,
|
|
IN ULONG EaLength,
|
|
IN CREATE_FILE_TYPE CreateFileType,
|
|
IN PVOID ExtraCreateParameters OPTIONAL,
|
|
IN ULONG Options
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PFILE_OBJECT
|
|
IoCreateStreamFileObject(
|
|
IN PFILE_OBJECT FileObject OPTIONAL,
|
|
IN PDEVICE_OBJECT DeviceObject OPTIONAL
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
PKEVENT
|
|
IoCreateNotificationEvent(
|
|
IN PUNICODE_STRING EventName,
|
|
OUT PHANDLE EventHandle
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCreateSymbolicLink(
|
|
IN PUNICODE_STRING SymbolicLinkName,
|
|
IN PUNICODE_STRING DeviceName
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PKEVENT
|
|
IoCreateSynchronizationEvent(
|
|
IN PUNICODE_STRING EventName,
|
|
OUT PHANDLE EventHandle
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoCreateUnprotectedSymbolicLink(
|
|
IN PUNICODE_STRING SymbolicLinkName,
|
|
IN PUNICODE_STRING DeviceName
|
|
);
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoDeassignArcName(
|
|
// IN PUNICODE_STRING ArcName
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked by drivers to deassign an ARC name that they
|
|
// created to a device. This is generally only called if the driver is
|
|
// deleting the device object, which means that the driver is probably
|
|
// unloading.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// ArcName - Supplies the ARC name to be removed.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoDeassignArcName( ArcName ) ( \
|
|
IoDeleteSymbolicLink( (ArcName) ) )
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoDeleteController(
|
|
IN PCONTROLLER_OBJECT ControllerObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoDeleteDevice(
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoDeleteSymbolicLink(
|
|
IN PUNICODE_STRING SymbolicLinkName
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoDetachDevice(
|
|
IN OUT PDEVICE_OBJECT TargetDevice
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoDisconnectInterrupt(
|
|
IN PKINTERRUPT InterruptObject
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoEnqueueIrp(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
// begin_ntsrv
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoFastQueryNetworkAttributes(
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|
IN ACCESS_MASK DesiredAccess,
|
|
IN ULONG OpenOptions,
|
|
OUT PIO_STATUS_BLOCK IoStatus,
|
|
OUT PFILE_NETWORK_OPEN_INFORMATION Buffer
|
|
);
|
|
|
|
// end_ntsrv
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoFreeController(
|
|
IN PCONTROLLER_OBJECT ControllerObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoFreeIrp(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoFreeMdl(
|
|
IN PMDL Mdl
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
PDEVICE_OBJECT
|
|
IoGetAttachedDevice(
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PDEVICE_OBJECT
|
|
IoGetBaseFileSystemDeviceObject(
|
|
IN PFILE_OBJECT FileObject
|
|
);
|
|
|
|
NTKERNELAPI // ntddk nthal
|
|
PCONFIGURATION_INFORMATION // ntddk nthal
|
|
IoGetConfigurationInformation( VOID ); // ntddk nthal
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//++
|
|
//
|
|
// PIO_STACK_LOCATION
|
|
// IoGetCurrentIrpStackLocation(
|
|
// IN PIRP Irp
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to return a pointer to the current stack location
|
|
// in an I/O Request Packet (IRP).
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Irp - Pointer to the I/O Request Packet.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// The function value is a pointer to the current stack location in the
|
|
// packet.
|
|
//
|
|
//--
|
|
|
|
#define IoGetCurrentIrpStackLocation( Irp ) ( (Irp)->Tail.Overlay.CurrentStackLocation )
|
|
|
|
// end_nthal
|
|
|
|
NTKERNELAPI
|
|
PDEVICE_OBJECT
|
|
IoGetDeviceToVerify(
|
|
IN PETHREAD Thread
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PEPROCESS
|
|
IoGetCurrentProcess(
|
|
VOID
|
|
);
|
|
|
|
// begin_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoGetDeviceObjectPointer(
|
|
IN PUNICODE_STRING ObjectName,
|
|
IN ACCESS_MASK DesiredAccess,
|
|
OUT PFILE_OBJECT *FileObject,
|
|
OUT PDEVICE_OBJECT *DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PGENERIC_MAPPING
|
|
IoGetFileObjectGenericMapping(
|
|
VOID
|
|
);
|
|
|
|
// end_nthal
|
|
|
|
//++
|
|
//
|
|
// ULONG
|
|
// IoGetFunctionCodeFromCtlCode(
|
|
// IN ULONG ControlCode
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine extracts the function code from IOCTL and FSCTL function
|
|
// control codes.
|
|
// This routine should only be used by kernel mode code.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// ControlCode - A function control code (IOCTL or FSCTL) from which the
|
|
// function code must be extracted.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// The extracted function code.
|
|
//
|
|
// Note:
|
|
//
|
|
// The CTL_CODE macro, used to create IOCTL and FSCTL function control
|
|
// codes, is defined in ntioapi.h
|
|
//
|
|
//--
|
|
|
|
#define IoGetFunctionCodeFromCtlCode( ControlCode ) (\
|
|
( ControlCode >> 2) & 0x00000FFF )
|
|
|
|
// begin_nthal
|
|
|
|
NTKERNELAPI
|
|
PVOID
|
|
IoGetInitialStack(
|
|
VOID
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoGetStackLimits (
|
|
OUT PULONG LowLimit,
|
|
OUT PULONG HighLimit
|
|
);
|
|
|
|
|
|
//
|
|
// The following function is used to tell the caller how much stack is available
|
|
//
|
|
|
|
__inline
|
|
ULONG
|
|
IoGetRemainingStackSize (
|
|
VOID
|
|
)
|
|
{
|
|
ULONG Top;
|
|
ULONG Bottom;
|
|
|
|
IoGetStackLimits( &Bottom, &Top );
|
|
return((ULONG)(&Top) - Bottom );
|
|
}
|
|
|
|
//++
|
|
//
|
|
// PIO_STACK_LOCATION
|
|
// IoGetNextIrpStackLocation(
|
|
// IN PIRP Irp
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to return a pointer to the next stack location
|
|
// in an I/O Request Packet (IRP).
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Irp - Pointer to the I/O Request Packet.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// The function value is a pointer to the next stack location in the packet.
|
|
//
|
|
//--
|
|
|
|
#define IoGetNextIrpStackLocation( Irp ) (\
|
|
(Irp)->Tail.Overlay.CurrentStackLocation - 1 )
|
|
|
|
NTKERNELAPI
|
|
PDEVICE_OBJECT
|
|
IoGetRelatedDeviceObject(
|
|
IN PFILE_OBJECT FileObject
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
PEPROCESS
|
|
IoGetRequestorProcess(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PIRP
|
|
IoGetTopLevelIrp(
|
|
VOID
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoInitializeDpcRequest(
|
|
// IN PDEVICE_OBJECT DeviceObject,
|
|
// IN PIO_DPC_ROUTINE DpcRoutine
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to initialize the DPC in a device object for a
|
|
// device driver during its initialization routine. The DPC is used later
|
|
// when the driver interrupt service routine requests that a DPC routine
|
|
// be queued for later execution.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// DeviceObject - Pointer to the device object that the request is for.
|
|
//
|
|
// DpcRoutine - Address of the driver's DPC routine to be executed when
|
|
// the DPC is dequeued for processing.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoInitializeDpcRequest( DeviceObject, DpcRoutine ) (\
|
|
KeInitializeDpc( &(DeviceObject)->Dpc, \
|
|
(PKDEFERRED_ROUTINE) (DpcRoutine), \
|
|
(DeviceObject) ) )
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoInitializeIrp(
|
|
IN OUT PIRP Irp,
|
|
IN USHORT PacketSize,
|
|
IN CCHAR StackSize
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoInitializeTimer(
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN PIO_TIMER_ROUTINE TimerRoutine,
|
|
IN PVOID Context
|
|
);
|
|
|
|
// end_ntddk end_nthal end_ntifs
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoInitSystem(
|
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
|
);
|
|
|
|
// begin_ntddk begin_nthal begin_ntifs
|
|
|
|
//++
|
|
//
|
|
// BOOLEAN
|
|
// IoIsErrorUserInduced(
|
|
// IN NTSTATUS Status
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to determine if an error was as a
|
|
// result of user actions. Typically these error are related
|
|
// to removable media and will result in a pop-up.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Status - The status value to check.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// The function value is TRUE if the user induced the error,
|
|
// otherwise FALSE is returned.
|
|
//
|
|
//--
|
|
#define IoIsErrorUserInduced( Status ) ((BOOLEAN) \
|
|
(((Status) == STATUS_DEVICE_NOT_READY) || \
|
|
((Status) == STATUS_IO_TIMEOUT) || \
|
|
((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
|
|
((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
|
|
((Status) == STATUS_VERIFY_REQUIRED) || \
|
|
((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
|
|
((Status) == STATUS_WRONG_VOLUME)))
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
//++
|
|
//
|
|
// BOOLEAN
|
|
// IoIsFileOpenedExclusively(
|
|
// IN PFILE_OBJECT FileObject
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to determine whether the file open represented
|
|
// by the specified file object is opened exclusively.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// FileObject - Pointer to the file object that represents the open instance
|
|
// of the target file to be tested for exclusive access.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// The function value is TRUE if the open instance of the file is exclusive;
|
|
// otherwise FALSE is returned.
|
|
//
|
|
//--
|
|
|
|
#define IoIsFileOpenedExclusively( FileObject ) (\
|
|
(BOOLEAN) !((FileObject)->SharedRead || (FileObject)->SharedWrite || (FileObject)->SharedDelete))
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoIsOperationSynchronous(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoIsSystemThread(
|
|
IN PETHREAD Thread
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
PIRP
|
|
IoMakeAssociatedIrp(
|
|
IN PIRP Irp,
|
|
IN CCHAR StackSize
|
|
);
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoMarkIrpPending(
|
|
// IN OUT PIRP Irp
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine marks the specified I/O Request Packet (IRP) to indicate
|
|
// that an initial status of STATUS_PENDING was returned to the caller.
|
|
// This is used so that I/O completion can determine whether or not to
|
|
// fully complete the I/O operation requested by the packet.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Irp - Pointer to the I/O Request Packet to be marked pending.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoMarkIrpPending( Irp ) ( \
|
|
IoGetCurrentIrpStackLocation( (Irp) )->Control |= SL_PENDING_RETURNED )
|
|
|
|
// end_ntddk end_nthal end_ntifs
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoPageFileCreated(
|
|
IN HANDLE FileHandle
|
|
);
|
|
|
|
NTKERNELAPI // ntifs
|
|
NTSTATUS // ntifs
|
|
IoPageRead( // ntifs
|
|
IN PFILE_OBJECT FileObject, // ntifs
|
|
IN PMDL MemoryDescriptorList, // ntifs
|
|
IN PLARGE_INTEGER StartingOffset, // ntifs
|
|
IN PKEVENT Event, // ntifs
|
|
OUT PIO_STATUS_BLOCK IoStatusBlock // ntifs
|
|
); // ntifs
|
|
|
|
NTKERNELAPI // ntddk
|
|
NTSTATUS // ntddk
|
|
IoQueryDeviceDescription( // ntddk
|
|
IN PINTERFACE_TYPE BusType OPTIONAL, // ntddk
|
|
IN PULONG BusNumber OPTIONAL, // ntddk
|
|
IN PCONFIGURATION_TYPE ControllerType OPTIONAL, // ntddk
|
|
IN PULONG ControllerNumber OPTIONAL, // ntddk
|
|
IN PCONFIGURATION_TYPE PeripheralType OPTIONAL, // ntddk
|
|
IN PULONG PeripheralNumber OPTIONAL, // ntddk
|
|
IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, // ntddk
|
|
IN PVOID Context // ntddk
|
|
); // ntddk
|
|
|
|
// begin_ntifs
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoQueryFileInformation(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN FILE_INFORMATION_CLASS FileInformationClass,
|
|
IN ULONG Length,
|
|
OUT PVOID FileInformation,
|
|
OUT PULONG ReturnedLength
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoQueryVolumeInformation(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN FS_INFORMATION_CLASS FsInformationClass,
|
|
IN ULONG Length,
|
|
OUT PVOID FsInformation,
|
|
OUT PULONG ReturnedLength
|
|
);
|
|
|
|
// end_ntifs
|
|
// begin_ntsrv
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoQueueThreadIrp(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
// end_ntsrv
|
|
// begin_ntddk begin_nthal begin_ntifs
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoRaiseHardError(
|
|
IN PIRP Irp,
|
|
IN PVPB Vpb OPTIONAL,
|
|
IN PDEVICE_OBJECT RealDeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoRaiseInformationalHardError(
|
|
IN NTSTATUS ErrorStatus,
|
|
IN PUNICODE_STRING String OPTIONAL,
|
|
IN PKTHREAD Thread OPTIONAL
|
|
);
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoSetThreadHardErrorMode(
|
|
IN BOOLEAN EnableHardErrors
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoRegisterDriverReinitialization(
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
|
|
IN PVOID Context
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoRegisterFileSystem(
|
|
IN OUT PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoRegisterFsRegistrationChange(
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoRegisterShutdownNotification(
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoReleaseCancelSpinLock(
|
|
IN KIRQL Irql
|
|
);
|
|
|
|
#if _PNP_POWER_
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoHoldDeviceQueue (
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN struct _IRP *Irp
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoReleaseStartIoHoldingQueue (
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
#endif
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoReleaseVpbSpinLock(
|
|
IN KIRQL Irql
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoRemoveShareAccess(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN OUT PSHARE_ACCESS ShareAccess
|
|
);
|
|
|
|
// end_ntddk end_ntifs
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoReportHalResourceUsage(
|
|
IN PUNICODE_STRING HalName,
|
|
IN PCM_RESOURCE_LIST RawResourceList,
|
|
IN PCM_RESOURCE_LIST TranslatedResourceList,
|
|
IN ULONG ResourceListSize
|
|
);
|
|
|
|
// begin_ntddk begin_ntifs
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoReportResourceUsage(
|
|
IN PUNICODE_STRING DriverClassName OPTIONAL,
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN PCM_RESOURCE_LIST DriverList OPTIONAL,
|
|
IN ULONG DriverListSize OPTIONAL,
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
|
|
IN ULONG DeviceListSize OPTIONAL,
|
|
IN BOOLEAN OverrideConflict,
|
|
OUT PBOOLEAN ConflictDetected
|
|
);
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoRequestDpc(
|
|
// IN PDEVICE_OBJECT DeviceObject,
|
|
// IN PIRP Irp,
|
|
// IN PVOID Context
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked by the device driver's interrupt service routine
|
|
// to request that a DPC routine be queued for later execution at a lower
|
|
// IRQL.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// DeviceObject - Device object for which the request is being processed.
|
|
//
|
|
// Irp - Pointer to the current I/O Request Packet (IRP) for the specified
|
|
// device.
|
|
//
|
|
// Context - Provides a general context parameter to be passed to the
|
|
// DPC routine.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoRequestDpc( DeviceObject, Irp, Context ) ( \
|
|
KeInsertQueueDpc( &(DeviceObject)->Dpc, (Irp), (Context) ) )
|
|
|
|
//++
|
|
//
|
|
// PDRIVER_CANCEL
|
|
// IoSetCancelRoutine(
|
|
// IN PIRP Irp,
|
|
// IN PDRIVER_CANCEL CancelRoutine
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to set the address of a cancel routine which
|
|
// is to be invoked when an I/O packet has been canceled.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Irp - Pointer to the I/O Request Packet itself.
|
|
//
|
|
// CancelRoutine - Address of the cancel routine that is to be invoked
|
|
// if the IRP is cancelled.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// Previous value of CancelRoutine field in the IRP.
|
|
//
|
|
//--
|
|
|
|
#define IoSetCancelRoutine( Irp, NewCancelRoutine ) ( \
|
|
(PDRIVER_CANCEL) InterlockedExchange( (PLONG) &(Irp)->CancelRoutine, (LONG) (NewCancelRoutine) ) )
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoSetCompletionRoutine(
|
|
// IN PIRP Irp,
|
|
// IN PIO_COMPLETION_ROUTINE CompletionRoutine,
|
|
// IN PVOID Context,
|
|
// IN BOOLEAN InvokeOnSuccess,
|
|
// IN BOOLEAN InvokeOnError,
|
|
// IN BOOLEAN InvokeOnCancel
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to set the address of a completion routine which
|
|
// is to be invoked when an I/O packet has been completed by a lower-level
|
|
// driver.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Irp - Pointer to the I/O Request Packet itself.
|
|
//
|
|
// CompletionRoutine - Address of the completion routine that is to be
|
|
// invoked once the next level driver completes the packet.
|
|
//
|
|
// Context - Specifies a context parameter to be passed to the completion
|
|
// routine.
|
|
//
|
|
// InvokeOnSuccess - Specifies that the completion routine is invoked when the
|
|
// operation is successfully completed.
|
|
//
|
|
// InvokeOnError - Specifies that the completion routine is invoked when the
|
|
// operation completes with an error status.
|
|
//
|
|
// InvokeOnCancel - Specifies that the completion routine is invoked when the
|
|
// operation is being canceled.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoSetCompletionRoutine( Irp, Routine, CompletionContext, Success, Error, Cancel ) { \
|
|
PIO_STACK_LOCATION irpSp; \
|
|
ASSERT( (Success) | (Error) | (Cancel) ? (Routine) != NULL : TRUE ); \
|
|
irpSp = IoGetNextIrpStackLocation( (Irp) ); \
|
|
irpSp->CompletionRoutine = (Routine); \
|
|
irpSp->Context = (CompletionContext); \
|
|
irpSp->Control = 0; \
|
|
if ((Success)) { irpSp->Control = SL_INVOKE_ON_SUCCESS; } \
|
|
if ((Error)) { irpSp->Control |= SL_INVOKE_ON_ERROR; } \
|
|
if ((Cancel)) { irpSp->Control |= SL_INVOKE_ON_CANCEL; } }
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoSetDeviceToVerify(
|
|
IN PETHREAD Thread,
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoSetHardErrorOrVerifyDevice(
|
|
IN PIRP Irp,
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoSetInformation(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN FILE_INFORMATION_CLASS FileInformationClass,
|
|
IN ULONG Length,
|
|
IN PVOID FileInformation
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
//++
|
|
//
|
|
// VOID
|
|
// IoSetNextIrpStackLocation (
|
|
// IN OUT PIRP Irp
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// This routine is invoked to set the current IRP stack location to
|
|
// the next stack location, i.e. it "pushes" the stack.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// Irp - Pointer to the I/O Request Packet (IRP).
|
|
//
|
|
// Return Value:
|
|
//
|
|
// None.
|
|
//
|
|
//--
|
|
|
|
#define IoSetNextIrpStackLocation( Irp ) { \
|
|
(Irp)->CurrentLocation--; \
|
|
(Irp)->Tail.Overlay.CurrentStackLocation--; }
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoSetShareAccess(
|
|
IN ACCESS_MASK DesiredAccess,
|
|
IN ULONG DesiredShareAccess,
|
|
IN OUT PFILE_OBJECT FileObject,
|
|
OUT PSHARE_ACCESS ShareAccess
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoSetTopLevelIrp(
|
|
IN PIRP Irp
|
|
);
|
|
|
|
// end_ntifs
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoShutdownSystem(
|
|
IN BOOLEAN RebootPending,
|
|
IN ULONG Phase
|
|
);
|
|
|
|
// begin_ntddk begin_nthal begin_ntifs
|
|
|
|
//++
|
|
//
|
|
// USHORT
|
|
// IoSizeOfIrp(
|
|
// IN CCHAR StackSize
|
|
// )
|
|
//
|
|
// Routine Description:
|
|
//
|
|
// Determines the size of an IRP given the number of stack locations
|
|
// the IRP will have.
|
|
//
|
|
// Arguments:
|
|
//
|
|
// StackSize - Number of stack locations for the IRP.
|
|
//
|
|
// Return Value:
|
|
//
|
|
// Size in bytes of the IRP.
|
|
//
|
|
//--
|
|
|
|
#define IoSizeOfIrp( StackSize ) \
|
|
((USHORT) (sizeof( IRP ) + ((StackSize) * (sizeof( IO_STACK_LOCATION )))))
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoStartNextPacket(
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN BOOLEAN Cancelable
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoStartNextPacketByKey(
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN BOOLEAN Cancelable,
|
|
IN ULONG Key
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoStartPacket(
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN PIRP Irp,
|
|
IN PULONG Key OPTIONAL,
|
|
IN PDRIVER_CANCEL CancelFunction OPTIONAL
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoStartTimer(
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoStopTimer(
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoSynchronousPageWrite(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN PMDL MemoryDescriptorList,
|
|
IN PLARGE_INTEGER StartingOffset,
|
|
IN PKEVENT Event,
|
|
OUT PIO_STATUS_BLOCK IoStatusBlock
|
|
);
|
|
|
|
NTKERNELAPI
|
|
PEPROCESS
|
|
IoThreadToProcess(
|
|
IN PETHREAD Thread
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoUnregisterFileSystem(
|
|
IN OUT PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoUnregisterFsRegistrationChange(
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine
|
|
);
|
|
|
|
// begin_ntddk begin_nthal
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoUnregisterShutdownNotification(
|
|
IN PDEVICE_OBJECT DeviceObject
|
|
);
|
|
|
|
NTKERNELAPI
|
|
VOID
|
|
IoUpdateShareAccess(
|
|
IN PFILE_OBJECT FileObject,
|
|
IN OUT PSHARE_ACCESS ShareAccess
|
|
);
|
|
|
|
// end_ntddk end_nthal
|
|
|
|
NTKERNELAPI
|
|
NTSTATUS
|
|
IoVerifyVolume(
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
IN BOOLEAN AllowRawMount
|
|
);
|
|
|
|
NTKERNELAPI
|
|
BOOLEAN
|
|
IoWriteCrashDump(
|
|
IN ULONG BugCheckCode,
|
|
IN ULONG BugCheckParameter1,
|
|
IN ULONG BugCheckParameter2,
|
|
IN ULONG BugCheckParameter3,
|
|
IN ULONG BugCheckParameter4,
|
|
IN PVOID Context
|
|
);
|
|
|
|
NTKERNELAPI // ntddk nthal
|
|
VOID // ntddk nthal
|
|
IoWriteErrorLogEntry( // ntddk nthal
|
|
IN PVOID ElEntry // ntddk nthal
|
|
); // ntddk nthal
|
|
|
|
//end_ntifs
|
|
|
|
#endif // _IO_
|