1 /* $Id: iotypes.h,v 1.64 2004/10/19 20:36:52 navaraf 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
;
872 IO_STACK_LOCATION Stack
[1];
875 #define VPB_MOUNTED 0x00000001
876 #define VPB_LOCKED 0x00000002
877 #define VPB_PERSISTENT 0x00000004
878 #define VPB_REMOVE_PENDING 0x00000008
885 USHORT VolumeLabelLength
;
886 struct _DEVICE_OBJECT
* DeviceObject
;
887 struct _DEVICE_OBJECT
* RealDevice
;
889 ULONG ReferenceCount
;
890 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
];
894 typedef struct _DEVICE_OBJECT
899 struct _DRIVER_OBJECT
* DriverObject
;
900 struct _DEVICE_OBJECT
* NextDevice
;
901 struct _DEVICE_OBJECT
* AttachedDevice
;
902 struct _IRP
* CurrentIrp
;
903 struct _IO_TIMER
*Timer
;
905 ULONG Characteristics
;
907 PVOID DeviceExtension
;
908 DEVICE_TYPE DeviceType
;
913 WAIT_CONTEXT_BLOCK Wcb
;
915 ULONG AlignmentRequirement
;
916 KDEVICE_QUEUE DeviceQueue
;
918 ULONG ActiveThreadCount
;
919 PSECURITY_DESCRIPTOR SecurityDescriptor
;
923 struct _DEVOBJ_EXTENSION
* DeviceObjectExtension
;
925 } DEVICE_OBJECT
, *PDEVICE_OBJECT
;
929 * Fast i/o routine type declaration
931 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
932 //FIXME : this type is ok for read and write, but not for all routines
933 typedef BOOLEAN STDCALL_FUNC
934 (*PFAST_IO_ROUTINE
)(IN
struct _FILE_OBJECT
*FileObject
,
935 IN PLARGE_INTEGER FileOffset
,
940 OUT PIO_STATUS_BLOCK IoStatus
,
941 IN
struct _DEVICE_OBJECT
*DeviceObject
);
943 typedef struct _FAST_IO_DISPATCH
{
944 ULONG SizeOfFastIoDispatch
;
945 PFAST_IO_ROUTINE FastIoCheckIfPossible
;
946 PFAST_IO_ROUTINE FastIoRead
;
947 PFAST_IO_ROUTINE FastIoWrite
;
948 PFAST_IO_ROUTINE FastIoQueryBasicInfo
;
949 PFAST_IO_ROUTINE FastIoQueryStandardInfo
;
950 PFAST_IO_ROUTINE FastIoLock
;
951 PFAST_IO_ROUTINE FastIoUnlockSingle
;
952 PFAST_IO_ROUTINE FastIoUnlockAll
;
953 PFAST_IO_ROUTINE FastIoUnlockAllByKey
;
954 PFAST_IO_ROUTINE FastIoDeviceControl
;
955 PFAST_IO_ROUTINE AcquireFileForNtCreateSection
;
956 PFAST_IO_ROUTINE ReleaseFileForNtCreateSection
;
957 PFAST_IO_ROUTINE FastIoDetachDevice
;
958 PFAST_IO_ROUTINE FastIoQueryNetworkOpenInfo
;
959 PFAST_IO_ROUTINE AcquireForModWrite
;
960 PFAST_IO_ROUTINE MdlRead
;
961 PFAST_IO_ROUTINE MdlReadComplete
;
962 PFAST_IO_ROUTINE PrepareMdlWrite
;
963 PFAST_IO_ROUTINE MdlWriteComplete
;
964 PFAST_IO_ROUTINE FastIoReadCompressed
;
965 PFAST_IO_ROUTINE FastIoWriteCompressed
;
966 PFAST_IO_ROUTINE MdlReadCompleteCompressed
;
967 PFAST_IO_ROUTINE MdlWriteCompleteCompressed
;
968 PFAST_IO_ROUTINE FastIoQueryOpen
;
969 PFAST_IO_ROUTINE ReleaseForModWrite
;
970 PFAST_IO_ROUTINE AcquireForCcFlush
;
971 PFAST_IO_ROUTINE ReleaseForCcFlush
;
972 } FAST_IO_DISPATCH
, *PFAST_IO_DISPATCH
;
975 * Dispatch routine type declaration
977 typedef NTSTATUS STDCALL_FUNC
978 (*PDRIVER_DISPATCH
)(IN
struct _DEVICE_OBJECT
*DeviceObject
,
979 IN
struct _IRP
*Irp
);
982 * StartIo routine type declaration
984 typedef VOID STDCALL_FUNC
985 (*PDRIVER_STARTIO
)(IN PDEVICE_OBJECT DeviceObject
,
989 * Unload routine type declaration
991 typedef VOID STDCALL_FUNC
992 (*PDRIVER_UNLOAD
)(IN
struct _DRIVER_OBJECT
*DriverObject
);
995 * AddDevice routine type declaration
997 typedef NTSTATUS STDCALL_FUNC
998 (*PDRIVER_ADD_DEVICE
)(IN
struct _DRIVER_OBJECT
*DriverObject
,
999 IN
struct _DEVICE_OBJECT
*PhysicalDeviceObject
);
1002 typedef struct _DRIVER_EXTENSION
1004 struct _DRIVER_OBJECT
* DriverObject
;
1005 PDRIVER_ADD_DEVICE AddDevice
;
1007 UNICODE_STRING ServiceKeyName
;
1008 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
1012 struct _FAST_IO_DISPATCH_TABLE
1015 PFAST_IO_DISPATCH Dispatch
;
1017 } FAST_IO_DISPATCH_TABLE
, * PFAST_IO_DISPATCH_TABLE
;
1020 typedef struct _DRIVER_OBJECT
1024 PDEVICE_OBJECT DeviceObject
;
1028 PVOID DriverSection
;
1029 PDRIVER_EXTENSION DriverExtension
;
1030 UNICODE_STRING DriverName
;
1031 PUNICODE_STRING HardwareDatabase
;
1033 PFAST_IO_DISPATCH_TABLE FastIoDispatch
;
1035 PFAST_IO_DISPATCH FastIoDispatch
;
1037 PDRIVER_INITIALIZE DriverInit
;
1038 PDRIVER_STARTIO DriverStartIo
;
1039 PDRIVER_UNLOAD DriverUnload
;
1040 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
1041 } DRIVER_OBJECT
, *PDRIVER_OBJECT
;
1044 typedef struct _CONFIGURATION_INFORMATION
1050 ULONG ScsiPortCount
;
1052 ULONG ParallelCount
;
1053 BOOLEAN AtDiskPrimaryAddressClaimed
;
1054 BOOLEAN AtDiskSecondaryAddressClaimed
;
1055 } CONFIGURATION_INFORMATION
, *PCONFIGURATION_INFORMATION
;
1057 typedef VOID STDCALL_FUNC
1058 (*PIO_DPC_ROUTINE
)(PKDPC Dpc
,
1059 PDEVICE_OBJECT DeviceObject
,
1063 typedef VOID STDCALL_FUNC
1064 (*PIO_TIMER_ROUTINE
)(PDEVICE_OBJECT DeviceObject
,
1068 * PURPOSE: Special timer associated with each device
1069 * NOTES: This is a guess
1071 typedef struct _IO_TIMER
1075 PDEVICE_OBJECT DeviceObject
;
1076 PIO_TIMER_ROUTINE TimerRoutine
;
1078 } IO_TIMER
, *PIO_TIMER
;
1080 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
1081 typedef VOID (*PIO_WORKITEM_ROUTINE
)(IN PDEVICE_OBJECT DeviceObject
, IN PVOID Context
);
1083 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
1084 typedef struct _PARTITION_INFORMATION
1086 LARGE_INTEGER StartingOffset
;
1087 LARGE_INTEGER PartitionLength
;
1088 ULONG HiddenSectors
;
1089 ULONG PartitionNumber
;
1090 UCHAR PartitionType
;
1091 BOOLEAN BootIndicator
;
1092 BOOLEAN RecognizedPartition
;
1093 BOOLEAN RewritePartition
;
1094 } PARTITION_INFORMATION
, *PPARTITION_INFORMATION
;
1097 typedef enum _PARTITION_STYLE
{
1098 PARTITION_STYLE_MBR
,
1099 PARTITION_STYLE_GPT
,
1103 typedef struct _PARTITION_INFORMATION_GPT
{
1108 } PARTITION_INFORMATION_GPT
, *PPARTITION_INFORMATION_GPT
;
1110 typedef struct _PARTITION_INFORMATION_MBR
{
1111 UCHAR PartitionType
;
1112 BOOLEAN BootIndicator
;
1113 BOOLEAN RecognizedPartition
;
1114 ULONG HiddenSectors
;
1115 } PARTITION_INFORMATION_MBR
, *PPARTITION_INFORMATION_MBR
;
1117 typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR
;
1118 typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT
;
1120 typedef struct _SET_PARTITION_INFORMATION_EX
{
1121 PARTITION_STYLE PartitionStyle
;
1123 SET_PARTITION_INFORMATION_MBR Mbr
;
1124 SET_PARTITION_INFORMATION_GPT Gpt
;
1126 } SET_PARTITION_INFORMATION_EX
, *PSET_PARTITION_INFORMATION_EX
;
1128 typedef struct _CREATE_DISK_GPT
{
1130 ULONG MaxPartitionCount
;
1131 } CREATE_DISK_GPT
, *PCREATE_DISK_GPT
;
1133 typedef struct _CREATE_DISK_MBR
{
1135 } CREATE_DISK_MBR
, *PCREATE_DISK_MBR
;
1138 typedef struct _CREATE_DISK
{
1139 PARTITION_STYLE PartitionStyle
;
1141 CREATE_DISK_MBR Mbr
;
1142 CREATE_DISK_GPT Gpt
;
1144 } CREATE_DISK
, *PCREATE_DISK
;
1146 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT
{
1148 LARGE_INTEGER StartingUsableOffset
;
1149 LARGE_INTEGER UsableLength
;
1150 ULONG MaxPartitionCount
;
1151 } DRIVE_LAYOUT_INFORMATION_GPT
, *PDRIVE_LAYOUT_INFORMATION_GPT
;
1153 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR
{
1155 } DRIVE_LAYOUT_INFORMATION_MBR
, *PDRIVE_LAYOUT_INFORMATION_MBR
;
1157 typedef struct _PARTITION_INFORMATION_EX
{
1158 PARTITION_STYLE PartitionStyle
;
1159 LARGE_INTEGER StartingOffset
;
1160 LARGE_INTEGER PartitionLength
;
1161 ULONG PartitionNumber
;
1162 BOOLEAN RewritePartition
;
1164 PARTITION_INFORMATION_MBR Mbr
;
1165 PARTITION_INFORMATION_GPT Gpt
;
1167 } PARTITION_INFORMATION_EX
, *PPARTITION_INFORMATION_EX
;
1169 typedef struct _DRIVE_LAYOUT_INFORMATION_EX
{
1170 ULONG PartitionStyle
;
1171 ULONG PartitionCount
;
1173 DRIVE_LAYOUT_INFORMATION_MBR Mbr
;
1174 DRIVE_LAYOUT_INFORMATION_GPT Gpt
;
1176 PARTITION_INFORMATION_EX PartitionEntry
[1];
1177 } DRIVE_LAYOUT_INFORMATION_EX
, *PDRIVE_LAYOUT_INFORMATION_EX
;
1179 typedef struct _BOOTDISK_INFORMATION
{
1180 LONGLONG BootPartitionOffset
;
1181 LONGLONG SystemPartitionOffset
;
1182 ULONG BootDeviceSignature
;
1183 ULONG SystemDeviceSignature
;
1184 } BOOTDISK_INFORMATION
, *PBOOTDISK_INFORMATION
;
1187 typedef struct _DISK_SIGNATURE
{
1188 ULONG PartitionStyle
;
1199 } DISK_SIGNATURE
, *PDISK_SIGNATURE
;
1201 typedef struct _REPARSE_DATA_BUFFER
{
1203 USHORT ReparseDataLength
;
1207 USHORT SubstituteNameOffset
;
1208 USHORT SubstituteNameLength
;
1209 USHORT PrintNameOffset
;
1210 USHORT PrintNameLength
;
1211 WCHAR PathBuffer
[1];
1212 } SymbolicLinkReparseBuffer
;
1214 USHORT SubstituteNameOffset
;
1215 USHORT SubstituteNameLength
;
1216 USHORT PrintNameOffset
;
1217 USHORT PrintNameLength
;
1218 WCHAR PathBuffer
[1];
1219 } MountPointReparseBuffer
;
1221 UCHAR DataBuffer
[1];
1222 } GenericReparseBuffer
;
1224 } REPARSE_DATA_BUFFER
, *PREPARSE_DATA_BUFFER
;
1226 typedef struct _DRIVER_LAYOUT_INFORMATION
1228 ULONG PartitionCount
;
1230 PARTITION_INFORMATION PartitionEntry
[1];
1231 } DRIVER_LAYOUT_INFORMATION
, *PDRIVER_LAYOUT_INFORMATION
;
1234 typedef IO_ALLOCATION_ACTION STDCALL_FUNC
1235 (*PDRIVER_CONTROL
)(PDEVICE_OBJECT DeviceObject
,
1237 PVOID MapRegisterBase
,
1239 #if (_WIN32_WINNT >= 0x0400)
1240 typedef VOID STDCALL_FUNC
1241 (*PFSDNOTIFICATIONPROC
)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject
,
1242 IN BOOLEAN DriverActive
);
1243 #endif // (_WIN32_WINNT >= 0x0400)
1246 typedef struct _IO_PIPE_CREATE_BUFFER
1248 BOOLEAN WriteModeMessage
;
1249 BOOLEAN ReadModeMessage
;
1250 BOOLEAN NonBlocking
;
1253 ULONG OutBufferSize
;
1254 LARGE_INTEGER TimeOut
;
1255 } IO_PIPE_CREATE_BUFFER
, *PIO_PIPE_CREATE_BUFFER
;
1257 typedef struct _IO_MAILSLOT_CREATE_BUFFER
1259 ULONG Param
; /* ?? */
1260 ULONG MaxMessageSize
;
1261 LARGE_INTEGER TimeOut
;
1262 } IO_MAILSLOT_CREATE_BUFFER
, *PIO_MAILSLOT_CREATE_BUFFER
;
1266 typedef struct _IO_ERROR_LOG_PACKET
1268 UCHAR MajorFunctionCode
;
1270 USHORT DumpDataSize
;
1271 USHORT NumberOfStrings
;
1272 USHORT StringOffset
;
1273 USHORT EventCategory
;
1275 ULONG UniqueErrorValue
;
1276 NTSTATUS FinalStatus
;
1277 ULONG SequenceNumber
;
1278 ULONG IoControlCode
;
1279 LARGE_INTEGER DeviceOffset
;
1281 } IO_ERROR_LOG_PACKET
, *PIO_ERROR_LOG_PACKET
;
1283 typedef struct _IO_ERROR_LOG_MESSAGE
1287 USHORT DriverNameLength
;
1288 LARGE_INTEGER TimeStamp
;
1289 ULONG DriverNameOffset
;
1290 IO_ERROR_LOG_PACKET EntryData
;
1291 } IO_ERROR_LOG_MESSAGE
, *PIO_ERROR_LOG_MESSAGE
;
1296 typedef struct _SCATTER_GATHER_ELEMENT
{
1297 PHYSICAL_ADDRESS Address
;
1300 } SCATTER_GATHER_ELEMENT
, *PSCATTER_GATHER_ELEMENT
;
1302 typedef struct _SCATTER_GATHER_LIST
{
1303 ULONG NumberOfElements
;
1305 SCATTER_GATHER_ELEMENT Elements
[];
1306 } SCATTER_GATHER_LIST
, *PSCATTER_GATHER_LIST
;
1308 typedef struct _DMA_OPERATIONS
*PDMA_OPERATIONS
;
1310 typedef struct _DMA_ADAPTER
{
1313 PDMA_OPERATIONS DmaOperations
;
1314 PADAPTER_OBJECT HalAdapter
;
1315 } DMA_ADAPTER
, *PDMA_ADAPTER
;
1317 typedef VOID (*PPUT_DMA_ADAPTER
)(
1318 PDMA_ADAPTER DmaAdapter
1321 typedef PVOID (*PALLOCATE_COMMON_BUFFER
)(
1322 IN PDMA_ADAPTER DmaAdapter
,
1324 OUT PPHYSICAL_ADDRESS LogicalAddress
,
1325 IN BOOLEAN CacheEnabled
1328 typedef VOID (*PFREE_COMMON_BUFFER
)(
1329 IN PDMA_ADAPTER DmaAdapter
,
1331 IN PHYSICAL_ADDRESS LogicalAddress
,
1332 IN PVOID VirtualAddress
,
1333 IN BOOLEAN CacheEnabled
1336 typedef NTSTATUS (*PALLOCATE_ADAPTER_CHANNEL
)(
1337 IN PDMA_ADAPTER DmaAdapter
,
1338 IN PDEVICE_OBJECT DeviceObject
,
1339 IN ULONG NumberOfMapRegisters
,
1340 IN PDRIVER_CONTROL ExecutionRoutine
,
1344 typedef BOOLEAN (*PFLUSH_ADAPTER_BUFFERS
)(
1345 IN PDMA_ADAPTER DmaAdapter
,
1347 IN PVOID MapRegisterBase
,
1350 IN BOOLEAN WriteToDevice
1353 typedef VOID (*PFREE_ADAPTER_CHANNEL
)(
1354 IN PDMA_ADAPTER DmaAdapter
1357 typedef VOID (*PFREE_MAP_REGISTERS
)(
1358 IN PDMA_ADAPTER DmaAdapter
,
1359 PVOID MapRegisterBase
,
1360 ULONG NumberOfMapRegisters
1363 typedef PHYSICAL_ADDRESS (*PMAP_TRANSFER
)(
1364 IN PDMA_ADAPTER DmaAdapter
,
1366 IN PVOID MapRegisterBase
,
1368 IN OUT PULONG Length
,
1369 IN BOOLEAN WriteToDevice
1372 typedef ULONG (*PGET_DMA_ALIGNMENT
)(
1373 IN PDMA_ADAPTER DmaAdapter
1376 typedef ULONG (*PREAD_DMA_COUNTER
)(
1377 IN PDMA_ADAPTER DmaAdapter
1380 typedef VOID (*PDRIVER_LIST_CONTROL
)(
1381 IN
struct _DEVICE_OBJECT
*DeviceObject
,
1382 IN
struct _IRP
*Irp
,
1383 IN PSCATTER_GATHER_LIST ScatterGather
,
1387 typedef NTSTATUS (*PGET_SCATTER_GATHER_LIST
)(
1388 IN PDMA_ADAPTER DmaAdapter
,
1389 IN PDEVICE_OBJECT DeviceObject
,
1393 IN PDRIVER_LIST_CONTROL ExecutionRoutine
,
1395 IN BOOLEAN WriteToDevice
1398 typedef VOID (*PPUT_SCATTER_GATHER_LIST
)(
1399 IN PDMA_ADAPTER DmaAdapter
,
1400 IN PSCATTER_GATHER_LIST ScatterGather
,
1401 IN BOOLEAN WriteToDevice
1404 typedef struct _DMA_OPERATIONS
{
1406 PPUT_DMA_ADAPTER PutDmaAdapter
;
1407 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer
;
1408 PFREE_COMMON_BUFFER FreeCommonBuffer
;
1409 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel
;
1410 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers
;
1411 PFREE_ADAPTER_CHANNEL FreeAdapterChannel
;
1412 PFREE_MAP_REGISTERS FreeMapRegisters
;
1413 PMAP_TRANSFER MapTransfer
;
1414 PGET_DMA_ALIGNMENT GetDmaAlignment
;
1415 PREAD_DMA_COUNTER ReadDmaCounter
;
1416 PGET_SCATTER_GATHER_LIST GetScatterGatherList
;
1417 PPUT_SCATTER_GATHER_LIST PutScatterGatherList
;
1421 /* Standard bus interface */
1423 struct _DEVICE_DESCRIPTION
;
1425 typedef BOOLEAN
STDCALL_FUNC (*PTRANSLATE_BUS_ADDRESS
)(
1427 IN PHYSICAL_ADDRESS BusAddress
,
1429 IN OUT PULONG AddressSpace
,
1430 OUT PPHYSICAL_ADDRESS TranslatedAddress
);
1432 typedef PDMA_ADAPTER
STDCALL_FUNC (*PGET_DMA_ADAPTER
)(
1434 IN
struct _DEVICE_DESCRIPTION
*DeviceDescriptor
,
1435 OUT PULONG NumberOfMapRegisters
);
1437 typedef ULONG
STDCALL_FUNC (*PGET_SET_DEVICE_DATA
)(
1444 typedef struct _BUS_INTERFACE_STANDARD
{
1448 PINTERFACE_REFERENCE InterfaceReference
;
1449 PINTERFACE_DEREFERENCE InterfaceDereference
;
1450 PTRANSLATE_BUS_ADDRESS TranslateBusAddress
;
1451 PGET_DMA_ADAPTER GetDmaAdapter
;
1452 PGET_SET_DEVICE_DATA SetBusData
;
1453 PGET_SET_DEVICE_DATA GetBusData
;
1454 } BUS_INTERFACE_STANDARD
, *PBUS_INTERFACE_STANDARD
;
1456 #include <poppack.h>
1458 #endif /* __INCLUDE_DDK_IOTYPES_H */