1 /* $Id: iotypes.h,v 1.33 2002/01/26 17:59:25 ekohl Exp $
5 #ifndef __INCLUDE_DDK_IOTYPES_H
6 #define __INCLUDE_DDK_IOTYPES_H
12 extern POBJECT_TYPE EXPORTED IoAdapterObjectType
;
13 extern POBJECT_TYPE EXPORTED IoDeviceHandlerObjectType
;
14 extern POBJECT_TYPE EXPORTED IoDeviceObjectType
;
15 extern POBJECT_TYPE EXPORTED IoDriverObjectType
;
16 extern POBJECT_TYPE EXPORTED IoFileObjectType
;
18 extern POBJECT_TYPE IMPORTED IoAdapterObjectType
;
19 extern POBJECT_TYPE IMPORTED IoDeviceHandlerObjectType
;
20 extern POBJECT_TYPE IMPORTED IoDeviceObjectType
;
21 extern POBJECT_TYPE IMPORTED IoDriverObjectType
;
22 extern POBJECT_TYPE IMPORTED IoFileObjectType
;
26 * These are referenced before they can be fully defined
28 struct _DRIVER_OBJECT
;
30 struct _DEVICE_OBJECT
;
32 struct _IO_STATUS_BLOCK
;
33 struct _SCSI_REQUEST_BLOCK
;
35 /* SIMPLE TYPES *************************************************************/
44 typedef enum _CREATE_FILE_TYPE
47 CreateFileTypeNamedPipe
,
48 CreateFileTypeMailslot
52 typedef struct _SHARE_ACCESS
61 } SHARE_ACCESS
, *PSHARE_ACCESS
;
63 /* FUNCTION TYPES ************************************************************/
66 (*PDRIVER_REINITIALIZE
)(struct _DRIVER_OBJECT
* DriverObject
,
70 typedef NTSTATUS STDCALL
71 (*PIO_QUERY_DEVICE_ROUTINE
)(PVOID Context
,
72 PUNICODE_STRING Pathname
,
73 INTERFACE_TYPE BusType
,
75 PKEY_VALUE_FULL_INFORMATION
* BI
,
76 CONFIGURATION_TYPE ControllerType
,
77 ULONG ControllerNumber
,
78 PKEY_VALUE_FULL_INFORMATION
* CI
,
79 CONFIGURATION_TYPE PeripheralType
,
80 ULONG PeripheralNumber
,
81 PKEY_VALUE_FULL_INFORMATION
* PI
);
83 typedef NTSTATUS STDCALL
84 (*PIO_COMPLETION_ROUTINE
)(struct _DEVICE_OBJECT
* DeviceObject
,
89 (*PIO_APC_ROUTINE
)(PVOID ApcContext
,
90 struct _IO_STATUS_BLOCK
* IoStatusBlock
,
94 /* STRUCTURE TYPES ***********************************************************/
96 typedef struct _ADAPTER_OBJECT ADAPTER_OBJECT
, *PADAPTER_OBJECT
;
99 * PURPOSE: Special timer associated with each device
100 * NOTES: This is a guess
102 typedef struct _IO_TIMER
106 } IO_TIMER
, *PIO_TIMER
;
108 typedef struct _IO_SECURITY_CONTEXT
110 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
111 PACCESS_STATE AccessState
;
112 ACCESS_MASK DesiredAccess
;
113 ULONG FullCreateOptions
;
114 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
117 typedef struct _IO_RESOURCE_DESCRIPTOR
121 UCHAR ShareDisposition
;
124 * Reserved for system use
131 * Reserved for system use
141 PHYSICAL_ADDRESS MinimumAddress
;
142 PHYSICAL_ADDRESS MaximumAddress
;
148 PHYSICAL_ADDRESS MinimumAddress
;
149 PHYSICAL_ADDRESS MaximumAddress
;
158 ULONG MinimumChannel
;
159 ULONG MaximumChannel
;
162 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
164 // IO_RESOURCE_DESCRIPTOR Options
165 #define IO_RESOURCE_REQUIRED 0x00
166 #define IO_RESOURCE_PREFERRED 0x01
167 #define IO_RESOURCE_DEFAULT 0x02
168 #define IO_RESOURCE_ALTERNATIVE 0x08
170 typedef struct _IO_RESOURCE_LIST
175 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
176 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
178 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
186 * System defined enum for the bus
188 INTERFACE_TYPE InterfaceType
;
193 ULONG AlternativeLists
;
194 IO_RESOURCE_LIST List
[1];
195 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
200 UCHAR ShareDisposition
;
206 PHYSICAL_ADDRESS Start
;
217 PHYSICAL_ADDRESS Start
;
231 } DeviceSpecificData
;
233 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
240 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
241 } CM_PARTIAL_RESOURCE_LIST
;
245 INTERFACE_TYPE InterfaceType
;
247 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
248 } CM_FULL_RESOURCE_DESCRIPTOR
;
253 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
254 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
258 * PURPOSE: IRP stack location
260 typedef struct __attribute__((packed
)) _IO_STACK_LOCATION
271 PIO_SECURITY_CONTEXT SecurityContext
;
273 USHORT FileAttributes
;
281 LARGE_INTEGER ByteOffset
;
287 LARGE_INTEGER ByteOffset
;
291 ULONG OutputBufferLength
;
292 ULONG InputBufferLength
;
294 PVOID Type3InputBuffer
;
298 ULONG OutputBufferLength
;
299 ULONG InputBufferLength
;
301 PVOID Type3InputBuffer
;
306 struct _DEVICE_OBJECT
* DeviceObject
;
311 FILE_INFORMATION_CLASS FileInformationClass
;
316 FS_INFORMATION_CLASS FsInformationClass
;
321 FS_INFORMATION_CLASS FsInformationClass
;
326 FILE_INFORMATION_CLASS FileInformationClass
;
327 struct _FILE_OBJECT
* FileObject
;
332 BOOLEAN ReplaceIfExists
;
342 PUNICODE_STRING FileName
;
343 FILE_INFORMATION_CLASS FileInformationClass
;
347 // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS
350 DEVICE_RELATION_TYPE Type
;
351 } QueryDeviceRelations
;
353 // Parameters for IRP_MN_QUERY_INTERFACE
356 CONST GUID
*InterfaceType
;
359 PINTERFACE Interface
;
360 PVOID InterfaceSpecificData
;
363 // Parameters for IRP_MN_QUERY_CAPABILITIES
366 PDEVICE_CAPABILITIES Capabilities
;
367 } DeviceCapabilities
;
369 // Parameters for IRP_MN_QUERY_ID
372 BUS_QUERY_ID_TYPE IdType
;
375 // Parameters for IRP_MN_QUERY_DEVICE_TEXT
378 DEVICE_TEXT_TYPE DeviceTextType
;
382 // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION
387 DEVICE_USAGE_NOTIFICATION_TYPE Type
;
390 // Parameters for IRP_MN_WAIT_WAKE
393 SYSTEM_POWER_STATE PowerState
;
396 // Parameter for IRP_MN_POWER_SEQUENCE
399 PPOWER_SEQUENCE PowerSequence
;
402 // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER
406 POWER_STATE_TYPE Type
;
408 POWER_ACTION ShutdownType
;
411 // Parameters for IRP_MN_START_DEVICE
414 PCM_RESOURCE_LIST AllocatedResources
;
415 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
418 // Parameters for IRP_MN_SCSI_CLASS
421 struct _SCSI_REQUEST_BLOCK
*Srb
;
426 struct _DEVICE_OBJECT
* DeviceObject
;
427 struct _FILE_OBJECT
* FileObject
;
429 PIO_COMPLETION_ROUTINE CompletionRoutine
;
430 PVOID CompletionContext
;
432 } __attribute__((packed
)) IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
435 typedef struct _IO_STATUS_BLOCK
439 } IO_STATUS_BLOCK
, *PIO_STATUS_BLOCK
;
442 typedef struct _IO_PIPE_CREATE_BUFFER
444 BOOLEAN WriteModeMessage
;
445 BOOLEAN ReadModeMessage
;
450 LARGE_INTEGER TimeOut
;
451 } IO_PIPE_CREATE_BUFFER
, *PIO_PIPE_CREATE_BUFFER
;
454 typedef struct _IO_MAILSLOT_CREATE_BUFFER
456 ULONG Param
; /* ?? */
457 ULONG MaxMessageSize
;
458 LARGE_INTEGER TimeOut
;
459 } IO_MAILSLOT_CREATE_BUFFER
, *PIO_MAILSLOT_CREATE_BUFFER
;
463 * Driver entry point declaration
465 typedef NTSTATUS STDCALL
466 (*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
* DriverObject
,
467 PUNICODE_STRING RegistryPath
);
470 * Driver cancel declaration
472 typedef NTSTATUS STDCALL
473 (*PDRIVER_CANCEL
)(struct _DEVICE_OBJECT
* DeviceObject
,
474 struct _IRP
* RegistryPath
);
477 typedef struct _SECTION_OBJECT_POINTERS
479 PVOID DataSectionObject
;
480 PVOID SharedCacheMap
;
481 PVOID ImageSectionObject
;
482 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
484 typedef struct _IO_COMPLETION_CONTEXT
488 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
490 #define FO_FILE_OPEN 0x00000001
491 #define FO_SYNCHRONOUS_IO 0x00000002
492 #define FO_ALERTABLE_IO 0x00000004
493 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
494 #define FO_WRITE_THROUGH 0x00000010
495 #define FO_SEQUENTIAL_ONLY 0x00000020
496 #define FO_CACHE_SUPPORTED 0x00000040
497 #define FO_NAMED_PIPE 0x00000080
498 #define FO_STREAM_FILE 0x00000100
499 #define FO_MAILSLOT 0x00000200
500 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
501 #define FO_DIRECT_DEVICE_OPEN 0x00000800
502 #define FO_FILE_MODIFIED 0x00001000
503 #define FO_FILE_SIZE_CHANGED 0x00002000
504 #define FO_CLEANUP_COMPLETE 0x00004000
505 #define FO_TEMPORARY_FILE 0x00008000
506 #define FO_DELETE_ON_CLOSE 0x00010000
507 #define FO_OPENED_CASE_SENSITIVE 0x00020000
508 #define FO_HANDLE_CREATED 0x00040000
509 #define FO_FILE_FAST_IO_READ 0x00080000
512 * ReactOS specific flags
514 #define FO_DIRECT_CACHE_READ 0x72000001
515 #define FO_DIRECT_CACHE_WRITE 0x72000002
516 #define FO_DIRECT_CACHE_PAGING_READ 0x72000004
517 #define FO_DIRECT_CACHE_PAGING_WRITE 0x72000008
518 #define FO_FCB_IS_VALID 0x72000010
520 typedef struct _FILE_OBJECT
524 struct _DEVICE_OBJECT
* DeviceObject
;
528 PSECTION_OBJECT_POINTERS SectionObjectPointers
;
529 PVOID PrivateCacheMap
;
530 NTSTATUS FinalStatus
;
531 struct _FILE_OBJECT
* RelatedFileObject
;
532 BOOLEAN LockOperation
;
533 BOOLEAN DeletePending
;
536 BOOLEAN DeleteAccess
;
539 BOOLEAN SharedDelete
;
541 UNICODE_STRING FileName
;
542 LARGE_INTEGER CurrentByteOffset
;
548 PIO_COMPLETION_CONTEXT CompletionContext
;
549 } FILE_OBJECT
, *PFILE_OBJECT
;
560 struct _IRP
* MasterIrp
;
564 LIST_ENTRY ThreadListEntry
;
565 IO_STATUS_BLOCK IoStatus
;
566 KPROCESSOR_MODE RequestorMode
;
567 BOOLEAN PendingReturned
;
569 CHAR CurrentLocation
;
572 CCHAR ApcEnvironment
;// CCHAR or PVOID?
573 UCHAR AllocationFlags
;//UCHAR or ULONG?
574 PIO_STATUS_BLOCK UserIosb
;
580 PIO_APC_ROUTINE UserApcRoutine
;
581 PVOID UserApcContext
;
582 } AsynchronousParameters
;
583 LARGE_INTEGER AllocationSize
;
585 PDRIVER_CANCEL CancelRoutine
;
592 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
593 PVOID DriverContext
[4];
595 struct _ETHREAD
* Thread
;
596 PCHAR AuxiliaryBuffer
;
597 LIST_ENTRY ListEntry
;
598 struct _IO_STACK_LOCATION
* CurrentStackLocation
;
599 PFILE_OBJECT OriginalFileObject
;
604 IO_STACK_LOCATION Stack
[1];
607 #define VPB_MOUNTED 0x00000001
608 #define VPB_LOCKED 0x00000002
609 #define VPB_PERSISTENT 0x00000004
610 #define VPB_REMOVE_PENDING 0x00000008
617 USHORT VolumeLabelLength
;
618 struct _DEVICE_OBJECT
* DeviceObject
;
619 struct _DEVICE_OBJECT
* RealDevice
;
621 ULONG ReferenceCount
;
622 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
];
626 typedef struct _DEVICE_OBJECT
631 struct _DRIVER_OBJECT
* DriverObject
;
632 struct _DEVICE_OBJECT
* NextDevice
;
633 struct _DEVICE_OBJECT
* AttachedDevice
;
634 struct _IRP
* CurrentIrp
;
637 ULONG Characteristics
;
639 PVOID DeviceExtension
;
640 DEVICE_TYPE DeviceType
;
645 WAIT_CONTEXT_BLOCK Wcb
;
647 ULONG AlignmentRequirement
;
648 KDEVICE_QUEUE DeviceQueue
;
650 ULONG ActiveThreadCount
;
651 PSECURITY_DESCRIPTOR SecurityDescriptor
;
655 struct _DEVOBJ_EXTENSION
* DeviceObjectExtension
;
657 } DEVICE_OBJECT
, *PDEVICE_OBJECT
;
660 * Dispatch routine type declaration
662 typedef NTSTATUS STDCALL
663 (*PDRIVER_DISPATCH
)(struct _DEVICE_OBJECT
*,
668 * Fast i/o routine type declaration
670 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
671 //FIXME : this type is ok for read and write, but not for all routines
672 typedef BOOLEAN STDCALL
673 (*PFAST_IO_ROUTINE
)(IN
struct _FILE_OBJECT
*FileObject
,
674 IN PLARGE_INTEGER FileOffset
,
679 OUT PIO_STATUS_BLOCK IoStatus
,
680 IN
struct _DEVICE_OBJECT
*DeviceObject
);
682 typedef struct _FAST_IO_DISPATCH
{
683 ULONG SizeOfFastIoDispatch
;
684 PFAST_IO_ROUTINE FastIoCheckIfPossible
;
685 PFAST_IO_ROUTINE FastIoRead
;
686 PFAST_IO_ROUTINE FastIoWrite
;
687 PFAST_IO_ROUTINE FastIoQueryBasicInfo
;
688 PFAST_IO_ROUTINE FastIoQueryStandardInfo
;
689 PFAST_IO_ROUTINE FastIoLock
;
690 PFAST_IO_ROUTINE FastIoUnlockSingle
;
691 PFAST_IO_ROUTINE FastIoUnlockAll
;
692 PFAST_IO_ROUTINE FastIoUnlockAllByKey
;
693 PFAST_IO_ROUTINE FastIoDeviceControl
;
694 PFAST_IO_ROUTINE AcquireFileForNtCreateSection
;
695 PFAST_IO_ROUTINE ReleaseFileForNtCreateSection
;
696 PFAST_IO_ROUTINE FastIoDetachDevice
;
697 PFAST_IO_ROUTINE FastIoQueryNetworkOpenInfo
;
698 PFAST_IO_ROUTINE AcquireForModWrite
;
699 PFAST_IO_ROUTINE MdlRead
;
700 PFAST_IO_ROUTINE MdlReadComplete
;
701 PFAST_IO_ROUTINE PrepareMdlWrite
;
702 PFAST_IO_ROUTINE MdlWriteComplete
;
703 PFAST_IO_ROUTINE FastIoReadCompressed
;
704 PFAST_IO_ROUTINE FastIoWriteCompressed
;
705 PFAST_IO_ROUTINE MdlReadCompleteCompressed
;
706 PFAST_IO_ROUTINE MdlWriteCompleteCompressed
;
707 PFAST_IO_ROUTINE FastIoQueryOpen
;
708 PFAST_IO_ROUTINE ReleaseForModWrite
;
709 PFAST_IO_ROUTINE AcquireForCcFlush
;
710 PFAST_IO_ROUTINE ReleaseForCcFlush
;
711 } FAST_IO_DISPATCH
, *PFAST_IO_DISPATCH
;
714 * Dispatch routine type declaration
717 (*PDRIVER_STARTIO
)(IN PDEVICE_OBJECT DeviceObject
,
721 * Dispatch routine type declaration
723 typedef NTSTATUS STDCALL
724 (*PDRIVER_UNLOAD
)(struct _DRIVER_OBJECT
*);
726 typedef NTSTATUS STDCALL
727 (*PDRIVER_ADD_DEVICE
)(IN
struct _DRIVER_OBJECT
*DriverObject
,
728 IN
struct _DEVICE_OBJECT
*PhysicalDeviceObject
);
731 typedef struct _DRIVER_EXTENSION
733 struct _DRIVER_OBJECT
* DriverObject
;
734 PDRIVER_ADD_DEVICE AddDevice
;
736 UNICODE_STRING ServiceKeyName
;
737 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
741 struct _FAST_IO_DISPATCH_TABLE
744 PFAST_IO_DISPATCH Dispatch
;
746 } FAST_IO_DISPATCH_TABLE
, * PFAST_IO_DISPATCH_TABLE
;
749 typedef struct _DRIVER_OBJECT
753 PDEVICE_OBJECT DeviceObject
;
758 PDRIVER_EXTENSION DriverExtension
;
759 UNICODE_STRING DriverName
;
760 PUNICODE_STRING HardwareDatabase
;
762 PFAST_IO_DISPATCH_TABLE FastIoDispatch
;
764 PFAST_IO_DISPATCH FastIoDispatch
;
766 PDRIVER_INITIALIZE DriverInit
;
767 PDRIVER_STARTIO DriverStartIo
;
768 PDRIVER_UNLOAD DriverUnload
;
769 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
770 } DRIVER_OBJECT
, *PDRIVER_OBJECT
;
773 typedef struct _CONFIGURATION_INFORMATION
782 BOOLEAN AtDiskPrimaryAddressClaimed
;
783 BOOLEAN AtDiskSecondaryAddressClaimed
;
784 } CONFIGURATION_INFORMATION
, *PCONFIGURATION_INFORMATION
;
787 (*PIO_DPC_ROUTINE
)(PKDPC Dpc
,
788 PDEVICE_OBJECT DeviceObject
,
793 (*PIO_TIMER_ROUTINE
)(PDEVICE_OBJECT DeviceObject
,
796 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
797 typedef struct _PARTITION_INFORMATION
799 LARGE_INTEGER StartingOffset
;
800 LARGE_INTEGER PartitionLength
;
802 ULONG PartitionNumber
;
804 BOOLEAN BootIndicator
;
805 BOOLEAN RecognizedPartition
;
806 BOOLEAN RewritePartition
;
807 } PARTITION_INFORMATION
, *PPARTITION_INFORMATION
;
810 typedef struct _DRIVER_LAYOUT_INFORMATION
812 ULONG PartitionCount
;
814 PARTITION_INFORMATION PartitionEntry
[1];
815 } DRIVER_LAYOUT_INFORMATION
, *PDRIVER_LAYOUT_INFORMATION
;
818 typedef IO_ALLOCATION_ACTION STDCALL
819 (*PDRIVER_CONTROL
)(PDEVICE_OBJECT DeviceObject
,
821 PVOID MapRegisterBase
,
823 #if (_WIN32_WINNT >= 0x0400)
825 (*PFSDNOTIFICATIONPROC
)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject
,
826 IN BOOLEAN DriverActive
);
827 #endif // (_WIN32_WINNT >= 0x0400)
829 #endif /* __INCLUDE_DDK_IOTYPES_H */