Manually applying Gunnars patch became it's easier this way - and a good chance to...
[reactos.git] / reactos / include / ddk / iotypes.h
index f2c7108..1426a4e 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: iotypes.h,v 1.22 2001/01/08 02:14:05 dwelch Exp $
- * 
+/* $Id: iotypes.h,v 1.44 2002/11/07 02:44:49 robd Exp $
+ *
  */
 
 #ifndef __INCLUDE_DDK_IOTYPES_H
@@ -30,6 +30,7 @@ struct _FILE_OBJECT;
 struct _DEVICE_OBJECT;
 struct _IRP;
 struct _IO_STATUS_BLOCK;
+struct _SCSI_REQUEST_BLOCK;
 
 /* SIMPLE TYPES *************************************************************/
 
@@ -42,51 +43,57 @@ enum
 
 typedef enum _CREATE_FILE_TYPE
 {
-       CreateFileTypeNone,
-       CreateFileTypeNamedPipe,
-       CreateFileTypeMailslot
+   CreateFileTypeNone,
+   CreateFileTypeNamedPipe,
+   CreateFileTypeMailslot
 } CREATE_FILE_TYPE;
 
 
-/*
- * FIXME: Definition needed
- */
 typedef struct _SHARE_ACCESS
 {
+   ULONG OpenCount;
+   ULONG Readers;
+   ULONG Writers;
+   ULONG Deleters;
+   ULONG SharedRead;
+   ULONG SharedWrite;
+   ULONG SharedDelete;
 } SHARE_ACCESS, *PSHARE_ACCESS;
 
 /* FUNCTION TYPES ************************************************************/
 
-typedef VOID (*PDRIVER_REINITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
-                                    PVOID Context,
-                                    ULONG Count);
-
-typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
-                                            PUNICODE_STRING Pathname,
-                                            INTERFACE_TYPE BusType,
-                                            ULONG BusNumber,
-                                            PKEY_VALUE_FULL_INFORMATION* BI,
-                                            CONFIGURATION_TYPE ControllerType,
-                                            ULONG ControllerNumber,
-                                            PKEY_VALUE_FULL_INFORMATION* CI,
-                                            CONFIGURATION_TYPE PeripheralType,
-                                            ULONG PeripheralNumber,
-                                            PKEY_VALUE_FULL_INFORMATION* PI);
-
-typedef NTSTATUS (*PIO_COMPLETION_ROUTINE)(struct _DEVICE_OBJECT* DeviceObject,
-                                          struct _IRP* Irp,
-                                          PVOID Context);
-
-typedef VOID (*PIO_APC_ROUTINE) (PVOID ApcContext,
-                                struct _IO_STATUS_BLOCK* IoStatusBlock,
-                                ULONG Reserved);
+typedef VOID STDCALL
+(*PDRIVER_REINITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
+                       PVOID Context,
+                       ULONG Count);
+
+typedef NTSTATUS STDCALL
+(*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
+                           PUNICODE_STRING Pathname,
+                           INTERFACE_TYPE BusType,
+                           ULONG BusNumber,
+                           PKEY_VALUE_FULL_INFORMATION* BI,
+                           CONFIGURATION_TYPE ControllerType,
+                           ULONG ControllerNumber,
+                           PKEY_VALUE_FULL_INFORMATION* CI,
+                           CONFIGURATION_TYPE PeripheralType,
+                           ULONG PeripheralNumber,
+                           PKEY_VALUE_FULL_INFORMATION* PI);
+
+typedef NTSTATUS STDCALL
+(*PIO_COMPLETION_ROUTINE)(struct _DEVICE_OBJECT* DeviceObject,
+                         struct _IRP* Irp,
+                         PVOID Context);
+
+typedef VOID STDCALL
+(*PIO_APC_ROUTINE)(PVOID ApcContext,
+                  struct _IO_STATUS_BLOCK* IoStatusBlock,
+                  ULONG Reserved);
 
 
 /* STRUCTURE TYPES ***********************************************************/
 
