- Move more stuff to wdm.h
[reactos.git] / include / ddk / wdm.h
index f3f40d7..d0e135e 100644 (file)
@@ -56,6 +56,1722 @@ extern "C" {
 #endif
 
 
+/*
+ * Alignment Macros
+ */
+#define ALIGN_DOWN(s, t) \
+    ((ULONG)(s) & ~(sizeof(t) - 1))
+
+#define ALIGN_UP(s, t) \
+    (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
+
+#define ALIGN_DOWN_POINTER(p, t) \
+    ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
+
+#define ALIGN_UP_POINTER(p, t) \
+    (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
+
+/*
+ * GUID Comparison
+ */
+
+#ifndef __IID_ALIGNED__
+    #define __IID_ALIGNED__
+    #ifdef __cplusplus
+        inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
+        {
+            return ((*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)));
+        }
+    #else
+        #define IsEqualGUIDAligned(guid1, guid2) \
+            ((*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)))
+    #endif 
+#endif
+
+#if defined(_WIN64)
+#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
+#else
+#define POINTER_ALIGNMENT
+#endif
+
+/*
+** Forward declarations
+*/
+
+struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP;
+struct _MDL;
+struct _KAPC;
+struct _KDPC;
+struct _FILE_OBJECT;
+struct _DMA_ADAPTER;
+struct _DEVICE_OBJECT;
+struct _DRIVER_OBJECT;
+struct _IO_STATUS_BLOCK;
+struct _DEVICE_DESCRIPTION;
+struct _SCATTER_GATHER_LIST;
+struct _DRIVE_LAYOUT_INFORMATION;
+
+typedef PVOID PSID;
+
+/*
+** Simple structures
+*/
+
+typedef UCHAR KIRQL, *PKIRQL;
+
+typedef enum _MODE {
+  KernelMode,
+  UserMode,
+  MaximumMode
+} MODE;
+
+/* Constants */
+#define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )
+#define ZwCurrentProcess() NtCurrentProcess()
+#define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )
+#define ZwCurrentThread() NtCurrentThread()
+
+#if (_M_IX86)
+#define KIP0PCRADDRESS                      0xffdff000
+#endif
+
+#if defined(_WIN64)
+#define MAXIMUM_PROCESSORS 64
+#else
+#define MAXIMUM_PROCESSORS 32
+#endif
+
+#define MAXIMUM_WAIT_OBJECTS              64
+
+#define EX_RUNDOWN_ACTIVE                 0x1
+#define EX_RUNDOWN_COUNT_SHIFT            0x1
+#define EX_RUNDOWN_COUNT_INC              (1 << EX_RUNDOWN_COUNT_SHIFT)
+
+#define METHOD_BUFFERED                   0
+#define METHOD_IN_DIRECT                  1
+#define METHOD_OUT_DIRECT                 2
+#define METHOD_NEITHER                    3
+
+#define LOW_PRIORITY                      0
+#define LOW_REALTIME_PRIORITY             16
+#define HIGH_PRIORITY                     31
+#define MAXIMUM_PRIORITY                  32
+
+#define MAXIMUM_SUSPEND_COUNT             MAXCHAR
+
+#define MAXIMUM_FILENAME_LENGTH           256
+
+#define FILE_SUPERSEDED                   0x00000000
+#define FILE_OPENED                       0x00000001
+#define FILE_CREATED                      0x00000002
+#define FILE_OVERWRITTEN                  0x00000003
+#define FILE_EXISTS                       0x00000004
+#define FILE_DOES_NOT_EXIST               0x00000005
+
+#define FILE_USE_FILE_POINTER_POSITION    0xfffffffe
+#define FILE_WRITE_TO_END_OF_FILE         0xffffffff
+
+/* also in winnt.h */
+#define FILE_LIST_DIRECTORY               0x00000001
+#define FILE_READ_DATA                    0x00000001
+#define FILE_ADD_FILE                     0x00000002
+#define FILE_WRITE_DATA                   0x00000002
+#define FILE_ADD_SUBDIRECTORY             0x00000004
+#define FILE_APPEND_DATA                  0x00000004
+#define FILE_CREATE_PIPE_INSTANCE         0x00000004
+#define FILE_READ_EA                      0x00000008
+#define FILE_WRITE_EA                     0x00000010
+#define FILE_EXECUTE                      0x00000020
+#define FILE_TRAVERSE                     0x00000020
+#define FILE_DELETE_CHILD                 0x00000040
+#define FILE_READ_ATTRIBUTES              0x00000080
+#define FILE_WRITE_ATTRIBUTES             0x00000100
+
+#define FILE_SHARE_READ                   0x00000001
+#define FILE_SHARE_WRITE                  0x00000002
+#define FILE_SHARE_DELETE                 0x00000004
+#define FILE_SHARE_VALID_FLAGS            0x00000007
+
+#define FILE_ATTRIBUTE_READONLY           0x00000001
+#define FILE_ATTRIBUTE_HIDDEN             0x00000002
+#define FILE_ATTRIBUTE_SYSTEM             0x00000004
+#define FILE_ATTRIBUTE_DIRECTORY          0x00000010
+#define FILE_ATTRIBUTE_ARCHIVE            0x00000020
+#define FILE_ATTRIBUTE_DEVICE             0x00000040
+#define FILE_ATTRIBUTE_NORMAL             0x00000080
+#define FILE_ATTRIBUTE_TEMPORARY          0x00000100
+#define FILE_ATTRIBUTE_SPARSE_FILE        0x00000200
+#define FILE_ATTRIBUTE_REPARSE_POINT      0x00000400
+#define FILE_ATTRIBUTE_COMPRESSED         0x00000800
+#define FILE_ATTRIBUTE_OFFLINE            0x00001000
+#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
+#define FILE_ATTRIBUTE_ENCRYPTED          0x00004000
+
+#define FILE_ATTRIBUTE_VALID_FLAGS        0x00007fb7
+#define FILE_ATTRIBUTE_VALID_SET_FLAGS    0x000031a7
+
+#define FILE_VALID_OPTION_FLAGS           0x00ffffff
+#define FILE_VALID_PIPE_OPTION_FLAGS      0x00000032
+#define FILE_VALID_MAILSLOT_OPTION_FLAGS  0x00000032
+#define FILE_VALID_SET_FLAGS              0x00000036
+
+#define FILE_SUPERSEDE                    0x00000000
+#define FILE_OPEN                         0x00000001
+#define FILE_CREATE                       0x00000002
+#define FILE_OPEN_IF                      0x00000003
+#define FILE_OVERWRITE                    0x00000004
+#define FILE_OVERWRITE_IF                 0x00000005
+#define FILE_MAXIMUM_DISPOSITION          0x00000005
+
+#define FILE_DIRECTORY_FILE               0x00000001
+#define FILE_WRITE_THROUGH                0x00000002
+#define FILE_SEQUENTIAL_ONLY              0x00000004
+#define FILE_NO_INTERMEDIATE_BUFFERING    0x00000008
+#define FILE_SYNCHRONOUS_IO_ALERT         0x00000010
+#define FILE_SYNCHRONOUS_IO_NONALERT      0x00000020
+#define FILE_NON_DIRECTORY_FILE           0x00000040
+#define FILE_CREATE_TREE_CONNECTION       0x00000080
+#define FILE_COMPLETE_IF_OPLOCKED         0x00000100
+#define FILE_NO_EA_KNOWLEDGE              0x00000200
+#define FILE_OPEN_REMOTE_INSTANCE         0x00000400
+#define FILE_RANDOM_ACCESS                0x00000800
+#define FILE_DELETE_ON_CLOSE              0x00001000
+#define FILE_OPEN_BY_FILE_ID              0x00002000
+#define FILE_OPEN_FOR_BACKUP_INTENT       0x00004000
+#define FILE_NO_COMPRESSION               0x00008000
+#define FILE_RESERVE_OPFILTER             0x00100000
+#define FILE_OPEN_REPARSE_POINT           0x00200000
+#define FILE_OPEN_NO_RECALL               0x00400000
+#define FILE_OPEN_FOR_FREE_SPACE_QUERY    0x00800000
+
+#define FILE_ANY_ACCESS                   0x00000000
+#define FILE_SPECIAL_ACCESS               FILE_ANY_ACCESS
+#define FILE_READ_ACCESS                  0x00000001
+#define FILE_WRITE_ACCESS                 0x00000002
+
+#define FILE_ALL_ACCESS \
+  (STANDARD_RIGHTS_REQUIRED | \
+   SYNCHRONIZE | \
+   0x1FF)
+
+#define FILE_GENERIC_EXECUTE \
+  (STANDARD_RIGHTS_EXECUTE | \
+   FILE_READ_ATTRIBUTES | \
+   FILE_EXECUTE | \
+   SYNCHRONIZE)
+
+#define FILE_GENERIC_READ \
+  (STANDARD_RIGHTS_READ | \
+   FILE_READ_DATA | \
+   FILE_READ_ATTRIBUTES | \
+   FILE_READ_EA | \
+   SYNCHRONIZE)
+
+#define FILE_GENERIC_WRITE \
+  (STANDARD_RIGHTS_WRITE | \
+   FILE_WRITE_DATA | \
+   FILE_WRITE_ATTRIBUTES | \
+   FILE_WRITE_EA | \
+   FILE_APPEND_DATA | \
+   SYNCHRONIZE)
+
+/* end winnt.h */
+
+#define OBJ_NAME_PATH_SEPARATOR     ((WCHAR)L'\\')
+
+#define OBJECT_TYPE_CREATE (0x0001)
+#define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
+
+#define DIRECTORY_QUERY (0x0001)
+#define DIRECTORY_TRAVERSE (0x0002)
+#define DIRECTORY_CREATE_OBJECT (0x0004)
+#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
+#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
+
+#define EVENT_QUERY_STATE (0x0001)
+#define EVENT_MODIFY_STATE (0x0002)
+#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
+
+#define SEMAPHORE_QUERY_STATE (0x0001)
+#define SEMAPHORE_MODIFY_STATE (0x0002)
+#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
+
+#define FM_LOCK_BIT             (0x1)
+#define FM_LOCK_BIT_V           (0x0)
+#define FM_LOCK_WAITER_WOKEN    (0x2)
+#define FM_LOCK_WAITER_INC      (0x4)
+
+#define PROCESSOR_FEATURE_MAX 64
+
+typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
+{
+    StandardDesign,
+    NEC98x86,
+    EndAlternatives
+} ALTERNATIVE_ARCHITECTURE_TYPE;
+
+typedef struct _KSYSTEM_TIME
+{
+    ULONG LowPart;
+    LONG High1Time;
+    LONG High2Time;
+} KSYSTEM_TIME, *PKSYSTEM_TIME;
+
+/*
+** 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 enum _IO_PAGING_PRIORITY {
+  IoPagingPriorityInvalid,
+  IoPagingPriorityNormal,
+  IoPagingPriorityHigh,
+  IoPagingPriorityReserved1,
+  IoPagingPriorityReserved2
+} IO_PAGING_PRIORITY;
+
+typedef enum _IO_ALLOCATION_ACTION {
+  KeepObject = 1,
+  DeallocateObject,
+  DeallocateObjectKeepRegisters
+} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
+
+typedef IO_ALLOCATION_ACTION
+(DDKAPI *PDRIVER_CONTROL)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp,
+  IN PVOID  MapRegisterBase,
+  IN PVOID  Context);
+
+typedef VOID
+(DDKAPI *PDRIVER_LIST_CONTROL)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp,
+  IN struct _SCATTER_GATHER_LIST  *ScatterGather,
+  IN PVOID  Context);
+
+typedef NTSTATUS
+(DDKAPI DRIVER_ADD_DEVICE)(
+  IN struct _DRIVER_OBJECT  *DriverObject,
+  IN struct _DEVICE_OBJECT  *PhysicalDeviceObject);
+typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
+
+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;
+
+typedef VOID
+(DDKAPI DRIVER_CANCEL)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp);
+typedef DRIVER_CANCEL *PDRIVER_CANCEL;
+
+typedef VOID
+(DDKAPI *PKDEFERRED_ROUTINE)(
+  IN struct _KDPC  *Dpc,
+  IN PVOID  DeferredContext,
+  IN PVOID  SystemArgument1,
+  IN PVOID  SystemArgument2);
+
+typedef NTSTATUS
+(DDKAPI DRIVER_DISPATCH)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp);
+typedef DRIVER_DISPATCH *PDRIVER_DISPATCH;
+
+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 *PMM_DLL_INITIALIZE)(
+  IN PUNICODE_STRING  RegistryPath);
+
+typedef NTSTATUS
+(DDKAPI *PMM_DLL_UNLOAD)(
+  VOID);
+
+typedef NTSTATUS
+(DDKAPI DRIVER_INITIALIZE)(
+  IN struct _DRIVER_OBJECT  *DriverObject,
+  IN PUNICODE_STRING  RegistryPath);
+typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
+
+typedef BOOLEAN
+(DDKAPI KSERVICE_ROUTINE)(
+  IN struct _KINTERRUPT  *Interrupt,
+  IN PVOID  ServiceContext);
+typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE;
+
+typedef VOID
+(DDKAPI *PIO_TIMER_ROUTINE)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN PVOID  Context);
+
+typedef VOID
+(DDKAPI DRIVER_STARTIO)(
+  IN struct _DEVICE_OBJECT  *DeviceObject,
+  IN struct _IRP  *Irp);
+typedef DRIVER_STARTIO *PDRIVER_STARTIO;
+
+typedef BOOLEAN
+(DDKAPI *PKSYNCHRONIZE_ROUTINE)(
+  IN PVOID  SynchronizeContext);
+
+typedef VOID
+(DDKAPI DRIVER_UNLOAD)(
+  IN struct _DRIVER_OBJECT  *DriverObject);
+typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
+
+/*
+** Plug and Play structures
+*/
+
+typedef VOID
+(DDKAPI *PINTERFACE_REFERENCE)(
+  PVOID  Context);
+
+typedef VOID
+(DDKAPI *PINTERFACE_DEREFERENCE)(
+  PVOID Context);
+
+typedef BOOLEAN
+(DDKAPI *PTRANSLATE_BUS_ADDRESS)(
+  IN PVOID  Context,
+  IN PHYSICAL_ADDRESS  BusAddress,
+  IN ULONG  Length,
+  IN OUT PULONG  AddressSpace,
+  OUT PPHYSICAL_ADDRESS  TranslatedAddress);
+
+typedef struct _DMA_ADAPTER*
+(DDKAPI *PGET_DMA_ADAPTER)(
+  IN PVOID  Context,
+  IN struct _DEVICE_DESCRIPTION  *DeviceDescriptor,
+  OUT PULONG  NumberOfMapRegisters);
+
+typedef ULONG
+(DDKAPI *PGET_SET_DEVICE_DATA)(
+  IN PVOID  Context,
+  IN ULONG  DataType,
+  IN PVOID  Buffer,
+  IN ULONG  Offset,
+  IN ULONG  Length);
+
+/* 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;
+
+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);
+
+typedef BOOLEAN
+(DDKAPI *PPCI_IS_DEVICE_PRESENT_EX)(
+  IN PVOID Context,
+  IN PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
+
+typedef union _POWER_STATE {
+  SYSTEM_POWER_STATE  SystemState;
+  DEVICE_POWER_STATE  DeviceState;
+} POWER_STATE, *PPOWER_STATE;
+
+typedef enum _POWER_STATE_TYPE {
+  SystemPowerState = 0,
+  DevicePowerState
+} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
+
+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;
+
+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;
+
+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;
+
+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;
+
+typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
+
+#undef INTERFACE
+
+typedef struct _INTERFACE {
+  USHORT  Size;
+  USHORT  Version;
+  PVOID  Context;
+  PINTERFACE_REFERENCE  InterfaceReference;
+  PINTERFACE_DEREFERENCE  InterfaceDereference;
+} INTERFACE, *PINTERFACE;
+
+typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
+
+typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
+
+/* PNP_DEVICE_STATE */
+
+#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 _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 _TARGET_DEVICE_REMOVAL_NOTIFICATION {
+  USHORT  Version;
+  USHORT  Size;
+  GUID  Event;
+  struct _FILE_OBJECT  *FileObject;
+} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
+
+typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
+  DeviceUsageTypeUndefined,
+  DeviceUsageTypePaging,
+  DeviceUsageTypeHibernation,
+  DeviceUsageTypeDumpFile
+} DEVICE_USAGE_NOTIFICATION_TYPE;
+
+typedef struct _POWER_SEQUENCE {
+  ULONG  SequenceD1;
+  ULONG  SequenceD2;
+  ULONG  SequenceD3;
+} POWER_SEQUENCE, *PPOWER_SEQUENCE;
+
+typedef enum {
+  DevicePropertyDeviceDescription = 0x0 | __string_type,
+  DevicePropertyHardwareID = 0x1 | __multiString_type,
+  DevicePropertyCompatibleIDs = 0x2 | __multiString_type,
+  DevicePropertyBootConfiguration = 0x3,
+  DevicePropertyBootConfigurationTranslated = 0x4,
+  DevicePropertyClassName = 0x5 | __string_type,
+  DevicePropertyClassGuid = 0x6 | __string_type,
+  DevicePropertyDriverKeyName = 0x7 | __string_type,
+  DevicePropertyManufacturer = 0x8 | __string_type,
+  DevicePropertyFriendlyName = 0x9 | __string_type,
+  DevicePropertyLocationInformation = 0xa | __string_type,
+  DevicePropertyPhysicalDeviceObjectName = 0xb | __string_type,
+  DevicePropertyBusTypeGuid = 0xc | __guid_type,
+  DevicePropertyLegacyBusType = 0xd,
+  DevicePropertyBusNumber = 0xe,
+  DevicePropertyEnumeratorName = 0xf | __string_type,
+  DevicePropertyAddress = 0x10,
+  DevicePropertyUINumber = 0x11,
+  DevicePropertyInstallState = 0x12,
+  DevicePropertyRemovalPolicy = 0x13,
+  DevicePropertyResourceRequirements = 0x14,
+  DevicePropertyAllocatedResources = 0x15,
+  DevicePropertyContainerID = 0x16 | __string_type
+} 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
+
+typedef NTSTATUS
+(DDKAPI *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
+  IN PVOID NotificationStructure,
+  IN PVOID Context);
+
+typedef VOID
+(DDKAPI *PDEVICE_CHANGE_COMPLETE_CALLBACK)(
+  IN PVOID Context);
+
+/*
+** System structures
+*/
+
+#define SYMBOLIC_LINK_QUERY               0x0001
+#define SYMBOLIC_LINK_ALL_ACCESS          (STANDARD_RIGHTS_REQUIRED | 0x1)
+
+/* also in winnt,h */
+#define DUPLICATE_CLOSE_SOURCE            0x00000001
+#define DUPLICATE_SAME_ACCESS             0x00000002
+#define DUPLICATE_SAME_ATTRIBUTES         0x00000004
+/* end winnt.h */
+
+typedef struct _OBJECT_NAME_INFORMATION {
+  UNICODE_STRING  Name;
+} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
+
+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 *PIO_APC_ROUTINE)(
+  IN PVOID ApcContext,
+  IN PIO_STATUS_BLOCK IoStatusBlock,
+  IN ULONG Reserved);
+
+typedef VOID
+(DDKAPI *PKNORMAL_ROUTINE)(
+  IN PVOID  NormalContext,
+  IN PVOID  SystemArgument1,
+  IN PVOID  SystemArgument2);
+
+typedef VOID
+(DDKAPI *PKKERNEL_ROUTINE)(
+  IN struct _KAPC  *Apc,
+  IN OUT PKNORMAL_ROUTINE  *NormalRoutine,
+  IN OUT PVOID  *NormalContext,
+  IN OUT PVOID  *SystemArgument1,
+  IN OUT PVOID  *SystemArgument2);
+
+typedef VOID
+(DDKAPI *PKRUNDOWN_ROUTINE)(
+  IN struct _KAPC  *Apc);
+
+typedef struct _KAPC
+{
+  UCHAR Type;
+  UCHAR SpareByte0;
+  UCHAR Size;
+  UCHAR SpareByte1;
+  ULONG SpareLong0;
+  struct _KTHREAD *Thread;
+  LIST_ENTRY ApcListEntry;
+  PKKERNEL_ROUTINE KernelRoutine;
+  PKRUNDOWN_ROUTINE RundownRoutine;
+  PKNORMAL_ROUTINE NormalRoutine;
+  PVOID NormalContext;
+  PVOID SystemArgument1;
+  PVOID SystemArgument2;
+  CCHAR ApcStateIndex;
+  KPROCESSOR_MODE ApcMode;
+  BOOLEAN Inserted;
+} KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
+
+typedef struct _KDEVICE_QUEUE_ENTRY {
+  LIST_ENTRY  DeviceListEntry;
+  ULONG  SortKey;
+  BOOLEAN  Inserted;
+} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
+*RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
+
+#define LOCK_QUEUE_WAIT                   1
+#define LOCK_QUEUE_OWNER                  2
+
+#if defined(_AMD64_)
+
+typedef ULONG64 KSPIN_LOCK_QUEUE_NUMBER;
+
+#define LockQueueUnusedSpare0 0
+#define LockQueueExpansionLock 1
+#define LockQueueUnusedSpare2 2
+#define LockQueueSystemSpaceLock 3
+#define LockQueueVacbLock 4
+#define LockQueueMasterLock 5
+#define LockQueueNonPagedPoolLock 6
+#define LockQueueIoCancelLock 7
+#define LockQueueWorkQueueLock 8
+#define LockQueueIoVpbLock 9
+#define LockQueueIoDatabaseLock 10
+#define LockQueueIoCompletionLock 11
+#define LockQueueNtfsStructLock 12
+#define LockQueueAfdWorkQueueLock 13
+#define LockQueueBcbLock 14
+#define LockQueueMmNonPagedPoolLock 15
+#define LockQueueUnusedSpare16 16
+#define LockQueueMaximumLock (LockQueueUnusedSpare16 + 1)
+
+#else
+
+typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
+  LockQueueUnusedSpare0,
+  LockQueueExpansionLock,
+  LockQueueUnusedSpare2,
+  LockQueueSystemSpaceLock,
+  LockQueueVacbLock,
+  LockQueueMasterLock,
+  LockQueueNonPagedPoolLock,
+  LockQueueIoCancelLock,
+  LockQueueWorkQueueLock,
+  LockQueueIoVpbLock,
+  LockQueueIoDatabaseLock,
+  LockQueueIoCompletionLock,
+  LockQueueNtfsStructLock,
+  LockQueueAfdWorkQueueLock,
+  LockQueueBcbLock,
+  LockQueueMmNonPagedPoolLock,
+  LockQueueUnusedSpare16,
+  LockQueueMaximumLock = LockQueueUnusedSpare16 + 1
+} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
+
+#endif
+
+typedef struct _KSPIN_LOCK_QUEUE {
+  struct _KSPIN_LOCK_QUEUE  *volatile Next;
+  PKSPIN_LOCK volatile  Lock;
+} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
+
+typedef struct _KLOCK_QUEUE_HANDLE {
+  KSPIN_LOCK_QUEUE  LockQueue;
+  KIRQL  OldIrql;
+} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
+
+#define DPC_NORMAL 0
+#define DPC_THREADED 1
+
+#define ASSERT_APC(Object) \
+    ASSERT((Object)->Type == ApcObject)
+
+#define ASSERT_DPC(Object) \
+    ASSERT(((Object)->Type == 0) || \
+           ((Object)->Type == DpcObject) || \
+           ((Object)->Type == ThreadedDpcObject))
+
+#define ASSERT_DEVICE_QUEUE(Object) \
+    ASSERT((Object)->Type == DeviceQueueObject)
+
+typedef PVOID PKIPI_CONTEXT;
+
+typedef
+VOID
+(NTAPI *PKIPI_WORKER)(
+    IN PKIPI_CONTEXT PacketContext,
+    IN PVOID Parameter1,
+    IN PVOID Parameter2,
+    IN PVOID Parameter3
+);
+
+typedef struct _WAIT_CONTEXT_BLOCK {
+  KDEVICE_QUEUE_ENTRY  WaitQueueEntry;
+  PDRIVER_CONTROL  DeviceRoutine;
+  PVOID  DeviceContext;
+  ULONG  NumberOfMapRegisters;
+  PVOID  DeviceObject;
+  PVOID  CurrentIrp;
+  PKDPC  BufferChainingDpc;
+} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
+
+typedef struct _KDEVICE_QUEUE {
+  CSHORT Type;
+  CSHORT Size;
+  LIST_ENTRY DeviceListHead;
+  KSPIN_LOCK Lock;
+  #if defined(_AMD64_)
+  union {
+    BOOLEAN Busy;
+    struct {
+      LONG64 Reserved : 8;
+      LONG64 Hint : 56;
+    };
+  };
+  #else
+  BOOLEAN Busy;
+  #endif
+
+} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
+
+typedef struct _KDPC
+{
+    UCHAR Type;
+    UCHAR Importance;
+    volatile USHORT Number;
+    LIST_ENTRY DpcListEntry;
+    PKDEFERRED_ROUTINE DeferredRoutine;
+    PVOID DeferredContext;
+    PVOID SystemArgument1;
+    PVOID SystemArgument2;
+    volatile PVOID  DpcData;
+} KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
+
+typedef struct _KGATE
+{
+    DISPATCHER_HEADER Header;
+} KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE;
+
+#define GM_LOCK_BIT          0x1
+#define GM_LOCK_BIT_V        0x0
+#define GM_LOCK_WAITER_WOKEN 0x2
+#define GM_LOCK_WAITER_INC   0x4
+
+typedef struct _KGUARDED_MUTEX
+{
+    volatile LONG Count;
+    PKTHREAD Owner;
+    ULONG Contention;
+    KGATE Gate;
+    __GNU_EXTENSION union
+    {
+        __GNU_EXTENSION struct
+        {
+            SHORT KernelApcDisable;
+            SHORT SpecialApcDisable;
+        };
+        ULONG CombinedApcDisable;
+    };
+} KGUARDED_MUTEX, *PKGUARDED_MUTEX;
+
+typedef struct _KMUTANT {
+  DISPATCHER_HEADER  Header;
+  LIST_ENTRY  MutantListEntry;
+  struct _KTHREAD  *RESTRICTED_POINTER OwnerThread;
+  BOOLEAN  Abandoned;
+  UCHAR  ApcDisable;
+} KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
+
+typedef struct _KTIMER {
+  DISPATCHER_HEADER Header;
+  ULARGE_INTEGER DueTime;
+  LIST_ENTRY TimerListEntry;
+  struct _KDPC *Dpc;
+  #if !defined(_X86_)
+  ULONG Processor;
+  #endif
+  ULONG Period;
+} KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
+
+
+#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
+
+#define MM_MAXIMUM_DISK_IO_SIZE          (0x10000)
+
+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;
+
+/* 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
+
+typedef struct _BOOTDISK_INFORMATION {
+  LONGLONG  BootPartitionOffset;
+  LONGLONG  SystemPartitionOffset;
+  ULONG  BootDeviceSignature;
+  ULONG  SystemDeviceSignature;
+} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
+
+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 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;
+
+#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 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 struct _EISA_IRQ_CONFIGURATION {
+  EISA_IRQ_DESCRIPTOR  ConfigurationByte;
+  UCHAR  Reserved;
+} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
+
+typedef struct _DMA_CONFIGURATION_BYTE0 {
+  UCHAR Channel : 3;
+  UCHAR Reserved : 3;
+  UCHAR Shared : 1;
+  UCHAR MoreEntries : 1;
+} DMA_CONFIGURATION_BYTE0;
+
+typedef struct _DMA_CONFIGURATION_BYTE1 {
+  UCHAR  Reserved0 : 2;
+  UCHAR  TransferSize : 2;
+  UCHAR  Timing : 2;
+  UCHAR  Reserved1 : 2;
+} DMA_CONFIGURATION_BYTE1;
+
+typedef struct _EISA_DMA_CONFIGURATION {
+  DMA_CONFIGURATION_BYTE0  ConfigurationByte0;
+  DMA_CONFIGURATION_BYTE1  ConfigurationByte1;
+} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
+
+#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 _EISA_PORT_CONFIGURATION {
+  EISA_PORT_DESCRIPTOR  Configuration;
+  USHORT  PortAddress;
+} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
+#include <poppack.h>
+
+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;
+
+/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
+
+#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)
+
+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;
+
+/* CM_EISA_SLOT_INFORMATION.ReturnCode */
+
+#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
+
+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 _PNP_BUS_INFORMATION {
+  GUID  BusTypeGuid;
+  INTERFACE_TYPE  LegacyBusType;
+  ULONG  BusNumber;
+} PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
+
+#include <pshpack1.h>
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
+
+#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
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
+
+typedef enum _CM_SHARE_DISPOSITION {
+  CmResourceShareUndetermined,
+  CmResourceShareDeviceExclusive,
+  CmResourceShareDriverExclusive,
+  CmResourceShareShared
+} CM_SHARE_DISPOSITION;
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
+
+#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
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
+
+#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
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
+
+#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
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
+
+#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 _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 _CM_FULL_RESOURCE_DESCRIPTOR {
+  INTERFACE_TYPE  InterfaceType;
+  ULONG  BusNumber;
+  CM_PARTIAL_RESOURCE_LIST  PartialResourceList;
+} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
+
+typedef struct _CM_RESOURCE_LIST {
+  ULONG  Count;
+  CM_FULL_RESOURCE_DESCRIPTOR  List[1];
+} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
+
+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 _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 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;
+
+#include <poppack.h>
+
+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
+
+#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
+
+typedef struct _CM_SCSI_DEVICE_DATA {
+  USHORT  Version;
+  USHORT  Revision;
+  UCHAR  HostIdentifier;
+} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
+
+typedef struct _CM_SERIAL_DEVICE_DATA {
+  USHORT  Version;
+  USHORT  Revision;
+  ULONG  BaudClock;
+} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
+
+typedef enum _KINTERRUPT_POLARITY {
+  InterruptPolarityUnknown,
+  InterruptActiveHigh,
+  InterruptActiveLow
+} KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY;
+
+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 _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;
+
+#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 _DMA_WIDTH {
+  Width8Bits,
+  Width16Bits,
+  Width32Bits,
+  MaximumDmaWidth
+} DMA_WIDTH, *PDMA_WIDTH;
+
+typedef enum _DMA_SPEED {
+  Compatible,
+  TypeA,
+  TypeB,
+  TypeC,
+  TypeF,
+  MaximumDmaSpeed
+} DMA_SPEED, *PDMA_SPEED;
+
+/* 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;
+
+/* 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))
+
+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;
+
+/* DEVICE_OBJECT.Flags */
+
+#define DO_VERIFY_VOLUME                  0x00000002
+#define DO_BUFFERED_IO                    0x00000004
+#define DO_EXCLUSIVE                      0x00000008
+#define DO_DIRECT_IO                      0x00000010
+#define DO_MAP_IO_BUFFER                  0x00000020
+#define DO_DEVICE_INITIALIZING            0x00000080
+#define DO_SHUTDOWN_REGISTERED            0x00000800
+#define DO_BUS_ENUMERATED_DEVICE          0x00001000
+#define DO_POWER_PAGABLE                  0x00002000
+#define DO_POWER_INRUSH                   0x00004000
+
+/* DEVICE_OBJECT.Characteristics */
+
+#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
+
+/* DEVICE_OBJECT.AlignmentRequirement */
+
+#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
+
+/* DEVICE_OBJECT.DeviceType */
+
+#define DEVICE_TYPE ULONG
+
+#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 DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _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 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 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;
+
+#if _MSC_VER >= 1200
+#pragma warning(pop)
+#else
+#pragma warning(default:4200)
+#endif
+
+#else
+
+struct _SCATTER_GATHER_LIST;
+typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
+
+#endif
+
 /* Simple types */
 typedef UCHAR KPROCESSOR_MODE;
 typedef LONG KPRIORITY;