- Move more stuff to wdm.h
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 1 Mar 2010 13:26:33 +0000 (13:26 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 1 Mar 2010 13:26:33 +0000 (13:26 +0000)
- Group some related definitions
- Add IO_TYPE_CSQ_EX
- Add some missing _KEY_SET_INFORMATION_CLASS members
- KeyUserFlagsInformation -> KeyWow64FlagsInformation

svn path=/branches/header-work/; revision=45741

include/ddk/wdm.h
include/ddk/winddk.h
include/ndk/cmtypes.h

index 6ce790c..8d40c57 100644 (file)
@@ -1289,6 +1289,32 @@ typedef struct _PNP_BUS_INFORMATION {
  *                         Memory manager Types                               *
  ******************************************************************************/
 
+#define MDL_MAPPED_TO_SYSTEM_VA     0x0001
+#define MDL_PAGES_LOCKED            0x0002
+#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
+#define MDL_ALLOCATED_FIXED_SIZE    0x0008
+#define MDL_PARTIAL                 0x0010
+#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
+#define MDL_IO_PAGE_READ            0x0040
+#define MDL_WRITE_OPERATION         0x0080
+#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
+#define MDL_FREE_EXTRA_PTES         0x0200
+#define MDL_DESCRIBES_AWE           0x0400
+#define MDL_IO_SPACE                0x0800
+#define MDL_NETWORK_HEADER          0x1000
+#define MDL_MAPPING_CAN_FAIL        0x2000
+#define MDL_ALLOCATED_MUST_SUCCEED  0x4000
+#define MDL_INTERNAL                0x8000
+
+#define MDL_MAPPING_FLAGS ( \
+  MDL_MAPPED_TO_SYSTEM_VA     | \
+  MDL_PAGES_LOCKED            | \
+  MDL_SOURCE_IS_NONPAGED_POOL | \
+  MDL_PARTIAL_HAS_BEEN_MAPPED | \
+  MDL_PARENT_MAPPED_SYSTEM_VA | \
+  MDL_SYSTEM_VA               | \
+  MDL_IO_SPACE)
+
 typedef struct _MDL {
     struct _MDL *Next;
     CSHORT Size;
@@ -1338,2428 +1364,2811 @@ MmCreateMdl(
 #endif
 
 /******************************************************************************
- *                         I/O Manager Functions                              *
+ *                            Security Manager Types                          *
  ******************************************************************************/
 
-#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && \
-   (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
+//
+// Access/Security Stuff
+//
+typedef ULONG ACCESS_MASK, *PACCESS_MASK;
+typedef PVOID PACCESS_TOKEN;
 
-#define DMA_MACROS_DEFINED
+#define DELETE                           0x00010000L
+#define READ_CONTROL                     0x00020000L
+#define WRITE_DAC                        0x00040000L
+#define WRITE_OWNER                      0x00080000L
+#define SYNCHRONIZE                      0x00100000L
+#define STANDARD_RIGHTS_REQUIRED         0x000F0000L
+#define STANDARD_RIGHTS_READ             READ_CONTROL
+#define STANDARD_RIGHTS_WRITE            READ_CONTROL
+#define STANDARD_RIGHTS_EXECUTE          READ_CONTROL
+#define STANDARD_RIGHTS_ALL              0x001F0000L
+#define SPECIFIC_RIGHTS_ALL              0x0000FFFFL
+#define ACCESS_SYSTEM_SECURITY           0x01000000L
+#define MAXIMUM_ALLOWED                  0x02000000L
+#define GENERIC_READ                     0x80000000L
+#define GENERIC_WRITE                    0x40000000L
+#define GENERIC_EXECUTE                  0x20000000L
+#define GENERIC_ALL                      0x10000000L
 
-FORCEINLINE
-NTSTATUS
-IoAllocateAdapterChannel(
-    IN PADAPTER_OBJECT AdapterObject,
-    IN PDEVICE_OBJECT DeviceObject,
-    IN ULONG NumberOfMapRegisters,
-    IN PDRIVER_CONTROL ExecutionRoutine,
-    IN PVOID Context)
-{
-    PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
-    AllocateAdapterChannel =
-        *(DmaAdapter)->DmaOperations->AllocateAdapterChannel;
-    ASSERT(AllocateAdapterChannel);
-    return AllocateAdapterChannel(DmaAdapter,
-                                  DeviceObject,
-                                  NumberOfMapRegisters,
-                                  ExecutionRoutine,
-                                  Context );
-}
+typedef struct _GENERIC_MAPPING {
+    ACCESS_MASK GenericRead;
+    ACCESS_MASK GenericWrite;
+    ACCESS_MASK GenericExecute;
+    ACCESS_MASK GenericAll;
+} GENERIC_MAPPING, *PGENERIC_MAPPING;
 
-FORCEINLINE
-BOOLEAN
-IoFlushAdapterBuffers(
-    IN PADAPTER_OBJECT AdapterObject,
-    IN PMDL Mdl,
-    IN PVOID MapRegisterBase,
-    IN PVOID CurrentVa,
-    IN ULONG Length,
-    IN BOOLEAN WriteToDevice)
-{
-    PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
-    FlushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers;
-    ASSERT(FlushAdapterBuffers);
-    return FlushAdapterBuffers(DmaAdapter,
-                               Mdl,
-                               MapRegisterBase,
-                               CurrentVa,
-                               Length,
-                               WriteToDevice );
-}
+#define ACL_REVISION                      2
+#define ACL_REVISION_DS                   4
 
-FORCEINLINE
-VOID
-IoFreeAdapterChannel(
-    IN PADAPTER_OBJECT AdapterObject)
-{
-    PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
-    FreeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel;
-    ASSERT(FreeAdapterChannel);
-    FreeAdapterChannel(DmaAdapter);
-}
+#define ACL_REVISION1                     1
+#define ACL_REVISION2                     2
+#define ACL_REVISION3                     3
+#define ACL_REVISION4                     4
+#define MIN_ACL_REVISION                  ACL_REVISION2
+#define MAX_ACL_REVISION                  ACL_REVISION4
 
-FORCEINLINE
-VOID
-IoFreeMapRegisters(
-    IN PADAPTER_OBJECT AdapterObject,
-    IN PVOID MapRegisterBase,
-    IN ULONG NumberOfMapRegisters)
-{
-    PFREE_MAP_REGISTERS FreeMapRegisters;
-    FreeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters;
-    ASSERT(FreeMapRegisters);
-    FreeMapRegisters(DmaAdapter, MapRegisterBase, NumberOfMapRegisters);
-}
+typedef struct _ACL {
+    UCHAR AclRevision;
+    UCHAR Sbz1;
+    USHORT AclSize;
+    USHORT AceCount;
+    USHORT Sbz2;
+} ACL, *PACL;
 
-FORCEINLINE
-PHYSICAL_ADDRESS
-IoMapTransfer(
-    IN PDMA_ADAPTER DmaAdapter,
-    IN PMDL Mdl,
-    IN PVOID MapRegisterBase,
-    IN PVOID CurrentVa,
-    IN OUT PULONG Length,
-    IN BOOLEAN WriteToDevice)
-{
-    PMAP_TRANSFER MapTransfer;
+//
+// Current security descriptor revision value
+//
+#define SECURITY_DESCRIPTOR_REVISION     (1)
+#define SECURITY_DESCRIPTOR_REVISION1    (1)
 
-    MapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer;
-    ASSERT(MapTransfer);
-    return MapTransfer(DmaAdapter,
-                       Mdl,
-                       MapRegisterBase,
-                       CurrentVa,
-                       Length,
-                       WriteToDevice);
-}
-#endif
+//
+// Privilege attributes
+//
+#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L)
+#define SE_PRIVILEGE_ENABLED            (0x00000002L)
+#define SE_PRIVILEGE_REMOVED            (0X00000004L)
+#define SE_PRIVILEGE_USED_FOR_ACCESS    (0x80000000L)
 
-/* IO_RESOURCE_DESCRIPTOR.Option */
+#define SE_PRIVILEGE_VALID_ATTRIBUTES   (SE_PRIVILEGE_ENABLED_BY_DEFAULT | \
+                                         SE_PRIVILEGE_ENABLED            | \
+                                         SE_PRIVILEGE_REMOVED            | \
+                                         SE_PRIVILEGE_USED_FOR_ACCESS)
 
-#define IO_RESOURCE_PREFERRED             0x01
-#define IO_RESOURCE_DEFAULT               0x02
-#define IO_RESOURCE_ALTERNATIVE           0x08
+#include <pshpack4.h>
+typedef struct _LUID_AND_ATTRIBUTES {
+    LUID Luid;
+    ULONG Attributes;
+} LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
+#include <poppack.h>
 
-/* DEVICE_OBJECT.Flags */
+typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
+typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
 
-#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_INITIALIZING            0x00000080
-#define DO_SHUTDOWN_REGISTERED            0x00000800
-#define DO_BUS_ENUMERATED_DEVICE          0x00001000
-#define DO_POWER_PAGABLE                  0x00002000
-#define DO_POWER_INRUSH                   0x00004000
+//
+// Privilege sets
+//
+#define PRIVILEGE_SET_ALL_NECESSARY (1)
 
-/* DEVICE_OBJECT.Characteristics */
+typedef struct _PRIVILEGE_SET {
+    ULONG PrivilegeCount;
+    ULONG Control;
+    LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
+} PRIVILEGE_SET,*PPRIVILEGE_SET;
 
-#define FILE_REMOVABLE_MEDIA              0x00000001
-#define FILE_READ_ONLY_DEVICE             0x00000002
-#define FILE_FLOPPY_DISKETTE              0x00000004
-#define FILE_WRITE_ONCE_MEDIA             0x00000008
-#define FILE_REMOTE_DEVICE                0x00000010
-#define FILE_DEVICE_IS_MOUNTED            0x00000020
-#define FILE_VIRTUAL_VOLUME               0x00000040
-#define FILE_AUTOGENERATED_DEVICE_NAME    0x00000080
-#define FILE_DEVICE_SECURE_OPEN           0x00000100
-#define FILE_CHARACTERISTIC_PNP_DEVICE    0x00000800
-#define FILE_CHARACTERISTIC_TS_DEVICE     0x00001000
-#define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
+typedef enum _SECURITY_IMPERSONATION_LEVEL {
+    SecurityAnonymous,
+    SecurityIdentification,
+    SecurityImpersonation,
+    SecurityDelegation
+} SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL;
 
-/* DEVICE_OBJECT.AlignmentRequirement */
+#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
+#define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous
+#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
+#define VALID_IMPERSONATION_LEVEL(Level) (((Level) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((Level) <= SECURITY_MAX_IMPERSONATION_LEVEL))
 
-#define FILE_BYTE_ALIGNMENT             0x00000000
-#define FILE_WORD_ALIGNMENT             0x00000001
-#define FILE_LONG_ALIGNMENT             0x00000003
-#define FILE_QUAD_ALIGNMENT             0x00000007
-#define FILE_OCTA_ALIGNMENT             0x0000000f
-#define FILE_32_BYTE_ALIGNMENT          0x0000001f
-#define FILE_64_BYTE_ALIGNMENT          0x0000003f
-#define FILE_128_BYTE_ALIGNMENT         0x0000007f
-#define FILE_256_BYTE_ALIGNMENT         0x000000ff
-#define FILE_512_BYTE_ALIGNMENT         0x000001ff
+#define SECURITY_DYNAMIC_TRACKING (TRUE)
+#define SECURITY_STATIC_TRACKING (FALSE)
 
-/* DEVICE_OBJECT.DeviceType */
+typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, *PSECURITY_CONTEXT_TRACKING_MODE;
 
-#define DEVICE_TYPE ULONG
+typedef struct _SECURITY_QUALITY_OF_SERVICE {
+    ULONG Length;
+    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+    SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
+    BOOLEAN EffectiveOnly;
+} SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
 
-#define FILE_DEVICE_BEEP                  0x00000001
-#define FILE_DEVICE_CD_ROM                0x00000002
-#define FILE_DEVICE_CD_ROM_FILE_SYSTEM    0x00000003
-#define FILE_DEVICE_CONTROLLER            0x00000004
-#define FILE_DEVICE_DATALINK              0x00000005
-#define FILE_DEVICE_DFS                   0x00000006
-#define FILE_DEVICE_DISK                  0x00000007
-#define FILE_DEVICE_DISK_FILE_SYSTEM      0x00000008
-#define FILE_DEVICE_FILE_SYSTEM           0x00000009
-#define FILE_DEVICE_INPORT_PORT           0x0000000a
-#define FILE_DEVICE_KEYBOARD              0x0000000b
-#define FILE_DEVICE_MAILSLOT              0x0000000c
-#define FILE_DEVICE_MIDI_IN               0x0000000d
-#define FILE_DEVICE_MIDI_OUT              0x0000000e
-#define FILE_DEVICE_MOUSE                 0x0000000f
-#define FILE_DEVICE_MULTI_UNC_PROVIDER    0x00000010
-#define FILE_DEVICE_NAMED_PIPE            0x00000011
-#define FILE_DEVICE_NETWORK               0x00000012
-#define FILE_DEVICE_NETWORK_BROWSER       0x00000013
-#define FILE_DEVICE_NETWORK_FILE_SYSTEM   0x00000014
-#define FILE_DEVICE_NULL                  0x00000015
-#define FILE_DEVICE_PARALLEL_PORT         0x00000016
-#define FILE_DEVICE_PHYSICAL_NETCARD      0x00000017
-#define FILE_DEVICE_PRINTER               0x00000018
-#define FILE_DEVICE_SCANNER               0x00000019
-#define FILE_DEVICE_SERIAL_MOUSE_PORT     0x0000001a
-#define FILE_DEVICE_SERIAL_PORT           0x0000001b
-#define FILE_DEVICE_SCREEN                0x0000001c
-#define FILE_DEVICE_SOUND                 0x0000001d
-#define FILE_DEVICE_STREAMS               0x0000001e
-#define FILE_DEVICE_TAPE                  0x0000001f
-#define FILE_DEVICE_TAPE_FILE_SYSTEM      0x00000020
-#define FILE_DEVICE_TRANSPORT             0x00000021
-#define FILE_DEVICE_UNKNOWN               0x00000022
-#define FILE_DEVICE_VIDEO                 0x00000023
-#define FILE_DEVICE_VIRTUAL_DISK          0x00000024
-#define FILE_DEVICE_WAVE_IN               0x00000025
-#define FILE_DEVICE_WAVE_OUT              0x00000026
-#define FILE_DEVICE_8042_PORT             0x00000027
-#define FILE_DEVICE_NETWORK_REDIRECTOR    0x00000028
-#define FILE_DEVICE_BATTERY               0x00000029
-#define FILE_DEVICE_BUS_EXTENDER          0x0000002a
-#define FILE_DEVICE_MODEM                 0x0000002b
-#define FILE_DEVICE_VDM                   0x0000002c
-#define FILE_DEVICE_MASS_STORAGE          0x0000002d
-#define FILE_DEVICE_SMB                   0x0000002e
-#define FILE_DEVICE_KS                    0x0000002f
-#define FILE_DEVICE_CHANGER               0x00000030
-#define FILE_DEVICE_SMARTCARD             0x00000031
-#define FILE_DEVICE_ACPI                  0x00000032
-#define FILE_DEVICE_DVD                   0x00000033
-#define FILE_DEVICE_FULLSCREEN_VIDEO      0x00000034
-#define FILE_DEVICE_DFS_FILE_SYSTEM       0x00000035
-#define FILE_DEVICE_DFS_VOLUME            0x00000036
-#define FILE_DEVICE_SERENUM               0x00000037
-#define FILE_DEVICE_TERMSRV               0x00000038
-#define FILE_DEVICE_KSEC                  0x00000039
-#define FILE_DEVICE_FIPS                  0x0000003a
-#define FILE_DEVICE_INFINIBAND            0x0000003b
-#define FILE_DEVICE_VMBUS                 0x0000003e
-#define FILE_DEVICE_CRYPT_PROVIDER        0x0000003f
-#define FILE_DEVICE_WPD                   0x00000040
-#define FILE_DEVICE_BLUETOOTH             0x00000041
-#define FILE_DEVICE_MT_COMPOSITE          0x00000042
-#define FILE_DEVICE_MT_TRANSPORT          0x00000043
-#define FILE_DEVICE_BIOMETRIC             0x00000044
-#define FILE_DEVICE_PMI                   0x00000045
+typedef struct _SE_IMPERSONATION_STATE {
+    PACCESS_TOKEN Token;
+    BOOLEAN CopyOnOpen;
+    BOOLEAN EffectiveOnly;
+    SECURITY_IMPERSONATION_LEVEL Level;
+} SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE;
 
-typedef struct _IO_STATUS_BLOCK {
-  _ANONYMOUS_UNION union {
-    NTSTATUS  Status;
-    PVOID  Pointer;
-  } DUMMYUNIONNAME;
-  ULONG_PTR  Information;
-} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
+#define OWNER_SECURITY_INFORMATION       (0x00000001L)
+#define GROUP_SECURITY_INFORMATION       (0x00000002L)
+#define DACL_SECURITY_INFORMATION        (0x00000004L)
+#define SACL_SECURITY_INFORMATION        (0x00000008L)
+#define LABEL_SECURITY_INFORMATION       (0x00000010L)
 
-typedef VOID
-(DDKAPI *PIO_APC_ROUTINE)(
-  IN PVOID ApcContext,
-  IN PIO_STATUS_BLOCK IoStatusBlock,
-  IN ULONG Reserved);
+#define PROTECTED_DACL_SECURITY_INFORMATION     (0x80000000L)
+#define PROTECTED_SACL_SECURITY_INFORMATION     (0x40000000L)
+#define UNPROTECTED_DACL_SECURITY_INFORMATION   (0x20000000L)
+#define UNPROTECTED_SACL_SECURITY_INFORMATION   (0x10000000L)
 
-#define EVENT_INCREMENT                   1
-#define IO_NO_INCREMENT                   0
-#define IO_CD_ROM_INCREMENT               1
-#define IO_DISK_INCREMENT                 1
-#define IO_KEYBOARD_INCREMENT             6
-#define IO_MAILSLOT_INCREMENT             2
-#define IO_MOUSE_INCREMENT                6
-#define IO_NAMED_PIPE_INCREMENT           2
-#define IO_NETWORK_INCREMENT              2
-#define IO_PARALLEL_INCREMENT             1
-#define IO_SERIAL_INCREMENT               2
-#define IO_SOUND_INCREMENT                8
-#define IO_VIDEO_INCREMENT                1
-#define SEMAPHORE_INCREMENT               1
+typedef enum _SECURITY_OPERATION_CODE {
+  SetSecurityDescriptor,
+  QuerySecurityDescriptor,
+  DeleteSecurityDescriptor,
+  AssignSecurityDescriptor
+} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
 
-#define MM_MAXIMUM_DISK_IO_SIZE          (0x10000)
+#define INITIAL_PRIVILEGE_COUNT           3
 
-typedef struct _BOOTDISK_INFORMATION {
-  LONGLONG  BootPartitionOffset;
-  LONGLONG  SystemPartitionOffset;
-  ULONG  BootDeviceSignature;
-  ULONG  SystemDeviceSignature;
-} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
+typedef struct _INITIAL_PRIVILEGE_SET {
+  ULONG  PrivilegeCount;
+  ULONG  Control;
+  LUID_AND_ATTRIBUTES  Privilege[INITIAL_PRIVILEGE_COUNT];
+} INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
 
-typedef struct _BOOTDISK_INFORMATION_EX {
-  LONGLONG  BootPartitionOffset;
-  LONGLONG  SystemPartitionOffset;
-  ULONG  BootDeviceSignature;
-  ULONG  SystemDeviceSignature;
-  GUID  BootDeviceGuid;
-  GUID  SystemDeviceGuid;
-  BOOLEAN  BootDeviceIsGpt;
-  BOOLEAN  SystemDeviceIsGpt;
-} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
+#define SE_MIN_WELL_KNOWN_PRIVILEGE         2
+#define SE_CREATE_TOKEN_PRIVILEGE           2
+#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE     3
+#define SE_LOCK_MEMORY_PRIVILEGE            4
+#define SE_INCREASE_QUOTA_PRIVILEGE         5
+#define SE_MACHINE_ACCOUNT_PRIVILEGE        6
+#define SE_TCB_PRIVILEGE                    7
+#define SE_SECURITY_PRIVILEGE               8
+#define SE_TAKE_OWNERSHIP_PRIVILEGE         9
+#define SE_LOAD_DRIVER_PRIVILEGE            10
+#define SE_SYSTEM_PROFILE_PRIVILEGE         11
+#define SE_SYSTEMTIME_PRIVILEGE             12
+#define SE_PROF_SINGLE_PROCESS_PRIVILEGE    13
+#define SE_INC_BASE_PRIORITY_PRIVILEGE      14
+#define SE_CREATE_PAGEFILE_PRIVILEGE        15
+#define SE_CREATE_PERMANENT_PRIVILEGE       16
+#define SE_BACKUP_PRIVILEGE                 17
+#define SE_RESTORE_PRIVILEGE                18
+#define SE_SHUTDOWN_PRIVILEGE               19
+#define SE_DEBUG_PRIVILEGE                  20
+#define SE_AUDIT_PRIVILEGE                  21
+#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE     22
+#define SE_CHANGE_NOTIFY_PRIVILEGE          23
+#define SE_REMOTE_SHUTDOWN_PRIVILEGE        24
+#define SE_UNDOCK_PRIVILEGE                 25
+#define SE_SYNC_AGENT_PRIVILEGE             26
+#define SE_ENABLE_DELEGATION_PRIVILEGE      27
+#define SE_MANAGE_VOLUME_PRIVILEGE          28
+#define SE_IMPERSONATE_PRIVILEGE            29
+#define SE_CREATE_GLOBAL_PRIVILEGE          30
+#define SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE 31
+#define SE_RELABEL_PRIVILEGE                32
+#define SE_INC_WORKING_SET_PRIVILEGE        33
+#define SE_TIME_ZONE_PRIVILEGE              34
+#define SE_CREATE_SYMBOLIC_LINK_PRIVILEGE   35
+#define SE_MAX_WELL_KNOWN_PRIVILEGE         SE_CREATE_SYMBOLIC_LINK_PRIVILEGE
 
-typedef struct _EISA_MEMORY_TYPE {
-  UCHAR  ReadWrite : 1;
-  UCHAR  Cached : 1;
-  UCHAR  Reserved0 : 1;
-  UCHAR  Type : 2;
-  UCHAR  Shared : 1;
-  UCHAR  Reserved1 : 1;
-  UCHAR  MoreEntries : 1;
-} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
+typedef struct _SECURITY_SUBJECT_CONTEXT {
+  PACCESS_TOKEN  ClientToken;
+  SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel;
+  PACCESS_TOKEN  PrimaryToken;
+  PVOID  ProcessAuditId;
+} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
 
-#include <pshpack1.h>
-typedef struct _EISA_MEMORY_CONFIGURATION {
-  EISA_MEMORY_TYPE  ConfigurationByte;
-  UCHAR  DataSize;
-  USHORT  AddressLowWord;
-  UCHAR  AddressHighByte;
-  USHORT  MemorySize;
-} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
+#include <pshpack4.h>
+typedef struct _ACCESS_STATE {
+  LUID  OperationID;
+  BOOLEAN  SecurityEvaluated;
+  BOOLEAN  GenerateAudit;
+  BOOLEAN  GenerateOnClose;
+  BOOLEAN  PrivilegesAllocated;
+  ULONG  Flags;
+  ACCESS_MASK  RemainingDesiredAccess;
+  ACCESS_MASK  PreviouslyGrantedAccess;
+  ACCESS_MASK  OriginalDesiredAccess;
+  SECURITY_SUBJECT_CONTEXT  SubjectSecurityContext;
+  PSECURITY_DESCRIPTOR  SecurityDescriptor;
+  PVOID  AuxData;
+  union {
+    INITIAL_PRIVILEGE_SET  InitialPrivilegeSet;
+    PRIVILEGE_SET  PrivilegeSet;
+  } Privileges;
+
+  BOOLEAN  AuditPrivileges;
+  UNICODE_STRING  ObjectName;
+  UNICODE_STRING  ObjectTypeName;
+} ACCESS_STATE, *PACCESS_STATE;
 #include <poppack.h>
 
-typedef struct _EISA_IRQ_DESCRIPTOR {
-  UCHAR  Interrupt : 4;
-  UCHAR  Reserved : 1;
-  UCHAR  LevelTriggered : 1;
-  UCHAR  Shared : 1;
-  UCHAR  MoreEntries : 1;
-} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
+/******************************************************************************
+ *                            Configuration Manager Types                     *
+ ******************************************************************************/
 
-typedef struct _EISA_IRQ_CONFIGURATION {
-  EISA_IRQ_DESCRIPTOR  ConfigurationByte;
-  UCHAR  Reserved;
-} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
+//
+// Registry Access Rights
+//
+#define KEY_QUERY_VALUE         (0x0001)
+#define KEY_SET_VALUE           (0x0002)
+#define KEY_CREATE_SUB_KEY      (0x0004)
+#define KEY_ENUMERATE_SUB_KEYS  (0x0008)
+#define KEY_NOTIFY              (0x0010)
+#define KEY_CREATE_LINK         (0x0020)
+#define KEY_WOW64_32KEY         (0x0200)
+#define KEY_WOW64_64KEY         (0x0100)
+#define KEY_WOW64_RES           (0x0300)
 
-typedef struct _DMA_CONFIGURATION_BYTE0 {
-  UCHAR Channel : 3;
-  UCHAR Reserved : 3;
-  UCHAR Shared : 1;
-  UCHAR MoreEntries : 1;
-} DMA_CONFIGURATION_BYTE0;
+#define KEY_READ                ((STANDARD_RIGHTS_READ       |\
+                                  KEY_QUERY_VALUE            |\
+                                  KEY_ENUMERATE_SUB_KEYS     |\
+                                  KEY_NOTIFY)                 \
+                                  &                           \
+                                 (~SYNCHRONIZE))
 
-typedef struct _DMA_CONFIGURATION_BYTE1 {
-  UCHAR  Reserved0 : 2;
-  UCHAR  TransferSize : 2;
-  UCHAR  Timing : 2;
-  UCHAR  Reserved1 : 2;
-} DMA_CONFIGURATION_BYTE1;
+#define KEY_WRITE               ((STANDARD_RIGHTS_WRITE      |\
+                                  KEY_SET_VALUE              |\
+                                  KEY_CREATE_SUB_KEY)         \
+                                  &                           \
+                                 (~SYNCHRONIZE))
 