-typedef struct _ADAPTER_OBJECT
-{
-} ADAPTER_OBJECT, *PADAPTER_OBJECT;
+typedef struct _ADAPTER_OBJECT ADAPTER_OBJECT, *PADAPTER_OBJECT;
 
 /*
  * PURPOSE: Special timer associated with each device
@@ -106,131 +113,392 @@ typedef struct _IO_SECURITY_CONTEXT
    ULONG FullCreateOptions;
 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
 
-/*
- * PURPOSE: IRP stack location
- */
-typedef struct _IO_STACK_LOCATION
+
+typedef struct _IO_RESOURCE_DESCRIPTOR
 {
-   UCHAR MajorFunction;
-   UCHAR MinorFunction;   
-   UCHAR Flags;   
-   UCHAR Control;
+   UCHAR Option;
+   UCHAR Type;
+   UCHAR ShareDisposition;
+   
+   /*
+    * Reserved for system use
+    */
+   UCHAR Spare1;
+   
+   USHORT Flags;
+   
+   /*
+    * Reserved for system use
+    */
+   UCHAR Spare2;
    
    union
      {
-       struct
-         {
-            PIO_SECURITY_CONTEXT SecurityContext;
-            ULONG Options;
-            USHORT FileAttributes;
-            USHORT ShareAccess;
-            ULONG EaLength;
-         } Create;
        struct
          {
             ULONG Length;
-            ULONG Key;
-            LARGE_INTEGER ByteOffset;
-         } Read;
+            ULONG Alignment;
+            PHYSICAL_ADDRESS MinimumAddress;
+            PHYSICAL_ADDRESS MaximumAddress;
+         } Port;
        struct
          {
             ULONG Length;
-            ULONG Key;
-            LARGE_INTEGER ByteOffset;
-         } Write;
+            ULONG Alignment;
+            PHYSICAL_ADDRESS MinimumAddress;
+            PHYSICAL_ADDRESS MaximumAddress;
+         } Memory;
+       struct
+         { 
+            ULONG MinimumVector;
+            ULONG MaximumVector;
+         } Interrupt;
        struct
          {
-            ULONG OutputBufferLength;
-            ULONG InputBufferLength;
-            ULONG IoControlCode;
-            PVOID Type3InputBuffer;
-         } DeviceIoControl;
+            ULONG MinimumChannel;
+            ULONG MaximumChannel;
+         } Dma;
+     } u;
+} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
+
+// IO_RESOURCE_DESCRIPTOR Options
+#define IO_RESOURCE_REQUIRED    0x00
+#define IO_RESOURCE_PREFERRED   0x01
+#define IO_RESOURCE_DEFAULT     0x02
+#define IO_RESOURCE_ALTERNATIVE 0x08
+
+typedef struct _IO_RESOURCE_LIST
+{
+   USHORT Version;
+   USHORT Revision;
+   ULONG Count;
+   IO_RESOURCE_DESCRIPTOR Descriptors[1];
+} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
+
+typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
+{
+   /*
+    * List size in bytes
+    */
+   ULONG ListSize;
+   
+   /*
+    * System defined enum for the bus
+    */
+   INTERFACE_TYPE InterfaceType;
+   
+   ULONG BusNumber;
+   ULONG SlotNumber;
+   ULONG Reserved[3];
+   ULONG AlternativeLists;
+   IO_RESOURCE_LIST List[1];
+} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
+
+typedef struct
+{
+   UCHAR Type;
+   UCHAR ShareDisposition;
+   USHORT Flags;
+   union
+     {
        struct
          {
-            ULONG OutputBufferLength;
-            ULONG InputBufferLength;
-            ULONG IoControlCode;
-            PVOID Type3InputBuffer;
-         } FileSystemControl;
+            PHYSICAL_ADDRESS Start;
+            ULONG Length;
+         } __attribute__((packed)) Port;
        struct
          {
-            struct _VPB* Vpb;
-            struct _DEVICE_OBJECT* DeviceObject;
-         } Mount;
-        struct {
-            ULONG Length;
-            FILE_INFORMATION_CLASS FileInformationClass;
-        } QueryFile;
-        struct {
-            ULONG Length;
-            FS_INFORMATION_CLASS FileInformationClass;
-        } QueryVolume;
-        struct {
-            ULONG Length;
-            FS_INFORMATION_CLASS FileInformationClass;
-        } SetVolume;
-        struct {
-            ULONG Length;
-            FILE_INFORMATION_CLASS FileInformationClass;
-            struct _FILE_OBJECT* FileObject;
-            union {
-                struct {
-                    BOOLEAN ReplaceIfExists;
-                    BOOLEAN AdvanceOnly;
-                } d;
-                ULONG ClusterCount;
-                HANDLE DeleteHandle;
-            } u;
-        } SetFile;
+            ULONG Level;
+            ULONG Vector;
+            ULONG Affinity;
+         } __attribute__((packed))Interrupt;
        struct
          {
+            PHYSICAL_ADDRESS Start;
             ULONG Length;
-            PUNICODE_STRING FileName;
-            FILE_INFORMATION_CLASS FileInformationClass;
-            ULONG FileIndex;
-         } QueryDirectory;
-/*
+         } __attribute__((packed))Memory;
        struct
          {
-            ULONG CreateDisposition;
-            ULONG CreateOptions;
-            ULONG ShareAccess;
-            BOOLEAN WriteModeMessage;
-            BOOLEAN ReadModeMessage;
-            BOOLEAN NonBlocking;
-            ULONG MaxInstances;
-            ULONG InBufferSize;
-            ULONG OutBufferSize;
-            LARGE_INTEGER TimeOut;
-         } CreateNamedPipe;
-*/
-     } Parameters;
-   
-   struct _DEVICE_OBJECT* DeviceObject;
-   struct _FILE_OBJECT* FileObject;
+            ULONG Channel;
+            ULONG Port;
+            ULONG Reserved1;
+         } __attribute__((packed))Dma;
+       struct
+         {
+            ULONG DataSize;
+            ULONG Reserved1;
+            ULONG Reserved2;
+         } __attribute__((packed))DeviceSpecificData;
+     } __attribute__((packed)) u;
+} __attribute__((packed)) CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
+
+typedef struct
+{
+   USHORT Version;
+   USHORT Revision;
+   ULONG Count;
+   CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
+} __attribute__((packed))CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
+
+typedef struct
+{
+   INTERFACE_TYPE InterfaceType;
+   ULONG BusNumber;
+   CM_PARTIAL_RESOURCE_LIST PartialResourceList;
+} __attribute__((packed)) CM_FULL_RESOURCE_DESCRIPTOR;
+
+typedef struct
+{
+   ULONG Count;
+   CM_FULL_RESOURCE_DESCRIPTOR List[1];
+} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
+
+
+/*
+ * PURPOSE: IRP stack location
+ */
+typedef struct __attribute__((packed)) _IO_STACK_LOCATION
+{
+  UCHAR MajorFunction;
+  UCHAR MinorFunction;
+  UCHAR Flags;
+  UCHAR Control;
+  
+  union
+    {
+      struct
+       {
+         PIO_SECURITY_CONTEXT SecurityContext;
+         ULONG Options;
+         USHORT FileAttributes;
+         USHORT ShareAccess;
+         ULONG EaLength;
+       } Create;
+      struct
+       {
+         ULONG Length;
+         ULONG Key;
+         LARGE_INTEGER ByteOffset;
+       } Read;
+      struct
+       {
+         ULONG Length;
+         ULONG Key;
+         LARGE_INTEGER ByteOffset;
+       } Write;
+      struct
+       {
+         ULONG OutputBufferLength;
+         ULONG InputBufferLength;
+         ULONG IoControlCode;
+         PVOID Type3InputBuffer;
+       } DeviceIoControl;
+      struct
+       {
+         ULONG OutputBufferLength;
+         ULONG InputBufferLength;
+         ULONG IoControlCode;
+         PVOID Type3InputBuffer;
+       } FileSystemControl;
+      struct
+       {
+         struct _VPB* Vpb;
+         struct _DEVICE_OBJECT* DeviceObject;
+       } MountVolume;
+      struct
+       {
+         struct _VPB* Vpb;
+         struct _DEVICE_OBJECT* DeviceObject;
+       } VerifyVolume;
+      struct
+       {
+         ULONG Length;
+         FILE_INFORMATION_CLASS FileInformationClass;
+       } QueryFile;
+      struct
+       {
+         ULONG Length;
+         FS_INFORMATION_CLASS FsInformationClass;
+       } QueryVolume;
+      struct
+       {
+         ULONG Length;
+         FS_INFORMATION_CLASS FsInformationClass;
+       } SetVolume;
+      struct
+       {
+         ULONG Length;
+         FILE_INFORMATION_CLASS FileInformationClass;
+         struct _FILE_OBJECT* FileObject;
+         union
+           {
+             struct
+               {
+                 BOOLEAN ReplaceIfExists;
+                 BOOLEAN AdvanceOnly;
+               } d;
+             ULONG ClusterCount;
+             HANDLE DeleteHandle;
+           } u;
+       } SetFile;
+      struct
+       {
+         ULONG Length;
+         PUNICODE_STRING FileName;
+         FILE_INFORMATION_CLASS FileInformationClass;
+         ULONG FileIndex;
+       } QueryDirectory;
+
+      // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS
+      struct
+       {
+         DEVICE_RELATION_TYPE Type;
+       } QueryDeviceRelations;
+
+      // Parameters for IRP_MN_QUERY_INTERFACE
+      struct
+       {
+         CONST GUID *InterfaceType;
+         USHORT Size;
+         USHORT Version;
+         PINTERFACE Interface;
+         PVOID InterfaceSpecificData;
+       } QueryInterface;
+
+      // Parameters for IRP_MN_QUERY_CAPABILITIES
+      struct
+       {
+         PDEVICE_CAPABILITIES Capabilities;
+       } DeviceCapabilities;
+
+      // Parameters for IRP_MN_FILTER_RESOURCE_REQUIREMENTS
+      struct
+       {
+      PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
+    } FilterResourceRequirements;
+
+      // Parameters for IRP_MN_QUERY_ID
+      struct
+       {
+         BUS_QUERY_ID_TYPE IdType;
+       } QueryId;
+
+      // Parameters for IRP_MN_QUERY_DEVICE_TEXT
+      struct
+       {
+         DEVICE_TEXT_TYPE DeviceTextType;
+         LCID LocaleId;
+       } QueryDeviceText;
+
+      // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION
+      struct
+       {
+         BOOLEAN InPath;
+         BOOLEAN Reserved[3];
+         DEVICE_USAGE_NOTIFICATION_TYPE Type;
+       } UsageNotification;
+
+      // Parameters for IRP_MN_WAIT_WAKE
+      struct
+       {
+         SYSTEM_POWER_STATE PowerState;
+       } WaitWake;
+
+      // Parameter for IRP_MN_POWER_SEQUENCE
+      struct
+       {
+         PPOWER_SEQUENCE PowerSequence;
+       } PowerSequence;
+
+      // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER
+      struct
+       {
+         ULONG SystemContext;
+         POWER_STATE_TYPE Type;
+         POWER_STATE State;
+         POWER_ACTION ShutdownType;
+       } Power;
+
+      // Parameters for IRP_MN_START_DEVICE
+      struct
+       {
+         PCM_RESOURCE_LIST AllocatedResources;
+         PCM_RESOURCE_LIST AllocatedResourcesTranslated;
+       } StartDevice;
+
+      /* Parameters for IRP_MN_SCSI_CLASS */
+      struct
+       {
+         struct _SCSI_REQUEST_BLOCK *Srb;
+       } Scsi;
+
+         //byte range file locking
+         struct 
+       {
+      PLARGE_INTEGER Length;
+      ULONG Key;
+      LARGE_INTEGER ByteOffset;
+    } LockControl;
+
+      /* Paramters for other calls */
+      struct
+       {
+         PVOID Argument1;
+         PVOID Argument2;
+         PVOID Argument3;
+         PVOID Argument4;
+       } Others;
+    } Parameters;
+  
+  struct _DEVICE_OBJECT* DeviceObject;
+  struct _FILE_OBJECT* FileObject;
+
+  PIO_COMPLETION_ROUTINE CompletionRoutine;
+  PVOID CompletionContext;
+
+} __attribute__((packed)) IO_STACK_LOCATION, *PIO_STACK_LOCATION;
 
