5 #ifndef __INCLUDE_DDK_IOTYPES_H
6 #define __INCLUDE_DDK_IOTYPES_H
9 * These are referenced before they can be fully defined
11 struct _DRIVER_OBJECT
;
13 struct _DEVICE_OBJECT
;
15 struct _IO_STATUS_BLOCK
;
17 /* SIMPLE TYPES *************************************************************/
19 typedef ULONG INTERFACE_TYPE
;
20 typedef INTERFACE_TYPE
* PINTERFACE_TYPE
;
21 typedef ULONG CONFIGURATION_TYPE
;
22 typedef CONFIGURATION_TYPE
* PCONFIGURATION_TYPE
;
25 * FIXME: Definition needed
27 typedef struct _SHARE_ACCESS
29 } SHARE_ACCESS
, *PSHARE_ACCESS
;
31 /* FUNCTION TYPES ************************************************************/
33 typedef VOID (*PDRIVER_REINITIALIZE
)(struct _DRIVER_OBJECT
* DriverObject
,
37 typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE
)(PVOID Context
,
38 PUNICODE_STRING Pathname
,
39 INTERFACE_TYPE BusType
,
41 PKEY_VALUE_FULL_INFORMATION
* BI
,
42 CONFIGURATION_TYPE ControllerType
,
43 ULONG ControllerNumber
,
44 PKEY_VALUE_FULL_INFORMATION
* CI
,
45 CONFIGURATION_TYPE PeripheralType
,
46 ULONG PeripheralNumber
,
47 PKEY_VALUE_FULL_INFORMATION
* PI
);
49 typedef NTSTATUS (*PIO_COMPLETION_ROUTINE
)(struct _DEVICE_OBJECT
* DeviceObject
,
53 typedef VOID (*PIO_APC_ROUTINE
) (PVOID ApcContext
,
54 struct _IO_STATUS_BLOCK
* IoStatusBlock
,
58 /* STRUCTURE TYPES ***********************************************************/
61 * PURPOSE: Special timer associated with each device
63 typedef struct _IO_TIMER
65 } IO_TIMER
, PIO_TIMER
;
69 * PURPOSE: IRP stack location
71 typedef struct _IO_STACK_LOCATION
79 * Further information about request type
89 * FUNCTION: Various flags including for the io completion routine
94 * Parameters for request
101 * Number of bytes to be transferrred
106 * Possibly used to sort incoming request (to be documented)
111 * Optional starting offset for read
113 LARGE_INTEGER ByteOffset
;
119 LARGE_INTEGER ByteOffset
;
123 ULONG OutputBufferLength
;
124 ULONG InputBufferLength
;
126 PVOID Type3InputBuffer
;
132 * PURPOSE: Completion routine
133 * NOTE: If this is the nth stack location (where the 1st is passed to the
134 * highest level driver) then this is the completion routine set by
137 PIO_COMPLETION_ROUTINE CompletionRoutine
;
138 PVOID CompletionContext
;
139 BOOLEAN InvokeOnSuccess
;
140 BOOLEAN InvokeOnError
;
141 BOOLEAN InvokeOnCancel
;
144 * Driver created device object representing the target device
146 struct _DEVICE_OBJECT
* DeviceObject
;
149 * File object (if any) associated with DeviceObject
151 struct _FILE_OBJECT
* FileObject
;
152 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
154 typedef struct _IO_STATUS_BLOCK
157 * Is the completion status
162 * Is a request dependant value
165 } IO_STATUS_BLOCK
, *PIO_STATUS_BLOCK
;
168 * Driver entry point declaration
170 typedef NTSTATUS (*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
* DriverObject
,
171 PUNICODE_STRING RegistryPath
);
174 * Driver cancel declaration
176 typedef NTSTATUS (*PDRIVER_CANCEL
)(struct _DRIVER_OBJECT
* DriverObject
,
177 PUNICODE_STRING RegistryPath
);
185 struct _IRP
* MasterIrp
;
189 LIST_ENTRY ThreadListEntry
;
190 IO_STATUS_BLOCK IoStatus
;
191 KPROCESSOR_MODE RequestorMode
;
192 BOOLEAN PendingReturned
;
195 PDRIVER_CANCEL CancelRoutine
;
197 PVOID ApcEnvironment
;
198 ULONG AllocationFlags
;
199 PIO_STATUS_BLOCK UserIosb
;
205 PIO_APC_ROUTINE UserApcRoutine
;
206 PVOID UserApcContext
;
207 } AsynchronousParameters
;
208 LARGE_INTEGER AllocationSize
;
214 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
217 PCHAR AuxiliaryBuffer
;
218 LIST_ENTRY ListEntry
;
219 struct _IO_STACK_LOCATION
* CurrentStackLocation
;
220 // PFILE_OBJECT OriginalFileObject;
221 PVOID OriginalFileObject
;
226 ULONG CurrentLocation
;
227 IO_STACK_LOCATION Stack
[1];
236 USHORT VolumeLabelLength
;
237 struct _DEVICE_OBJECT
* DeviceObject
;
238 struct _DEVICE_OBJECT
* RealDevice
;
240 ULONG ReferenceCount
;
241 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
245 typedef struct _DEVICE_OBJECT
250 struct _DRIVER_OBJECT
* DriverObject
;
251 struct _DEVICE_OBJECT
* NextDevice
;
252 struct _DEVICE_OBJECT
* AttachedDevice
;
253 struct _IRP
* CurrentIrp
;
256 ULONG Characteristics
;
258 PVOID DeviceExtension
;
259 DEVICE_TYPE DeviceType
;
264 WAIT_CONTEXT_BLOCK Wcb
;
266 ULONG AlignmentRequirement
;
267 KDEVICE_QUEUE DeviceQueue
;
269 ULONG ActiveThreadCount
;
270 PSECURITY_DESCRIPTOR SecurityDescriptor
;
274 struct _DEVOBJ_EXTENSION
* DeviceObjectExtension
;
276 } DEVICE_OBJECT
, *PDEVICE_OBJECT
;
279 * Dispatch routine type declaration
281 typedef NTSTATUS (*PDRIVER_DISPATCH
)(struct _DEVICE_OBJECT
*, IRP
*);
284 * Fast i/o routine type declaration
286 typedef NTSTATUS (*PFAST_IO_DISPATCH
)(struct _DEVICE_OBJECT
*, IRP
*);
289 * Dispatch routine type declaration
291 typedef NTSTATUS (*PDRIVER_STARTIO
)(struct _DEVICE_OBJECT
*, IRP
*);
294 * Dispatch routine type declaration
296 typedef NTSTATUS (*PDRIVER_UNLOAD
)(struct _DRIVER_OBJECT
*);
298 typedef struct _DRIVER_EXTENSION
300 struct _DRIVER_OBJECT
* DriverObject
;
301 PDRIVER_ADD_DEVICE AddDevice
;
303 UNICODE_STRING ServiceKeyName
;
304 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
306 typedef struct _DRIVER_OBJECT
309 * PURPOSE: Magic values for debugging
313 PDEVICE_OBJECT DeviceObject
;
318 PDRIVER_EXTENSION DriverExtension
;
319 UNICODE_STRING DriverName
;
320 PUNICODE_STRING HardwareDatabase
;
321 PFAST_IO_DISPATCH FastIoDispatch
;
322 PDRIVER_INITIALIZE DriverInit
;
323 PDRIVER_STARTIO DriverStartIo
;
324 PDRIVER_UNLOAD DriverUnload
;
325 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
326 } DRIVER_OBJECT
, *PDRIVER_OBJECT
;
331 typedef struct _FILE_OBJECT
333 PDEVICE_OBJECT DeviceObject
;
335 } FILE_OBJECT
, *PFILE_OBJECT
;
337 typedef struct _CONFIGURATION_INFORMATION
346 BOOLEAN AtDiskPrimaryAddressClaimed
;
347 BOOLEAN AtDiskSecondaryAddressClaimed
;
348 } CONFIGURATION_INFORMATION
, *PCONFIGURATION_INFORMATION
;
350 typedef VOID (*PIO_DPC_ROUTINE
)(PKDPC Dpc
,
351 PDEVICE_OBJECT DeviceObject
,
355 typedef VOID (*PIO_TIMER_ROUTINE
)(PDEVICE_OBJECT DeviceObject
,
358 #if PKEY_VALUE_FULL_INFORMATION_DEFINED
359 typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE
)(PVOID Context
,
360 PUNICODE_STRING PathName
,
361 INTERFACE_TYPE BusType
,
363 PKEY_VALUE_FULL_INFORMATION
* BusKey
,
364 CONFIGURATION_TYPE ControllerType
,
365 ULONG ControllerNumber
,
366 PKEY_VALUE_FULL_INFORMATION
* CtrlKey
,
367 CONFIGURATION_TYPE PeripheralType
,
368 ULONG PeripheralNumber
,
369 PKEY_VALUE_FULL_INFORMATION
* PrphKey
);
372 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
373 typedef struct _PARTITION_INFORMATION
375 LARGE_INTEGER StartingOffset
;
376 LARGE_INTEGER PartitionLength
;
378 ULONG PartitionNumber
;
380 BOOLEAN BootIndicator
;
381 BOOLEAN RecognizedPartition
;
382 BOOLEAN RewritePartition
;
383 } PARTITION_INFORMATION
, *PPARTITION_INFORMATION
;
386 typedef struct _DRIVER_LAYOUT_INFORMATION
388 ULONG PartitionCount
;
390 PARTITION_INFORMATION PartitionEntry
[1];
391 } DRIVER_LAYOUT_INFORMATION
, *PDRIVER_LAYOUT_INFORMATION
;
393 #endif __INCLUDE_DDK_IOTYPES_H