-typedef struct _EISA_DMA_CONFIGURATION {
-  DMA_CONFIGURATION_BYTE0  ConfigurationByte0;
-  DMA_CONFIGURATION_BYTE1  ConfigurationByte1;
-} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
+#define KEY_EXECUTE             ((KEY_READ)                   \
+                                  &                           \
+                                 (~SYNCHRONIZE))
 
-#include <pshpack1.h>
-typedef struct _EISA_PORT_DESCRIPTOR {
-  UCHAR  NumberPorts : 5;
-  UCHAR  Reserved : 1;
-  UCHAR  Shared : 1;
-  UCHAR  MoreEntries : 1;
-} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
+#define KEY_ALL_ACCESS          ((STANDARD_RIGHTS_ALL        |\
+                                  KEY_QUERY_VALUE            |\
+                                  KEY_SET_VALUE              |\
+                                  KEY_CREATE_SUB_KEY         |\
+                                  KEY_ENUMERATE_SUB_KEYS     |\
+                                  KEY_NOTIFY                 |\
+                                  KEY_CREATE_LINK)            \
+                                  &                           \
+                                 (~SYNCHRONIZE))
 
-typedef struct _EISA_PORT_CONFIGURATION {
-  EISA_PORT_DESCRIPTOR  Configuration;
-  USHORT  PortAddress;
-} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
-#include <poppack.h>
+//
+// Registry Open/Create Options
+//
+#define REG_OPTION_RESERVED         (0x00000000L)
+#define REG_OPTION_NON_VOLATILE     (0x00000000L)
+#define REG_OPTION_VOLATILE         (0x00000001L)
+#define REG_OPTION_CREATE_LINK      (0x00000002L)
+#define REG_OPTION_BACKUP_RESTORE   (0x00000004L)
+#define REG_OPTION_OPEN_LINK        (0x00000008L)
 
-typedef struct _CM_EISA_FUNCTION_INFORMATION {
-  ULONG  CompressedId;
-  UCHAR  IdSlotFlags1;
-  UCHAR  IdSlotFlags2;
-  UCHAR  MinorRevision;
-  UCHAR  MajorRevision;
-  UCHAR  Selections[26];
-  UCHAR  FunctionFlags;
-  UCHAR  TypeString[80];
-  EISA_MEMORY_CONFIGURATION  EisaMemory[9];
-  EISA_IRQ_CONFIGURATION  EisaIrq[7];
-  EISA_DMA_CONFIGURATION  EisaDma[4];
-  EISA_PORT_CONFIGURATION  EisaPort[20];
-  UCHAR  InitializationData[60];
-} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
+#define REG_LEGAL_OPTION            \
+                (REG_OPTION_RESERVED            |\
+                 REG_OPTION_NON_VOLATILE        |\
+                 REG_OPTION_VOLATILE            |\
+                 REG_OPTION_CREATE_LINK         |\
+                 REG_OPTION_BACKUP_RESTORE      |\
+                 REG_OPTION_OPEN_LINK)
 
-/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
+//
+// Key creation/open disposition
+//
+#define REG_CREATED_NEW_KEY         (0x00000001L)
+#define REG_OPENED_EXISTING_KEY     (0x00000002L)
 
-#define EISA_FUNCTION_ENABLED           0x80
-#define EISA_FREE_FORM_DATA             0x40
-#define EISA_HAS_PORT_INIT_ENTRY        0x20
-#define EISA_HAS_PORT_RANGE             0x10
-#define EISA_HAS_DMA_ENTRY              0x08
-#define EISA_HAS_IRQ_ENTRY              0x04
-#define EISA_HAS_MEMORY_ENTRY           0x02
-#define EISA_HAS_TYPE_ENTRY             0x01
-#define EISA_HAS_INFORMATION \
-  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
-  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
+//
+// Key restore & hive load flags
+//
+#define REG_WHOLE_HIVE_VOLATILE         (0x00000001L)
+#define REG_REFRESH_HIVE                (0x00000002L)
+#define REG_NO_LAZY_FLUSH               (0x00000004L)
+#define REG_FORCE_RESTORE               (0x00000008L)
+#define REG_APP_HIVE                    (0x00000010L)
+#define REG_PROCESS_PRIVATE             (0x00000020L)
+#define REG_START_JOURNAL               (0x00000040L)
+#define REG_HIVE_EXACT_FILE_GROWTH      (0x00000080L)
+#define REG_HIVE_NO_RM                  (0x00000100L)
+#define REG_HIVE_SINGLE_LOG             (0x00000200L)
 
-typedef struct _CM_EISA_SLOT_INFORMATION {
-  UCHAR  ReturnCode;
-  UCHAR  ReturnFlags;
-  UCHAR  MajorRevision;
-  UCHAR  MinorRevision;
-  USHORT  Checksum;
-  UCHAR  NumberFunctions;
-  UCHAR  FunctionInformation;
-  ULONG  CompressedId;
-} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
+//
+// Unload Flags
+//
+#define REG_FORCE_UNLOAD            1
 
-/* CM_EISA_SLOT_INFORMATION.ReturnCode */
+//
+// Notify Filter Values
+//
+#define REG_NOTIFY_CHANGE_NAME          (0x00000001L)
+#define REG_NOTIFY_CHANGE_ATTRIBUTES    (0x00000002L)
+#define REG_NOTIFY_CHANGE_LAST_SET      (0x00000004L)
+#define REG_NOTIFY_CHANGE_SECURITY      (0x00000008L)
 
-#define EISA_INVALID_SLOT               0x80
-#define EISA_INVALID_FUNCTION           0x81
-#define EISA_INVALID_CONFIGURATION      0x82
-#define EISA_EMPTY_SLOT                 0x83
-#define EISA_INVALID_BIOS_CALL          0x86
+#define REG_LEGAL_CHANGE_FILTER                 \
+                (REG_NOTIFY_CHANGE_NAME          |\
+                 REG_NOTIFY_CHANGE_ATTRIBUTES    |\
+                 REG_NOTIFY_CHANGE_LAST_SET      |\
+                 REG_NOTIFY_CHANGE_SECURITY)
 
-/*
-** Plug and Play structures
-*/
+typedef struct _CM_FLOPPY_DEVICE_DATA {
+  USHORT  Version;
+  USHORT  Revision;
+  CHAR  Size[8];
+  ULONG  MaxDensity;
+  ULONG  MountDensity;
+  UCHAR  StepRateHeadUnloadTime;
+  UCHAR  HeadLoadTime;
+  UCHAR  MotorOffTime;
+  UCHAR  SectorLengthCode;
+  UCHAR  SectorPerTrack;
+  UCHAR  ReadWriteGapLength;
+  UCHAR  DataTransferLength;
+  UCHAR  FormatGapLength;
+  UCHAR  FormatFillCharacter;
+  UCHAR  HeadSettleTime;
+  UCHAR  MotorSettleTime;
+  UCHAR  MaximumTrackValue;
+  UCHAR  DataTransferRate;
+} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
 
-typedef VOID
-(DDKAPI *PINTERFACE_REFERENCE)(
-  PVOID  Context);
+#include <pshpack4.h>
+typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
+  UCHAR Type;
+  UCHAR ShareDisposition;
+  USHORT Flags;
+  union {
+    struct {
+      PHYSICAL_ADDRESS Start;
+      ULONG Length;
+    } Generic;
+    struct {
+      PHYSICAL_ADDRESS Start;
+      ULONG Length;
+    } Port;
+    struct {
+      ULONG Level;
+      ULONG Vector;
+      KAFFINITY Affinity;
+    } Interrupt;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    struct {
+      __GNU_EXTENSION union {
+        struct {
+          USHORT Reserved;
+          USHORT MessageCount;
+          ULONG Vector;
+          KAFFINITY Affinity;
+        } Raw;
+        struct {
+          ULONG Level;
+          ULONG Vector;
+          KAFFINITY Affinity;
+        } Translated;
+      };
+    } MessageInterrupt;
+#endif
+    struct {
+      PHYSICAL_ADDRESS Start;
+      ULONG Length;
+    } Memory;
+    struct {
+      ULONG Channel;
+      ULONG Port;
+      ULONG Reserved1;
+    } Dma;
+    struct {
+      ULONG Data[3];
+    } DevicePrivate;
+    struct {
+      ULONG Start;
+      ULONG Length;
+      ULONG Reserved;
+    } BusNumber;
+    struct {
+      ULONG DataSize;
+      ULONG Reserved1;
+      ULONG Reserved2;
+    } DeviceSpecificData;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    struct {
+      PHYSICAL_ADDRESS Start;
+      ULONG Length40;
+    } Memory40;
+    struct {
+      PHYSICAL_ADDRESS Start;
+      ULONG Length48;
+    } Memory48;
+    struct {
+      PHYSICAL_ADDRESS Start;
+      ULONG Length64;
+    } Memory64;
+#endif
+  } u;
+} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
+#include <poppack.h>
 
-typedef VOID
-(DDKAPI *PINTERFACE_DEREFERENCE)(
-  PVOID Context);
+#include <pshpack1.h>
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
 
-typedef BOOLEAN
-(DDKAPI *PTRANSLATE_BUS_ADDRESS)(
-  IN PVOID  Context,
-  IN PHYSICAL_ADDRESS  BusAddress,
-  IN ULONG  Length,
-  IN OUT PULONG  AddressSpace,
-  OUT PPHYSICAL_ADDRESS  TranslatedAddress);
+#define CmResourceTypeNull                0
+#define CmResourceTypePort                1
+#define CmResourceTypeInterrupt           2
+#define CmResourceTypeMemory              3
+#define CmResourceTypeDma                 4
+#define CmResourceTypeDeviceSpecific      5
+#define CmResourceTypeBusNumber           6
+#define CmResourceTypeMemoryLarge         7
+#define CmResourceTypeNonArbitrated     128
+#define CmResourceTypeConfigData        128
+#define CmResourceTypeDevicePrivate     129
+#define CmResourceTypePcCardConfig      130
+#define CmResourceTypeMfCardConfig      131
 
-typedef struct _DMA_ADAPTER*
-(DDKAPI *PGET_DMA_ADAPTER)(
-  IN PVOID  Context,
-  IN struct _DEVICE_DESCRIPTION  *DeviceDescriptor,
-  OUT PULONG  NumberOfMapRegisters);
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
 
-typedef ULONG
-(DDKAPI *PGET_SET_DEVICE_DATA)(
-  IN PVOID  Context,
-  IN ULONG  DataType,
-  IN PVOID  Buffer,
-  IN ULONG  Offset,
-  IN ULONG  Length);
+typedef enum _CM_SHARE_DISPOSITION {
+  CmResourceShareUndetermined,
+  CmResourceShareDeviceExclusive,
+  CmResourceShareDriverExclusive,
+  CmResourceShareShared
+} CM_SHARE_DISPOSITION;
 
-/* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
-#define PCI_USE_SUBSYSTEM_IDS   0x00000001
-#define PCI_USE_REVISION        0x00000002
-#define PCI_USE_VENDEV_IDS      0x00000004
-#define PCI_USE_CLASS_SUBCLASS  0x00000008
-#define PCI_USE_PROGIF          0x00000010
-#define PCI_USE_LOCAL_BUS       0x00000020
-#define PCI_USE_LOCAL_DEVICE    0x00000040
-
-typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS {
-  ULONG   Size;
-  ULONG   Flags;
-  USHORT  VendorID;
-  USHORT  DeviceID;
-  UCHAR   RevisionID;
-  USHORT  SubVendorID;
-  USHORT  SubSystemID;
-  UCHAR   BaseClass;
-  UCHAR   SubClass;
-  UCHAR   ProgIf;
-} PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS;
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
 
-typedef BOOLEAN
-(DDKAPI *PPCI_IS_DEVICE_PRESENT)(
-  IN USHORT  VendorID,
-  IN USHORT  DeviceID,
-  IN UCHAR   RevisionID,
-  IN USHORT  SubVendorID,
-  IN USHORT  SubSystemID,
-  IN ULONG   Flags);
+#define CM_RESOURCE_PORT_MEMORY           0x0000
+#define CM_RESOURCE_PORT_IO               0x0001
+#define CM_RESOURCE_PORT_10_BIT_DECODE    0x0004
+#define CM_RESOURCE_PORT_12_BIT_DECODE    0x0008
+#define CM_RESOURCE_PORT_16_BIT_DECODE    0x0010
+#define CM_RESOURCE_PORT_POSITIVE_DECODE  0x0020
+#define CM_RESOURCE_PORT_PASSIVE_DECODE   0x0040
+#define CM_RESOURCE_PORT_WINDOW_DECODE    0x0080
+#define CM_RESOURCE_PORT_BAR              0x0100
 
-typedef BOOLEAN
-(DDKAPI *PPCI_IS_DEVICE_PRESENT_EX)(
-  IN PVOID Context,
-  IN PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
 
-typedef union _POWER_STATE {
-  SYSTEM_POWER_STATE  SystemState;
-  DEVICE_POWER_STATE  DeviceState;
-} POWER_STATE, *PPOWER_STATE;
+#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
+#define CM_RESOURCE_INTERRUPT_LATCHED         0x0001
+#define CM_RESOURCE_INTERRUPT_MESSAGE         0x0002
+#define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 0x0004
 
-typedef enum _POWER_STATE_TYPE {
-  SystemPowerState = 0,
-  DevicePowerState
-} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
 
-typedef struct _BUS_INTERFACE_STANDARD {
-  USHORT  Size;
-  USHORT  Version;
-  PVOID  Context;
-  PINTERFACE_REFERENCE  InterfaceReference;
-  PINTERFACE_DEREFERENCE  InterfaceDereference;
-  PTRANSLATE_BUS_ADDRESS  TranslateBusAddress;
-  PGET_DMA_ADAPTER  GetDmaAdapter;
-  PGET_SET_DEVICE_DATA  SetBusData;
-  PGET_SET_DEVICE_DATA  GetBusData;
-} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
+#define CM_RESOURCE_MEMORY_READ_WRITE                    0x0000
+#define CM_RESOURCE_MEMORY_READ_ONLY                     0x0001
+#define CM_RESOURCE_MEMORY_WRITE_ONLY                    0x0002
+#define CM_RESOURCE_MEMORY_WRITEABILITY_MASK             0x0003
+#define CM_RESOURCE_MEMORY_PREFETCHABLE                  0x0004
+#define CM_RESOURCE_MEMORY_COMBINEDWRITE                 0x0008
+#define CM_RESOURCE_MEMORY_24                            0x0010
+#define CM_RESOURCE_MEMORY_CACHEABLE                     0x0020
+#define CM_RESOURCE_MEMORY_WINDOW_DECODE                 0x0040
+#define CM_RESOURCE_MEMORY_BAR                           0x0080
+#define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE 0x0100
 
-typedef struct _PCI_DEVICE_PRESENT_INTERFACE {
-  USHORT  Size;
-  USHORT  Version;
-  PVOID  Context;
-  PINTERFACE_REFERENCE  InterfaceReference;
-  PINTERFACE_DEREFERENCE  InterfaceDereference;
-  PPCI_IS_DEVICE_PRESENT  IsDevicePresent;
-  PPCI_IS_DEVICE_PRESENT_EX  IsDevicePresentEx;
-} PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE;
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
 
-typedef struct _DEVICE_CAPABILITIES {
-  USHORT  Size;
-  USHORT  Version;
-  ULONG  DeviceD1 : 1;
-  ULONG  DeviceD2 : 1;
-  ULONG  LockSupported : 1;
-  ULONG  EjectSupported : 1;
-  ULONG  Removable : 1;
-  ULONG  DockDevice : 1;
-  ULONG  UniqueID : 1;
-  ULONG  SilentInstall : 1;
-  ULONG  RawDeviceOK : 1;
-  ULONG  SurpriseRemovalOK : 1;
-  ULONG  WakeFromD0 : 1;
-  ULONG  WakeFromD1 : 1;
-  ULONG  WakeFromD2 : 1;
-  ULONG  WakeFromD3 : 1;
-  ULONG  HardwareDisabled : 1;
-  ULONG  NonDynamic : 1;
-  ULONG  WarmEjectSupported : 1;
-  ULONG  NoDisplayInUI : 1;
-  ULONG  Reserved : 14;
-  ULONG  Address;
-  ULONG  UINumber;
-  DEVICE_POWER_STATE  DeviceState[PowerSystemMaximum];
-  SYSTEM_POWER_STATE  SystemWake;
-  DEVICE_POWER_STATE  DeviceWake;
-  ULONG  D1Latency;
-  ULONG  D2Latency;
-  ULONG  D3Latency;
-} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
+#define CM_RESOURCE_DMA_8                 0x0000
+#define CM_RESOURCE_DMA_16                0x0001
+#define CM_RESOURCE_DMA_32                0x0002
+#define CM_RESOURCE_DMA_8_AND_16          0x0004
+#define CM_RESOURCE_DMA_BUS_MASTER        0x0008
+#define CM_RESOURCE_DMA_TYPE_A            0x0010
+#define CM_RESOURCE_DMA_TYPE_B            0x0020
+#define CM_RESOURCE_DMA_TYPE_F            0x0040
 
-typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
+typedef struct _CM_PARTIAL_RESOURCE_LIST {
   USHORT  Version;
-  USHORT  Size;
-  GUID  Event;
-  GUID  InterfaceClassGuid;
-  PUNICODE_STRING  SymbolicLinkName;
-} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
+  USHORT  Revision;
+  ULONG  Count;
+  CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
+} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
 
-typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
-  USHORT  Version;
-  USHORT  Size;
-  GUID  Event;
-} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
+typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
+  INTERFACE_TYPE  InterfaceType;
+  ULONG  BusNumber;
+  CM_PARTIAL_RESOURCE_LIST  PartialResourceList;
+} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
 
-#undef INTERFACE
+typedef struct _CM_RESOURCE_LIST {
+  ULONG  Count;
+  CM_FULL_RESOURCE_DESCRIPTOR  List[1];
+} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
 
-typedef struct _INTERFACE {
-  USHORT  Size;
-  USHORT  Version;
-  PVOID  Context;
-  PINTERFACE_REFERENCE  InterfaceReference;
-  PINTERFACE_DEREFERENCE  InterfaceDereference;
-} INTERFACE, *PINTERFACE;
+typedef struct _CM_INT13_DRIVE_PARAMETER {
+  USHORT  DriveSelect;
+  ULONG  MaxCylinders;
+  USHORT  SectorsPerTrack;
+  USHORT  MaxHeads;
+  USHORT  NumberDrives;
+} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
 
-typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
-  USHORT  Version;
-  USHORT  Size;
-  GUID  Event;
-} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
+typedef struct _CM_PNP_BIOS_DEVICE_NODE
+{
+    USHORT Size;
+    UCHAR Node;
+    ULONG ProductId;
+    UCHAR DeviceType[3];
+    USHORT DeviceAttributes;
+} CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE;
 
-typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
+typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK
+{
+    UCHAR Signature[4];
+    UCHAR Revision;
+    UCHAR Length;
+    USHORT ControlField;
+    UCHAR Checksum;
+    ULONG EventFlagAddress;
+    USHORT RealModeEntryOffset;
+    USHORT RealModeEntrySegment;
+    USHORT ProtectedModeEntryOffset;
+    ULONG ProtectedModeCodeBaseAddress;
+    ULONG OemDeviceId;
+    USHORT RealModeDataBaseAddress;
+    ULONG ProtectedModeDataBaseAddress;
+} CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
 
-/* PNP_DEVICE_STATE */
+#include <poppack.h>
 
-#define PNP_DEVICE_DISABLED                      0x00000001
-#define PNP_DEVICE_DONT_DISPLAY_IN_UI            0x00000002
-#define PNP_DEVICE_FAILED                        0x00000004
-#define PNP_DEVICE_REMOVED                       0x00000008
-#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
-#define PNP_DEVICE_NOT_DISABLEABLE               0x00000020
+typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
+{
+    ULONG BytesPerSector;
+    ULONG NumberOfCylinders;
+    ULONG SectorsPerTrack;
+    ULONG NumberOfHeads;
+} CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
 
-typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
+typedef struct _CM_KEYBOARD_DEVICE_DATA {
   USHORT  Version;
-  USHORT  Size;
-  GUID  Event;
-  struct _FILE_OBJECT  *FileObject;
-  LONG  NameBufferOffset;
-  UCHAR  CustomDataBuffer[1];
-} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
+  USHORT  Revision;
+  UCHAR  Type;
+  UCHAR  Subtype;
+  USHORT  KeyboardFlags;
+} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
 
-typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
-  USHORT  Version;
-  USHORT  Size;
-  GUID  Event;
-  struct _FILE_OBJECT  *FileObject;
-} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
+typedef struct _CM_MCA_POS_DATA {
+  USHORT  AdapterId;
+  UCHAR  PosData1;
+  UCHAR  PosData2;
+  UCHAR  PosData3;
+  UCHAR  PosData4;
+} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
 
-typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
-  DeviceUsageTypeUndefined,
-  DeviceUsageTypePaging,
-  DeviceUsageTypeHibernation,
-  DeviceUsageTypeDumpFile
-} DEVICE_USAGE_NOTIFICATION_TYPE;
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+typedef struct CM_Power_Data_s {
+  ULONG  PD_Size;
+  DEVICE_POWER_STATE  PD_MostRecentPowerState;
+  ULONG  PD_Capabilities;
+  ULONG  PD_D1Latency;
+  ULONG  PD_D2Latency;
+  ULONG  PD_D3Latency;
+  DEVICE_POWER_STATE  PD_PowerStateMapping[PowerSystemMaximum];
+  SYSTEM_POWER_STATE  PD_DeepestSystemWake;
+} CM_POWER_DATA, *PCM_POWER_DATA;
 