-   PIO_COMPLETION_ROUTINE CompletionRoutine;
-   PVOID CompletionContext;
-   
-} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
 
 typedef struct _IO_STATUS_BLOCK
 {
-   NTSTATUS Status;
-   ULONG Information;
+  NTSTATUS Status;
+  ULONG Information;
 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
 
+
+typedef struct _IO_PIPE_CREATE_BUFFER
+{
+   BOOLEAN WriteModeMessage;
+   BOOLEAN ReadModeMessage;
+   BOOLEAN NonBlocking;
+   ULONG MaxInstances;
+   ULONG InBufferSize;
+   ULONG OutBufferSize;
+   LARGE_INTEGER TimeOut;
+} IO_PIPE_CREATE_BUFFER, *PIO_PIPE_CREATE_BUFFER;
+
+
+typedef struct _IO_MAILSLOT_CREATE_BUFFER
+{
+   ULONG Param; /* ?? */
+   ULONG MaxMessageSize;
+   LARGE_INTEGER TimeOut;
+} IO_MAILSLOT_CREATE_BUFFER, *PIO_MAILSLOT_CREATE_BUFFER;
+
+
 /*
  * Driver entry point declaration
  */
-typedef NTSTATUS (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
-                                      PUNICODE_STRING RegistryPath);
+typedef NTSTATUS STDCALL
+(*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
+                     PUNICODE_STRING RegistryPath);
 
 /*
  * Driver cancel declaration
  */
-typedef NTSTATUS (*PDRIVER_CANCEL)(struct _DEVICE_OBJECT* DeviceObject,
-                                  struct _IRP* RegistryPath);
+typedef NTSTATUS STDCALL
+(*PDRIVER_CANCEL)(struct _DEVICE_OBJECT* DeviceObject,
+                 struct _IRP* RegistryPath);
 
 
 typedef struct _SECTION_OBJECT_POINTERS
@@ -270,7 +538,7 @@ typedef struct _IO_COMPLETION_CONTEXT
 /*
  * ReactOS specific flags
  */
-#define FO_DIRECT_CACHE_READ            0x72000001 
+#define FO_DIRECT_CACHE_READ            0x72000001
 #define FO_DIRECT_CACHE_WRITE           0x72000002
 #define FO_DIRECT_CACHE_PAGING_READ     0x72000004
 #define FO_DIRECT_CACHE_PAGING_WRITE    0x72000008
@@ -281,7 +549,7 @@ typedef struct _FILE_OBJECT
    CSHORT Type;
    CSHORT Size;
    struct _DEVICE_OBJECT* DeviceObject;
-   struct _VPB* Vpb;   
+   struct _VPB* Vpb;
    PVOID FsContext;
    PVOID FsContext2;
    PSECTION_OBJECT_POINTERS SectionObjectPointers;
@@ -347,13 +615,16 @@ typedef struct _IRP
      {
        struct
          {
-            KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
+            union {
+              KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
+              PVOID DriverContext[4];
+            };
             struct _ETHREAD* Thread;
             PCHAR AuxiliaryBuffer;
             LIST_ENTRY ListEntry;
             struct _IO_STACK_LOCATION* CurrentStackLocation;
             PFILE_OBJECT OriginalFileObject;
-         } Overlay;      
+         } Overlay;
        KAPC Apc;
        ULONG CompletionKey;
      } Tail;
