-/* $Id: iotypes.h,v 1.32 2002/01/21 22:28:45 hbirr Exp $
- *
+/* $Id: iotypes.h,v 1.42 2002/10/03 19:26:47 robd Exp $
+ *
*/
#ifndef __INCLUDE_DDK_IOTYPES_H
struct _DEVICE_OBJECT;
struct _IRP;
struct _IO_STATUS_BLOCK;
+struct _SCSI_REQUEST_BLOCK;
/* SIMPLE TYPES *************************************************************/
ULONG MinimumChannel;
ULONG MaximumChannel;
} Dma;
- } u;
+ } u;
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
// IO_RESOURCE_DESCRIPTOR Options
{
PHYSICAL_ADDRESS Start;
ULONG Length;
- } Port;
+ } __attribute__((packed)) Port;
struct
{
ULONG Level;
ULONG Vector;
ULONG Affinity;
- } Interrupt;
+ } __attribute__((packed))Interrupt;
struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
- } Memory;
+ } __attribute__((packed))Memory;
struct
{
ULONG Channel;
ULONG Port;
ULONG Reserved1;
- } Dma;
+ } __attribute__((packed))Dma;
struct
{
ULONG DataSize;
ULONG Reserved1;
ULONG Reserved2;
- } DeviceSpecificData;
- } u;
-} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
+ } __attribute__((packed))DeviceSpecificData;
+ } __attribute__((packed)) u;
+} __attribute__((packed)) CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
typedef struct
{
USHORT Revision;
ULONG Count;
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
-} CM_PARTIAL_RESOURCE_LIST;
+} __attribute__((packed))CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
typedef struct
{
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
-} CM_FULL_RESOURCE_DESCRIPTOR;
+} __attribute__((packed)) CM_FULL_RESOURCE_DESCRIPTOR;
typedef struct
{
*/
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;
- } Mount;
- 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_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;
-
- struct _DEVICE_OBJECT* DeviceObject;
- struct _FILE_OBJECT* FileObject;
-
- PIO_COMPLETION_ROUTINE CompletionRoutine;
- PVOID CompletionContext;
-
+ 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;
+
+ /* 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;
+
typedef struct _IO_STATUS_BLOCK
{
- NTSTATUS Status;
- ULONG Information;
+ NTSTATUS Status;
+ ULONG Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
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
/*
* Dispatch routine type declaration
*/
+typedef NTSTATUS STDCALL
+(*PDRIVER_DISPATCH)(IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp);
+
+/*
+ * StartIo routine type declaration
+ */
typedef VOID STDCALL
(*PDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/*
- * Dispatch routine type declaration
+ * Unload routine type declaration
*/
-typedef NTSTATUS STDCALL
-(*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);
{
ULONG Count;
PFAST_IO_DISPATCH Dispatch;
-
+
} FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE;
#endif