-typedef struct _POWER_SEQUENCE {
-  ULONG  SequenceD1;
-  ULONG  SequenceD2;
-  ULONG  SequenceD3;
-} POWER_SEQUENCE, *PPOWER_SEQUENCE;
-
-typedef enum {
-  DevicePropertyDeviceDescription = 0x0,
-  DevicePropertyHardwareID = 0x1,
-  DevicePropertyCompatibleIDs = 0x2,
-  DevicePropertyBootConfiguration = 0x3,
-  DevicePropertyBootConfigurationTranslated = 0x4,
-  DevicePropertyClassName = 0x5,
-  DevicePropertyClassGuid = 0x6,
-  DevicePropertyDriverKeyName = 0x7,
-  DevicePropertyManufacturer = 0x8,
-  DevicePropertyFriendlyName = 0x9,
-  DevicePropertyLocationInformation = 0xa,
-  DevicePropertyPhysicalDeviceObjectName = 0xb,
-  DevicePropertyBusTypeGuid = 0xc,
-  DevicePropertyLegacyBusType = 0xd,
-  DevicePropertyBusNumber = 0xe,
-  DevicePropertyEnumeratorName = 0xf,
-  DevicePropertyAddress = 0x10,
-  DevicePropertyUINumber = 0x11,
-  DevicePropertyInstallState = 0x12,
-  DevicePropertyRemovalPolicy = 0x13,
-  DevicePropertyResourceRequirements = 0x14,
-  DevicePropertyAllocatedResources = 0x15,
-  DevicePropertyContainerID = 0x16
-} DEVICE_REGISTRY_PROPERTY;
-
-typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
-  EventCategoryReserved,
-  EventCategoryHardwareProfileChange,
-  EventCategoryDeviceInterfaceChange,
-  EventCategoryTargetDeviceChange
-} IO_NOTIFICATION_EVENT_CATEGORY;
-
-#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES    0x00000001
+#define PDCAP_D0_SUPPORTED                0x00000001
+#define PDCAP_D1_SUPPORTED                0x00000002
+#define PDCAP_D2_SUPPORTED                0x00000004
+#define PDCAP_D3_SUPPORTED                0x00000008
+#define PDCAP_WAKE_FROM_D0_SUPPORTED      0x00000010
+#define PDCAP_WAKE_FROM_D1_SUPPORTED      0x00000020
+#define PDCAP_WAKE_FROM_D2_SUPPORTED      0x00000040
+#define PDCAP_WAKE_FROM_D3_SUPPORTED      0x00000080
+#define PDCAP_WARM_EJECT_SUPPORTED        0x00000100
 
-typedef NTSTATUS
-(DDKAPI *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
-  IN PVOID NotificationStructure,
-  IN PVOID Context);
+#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
 
-typedef VOID
-(DDKAPI *PDEVICE_CHANGE_COMPLETE_CALLBACK)(
-  IN PVOID Context);
+typedef struct _CM_SCSI_DEVICE_DATA {
+  USHORT  Version;
+  USHORT  Revision;
+  UCHAR  HostIdentifier;
+} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
 
-typedef enum _FILE_INFORMATION_CLASS {
-  FileDirectoryInformation = 1,
-  FileFullDirectoryInformation,
-  FileBothDirectoryInformation,
-  FileBasicInformation,
-  FileStandardInformation,
-  FileInternalInformation,
-  FileEaInformation,
-  FileAccessInformation,
-  FileNameInformation,
-  FileRenameInformation,
-  FileLinkInformation,
-  FileNamesInformation,
-  FileDispositionInformation,
-  FilePositionInformation,
-  FileFullEaInformation,
-  FileModeInformation,
-  FileAlignmentInformation,
-  FileAllInformation,
-  FileAllocationInformation,
-  FileEndOfFileInformation,
-  FileAlternateNameInformation,
-  FileStreamInformation,
-  FilePipeInformation,
-  FilePipeLocalInformation,
-  FilePipeRemoteInformation,
-  FileMailslotQueryInformation,
-  FileMailslotSetInformation,
-  FileCompressionInformation,
-  FileObjectIdInformation,
-  FileCompletionInformation,
-  FileMoveClusterInformation,
-  FileQuotaInformation,
-  FileReparsePointInformation,
-  FileNetworkOpenInformation,
-  FileAttributeTagInformation,
-  FileTrackingInformation,
-  FileIdBothDirectoryInformation,
-  FileIdFullDirectoryInformation,
-  FileValidDataLengthInformation,
-  FileShortNameInformation,
-  FileIoCompletionNotificationInformation,
-  FileIoStatusBlockRangeInformation,
-  FileIoPriorityHintInformation,
-  FileSfioReserveInformation,
-  FileSfioVolumeInformation,
-  FileHardLinkInformation,
-  FileProcessIdsUsingFileInformation,
-  FileNormalizedNameInformation,
-  FileNetworkPhysicalNameInformation,
-  FileIdGlobalTxDirectoryInformation,
-  FileIsRemoteDeviceInformation,
-  FileAttributeCacheInformation,
-  FileNumaNodeInformation,
-  FileStandardLinkInformation,
-  FileRemoteProtocolInformation,
-  FileMaximumInformation
-} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
+typedef struct _CM_SERIAL_DEVICE_DATA {
+  USHORT  Version;
+  USHORT  Revision;
+  ULONG  BaudClock;
+} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
 
-typedef struct _FILE_POSITION_INFORMATION {
-  LARGE_INTEGER  CurrentByteOffset;
-} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
+typedef enum _KEY_INFORMATION_CLASS {
+  KeyBasicInformation,
+  KeyNodeInformation,
+  KeyFullInformation,
+  KeyNameInformation,
+  KeyCachedInformation,
+  KeyFlagsInformation
+} KEY_INFORMATION_CLASS;
 
-#include <pshpack8.h>
-typedef struct _FILE_BASIC_INFORMATION {
-  LARGE_INTEGER  CreationTime;
-  LARGE_INTEGER  LastAccessTime;
+typedef struct _KEY_BASIC_INFORMATION {
   LARGE_INTEGER  LastWriteTime;
-  LARGE_INTEGER  ChangeTime;
-  ULONG  FileAttributes;
-} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
-#include <poppack.h>
-
-typedef struct _FILE_STANDARD_INFORMATION {
-  LARGE_INTEGER  AllocationSize;
-  LARGE_INTEGER  EndOfFile;
-  ULONG  NumberOfLinks;
-  BOOLEAN  DeletePending;
-  BOOLEAN  Directory;
-} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
+  ULONG  TitleIndex;
+  ULONG  NameLength;
+  WCHAR  Name[1];
+} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
 
-typedef struct _FILE_NETWORK_OPEN_INFORMATION {
-  LARGE_INTEGER  CreationTime;
-  LARGE_INTEGER  LastAccessTime;
+typedef struct _KEY_FULL_INFORMATION {
   LARGE_INTEGER  LastWriteTime;
-  LARGE_INTEGER  ChangeTime;
-  LARGE_INTEGER  AllocationSize;
-  LARGE_INTEGER  EndOfFile;
-  ULONG  FileAttributes;
-} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
+  ULONG  TitleIndex;
+  ULONG  ClassOffset;
+  ULONG  ClassLength;
+  ULONG  SubKeys;
+  ULONG  MaxNameLen;
+  ULONG  MaxClassLen;
+  ULONG  Values;
+  ULONG  MaxValueNameLen;
+  ULONG  MaxValueDataLen;
+  WCHAR  Class[1];
+} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
+
+typedef struct _KEY_NODE_INFORMATION {
+  LARGE_INTEGER  LastWriteTime;
+  ULONG  TitleIndex;
+  ULONG  ClassOffset;
+  ULONG  ClassLength;
+  ULONG  NameLength;
+  WCHAR  Name[1];
+} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
+
+typedef struct _KEY_VALUE_BASIC_INFORMATION {
+  ULONG  TitleIndex;
+  ULONG  Type;
+  ULONG  NameLength;
+  WCHAR  Name[1];
+} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
+
+typedef struct _KEY_VALUE_FULL_INFORMATION {
+  ULONG  TitleIndex;
+  ULONG  Type;
+  ULONG  DataOffset;
+  ULONG  DataLength;
+  ULONG  NameLength;
+  WCHAR  Name[1];
+} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
+
+typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
+  ULONG  TitleIndex;
+  ULONG  Type;
+  ULONG  DataLength;
+  UCHAR  Data[1];
+} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
+
+typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
+  ULONG  Type;
+  ULONG  DataLength;
+  UCHAR  Data[1];
+} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
+
+typedef struct _KEY_VALUE_ENTRY {
+  PUNICODE_STRING  ValueName;
+  ULONG  DataLength;
+  ULONG  DataOffset;
+  ULONG  Type;
+} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
+
+typedef enum _KEY_VALUE_INFORMATION_CLASS {
+  KeyValueBasicInformation,
+  KeyValueFullInformation,
+  KeyValuePartialInformation,
+  KeyValueFullInformationAlign64,
+  KeyValuePartialInformationAlign64
+} KEY_VALUE_INFORMATION_CLASS;
+
+typedef struct _KEY_WRITE_TIME_INFORMATION {
+  LARGE_INTEGER  LastWriteTime;
+} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
+
+typedef enum _KEY_SET_INFORMATION_CLASS {
+  KeyWriteTimeInformation,
+  KeyWow64FlagsInformation,
+  KeyControlFlagsInformation,
+  KeySetVirtualizationInformation,
+  KeySetDebugInformation,
+  KeySetHandleTagsInformation,
+  MaxKeySetInfoClass
+} KEY_SET_INFORMATION_CLASS;
 
-typedef enum _FSINFOCLASS {
-  FileFsVolumeInformation = 1,
-  FileFsLabelInformation,
-  FileFsSizeInformation,
-  FileFsDeviceInformation,
-  FileFsAttributeInformation,
-  FileFsControlInformation,
-  FileFsFullSizeInformation,
-  FileFsObjectIdInformation,
-  FileFsDriverPathInformation,
-  FileFsVolumeFlagsInformation,
-  FileFsMaximumInformation
-} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
+/******************************************************************************
+ *                         I/O Manager Functions                              *
+ ******************************************************************************/
 
-typedef struct _FILE_FS_DEVICE_INFORMATION {
-  DEVICE_TYPE  DeviceType;
-  ULONG  Characteristics;
-} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
+#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && \
+   (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
 
-typedef struct _FILE_FULL_EA_INFORMATION {
-  ULONG  NextEntryOffset;
-  UCHAR  Flags;
-  UCHAR  EaNameLength;
-  USHORT  EaValueLength;
-  CHAR  EaName[1];
-} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
+#define DMA_MACROS_DEFINED
 
-typedef struct _FAST_MUTEX
+FORCEINLINE
+NTSTATUS
+IoAllocateAdapterChannel(
+    IN PADAPTER_OBJECT AdapterObject,
+    IN PDEVICE_OBJECT DeviceObject,
+    IN ULONG NumberOfMapRegisters,
+    IN PDRIVER_CONTROL ExecutionRoutine,
+    IN PVOID Context)
 {
-    LONG Count;
-    PKTHREAD Owner;
-    ULONG Contention;
-    KEVENT Gate;
-    ULONG OldIrql;
-} FAST_MUTEX, *PFAST_MUTEX;
+    PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
+    AllocateAdapterChannel =
+        *(DmaAdapter)->DmaOperations->AllocateAdapterChannel;
+    ASSERT(AllocateAdapterChannel);
+    return AllocateAdapterChannel(DmaAdapter,
+                                  DeviceObject,
+                                  NumberOfMapRegisters,
+                                  ExecutionRoutine,
+                                  Context );
+}
 
-typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
+FORCEINLINE
+BOOLEAN
+IoFlushAdapterBuffers(
+    IN PADAPTER_OBJECT AdapterObject,
+    IN PMDL Mdl,
+    IN PVOID MapRegisterBase,
+    IN PVOID CurrentVa,
+    IN ULONG Length,
+    IN BOOLEAN WriteToDevice)
+{
+    PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
+    FlushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers;
+    ASSERT(FlushAdapterBuffers);
+    return FlushAdapterBuffers(DmaAdapter,
+                               Mdl,
+                               MapRegisterBase,
+                               CurrentVa,
+                               Length,
+                               WriteToDevice );
+}
 
-typedef struct _OWNER_ENTRY {
-    ERESOURCE_THREAD OwnerThread;
-    _ANONYMOUS_UNION union {
-        LONG OwnerCount;
-        ULONG TableSize;
-    } DUMMYUNIONNAME;
-} OWNER_ENTRY, *POWNER_ENTRY;
+FORCEINLINE
+VOID
+IoFreeAdapterChannel(
+    IN PADAPTER_OBJECT AdapterObject)
+{
+    PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
+    FreeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel;
+    ASSERT(FreeAdapterChannel);
+    FreeAdapterChannel(DmaAdapter);
+}
 
-typedef struct _ERESOURCE
+FORCEINLINE
+VOID
+IoFreeMapRegisters(
+    IN PADAPTER_OBJECT AdapterObject,
+    IN PVOID MapRegisterBase,
+    IN ULONG NumberOfMapRegisters)
 {
-    LIST_ENTRY SystemResourcesList;
-    POWNER_ENTRY OwnerTable;
-    SHORT ActiveCount;
-    USHORT Flag;
-    volatile PKSEMAPHORE SharedWaiters;
-    volatile PKEVENT ExclusiveWaiters;
-    OWNER_ENTRY OwnerEntry;
-    ULONG ActiveEntries;
-    ULONG ContentionCount;
-    ULONG NumberOfSharedWaiters;
-    ULONG NumberOfExclusiveWaiters;
-    __GNU_EXTENSION union
-    {
-        PVOID Address;
-        ULONG_PTR CreatorBackTraceIndex;
-    };
-    KSPIN_LOCK SpinLock;
-} ERESOURCE, *PERESOURCE;
+    PFREE_MAP_REGISTERS FreeMapRegisters;
+    FreeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters;
+    ASSERT(FreeMapRegisters);
+    FreeMapRegisters(DmaAdapter, MapRegisterBase, NumberOfMapRegisters);
+}
 
-/* ERESOURCE.Flag */
+FORCEINLINE
+PHYSICAL_ADDRESS
+IoMapTransfer(
+    IN PDMA_ADAPTER DmaAdapter,
+    IN PMDL Mdl,
+    IN PVOID MapRegisterBase,
+    IN PVOID CurrentVa,
+    IN OUT PULONG Length,
+    IN BOOLEAN WriteToDevice)
+{
+    PMAP_TRANSFER MapTransfer;
 
-#define ResourceNeverExclusive            0x0010
-#define ResourceReleaseByOtherThread      0x0020
-#define ResourceOwnedExclusive            0x0080
+    MapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer;
+    ASSERT(MapTransfer);
+    return MapTransfer(DmaAdapter,
+                       Mdl,
+                       MapRegisterBase,
+                       CurrentVa,
+                       Length,
+                       WriteToDevice);
+}
+#endif
 
-#define RESOURCE_HASH_TABLE_SIZE          64
+#define IO_TYPE_ADAPTER                 1
+#define IO_TYPE_CONTROLLER              2
+#define IO_TYPE_DEVICE                  3
+#define IO_TYPE_DRIVER                  4
+#define IO_TYPE_FILE                    5
+#define IO_TYPE_IRP                     6
+#define IO_TYPE_MASTER_ADAPTER          7
+#define IO_TYPE_OPEN_PACKET             8
+#define IO_TYPE_TIMER                   9
+#define IO_TYPE_VPB                     10
+#define IO_TYPE_ERROR_LOG               11
+#define IO_TYPE_ERROR_MESSAGE           12
+#define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
+
+#define IO_TYPE_CSQ_IRP_CONTEXT 1
+#define IO_TYPE_CSQ 2
+#define IO_TYPE_CSQ_EX 3
 
-typedef BOOLEAN
-(DDKAPI *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);
+/* IO_RESOURCE_DESCRIPTOR.Option */
 
-typedef BOOLEAN
-(DDKAPI *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);
+#define IO_RESOURCE_PREFERRED             0x01
+#define IO_RESOURCE_DEFAULT               0x02
+#define IO_RESOURCE_ALTERNATIVE           0x08
 
-typedef BOOLEAN
-(DDKAPI *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);
+/* DEVICE_OBJECT.Flags */
 
-typedef BOOLEAN
-(DDKAPI *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);
+#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_INITIALIZING            0x00000080
+#define DO_SHUTDOWN_REGISTERED            0x00000800
+#define DO_BUS_ENUMERATED_DEVICE          0x00001000
+#define DO_POWER_PAGABLE                  0x00002000
+#define DO_POWER_INRUSH                   0x00004000
 
-typedef BOOLEAN
-(DDKAPI *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);
+/* DEVICE_OBJECT.Characteristics */
 
-typedef BOOLEAN
-(DDKAPI *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);
+#define FILE_REMOVABLE_MEDIA              0x00000001
+#define FILE_READ_ONLY_DEVICE             0x00000002
+#define FILE_FLOPPY_DISKETTE              0x00000004
+#define FILE_WRITE_ONCE_MEDIA             0x00000008
+#define FILE_REMOTE_DEVICE                0x00000010
+#define FILE_DEVICE_IS_MOUNTED            0x00000020
+#define FILE_VIRTUAL_VOLUME               0x00000040
+#define FILE_AUTOGENERATED_DEVICE_NAME    0x00000080
+#define FILE_DEVICE_SECURE_OPEN           0x00000100
+#define FILE_CHARACTERISTIC_PNP_DEVICE    0x00000800
+#define FILE_CHARACTERISTIC_TS_DEVICE     0x00001000
+#define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
 
