1 /* $Id: iotypes.h,v 1.69 2004/11/06 04:12:59 ion Exp $
5 #ifndef __INCLUDE_DDK_IOTYPES_H
6 #define __INCLUDE_DDK_IOTYPES_H
8 #include <ntos/obtypes.h>
10 #include <ntos/file.h>
15 #define POINTER_ALIGNMENT
19 * These are referenced before they can be fully defined
21 struct _DRIVER_OBJECT
;
23 struct _DEVICE_OBJECT
;
25 struct _IO_STATUS_BLOCK
;
26 struct _SCSI_REQUEST_BLOCK
;
29 /* SIMPLE TYPES *************************************************************/
35 DeallocateObjectKeepRegisters
39 typedef enum _CREATE_FILE_TYPE
42 CreateFileTypeNamedPipe
,
43 CreateFileTypeMailslot
47 typedef struct _SHARE_ACCESS
56 } SHARE_ACCESS
, *PSHARE_ACCESS
;
58 /* FUNCTION TYPES ************************************************************/
60 typedef VOID STDCALL_FUNC
61 (*PDRIVER_REINITIALIZE
)(struct _DRIVER_OBJECT
* DriverObject
,
65 typedef NTSTATUS STDCALL_FUNC
66 (*PIO_QUERY_DEVICE_ROUTINE
)(PVOID Context
,
67 PUNICODE_STRING Pathname
,
68 INTERFACE_TYPE BusType
,
70 PKEY_VALUE_FULL_INFORMATION
* BI
,
71 CONFIGURATION_TYPE ControllerType
,
72 ULONG ControllerNumber
,
73 PKEY_VALUE_FULL_INFORMATION
* CI
,
74 CONFIGURATION_TYPE PeripheralType
,
75 ULONG PeripheralNumber
,
76 PKEY_VALUE_FULL_INFORMATION
* PI
);
78 typedef NTSTATUS STDCALL_FUNC
79 (*PIO_COMPLETION_ROUTINE
)(struct _DEVICE_OBJECT
* DeviceObject
,
83 typedef VOID STDCALL_FUNC
84 (*PIO_APC_ROUTINE
)(PVOID ApcContext
,
85 struct _IO_STATUS_BLOCK
* IoStatusBlock
,
89 /* STRUCTURE TYPES ***********************************************************/
91 typedef struct _ADAPTER_OBJECT ADAPTER_OBJECT
, *PADAPTER_OBJECT
;
93 typedef struct _IO_SECURITY_CONTEXT
95 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
96 PACCESS_STATE AccessState
;
97 ACCESS_MASK DesiredAccess
;
98 ULONG FullCreateOptions
;
99 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
102 typedef struct _IO_RESOURCE_DESCRIPTOR
106 UCHAR ShareDisposition
;
109 * Reserved for system use
116 * Reserved for system use
126 PHYSICAL_ADDRESS MinimumAddress
;
127 PHYSICAL_ADDRESS MaximumAddress
;
133 PHYSICAL_ADDRESS MinimumAddress
;
134 PHYSICAL_ADDRESS MaximumAddress
;
143 ULONG MinimumChannel
;
144 ULONG MaximumChannel
;
147 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
149 // IO_RESOURCE_DESCRIPTOR Options
150 #define IO_RESOURCE_REQUIRED 0x00
151 #define IO_RESOURCE_PREFERRED 0x01
152 #define IO_RESOURCE_DEFAULT 0x02
153 #define IO_RESOURCE_ALTERNATIVE 0x08
155 typedef struct _IO_RESOURCE_LIST
160 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
161 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
163 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
171 * System defined enum for the bus
173 INTERFACE_TYPE InterfaceType
;
178 ULONG AlternativeLists
;
179 IO_RESOURCE_LIST List
[1];
180 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
183 /* MicroChannel bus data */
185 typedef struct _CM_MCA_POS_DATA
192 } CM_MCA_POS_DATA
, *PCM_MCA_POS_DATA
;
195 /* Int13 drive geometry data */
197 typedef struct _CM_INT13_DRIVE_PARAMETER
201 USHORT SectorsPerTrack
;
204 } CM_INT13_DRIVE_PARAMETER
, *PCM_INT13_DRIVE_PARAMETER
;
207 /* Extended drive geometry data */
209 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
211 ULONG BytesPerSector
;
212 ULONG NumberOfCylinders
;
213 ULONG SectorsPerTrack
;
215 } CM_DISK_GEOMETRY_DEVICE_DATA
, *PCM_DISK_GEOMETRY_DEVICE_DATA
;
218 #include <pshpack1.h>
223 UCHAR ShareDisposition
;
229 PHYSICAL_ADDRESS Start
;
234 PHYSICAL_ADDRESS Start
;
245 PHYSICAL_ADDRESS Start
;
259 } DeviceSpecificData
;
261 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
268 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
269 } CM_PARTIAL_RESOURCE_LIST
, *PCM_PARTIAL_RESOURCE_LIST
;
273 INTERFACE_TYPE InterfaceType
;
275 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
276 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
281 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
282 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
288 * PURPOSE: IRP stack location
292 typedef struct _IO_STACK_LOCATION
303 PIO_SECURITY_CONTEXT SecurityContext;
305 USHORT FileAttributes;
313 LARGE_INTEGER ByteOffset;
319 LARGE_INTEGER ByteOffset;
323 ULONG OutputBufferLength;
324 ULONG InputBufferLength;
326 PVOID Type3InputBuffer;
330 ULONG OutputBufferLength;
331 ULONG InputBufferLength;
333 PVOID Type3InputBuffer;
338 struct _DEVICE_OBJECT* DeviceObject;
343 struct _DEVICE_OBJECT* DeviceObject;
348 FILE_INFORMATION_CLASS FileInformationClass;
353 FS_INFORMATION_CLASS FsInformationClass;
358 FS_INFORMATION_CLASS FsInformationClass;
363 FILE_INFORMATION_CLASS FileInformationClass;
364 struct _FILE_OBJECT* FileObject;
369 BOOLEAN ReplaceIfExists;
379 PUNICODE_STRING FileName;
380 FILE_INFORMATION_CLASS FileInformationClass;
384 // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS
387 DEVICE_RELATION_TYPE Type;
388 } QueryDeviceRelations;
390 // Parameters for IRP_MN_QUERY_INTERFACE
393 CONST GUID *InterfaceType;
396 PINTERFACE Interface;
397 PVOID InterfaceSpecificData;
400 // Parameters for IRP_MN_QUERY_CAPABILITIES
403 PDEVICE_CAPABILITIES Capabilities;
404 } DeviceCapabilities;
406 // Parameters for IRP_MN_FILTER_RESOURCE_REQUIREMENTS
409 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
410 } FilterResourceRequirements;
412 // Parameters for IRP_MN_QUERY_ID
415 BUS_QUERY_ID_TYPE IdType;
418 // Parameters for IRP_MN_QUERY_DEVICE_TEXT
421 DEVICE_TEXT_TYPE DeviceTextType;
425 // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION
430 DEVICE_USAGE_NOTIFICATION_TYPE Type;
433 // Parameters for IRP_MN_WAIT_WAKE
436 SYSTEM_POWER_STATE PowerState;
439 // Parameter for IRP_MN_POWER_SEQUENCE
442 PPOWER_SEQUENCE PowerSequence;
445 // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER
449 POWER_STATE_TYPE Type;
451 POWER_ACTION ShutdownType;
454 // Parameters for IRP_MN_START_DEVICE
457 PCM_RESOURCE_LIST AllocatedResources;
458 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
461 /* Parameters for IRP_MN_SCSI_CLASS */
464 struct _SCSI_REQUEST_BLOCK *Srb;
467 //byte range file locking
470 PLARGE_INTEGER Length;
472 LARGE_INTEGER ByteOffset;
475 /* Paramters for other calls */
485 struct _DEVICE_OBJECT* DeviceObject;
486 struct _FILE_OBJECT* FileObject;
488 PIO_COMPLETION_ROUTINE CompletionRoutine;
489 PVOID CompletionContext;
491 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;*/
493 typedef struct _IO_STACK_LOCATION
{
500 PIO_SECURITY_CONTEXT SecurityContext
;
502 USHORT POINTER_ALIGNMENT FileAttributes
;
504 ULONG POINTER_ALIGNMENT EaLength
;
508 ULONG POINTER_ALIGNMENT Key
;
509 LARGE_INTEGER ByteOffset
;
513 ULONG POINTER_ALIGNMENT Key
;
514 LARGE_INTEGER ByteOffset
;
518 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
522 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
523 struct _FILE_OBJECT
* FileObject
;
526 BOOLEAN ReplaceIfExists
;
535 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
538 ULONG OutputBufferLength
;
539 ULONG POINTER_ALIGNMENT InputBufferLength
;
540 ULONG POINTER_ALIGNMENT IoControlCode
;
541 PVOID Type3InputBuffer
;
544 SECURITY_INFORMATION SecurityInformation
;
545 ULONG POINTER_ALIGNMENT Length
;
548 SECURITY_INFORMATION SecurityInformation
;
549 PSECURITY_DESCRIPTOR SecurityDescriptor
;
553 struct _DEVICE_OBJECT
* DeviceObject
;
557 struct _DEVICE_OBJECT
* DeviceObject
;
560 struct _SCSI_REQUEST_BLOCK
*Srb
;
563 DEVICE_RELATION_TYPE Type
;
564 } QueryDeviceRelations
;
566 CONST GUID
*InterfaceType
;
569 PINTERFACE Interface
;
570 PVOID InterfaceSpecificData
;
573 PDEVICE_CAPABILITIES Capabilities
;
574 } DeviceCapabilities
;
576 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
577 } FilterResourceRequirements
;
582 ULONG POINTER_ALIGNMENT Length
;
588 BUS_QUERY_ID_TYPE IdType
;
591 DEVICE_TEXT_TYPE DeviceTextType
;
592 LCID POINTER_ALIGNMENT LocaleId
;
597 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
600 SYSTEM_POWER_STATE PowerState
;
603 PPOWER_SEQUENCE PowerSequence
;
607 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
608 POWER_STATE POINTER_ALIGNMENT State
;
609 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
612 PCM_RESOURCE_LIST AllocatedResources
;
613 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
616 ULONG_PTR ProviderId
;
628 struct _DEVICE_OBJECT
* DeviceObject
;
629 struct _FILE_OBJECT
* FileObject
;
630 PIO_COMPLETION_ROUTINE CompletionRoutine
;
632 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
634 // AG: The commented lines in this structure are due to PMAILSLOT_CREATE_PARAMETERS
635 // and PNAMED_PIPE_CREATE_PARAMETERS and PFILE_GET_QUOTA_INFORMATION not being
638 typedef struct _EXTENDED_IO_STACK_LOCATION
{
640 /* Included for padding */
649 // PIO_SECURITY_CONTEXT SecurityContext;
652 // USHORT ShareAccess;
653 // PMAILSLOT_CREATE_PARAMETERS Parameters;
657 // PIO_SECURITY_CONTEXT SecurityContext;
660 // USHORT ShareAccess;
661 // PNAMED_PIPE_CREATE_PARAMETERS Parameters;
665 ULONG OutputBufferLength
;
666 ULONG InputBufferLength
;
668 PVOID Type3InputBuffer
;
672 PLARGE_INTEGER Length
;
674 LARGE_INTEGER ByteOffset
;
679 ULONG CompletionFilter
;
684 PUNICODE_STRING FileName
;
685 FILE_INFORMATION_CLASS FileInformationClass
;
699 // PFILE_GET_QUOTA_INFORMATION SidList;
700 // ULONG SidListLength;
713 FS_INFORMATION_CLASS FsInformationClass
;
717 struct _DEVICE_OBJECT
* DeviceObject
;
718 struct _FILE_OBJECT
* FileObject
;
719 PIO_COMPLETION_ROUTINE CompletionRoutine
;
722 } EXTENDED_IO_STACK_LOCATION
, *PEXTENDED_IO_STACK_LOCATION
;
724 typedef struct _IO_STATUS_BLOCK
728 } IO_STATUS_BLOCK
, *PIO_STATUS_BLOCK
;
731 * Driver entry point declaration
733 typedef NTSTATUS STDCALL_FUNC
734 (*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
* DriverObject
,
735 PUNICODE_STRING RegistryPath
);
738 * Driver cancel declaration
740 typedef NTSTATUS STDCALL_FUNC
741 (*PDRIVER_CANCEL
)(struct _DEVICE_OBJECT
* DeviceObject
,
742 struct _IRP
* RegistryPath
);
745 typedef struct _SECTION_OBJECT_POINTERS
747 PVOID DataSectionObject
;
748 PVOID SharedCacheMap
;
749 PVOID ImageSectionObject
;
750 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
752 typedef struct _IO_COMPLETION_CONTEXT
756 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
758 #define FO_FILE_OPEN 0x00000001
759 #define FO_SYNCHRONOUS_IO 0x00000002
760 #define FO_ALERTABLE_IO 0x00000004
761 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
762 #define FO_WRITE_THROUGH 0x00000010
763 #define FO_SEQUENTIAL_ONLY 0x00000020
764 #define FO_CACHE_SUPPORTED 0x00000040
765 #define FO_NAMED_PIPE 0x00000080
766 #define FO_STREAM_FILE 0x00000100
767 #define FO_MAILSLOT 0x00000200
768 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
769 #define FO_DIRECT_DEVICE_OPEN 0x00000800
770 #define FO_FILE_MODIFIED 0x00001000
771 #define FO_FILE_SIZE_CHANGED 0x00002000
772 #define FO_CLEANUP_COMPLETE 0x00004000
773 #define FO_TEMPORARY_FILE 0x00008000
774 #define FO_DELETE_ON_CLOSE 0x00010000
775 #define FO_OPENED_CASE_SENSITIVE 0x00020000
776 #define FO_HANDLE_CREATED 0x00040000
777 #define FO_FILE_FAST_IO_READ 0x00080000
780 * ReactOS specific flags
782 #define FO_DIRECT_CACHE_READ 0x72000001
783 #define FO_DIRECT_CACHE_WRITE 0x72000002
784 #define FO_DIRECT_CACHE_PAGING_READ 0x72000004
785 #define FO_DIRECT_CACHE_PAGING_WRITE 0x72000008
786 #define FO_FCB_IS_VALID 0x72000010
788 typedef struct _FILE_OBJECT
792 struct _DEVICE_OBJECT
* DeviceObject
;
796 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
797 PVOID PrivateCacheMap
;
798 NTSTATUS FinalStatus
;
799 struct _FILE_OBJECT
* RelatedFileObject
;
800 BOOLEAN LockOperation
;
801 BOOLEAN DeletePending
;
804 BOOLEAN DeleteAccess
;
807 BOOLEAN SharedDelete
;
809 UNICODE_STRING FileName
;
810 LARGE_INTEGER CurrentByteOffset
;
816 PIO_COMPLETION_CONTEXT CompletionContext
;
817 } FILE_OBJECT
, *PFILE_OBJECT
;
828 struct _IRP
* MasterIrp
;
832 LIST_ENTRY ThreadListEntry
;
833 IO_STATUS_BLOCK IoStatus
;
834 KPROCESSOR_MODE RequestorMode
;
835 BOOLEAN PendingReturned
;
837 CHAR CurrentLocation
;
840 CCHAR ApcEnvironment
;// CCHAR or PVOID?
841 UCHAR AllocationFlags
;//UCHAR or ULONG?
842 PIO_STATUS_BLOCK UserIosb
;
848 PIO_APC_ROUTINE UserApcRoutine
;
849 PVOID UserApcContext
;
850 } AsynchronousParameters
;
851 LARGE_INTEGER AllocationSize
;
853 PDRIVER_CANCEL CancelRoutine
;
860 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
861 PVOID DriverContext
[4];
863 struct _ETHREAD
* Thread
;
864 PCHAR AuxiliaryBuffer
;
865 LIST_ENTRY ListEntry
;
866 struct _IO_STACK_LOCATION
* CurrentStackLocation
;
867 PFILE_OBJECT OriginalFileObject
;
874 #define VPB_MOUNTED 0x00000001
875 #define VPB_LOCKED 0x00000002
876 #define VPB_PERSISTENT 0x00000004
877 #define VPB_REMOVE_PENDING 0x00000008
884 USHORT VolumeLabelLength
;
885 struct _DEVICE_OBJECT
* DeviceObject
;
886 struct _DEVICE_OBJECT
* RealDevice
;
888 ULONG ReferenceCount
;
889 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
];
893 typedef struct _DEVICE_OBJECT
898 struct _DRIVER_OBJECT
* DriverObject
;
899 struct _DEVICE_OBJECT
* NextDevice
;
900 struct _DEVICE_OBJECT
* AttachedDevice
;
901 struct _IRP
* CurrentIrp
;
902 struct _IO_TIMER
*Timer
;
904 ULONG Characteristics
;
906 PVOID DeviceExtension
;
907 DEVICE_TYPE DeviceType
;
912 WAIT_CONTEXT_BLOCK Wcb
;
914 ULONG AlignmentRequirement
;
915 KDEVICE_QUEUE DeviceQueue
;
917 ULONG ActiveThreadCount
;
918 PSECURITY_DESCRIPTOR SecurityDescriptor
;
922 struct _DEVOBJ_EXTENSION
* DeviceObjectExtension
;
924 } DEVICE_OBJECT
, *PDEVICE_OBJECT
;
928 * Fast i/o routine type declaration
930 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
931 //FIXME : this type is ok for read and write, but not for all routines
932 typedef BOOLEAN STDCALL_FUNC
933 (*PFAST_IO_ROUTINE
)(IN
struct _FILE_OBJECT
*FileObject
,
934 IN PLARGE_INTEGER FileOffset
,
939 OUT PIO_STATUS_BLOCK IoStatus
,
940 IN
struct _DEVICE_OBJECT
*DeviceObject
);
942 typedef struct _FAST_IO_DISPATCH
{
943 ULONG SizeOfFastIoDispatch
;
944 PFAST_IO_ROUTINE FastIoCheckIfPossible
;
945 PFAST_IO_ROUTINE FastIoRead
;
946 PFAST_IO_ROUTINE FastIoWrite
;
947 PFAST_IO_ROUTINE FastIoQueryBasicInfo
;
948 PFAST_IO_ROUTINE FastIoQueryStandardInfo
;
949 PFAST_IO_ROUTINE FastIoLock
;
950 PFAST_IO_ROUTINE FastIoUnlockSingle
;
951 PFAST_IO_ROUTINE FastIoUnlockAll
;
952 PFAST_IO_ROUTINE FastIoUnlockAllByKey
;
953 PFAST_IO_ROUTINE FastIoDeviceControl
;
954 PFAST_IO_ROUTINE AcquireFileForNtCreateSection
;
955 PFAST_IO_ROUTINE ReleaseFileForNtCreateSection
;
956 PFAST_IO_ROUTINE FastIoDetachDevice
;
957 PFAST_IO_ROUTINE FastIoQueryNetworkOpenInfo
;
958 PFAST_IO_ROUTINE AcquireForModWrite
;
959 PFAST_IO_ROUTINE MdlRead
;
960 PFAST_IO_ROUTINE MdlReadComplete
;
961 PFAST_IO_ROUTINE PrepareMdlWrite
;
962 PFAST_IO_ROUTINE MdlWriteComplete
;
963 PFAST_IO_ROUTINE FastIoReadCompressed
;
964 PFAST_IO_ROUTINE FastIoWriteCompressed
;
965 PFAST_IO_ROUTINE MdlReadCompleteCompressed
;
966 PFAST_IO_ROUTINE MdlWriteCompleteCompressed
;
967 PFAST_IO_ROUTINE FastIoQueryOpen
;
968 PFAST_IO_ROUTINE ReleaseForModWrite
;
969 PFAST_IO_ROUTINE AcquireForCcFlush
;
970 PFAST_IO_ROUTINE ReleaseForCcFlush
;
971 } FAST_IO_DISPATCH
, *PFAST_IO_DISPATCH
;
974 * Dispatch routine type declaration
976 typedef NTSTATUS STDCALL_FUNC
977 (*PDRIVER_DISPATCH
)(IN
struct _DEVICE_OBJECT
*DeviceObject
,
978 IN
struct _IRP
*Irp
);
981 * StartIo routine type declaration
983 typedef VOID STDCALL_FUNC
984 (*PDRIVER_STARTIO
)(IN PDEVICE_OBJECT DeviceObject
,
988 * Unload routine type declaration
990 typedef VOID STDCALL_FUNC
991 (*PDRIVER_UNLOAD
)(IN
struct _DRIVER_OBJECT
*DriverObject
);
994 * AddDevice routine type declaration
996 typedef NTSTATUS STDCALL_FUNC
997 (*PDRIVER_ADD_DEVICE
)(IN
struct _DRIVER_OBJECT
*DriverObject
,
998 IN
struct _DEVICE_OBJECT
*PhysicalDeviceObject
);
1001 typedef struct _DRIVER_EXTENSION
1003 struct _DRIVER_OBJECT
* DriverObject
;
1004 PDRIVER_ADD_DEVICE AddDevice
;
1006 UNICODE_STRING ServiceKeyName
;
1007 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
1011 struct _FAST_IO_DISPATCH_TABLE
1014 PFAST_IO_DISPATCH Dispatch
;
1016 } FAST_IO_DISPATCH_TABLE
, * PFAST_IO_DISPATCH_TABLE
;
1019 typedef struct _DRIVER_OBJECT
1023 PDEVICE_OBJECT DeviceObject
;
1027 PVOID DriverSection
;
1028 PDRIVER_EXTENSION DriverExtension
;
1029 UNICODE_STRING DriverName
;
1030 PUNICODE_STRING HardwareDatabase
;
1032 PFAST_IO_DISPATCH_TABLE FastIoDispatch
;
1034 PFAST_IO_DISPATCH FastIoDispatch
;
1036 PDRIVER_INITIALIZE DriverInit
;
1037 PDRIVER_STARTIO DriverStartIo
;
1038 PDRIVER_UNLOAD DriverUnload
;
1039 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
1040 } DRIVER_OBJECT
, *PDRIVER_OBJECT
;
1043 typedef struct _CONFIGURATION_INFORMATION
1049 ULONG ScsiPortCount
;
1051 ULONG ParallelCount
;
1052 BOOLEAN AtDiskPrimaryAddressClaimed
;
1053 BOOLEAN AtDiskSecondaryAddressClaimed
;
1054 } CONFIGURATION_INFORMATION
, *PCONFIGURATION_INFORMATION
;
1056 typedef VOID STDCALL_FUNC
1057 (*PIO_DPC_ROUTINE
)(PKDPC Dpc
,
1058 PDEVICE_OBJECT DeviceObject
,
1062 typedef VOID STDCALL_FUNC
1063 (*PIO_TIMER_ROUTINE
)(PDEVICE_OBJECT DeviceObject
,
1067 * PURPOSE: Special timer associated with each device
1069 #define IO_TYPE_TIMER 9
1070 typedef struct _IO_TIMER
{
1071 USHORT Type
; /* Every IO Object has a Type */
1072 USHORT TimerEnabled
; /* Tells us if the Timer is enabled or not */
1073 LIST_ENTRY IoTimerList
; /* List of other Timers on the system */
1074 PIO_TIMER_ROUTINE TimerRoutine
; /* The associated timer routine */
1075 PVOID Context
; /* Context */
1076 PDEVICE_OBJECT DeviceObject
; /* Driver that owns this IO Timer */
1077 } IO_TIMER
, *PIO_TIMER
;
1079 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
1080 typedef VOID (*PIO_WORKITEM_ROUTINE
)(IN PDEVICE_OBJECT DeviceObject
, IN PVOID Context
);
1082 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
1083 typedef struct _PARTITION_INFORMATION
1085 LARGE_INTEGER StartingOffset
;
1086 LARGE_INTEGER PartitionLength
;
1087 ULONG HiddenSectors
;
1088 ULONG PartitionNumber
;
1089 UCHAR PartitionType
;
1090 BOOLEAN BootIndicator
;
1091 BOOLEAN RecognizedPartition
;
1092 BOOLEAN RewritePartition
;
1093 } PARTITION_INFORMATION
, *PPARTITION_INFORMATION
;
1096 typedef enum _PARTITION_STYLE
{
1097 PARTITION_STYLE_MBR
,
1098 PARTITION_STYLE_GPT
,
1102 typedef struct _PARTITION_INFORMATION_GPT
{
1107 } PARTITION_INFORMATION_GPT
, *PPARTITION_INFORMATION_GPT
;
1109 typedef struct _PARTITION_INFORMATION_MBR
{
1110 UCHAR PartitionType
;
1111 BOOLEAN BootIndicator
;
1112 BOOLEAN RecognizedPartition
;
1113 ULONG HiddenSectors
;
1114 } PARTITION_INFORMATION_MBR
, *PPARTITION_INFORMATION_MBR
;
1116 typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR
;
1117 typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT
;
1119 typedef struct _SET_PARTITION_INFORMATION_EX
{
1120 PARTITION_STYLE PartitionStyle
;
1122 SET_PARTITION_INFORMATION_MBR Mbr
;
1123 SET_PARTITION_INFORMATION_GPT Gpt
;
1125 } SET_PARTITION_INFORMATION_EX
, *PSET_PARTITION_INFORMATION_EX
;
1127 typedef struct _CREATE_DISK_GPT
{
1129 ULONG MaxPartitionCount
;
1130 } CREATE_DISK_GPT
, *PCREATE_DISK_GPT
;
1132 typedef struct _CREATE_DISK_MBR
{
1134 } CREATE_DISK_MBR
, *PCREATE_DISK_MBR
;
1137 typedef struct _CREATE_DISK
{
1138 PARTITION_STYLE PartitionStyle
;
1140 CREATE_DISK_MBR Mbr
;
1141 CREATE_DISK_GPT Gpt
;
1143 } CREATE_DISK
, *PCREATE_DISK
;
1145 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT
{
1147 LARGE_INTEGER StartingUsableOffset
;
1148 LARGE_INTEGER UsableLength
;
1149 ULONG MaxPartitionCount
;
1150 } DRIVE_LAYOUT_INFORMATION_GPT
, *PDRIVE_LAYOUT_INFORMATION_GPT
;
1152 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR
{
1154 } DRIVE_LAYOUT_INFORMATION_MBR
, *PDRIVE_LAYOUT_INFORMATION_MBR
;
1156 typedef struct _PARTITION_INFORMATION_EX
{
1157 PARTITION_STYLE PartitionStyle
;
1158 LARGE_INTEGER StartingOffset
;
1159 LARGE_INTEGER PartitionLength
;
1160 ULONG PartitionNumber
;
1161 BOOLEAN RewritePartition
;
1163 PARTITION_INFORMATION_MBR Mbr
;
1164 PARTITION_INFORMATION_GPT Gpt
;
1166 } PARTITION_INFORMATION_EX
, *PPARTITION_INFORMATION_EX
;
1168 typedef struct _DRIVE_LAYOUT_INFORMATION_EX
{
1169 ULONG PartitionStyle
;
1170 ULONG PartitionCount
;
1172 DRIVE_LAYOUT_INFORMATION_MBR Mbr
;
1173 DRIVE_LAYOUT_INFORMATION_GPT Gpt
;
1175 PARTITION_INFORMATION_EX PartitionEntry
[1];
1176 } DRIVE_LAYOUT_INFORMATION_EX
, *PDRIVE_LAYOUT_INFORMATION_EX
;
1178 typedef struct _BOOTDISK_INFORMATION
{
1179 LONGLONG BootPartitionOffset
;
1180 LONGLONG SystemPartitionOffset
;
1181 ULONG BootDeviceSignature
;
1182 ULONG SystemDeviceSignature
;
1183 } BOOTDISK_INFORMATION
, *PBOOTDISK_INFORMATION
;
1186 typedef struct _DISK_SIGNATURE
{
1187 ULONG PartitionStyle
;
1198 } DISK_SIGNATURE
, *PDISK_SIGNATURE
;
1200 typedef struct _REPARSE_DATA_BUFFER
{
1202 USHORT ReparseDataLength
;
1206 USHORT SubstituteNameOffset
;
1207 USHORT SubstituteNameLength
;
1208 USHORT PrintNameOffset
;
1209 USHORT PrintNameLength
;
1210 WCHAR PathBuffer
[1];
1211 } SymbolicLinkReparseBuffer
;
1213 USHORT SubstituteNameOffset
;
1214 USHORT SubstituteNameLength
;
1215 USHORT PrintNameOffset
;
1216 USHORT PrintNameLength
;
1217 WCHAR PathBuffer
[1];
1218 } MountPointReparseBuffer
;
1220 UCHAR DataBuffer
[1];
1221 } GenericReparseBuffer
;
1223 } REPARSE_DATA_BUFFER
, *PREPARSE_DATA_BUFFER
;
1225 typedef struct _DRIVER_LAYOUT_INFORMATION
1227 ULONG PartitionCount
;
1229 PARTITION_INFORMATION PartitionEntry
[1];
1230 } DRIVER_LAYOUT_INFORMATION
, *PDRIVER_LAYOUT_INFORMATION
;
1233 typedef IO_ALLOCATION_ACTION STDCALL_FUNC
1234 (*PDRIVER_CONTROL
)(PDEVICE_OBJECT DeviceObject
,
1236 PVOID MapRegisterBase
,
1238 #if (_WIN32_WINNT >= 0x0400)
1239 typedef VOID STDCALL_FUNC
1240 (*PFSDNOTIFICATIONPROC
)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject
,
1241 IN BOOLEAN DriverActive
);
1242 #endif // (_WIN32_WINNT >= 0x0400)
1245 typedef struct _NAMED_PIPE_CREATE_PARAMETERS
{
1246 ULONG NamedPipeType
;
1248 ULONG CompletionMode
;
1249 ULONG MaximumInstances
;
1251 ULONG OutboundQuota
;
1252 LARGE_INTEGER DefaultTimeout
;
1253 BOOLEAN TimeoutSpecified
;
1254 } NAMED_PIPE_CREATE_PARAMETERS
, *PNAMED_PIPE_CREATE_PARAMETERS
;
1256 typedef struct _MAILSLOT_CREATE_PARAMETERS
{
1257 ULONG MailslotQuota
;
1258 ULONG MaximumMessageSize
;
1259 LARGE_INTEGER ReadTimeout
;
1260 BOOLEAN TimeoutSpecified
;
1261 } MAILSLOT_CREATE_PARAMETERS
, *PMAILSLOT_CREATE_PARAMETERS
;
1265 typedef struct _IO_ERROR_LOG_PACKET
1267 UCHAR MajorFunctionCode
;
1269 USHORT DumpDataSize
;
1270 USHORT NumberOfStrings
;
1271 USHORT StringOffset
;
1272 USHORT EventCategory
;
1274 ULONG UniqueErrorValue
;
1275 NTSTATUS FinalStatus
;
1276 ULONG SequenceNumber
;
1277 ULONG IoControlCode
;
1278 LARGE_INTEGER DeviceOffset
;
1280 } IO_ERROR_LOG_PACKET
, *PIO_ERROR_LOG_PACKET
;
1282 typedef struct _IO_ERROR_LOG_MESSAGE
1286 USHORT DriverNameLength
;
1287 LARGE_INTEGER TimeStamp
;
1288 ULONG DriverNameOffset
;
1289 IO_ERROR_LOG_PACKET EntryData
;
1290 } IO_ERROR_LOG_MESSAGE
, *PIO_ERROR_LOG_MESSAGE
;
1295 typedef struct _DMA_ADAPTER
{
1298 struct _DMA_OPERATIONS
*DmaOperations
;
1299 } DMA_ADAPTER
, *PDMA_ADAPTER
;
1301 typedef struct _SCATTER_GATHER_ELEMENT
{
1302 PHYSICAL_ADDRESS Address
;
1305 } SCATTER_GATHER_ELEMENT
, *PSCATTER_GATHER_ELEMENT
;
1307 typedef struct _SCATTER_GATHER_LIST
{
1308 ULONG NumberOfElements
;
1310 SCATTER_GATHER_ELEMENT Elements
[];
1311 } SCATTER_GATHER_LIST
, *PSCATTER_GATHER_LIST
;
1313 typedef VOID (*PPUT_DMA_ADAPTER
)(
1314 PDMA_ADAPTER DmaAdapter
1317 typedef PVOID (*PALLOCATE_COMMON_BUFFER
)(
1318 IN PDMA_ADAPTER DmaAdapter
,
1320 OUT PPHYSICAL_ADDRESS LogicalAddress
,
1321 IN BOOLEAN CacheEnabled
1324 typedef VOID (*PFREE_COMMON_BUFFER
)(
1325 IN PDMA_ADAPTER DmaAdapter
,
1327 IN PHYSICAL_ADDRESS LogicalAddress
,
1328 IN PVOID VirtualAddress
,
1329 IN BOOLEAN CacheEnabled
1332 typedef NTSTATUS (*PALLOCATE_ADAPTER_CHANNEL
)(
1333 IN PDMA_ADAPTER DmaAdapter
,
1334 IN PDEVICE_OBJECT DeviceObject
,
1335 IN ULONG NumberOfMapRegisters
,
1336 IN PDRIVER_CONTROL ExecutionRoutine
,
1340 typedef BOOLEAN (*PFLUSH_ADAPTER_BUFFERS
)(
1341 IN PDMA_ADAPTER DmaAdapter
,
1343 IN PVOID MapRegisterBase
,
1346 IN BOOLEAN WriteToDevice
1349 typedef VOID (*PFREE_ADAPTER_CHANNEL
)(
1350 IN PDMA_ADAPTER DmaAdapter
1353 typedef VOID (*PFREE_MAP_REGISTERS
)(
1354 IN PDMA_ADAPTER DmaAdapter
,
1355 PVOID MapRegisterBase
,
1356 ULONG NumberOfMapRegisters
1359 typedef PHYSICAL_ADDRESS (*PMAP_TRANSFER
)(
1360 IN PDMA_ADAPTER DmaAdapter
,
1362 IN PVOID MapRegisterBase
,
1364 IN OUT PULONG Length
,
1365 IN BOOLEAN WriteToDevice
1368 typedef ULONG (*PGET_DMA_ALIGNMENT
)(
1369 IN PDMA_ADAPTER DmaAdapter
1372 typedef ULONG (*PREAD_DMA_COUNTER
)(
1373 IN PDMA_ADAPTER DmaAdapter
1376 typedef VOID (*PDRIVER_LIST_CONTROL
)(
1377 IN
struct _DEVICE_OBJECT
*DeviceObject
,
1378 IN
struct _IRP
*Irp
,
1379 IN PSCATTER_GATHER_LIST ScatterGather
,
1383 typedef NTSTATUS (*PGET_SCATTER_GATHER_LIST
)(
1384 IN PDMA_ADAPTER DmaAdapter
,
1385 IN PDEVICE_OBJECT DeviceObject
,
1389 IN PDRIVER_LIST_CONTROL ExecutionRoutine
,
1391 IN BOOLEAN WriteToDevice
1394 typedef VOID (*PPUT_SCATTER_GATHER_LIST
)(
1395 IN PDMA_ADAPTER DmaAdapter
,
1396 IN PSCATTER_GATHER_LIST ScatterGather
,
1397 IN BOOLEAN WriteToDevice
1400 typedef struct _DMA_OPERATIONS
{
1402 PPUT_DMA_ADAPTER PutDmaAdapter
;
1403 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer
;
1404 PFREE_COMMON_BUFFER FreeCommonBuffer
;
1405 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel
;
1406 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers
;
1407 PFREE_ADAPTER_CHANNEL FreeAdapterChannel
;
1408 PFREE_MAP_REGISTERS FreeMapRegisters
;
1409 PMAP_TRANSFER MapTransfer
;
1410 PGET_DMA_ALIGNMENT GetDmaAlignment
;
1411 PREAD_DMA_COUNTER ReadDmaCounter
;
1412 PGET_SCATTER_GATHER_LIST GetScatterGatherList
;
1413 PPUT_SCATTER_GATHER_LIST PutScatterGatherList
;
1414 } DMA_OPERATIONS
, *PDMA_OPERATIONS
;
1416 /* Standard bus interface */
1418 struct _DEVICE_DESCRIPTION
;
1420 typedef BOOLEAN
STDCALL_FUNC (*PTRANSLATE_BUS_ADDRESS
)(
1422 IN PHYSICAL_ADDRESS BusAddress
,
1424 IN OUT PULONG AddressSpace
,
1425 OUT PPHYSICAL_ADDRESS TranslatedAddress
);
1427 typedef PDMA_ADAPTER
STDCALL_FUNC (*PGET_DMA_ADAPTER
)(
1429 IN
struct _DEVICE_DESCRIPTION
*DeviceDescriptor
,
1430 OUT PULONG NumberOfMapRegisters
);
1432 typedef ULONG
STDCALL_FUNC (*PGET_SET_DEVICE_DATA
)(
1439 typedef struct _BUS_INTERFACE_STANDARD
{
1443 PINTERFACE_REFERENCE InterfaceReference
;
1444 PINTERFACE_DEREFERENCE InterfaceDereference
;
1445 PTRANSLATE_BUS_ADDRESS TranslateBusAddress
;
1446 PGET_DMA_ADAPTER GetDmaAdapter
;
1447 PGET_SET_DEVICE_DATA SetBusData
;
1448 PGET_SET_DEVICE_DATA GetBusData
;
1449 } BUS_INTERFACE_STANDARD
, *PBUS_INTERFACE_STANDARD
;
1451 #include <poppack.h>
1453 #endif /* __INCLUDE_DDK_IOTYPES_H */