- Move more stuff to wdm.h
[reactos.git] / include / ddk / winddk.h
index b2b2efe..5022076 100644 (file)
@@ -42,12 +42,6 @@ extern "C" {
 
 #include "intrin.h"
 
-#if !defined(_NTHAL_)
-#define NTHALAPI DECLSPEC_IMPORT
-#else
-#define NTHALAPI
-#endif
-
 /* Pseudo modifiers for parameters */
 #ifndef IN
 #define IN
@@ -66,12 +60,6 @@ extern "C" {
 
 #define RESTRICTED_POINTER
 
-#if defined(_WIN64)
-#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
-#else
-#define POINTER_ALIGNMENT
-#endif
-
 #define DECLSPEC_ADDRSAFE
 
 #ifdef NONAMELESSUNION
@@ -407,19 +395,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);
@@ -1131,1029 +1106,13 @@ typedef union _FILE_SEGMENT_ELEMENT {
     ULONGLONG Alignment;
 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
 
-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 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);
-
-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);
-
-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 *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 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 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 BOOLEAN
-(DDKAPI *PFAST_IO_UNLOCK_ALL)(
-  IN struct _FILE_OBJECT  *FileObject,
-  PEPROCESS  ProcessId,
-  OUT PIO_STATUS_BLOCK  IoStatus,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
-
-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 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 *PFAST_IO_ACQUIRE_FILE)(
-  IN struct _FILE_OBJECT  *FileObject);
-
-typedef VOID
-(DDKAPI *PFAST_IO_RELEASE_FILE)(
-  IN struct _FILE_OBJECT  *FileObject);
-
-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);
-
-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);
-
-typedef BOOLEAN
-(DDKAPI *PFAST_IO_MDL_READ_COMPLETE)(
-  IN struct _FILE_OBJECT *FileObject,
-  IN PMDL MdlChain,
-  IN struct _DEVICE_OBJECT *DeviceObject);
-
-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 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 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 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 BOOLEAN
-(DDKAPI *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN PMDL  MdlChain,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
-
-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 BOOLEAN
-(DDKAPI *PFAST_IO_QUERY_OPEN)(
-  IN struct _IRP  *Irp,
-  OUT PFILE_NETWORK_OPEN_INFORMATION  NetworkInformation,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
-
-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 *PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
-  IN struct _FILE_OBJECT  *FileObject,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
-
-typedef NTSTATUS
-(DDKAPI *PFAST_IO_RELEASE_FOR_CCFLUSH) (
-  IN struct _FILE_OBJECT  *FileObject,
-  IN struct _DEVICE_OBJECT  *DeviceObject);
-
-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 _SECTION_OBJECT_POINTERS {
-  PVOID  DataSectionObject;
-  PVOID  SharedCacheMap;
-  PVOID  ImageSectionObject;
-} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
-
-typedef struct _IO_COMPLETION_CONTEXT {
-  PVOID  Port;
-  PVOID  Key;
-} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
-
-/* 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_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
-
-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;
-
-typedef enum _SECURITY_OPERATION_CODE {
-  SetSecurityDescriptor,
-  QuerySecurityDescriptor,
-  DeleteSecurityDescriptor,
-  AssignSecurityDescriptor
-} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
-
-#define INITIAL_PRIVILEGE_COUNT           3
-
-typedef struct _INITIAL_PRIVILEGE_SET {
-  ULONG  PrivilegeCount;
-  ULONG  Control;
-  LUID_AND_ATTRIBUTES  Privilege[INITIAL_PRIVILEGE_COUNT];
-} INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
-
-#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_UNSOLICITED_INPUT_PRIVILEGE    6
-#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_MAX_WELL_KNOWN_PRIVILEGE       SE_CREATE_GLOBAL_PRIVILEGE
-
-typedef struct _SECURITY_SUBJECT_CONTEXT {
-  PACCESS_TOKEN  ClientToken;
-  SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel;
-  PACCESS_TOKEN  PrimaryToken;
-  PVOID  ProcessAuditId;
-} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
-
-#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
-#define REG_SZ                             1
-#define REG_EXPAND_SZ                      2
-#define REG_BINARY                         3
-#define REG_DWORD                          4
-#define REG_DWORD_LITTLE_ENDIAN            4
-#define REG_DWORD_BIG_ENDIAN               5
-#define REG_LINK                           6
-#define REG_MULTI_SZ                       7
-#define REG_RESOURCE_LIST                  8
-#define REG_FULL_RESOURCE_DESCRIPTOR       9
-#define REG_RESOURCE_REQUIREMENTS_LIST    10
-#define REG_QWORD                         11
-#define REG_QWORD_LITTLE_ENDIAN           11
-
-#define PCI_TYPE0_ADDRESSES               6
-#define PCI_TYPE1_ADDRESSES               2
-#define PCI_TYPE2_ADDRESSES               5
-
-typedef struct _PCI_COMMON_CONFIG {
-  USHORT  VendorID;
-  USHORT  DeviceID;
-  USHORT  Command;
-  USHORT  Status;
-  UCHAR  RevisionID;
-  UCHAR  ProgIf;
-  UCHAR  SubClass;
-  UCHAR  BaseClass;
-  UCHAR  CacheLineSize;
-  UCHAR  LatencyTimer;
-  UCHAR  HeaderType;
-  UCHAR  BIST;
-  union {
-    struct _PCI_HEADER_TYPE_0 {
-      ULONG  BaseAddresses[PCI_TYPE0_ADDRESSES];
-      ULONG  CIS;
-      USHORT  SubVendorID;
-      USHORT  SubSystemID;
-      ULONG  ROMBaseAddress;
-      UCHAR  CapabilitiesPtr;
-      UCHAR  Reserved1[3];
-      ULONG  Reserved2;
-      UCHAR  InterruptLine;
-      UCHAR  InterruptPin;
-      UCHAR  MinimumGrant;
-      UCHAR  MaximumLatency;
-    } type0;
-    struct _PCI_HEADER_TYPE_1 {
-      ULONG  BaseAddresses[PCI_TYPE1_ADDRESSES];
-      UCHAR  PrimaryBus;
-      UCHAR  SecondaryBus;
-      UCHAR  SubordinateBus;
-      UCHAR  SecondaryLatency;
-      UCHAR  IOBase;
-      UCHAR  IOLimit;
-      USHORT  SecondaryStatus;
-      USHORT  MemoryBase;
-      USHORT  MemoryLimit;
-      USHORT  PrefetchBase;
-      USHORT  PrefetchLimit;
-      ULONG  PrefetchBaseUpper32;
-      ULONG  PrefetchLimitUpper32;
-      USHORT  IOBaseUpper16;
-      USHORT  IOLimitUpper16;
-      UCHAR  CapabilitiesPtr;
-      UCHAR  Reserved1[3];
-      ULONG  ROMBaseAddress;
-      UCHAR  InterruptLine;
-      UCHAR  InterruptPin;
-      USHORT  BridgeControl;
-    } type1;
-    struct _PCI_HEADER_TYPE_2 {
-      ULONG  SocketRegistersBaseAddress;
-      UCHAR  CapabilitiesPtr;
-      UCHAR  Reserved;
-      USHORT  SecondaryStatus;
-      UCHAR  PrimaryBus;
-      UCHAR  SecondaryBus;
-      UCHAR  SubordinateBus;
-      UCHAR  SecondaryLatency;
-      struct {
-        ULONG  Base;
-        ULONG  Limit;
-      } Range[PCI_TYPE2_ADDRESSES - 1];
-      UCHAR  InterruptLine;
-      UCHAR  InterruptPin;
-      USHORT  BridgeControl;
-    } type2;
-  } u;
-  UCHAR  DeviceSpecific[192];
-} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
-
-/* PCI_COMMON_CONFIG.Command */
-
-#define PCI_ENABLE_IO_SPACE               0x0001
-#define PCI_ENABLE_MEMORY_SPACE           0x0002
-#define PCI_ENABLE_BUS_MASTER             0x0004
-#define PCI_ENABLE_SPECIAL_CYCLES         0x0008
-#define PCI_ENABLE_WRITE_AND_INVALIDATE   0x0010
-#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
-#define PCI_ENABLE_PARITY                 0x0040
-#define PCI_ENABLE_WAIT_CYCLE             0x0080
-#define PCI_ENABLE_SERR                   0x0100
-#define PCI_ENABLE_FAST_BACK_TO_BACK      0x0200
-
-/* PCI_COMMON_CONFIG.Status */
-
-#define PCI_STATUS_CAPABILITIES_LIST      0x0010
-#define PCI_STATUS_66MHZ_CAPABLE          0x0020
-#define PCI_STATUS_UDF_SUPPORTED          0x0040
-#define PCI_STATUS_FAST_BACK_TO_BACK      0x0080
-#define PCI_STATUS_DATA_PARITY_DETECTED   0x0100
-#define PCI_STATUS_DEVSEL                 0x0600
-#define PCI_STATUS_SIGNALED_TARGET_ABORT  0x0800
-#define PCI_STATUS_RECEIVED_TARGET_ABORT  0x1000
-#define PCI_STATUS_RECEIVED_MASTER_ABORT  0x2000
-#define PCI_STATUS_SIGNALED_SYSTEM_ERROR  0x4000
-#define PCI_STATUS_DETECTED_PARITY_ERROR  0x8000
-
-/* PCI_COMMON_CONFIG.HeaderType */
-
-#define PCI_MULTIFUNCTION                 0x80
-#define PCI_DEVICE_TYPE                   0x00
-#define PCI_BRIDGE_TYPE                   0x01
-#define PCI_CARDBUS_BRIDGE_TYPE           0x02
-
-#define PCI_CONFIGURATION_TYPE(PciData) \
-  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
-
-#define PCI_MULTIFUNCTION_DEVICE(PciData) \
-  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
-
-/* PCI device classes */
-
-#define PCI_CLASS_PRE_20                    0x00
-#define PCI_CLASS_MASS_STORAGE_CTLR         0x01
-#define PCI_CLASS_NETWORK_CTLR              0x02
-#define PCI_CLASS_DISPLAY_CTLR              0x03
-#define PCI_CLASS_MULTIMEDIA_DEV            0x04
-#define PCI_CLASS_MEMORY_CTLR               0x05
-#define PCI_CLASS_BRIDGE_DEV                0x06
-#define PCI_CLASS_SIMPLE_COMMS_CTLR         0x07
-#define PCI_CLASS_BASE_SYSTEM_DEV           0x08
-#define PCI_CLASS_INPUT_DEV                 0x09
-#define PCI_CLASS_DOCKING_STATION           0x0a
-#define PCI_CLASS_PROCESSOR                 0x0b
-#define PCI_CLASS_SERIAL_BUS_CTLR           0x0c
-
-/* PCI device subclasses for class 0 */
-
-#define PCI_SUBCLASS_PRE_20_NON_VGA         0x00
-#define PCI_SUBCLASS_PRE_20_VGA             0x01
-
-/* PCI device subclasses for class 1 (mass storage controllers)*/
-
-#define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR      0x00
-#define PCI_SUBCLASS_MSC_IDE_CTLR           0x01
-#define PCI_SUBCLASS_MSC_FLOPPY_CTLR        0x02
-#define PCI_SUBCLASS_MSC_IPI_CTLR           0x03
-#define PCI_SUBCLASS_MSC_RAID_CTLR          0x04
-#define PCI_SUBCLASS_MSC_OTHER              0x80
-
-/* PCI device subclasses for class 2 (network controllers)*/
-
-#define PCI_SUBCLASS_NET_ETHERNET_CTLR      0x00
-#define PCI_SUBCLASS_NET_TOKEN_RING_CTLR    0x01
-#define PCI_SUBCLASS_NET_FDDI_CTLR          0x02
-#define PCI_SUBCLASS_NET_ATM_CTLR           0x03
-#define PCI_SUBCLASS_NET_OTHER              0x80
-
-/* PCI device subclasses for class 3 (display controllers)*/
-
-#define PCI_SUBCLASS_VID_VGA_CTLR           0x00
-#define PCI_SUBCLASS_VID_XGA_CTLR           0x01
-#define PCI_SUBCLASS_VID_3D_CTLR            0x02
-#define PCI_SUBCLASS_VID_OTHER              0x80
-
-/* PCI device subclasses for class 4 (multimedia device)*/
-
-#define PCI_SUBCLASS_MM_VIDEO_DEV           0x00
-#define PCI_SUBCLASS_MM_AUDIO_DEV           0x01
-#define PCI_SUBCLASS_MM_TELEPHONY_DEV       0x02
-#define PCI_SUBCLASS_MM_OTHER               0x80
-
-/* PCI device subclasses for class 5 (memory controller)*/
-
-#define PCI_SUBCLASS_MEM_RAM                0x00
-#define PCI_SUBCLASS_MEM_FLASH              0x01
-#define PCI_SUBCLASS_MEM_OTHER              0x80
-
-/* PCI device subclasses for class 6 (bridge device)*/
-
-#define PCI_SUBCLASS_BR_HOST                0x00
-#define PCI_SUBCLASS_BR_ISA                 0x01
-#define PCI_SUBCLASS_BR_EISA                0x02
-#define PCI_SUBCLASS_BR_MCA                 0x03
-#define PCI_SUBCLASS_BR_PCI_TO_PCI          0x04
-#define PCI_SUBCLASS_BR_PCMCIA              0x05
-#define PCI_SUBCLASS_BR_NUBUS               0x06
-#define PCI_SUBCLASS_BR_CARDBUS             0x07
-#define PCI_SUBCLASS_BR_OTHER               0x80
-
-/* PCI device subclasses for class C (serial bus controller)*/
-
-#define PCI_SUBCLASS_SB_IEEE1394            0x00
-#define PCI_SUBCLASS_SB_ACCESS              0x01
-#define PCI_SUBCLASS_SB_SSA                 0x02
-#define PCI_SUBCLASS_SB_USB                 0x03
-#define PCI_SUBCLASS_SB_FIBRE_CHANNEL       0x04
-#define PCI_SUBCLASS_SB_SMBUS               0x05
-
-#define PCI_MAX_DEVICES        32
-#define PCI_MAX_FUNCTION       8
-#define PCI_MAX_BRIDGE_NUMBER  0xFF
-#define PCI_INVALID_VENDORID   0xFFFF
-#define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
-
 #define PCI_ADDRESS_MEMORY_SPACE            0x00000000
-#define PCI_ADDRESS_IO_SPACE                0x00000001
-#define PCI_ADDRESS_MEMORY_TYPE_MASK        0x00000006
-#define PCI_ADDRESS_MEMORY_PREFETCHABLE     0x00000008
-#define PCI_ADDRESS_IO_ADDRESS_MASK         0xfffffffc
-#define PCI_ADDRESS_MEMORY_ADDRESS_MASK     0xfffffff0
-#define PCI_ADDRESS_ROM_ADDRESS_MASK        0xfffff800
-
-#define PCI_TYPE_32BIT 0
-#define PCI_TYPE_20BIT 2
-#define PCI_TYPE_64BIT 4
-
-typedef struct _PCI_SLOT_NUMBER {
-  union {
-    struct {
-      ULONG  DeviceNumber : 5;
-      ULONG  FunctionNumber : 3;
-      ULONG  Reserved : 24;
-    } bits;
-    ULONG  AsULONG;
-  } u;
-} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
-
-#define POOL_COLD_ALLOCATION                256
-#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE    8
-#define POOL_RAISE_IF_ALLOCATION_FAILURE    16
 
 typedef struct _OSVERSIONINFOA {
     ULONG dwOSVersionInfoSize;
@@ -2270,118 +1229,6 @@ typedef enum _EVENT_TYPE {
   SynchronizationEvent
 } EVENT_TYPE;
 
-typedef enum _KWAIT_REASON {
-  Executive,
-  FreePage,
-  PageIn,
-  PoolAllocation,
-  DelayExecution,
-  Suspended,
-  UserRequest,
-  WrExecutive,
-  WrFreePage,
-  WrPageIn,
-  WrPoolAllocation,
-  WrDelayExecution,
-  WrSuspended,
-  WrUserRequest,
-  WrEventPair,
-  WrQueue,
-  WrLpcReceive,
-  WrLpcReply,
-  WrVirtualMemory,
-  WrPageOut,
-  WrRendezvous,
-  Spare2,
-  WrGuardedMutex,
-  Spare4,
-  Spare5,
-  Spare6,
-  WrKernel,
-  WrResource,
-  WrPushLock,
-  WrMutex,
-  WrQuantumEnd,
-  WrDispatchInt,
-  WrPreempted,
-  WrYieldExecution,
-  MaximumWaitReason
-} KWAIT_REASON;
-
-typedef struct _KWAIT_BLOCK {
-  LIST_ENTRY  WaitListEntry;
-  struct _KTHREAD * RESTRICTED_POINTER  Thread;
-  PVOID  Object;
-  struct _KWAIT_BLOCK * RESTRICTED_POINTER  NextWaitBlock;
-  USHORT  WaitKey;
-  UCHAR WaitType;
-  UCHAR SpareByte;
-} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
-
-typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
-
-typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
-  BOOLEAN  Removed;
-  BOOLEAN  Reserved[3];
-  volatile LONG  IoCount;
-  KEVENT  RemoveEvent;
-} IO_REMOVE_LOCK_COMMON_BLOCK;
-
-typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
-  LONG  Signature;
-  LONG  HighWatermark;
-  LONGLONG  MaxLockedTicks;
-  LONG  AllocateTag;
-  LIST_ENTRY  LockList;
-  KSPIN_LOCK  Spin;
-  volatile LONG  LowMemoryCount;
-  ULONG  Reserved1[4];
-  PVOID  Reserved2;
-  PIO_REMOVE_LOCK_TRACKING_BLOCK  Blocks;
-} IO_REMOVE_LOCK_DBG_BLOCK;
-
-typedef struct _IO_REMOVE_LOCK {
-  IO_REMOVE_LOCK_COMMON_BLOCK  Common;
-#if DBG
-  IO_REMOVE_LOCK_DBG_BLOCK  Dbg;
-#endif
-} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
-
-typedef struct _IO_WORKITEM *PIO_WORKITEM;
-
-typedef VOID
-(DDKAPI IO_WORKITEM_ROUTINE)(
-  IN PDEVICE_OBJECT  DeviceObject,
-  IN PVOID  Context);
-typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
-
-typedef struct _SHARE_ACCESS {
-  ULONG  OpenCount;
-  ULONG  Readers;
-  ULONG  Writers;
-  ULONG  Deleters;
-  ULONG  SharedRead;
-  ULONG  SharedWrite;
-  ULONG  SharedDelete;
-} SHARE_ACCESS, *PSHARE_ACCESS;
-
-typedef enum _KINTERRUPT_MODE {
-  LevelSensitive,
-  Latched
-} KINTERRUPT_MODE;
-
-#define THREAD_WAIT_OBJECTS 3
-
-typedef VOID
-(DDKAPI *PKINTERRUPT_ROUTINE)(
-  VOID);
-
-typedef enum _CREATE_FILE_TYPE {
-  CreateFileTypeNone,
-  CreateFileTypeNamedPipe,
-  CreateFileTypeMailslot
-} CREATE_FILE_TYPE;
-
 typedef struct _CONFIGURATION_INFORMATION {
   ULONG  DiskCount;
   ULONG  FloppyCount;
@@ -2441,12 +1288,6 @@ typedef enum _CONFIGURATION_TYPE {
   MaximumType
 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
 
-#define IO_FORCE_ACCESS_CHECK               0x001
-#define IO_NO_PARAMETER_CHECKING            0x100
-
-#define IO_REPARSE                      0x0
-#define IO_REMOUNT                      0x1
-
 typedef NTSTATUS
 (DDKAPI *PIO_QUERY_DEVICE_ROUTINE)(
   IN PVOID  Context,
@@ -2468,121 +1309,6 @@ typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
   IoQueryDeviceMaxData
 } IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
 
-typedef enum _KBUGCHECK_CALLBACK_REASON {
-  KbCallbackInvalid,
-  KbCallbackReserved1,
-  KbCallbackSecondaryDumpData,
-  KbCallbackDumpIo,
-} KBUGCHECK_CALLBACK_REASON;
-
-struct _KBUGCHECK_REASON_CALLBACK_RECORD;
-
-typedef VOID
-(DDKAPI *PKBUGCHECK_REASON_CALLBACK_ROUTINE)(
-  IN KBUGCHECK_CALLBACK_REASON  Reason,
-  IN struct _KBUGCHECK_REASON_CALLBACK_RECORD  *Record,
-  IN OUT PVOID  ReasonSpecificData,
-  IN ULONG  ReasonSpecificDataLength);
-
-typedef struct _KBUGCHECK_REASON_CALLBACK_RECORD {
-  LIST_ENTRY  Entry;
-  PKBUGCHECK_REASON_CALLBACK_ROUTINE  CallbackRoutine;
-  PUCHAR  Component;
-  ULONG_PTR  Checksum;
-  KBUGCHECK_CALLBACK_REASON  Reason;
-  UCHAR  State;
-} KBUGCHECK_REASON_CALLBACK_RECORD, *PKBUGCHECK_REASON_CALLBACK_RECORD;
-
-typedef enum _KBUGCHECK_BUFFER_DUMP_STATE {
-  BufferEmpty,
-  BufferInserted,
-  BufferStarted,
-  BufferFinished,
-  BufferIncomplete
-} KBUGCHECK_BUFFER_DUMP_STATE;
-
-typedef VOID
-(DDKAPI *PKBUGCHECK_CALLBACK_ROUTINE)(
-  IN PVOID  Buffer,
-  IN ULONG  Length);
-
-typedef struct _KBUGCHECK_CALLBACK_RECORD {
-  LIST_ENTRY  Entry;
-  PKBUGCHECK_CALLBACK_ROUTINE  CallbackRoutine;
-  PVOID  Buffer;
-  ULONG  Length;
-  PUCHAR  Component;
-  ULONG_PTR  Checksum;
-  UCHAR  State;
-} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
-
-typedef BOOLEAN
-(DDKAPI *PNMI_CALLBACK)(
-    IN PVOID Context,
-    IN BOOLEAN Handled);
-
-/*
- * VOID
- * KeInitializeCallbackRecord(
- *   IN PKBUGCHECK_CALLBACK_RECORD  CallbackRecord)
- */
-#define KeInitializeCallbackRecord(CallbackRecord) \
-  CallbackRecord->State = BufferEmpty;
-
-typedef enum _KDPC_IMPORTANCE {
-  LowImportance,
-  MediumImportance,
-  HighImportance
-} KDPC_IMPORTANCE;
-
-typedef enum _MEMORY_CACHING_TYPE_ORIG {
-  MmFrameBufferCached = 2
-} MEMORY_CACHING_TYPE_ORIG;
-
-typedef enum _MEMORY_CACHING_TYPE {
-  MmNonCached = FALSE,
-  MmCached = TRUE,
-  MmWriteCombined = MmFrameBufferCached,
-  MmHardwareCoherentCached,
-  MmNonCachedUnordered,
-  MmUSWCCached,
-  MmMaximumCacheType
-} MEMORY_CACHING_TYPE;
-
-typedef enum _MM_PAGE_PRIORITY {
-  LowPagePriority,
-  NormalPagePriority = 16,
-  HighPagePriority = 32
-} MM_PAGE_PRIORITY;
-
-typedef enum _LOCK_OPERATION {
-  IoReadAccess,
-  IoWriteAccess,
-  IoModifyAccess
-} LOCK_OPERATION;
-
-#define FLUSH_MULTIPLE_MAXIMUM 32
-
-typedef enum _MM_SYSTEM_SIZE {
-  MmSmallSystem,
-  MmMediumSystem,
-  MmLargeSystem
-} MM_SYSTEMSIZE;
-
-typedef struct _OBJECT_HANDLE_INFORMATION {
-  ULONG HandleAttributes;
-  ACCESS_MASK GrantedAccess;
-} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
-
-typedef struct _CLIENT_ID {
-  HANDLE  UniqueProcess;
-  HANDLE  UniqueThread;
-} CLIENT_ID, *PCLIENT_ID;
-
-typedef VOID
-(DDKAPI *PKSTART_ROUTINE)(
-  IN PVOID  StartContext);
-
 typedef VOID
 (DDKAPI *PCREATE_PROCESS_NOTIFY_ROUTINE)(
   IN HANDLE  ParentId,
@@ -2803,190 +1529,6 @@ typedef struct _PROCESS_SESSION_INFORMATION
     ULONG SessionId;
 } PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
 
-typedef VOID
-(DDKAPI *PREQUEST_POWER_COMPLETE)(
-  IN PDEVICE_OBJECT  DeviceObject,
-  IN UCHAR  MinorFunction,
-  IN POWER_STATE  PowerState,
-  IN PVOID  Context,
-  IN PIO_STATUS_BLOCK  IoStatus);
-
-typedef enum _TRACE_INFORMATION_CLASS {
-  TraceIdClass,
-  TraceHandleClass,
-  TraceEnableFlagsClass,
-  TraceEnableLevelClass,
-  GlobalLoggerHandleClass,
-  EventLoggerHandleClass,
-  AllLoggerHandlesClass,
-  TraceHandleByNameClass
-} TRACE_INFORMATION_CLASS;
-
-typedef enum _REG_NOTIFY_CLASS
-{
-  RegNtDeleteKey,
-  RegNtPreDeleteKey = RegNtDeleteKey,
-  RegNtSetValueKey,
-  RegNtPreSetValueKey = RegNtSetValueKey,
-  RegNtDeleteValueKey,
-  RegNtPreDeleteValueKey = RegNtDeleteValueKey,
-  RegNtSetInformationKey,
-  RegNtPreSetInformationKey = RegNtSetInformationKey,
-  RegNtRenameKey,
-  RegNtPreRenameKey = RegNtRenameKey,
-  RegNtEnumerateKey,
-  RegNtPreEnumerateKey = RegNtEnumerateKey,
-  RegNtEnumerateValueKey,
-  RegNtPreEnumerateValueKey = RegNtEnumerateValueKey,
-  RegNtQueryKey,
-  RegNtPreQueryKey = RegNtQueryKey,
-  RegNtQueryValueKey,
-  RegNtPreQueryValueKey = RegNtQueryValueKey,
-  RegNtQueryMultipleValueKey,
-  RegNtPreQueryMultipleValueKey = RegNtQueryMultipleValueKey,
-  RegNtPreCreateKey,
-  RegNtPostCreateKey,
-  RegNtPreOpenKey,
-  RegNtPostOpenKey,
-  RegNtKeyHandleClose,
-  RegNtPreKeyHandleClose = RegNtKeyHandleClose,
-  RegNtPostDeleteKey,
-  RegNtPostSetValueKey,
-  RegNtPostDeleteValueKey,
-  RegNtPostSetInformationKey,
-  RegNtPostRenameKey,
-  RegNtPostEnumerateKey,
-  RegNtPostEnumerateValueKey,
-  RegNtPostQueryKey,
-  RegNtPostQueryValueKey,
-  RegNtPostQueryMultipleValueKey,
-  RegNtPostKeyHandleClose,
-  RegNtPreCreateKeyEx,
-  RegNtPostCreateKeyEx,
-  RegNtPreOpenKeyEx,
-  RegNtPostOpenKeyEx
-} REG_NOTIFY_CLASS, *PREG_NOTIFY_CLASS;
-
-typedef NTSTATUS
-(NTAPI *PEX_CALLBACK_FUNCTION)(
-    IN PVOID CallbackContext,
-    IN PVOID Argument1,
-    IN PVOID Argument2
-);
-
-typedef struct _REG_DELETE_KEY_INFORMATION
-{
-    PVOID Object;
-} REG_DELETE_KEY_INFORMATION, *PREG_DELETE_KEY_INFORMATION;
-
-typedef struct _REG_SET_VALUE_KEY_INFORMATION
-{
-    PVOID Object;
-    PUNICODE_STRING ValueName;
-    ULONG TitleIndex;
-    ULONG Type;
-    PVOID Data;
-    ULONG DataSize;
-} REG_SET_VALUE_KEY_INFORMATION, *PREG_SET_VALUE_KEY_INFORMATION;
-
-typedef struct _REG_DELETE_VALUE_KEY_INFORMATION
-{
-    PVOID Object;
-    PUNICODE_STRING ValueName;
-} REG_DELETE_VALUE_KEY_INFORMATION, *PREG_DELETE_VALUE_KEY_INFORMATION;
-
-typedef struct _REG_SET_INFORMATION_KEY_INFORMATION
-{
-    PVOID Object;
-    KEY_SET_INFORMATION_CLASS KeySetInformationClass;
-    PVOID KeySetInformation;
-    ULONG KeySetInformationLength;
-} REG_SET_INFORMATION_KEY_INFORMATION, *PREG_SET_INFORMATION_KEY_INFORMATION;
-
-typedef struct _REG_ENUMERATE_KEY_INFORMATION
-{
-    PVOID Object;
-    ULONG Index;
-    KEY_INFORMATION_CLASS KeyInformationClass;
-    PVOID KeyInformation;
-    ULONG Length;
-    PULONG ResultLength;
-} REG_ENUMERATE_KEY_INFORMATION, *PREG_ENUMERATE_KEY_INFORMATION;
-
-typedef struct _REG_ENUMERATE_VALUE_KEY_INFORMATION
-{
-    PVOID Object;
-    ULONG Index;
-    KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass;
-    PVOID KeyValueInformation;
-    ULONG Length;
-    PULONG ResultLength;
-} REG_ENUMERATE_VALUE_KEY_INFORMATION, *PREG_ENUMERATE_VALUE_KEY_INFORMATION;
-
-typedef struct _REG_QUERY_KEY_INFORMATION
-{
-    PVOID Object;
-    KEY_INFORMATION_CLASS KeyInformationClass;
-    PVOID KeyInformation;
-    ULONG Length;
-    PULONG ResultLength;
-} REG_QUERY_KEY_INFORMATION, *PREG_QUERY_KEY_INFORMATION;
-
-typedef struct _REG_QUERY_VALUE_KEY_INFORMATION
-{
-    PVOID Object;
-    PUNICODE_STRING ValueName;
-    KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass;
-    PVOID KeyValueInformation;
-    ULONG Length;
-    PULONG ResultLength;
-} REG_QUERY_VALUE_KEY_INFORMATION, *PREG_QUERY_VALUE_KEY_INFORMATION;
-
-typedef struct _REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION
-{
-    PVOID Object;
-    PKEY_VALUE_ENTRY ValueEntries;
-    ULONG EntryCount;
-    PVOID ValueBuffer;
-    PULONG BufferLength;
-    PULONG RequiredBufferLength;
-} REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION, *PREG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION;
-
-typedef struct _REG_PRE_CREATE_KEY_INFORMATION
-{
-    PUNICODE_STRING CompleteName;
-} REG_PRE_CREATE_KEY_INFORMATION, *PREG_PRE_CREATE_KEY_INFORMATION;
-
-typedef struct _REG_POST_CREATE_KEY_INFORMATION
-{
-    PUNICODE_STRING CompleteName;
-    PVOID Object;
-    NTSTATUS Status;
-} REG_POST_CREATE_KEY_INFORMATION, *PREG_POST_CREATE_KEY_INFORMATION;
-
-typedef struct _REG_PRE_OPEN_KEY_INFORMATION
-{
-    PUNICODE_STRING  CompleteName;
-} REG_PRE_OPEN_KEY_INFORMATION, *PREG_PRE_OPEN_KEY_INFORMATION;
-
-typedef struct _REG_POST_OPEN_KEY_INFORMATION
-{
-    PUNICODE_STRING CompleteName;
-    PVOID Object;
-    NTSTATUS Status;
-} REG_POST_OPEN_KEY_INFORMATION, *PREG_POST_OPEN_KEY_INFORMATION;
-
-typedef struct _REG_POST_OPERATION_INFORMATION
-{
-    PVOID Object;
-    NTSTATUS Status;
-} REG_POST_OPERATION_INFORMATION,*PREG_POST_OPERATION_INFORMATION;
-
-typedef struct _REG_KEY_HANDLE_CLOSE_INFORMATION
-{
-    PVOID Object;
-} REG_KEY_HANDLE_CLOSE_INFORMATION, *PREG_KEY_HANDLE_CLOSE_INFORMATION;
-
 /*
 ** Storage structures
 */
@@ -3031,14 +1573,6 @@ typedef VOID
   IN HANDLE  ThreadId,
   IN KPROCESSOR_MODE  Mode);
 
-#define DBG_STATUS_CONTROL_C              1
-#define DBG_STATUS_SYSRQ                  2
-#define DBG_STATUS_BUGCHECK_FIRST         3
-#define DBG_STATUS_BUGCHECK_SECOND        4
-#define DBG_STATUS_FATAL                  5
-#define DBG_STATUS_DEBUG_CONTROL          6
-#define DBG_STATUS_WORKER                 7
-
 typedef struct _PHYSICAL_MEMORY_RANGE {
   PHYSICAL_ADDRESS  BaseAddress;
   LARGE_INTEGER  NumberOfBytes;
@@ -3059,28 +1593,12 @@ typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
 #define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS      0x0008
 #define DRIVER_VERIFIER_IO_CHECKING                 0x0010
 
-#define HASH_STRING_ALGORITHM_DEFAULT     0
-#define HASH_STRING_ALGORITHM_X65599      1
-#define HASH_STRING_ALGORITHM_INVALID     0xffffffff
-
 typedef VOID
 (DDKAPI *PTIMER_APC_ROUTINE)(
   IN PVOID  TimerContext,
   IN ULONG  TimerLowValue,
   IN LONG  TimerHighValue);
 
-
-
-/*
-** WMI structures
-*/
-
-typedef VOID
-(DDKAPI *WMI_NOTIFICATION_CALLBACK)(
-  PVOID  Wnode,
-  PVOID  Context);
-
-
 /*
 ** Architecture specific structures
 */
@@ -3099,7 +1617,6 @@ typedef VOID
 #define CONTEXT_DEBUG_REGISTERS        (CONTEXT_i386|0x00000010L)
 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
 #define CONTEXT_FULL   (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
-#define MAXIMUM_SUPPORTED_EXTENSION  512
 
 typedef struct _FLOATING_SAVE_AREA {
     ULONG ControlWord;
@@ -3141,24 +1658,6 @@ typedef struct _CONTEXT {
     UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
 } CONTEXT;
 
-//
-// Used to contain PFNs and PFN counts
-//
-typedef ULONG PFN_COUNT;
-typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
-typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
-
-#define PASSIVE_LEVEL                      0
-#define LOW_LEVEL                          0
-#define APC_LEVEL                          1
-#define DISPATCH_LEVEL                     2
-#define PROFILE_LEVEL                     27
-#define CLOCK1_LEVEL                      28
-#define CLOCK2_LEVEL                      28
-#define IPI_LEVEL                         29
-#define POWER_LEVEL                       30
-#define HIGH_LEVEL                        31
-
 typedef struct _KPCR_TIB {
   PVOID  ExceptionList;         /* 00 */
   PVOID  StackBase;             /* 04 */
@@ -3200,17 +1699,6 @@ typedef struct _KPCR {
 
 #define KeGetPcr()                      PCR
 
-typedef struct _KFLOATING_SAVE {
-  ULONG  ControlWord;
-  ULONG  StatusWord;
-  ULONG  ErrorOffset;
-  ULONG  ErrorSelector;
-  ULONG  DataOffset;
-  ULONG  DataSelector;
-  ULONG  Cr0NpxState;
-  ULONG  Spare1;
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-
 FORCEINLINE
 ULONG
 KeGetCurrentProcessorNumber(VOID)
@@ -3218,25 +1706,6 @@ KeGetCurrentProcessorNumber(VOID)
     return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
 }
 
-NTHALAPI
-KIRQL
-DDKAPI
-KeGetCurrentIrql(
-    VOID);
-
-NTKERNELAPI
-PRKTHREAD
-NTAPI
-KeGetCurrentThread(
-    VOID);
-
-#define KI_USER_SHARED_DATA               0xffdf0000
-
-#define PAGE_SIZE                         0x1000
-#define PAGE_SHIFT                        12L
-
-#define SharedUserData                    ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
-
 extern NTKERNELAPI PVOID MmHighestUserAddress;
 extern NTKERNELAPI PVOID MmSystemRangeStart;
 extern NTKERNELAPI ULONG_PTR MmUserProbeAddress;
@@ -3269,30 +1738,6 @@ extern NTKERNELAPI ULONG_PTR MmUserProbeAddress;
 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
 #endif
 
-typedef struct DECLSPEC_ALIGN(16) _M128A {
-    ULONGLONG Low;
-    LONGLONG High;
-} M128A, *PM128A;
-
-typedef struct _XMM_SAVE_AREA32 {
-    USHORT ControlWord;
-    USHORT StatusWord;
-    UCHAR TagWord;
-    UCHAR Reserved1;
-    USHORT ErrorOpcode;
-    ULONG ErrorOffset;
-    USHORT ErrorSelector;
-    USHORT Reserved2;
-    ULONG DataOffset;
-    USHORT DataSelector;
-    USHORT Reserved3;
-    ULONG MxCsr;
-    ULONG MxCsr_Mask;
-    M128A FloatRegisters[8];
-    M128A XmmRegisters[16];
-    UCHAR Reserved4[96];
-} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
-
 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
     ULONG64 P1Home;
     ULONG64 P2Home;
@@ -3380,23 +1825,6 @@ typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
     ULONG64 LastExceptionFromRip;
 } CONTEXT;
 
-//
-// Used to contain PFNs and PFN counts
-//
-typedef ULONG PFN_COUNT;
-typedef ULONG64 PFN_NUMBER, *PPFN_NUMBER;
-typedef LONG64 SPFN_NUMBER, *PSPFN_NUMBER;
-
-#define PASSIVE_LEVEL                      0
-#define LOW_LEVEL                          0
-#define APC_LEVEL                          1
-#define DISPATCH_LEVEL                     2
-#define CLOCK_LEVEL                       13
-#define IPI_LEVEL                         14
-#define POWER_LEVEL                       14
-#define PROFILE_LEVEL                     15
-#define HIGH_LEVEL                        15
-
 #define PAGE_SIZE   0x1000
 #define PAGE_SHIFT 12L
 #define PTI_SHIFT  12L
@@ -3485,12 +1913,6 @@ typedef struct _KFLOATING_SAVE {
   ULONG Dummy;
 } KFLOATING_SAVE, *PKFLOATING_SAVE;
 
-NTKERNELAPI
-PRKTHREAD
-NTAPI
-KeGetCurrentThread(
-    VOID);
-
 FORCEINLINE
 PKPCR
 KeGetPcr(VOID)
@@ -3630,18 +2052,6 @@ KeGetCurrentProcessorNumber(VOID)
 #error Unknown architecture
 #endif
 
-#define MM_DONT_ZERO_ALLOCATION             0x00000001
-#define MM_ALLOCATE_FROM_LOCAL_NODE_ONLY    0x00000002
-
-    
-#define EFLAG_SIGN                        0x8000
-#define EFLAG_ZERO                        0x4000
-#define EFLAG_SELECT                      (EFLAG_SIGN | EFLAG_ZERO)
-
-#define RESULT_NEGATIVE                   ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
-#define RESULT_ZERO                       ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
-#define RESULT_POSITIVE                   ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
-
 typedef enum _INTERLOCKED_RESULT {
   ResultNegative = RESULT_NEGATIVE,
   ResultZero = RESULT_ZERO,
@@ -3692,20 +2102,6 @@ typedef struct _PCIBUSDATA
 
 /** SPINLOCK FUNCTIONS ********************************************************/
 
-NTKERNELAPI
-BOOLEAN
-FASTCALL
-KeTryToAcquireSpinLockAtDpcLevel(
-    IN OUT PKSPIN_LOCK SpinLock
-);
-
-NTKERNELAPI
-BOOLEAN
-FASTCALL
-KeTestSpinLock(
-    IN PKSPIN_LOCK SpinLock
-);
-
 #if defined (_X86_)
 
 #if defined(WIN9X_COMPAT_SPINLOCK)
@@ -3846,263 +2242,9 @@ KeAcquireSpinLockRaiseToDpc(
     
 #endif // !defined (_X86_)
 
-/*
-** Utillity functions
-*/
-
 #define ARGUMENT_PRESENT(ArgumentPointer) \
   ((CHAR*)((ULONG_PTR)(ArgumentPointer)) != (CHAR*)NULL)
 
-/*
- * ULONG
- * BYTE_OFFSET(
- *   IN PVOID  Va)
- */
-#define BYTE_OFFSET(Va) \
-  ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
-
-/*
- * ULONG
- * BYTES_TO_PAGES(
- *   IN ULONG  Size)
- */
-#define BYTES_TO_PAGES(Size) \
-  ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0))
-
-/*
- * PVOID
- * PAGE_ALIGN(
- *   IN PVOID  Va)
- */
-#define PAGE_ALIGN(Va) \
-  ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
-
-/*
- * ULONG_PTR
- * ROUND_TO_PAGES(
- *   IN ULONG_PTR  Size)
- */
-#define ROUND_TO_PAGES(Size) \
-  ((ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
-
-
-
-#if defined(_X86_) || defined(_AMD64_)
-
-//
-// x86 and x64 performs a 0x2C interrupt
-//
-#define DbgRaiseAssertionFailure __int2c
-
-#elif defined(_ARM_)
-
-//
-// TODO
-//
-
-#else
-#error Unsupported Architecture
-#endif
-
-#if DBG
-
-#define ASSERT(exp) \
-  (VOID)((!(exp)) ? \
-    RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
-
-#define ASSERTMSG(msg, exp) \
-  (VOID)((!(exp)) ? \
-    RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, msg ), FALSE : TRUE)
-
-#define RTL_SOFT_ASSERT(exp) \
-  (VOID)((!(exp)) ? \
-    DbgPrint("%s(%d): Soft assertion failed\n   Expression: %s\n", __FILE__, __LINE__, #exp), FALSE : TRUE)
-
-#define RTL_SOFT_ASSERTMSG(msg, exp) \
-  (VOID)((!(exp)) ? \
-    DbgPrint("%s(%d): Soft assertion failed\n   Expression: %s\n   Message: %s\n", __FILE__, __LINE__, #exp, (msg)), FALSE : TRUE)
-
-#define RTL_VERIFY(exp) ASSERT(exp)
-#define RTL_VERIFYMSG(msg, exp) ASSERT(msg, exp)
-
-#define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
-#define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
-
-#if defined(_MSC_VER)
-
-#define NT_ASSERT(exp) \
-   ((!(exp)) ? \
-      (__annotation(L"Debug", L"AssertFail", L#exp), \
-       DbgRaiseAssertionFailure(), FALSE) : TRUE)
-
-#define NT_ASSERTMSG(msg, exp) \
-   ((!(exp)) ? \
-      (__annotation(L"Debug", L"AssertFail", L##msg), \
-      DbgRaiseAssertionFailure(), FALSE) : TRUE)
-
-#define NT_ASSERTMSGW(msg, exp) \
-    ((!(exp)) ? \
-        (__annotation(L"Debug", L"AssertFail", msg), \
-         DbgRaiseAssertionFailure(), FALSE) : TRUE)
-
-#else
-
-//
-// GCC doesn't support __annotation (nor PDB)
-//
-#define NT_ASSERT(exp) \
-   (VOID)((!(exp)) ? (DbgRaiseAssertionFailure(), FALSE) : TRUE)
-
-#define NT_ASSERTMSG NT_ASSERT
-#define NT_ASSERTMSGW NT_ASSERT
-
-#endif
-
-#else /* !DBG */
-
-#define ASSERT(exp) ((VOID) 0)
-#define ASSERTMSG(msg, exp) ((VOID) 0)
-
-#define RTL_SOFT_ASSERT(exp) ((VOID) 0)
-#define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
-
-#define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
-#define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
-
-#define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
-#define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
-
-#define NT_ASSERT(exp)     ((VOID)0)
-#define NT_ASSERTMSG(exp)  ((VOID)0)
-#define NT_ASSERTMSGW(exp) ((VOID)0)
-
-#endif /* DBG */
-
-/* HACK HACK HACK - GCC (or perhaps LD) is messing this up */
-#if defined(_NTSYSTEM_) || defined(__GNUC__)
-#define NLS_MB_CODE_PAGE_TAG NlsMbCodePageTag
-#define NLS_MB_OEM_CODE_PAGE_TAG NlsMbOemCodePageTag
-#else
-#define NLS_MB_CODE_PAGE_TAG (*NlsMbCodePageTag)
-#define NLS_MB_OEM_CODE_PAGE_TAG (*NlsMbOemCodePageTag)
-#endif /* _NT_SYSTEM */
-
-extern BOOLEAN NTSYSAPI NLS_MB_CODE_PAGE_TAG;
-extern BOOLEAN NTSYSAPI NLS_MB_OEM_CODE_PAGE_TAG;
-
-/*
-** Driver support routines
-*/
-
-/** Runtime library routines **/
-
-static __inline VOID
-InitializeListHead(
-  IN PLIST_ENTRY  ListHead)
-{
-  ListHead->Flink = ListHead->Blink = ListHead;
-}
-
-static __inline VOID
-InsertHeadList(
-  IN PLIST_ENTRY  ListHead,
-  IN PLIST_ENTRY  Entry)
-{
-  PLIST_ENTRY OldFlink;
-  OldFlink = ListHead->Flink;
-  Entry->Flink = OldFlink;
-  Entry->Blink = ListHead;
-  OldFlink->Blink = Entry;
-  ListHead->Flink = Entry;
-}
-
-static __inline VOID
-InsertTailList(
-  IN PLIST_ENTRY  ListHead,
-  IN PLIST_ENTRY  Entry)
-{
-  PLIST_ENTRY OldBlink;
-  OldBlink = ListHead->Blink;
-  Entry->Flink = ListHead;
-  Entry->Blink = OldBlink;
-  OldBlink->Flink = Entry;
-  ListHead->Blink = Entry;
-}
-
-/*
- * BOOLEAN
- * IsListEmpty(
- *   IN PLIST_ENTRY  ListHead)
- */
-#define IsListEmpty(_ListHead) \
-  ((_ListHead)->Flink == (_ListHead))
-
-/*
- * PSINGLE_LIST_ENTRY
- * PopEntryList(
- *   IN PSINGLE_LIST_ENTRY  ListHead)
- */
-#define PopEntryList(ListHead) \
-  (ListHead)->Next; \
-  { \
-    PSINGLE_LIST_ENTRY _FirstEntry; \
-    _FirstEntry = (ListHead)->Next; \
-    if (_FirstEntry != NULL) \
-      (ListHead)->Next = _FirstEntry->Next; \
-  }
-
-/*
- * VOID
- * PushEntryList(
- *   IN PSINGLE_LIST_ENTRY  ListHead,
- *   IN PSINGLE_LIST_ENTRY  Entry)
- */
-#define PushEntryList(_ListHead, _Entry) \
-       (_Entry)->Next = (_ListHead)->Next; \
-       (_ListHead)->Next = (_Entry); \
-
-static __inline BOOLEAN
-RemoveEntryList(
-  IN PLIST_ENTRY  Entry)
-{
-  PLIST_ENTRY OldFlink;
-  PLIST_ENTRY OldBlink;
-
-  OldFlink = Entry->Flink;
-  OldBlink = Entry->Blink;
-  OldFlink->Blink = OldBlink;
-  OldBlink->Flink = OldFlink;
-  return (BOOLEAN)(OldFlink == OldBlink);
-}
-
-static __inline PLIST_ENTRY
-RemoveHeadList(
-  IN PLIST_ENTRY  ListHead)
-{
-  PLIST_ENTRY Flink;
-  PLIST_ENTRY Entry;
-
-  Entry = ListHead->Flink;
-  Flink = Entry->Flink;
-  ListHead->Flink = Flink;
-  Flink->Blink = ListHead;
-  return Entry;
-}
-
-static __inline PLIST_ENTRY
-RemoveTailList(
-  IN PLIST_ENTRY  ListHead)
-{
-  PLIST_ENTRY Blink;
-  PLIST_ENTRY Entry;
-
-  Entry = ListHead->Blink;
-  Blink = Entry->Blink;
-  ListHead->Blink = Blink;
-  Blink->Flink = ListHead;
-  return Entry;
-}
-
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -4254,88 +2396,6 @@ RtlWalkFrameChain(
   IN ULONG  Count,
   IN ULONG  Flags);
 
-NTKERNELAPI
-BOOLEAN
-NTAPI
-KeAreAllApcsDisabled(
-    VOID
-);
-
-/* Guarded Mutex routines */
-
-NTKERNELAPI
-VOID
-FASTCALL
-KeAcquireGuardedMutex(
-    IN OUT PKGUARDED_MUTEX GuardedMutex
-);
-
-NTKERNELAPI
-VOID
-FASTCALL
-KeAcquireGuardedMutexUnsafe(
-    IN OUT PKGUARDED_MUTEX GuardedMutex
-);
-
-NTKERNELAPI
-VOID
-NTAPI
-KeEnterGuardedRegion(
-    VOID
-);
-
-NTKERNELAPI
-VOID
-NTAPI
-KeLeaveGuardedRegion(
-    VOID
-);
-
-NTKERNELAPI
-VOID
-FASTCALL
-KeInitializeGuardedMutex(
-    OUT PKGUARDED_MUTEX GuardedMutex
-);
-
-NTKERNELAPI
-VOID
-FASTCALL
-KeReleaseGuardedMutexUnsafe(
-    IN OUT PKGUARDED_MUTEX GuardedMutex
-);
-
-NTKERNELAPI
-VOID
-FASTCALL
-KeReleaseGuardedMutex(
-    IN OUT PKGUARDED_MUTEX GuardedMutex
-);
-
-NTKERNELAPI
-BOOLEAN
-FASTCALL
-KeTryToAcquireGuardedMutex(
-    IN OUT PKGUARDED_MUTEX GuardedMutex
-);
-
-/* Fast Mutex */
-#define ExInitializeFastMutex(_FastMutex) \
-{ \
-    (_FastMutex)->Count = FM_LOCK_BIT; \
-    (_FastMutex)->Owner = NULL; \
-    (_FastMutex)->Contention = 0; \
-    KeInitializeEvent(&(_FastMutex)->Gate, SynchronizationEvent, FALSE); \
-}
-
-NTKERNELAPI
-VOID
-NTAPI
-KeInitializeEvent(
-  IN PRKEVENT  Event,
-  IN EVENT_TYPE  Type,
-  IN BOOLEAN  State);
-
 /******************************************************************************
  *                            Executive Types                                 *
  ******************************************************************************/
@@ -4421,16 +2481,6 @@ ExInterlockedExtendZone(
 #define ExInterlockedFreeToZone(Zone, Block, Lock) \
     ExInterlockedPushEntryList(&(Zone)->FreeList, (PSINGLE_LIST_ENTRY)(Block), Lock)
 
-/*
- * VOID
- * InitializeSListHead(
- *   IN PSLIST_HEADER  SListHead)
- */
-#define InitializeSListHead(_SListHead) \
-       (_SListHead)->Alignment = 0
-
-#define ExInitializeSListHead InitializeSListHead
-
 /*
  * BOOLEAN
  * ExIsFullZone(