-typedef BOOLEAN
-(DDKAPI *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);
+/* DEVICE_OBJECT.AlignmentRequirement */
 
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_UNLOCK_ALL)(
-  IN struct _FILE_OBJECT  *FileObject,
-  PEPROCESS  ProcessId,
-  OUT PIO_STATUS_BLOCK  IoStatus,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+#define FILE_BYTE_ALIGNMENT             0x00000000
+#define FILE_WORD_ALIGNMENT             0x00000001
+#define FILE_LONG_ALIGNMENT             0x00000003
+#define FILE_QUAD_ALIGNMENT             0x00000007
+#define FILE_OCTA_ALIGNMENT             0x0000000f
+#define FILE_32_BYTE_ALIGNMENT          0x0000001f
+#define FILE_64_BYTE_ALIGNMENT          0x0000003f
+#define FILE_128_BYTE_ALIGNMENT         0x0000007f
+#define FILE_256_BYTE_ALIGNMENT         0x000000ff
+#define FILE_512_BYTE_ALIGNMENT         0x000001ff
 
-typedef BOOLEAN
-(DDKAPI *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);
+/* DEVICE_OBJECT.DeviceType */
 
-typedef BOOLEAN
-(DDKAPI *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 DEVICE_TYPE ULONG
 
-typedef VOID
-(DDKAPI *PFAST_IO_ACQUIRE_FILE)(
-  IN struct _FILE_OBJECT  *FileObject);
+#define FILE_DEVICE_BEEP                  0x00000001
+#define FILE_DEVICE_CD_ROM                0x00000002
+#define FILE_DEVICE_CD_ROM_FILE_SYSTEM    0x00000003
+#define FILE_DEVICE_CONTROLLER            0x00000004
+#define FILE_DEVICE_DATALINK              0x00000005
+#define FILE_DEVICE_DFS                   0x00000006
+#define FILE_DEVICE_DISK                  0x00000007
+#define FILE_DEVICE_DISK_FILE_SYSTEM      0x00000008
+#define FILE_DEVICE_FILE_SYSTEM           0x00000009
+#define FILE_DEVICE_INPORT_PORT           0x0000000a
+#define FILE_DEVICE_KEYBOARD              0x0000000b
+#define FILE_DEVICE_MAILSLOT              0x0000000c
+#define FILE_DEVICE_MIDI_IN               0x0000000d
+#define FILE_DEVICE_MIDI_OUT              0x0000000e
+#define FILE_DEVICE_MOUSE                 0x0000000f
+#define FILE_DEVICE_MULTI_UNC_PROVIDER    0x00000010
+#define FILE_DEVICE_NAMED_PIPE            0x00000011
+#define FILE_DEVICE_NETWORK               0x00000012
+#define FILE_DEVICE_NETWORK_BROWSER       0x00000013
+#define FILE_DEVICE_NETWORK_FILE_SYSTEM   0x00000014
+#define FILE_DEVICE_NULL                  0x00000015
+#define FILE_DEVICE_PARALLEL_PORT         0x00000016
+#define FILE_DEVICE_PHYSICAL_NETCARD      0x00000017
+#define FILE_DEVICE_PRINTER               0x00000018
+#define FILE_DEVICE_SCANNER               0x00000019
+#define FILE_DEVICE_SERIAL_MOUSE_PORT     0x0000001a
+#define FILE_DEVICE_SERIAL_PORT           0x0000001b
+#define FILE_DEVICE_SCREEN                0x0000001c
+#define FILE_DEVICE_SOUND                 0x0000001d
+#define FILE_DEVICE_STREAMS               0x0000001e
+#define FILE_DEVICE_TAPE                  0x0000001f
+#define FILE_DEVICE_TAPE_FILE_SYSTEM      0x00000020
+#define FILE_DEVICE_TRANSPORT             0x00000021
+#define FILE_DEVICE_UNKNOWN               0x00000022
+#define FILE_DEVICE_VIDEO                 0x00000023
+#define FILE_DEVICE_VIRTUAL_DISK          0x00000024
+#define FILE_DEVICE_WAVE_IN               0x00000025
+#define FILE_DEVICE_WAVE_OUT              0x00000026
+#define FILE_DEVICE_8042_PORT             0x00000027
+#define FILE_DEVICE_NETWORK_REDIRECTOR    0x00000028
+#define FILE_DEVICE_BATTERY               0x00000029
+#define FILE_DEVICE_BUS_EXTENDER          0x0000002a
+#define FILE_DEVICE_MODEM                 0x0000002b
+#define FILE_DEVICE_VDM                   0x0000002c
+#define FILE_DEVICE_MASS_STORAGE          0x0000002d
+#define FILE_DEVICE_SMB                   0x0000002e
+#define FILE_DEVICE_KS                    0x0000002f
+#define FILE_DEVICE_CHANGER               0x00000030
+#define FILE_DEVICE_SMARTCARD             0x00000031
+#define FILE_DEVICE_ACPI                  0x00000032
+#define FILE_DEVICE_DVD                   0x00000033
+#define FILE_DEVICE_FULLSCREEN_VIDEO      0x00000034
+#define FILE_DEVICE_DFS_FILE_SYSTEM       0x00000035
+#define FILE_DEVICE_DFS_VOLUME            0x00000036
+#define FILE_DEVICE_SERENUM               0x00000037
+#define FILE_DEVICE_TERMSRV               0x00000038
+#define FILE_DEVICE_KSEC                  0x00000039
+#define FILE_DEVICE_FIPS                  0x0000003a
+#define FILE_DEVICE_INFINIBAND            0x0000003b
+#define FILE_DEVICE_VMBUS                 0x0000003e
+#define FILE_DEVICE_CRYPT_PROVIDER        0x0000003f
+#define FILE_DEVICE_WPD                   0x00000040
+#define FILE_DEVICE_BLUETOOTH             0x00000041
+#define FILE_DEVICE_MT_COMPOSITE          0x00000042
+#define FILE_DEVICE_MT_TRANSPORT          0x00000043
+#define FILE_DEVICE_BIOMETRIC             0x00000044
+#define FILE_DEVICE_PMI                   0x00000045
 
-typedef VOID
-(DDKAPI *PFAST_IO_RELEASE_FILE)(
-  IN struct _FILE_OBJECT  *FileObject);
+typedef struct _IO_STATUS_BLOCK {
+  _ANONYMOUS_UNION union {
+    NTSTATUS  Status;
+    PVOID  Pointer;
+  } DUMMYUNIONNAME;
+  ULONG_PTR  Information;
+} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
 
 typedef VOID
-(DDKAPI *PFAST_IO_DETACH_DEVICE)(
-  IN struct _DEVICE_OBJECT  *SourceDevice,
-  IN struct _DEVICE_OBJECT  *TargetDevice);
-
-typedef BOOLEAN
-(DDKAPI *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);
-
-typedef NTSTATUS
-(DDKAPI *PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN PLARGE_INTEGER  EndingOffset,
-  OUT struct _ERESOURCE  **ResourceToRelease,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+(DDKAPI *PIO_APC_ROUTINE)(
+  IN PVOID ApcContext,
+  IN PIO_STATUS_BLOCK IoStatusBlock,
+  IN ULONG Reserved);
 
-typedef BOOLEAN
-(DDKAPI *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);
+#define EVENT_INCREMENT                   1
+#define IO_NO_INCREMENT                   0
+#define IO_CD_ROM_INCREMENT               1
+#define IO_DISK_INCREMENT                 1
+#define IO_KEYBOARD_INCREMENT             6
+#define IO_MAILSLOT_INCREMENT             2
+#define IO_MOUSE_INCREMENT                6
+#define IO_NAMED_PIPE_INCREMENT           2
+#define IO_NETWORK_INCREMENT              2
+#define IO_PARALLEL_INCREMENT             1
+#define IO_SERIAL_INCREMENT               2
+#define IO_SOUND_INCREMENT                8
+#define IO_VIDEO_INCREMENT                1
+#define SEMAPHORE_INCREMENT               1
 
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_MDL_READ_COMPLETE)(
-  IN struct _FILE_OBJECT *FileObject,
-  IN PMDL MdlChain,
-  IN struct _DEVICE_OBJECT *DeviceObject);
+#define MM_MAXIMUM_DISK_IO_SIZE          (0x10000)
 
-typedef BOOLEAN
-(DDKAPI *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 struct _BOOTDISK_INFORMATION {
+  LONGLONG  BootPartitionOffset;
+  LONGLONG  SystemPartitionOffset;
+  ULONG  BootDeviceSignature;
+  ULONG  SystemDeviceSignature;
+} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
 
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_MDL_WRITE_COMPLETE)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN PLARGE_INTEGER  FileOffset,
-  IN PMDL  MdlChain,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+typedef struct _BOOTDISK_INFORMATION_EX {
+  LONGLONG  BootPartitionOffset;
+  LONGLONG  SystemPartitionOffset;
+  ULONG  BootDeviceSignature;
+  ULONG  SystemDeviceSignature;
+  GUID  BootDeviceGuid;
+  GUID  SystemDeviceGuid;
+  BOOLEAN  BootDeviceIsGpt;
+  BOOLEAN  SystemDeviceIsGpt;
+} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
 
-typedef BOOLEAN
-(DDKAPI *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 struct _EISA_MEMORY_TYPE {
+  UCHAR  ReadWrite : 1;
+  UCHAR  Cached : 1;
+  UCHAR  Reserved0 : 1;
+  UCHAR  Type : 2;
+  UCHAR  Shared : 1;
+  UCHAR  Reserved1 : 1;
+  UCHAR  MoreEntries : 1;
+} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
 
-typedef BOOLEAN
-(DDKAPI *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);
+#include <pshpack1.h>
+typedef struct _EISA_MEMORY_CONFIGURATION {
+  EISA_MEMORY_TYPE  ConfigurationByte;
+  UCHAR  DataSize;
+  USHORT  AddressLowWord;
+  UCHAR  AddressHighByte;
+  USHORT  MemorySize;
+} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
+#include <poppack.h>
 
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN PMDL  MdlChain,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+typedef struct _EISA_IRQ_DESCRIPTOR {
+  UCHAR  Interrupt : 4;
+  UCHAR  Reserved : 1;
+  UCHAR  LevelTriggered : 1;
+  UCHAR  Shared : 1;
+  UCHAR  MoreEntries : 1;
+} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
 
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN PLARGE_INTEGER  FileOffset,
-  IN PMDL  MdlChain,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+typedef struct _EISA_IRQ_CONFIGURATION {
+  EISA_IRQ_DESCRIPTOR  ConfigurationByte;
+  UCHAR  Reserved;
+} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
 
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_QUERY_OPEN)(
-  IN struct _IRP  *Irp,
-  OUT PFILE_NETWORK_OPEN_INFORMATION  NetworkInformation,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+typedef struct _DMA_CONFIGURATION_BYTE0 {
+  UCHAR Channel : 3;
+  UCHAR Reserved : 3;
+  UCHAR Shared : 1;
+  UCHAR MoreEntries : 1;
+} DMA_CONFIGURATION_BYTE0;
 
-typedef NTSTATUS
-(DDKAPI *PFAST_IO_RELEASE_FOR_MOD_WRITE)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN struct _ERESOURCE  *ResourceToRelease,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+typedef struct _DMA_CONFIGURATION_BYTE1 {
+  UCHAR  Reserved0 : 2;
+  UCHAR  TransferSize : 2;
+  UCHAR  Timing : 2;
+  UCHAR  Reserved1 : 2;
+} DMA_CONFIGURATION_BYTE1;
 
-typedef NTSTATUS
-(DDKAPI *PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+typedef struct _EISA_DMA_CONFIGURATION {
+  DMA_CONFIGURATION_BYTE0  ConfigurationByte0;
+  DMA_CONFIGURATION_BYTE1  ConfigurationByte1;
+} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
 
-typedef NTSTATUS
-(DDKAPI *PFAST_IO_RELEASE_FOR_CCFLUSH) (
-  IN struct _FILE_OBJECT  *FileObject,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
+#include <pshpack1.h>
+typedef struct _EISA_PORT_DESCRIPTOR {
+  UCHAR  NumberPorts : 5;
+  UCHAR  Reserved : 1;
+  UCHAR  Shared : 1;
+  UCHAR  MoreEntries : 1;
+} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
 
-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;
+typedef struct _EISA_PORT_CONFIGURATION {
+  EISA_PORT_DESCRIPTOR  Configuration;
+  USHORT  PortAddress;
+} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
+#include <poppack.h>
 
-typedef struct _SECTION_OBJECT_POINTERS {
-  PVOID  DataSectionObject;
-  PVOID  SharedCacheMap;
-  PVOID  ImageSectionObject;
-} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
+typedef struct _CM_EISA_FUNCTION_INFORMATION {
+  ULONG  CompressedId;
+  UCHAR  IdSlotFlags1;
+  UCHAR  IdSlotFlags2;
+  UCHAR  MinorRevision;
+  UCHAR  MajorRevision;
+  UCHAR  Selections[26];
+  UCHAR  FunctionFlags;
+  UCHAR  TypeString[80];
+  EISA_MEMORY_CONFIGURATION  EisaMemory[9];
+  EISA_IRQ_CONFIGURATION  EisaIrq[7];
+  EISA_DMA_CONFIGURATION  EisaDma[4];
+  EISA_PORT_CONFIGURATION  EisaPort[20];
+  UCHAR  InitializationData[60];
+} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
 
-typedef struct _IO_COMPLETION_CONTEXT {
-  PVOID  Port;
-  PVOID  Key;
-} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
+/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
 
-/* FILE_OBJECT.Flags */
+#define EISA_FUNCTION_ENABLED           0x80
+#define EISA_FREE_FORM_DATA             0x40
+#define EISA_HAS_PORT_INIT_ENTRY        0x20
+#define EISA_HAS_PORT_RANGE             0x10
+#define EISA_HAS_DMA_ENTRY              0x08
+#define EISA_HAS_IRQ_ENTRY              0x04
+#define EISA_HAS_MEMORY_ENTRY           0x02
+#define EISA_HAS_TYPE_ENTRY             0x01
+#define EISA_HAS_INFORMATION \
+  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
+  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
 
-#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_QUEUE_IRP_TO_THREAD       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_RANDOM_ACCESS             0x00100000
-#define FO_FILE_OPEN_CANCELLED       0x00200000
-#define FO_VOLUME_OPEN               0x00400000
-#define FO_REMOTE_ORIGIN             0x01000000
-#define FO_DISALLOW_EXCLUSIVE        0x02000000
-#define FO_SKIP_COMPLETION_PORT      0x02000000
-#define FO_SKIP_SET_EVENT            0x04000000
-#define FO_SKIP_SET_FAST_IO          0x08000000
+typedef struct _CM_EISA_SLOT_INFORMATION {
+  UCHAR  ReturnCode;
+  UCHAR  ReturnFlags;
+  UCHAR  MajorRevision;
+  UCHAR  MinorRevision;
+  USHORT  Checksum;
+  UCHAR  NumberFunctions;
+  UCHAR  FunctionInformation;
+  ULONG  CompressedId;
+} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
 
-/* VPB.Flags */
-#define VPB_MOUNTED                       0x0001
-#define VPB_LOCKED                        0x0002
-#define VPB_PERSISTENT                    0x0004
-#define VPB_REMOVE_PENDING                0x0008
-#define VPB_RAW_MOUNT                     0x0010
-#define VPB_DIRECT_WRITES_ALLOWED         0x0020
+/* CM_EISA_SLOT_INFORMATION.ReturnCode */
 
-#define MAXIMUM_VOLUME_LABEL_LENGTH       (32 * sizeof(WCHAR))
+#define EISA_INVALID_SLOT               0x80
+#define EISA_INVALID_FUNCTION           0x81
+#define EISA_INVALID_CONFIGURATION      0x82
+#define EISA_EMPTY_SLOT                 0x83
+#define EISA_INVALID_BIOS_CALL          0x86
 
-/* IRP.Flags */
+/*
+** Plug and Play structures
+*/
 
-#define SL_FORCE_ACCESS_CHECK             0x01
-#define SL_OPEN_PAGING_FILE               0x02
-#define SL_OPEN_TARGET_DIRECTORY          0x04
-#define SL_CASE_SENSITIVE                 0x80
+typedef VOID
+(DDKAPI *PINTERFACE_REFERENCE)(
+  PVOID  Context);
 
-#define SL_KEY_SPECIFIED                  0x01
-#define SL_OVERRIDE_VERIFY_VOLUME         0x02
-#define SL_WRITE_THROUGH                  0x04
-#define SL_FT_SEQUENTIAL_WRITE            0x08
+typedef VOID
+(DDKAPI *PINTERFACE_DEREFERENCE)(
+  PVOID Context);
 
-#define SL_FAIL_IMMEDIATELY               0x01
-#define SL_EXCLUSIVE_LOCK                 0x02
+typedef BOOLEAN
+(DDKAPI *PTRANSLATE_BUS_ADDRESS)(
+  IN PVOID  Context,
+  IN PHYSICAL_ADDRESS  BusAddress,
+  IN ULONG  Length,
+  IN OUT PULONG  AddressSpace,
+  OUT PPHYSICAL_ADDRESS  TranslatedAddress);
 
-#define SL_RESTART_SCAN                   0x01
-#define SL_RETURN_SINGLE_ENTRY            0x02
-#define SL_INDEX_SPECIFIED                0x04
+typedef struct _DMA_ADAPTER*
+(DDKAPI *PGET_DMA_ADAPTER)(
+  IN PVOID  Context,
+  IN struct _DEVICE_DESCRIPTION  *DeviceDescriptor,
+  OUT PULONG  NumberOfMapRegisters);
 
-#define SL_WATCH_TREE                     0x01
+typedef ULONG
+(DDKAPI *PGET_SET_DEVICE_DATA)(
+  IN PVOID  Context,
+  IN ULONG  DataType,
+  IN PVOID  Buffer,
+  IN ULONG  Offset,
+  IN ULONG  Length);
 
-#define SL_ALLOW_RAW_MOUNT                0x01
+/* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
+#define PCI_USE_SUBSYSTEM_IDS   0x00000001
+#define PCI_USE_REVISION        0x00000002
+#define PCI_USE_VENDEV_IDS      0x00000004
+#define PCI_USE_CLASS_SUBCLASS  0x00000008
+#define PCI_USE_PROGIF          0x00000010
+#define PCI_USE_LOCAL_BUS       0x00000020
+#define PCI_USE_LOCAL_DEVICE    0x00000040
 
-#define CTL_CODE(DeviceType, Function, Method, Access)( \
-  ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
+typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS {
+  ULONG   Size;
+  ULONG   Flags;
+  USHORT  VendorID;
+  USHORT  DeviceID;
+  UCHAR   RevisionID;
+  USHORT  SubVendorID;
+  USHORT  SubSystemID;
+  UCHAR   BaseClass;
+  UCHAR   SubClass;
+  UCHAR   ProgIf;
+} PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS;
 
-#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
+typedef BOOLEAN
+(DDKAPI *PPCI_IS_DEVICE_PRESENT)(
+  IN USHORT  VendorID,
+  IN USHORT  DeviceID,
+  IN UCHAR   RevisionID,
+  IN USHORT  SubVendorID,
+  IN USHORT  SubSystemID,
+  IN ULONG   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
+typedef BOOLEAN
+(DDKAPI *PPCI_IS_DEVICE_PRESENT_EX)(
+  IN PVOID Context,
+  IN PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
 
-#define IRP_QUOTA_CHARGED                 0x01
-#define IRP_ALLOCATED_MUST_SUCCEED        0x02
-#define IRP_ALLOCATED_FIXED_SIZE          0x04
-#define IRP_LOOKASIDE_ALLOCATION          0x08
+typedef union _POWER_STATE {
+  SYSTEM_POWER_STATE  SystemState;
+  DEVICE_POWER_STATE  DeviceState;
+} POWER_STATE, *PPOWER_STATE;
 
-/*
-** IRP function codes
-*/
+typedef enum _POWER_STATE_TYPE {
+  SystemPowerState = 0,
+  DevicePowerState
+} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
 
-#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_SCSI                       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_POWER                      0x16
-#define IRP_MJ_SYSTEM_CONTROL             0x17
-#define IRP_MJ_DEVICE_CHANGE              0x18
-#define IRP_MJ_QUERY_QUOTA                0x19
-#define IRP_MJ_SET_QUOTA                  0x1a
-#define IRP_MJ_PNP                        0x1b
-#define IRP_MJ_PNP_POWER                  0x1b
-#define IRP_MJ_MAXIMUM_FUNCTION           0x1b
+typedef struct _BUS_INTERFACE_STANDARD {
+  USHORT  Size;
+  USHORT  Version;
+  PVOID  Context;
+  PINTERFACE_REFERENCE  InterfaceReference;
+  PINTERFACE_DEREFERENCE  InterfaceDereference;
+  PTRANSLATE_BUS_ADDRESS  TranslateBusAddress;
+  PGET_DMA_ADAPTER  GetDmaAdapter;
+  PGET_SET_DEVICE_DATA  SetBusData;
+  PGET_SET_DEVICE_DATA  GetBusData;
+} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
 
-#define IRP_MN_SCSI_CLASS                 0x01
+typedef struct _PCI_DEVICE_PRESENT_INTERFACE {
+  USHORT  Size;
+  USHORT  Version;
+  PVOID  Context;
+  PINTERFACE_REFERENCE  InterfaceReference;
+  PINTERFACE_DEREFERENCE  InterfaceDereference;
+  PPCI_IS_DEVICE_PRESENT  IsDevicePresent;
+  PPCI_IS_DEVICE_PRESENT_EX  IsDevicePresentEx;
+} PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE;
 
-#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
+typedef struct _DEVICE_CAPABILITIES {
+  USHORT  Size;
+  USHORT  Version;
+  ULONG  DeviceD1 : 1;
+  ULONG  DeviceD2 : 1;
+  ULONG  LockSupported : 1;
+  ULONG  EjectSupported : 1;
+  ULONG  Removable : 1;
+  ULONG  DockDevice : 1;
+  ULONG  UniqueID : 1;
+  ULONG  SilentInstall : 1;
+  ULONG  RawDeviceOK : 1;
+  ULONG  SurpriseRemovalOK : 1;
+  ULONG  WakeFromD0 : 1;
+  ULONG  WakeFromD1 : 1;
+  ULONG  WakeFromD2 : 1;
+  ULONG  WakeFromD3 : 1;
+  ULONG  HardwareDisabled : 1;
+  ULONG  NonDynamic : 1;
+  ULONG  WarmEjectSupported : 1;
+  ULONG  NoDisplayInUI : 1;
+  ULONG  Reserved : 14;
+  ULONG  Address;
+  ULONG  UINumber;
+  DEVICE_POWER_STATE  DeviceState[PowerSystemMaximum];
+  SYSTEM_POWER_STATE  SystemWake;
+  DEVICE_POWER_STATE  DeviceWake;
+  ULONG  D1Latency;
+  ULONG  D2Latency;
+  ULONG  D3Latency;
+} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
 
-#define IRP_MN_QUERY_DEVICE_RELATIONS       0x07
-#define IRP_MN_QUERY_INTERFACE              0x08
-#define IRP_MN_QUERY_CAPABILITIES           0x09
-#define IRP_MN_QUERY_RESOURCES              0x0A
-#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS  0x0B
-#define IRP_MN_QUERY_DEVICE_TEXT            0x0C
-#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
+typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+  GUID  InterfaceClassGuid;
+  PUNICODE_STRING  SymbolicLinkName;
+} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
 
-#define IRP_MN_READ_CONFIG                  0x0F
-#define IRP_MN_WRITE_CONFIG                 0x10
-#define IRP_MN_EJECT                        0x11
-#define IRP_MN_SET_LOCK                     0x12
-#define IRP_MN_QUERY_ID                     0x13
-#define IRP_MN_QUERY_PNP_DEVICE_STATE       0x14
-#define IRP_MN_QUERY_BUS_INFORMATION        0x15
-#define IRP_MN_DEVICE_USAGE_NOTIFICATION    0x16
-#define IRP_MN_SURPRISE_REMOVAL             0x17
+typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
 
-#define IRP_MN_WAIT_WAKE                  0x00
-#define IRP_MN_POWER_SEQUENCE             0x01
-#define IRP_MN_SET_POWER                  0x02
-#define IRP_MN_QUERY_POWER                0x03
+#undef INTERFACE
 
-#define IRP_MN_QUERY_ALL_DATA             0x00
-#define IRP_MN_QUERY_SINGLE_INSTANCE      0x01
-#define IRP_MN_CHANGE_SINGLE_INSTANCE     0x02
-#define IRP_MN_CHANGE_SINGLE_ITEM         0x03
-#define IRP_MN_ENABLE_EVENTS              0x04
-#define IRP_MN_DISABLE_EVENTS             0x05
-#define IRP_MN_ENABLE_COLLECTION          0x06
-#define IRP_MN_DISABLE_COLLECTION         0x07
-#define IRP_MN_REGINFO                    0x08
-#define IRP_MN_EXECUTE_METHOD             0x09
+typedef struct _INTERFACE {
+  USHORT  Size;
+  USHORT  Version;
+  PVOID  Context;
+  PINTERFACE_REFERENCE  InterfaceReference;
+  PINTERFACE_DEREFERENCE  InterfaceDereference;
+} INTERFACE, *PINTERFACE;
 
-#define IRP_MN_REGINFO_EX                 0x0b
+typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
 
-typedef struct _VPB {
-  CSHORT  Type;
-  CSHORT  Size;
-  USHORT  Flags;
-  USHORT  VolumeLabelLength;
-  struct _DEVICE_OBJECT  *DeviceObject;
-  struct _DEVICE_OBJECT  *RealDevice;
-  ULONG  SerialNumber;
-  ULONG  ReferenceCount;
-  WCHAR  VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
-} VPB, *PVPB;
+typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
 
-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;
-  ULONG  Characteristics;
-  volatile 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;
-  ULONG  ActiveThreadCount;
-  PSECURITY_DESCRIPTOR  SecurityDescriptor;
-  KEVENT  DeviceLock;
-  USHORT  SectorSize;
-  USHORT  Spare1;
-  struct _DEVOBJ_EXTENSION  *DeviceObjectExtension;
-  PVOID  Reserved;
-} DEVICE_OBJECT, *PDEVICE_OBJECT;
+/* PNP_DEVICE_STATE */
 
-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;
-    volatile ULONG Waiters;
-    volatile ULONG Busy;
-    PVOID LastLock;
-    KEVENT Lock;
-    KEVENT Event;
-    volatile PIO_COMPLETION_CONTEXT CompletionContext;
-    KSPIN_LOCK IrpListLock;
-    LIST_ENTRY IrpList;
-    volatile PVOID FileObjectExtension;
-} FILE_OBJECT;
-typedef struct _FILE_OBJECT *PFILE_OBJECT;
+#define PNP_DEVICE_DISABLED                      0x00000001
+#define PNP_DEVICE_DONT_DISPLAY_IN_UI            0x00000002
+#define PNP_DEVICE_FAILED                        0x00000004
+#define PNP_DEVICE_REMOVED                       0x00000008
+#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
+#define PNP_DEVICE_NOT_DISABLEABLE               0x00000020
 
-typedef struct _IO_ERROR_LOG_PACKET {
-  UCHAR  MajorFunctionCode;
-  UCHAR  RetryCount;
-  USHORT  DumpDataSize;
-  USHORT  NumberOfStrings;
-  USHORT  StringOffset;
-  USHORT  EventCategory;
-  NTSTATUS  ErrorCode;
-  ULONG  UniqueErrorValue;
-  NTSTATUS  FinalStatus;
-  ULONG  SequenceNumber;
-  ULONG  IoControlCode;
-  LARGE_INTEGER  DeviceOffset;
-  ULONG  DumpData[1];
-} IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
+typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+  struct _FILE_OBJECT  *FileObject;
+  LONG  NameBufferOffset;
+  UCHAR  CustomDataBuffer[1];
+} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
 
-typedef struct _IO_ERROR_LOG_MESSAGE {
-  USHORT  Type;
+typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
+  USHORT  Version;
   USHORT  Size;
-  USHORT  DriverNameLength;
-  LARGE_INTEGER  TimeStamp;
-  ULONG  DriverNameOffset;
-  IO_ERROR_LOG_PACKET  EntryData;
-} IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
+  GUID  Event;
+  struct _FILE_OBJECT  *FileObject;
+} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
 
-#define ERROR_LOG_LIMIT_SIZE               240
-#define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
-                                            sizeof(IO_ERROR_LOG_PACKET) + \
-                                            (sizeof(WCHAR) * 40))
-#define ERROR_LOG_MESSAGE_LIMIT_SIZE                                          \
-    (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
-#define IO_ERROR_LOG_MESSAGE_LENGTH                                           \
-    ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ?           \
-        ERROR_LOG_MESSAGE_LIMIT_SIZE :                                        \
-        PORT_MAXIMUM_MESSAGE_LENGTH)
-#define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH -                 \
-                                IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
+typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
+  DeviceUsageTypeUndefined,
+  DeviceUsageTypePaging,
+  DeviceUsageTypeHibernation,
+  DeviceUsageTypeDumpFile
+} DEVICE_USAGE_NOTIFICATION_TYPE;
 
-typedef enum _DMA_WIDTH {
-  Width8Bits,
-  Width16Bits,
-  Width32Bits,
-  MaximumDmaWidth
-} DMA_WIDTH, *PDMA_WIDTH;
+typedef struct _POWER_SEQUENCE {
+  ULONG  SequenceD1;
+  ULONG  SequenceD2;
+  ULONG  SequenceD3;
+} POWER_SEQUENCE, *PPOWER_SEQUENCE;
 
-typedef enum _DMA_SPEED {
-  Compatible,
-  TypeA,
-  TypeB,
-  TypeC,
-  TypeF,
-  MaximumDmaSpeed
-} DMA_SPEED, *PDMA_SPEED;
+typedef enum {
+  DevicePropertyDeviceDescription = 0x0,
+  DevicePropertyHardwareID = 0x1,
+  DevicePropertyCompatibleIDs = 0x2,
+  DevicePropertyBootConfiguration = 0x3,
+  DevicePropertyBootConfigurationTranslated = 0x4,
+  DevicePropertyClassName = 0x5,
+  DevicePropertyClassGuid = 0x6,
+  DevicePropertyDriverKeyName = 0x7,
+  DevicePropertyManufacturer = 0x8,
+  DevicePropertyFriendlyName = 0x9,
+  DevicePropertyLocationInformation = 0xa,
+  DevicePropertyPhysicalDeviceObjectName = 0xb,
+  DevicePropertyBusTypeGuid = 0xc,
+  DevicePropertyLegacyBusType = 0xd,
+  DevicePropertyBusNumber = 0xe,
+  DevicePropertyEnumeratorName = 0xf,
+  DevicePropertyAddress = 0x10,
+  DevicePropertyUINumber = 0x11,
+  DevicePropertyInstallState = 0x12,
+  DevicePropertyRemovalPolicy = 0x13,
+  DevicePropertyResourceRequirements = 0x14,
+  DevicePropertyAllocatedResources = 0x15,
+  DevicePropertyContainerID = 0x16
+} DEVICE_REGISTRY_PROPERTY;
 
-/* DEVICE_DESCRIPTION.Version */
+typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
+  EventCategoryReserved,
+  EventCategoryHardwareProfileChange,
+  EventCategoryDeviceInterfaceChange,
+  EventCategoryTargetDeviceChange
+} IO_NOTIFICATION_EVENT_CATEGORY;
 
-#define DEVICE_DESCRIPTION_VERSION        0x0000
-#define DEVICE_DESCRIPTION_VERSION1       0x0001
-#define DEVICE_DESCRIPTION_VERSION2       0x0002
+#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES    0x00000001
 
-typedef struct _DEVICE_DESCRIPTION {
-  ULONG  Version;
-  BOOLEAN  Master;
-  BOOLEAN  ScatterGather;
-  BOOLEAN  DemandMode;
-  BOOLEAN  AutoInitialize;
-  BOOLEAN  Dma32BitAddresses;
-  BOOLEAN  IgnoreCount;
-  BOOLEAN  Reserved1;
-  BOOLEAN  Dma64BitAddresses;
-  ULONG  BusNumber;
-  ULONG  DmaChannel;
-  INTERFACE_TYPE  InterfaceType;
-  DMA_WIDTH  DmaWidth;
-  DMA_SPEED  DmaSpeed;
-  ULONG  MaximumLength;
-  ULONG  DmaPort;
-} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
-
-typedef enum _DEVICE_RELATION_TYPE {
-  BusRelations,
-  EjectionRelations,
-  PowerRelations,
-  RemovalRelations,
-  TargetDeviceRelation,
-  SingleBusRelations,
-  TransportRelations
-} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
-
-typedef struct _DEVICE_RELATIONS {
-  ULONG  Count;
-  PDEVICE_OBJECT Objects[1];
-} DEVICE_RELATIONS, *PDEVICE_RELATIONS;
+typedef NTSTATUS
+(DDKAPI *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
+  IN PVOID NotificationStructure,
+  IN PVOID Context);
 