@@ -398,7 +669,7 @@ typedef struct _DEVICE_OBJECT
    union
      {
        LIST_ENTRY ListHead;
-       WAIT_CONTEXT_BLOCK Wcb; 
+       WAIT_CONTEXT_BLOCK Wcb;
      } Queue;
    ULONG AlignmentRequirement;
    KDEVICE_QUEUE DeviceQueue;
@@ -412,27 +683,21 @@ typedef struct _DEVICE_OBJECT
    PVOID Reserved;
 } DEVICE_OBJECT, *PDEVICE_OBJECT;
 
-/*
- * Dispatch routine type declaration
- */
-typedef NTSTATUS STDCALL (*PDRIVER_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
-
 
 /*
  * Fast i/o routine type declaration
  */
 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
 //FIXME : this type is ok for read and write, but not for all routines
-typedef BOOLEAN STDCALL (*PFAST_IO_ROUTINE) (
-   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 STDCALL
+(*PFAST_IO_ROUTINE)(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 struct _FAST_IO_DISPATCH {
    ULONG SizeOfFastIoDispatch;
@@ -468,12 +733,30 @@ typedef struct _FAST_IO_DISPATCH {
 /*
  * Dispatch routine type declaration
  */
-typedef VOID STDCALL (*PDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
+typedef NTSTATUS STDCALL
+(*PDRIVER_DISPATCH)(IN struct _DEVICE_OBJECT *DeviceObject,
+                  IN struct _IRP *Irp);
 
 /*
- * Dispatch routine type declaration
+ * StartIo routine type declaration
+ */
+typedef VOID STDCALL
+(*PDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject,
+                  IN PIRP Irp);
+
+/*
+ * Unload routine type declaration
  */
-typedef NTSTATUS (*PDRIVER_UNLOAD)(struct _DRIVER_OBJECT*);
+typedef VOID STDCALL
+(*PDRIVER_UNLOAD)(IN struct _DRIVER_OBJECT *DriverObject);
+
+/*
+ * AddDevice routine type declaration
+ */
+typedef NTSTATUS STDCALL
+(*PDRIVER_ADD_DEVICE)(IN struct _DRIVER_OBJECT *DriverObject,
+                     IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
+
 
 typedef struct _DRIVER_EXTENSION
 {
@@ -489,7 +772,7 @@ struct _FAST_IO_DISPATCH_TABLE
 {
        ULONG                   Count;
        PFAST_IO_DISPATCH       Dispatch;
-       
+
 } FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE;
 #endif
 
@@ -530,13 +813,18 @@ typedef struct _CONFIGURATION_INFORMATION
    BOOLEAN AtDiskSecondaryAddressClaimed;
 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
 
-typedef VOID (*PIO_DPC_ROUTINE)(PKDPC Dpc,
-                               PDEVICE_OBJECT DeviceObject,
-                               PIRP Irp,
-                               PVOID Context);
+typedef VOID STDCALL
+(*PIO_DPC_ROUTINE)(PKDPC Dpc,
+                  PDEVICE_OBJECT DeviceObject,
+                  PIRP Irp,
+                  PVOID Context);
 
-typedef VOID (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
-                                 PVOID Context);
+typedef VOID STDCALL
+(*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
+                    PVOID Context);
+
+typedef struct _IO_WORKITEM *PIO_WORKITEM;
+typedef VOID (*PIO_WORKITEM_ROUTINE)(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context);
 
 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
 typedef struct _PARTITION_INFORMATION
@@ -560,158 +848,15 @@ typedef struct _DRIVER_LAYOUT_INFORMATION
 } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
 
 
-
-
-
-typedef struct _IO_RESOURCE_DESCRIPTOR
-{
-   UCHAR Option;
-   UCHAR Type;
-   UCHAR SharedDisposition;
-   
-   /*
-    * Reserved for system use
-    */
-   UCHAR Spare1;             
-   
-   USHORT Flags;
-   
-   /*
-    * Reserved for system use
-    */
-   UCHAR Spare2;
-   
-   union
-     {
-       struct
-         {
-            ULONG Length;
-            ULONG Alignment;
-            PHYSICAL_ADDRESS MinimumAddress;
-            PHYSICAL_ADDRESS MaximumAddress;
-         } Port;
-       struct
-         {
-            ULONG Length;
-            ULONG Alignment;
-            PHYSICAL_ADDRESS MinimumAddress;
-            PHYSICAL_ADDRESS MaximumAddress;
-         } Memory;
-       struct
-         { 
-            ULONG MinimumVector;
-            ULONG MaximumVector;
-         } Interrupt;
-       struct
-         {
-            ULONG MinimumChannel;
-            ULONG MaximumChannel;
-         } Dma;
-     } u;     
-} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
-
-typedef struct _IO_RESOURCE_LIST
-{
-   USHORT Version;
-   USHORT Revision;
-   ULONG Count;
-   IO_RESOURCE_DESCRIPTOR Descriptors[1];
-} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
-
-typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
-{
-   /*
-    * List size in bytes
-    */
-   ULONG ListSize;
-   
-   /*
-    * System defined enum for the bus
-    */
-   INTERFACE_TYPE InterfaceType;
-   
-   ULONG BusNumber;
-   ULONG SlotNumber;
-   ULONG Reserved[3];
-   ULONG AlternativeLists;
-   IO_RESOURCE_LIST List[1];   
-} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
-
-typedef struct
-{
-   UCHAR Type;
-   UCHAR ShareDisposition;
-   USHORT Flags;
-   union
-     {
-       struct
-         {
-            PHYSICAL_ADDRESS Start;
-            ULONG Length;
-         } Port;
-       struct
-         {
-            ULONG Level;
-            ULONG Vector;
-            ULONG Affinity;
-         } Interrupt;
-       struct
-         {
-            PHYSICAL_ADDRESS Start;
-            ULONG Length;
-         } Memory;
-       struct
-         {
-            ULONG Channel;
-            ULONG Port;
-            ULONG Reserved1;
-         } Dma;
-       struct
-         {
-            ULONG DataSize;
-            ULONG Reserved1;
-            ULONG Reserved2;
-         } DeviceSpecificData;
-     } u;
-} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
-
-typedef struct
-{
-   USHORT Version;
-   USHORT Revision;
-   ULONG Count;
-   CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
-} CM_PARTIAL_RESOURCE_LIST;
-
-typedef struct
-{
-   INTERFACE_TYPE InterfaceType;
-   ULONG BusNumber;
-   CM_PARTIAL_RESOURCE_LIST PartialResourceList;
-} CM_FULL_RESOURCE_DESCRIPTOR;
-
-typedef struct
-{
-   ULONG Count;
-   CM_FULL_RESOURCE_DESCRIPTOR List[1];
-} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
-
-
-typedef
-IO_ALLOCATION_ACTION
-(*PDRIVER_CONTROL) (
-       PDEVICE_OBJECT  DeviceObject,
-       PIRP            irp,
-       PVOID           MapRegisterBase,
-       PVOID           Context
-       );
+typedef IO_ALLOCATION_ACTION STDCALL
+(*PDRIVER_CONTROL)(PDEVICE_OBJECT DeviceObject,
+                  PIRP Irp,
+                  PVOID MapRegisterBase,
+                  PVOID Context);
 #if (_WIN32_WINNT >= 0x0400)
-typedef
-VOID
-(*PFSDNOTIFICATIONPROC) (
-       IN      PDEVICE_OBJECT  PtrTargetFileSystemDeviceObject,
-       IN      BOOLEAN         DriverActive
-       );
+typedef VOID STDCALL
+(*PFSDNOTIFICATIONPROC)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject,
+                       IN BOOLEAN DriverActive);
 #endif // (_WIN32_WINNT >= 0x0400)
 
-#endif __INCLUDE_DDK_IOTYPES_H
+#endif /* __INCLUDE_DDK_IOTYPES_H */