-typedef struct _DEVOBJ_EXTENSION
-{
-    CSHORT Type;
-    USHORT Size;
-    PDEVICE_OBJECT DeviceObject;
-} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
+typedef VOID
+(DDKAPI *PDEVICE_CHANGE_COMPLETE_CALLBACK)(
+  IN PVOID Context);
 
-typedef struct _SCATTER_GATHER_ELEMENT {
-  PHYSICAL_ADDRESS  Address;
-  ULONG  Length;
-  ULONG_PTR  Reserved;
-} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
+typedef enum _FILE_INFORMATION_CLASS {
+  FileDirectoryInformation = 1,
+  FileFullDirectoryInformation,
+  FileBothDirectoryInformation,
+  FileBasicInformation,
+  FileStandardInformation,
+  FileInternalInformation,
+  FileEaInformation,
+  FileAccessInformation,
+  FileNameInformation,
+  FileRenameInformation,
+  FileLinkInformation,
+  FileNamesInformation,
+  FileDispositionInformation,
+  FilePositionInformation,
+  FileFullEaInformation,
+  FileModeInformation,
+  FileAlignmentInformation,
+  FileAllInformation,
+  FileAllocationInformation,
+  FileEndOfFileInformation,
+  FileAlternateNameInformation,
+  FileStreamInformation,
+  FilePipeInformation,
+  FilePipeLocalInformation,
+  FilePipeRemoteInformation,
+  FileMailslotQueryInformation,
+  FileMailslotSetInformation,
+  FileCompressionInformation,
+  FileObjectIdInformation,
+  FileCompletionInformation,
+  FileMoveClusterInformation,
+  FileQuotaInformation,
+  FileReparsePointInformation,
+  FileNetworkOpenInformation,
+  FileAttributeTagInformation,
+  FileTrackingInformation,
+  FileIdBothDirectoryInformation,
+  FileIdFullDirectoryInformation,
+  FileValidDataLengthInformation,
+  FileShortNameInformation,
+  FileIoCompletionNotificationInformation,
+  FileIoStatusBlockRangeInformation,
+  FileIoPriorityHintInformation,
+  FileSfioReserveInformation,
+  FileSfioVolumeInformation,
+  FileHardLinkInformation,
+  FileProcessIdsUsingFileInformation,
+  FileNormalizedNameInformation,
+  FileNetworkPhysicalNameInformation,
+  FileIdGlobalTxDirectoryInformation,
+  FileIsRemoteDeviceInformation,
+  FileAttributeCacheInformation,
+  FileNumaNodeInformation,
+  FileStandardLinkInformation,
+  FileRemoteProtocolInformation,
+  FileMaximumInformation
+} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
 
-#if defined(_MSC_EXTENSIONS)
+typedef struct _FILE_POSITION_INFORMATION {
+  LARGE_INTEGER  CurrentByteOffset;
+} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
 
-#if _MSC_VER >= 1200
-#pragma warning(push)
-#endif
-#pragma warning(disable:4200)
-typedef struct _SCATTER_GATHER_LIST {
-  ULONG  NumberOfElements;
-  ULONG_PTR  Reserved;
-  SCATTER_GATHER_ELEMENT  Elements[1];
-} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
+#include <pshpack8.h>
+typedef struct _FILE_BASIC_INFORMATION {
+  LARGE_INTEGER  CreationTime;
+  LARGE_INTEGER  LastAccessTime;
+  LARGE_INTEGER  LastWriteTime;
+  LARGE_INTEGER  ChangeTime;
+  ULONG  FileAttributes;
+} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
+#include <poppack.h>
 
-#if _MSC_VER >= 1200
-#pragma warning(pop)
-#else
-#pragma warning(default:4200)
-#endif
+typedef struct _FILE_STANDARD_INFORMATION {
+  LARGE_INTEGER  AllocationSize;
+  LARGE_INTEGER  EndOfFile;
+  ULONG  NumberOfLinks;
+  BOOLEAN  DeletePending;
+  BOOLEAN  Directory;
+} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
 
-#else
+typedef struct _FILE_NETWORK_OPEN_INFORMATION {
+  LARGE_INTEGER  CreationTime;
+  LARGE_INTEGER  LastAccessTime;
+  LARGE_INTEGER  LastWriteTime;
+  LARGE_INTEGER  ChangeTime;
+  LARGE_INTEGER  AllocationSize;
+  LARGE_INTEGER  EndOfFile;
+  ULONG  FileAttributes;
+} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
 
-struct _SCATTER_GATHER_LIST;
-typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
+typedef enum _FSINFOCLASS {
+  FileFsVolumeInformation = 1,
+  FileFsLabelInformation,
+  FileFsSizeInformation,
+  FileFsDeviceInformation,
+  FileFsAttributeInformation,
+  FileFsControlInformation,
+  FileFsFullSizeInformation,
+  FileFsObjectIdInformation,
+  FileFsDriverPathInformation,
+  FileFsVolumeFlagsInformation,
+  FileFsMaximumInformation
+} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
 
-#endif
+typedef struct _FILE_FS_DEVICE_INFORMATION {
+  DEVICE_TYPE  DeviceType;
+  ULONG  Characteristics;
+} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
 
-#define MDL_MAPPED_TO_SYSTEM_VA     0x0001
-#define MDL_PAGES_LOCKED            0x0002
-#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
-#define MDL_ALLOCATED_FIXED_SIZE    0x0008
-#define MDL_PARTIAL                 0x0010
-#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
-#define MDL_IO_PAGE_READ            0x0040
-#define MDL_WRITE_OPERATION         0x0080
-#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
-#define MDL_FREE_EXTRA_PTES         0x0200
-#define MDL_DESCRIBES_AWE           0x0400
-#define MDL_IO_SPACE                0x0800
-#define MDL_NETWORK_HEADER          0x1000
-#define MDL_MAPPING_CAN_FAIL        0x2000
-#define MDL_ALLOCATED_MUST_SUCCEED  0x4000
-#define MDL_INTERNAL                0x8000
+typedef struct _FILE_FULL_EA_INFORMATION {
+  ULONG  NextEntryOffset;
+  UCHAR  Flags;
+  UCHAR  EaNameLength;
+  USHORT  EaValueLength;
+  CHAR  EaName[1];
+} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
 
+typedef struct _FAST_MUTEX
+{
+    LONG Count;
+    PKTHREAD Owner;
+    ULONG Contention;
+    KEVENT Gate;
+    ULONG OldIrql;
+} FAST_MUTEX, *PFAST_MUTEX;
 
-#define MDL_MAPPING_FLAGS ( \
-  MDL_MAPPED_TO_SYSTEM_VA     | \
-  MDL_PAGES_LOCKED            | \
-  MDL_SOURCE_IS_NONPAGED_POOL | \
-  MDL_PARTIAL_HAS_BEEN_MAPPED | \
-  MDL_PARENT_MAPPED_SYSTEM_VA | \
-  MDL_SYSTEM_VA               | \
-  MDL_IO_SPACE)
+typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
 
-typedef NTSTATUS
-(DDKAPI DRIVER_ADD_DEVICE)(
-  IN struct _DRIVER_OBJECT  *DriverObject,
-  IN struct _DEVICE_OBJECT  *PhysicalDeviceObject);
-typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
+typedef struct _OWNER_ENTRY {
+    ERESOURCE_THREAD OwnerThread;
+    _ANONYMOUS_UNION union {
+        LONG OwnerCount;
+        ULONG TableSize;
+    } DUMMYUNIONNAME;
+} OWNER_ENTRY, *POWNER_ENTRY;
 
-typedef struct _DRIVER_EXTENSION {
-  struct _DRIVER_OBJECT  *DriverObject;
-  PDRIVER_ADD_DEVICE  AddDevice;
-  ULONG  Count;
-  UNICODE_STRING  ServiceKeyName;
-} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
+typedef struct _ERESOURCE
+{
+    LIST_ENTRY SystemResourcesList;
+    POWNER_ENTRY OwnerTable;
+    SHORT ActiveCount;
+    USHORT Flag;
+    volatile PKSEMAPHORE SharedWaiters;
+    volatile PKEVENT ExclusiveWaiters;
+    OWNER_ENTRY OwnerEntry;
+    ULONG ActiveEntries;
+    ULONG ContentionCount;
+    ULONG NumberOfSharedWaiters;
+    ULONG NumberOfExclusiveWaiters;
+    __GNU_EXTENSION union
+    {
+        PVOID Address;
+        ULONG_PTR CreatorBackTraceIndex;
+    };
+    KSPIN_LOCK SpinLock;
+} ERESOURCE, *PERESOURCE;
 
-#define DRVO_UNLOAD_INVOKED               0x00000001
-#define DRVO_LEGACY_DRIVER                0x00000002
-#define DRVO_BUILTIN_DRIVER               0x00000004
+/* ERESOURCE.Flag */
 
-typedef NTSTATUS
-(DDKAPI DRIVER_INITIALIZE)(
-  IN struct _DRIVER_OBJECT  *DriverObject,
-  IN PUNICODE_STRING  RegistryPath);
-typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
+#define ResourceNeverExclusive            0x0010
+#define ResourceReleaseByOtherThread      0x0020
+#define ResourceOwnedExclusive            0x0080
 
-typedef VOID
-(DDKAPI DRIVER_STARTIO)(
-  IN struct _DEVICE_OBJECT  *DeviceObject,
-  IN struct _IRP  *Irp);
-typedef DRIVER_STARTIO *PDRIVER_STARTIO;
+#define RESOURCE_HASH_TABLE_SIZE          64
 
-typedef VOID
-(DDKAPI DRIVER_UNLOAD)(
-  IN struct _DRIVER_OBJECT  *DriverObject);
-typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
-
-typedef NTSTATUS
-(DDKAPI DRIVER_DISPATCH)(
-  IN struct _DEVICE_OBJECT  *DeviceObject,
-  IN struct _IRP  *Irp);
-typedef DRIVER_DISPATCH *PDRIVER_DISPATCH;
-
-typedef struct _DRIVER_OBJECT {
-  CSHORT  Type;
-  CSHORT  Size;
-  PDEVICE_OBJECT  DeviceObject;
-  ULONG  Flags;
-  PVOID  DriverStart;
-  ULONG  DriverSize;
-  PVOID  DriverSection;
-  PDRIVER_EXTENSION  DriverExtension;
-  UNICODE_STRING  DriverName;
-  PUNICODE_STRING  HardwareDatabase;
-  struct _FAST_IO_DISPATCH *FastIoDispatch;
-  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;
-
-typedef struct _DMA_ADAPTER {
-  USHORT  Version;
-  USHORT  Size;
-  struct _DMA_OPERATIONS*  DmaOperations;
-} DMA_ADAPTER, *PDMA_ADAPTER;
-
-typedef VOID
-(DDKAPI *PPUT_DMA_ADAPTER)(
-  IN PDMA_ADAPTER  DmaAdapter);
+typedef BOOLEAN
+(DDKAPI *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 PVOID
-(DDKAPI *PALLOCATE_COMMON_BUFFER)(
-  IN PDMA_ADAPTER  DmaAdapter,
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_READ)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN PLARGE_INTEGER  FileOffset,
   IN ULONG  Length,
-  OUT PPHYSICAL_ADDRESS  LogicalAddress,
-  IN BOOLEAN  CacheEnabled);
+  IN BOOLEAN  Wait,
+  IN ULONG  LockKey,
+  OUT PVOID  Buffer,
+  OUT PIO_STATUS_BLOCK  IoStatus,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef VOID
-(DDKAPI *PFREE_COMMON_BUFFER)(
-  IN PDMA_ADAPTER  DmaAdapter,
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_WRITE)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN PLARGE_INTEGER  FileOffset,
   IN ULONG  Length,
-  IN PHYSICAL_ADDRESS  LogicalAddress,
-  IN PVOID  VirtualAddress,
-  IN BOOLEAN  CacheEnabled);
+  IN BOOLEAN  Wait,
+  IN ULONG  LockKey,
+  IN PVOID  Buffer,
+  OUT PIO_STATUS_BLOCK  IoStatus,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef NTSTATUS
-(DDKAPI *PALLOCATE_ADAPTER_CHANNEL)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PDEVICE_OBJECT  DeviceObject,
-  IN ULONG  NumberOfMapRegisters,
-  IN PDRIVER_CONTROL  ExecutionRoutine,
-  IN PVOID  Context);
+typedef BOOLEAN
+(DDKAPI *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
-(DDKAPI *PFLUSH_ADAPTER_BUFFERS)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PMDL  Mdl,
-  IN PVOID  MapRegisterBase,
-  IN PVOID  CurrentVa,
-  IN ULONG  Length,
-  IN BOOLEAN  WriteToDevice);
+(DDKAPI *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);
 
-typedef VOID
-(DDKAPI *PFREE_ADAPTER_CHANNEL)(
-  IN PDMA_ADAPTER  DmaAdapter);
+typedef BOOLEAN
+(DDKAPI *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 VOID
-(DDKAPI *PFREE_MAP_REGISTERS)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  PVOID  MapRegisterBase,
-  ULONG  NumberOfMapRegisters);
+typedef BOOLEAN
+(DDKAPI *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 PHYSICAL_ADDRESS
-(DDKAPI *PMAP_TRANSFER)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PMDL  Mdl,
-  IN PVOID  MapRegisterBase,
-  IN PVOID  CurrentVa,
-  IN OUT PULONG  Length,
-  IN BOOLEAN  WriteToDevice);
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_UNLOCK_ALL)(
+  IN struct _FILE_OBJECT  *FileObject,
+  PEPROCESS  ProcessId,
+  OUT PIO_STATUS_BLOCK  IoStatus,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef ULONG
-(DDKAPI *PGET_DMA_ALIGNMENT)(
-  IN PDMA_ADAPTER  DmaAdapter);
+typedef BOOLEAN
+(DDKAPI *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);
 
-typedef ULONG
-(DDKAPI *PREAD_DMA_COUNTER)(
-  IN PDMA_ADAPTER  DmaAdapter);
+typedef BOOLEAN
+(DDKAPI *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);
 
 typedef VOID
-(DDKAPI *PDRIVER_LIST_CONTROL)(
-  IN struct _DEVICE_OBJECT  *DeviceObject,
-  IN struct _IRP  *Irp,
-  IN struct _SCATTER_GATHER_LIST  *ScatterGather,
-  IN PVOID  Context);
+(DDKAPI *PFAST_IO_ACQUIRE_FILE)(
+  IN struct _FILE_OBJECT  *FileObject);
 
-typedef NTSTATUS
-(DDKAPI *PGET_SCATTER_GATHER_LIST)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PDEVICE_OBJECT  DeviceObject,
-  IN PMDL  Mdl,
-  IN PVOID  CurrentVa,
-  IN ULONG  Length,
-  IN PDRIVER_LIST_CONTROL  ExecutionRoutine,
-  IN PVOID  Context,
-  IN BOOLEAN  WriteToDevice);
+typedef VOID
+(DDKAPI *PFAST_IO_RELEASE_FILE)(
+  IN struct _FILE_OBJECT  *FileObject);
 
 typedef VOID
-(DDKAPI *PPUT_SCATTER_GATHER_LIST)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PSCATTER_GATHER_LIST  ScatterGather,
-  IN BOOLEAN  WriteToDevice);
+(DDKAPI *PFAST_IO_DETACH_DEVICE)(
+  IN struct _DEVICE_OBJECT  *SourceDevice,
+  IN struct _DEVICE_OBJECT  *TargetDevice);
 
-typedef NTSTATUS
-(DDKAPI *PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PMDL  Mdl  OPTIONAL,
-  IN PVOID  CurrentVa,
-  IN ULONG  Length,
-  OUT PULONG  ScatterGatherListSize,
-  OUT PULONG  pNumberOfMapRegisters  OPTIONAL);
+typedef BOOLEAN
+(DDKAPI *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);
 
 typedef NTSTATUS
-(DDKAPI *PBUILD_SCATTER_GATHER_LIST)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PDEVICE_OBJECT  DeviceObject,
-  IN PMDL  Mdl,
-  IN PVOID  CurrentVa,
+(DDKAPI *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 BOOLEAN
+(DDKAPI *PFAST_IO_MDL_READ)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN PLARGE_INTEGER  FileOffset,
   IN ULONG  Length,
-  IN PDRIVER_LIST_CONTROL  ExecutionRoutine,
-  IN PVOID  Context,
-  IN BOOLEAN  WriteToDevice,
-  IN PVOID  ScatterGatherBuffer,
-  IN ULONG  ScatterGatherLength);
+  IN ULONG  LockKey,
+  OUT PMDL  *MdlChain,
+  OUT PIO_STATUS_BLOCK  IoStatus,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef NTSTATUS
-(DDKAPI *PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
-  IN PDMA_ADAPTER  DmaAdapter,
-  IN PSCATTER_GATHER_LIST  ScatterGather,
-  IN PMDL  OriginalMdl,
-  OUT PMDL  *TargetMdl);
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_MDL_READ_COMPLETE)(
+  IN struct _FILE_OBJECT *FileObject,
+  IN PMDL MdlChain,
+  IN struct _DEVICE_OBJECT *DeviceObject);
 
-typedef struct _DMA_OPERATIONS {
-  ULONG  Size;
-  PPUT_DMA_ADAPTER  PutDmaAdapter;
-  PALLOCATE_COMMON_BUFFER  AllocateCommonBuffer;
-  PFREE_COMMON_BUFFER  FreeCommonBuffer;
-  PALLOCATE_ADAPTER_CHANNEL  AllocateAdapterChannel;
-  PFLUSH_ADAPTER_BUFFERS  FlushAdapterBuffers;
-  PFREE_ADAPTER_CHANNEL  FreeAdapterChannel;
-  PFREE_MAP_REGISTERS  FreeMapRegisters;
-  PMAP_TRANSFER  MapTransfer;
-  PGET_DMA_ALIGNMENT  GetDmaAlignment;
-  PREAD_DMA_COUNTER  ReadDmaCounter;
-  PGET_SCATTER_GATHER_LIST  GetScatterGatherList;
-  PPUT_SCATTER_GATHER_LIST  PutScatterGatherList;
-  PCALCULATE_SCATTER_GATHER_LIST_SIZE  CalculateScatterGatherList;
-  PBUILD_SCATTER_GATHER_LIST  BuildScatterGatherList;
-  PBUILD_MDL_FROM_SCATTER_GATHER_LIST  BuildMdlFromScatterGatherList;
-} DMA_OPERATIONS, *PDMA_OPERATIONS;
-
-typedef struct _IO_RESOURCE_DESCRIPTOR {
-  UCHAR  Option;
-  UCHAR  Type;
-  UCHAR  ShareDisposition;
-  UCHAR  Spare1;
-  USHORT  Flags;
-  USHORT  Spare2;
-  union {
-    struct {
-      ULONG  Length;
-      ULONG  Alignment;
-      PHYSICAL_ADDRESS  MinimumAddress;
-      PHYSICAL_ADDRESS  MaximumAddress;
-    } Port;
-    struct {
-      ULONG  Length;
-      ULONG  Alignment;
-      PHYSICAL_ADDRESS  MinimumAddress;
-      PHYSICAL_ADDRESS  MaximumAddress;
-    } Memory;
-    struct {
-      ULONG  MinimumVector;
-      ULONG  MaximumVector;
-    } Interrupt;
-    struct {
-      ULONG  MinimumChannel;
-      ULONG  MaximumChannel;
-    } Dma;
-    struct {
-      ULONG  Length;
-      ULONG  Alignment;
-      PHYSICAL_ADDRESS  MinimumAddress;
-      PHYSICAL_ADDRESS  MaximumAddress;
-    } Generic;
-    struct {
-      ULONG  Data[3];
-    } DevicePrivate;
-    struct {
-      ULONG  Length;
-      ULONG  MinBusNumber;
-      ULONG  MaxBusNumber;
-      ULONG  Reserved;
-    } BusNumber;
-    struct {
-      ULONG  Priority;
-      ULONG  Reserved1;
-      ULONG  Reserved2;
-    } ConfigData;
-  } u;
-} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
+typedef BOOLEAN
+(DDKAPI *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 struct _IO_RESOURCE_LIST {
-  USHORT  Version;
-  USHORT  Revision;
-  ULONG  Count;
-  IO_RESOURCE_DESCRIPTOR  Descriptors[1];
-} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_MDL_WRITE_COMPLETE)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN PLARGE_INTEGER  FileOffset,
+  IN PMDL  MdlChain,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
-  ULONG  ListSize;
-  INTERFACE_TYPE  InterfaceType;
-  ULONG  BusNumber;
-  ULONG  SlotNumber;
-  ULONG  Reserved[3];
-  ULONG  AlternativeLists;
-  IO_RESOURCE_LIST  List[1];
-} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
+typedef BOOLEAN
+(DDKAPI *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 VOID
-(DDKAPI DRIVER_CANCEL)(
-  IN struct _DEVICE_OBJECT  *DeviceObject,
-  IN struct _IRP  *Irp);
-typedef DRIVER_CANCEL *PDRIVER_CANCEL;
+typedef BOOLEAN
+(DDKAPI *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 struct _IRP {
-  CSHORT  Type;
-  USHORT  Size;
-  struct _MDL  *MdlAddress;
-  ULONG  Flags;
-  union {
-    struct _IRP  *MasterIrp;
-    volatile LONG  IrpCount;
-    PVOID  SystemBuffer;
-  } AssociatedIrp;
-  LIST_ENTRY  ThreadListEntry;
-  IO_STATUS_BLOCK  IoStatus;
-  KPROCESSOR_MODE  RequestorMode;
-  BOOLEAN  PendingReturned;
-  CHAR  StackCount;
-  CHAR  CurrentLocation;
-  BOOLEAN  Cancel;
-  KIRQL  CancelIrql;
-  CCHAR  ApcEnvironment;
-  UCHAR  AllocationFlags;
-  PIO_STATUS_BLOCK  UserIosb;
-  PKEVENT  UserEvent;
-  union {
-    struct {
-      _ANONYMOUS_UNION union {      
-        PIO_APC_ROUTINE  UserApcRoutine;
-        PVOID IssuingProcess;
-      } DUMMYUNIONNAME;
-      PVOID  UserApcContext;
-    } AsynchronousParameters;
-    LARGE_INTEGER  AllocationSize;
-  } Overlay;
-  volatile PDRIVER_CANCEL  CancelRoutine;
-  PVOID  UserBuffer;
-  union {
-    struct {
-      _ANONYMOUS_UNION union {
-        KDEVICE_QUEUE_ENTRY  DeviceQueueEntry;
-        _ANONYMOUS_STRUCT struct {
-          PVOID  DriverContext[4];
-        } DUMMYSTRUCTNAME;
-      } DUMMYUNIONNAME;
-      PETHREAD  Thread;
-      PCHAR  AuxiliaryBuffer;
-      _ANONYMOUS_STRUCT struct {
-        LIST_ENTRY  ListEntry;
-        _ANONYMOUS_UNION union {
-          struct _IO_STACK_LOCATION  *CurrentStackLocation;
-          ULONG  PacketType;
-        } DUMMYUNIONNAME;
-      } DUMMYSTRUCTNAME;
-      struct _FILE_OBJECT  *OriginalFileObject;
-    } Overlay;
-    KAPC  Apc;
-    PVOID  CompletionKey;
-  } Tail;
-} IRP;
-typedef struct _IRP *PIRP;
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN PMDL  MdlChain,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef enum _IO_PAGING_PRIORITY {
-  IoPagingPriorityInvalid,
-  IoPagingPriorityNormal,
-  IoPagingPriorityHigh,
-  IoPagingPriorityReserved1,
-  IoPagingPriorityReserved2
-} IO_PAGING_PRIORITY;
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN PLARGE_INTEGER  FileOffset,
+  IN PMDL  MdlChain,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef NTSTATUS
-(DDKAPI IO_COMPLETION_ROUTINE)(
-  IN struct _DEVICE_OBJECT  *DeviceObject,
+typedef BOOLEAN
+(DDKAPI *PFAST_IO_QUERY_OPEN)(
   IN struct _IRP  *Irp,
-  IN PVOID  Context);
-typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
+  OUT PFILE_NETWORK_OPEN_INFORMATION  NetworkInformation,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef VOID
-(DDKAPI *PIO_DPC_ROUTINE)(
-  IN struct _KDPC  *Dpc,
-  IN struct _DEVICE_OBJECT  *DeviceObject,
-  IN struct _IRP  *Irp,
-  IN PVOID  Context);
+typedef NTSTATUS
+(DDKAPI *PFAST_IO_RELEASE_FOR_MOD_WRITE)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN struct _ERESOURCE  *ResourceToRelease,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
 typedef NTSTATUS
-(DDKAPI *PMM_DLL_INITIALIZE)(
-  IN PUNICODE_STRING  RegistryPath);
+(DDKAPI *PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
+  IN struct _FILE_OBJECT  *FileObject,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
 typedef NTSTATUS
-(DDKAPI *PMM_DLL_UNLOAD)(
-  VOID);
+(DDKAPI *PFAST_IO_RELEASE_FOR_CCFLUSH) (
+  IN struct _FILE_OBJECT  *FileObject,
+  IN struct _DEVICE_OBJECT  *DeviceObject);
 
-typedef BOOLEAN
-(DDKAPI KSERVICE_ROUTINE)(
-  IN struct _KINTERRUPT  *Interrupt,
-  IN PVOID  ServiceContext);
-typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE;
+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;
 
-typedef VOID
-(DDKAPI *PIO_TIMER_ROUTINE)(
-  IN struct _DEVICE_OBJECT  *DeviceObject,
-  IN PVOID  Context);
+typedef struct _SECTION_OBJECT_POINTERS {
+  PVOID  DataSectionObject;
+  PVOID  SharedCacheMap;
+  PVOID  ImageSectionObject;
+} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
 
-typedef BOOLEAN
-(DDKAPI *PKSYNCHRONIZE_ROUTINE)(
-  IN PVOID  SynchronizeContext);
+typedef struct _IO_COMPLETION_CONTEXT {
+  PVOID  Port;
+  PVOID  Key;
+} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
 
-/******************************************************************************
- *                            Security Manager Types                          *
- ******************************************************************************/
+/* FILE_OBJECT.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_QUEUE_IRP_TO_THREAD       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_RANDOM_ACCESS             0x00100000
+#define FO_FILE_OPEN_CANCELLED       0x00200000
+#define FO_VOLUME_OPEN               0x00400000
+#define FO_REMOTE_ORIGIN             0x01000000
+#define FO_DISALLOW_EXCLUSIVE        0x02000000
+#define FO_SKIP_COMPLETION_PORT      0x02000000
+#define FO_SKIP_SET_EVENT            0x04000000
+#define FO_SKIP_SET_FAST_IO          0x08000000
+
+/* VPB.Flags */
+#define VPB_MOUNTED                       0x0001
+#define VPB_LOCKED                        0x0002
+#define VPB_PERSISTENT                    0x0004
+#define VPB_REMOVE_PENDING                0x0008
+#define VPB_RAW_MOUNT                     0x0010
+#define VPB_DIRECT_WRITES_ALLOWED         0x0020
+
+#define MAXIMUM_VOLUME_LABEL_LENGTH       (32 * sizeof(WCHAR))
+
+/* IRP.Flags */
+
+#define SL_FORCE_ACCESS_CHECK             0x01
+#define SL_OPEN_PAGING_FILE               0x02
+#define SL_OPEN_TARGET_DIRECTORY          0x04
+#define SL_CASE_SENSITIVE                 0x80
+
+#define SL_KEY_SPECIFIED                  0x01
+#define SL_OVERRIDE_VERIFY_VOLUME         0x02
+#define SL_WRITE_THROUGH                  0x04
+#define SL_FT_SEQUENTIAL_WRITE            0x08
+
+#define SL_FAIL_IMMEDIATELY               0x01
+#define SL_EXCLUSIVE_LOCK                 0x02
+
+#define SL_RESTART_SCAN                   0x01
+#define SL_RETURN_SINGLE_ENTRY            0x02
+#define SL_INDEX_SPECIFIED                0x04
+
+#define SL_WATCH_TREE                     0x01
+
+#define SL_ALLOW_RAW_MOUNT                0x01
+
+#define CTL_CODE(DeviceType, Function, Method, Access)( \
+  ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
+
+#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
+
+#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 IRP_QUOTA_CHARGED                 0x01
+#define IRP_ALLOCATED_MUST_SUCCEED        0x02
+#define IRP_ALLOCATED_FIXED_SIZE          0x04
+#define IRP_LOOKASIDE_ALLOCATION          0x08
+
+/*
+** IRP function codes
+*/
+
+#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_SCSI                       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_POWER                      0x16
+#define IRP_MJ_SYSTEM_CONTROL             0x17
+#define IRP_MJ_DEVICE_CHANGE              0x18
+#define IRP_MJ_QUERY_QUOTA                0x19
+#define IRP_MJ_SET_QUOTA                  0x1a
+#define IRP_MJ_PNP                        0x1b
+#define IRP_MJ_PNP_POWER                  0x1b
+#define IRP_MJ_MAXIMUM_FUNCTION           0x1b
+
+#define IRP_MN_SCSI_CLASS                 0x01
+
+#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 IRP_MN_QUERY_DEVICE_RELATIONS       0x07
+#define IRP_MN_QUERY_INTERFACE              0x08
+#define IRP_MN_QUERY_CAPABILITIES           0x09
+#define IRP_MN_QUERY_RESOURCES              0x0A
+#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS  0x0B
+#define IRP_MN_QUERY_DEVICE_TEXT            0x0C
+#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
+
+#define IRP_MN_READ_CONFIG                  0x0F
+#define IRP_MN_WRITE_CONFIG                 0x10
+#define IRP_MN_EJECT                        0x11
+#define IRP_MN_SET_LOCK                     0x12
+#define IRP_MN_QUERY_ID                     0x13
+#define IRP_MN_QUERY_PNP_DEVICE_STATE       0x14
+#define IRP_MN_QUERY_BUS_INFORMATION        0x15
+#define IRP_MN_DEVICE_USAGE_NOTIFICATION    0x16
+#define IRP_MN_SURPRISE_REMOVAL             0x17
+
+#define IRP_MN_WAIT_WAKE                  0x00
+#define IRP_MN_POWER_SEQUENCE             0x01
+#define IRP_MN_SET_POWER                  0x02
+#define IRP_MN_QUERY_POWER                0x03
+
+#define IRP_MN_QUERY_ALL_DATA             0x00
+#define IRP_MN_QUERY_SINGLE_INSTANCE      0x01
+#define IRP_MN_CHANGE_SINGLE_INSTANCE     0x02
+#define IRP_MN_CHANGE_SINGLE_ITEM         0x03
+#define IRP_MN_ENABLE_EVENTS              0x04
+#define IRP_MN_DISABLE_EVENTS             0x05
+#define IRP_MN_ENABLE_COLLECTION          0x06
+#define IRP_MN_DISABLE_COLLECTION         0x07
+#define IRP_MN_REGINFO                    0x08
+#define IRP_MN_EXECUTE_METHOD             0x09
+
+#define IRP_MN_REGINFO_EX                 0x0b
+
+typedef struct _VPB {
+  CSHORT  Type;
+  CSHORT  Size;
+  USHORT  Flags;
+  USHORT  VolumeLabelLength;
+  struct _DEVICE_OBJECT  *DeviceObject;
+  struct _DEVICE_OBJECT  *RealDevice;
+  ULONG  SerialNumber;
+  ULONG  ReferenceCount;
+  WCHAR  VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
+} VPB, *PVPB;
+
+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;
+  ULONG  Characteristics;
+  volatile 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;
+  ULONG  ActiveThreadCount;
+  PSECURITY_DESCRIPTOR  SecurityDescriptor;
+  KEVENT  DeviceLock;
+  USHORT  SectorSize;
+  USHORT  Spare1;
+  struct _DEVOBJ_EXTENSION  *DeviceObjectExtension;
+  PVOID  Reserved;
+} DEVICE_OBJECT, *PDEVICE_OBJECT;
+
+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;
+    volatile ULONG Waiters;
+    volatile ULONG Busy;
+    PVOID LastLock;
+    KEVENT Lock;
+    KEVENT Event;
+    volatile PIO_COMPLETION_CONTEXT CompletionContext;
+    KSPIN_LOCK IrpListLock;
+    LIST_ENTRY IrpList;
+    volatile PVOID FileObjectExtension;
+} FILE_OBJECT;
+typedef struct _FILE_OBJECT *PFILE_OBJECT;
 
-//
-// Access/Security Stuff
-//
-typedef ULONG ACCESS_MASK, *PACCESS_MASK;
-typedef PVOID PACCESS_TOKEN;
+typedef struct _IO_ERROR_LOG_PACKET {
+  UCHAR  MajorFunctionCode;
+  UCHAR  RetryCount;
+  USHORT  DumpDataSize;
+  USHORT  NumberOfStrings;
+  USHORT  StringOffset;
+  USHORT  EventCategory;
+  NTSTATUS  ErrorCode;
+  ULONG  UniqueErrorValue;
+  NTSTATUS  FinalStatus;
+  ULONG  SequenceNumber;
+  ULONG  IoControlCode;
+  LARGE_INTEGER  DeviceOffset;
+  ULONG  DumpData[1];
+} IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
 
-#define DELETE                           0x00010000L
-#define READ_CONTROL                     0x00020000L
-#define WRITE_DAC                        0x00040000L
-#define WRITE_OWNER                      0x00080000L
-#define SYNCHRONIZE                      0x00100000L
-#define STANDARD_RIGHTS_REQUIRED         0x000F0000L
-#define STANDARD_RIGHTS_READ             READ_CONTROL
-#define STANDARD_RIGHTS_WRITE            READ_CONTROL
-#define STANDARD_RIGHTS_EXECUTE          READ_CONTROL
-#define STANDARD_RIGHTS_ALL              0x001F0000L
-#define SPECIFIC_RIGHTS_ALL              0x0000FFFFL
-#define ACCESS_SYSTEM_SECURITY           0x01000000L
-#define MAXIMUM_ALLOWED                  0x02000000L
-#define GENERIC_READ                     0x80000000L
-#define GENERIC_WRITE                    0x40000000L
-#define GENERIC_EXECUTE                  0x20000000L
-#define GENERIC_ALL                      0x10000000L
+typedef struct _IO_ERROR_LOG_MESSAGE {
+  USHORT  Type;
+  USHORT  Size;
+  USHORT  DriverNameLength;
+  LARGE_INTEGER  TimeStamp;
+  ULONG  DriverNameOffset;
+  IO_ERROR_LOG_PACKET  EntryData;
+} IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
 
-typedef struct _GENERIC_MAPPING {
-    ACCESS_MASK GenericRead;
-    ACCESS_MASK GenericWrite;
-    ACCESS_MASK GenericExecute;
-    ACCESS_MASK GenericAll;
-} GENERIC_MAPPING, *PGENERIC_MAPPING;
+#define ERROR_LOG_LIMIT_SIZE               240
+#define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
+                                            sizeof(IO_ERROR_LOG_PACKET) + \
+                                            (sizeof(WCHAR) * 40))
+#define ERROR_LOG_MESSAGE_LIMIT_SIZE                                          \
+    (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
+#define IO_ERROR_LOG_MESSAGE_LENGTH                                           \
+    ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ?           \
+        ERROR_LOG_MESSAGE_LIMIT_SIZE :                                        \
+        PORT_MAXIMUM_MESSAGE_LENGTH)
+#define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH -                 \
+                                IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
 
-#define ACL_REVISION                      2
-#define ACL_REVISION_DS                   4
+typedef enum _DMA_WIDTH {
+  Width8Bits,
+  Width16Bits,
+  Width32Bits,
+  MaximumDmaWidth
+} DMA_WIDTH, *PDMA_WIDTH;
 
-#define ACL_REVISION1                     1
-#define ACL_REVISION2                     2
-#define ACL_REVISION3                     3
-#define ACL_REVISION4                     4
-#define MIN_ACL_REVISION                  ACL_REVISION2
-#define MAX_ACL_REVISION                  ACL_REVISION4
+typedef enum _DMA_SPEED {
+  Compatible,
+  TypeA,
+  TypeB,
+  TypeC,
+  TypeF,
+  MaximumDmaSpeed
+} DMA_SPEED, *PDMA_SPEED;
 
-typedef struct _ACL {
-    UCHAR AclRevision;
-    UCHAR Sbz1;
-    USHORT AclSize;
-    USHORT AceCount;
-    USHORT Sbz2;
-} ACL, *PACL;
+/* DEVICE_DESCRIPTION.Version */
 
+#define DEVICE_DESCRIPTION_VERSION        0x0000
+#define DEVICE_DESCRIPTION_VERSION1       0x0001
+#define DEVICE_DESCRIPTION_VERSION2       0x0002
 
+typedef struct _DEVICE_DESCRIPTION {
+  ULONG  Version;
+  BOOLEAN  Master;
+  BOOLEAN  ScatterGather;
+  BOOLEAN  DemandMode;
+  BOOLEAN  AutoInitialize;
+  BOOLEAN  Dma32BitAddresses;
+  BOOLEAN  IgnoreCount;
+  BOOLEAN  Reserved1;
+  BOOLEAN  Dma64BitAddresses;
+  ULONG  BusNumber;
+  ULONG  DmaChannel;
+  INTERFACE_TYPE  InterfaceType;
+  DMA_WIDTH  DmaWidth;
+  DMA_SPEED  DmaSpeed;
+  ULONG  MaximumLength;
+  ULONG  DmaPort;
+} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
 
-//
-// Current security descriptor revision value
-//
-#define SECURITY_DESCRIPTOR_REVISION     (1)
-#define SECURITY_DESCRIPTOR_REVISION1    (1)
+typedef enum _DEVICE_RELATION_TYPE {
+  BusRelations,
+  EjectionRelations,
+  PowerRelations,
+  RemovalRelations,
+  TargetDeviceRelation,
+  SingleBusRelations,
+  TransportRelations
+} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
 
-//
-// Privilege attributes
-//
-#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L)
-#define SE_PRIVILEGE_ENABLED            (0x00000002L)
-#define SE_PRIVILEGE_REMOVED            (0X00000004L)
-#define SE_PRIVILEGE_USED_FOR_ACCESS    (0x80000000L)
+typedef struct _DEVICE_RELATIONS {
+  ULONG  Count;
+  PDEVICE_OBJECT Objects[1];
+} DEVICE_RELATIONS, *PDEVICE_RELATIONS;
 
-#define SE_PRIVILEGE_VALID_ATTRIBUTES   (SE_PRIVILEGE_ENABLED_BY_DEFAULT | \
-                                         SE_PRIVILEGE_ENABLED            | \
-                                         SE_PRIVILEGE_REMOVED            | \
-                                         SE_PRIVILEGE_USED_FOR_ACCESS)
+typedef struct _DEVOBJ_EXTENSION
+{
+    CSHORT Type;
+    USHORT Size;
+    PDEVICE_OBJECT DeviceObject;
+} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
 
-#include <pshpack4.h>
-typedef struct _LUID_AND_ATTRIBUTES {
-    LUID Luid;
-    ULONG Attributes;
-} LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
-#include <poppack.h>
-typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
-typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
+typedef struct _SCATTER_GATHER_ELEMENT {
+  PHYSICAL_ADDRESS  Address;
+  ULONG  Length;
+  ULONG_PTR  Reserved;
+} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
 
+#if defined(_MSC_EXTENSIONS)
 
+#if _MSC_VER >= 1200
+#pragma warning(push)
+#endif
+#pragma warning(disable:4200)
+typedef struct _SCATTER_GATHER_LIST {
+  ULONG  NumberOfElements;
+  ULONG_PTR  Reserved;
+  SCATTER_GATHER_ELEMENT  Elements[1];
+} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
 
-//
-// Privilege sets
-//
-#define PRIVILEGE_SET_ALL_NECESSARY (1)
+#if _MSC_VER >= 1200
+#pragma warning(pop)
+#else
+#pragma warning(default:4200)
+#endif
 
-typedef struct _PRIVILEGE_SET {
-    ULONG PrivilegeCount;
-    ULONG Control;
-    LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
-} PRIVILEGE_SET,*PPRIVILEGE_SET;
+#else
 
-typedef enum _SECURITY_IMPERSONATION_LEVEL {
-    SecurityAnonymous,
-    SecurityIdentification,
-    SecurityImpersonation,
-    SecurityDelegation
-} SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL;
+struct _SCATTER_GATHER_LIST;
+typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
 
-#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
-#define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous
-#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
-#define VALID_IMPERSONATION_LEVEL(Level) (((Level) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((Level) <= SECURITY_MAX_IMPERSONATION_LEVEL))
+#endif
 
-#define SECURITY_DYNAMIC_TRACKING (TRUE)
-#define SECURITY_STATIC_TRACKING (FALSE)
+typedef NTSTATUS
+(DDKAPI DRIVER_ADD_DEVICE)(
+  IN struct _DRIVER_OBJECT  *DriverObject,
+  IN struct _DEVICE_OBJECT  *PhysicalDeviceObject);
+typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
 
-typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, *PSECURITY_CONTEXT_TRACKING_MODE;
+typedef struct _DRIVER_EXTENSION {
+  struct _DRIVER_OBJECT  *DriverObject;
+  PDRIVER_ADD_DEVICE  AddDevice;
+  ULONG  Count;
+  UNICODE_STRING  ServiceKeyName;
+} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
 
-typedef struct _SECURITY_QUALITY_OF_SERVICE {
-    ULONG Length;
-    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
-    SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
-    BOOLEAN EffectiveOnly;
-} SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
+#define DRVO_UNLOAD_INVOKED               0x00000001
+#define DRVO_LEGACY_DRIVER                0x00000002
+#define DRVO_BUILTIN_DRIVER               0x00000004
 
-typedef struct _SE_IMPERSONATION_STATE {
-    PACCESS_TOKEN Token;
-    BOOLEAN CopyOnOpen;
-    BOOLEAN EffectiveOnly;
-    SECURITY_IMPERSONATION_LEVEL Level;
-} SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE;
+typedef NTSTATUS
+(DDKAPI DRIVER_INITIALIZE)(
+  IN struct _DRIVER_OBJECT  *DriverObject,
+  IN PUNICODE_STRING  RegistryPath);
+typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
 
-#define OWNER_SECURITY_INFORMATION       (0x00000001L)
-#define GROUP_SECURITY_INFORMATION       (0x00000002L)
-#define DACL_SECURITY_INFORMATION        (0x00000004L)
-#define SACL_SECURITY_INFORMATION        (0x00000008L)
-#define LABEL_SECURITY_INFORMATION       (0x00000010L)
+typedef VOID
+(DDKAPI DRIVER_STARTIO)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp);
+typedef DRIVER_STARTIO *PDRIVER_STARTIO;
 
-#define PROTECTED_DACL_SECURITY_INFORMATION     (0x80000000L)
-#define PROTECTED_SACL_SECURITY_INFORMATION     (0x40000000L)
-#define UNPROTECTED_DACL_SECURITY_INFORMATION   (0x20000000L)
-#define UNPROTECTED_SACL_SECURITY_INFORMATION   (0x10000000L)
+typedef VOID
+(DDKAPI DRIVER_UNLOAD)(
+  IN struct _DRIVER_OBJECT  *DriverObject);
+typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
 
-typedef enum _SECURITY_OPERATION_CODE {
-  SetSecurityDescriptor,
-  QuerySecurityDescriptor,
-  DeleteSecurityDescriptor,
-  AssignSecurityDescriptor
-} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
+typedef NTSTATUS
+(DDKAPI DRIVER_DISPATCH)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp);
+typedef DRIVER_DISPATCH *PDRIVER_DISPATCH;
 
-#define INITIAL_PRIVILEGE_COUNT           3
+typedef struct _DRIVER_OBJECT {
+  CSHORT  Type;
+  CSHORT  Size;
+  PDEVICE_OBJECT  DeviceObject;
+  ULONG  Flags;
+  PVOID  DriverStart;
+  ULONG  DriverSize;
+  PVOID  DriverSection;
+  PDRIVER_EXTENSION  DriverExtension;
+  UNICODE_STRING  DriverName;
+  PUNICODE_STRING  HardwareDatabase;
+  struct _FAST_IO_DISPATCH *FastIoDispatch;
+  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;
 
-typedef struct _INITIAL_PRIVILEGE_SET {
-  ULONG  PrivilegeCount;
-  ULONG  Control;
-  LUID_AND_ATTRIBUTES  Privilege[INITIAL_PRIVILEGE_COUNT];
-} INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
+typedef struct _DMA_ADAPTER {
+  USHORT  Version;
+  USHORT  Size;
+  struct _DMA_OPERATIONS*  DmaOperations;
+} DMA_ADAPTER, *PDMA_ADAPTER;
 
-#define SE_MIN_WELL_KNOWN_PRIVILEGE         2
-#define SE_CREATE_TOKEN_PRIVILEGE           2
-#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE     3
-#define SE_LOCK_MEMORY_PRIVILEGE            4
-#define SE_INCREASE_QUOTA_PRIVILEGE         5
-#define SE_MACHINE_ACCOUNT_PRIVILEGE        6
-#define SE_TCB_PRIVILEGE                    7
-#define SE_SECURITY_PRIVILEGE               8
-#define SE_TAKE_OWNERSHIP_PRIVILEGE         9
-#define SE_LOAD_DRIVER_PRIVILEGE            10
-#define SE_SYSTEM_PROFILE_PRIVILEGE         11
-#define SE_SYSTEMTIME_PRIVILEGE             12
-#define SE_PROF_SINGLE_PROCESS_PRIVILEGE    13
-#define SE_INC_BASE_PRIORITY_PRIVILEGE      14
-#define SE_CREATE_PAGEFILE_PRIVILEGE        15
-#define SE_CREATE_PERMANENT_PRIVILEGE       16
-#define SE_BACKUP_PRIVILEGE                 17
-#define SE_RESTORE_PRIVILEGE                18
-#define SE_SHUTDOWN_PRIVILEGE               19
-#define SE_DEBUG_PRIVILEGE                  20
-#define SE_AUDIT_PRIVILEGE                  21
-#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE     22
-#define SE_CHANGE_NOTIFY_PRIVILEGE          23
-#define SE_REMOTE_SHUTDOWN_PRIVILEGE        24
-#define SE_UNDOCK_PRIVILEGE                 25
-#define SE_SYNC_AGENT_PRIVILEGE             26
-#define SE_ENABLE_DELEGATION_PRIVILEGE      27
-#define SE_MANAGE_VOLUME_PRIVILEGE          28
-#define SE_IMPERSONATE_PRIVILEGE            29
-#define SE_CREATE_GLOBAL_PRIVILEGE          30
-#define SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE 31
-#define SE_RELABEL_PRIVILEGE                32
-#define SE_INC_WORKING_SET_PRIVILEGE        33
-#define SE_TIME_ZONE_PRIVILEGE              34
-#define SE_CREATE_SYMBOLIC_LINK_PRIVILEGE   35
-#define SE_MAX_WELL_KNOWN_PRIVILEGE         SE_CREATE_SYMBOLIC_LINK_PRIVILEGE
+typedef VOID
+(DDKAPI *PPUT_DMA_ADAPTER)(
+  IN PDMA_ADAPTER  DmaAdapter);
 
-typedef struct _SECURITY_SUBJECT_CONTEXT {
-  PACCESS_TOKEN  ClientToken;
-  SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel;
-  PACCESS_TOKEN  PrimaryToken;
-  PVOID  ProcessAuditId;
-} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
+typedef PVOID
+(DDKAPI *PALLOCATE_COMMON_BUFFER)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN ULONG  Length,
+  OUT PPHYSICAL_ADDRESS  LogicalAddress,
+  IN BOOLEAN  CacheEnabled);
 
-/******************************************************************************
- *                            Configuration Manager Types                     *
- ******************************************************************************/
+typedef VOID
+(DDKAPI *PFREE_COMMON_BUFFER)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN ULONG  Length,
+  IN PHYSICAL_ADDRESS  LogicalAddress,
+  IN PVOID  VirtualAddress,
+  IN BOOLEAN  CacheEnabled);
 
-//
-// Registry Access Rights
-//
-#define KEY_QUERY_VALUE         (0x0001)
-#define KEY_SET_VALUE           (0x0002)
-#define KEY_CREATE_SUB_KEY      (0x0004)
-#define KEY_ENUMERATE_SUB_KEYS  (0x0008)
-#define KEY_NOTIFY              (0x0010)
-#define KEY_CREATE_LINK         (0x0020)
-#define KEY_WOW64_32KEY         (0x0200)
-#define KEY_WOW64_64KEY         (0x0100)
-#define KEY_WOW64_RES           (0x0300)
+typedef NTSTATUS
+(DDKAPI *PALLOCATE_ADAPTER_CHANNEL)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PDEVICE_OBJECT  DeviceObject,
+  IN ULONG  NumberOfMapRegisters,
+  IN PDRIVER_CONTROL  ExecutionRoutine,
+  IN PVOID  Context);
 
-#define KEY_READ                ((STANDARD_RIGHTS_READ       |\
-                                  KEY_QUERY_VALUE            |\
-                                  KEY_ENUMERATE_SUB_KEYS     |\
-                                  KEY_NOTIFY)                 \
-                                  &                           \
-                                 (~SYNCHRONIZE))
+typedef BOOLEAN
+(DDKAPI *PFLUSH_ADAPTER_BUFFERS)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PMDL  Mdl,
+  IN PVOID  MapRegisterBase,
+  IN PVOID  CurrentVa,
+  IN ULONG  Length,
+  IN BOOLEAN  WriteToDevice);
 
-#define KEY_WRITE               ((STANDARD_RIGHTS_WRITE      |\
-                                  KEY_SET_VALUE              |\
-                                  KEY_CREATE_SUB_KEY)         \
-                                  &                           \
-                                 (~SYNCHRONIZE))
+typedef VOID
+(DDKAPI *PFREE_ADAPTER_CHANNEL)(
+  IN PDMA_ADAPTER  DmaAdapter);
 
-#define KEY_EXECUTE             ((KEY_READ)                   \
-                                  &                           \
-                                 (~SYNCHRONIZE))
+typedef VOID
+(DDKAPI *PFREE_MAP_REGISTERS)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  PVOID  MapRegisterBase,
+  ULONG  NumberOfMapRegisters);
 
-#define KEY_ALL_ACCESS          ((STANDARD_RIGHTS_ALL        |\
-                                  KEY_QUERY_VALUE            |\
-                                  KEY_SET_VALUE              |\
-                                  KEY_CREATE_SUB_KEY         |\
-                                  KEY_ENUMERATE_SUB_KEYS     |\
-                                  KEY_NOTIFY                 |\
-                                  KEY_CREATE_LINK)            \
-                                  &                           \
-                                 (~SYNCHRONIZE))
+typedef PHYSICAL_ADDRESS
+(DDKAPI *PMAP_TRANSFER)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PMDL  Mdl,
+  IN PVOID  MapRegisterBase,
+  IN PVOID  CurrentVa,
+  IN OUT PULONG  Length,
+  IN BOOLEAN  WriteToDevice);
 
-//
-// Registry Open/Create Options
-//
-#define REG_OPTION_RESERVED         (0x00000000L)
-#define REG_OPTION_NON_VOLATILE     (0x00000000L)
-#define REG_OPTION_VOLATILE         (0x00000001L)
-#define REG_OPTION_CREATE_LINK      (0x00000002L)
-#define REG_OPTION_BACKUP_RESTORE   (0x00000004L)
-#define REG_OPTION_OPEN_LINK        (0x00000008L)
+typedef ULONG
+(DDKAPI *PGET_DMA_ALIGNMENT)(
+  IN PDMA_ADAPTER  DmaAdapter);
 
-#define REG_LEGAL_OPTION            \
-                (REG_OPTION_RESERVED            |\
-                 REG_OPTION_NON_VOLATILE        |\
-                 REG_OPTION_VOLATILE            |\
-                 REG_OPTION_CREATE_LINK         |\
-                 REG_OPTION_BACKUP_RESTORE      |\
-                 REG_OPTION_OPEN_LINK)
+typedef ULONG
+(DDKAPI *PREAD_DMA_COUNTER)(
+  IN PDMA_ADAPTER  DmaAdapter);
 
-//
-// Key creation/open disposition
-//
-#define REG_CREATED_NEW_KEY         (0x00000001L)
-#define REG_OPENED_EXISTING_KEY     (0x00000002L)
+typedef VOID
+(DDKAPI *PDRIVER_LIST_CONTROL)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp,
+  IN struct _SCATTER_GATHER_LIST  *ScatterGather,
+  IN PVOID  Context);
 
-//
-// Key restore & hive load flags
-//
-#define REG_WHOLE_HIVE_VOLATILE         (0x00000001L)
-#define REG_REFRESH_HIVE                (0x00000002L)
-#define REG_NO_LAZY_FLUSH               (0x00000004L)
-#define REG_FORCE_RESTORE               (0x00000008L)
-#define REG_APP_HIVE                    (0x00000010L)
-#define REG_PROCESS_PRIVATE             (0x00000020L)
-#define REG_START_JOURNAL               (0x00000040L)
-#define REG_HIVE_EXACT_FILE_GROWTH      (0x00000080L)
-#define REG_HIVE_NO_RM                  (0x00000100L)
-#define REG_HIVE_SINGLE_LOG             (0x00000200L)
+typedef NTSTATUS
+(DDKAPI *PGET_SCATTER_GATHER_LIST)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PDEVICE_OBJECT  DeviceObject,
+  IN PMDL  Mdl,
+  IN PVOID  CurrentVa,
+  IN ULONG  Length,
+  IN PDRIVER_LIST_CONTROL  ExecutionRoutine,
+  IN PVOID  Context,
+  IN BOOLEAN  WriteToDevice);
 
-//
-// Unload Flags
-//
-#define REG_FORCE_UNLOAD            1
+typedef VOID
+(DDKAPI *PPUT_SCATTER_GATHER_LIST)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PSCATTER_GATHER_LIST  ScatterGather,
+  IN BOOLEAN  WriteToDevice);
+
+typedef NTSTATUS
+(DDKAPI *PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PMDL  Mdl  OPTIONAL,
+  IN PVOID  CurrentVa,
+  IN ULONG  Length,
+  OUT PULONG  ScatterGatherListSize,
+  OUT PULONG  pNumberOfMapRegisters  OPTIONAL);
 
-//
-// Notify Filter Values
-//
-#define REG_NOTIFY_CHANGE_NAME          (0x00000001L)
-#define REG_NOTIFY_CHANGE_ATTRIBUTES    (0x00000002L)
-#define REG_NOTIFY_CHANGE_LAST_SET      (0x00000004L)
-#define REG_NOTIFY_CHANGE_SECURITY      (0x00000008L)
+typedef NTSTATUS
+(DDKAPI *PBUILD_SCATTER_GATHER_LIST)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PDEVICE_OBJECT  DeviceObject,
+  IN PMDL  Mdl,
+  IN PVOID  CurrentVa,
+  IN ULONG  Length,
+  IN PDRIVER_LIST_CONTROL  ExecutionRoutine,
+  IN PVOID  Context,
+  IN BOOLEAN  WriteToDevice,
+  IN PVOID  ScatterGatherBuffer,
+  IN ULONG  ScatterGatherLength);
 
-#define REG_LEGAL_CHANGE_FILTER                 \
-                (REG_NOTIFY_CHANGE_NAME          |\
-                 REG_NOTIFY_CHANGE_ATTRIBUTES    |\
-                 REG_NOTIFY_CHANGE_LAST_SET      |\
-                 REG_NOTIFY_CHANGE_SECURITY)
+typedef NTSTATUS
+(DDKAPI *PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
+  IN PDMA_ADAPTER  DmaAdapter,
+  IN PSCATTER_GATHER_LIST  ScatterGather,
+  IN PMDL  OriginalMdl,
+  OUT PMDL  *TargetMdl);
 
-typedef struct _CM_FLOPPY_DEVICE_DATA {
-  USHORT  Version;
-  USHORT  Revision;
-  CHAR  Size[8];
-  ULONG  MaxDensity;
-  ULONG  MountDensity;
-  UCHAR  StepRateHeadUnloadTime;
-  UCHAR  HeadLoadTime;
-  UCHAR  MotorOffTime;
-  UCHAR  SectorLengthCode;
-  UCHAR  SectorPerTrack;
-  UCHAR  ReadWriteGapLength;
-  UCHAR  DataTransferLength;
-  UCHAR  FormatGapLength;
-  UCHAR  FormatFillCharacter;
-  UCHAR  HeadSettleTime;
-  UCHAR  MotorSettleTime;
-  UCHAR  MaximumTrackValue;
-  UCHAR  DataTransferRate;
-} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
+typedef struct _DMA_OPERATIONS {
+  ULONG  Size;
+  PPUT_DMA_ADAPTER  PutDmaAdapter;
+  PALLOCATE_COMMON_BUFFER  AllocateCommonBuffer;
+  PFREE_COMMON_BUFFER  FreeCommonBuffer;
+  PALLOCATE_ADAPTER_CHANNEL  AllocateAdapterChannel;
+  PFLUSH_ADAPTER_BUFFERS  FlushAdapterBuffers;
+  PFREE_ADAPTER_CHANNEL  FreeAdapterChannel;
+  PFREE_MAP_REGISTERS  FreeMapRegisters;
+  PMAP_TRANSFER  MapTransfer;
+  PGET_DMA_ALIGNMENT  GetDmaAlignment;
+  PREAD_DMA_COUNTER  ReadDmaCounter;
+  PGET_SCATTER_GATHER_LIST  GetScatterGatherList;
+  PPUT_SCATTER_GATHER_LIST  PutScatterGatherList;
+  PCALCULATE_SCATTER_GATHER_LIST_SIZE  CalculateScatterGatherList;
+  PBUILD_SCATTER_GATHER_LIST  BuildScatterGatherList;
+  PBUILD_MDL_FROM_SCATTER_GATHER_LIST  BuildMdlFromScatterGatherList;
+} DMA_OPERATIONS, *PDMA_OPERATIONS;
 
-#include <pshpack4.h>
-typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
-  UCHAR Type;
-  UCHAR ShareDisposition;
-  USHORT Flags;
+typedef struct _IO_RESOURCE_DESCRIPTOR {
+  UCHAR  Option;
+  UCHAR  Type;
+  UCHAR  ShareDisposition;
+  UCHAR  Spare1;
+  USHORT  Flags;
+  USHORT  Spare2;
   union {
     struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length;
-    } Generic;
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length;
+      ULONG  Length;
+      ULONG  Alignment;
+      PHYSICAL_ADDRESS  MinimumAddress;
+      PHYSICAL_ADDRESS  MaximumAddress;
     } Port;
     struct {
-      ULONG Level;
-      ULONG Vector;
-      KAFFINITY Affinity;
-    } Interrupt;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    struct {
-      __GNU_EXTENSION union {
-        struct {
-          USHORT Reserved;
-          USHORT MessageCount;
-          ULONG Vector;
-          KAFFINITY Affinity;
-        } Raw;
-        struct {
-          ULONG Level;
-          ULONG Vector;
-          KAFFINITY Affinity;
-        } Translated;
-      };
-    } MessageInterrupt;
-#endif
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length;
+      ULONG  Length;
+      ULONG  Alignment;
+      PHYSICAL_ADDRESS  MinimumAddress;
+      PHYSICAL_ADDRESS  MaximumAddress;
     } Memory;
     struct {
-      ULONG Channel;
-      ULONG Port;
-      ULONG Reserved1;
+      ULONG  MinimumVector;
+      ULONG  MaximumVector;
+    } Interrupt;
+    struct {
+      ULONG  MinimumChannel;
+      ULONG  MaximumChannel;
     } Dma;
     struct {
-      ULONG Data[3];
+      ULONG  Length;
+      ULONG  Alignment;
+      PHYSICAL_ADDRESS  MinimumAddress;
+      PHYSICAL_ADDRESS  MaximumAddress;
+    } Generic;
+    struct {
+      ULONG  Data[3];
     } DevicePrivate;
     struct {
-      ULONG Start;
-      ULONG Length;
-      ULONG Reserved;
+      ULONG  Length;
+      ULONG  MinBusNumber;
+      ULONG  MaxBusNumber;
+      ULONG  Reserved;
     } BusNumber;
     struct {
-      ULONG DataSize;
-      ULONG Reserved1;
-      ULONG Reserved2;
-    } DeviceSpecificData;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length40;
-    } Memory40;
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length48;
-    } Memory48;
-    struct {
-      PHYSICAL_ADDRESS Start;
-      ULONG Length64;
-    } Memory64;
-#endif
+      ULONG  Priority;
+      ULONG  Reserved1;
+      ULONG  Reserved2;
+    } ConfigData;
   } u;
-} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
-#include <poppack.h>
+} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
 
-#include <pshpack1.h>
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
+typedef struct _IO_RESOURCE_LIST {
+  USHORT  Version;
+  USHORT  Revision;
+  ULONG  Count;
+  IO_RESOURCE_DESCRIPTOR  Descriptors[1];
+} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
 
-#define CmResourceTypeNull                0
-#define CmResourceTypePort                1
-#define CmResourceTypeInterrupt           2
-#define CmResourceTypeMemory              3
-#define CmResourceTypeDma                 4
-#define CmResourceTypeDeviceSpecific      5
-#define CmResourceTypeBusNumber           6
-#define CmResourceTypeMemoryLarge         7
-#define CmResourceTypeNonArbitrated     128
-#define CmResourceTypeConfigData        128
-#define CmResourceTypeDevicePrivate     129
-#define CmResourceTypePcCardConfig      130
-#define CmResourceTypeMfCardConfig      131
+typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
+  ULONG  ListSize;
+  INTERFACE_TYPE  InterfaceType;
+  ULONG  BusNumber;
+  ULONG  SlotNumber;
+  ULONG  Reserved[3];
+  ULONG  AlternativeLists;
+  IO_RESOURCE_LIST  List[1];
+} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
+
+typedef VOID
+(DDKAPI DRIVER_CANCEL)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp);
+typedef DRIVER_CANCEL *PDRIVER_CANCEL;
+
+typedef struct _IRP {
+  CSHORT  Type;
+  USHORT  Size;
+  struct _MDL  *MdlAddress;
+  ULONG  Flags;
+  union {
+    struct _IRP  *MasterIrp;
+    volatile LONG  IrpCount;
+    PVOID  SystemBuffer;
+  } AssociatedIrp;
+  LIST_ENTRY  ThreadListEntry;
+  IO_STATUS_BLOCK  IoStatus;
+  KPROCESSOR_MODE  RequestorMode;
+  BOOLEAN  PendingReturned;
+  CHAR  StackCount;
+  CHAR  CurrentLocation;
+  BOOLEAN  Cancel;
+  KIRQL  CancelIrql;
+  CCHAR  ApcEnvironment;
+  UCHAR  AllocationFlags;
+  PIO_STATUS_BLOCK  UserIosb;
+  PKEVENT  UserEvent;
+  union {
+    struct {
+      _ANONYMOUS_UNION union {      
+        PIO_APC_ROUTINE  UserApcRoutine;
+        PVOID IssuingProcess;
+      } DUMMYUNIONNAME;
+      PVOID  UserApcContext;
+    } AsynchronousParameters;
+    LARGE_INTEGER  AllocationSize;
+  } Overlay;
+  volatile PDRIVER_CANCEL  CancelRoutine;
+  PVOID  UserBuffer;
+  union {
+    struct {
+      _ANONYMOUS_UNION union {
+        KDEVICE_QUEUE_ENTRY  DeviceQueueEntry;
+        _ANONYMOUS_STRUCT struct {
+          PVOID  DriverContext[4];
+        } DUMMYSTRUCTNAME;
+      } DUMMYUNIONNAME;
+      PETHREAD  Thread;
+      PCHAR  AuxiliaryBuffer;
+      _ANONYMOUS_STRUCT struct {
+        LIST_ENTRY  ListEntry;
+        _ANONYMOUS_UNION union {
+          struct _IO_STACK_LOCATION  *CurrentStackLocation;
+          ULONG  PacketType;
+        } DUMMYUNIONNAME;
+      } DUMMYSTRUCTNAME;
+      struct _FILE_OBJECT  *OriginalFileObject;
+    } Overlay;
+    KAPC  Apc;
+    PVOID  CompletionKey;
+  } Tail;
+} IRP;
+typedef struct _IRP *PIRP;
 
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
+typedef enum _IO_PAGING_PRIORITY {
+  IoPagingPriorityInvalid,
+  IoPagingPriorityNormal,
+  IoPagingPriorityHigh,
+  IoPagingPriorityReserved1,
+  IoPagingPriorityReserved2
+} IO_PAGING_PRIORITY;
 
-typedef enum _CM_SHARE_DISPOSITION {
-  CmResourceShareUndetermined,
-  CmResourceShareDeviceExclusive,
-  CmResourceShareDriverExclusive,
-  CmResourceShareShared
-} CM_SHARE_DISPOSITION;
+typedef NTSTATUS
+(DDKAPI IO_COMPLETION_ROUTINE)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp,
+  IN PVOID  Context);
+typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
 
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
+typedef VOID
+(DDKAPI *PIO_DPC_ROUTINE)(
+  IN struct _KDPC  *Dpc,
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp,
+  IN PVOID  Context);
 
-#define CM_RESOURCE_PORT_MEMORY           0x0000
-#define CM_RESOURCE_PORT_IO               0x0001
-#define CM_RESOURCE_PORT_10_BIT_DECODE    0x0004
-#define CM_RESOURCE_PORT_12_BIT_DECODE    0x0008
-#define CM_RESOURCE_PORT_16_BIT_DECODE    0x0010
-#define CM_RESOURCE_PORT_POSITIVE_DECODE  0x0020
-#define CM_RESOURCE_PORT_PASSIVE_DECODE   0x0040
-#define CM_RESOURCE_PORT_WINDOW_DECODE    0x0080
-#define CM_RESOURCE_PORT_BAR              0x0100
+typedef NTSTATUS
+(DDKAPI *PMM_DLL_INITIALIZE)(
+  IN PUNICODE_STRING  RegistryPath);
 
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
+typedef NTSTATUS
+(DDKAPI *PMM_DLL_UNLOAD)(
+  VOID);
 
-#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
-#define CM_RESOURCE_INTERRUPT_LATCHED         0x0001
-#define CM_RESOURCE_INTERRUPT_MESSAGE         0x0002
-#define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 0x0004
+typedef BOOLEAN
+(DDKAPI KSERVICE_ROUTINE)(
+  IN struct _KINTERRUPT  *Interrupt,
+  IN PVOID  ServiceContext);
+typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE;
 
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
+typedef VOID
+(DDKAPI *PIO_TIMER_ROUTINE)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN PVOID  Context);
 
-#define CM_RESOURCE_MEMORY_READ_WRITE                    0x0000
-#define CM_RESOURCE_MEMORY_READ_ONLY                     0x0001
-#define CM_RESOURCE_MEMORY_WRITE_ONLY                    0x0002
-#define CM_RESOURCE_MEMORY_WRITEABILITY_MASK             0x0003
-#define CM_RESOURCE_MEMORY_PREFETCHABLE                  0x0004
-#define CM_RESOURCE_MEMORY_COMBINEDWRITE                 0x0008
-#define CM_RESOURCE_MEMORY_24                            0x0010
-#define CM_RESOURCE_MEMORY_CACHEABLE                     0x0020
-#define CM_RESOURCE_MEMORY_WINDOW_DECODE                 0x0040
-#define CM_RESOURCE_MEMORY_BAR                           0x0080
-#define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE 0x0100
+typedef BOOLEAN
+(DDKAPI *PKSYNCHRONIZE_ROUTINE)(
+  IN PVOID  SynchronizeContext);
 
-/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
+typedef struct _IO_SECURITY_CONTEXT {
+  PSECURITY_QUALITY_OF_SERVICE  SecurityQos;
+  PACCESS_STATE  AccessState;
+  ACCESS_MASK  DesiredAccess;
+  ULONG  FullCreateOptions;
+} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
 
-#define CM_RESOURCE_DMA_8                 0x0000
-#define CM_RESOURCE_DMA_16                0x0001
-#define CM_RESOURCE_DMA_32                0x0002
-#define CM_RESOURCE_DMA_8_AND_16          0x0004
-#define CM_RESOURCE_DMA_BUS_MASTER        0x0008
-#define CM_RESOURCE_DMA_TYPE_A            0x0010
-#define CM_RESOURCE_DMA_TYPE_B            0x0020
-#define CM_RESOURCE_DMA_TYPE_F            0x0040
+struct _IO_CSQ;
 
-typedef struct _CM_PARTIAL_RESOURCE_LIST {
-  USHORT  Version;
-  USHORT  Revision;
-  ULONG  Count;
-  CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
-} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
+typedef struct _IO_CSQ_IRP_CONTEXT {
+  ULONG  Type;
+  struct _IRP  *Irp;
+  struct _IO_CSQ  *Csq;
+} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
 
-typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
-  INTERFACE_TYPE  InterfaceType;
-  ULONG  BusNumber;
-  CM_PARTIAL_RESOURCE_LIST  PartialResourceList;
-} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
+typedef VOID
+(DDKAPI *PIO_CSQ_INSERT_IRP)(
+  IN struct _IO_CSQ  *Csq,
+  IN PIRP  Irp);
 
-typedef struct _CM_RESOURCE_LIST {
-  ULONG  Count;
-  CM_FULL_RESOURCE_DESCRIPTOR  List[1];
-} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
+typedef VOID
+(DDKAPI *PIO_CSQ_REMOVE_IRP)(
+  IN struct _IO_CSQ  *Csq,
+  IN PIRP  Irp);
 
-typedef struct _CM_INT13_DRIVE_PARAMETER {
-  USHORT  DriveSelect;
-  ULONG  MaxCylinders;
-  USHORT  SectorsPerTrack;
-  USHORT  MaxHeads;
-  USHORT  NumberDrives;
-} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
+typedef PIRP
+(DDKAPI *PIO_CSQ_PEEK_NEXT_IRP)(
+  IN struct _IO_CSQ  *Csq,
+  IN PIRP  Irp,
+  IN PVOID  PeekContext);
 
-typedef struct _CM_PNP_BIOS_DEVICE_NODE
-{
-    USHORT Size;
-    UCHAR Node;
-    ULONG ProductId;
-    UCHAR DeviceType[3];
-    USHORT DeviceAttributes;
-} CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE;
+typedef VOID
+(DDKAPI *PIO_CSQ_ACQUIRE_LOCK)(
+  IN  struct _IO_CSQ  *Csq,
+  OUT PKIRQL  Irql);
 
-typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK
-{
-    UCHAR Signature[4];
-    UCHAR Revision;
-    UCHAR Length;
-    USHORT ControlField;
-    UCHAR Checksum;
-    ULONG EventFlagAddress;
-    USHORT RealModeEntryOffset;
-    USHORT RealModeEntrySegment;
-    USHORT ProtectedModeEntryOffset;
-    ULONG ProtectedModeCodeBaseAddress;
-    ULONG OemDeviceId;
-    USHORT RealModeDataBaseAddress;
-    ULONG ProtectedModeDataBaseAddress;
-} CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
+typedef VOID
+(DDKAPI *PIO_CSQ_RELEASE_LOCK)(
+  IN struct _IO_CSQ  *Csq,
+  IN KIRQL  Irql);
 
+typedef VOID
+(DDKAPI *PIO_CSQ_COMPLETE_CANCELED_IRP)(
+  IN  struct _IO_CSQ  *Csq,
+  IN  PIRP  Irp);
+
+typedef struct _IO_CSQ {
+  ULONG  Type;
+  PIO_CSQ_INSERT_IRP  CsqInsertIrp;
+  PIO_CSQ_REMOVE_IRP  CsqRemoveIrp;
+  PIO_CSQ_PEEK_NEXT_IRP  CsqPeekNextIrp;
+  PIO_CSQ_ACQUIRE_LOCK  CsqAcquireLock;
+  PIO_CSQ_RELEASE_LOCK  CsqReleaseLock;
+  PIO_CSQ_COMPLETE_CANCELED_IRP  CsqCompleteCanceledIrp;
+  PVOID  ReservePointer;
+} IO_CSQ, *PIO_CSQ;
+
+typedef enum _BUS_QUERY_ID_TYPE {
+  BusQueryDeviceID,
+  BusQueryHardwareIDs,
+  BusQueryCompatibleIDs,
+  BusQueryInstanceID,
+  BusQueryDeviceSerialNumber
+} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
+
+typedef enum _DEVICE_TEXT_TYPE {
+  DeviceTextDescription,
+  DeviceTextLocationInformation
+} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
+
+#if !defined(_ALPHA_)
+#include <pshpack4.h>
+#endif
+typedef struct _IO_STACK_LOCATION {
+  UCHAR  MajorFunction;
+  UCHAR  MinorFunction;
+  UCHAR  Flags;
+  UCHAR  Control;
+  union {
+    struct {
+      PIO_SECURITY_CONTEXT  SecurityContext;
+      ULONG  Options;
+      USHORT POINTER_ALIGNMENT  FileAttributes;
+      USHORT  ShareAccess;
+      ULONG POINTER_ALIGNMENT  EaLength;
+    } Create;
+    struct {
+      ULONG  Length;
+      ULONG POINTER_ALIGNMENT  Key;
+      LARGE_INTEGER  ByteOffset;
+    } Read;
+    struct {
+      ULONG  Length;
+      ULONG POINTER_ALIGNMENT  Key;
+      LARGE_INTEGER  ByteOffset;
+    } Write;
+    struct {
+      ULONG  Length;
+      PUNICODE_STRING  FileName;
+      FILE_INFORMATION_CLASS  FileInformationClass;
+      ULONG  FileIndex;
+    } QueryDirectory;
+    struct {
+      ULONG  Length;
+      ULONG  CompletionFilter;
+    } NotifyDirectory;
+    struct {
+      ULONG  Length;
+      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
+    } QueryFile;
+    struct {
+      ULONG  Length;
+      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
+      PFILE_OBJECT  FileObject;
+      _ANONYMOUS_UNION union {
+        _ANONYMOUS_STRUCT struct {
+          BOOLEAN  ReplaceIfExists;
+          BOOLEAN  AdvanceOnly;
+        } DUMMYSTRUCTNAME;
+        ULONG  ClusterCount;
+        HANDLE  DeleteHandle;
+      } DUMMYUNIONNAME;
+    } SetFile;
+    struct {
+      ULONG  Length;
+      PVOID  EaList;
+      ULONG  EaListLength;
+      ULONG  EaIndex;
+    } QueryEa;
+    struct {
+      ULONG  Length;
+    } SetEa;
+    struct {
+      ULONG  Length;
+      FS_INFORMATION_CLASS POINTER_ALIGNMENT  FsInformationClass;
+    } QueryVolume;
+    struct {
+      ULONG  Length;
+      FS_INFORMATION_CLASS  FsInformationClass;
+    } SetVolume;
+    struct {
+      ULONG  OutputBufferLength;
+      ULONG  InputBufferLength;
+      ULONG  FsControlCode;
+      PVOID  Type3InputBuffer;
+    } FileSystemControl;
+    struct {
+      PLARGE_INTEGER  Length;
+      ULONG  Key;
+      LARGE_INTEGER  ByteOffset;
+    } LockControl;
+    struct {
+      ULONG  OutputBufferLength;
+      ULONG POINTER_ALIGNMENT  InputBufferLength;
+      ULONG POINTER_ALIGNMENT  IoControlCode;
+      PVOID  Type3InputBuffer;
+    } DeviceIoControl;
+    struct {
+      SECURITY_INFORMATION  SecurityInformation;
+      ULONG POINTER_ALIGNMENT  Length;
+    } QuerySecurity;
+    struct {
+      SECURITY_INFORMATION  SecurityInformation;
+      PSECURITY_DESCRIPTOR  SecurityDescriptor;
+    } SetSecurity;
+    struct {
+      PVPB  Vpb;
+      PDEVICE_OBJECT  DeviceObject;
+    } MountVolume;
+    struct {
+      PVPB  Vpb;
+      PDEVICE_OBJECT  DeviceObject;
+    } VerifyVolume;
+    struct {
+      struct _SCSI_REQUEST_BLOCK  *Srb;
+    } Scsi;
+    struct {
+      ULONG  Length;
+      PSID  StartSid;
+      struct _FILE_GET_QUOTA_INFORMATION  *SidList;
+      ULONG  SidListLength;
+    } QueryQuota;
+    struct {
+      ULONG  Length;
+    } SetQuota;
+    struct {
+      DEVICE_RELATION_TYPE  Type;
+    } QueryDeviceRelations;
+    struct {
+      CONST GUID  *InterfaceType;
+      USHORT  Size;
+      USHORT  Version;
+      PINTERFACE  Interface;
+      PVOID  InterfaceSpecificData;
+    } QueryInterface;
+    struct {
+      PDEVICE_CAPABILITIES  Capabilities;
+    } DeviceCapabilities;
+    struct {
+      PIO_RESOURCE_REQUIREMENTS_LIST  IoResourceRequirementList;
+    } FilterResourceRequirements;
+    struct {
+      ULONG  WhichSpace;
+      PVOID  Buffer;
+      ULONG  Offset;
+      ULONG POINTER_ALIGNMENT  Length;
+    } ReadWriteConfig;
+    struct {
+      BOOLEAN  Lock;
+    } SetLock;
+    struct {
+      BUS_QUERY_ID_TYPE  IdType;
+    } QueryId;
+    struct {
+      DEVICE_TEXT_TYPE  DeviceTextType;
+      LCID POINTER_ALIGNMENT  LocaleId;
+    } QueryDeviceText;
+    struct {
+      BOOLEAN  InPath;
+      BOOLEAN  Reserved[3];
+      DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT  Type;
+    } UsageNotification;
+    struct {
+      SYSTEM_POWER_STATE  PowerState;
+    } WaitWake;
+    struct {
+      PPOWER_SEQUENCE  PowerSequence;
+    } PowerSequence;
+    struct {
+      ULONG  SystemContext;
+      POWER_STATE_TYPE POINTER_ALIGNMENT  Type;
+      POWER_STATE POINTER_ALIGNMENT  State;
+      POWER_ACTION POINTER_ALIGNMENT  ShutdownType;
+    } Power;
+    struct {
+      PCM_RESOURCE_LIST  AllocatedResources;
+      PCM_RESOURCE_LIST  AllocatedResourcesTranslated;
+    } StartDevice;
+    struct {
+      ULONG_PTR  ProviderId;
+      PVOID  DataPath;
+      ULONG  BufferSize;
+      PVOID  Buffer;
+    } WMI;
+    struct {
+      PVOID  Argument1;
+      PVOID  Argument2;
+      PVOID  Argument3;
+      PVOID  Argument4;
+    } Others;
+  } Parameters;
+  PDEVICE_OBJECT  DeviceObject;
+  PFILE_OBJECT  FileObject;
+  PIO_COMPLETION_ROUTINE  CompletionRoutine;
+  PVOID  Context;
+} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
+#if !defined(_ALPHA_)
 #include <poppack.h>
+#endif
 
-typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
-{
-    ULONG BytesPerSector;
-    ULONG NumberOfCylinders;
-    ULONG SectorsPerTrack;
-    ULONG NumberOfHeads;
-} CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
-
-typedef struct _CM_KEYBOARD_DEVICE_DATA {
-  USHORT  Version;
-  USHORT  Revision;
-  UCHAR  Type;
-  UCHAR  Subtype;
-  USHORT  KeyboardFlags;
-} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
-
-typedef struct _CM_MCA_POS_DATA {
-  USHORT  AdapterId;
-  UCHAR  PosData1;
-  UCHAR  PosData2;
-  UCHAR  PosData3;
-  UCHAR  PosData4;
-} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
-
-#if (NTDDI_VERSION >= NTDDI_WINXP)
-typedef struct CM_Power_Data_s {
-  ULONG  PD_Size;
-  DEVICE_POWER_STATE  PD_MostRecentPowerState;
-  ULONG  PD_Capabilities;
-  ULONG  PD_D1Latency;
-  ULONG  PD_D2Latency;
-  ULONG  PD_D3Latency;
-  DEVICE_POWER_STATE  PD_PowerStateMapping[PowerSystemMaximum];
-  SYSTEM_POWER_STATE  PD_DeepestSystemWake;
-} CM_POWER_DATA, *PCM_POWER_DATA;
-
-#define PDCAP_D0_SUPPORTED                0x00000001
-#define PDCAP_D1_SUPPORTED                0x00000002
-#define PDCAP_D2_SUPPORTED                0x00000004
-#define PDCAP_D3_SUPPORTED                0x00000008
-#define PDCAP_WAKE_FROM_D0_SUPPORTED      0x00000010
-#define PDCAP_WAKE_FROM_D1_SUPPORTED      0x00000020
-#define PDCAP_WAKE_FROM_D2_SUPPORTED      0x00000040
-#define PDCAP_WAKE_FROM_D3_SUPPORTED      0x00000080
-#define PDCAP_WARM_EJECT_SUPPORTED        0x00000100
+/* IO_STACK_LOCATION.Control */
 
-#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
+#define SL_PENDING_RETURNED               0x01
+#define SL_ERROR_RETURNED                 0x02
+#define SL_INVOKE_ON_CANCEL               0x20
+#define SL_INVOKE_ON_SUCCESS              0x40
+#define SL_INVOKE_ON_ERROR                0x80
 
-typedef struct _CM_SCSI_DEVICE_DATA {
-  USHORT  Version;
-  USHORT  Revision;
-  UCHAR  HostIdentifier;
-} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
+/* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
 
-typedef struct _CM_SERIAL_DEVICE_DATA {
-  USHORT  Version;
-  USHORT  Revision;
-  ULONG  BaudClock;
-} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
+#define PCI_WHICHSPACE_CONFIG             0x0
+#define PCI_WHICHSPACE_ROM                0x52696350 /* 'PciR' */
 
 /******************************************************************************
  *                                 RTL Types                                  *
index ac360ca..2153d13 100644 (file)
@@ -407,19 +407,6 @@ typedef VOID
   IN PVOID  Context,
   IN ULONG  Count);
 
-typedef enum _BUS_QUERY_ID_TYPE {
-  BusQueryDeviceID,
-  BusQueryHardwareIDs,
-  BusQueryCompatibleIDs,
-  BusQueryInstanceID,
-  BusQueryDeviceSerialNumber
-} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
-
-typedef enum _DEVICE_TEXT_TYPE {
-  DeviceTextDescription,
-  DeviceTextLocationInformation
-} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
-
 typedef BOOLEAN
 (DDKAPI *PKTRANSFER_ROUTINE)(
   VOID);
@@ -1133,405 +1120,10 @@ typedef union _FILE_SEGMENT_ELEMENT {
 
 #define SE_UNSOLICITED_INPUT_PRIVILEGE    6
 
-#include <pshpack4.h>
-typedef struct _ACCESS_STATE {
-  LUID  OperationID;
-  BOOLEAN  SecurityEvaluated;
-  BOOLEAN  GenerateAudit;
-  BOOLEAN  GenerateOnClose;
-  BOOLEAN  PrivilegesAllocated;
-  ULONG  Flags;
-  ACCESS_MASK  RemainingDesiredAccess;
-  ACCESS_MASK  PreviouslyGrantedAccess;
-  ACCESS_MASK  OriginalDesiredAccess;
-  SECURITY_SUBJECT_CONTEXT  SubjectSecurityContext;
-  PSECURITY_DESCRIPTOR  SecurityDescriptor;
-  PVOID  AuxData;
-  union {
-    INITIAL_PRIVILEGE_SET  InitialPrivilegeSet;
-    PRIVILEGE_SET  PrivilegeSet;
-  } Privileges;
-
-  BOOLEAN  AuditPrivileges;
-  UNICODE_STRING  ObjectName;
-  UNICODE_STRING  ObjectTypeName;
-} ACCESS_STATE, *PACCESS_STATE;
-#include <poppack.h>
-
-typedef struct _IO_SECURITY_CONTEXT {
-  PSECURITY_QUALITY_OF_SERVICE  SecurityQos;
-  PACCESS_STATE  AccessState;
-  ACCESS_MASK  DesiredAccess;
-  ULONG  FullCreateOptions;
-} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
-
-#define IO_TYPE_ADAPTER                 1
-#define IO_TYPE_CONTROLLER              2
-#define IO_TYPE_DEVICE                  3
-#define IO_TYPE_DRIVER                  4
-#define IO_TYPE_FILE                    5
-#define IO_TYPE_IRP                     6
-#define IO_TYPE_MASTER_ADAPTER          7
-#define IO_TYPE_OPEN_PACKET             8
-#define IO_TYPE_TIMER                   9
-#define IO_TYPE_VPB                     10
-#define IO_TYPE_ERROR_LOG               11
-#define IO_TYPE_ERROR_MESSAGE           12
-#define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
-
-#define IO_TYPE_CSQ_IRP_CONTEXT 1
-#define IO_TYPE_CSQ 2
-
-struct _IO_CSQ;
-
-typedef struct _IO_CSQ_IRP_CONTEXT {
-  ULONG  Type;
-  struct _IRP  *Irp;
-  struct _IO_CSQ  *Csq;
-} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
-
-typedef VOID
-(DDKAPI *PIO_CSQ_INSERT_IRP)(
-  IN struct _IO_CSQ  *Csq,
-  IN PIRP  Irp);
-
-typedef VOID
-(DDKAPI *PIO_CSQ_REMOVE_IRP)(
-  IN struct _IO_CSQ  *Csq,
-  IN PIRP  Irp);
-
-typedef PIRP
-(DDKAPI *PIO_CSQ_PEEK_NEXT_IRP)(
-  IN struct _IO_CSQ  *Csq,
-  IN PIRP  Irp,
-  IN PVOID  PeekContext);
-
-typedef VOID
-(DDKAPI *PIO_CSQ_ACQUIRE_LOCK)(
-  IN  struct _IO_CSQ  *Csq,
-  OUT PKIRQL  Irql);
-
-typedef VOID
-(DDKAPI *PIO_CSQ_RELEASE_LOCK)(
-  IN struct _IO_CSQ  *Csq,
-  IN KIRQL  Irql);
-
-typedef VOID
-(DDKAPI *PIO_CSQ_COMPLETE_CANCELED_IRP)(
-  IN  struct _IO_CSQ  *Csq,
-  IN  PIRP  Irp);
-
-typedef struct _IO_CSQ {
-  ULONG  Type;
-  PIO_CSQ_INSERT_IRP  CsqInsertIrp;
-  PIO_CSQ_REMOVE_IRP  CsqRemoveIrp;
-  PIO_CSQ_PEEK_NEXT_IRP  CsqPeekNextIrp;
-  PIO_CSQ_ACQUIRE_LOCK  CsqAcquireLock;
-  PIO_CSQ_RELEASE_LOCK  CsqReleaseLock;
-  PIO_CSQ_COMPLETE_CANCELED_IRP  CsqCompleteCanceledIrp;
-  PVOID  ReservePointer;
-} IO_CSQ, *PIO_CSQ;
-
-#if !defined(_ALPHA_)
-#include <pshpack4.h>
-#endif
-typedef struct _IO_STACK_LOCATION {
-  UCHAR  MajorFunction;
-  UCHAR  MinorFunction;
-  UCHAR  Flags;
-  UCHAR  Control;
-  union {
-    struct {
-      PIO_SECURITY_CONTEXT  SecurityContext;
-      ULONG  Options;
-      USHORT POINTER_ALIGNMENT  FileAttributes;
-      USHORT  ShareAccess;
-      ULONG POINTER_ALIGNMENT  EaLength;
-    } Create;
-    struct {
-      ULONG  Length;
-      ULONG POINTER_ALIGNMENT  Key;
-      LARGE_INTEGER  ByteOffset;
-    } Read;
-    struct {
-      ULONG  Length;
-      ULONG POINTER_ALIGNMENT  Key;
-      LARGE_INTEGER  ByteOffset;
-    } Write;
-    struct {
-      ULONG  Length;
-      PUNICODE_STRING  FileName;
-      FILE_INFORMATION_CLASS  FileInformationClass;
-      ULONG  FileIndex;
-    } QueryDirectory;
-    struct {
-      ULONG  Length;
-      ULONG  CompletionFilter;
-    } NotifyDirectory;
-    struct {
-      ULONG  Length;
-      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
-    } QueryFile;
-    struct {
-      ULONG  Length;
-      FILE_INFORMATION_CLASS POINTER_ALIGNMENT  FileInformationClass;
-      PFILE_OBJECT  FileObject;
-      _ANONYMOUS_UNION union {
-        _ANONYMOUS_STRUCT struct {
-          BOOLEAN  ReplaceIfExists;
-          BOOLEAN  AdvanceOnly;
-        } DUMMYSTRUCTNAME;
-        ULONG  ClusterCount;
-        HANDLE  DeleteHandle;
-      } DUMMYUNIONNAME;
-    } SetFile;
-    struct {
-      ULONG  Length;
-      PVOID  EaList;
-      ULONG  EaListLength;
-      ULONG  EaIndex;
-    } QueryEa;
-    struct {
-      ULONG  Length;
-    } SetEa;
-    struct {
-      ULONG  Length;
-      FS_INFORMATION_CLASS POINTER_ALIGNMENT  FsInformationClass;
-    } QueryVolume;
-    struct {
-      ULONG  Length;
-      FS_INFORMATION_CLASS  FsInformationClass;
-    } SetVolume;
-    struct {
-      ULONG  OutputBufferLength;
-      ULONG  InputBufferLength;
-      ULONG  FsControlCode;
-      PVOID  Type3InputBuffer;
-    } FileSystemControl;
-    struct {
-      PLARGE_INTEGER  Length;
-      ULONG  Key;
-      LARGE_INTEGER  ByteOffset;
-    } LockControl;
-    struct {
-      ULONG  OutputBufferLength;
-      ULONG POINTER_ALIGNMENT  InputBufferLength;
-      ULONG POINTER_ALIGNMENT  IoControlCode;
-      PVOID  Type3InputBuffer;
-    } DeviceIoControl;
-    struct {
-      SECURITY_INFORMATION  SecurityInformation;
-      ULONG POINTER_ALIGNMENT  Length;
-    } QuerySecurity;
-    struct {
-      SECURITY_INFORMATION  SecurityInformation;
-      PSECURITY_DESCRIPTOR  SecurityDescriptor;
-    } SetSecurity;
-    struct {
-      PVPB  Vpb;
-      PDEVICE_OBJECT  DeviceObject;
-    } MountVolume;
-    struct {
-      PVPB  Vpb;
-      PDEVICE_OBJECT  DeviceObject;
-    } VerifyVolume;
-    struct {
-      struct _SCSI_REQUEST_BLOCK  *Srb;
-    } Scsi;
-    struct {
-      ULONG  Length;
-      PSID  StartSid;
-      struct _FILE_GET_QUOTA_INFORMATION  *SidList;
-      ULONG  SidListLength;
-    } QueryQuota;
-    struct {
-      ULONG  Length;
-    } SetQuota;
-    struct {
-      DEVICE_RELATION_TYPE  Type;
-    } QueryDeviceRelations;
-    struct {
-      CONST GUID  *InterfaceType;
-      USHORT  Size;
-      USHORT  Version;
-      PINTERFACE  Interface;
-      PVOID  InterfaceSpecificData;
-    } QueryInterface;
-    struct {
-      PDEVICE_CAPABILITIES  Capabilities;
-    } DeviceCapabilities;
-    struct {
-      PIO_RESOURCE_REQUIREMENTS_LIST  IoResourceRequirementList;
-    } FilterResourceRequirements;
-    struct {
-      ULONG  WhichSpace;
-      PVOID  Buffer;
-      ULONG  Offset;
-      ULONG POINTER_ALIGNMENT  Length;
-    } ReadWriteConfig;
-    struct {
-      BOOLEAN  Lock;
-    } SetLock;
-    struct {
-      BUS_QUERY_ID_TYPE  IdType;
-    } QueryId;
-    struct {
-      DEVICE_TEXT_TYPE  DeviceTextType;
-      LCID POINTER_ALIGNMENT  LocaleId;
-    } QueryDeviceText;
-    struct {
-      BOOLEAN  InPath;
-      BOOLEAN  Reserved[3];
-      DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT  Type;
-    } UsageNotification;
-    struct {
-      SYSTEM_POWER_STATE  PowerState;
-    } WaitWake;
-    struct {
-      PPOWER_SEQUENCE  PowerSequence;
-    } PowerSequence;
-    struct {
-      ULONG  SystemContext;
-      POWER_STATE_TYPE POINTER_ALIGNMENT  Type;
-      POWER_STATE POINTER_ALIGNMENT  State;
-      POWER_ACTION POINTER_ALIGNMENT  ShutdownType;
-    } Power;
-    struct {
-      PCM_RESOURCE_LIST  AllocatedResources;
-      PCM_RESOURCE_LIST  AllocatedResourcesTranslated;
-    } StartDevice;
-    struct {
-      ULONG_PTR  ProviderId;
-      PVOID  DataPath;
-      ULONG  BufferSize;
-      PVOID  Buffer;
-    } WMI;
-    struct {
-      PVOID  Argument1;
-      PVOID  Argument2;
-      PVOID  Argument3;
-      PVOID  Argument4;
-    } Others;
-  } Parameters;
-  PDEVICE_OBJECT  DeviceObject;
-  PFILE_OBJECT  FileObject;
-  PIO_COMPLETION_ROUTINE  CompletionRoutine;
-  PVOID  Context;
-} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
-#if !defined(_ALPHA_)
-#include <poppack.h>
-#endif
-
-/* IO_STACK_LOCATION.Control */
-
-#define SL_PENDING_RETURNED               0x01
-#define SL_ERROR_RETURNED                 0x02
-#define SL_INVOKE_ON_CANCEL               0x20
-#define SL_INVOKE_ON_SUCCESS              0x40
-#define SL_INVOKE_ON_ERROR                0x80
-
-/* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
-
-#define PCI_WHICHSPACE_CONFIG             0x0
-#define PCI_WHICHSPACE_ROM                0x52696350 /* 'PciR' */
-
-typedef enum _KEY_INFORMATION_CLASS {
-  KeyBasicInformation,
-  KeyNodeInformation,
-  KeyFullInformation,
-  KeyNameInformation,
-  KeyCachedInformation,
-  KeyFlagsInformation
-} KEY_INFORMATION_CLASS;
-
-typedef struct _KEY_BASIC_INFORMATION {
-  LARGE_INTEGER  LastWriteTime;
-  ULONG  TitleIndex;
-  ULONG  NameLength;
-  WCHAR  Name[1];
-} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
-
-typedef struct _KEY_FULL_INFORMATION {
-  LARGE_INTEGER  LastWriteTime;
-  ULONG  TitleIndex;
-  ULONG  ClassOffset;
-  ULONG  ClassLength;
-  ULONG  SubKeys;
-  ULONG  MaxNameLen;
-  ULONG  MaxClassLen;
-  ULONG  Values;
-  ULONG  MaxValueNameLen;
-  ULONG  MaxValueDataLen;
-  WCHAR  Class[1];
-} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
-
-typedef struct _KEY_NODE_INFORMATION {
-  LARGE_INTEGER  LastWriteTime;
-  ULONG  TitleIndex;
-  ULONG  ClassOffset;
-  ULONG  ClassLength;
-  ULONG  NameLength;
-  WCHAR  Name[1];
-} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
-
-typedef struct _KEY_VALUE_BASIC_INFORMATION {
-  ULONG  TitleIndex;
-  ULONG  Type;
-  ULONG  NameLength;
-  WCHAR  Name[1];
-} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
-
-typedef struct _KEY_VALUE_FULL_INFORMATION {
-  ULONG  TitleIndex;
-  ULONG  Type;
-  ULONG  DataOffset;
-  ULONG  DataLength;
-  ULONG  NameLength;
-  WCHAR  Name[1];
-} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
-
-typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
-  ULONG  TitleIndex;
-  ULONG  Type;
-  ULONG  DataLength;
-  UCHAR  Data[1];
-} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
-
-typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
-  ULONG  Type;
-  ULONG  DataLength;
-  UCHAR  Data[1];
-} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
-
-typedef struct _KEY_VALUE_ENTRY {
-  PUNICODE_STRING  ValueName;
-  ULONG  DataLength;
-  ULONG  DataOffset;
-  ULONG  Type;
-} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
-
-typedef enum _KEY_VALUE_INFORMATION_CLASS {
-  KeyValueBasicInformation,
-  KeyValueFullInformation,
-  KeyValuePartialInformation,
-  KeyValueFullInformationAlign64,
-  KeyValuePartialInformationAlign64
-} KEY_VALUE_INFORMATION_CLASS;
-
-typedef struct _KEY_WRITE_TIME_INFORMATION {
-  LARGE_INTEGER  LastWriteTime;
-} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
-
 typedef struct _KEY_USER_FLAGS_INFORMATION {
   ULONG  UserFlags;
 } KEY_USER_FLAGS_INFORMATION, *PKEY_USER_FLAGS_INFORMATION;
 
-typedef enum _KEY_SET_INFORMATION_CLASS {
-  KeyWriteTimeInformation,
-  KeyUserFlagsInformation,
-  MaxKeySetInfoClass
-} KEY_SET_INFORMATION_CLASS;
-
 /* KEY_VALUE_Xxx.Type */
 
 #define REG_NONE                           0
index f1c144c..36840f6 100644 (file)
@@ -142,11 +142,14 @@ typedef enum _KEY_VALUE_INFORMATION_CLASS
     KeyValuePartialInformationAlign64
 } KEY_VALUE_INFORMATION_CLASS;
 
-typedef enum _KEY_SET_INFORMATION_CLASS
-{
-    KeyWriteTimeInformation,
-    KeyUserFlagsInformation,
-    MaxKeySetInfoClass
+typedef enum _KEY_SET_INFORMATION_CLASS {
+  KeyWriteTimeInformation,
+  KeyWow64FlagsInformation,
+  KeyControlFlagsInformation,
+  KeySetVirtualizationInformation,
+  KeySetDebugInformation,
+  KeySetHandleTagsInformation,
+  MaxKeySetInfoClass
 } KEY_SET_INFORMATION_CLASS;
 
 #endif