NTOSKRNL.FSRtl MDL stubs added.
[reactos.git] / reactos / include / ddk / iotypes.h
1 /* $Id: iotypes.h,v 1.11 2000/03/05 19:17:37 ea Exp $
2 *
3 */
4
5 #ifndef __INCLUDE_DDK_IOTYPES_H
6 #define __INCLUDE_DDK_IOTYPES_H
7
8 /*
9 * These are referenced before they can be fully defined
10 */
11 struct _DRIVER_OBJECT;
12 struct _FILE_OBJECT;
13 struct _DEVICE_OBJECT;
14 struct _IRP;
15 struct _IO_STATUS_BLOCK;
16
17 /* SIMPLE TYPES *************************************************************/
18
19 enum
20 {
21 DeallocateObject,
22 KeepObject,
23 };
24
25
26 typedef enum _CREATE_FILE_TYPE
27 {
28 CreateFileTypeNone,
29 CreateFileTypeNamedPipe,
30 CreateFileTypeMailslot
31 } CREATE_FILE_TYPE;
32
33
34 typedef ULONG INTERFACE_TYPE;
35 typedef INTERFACE_TYPE* PINTERFACE_TYPE;
36
37 /*
38 * FIXME: Definition needed
39 */
40 typedef struct _SHARE_ACCESS
41 {
42 } SHARE_ACCESS, *PSHARE_ACCESS;
43
44 /* FUNCTION TYPES ************************************************************/
45
46 typedef VOID (*PDRIVER_REINITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
47 PVOID Context,
48 ULONG Count);
49
50 typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
51 PUNICODE_STRING Pathname,
52 INTERFACE_TYPE BusType,
53 ULONG BusNumber,
54 PKEY_VALUE_FULL_INFORMATION* BI,
55 CONFIGURATION_TYPE ControllerType,
56 ULONG ControllerNumber,
57 PKEY_VALUE_FULL_INFORMATION* CI,
58 CONFIGURATION_TYPE PeripheralType,
59 ULONG PeripheralNumber,
60 PKEY_VALUE_FULL_INFORMATION* PI);
61
62 typedef NTSTATUS (*PIO_COMPLETION_ROUTINE)(struct _DEVICE_OBJECT* DeviceObject,
63 struct _IRP* Irp,
64 PVOID Context);
65
66 typedef VOID (*PIO_APC_ROUTINE) (PVOID ApcContext,
67 struct _IO_STATUS_BLOCK* IoStatusBlock,
68 ULONG Reserved);
69
70
71 /* STRUCTURE TYPES ***********************************************************/
72
73 typedef struct _ADAPTER_OBJECT
74 {
75 } ADAPTER_OBJECT, *PADAPTER_OBJECT;
76
77 /*
78 * PURPOSE: Special timer associated with each device
79 * NOTES: This is a guess
80 */
81 typedef struct _IO_TIMER
82 {
83 KTIMER timer;
84 KDPC dpc;
85 } IO_TIMER, *PIO_TIMER;
86
87 typedef struct _IO_SECURITY_CONTEXT
88 {
89 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
90 PACCESS_STATE AccessState;
91 ACCESS_MASK DesiredAccess;
92 ULONG FullCreateOptions;
93 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
94
95 /*
96 * PURPOSE: IRP stack location
97 */
98 typedef struct _IO_STACK_LOCATION
99 {
100 UCHAR MajorFunction;
101 UCHAR MinorFunction;
102 UCHAR Flags;
103 UCHAR Control;
104
105 union
106 {
107 struct
108 {
109 PIO_SECURITY_CONTEXT SecurityContext;
110 ULONG Options;
111 USHORT FileAttributes;
112 USHORT ShareAccess;
113 ULONG EaLength;
114 } Create;
115 struct
116 {
117 ULONG Length;
118 ULONG Key;
119 LARGE_INTEGER ByteOffset;
120 } Read;
121 struct
122 {
123 ULONG Length;
124 ULONG Key;
125 LARGE_INTEGER ByteOffset;
126 } Write;
127 struct
128 {
129 ULONG OutputBufferLength;
130 ULONG InputBufferLength;
131 ULONG IoControlCode;
132 PVOID Type3InputBuffer;
133 } DeviceIoControl;
134 struct
135 {
136 struct _VPB* Vpb;
137 struct _DEVICE_OBJECT* DeviceObject;
138 } Mount;
139 struct {
140 ULONG Length;
141 FILE_INFORMATION_CLASS FileInformationClass;
142 } QueryFile;
143 struct {
144 ULONG Length;
145 FS_INFORMATION_CLASS FileInformationClass;
146 } QueryVolume;
147 struct {
148 ULONG Length;
149 FS_INFORMATION_CLASS FileInformationClass;
150 } SetVolume;
151 struct {
152 ULONG Length;
153 FILE_INFORMATION_CLASS FileInformationClass;
154 struct _FILE_OBJECT* FileObject;
155 union {
156 struct {
157 BOOLEAN ReplaceIfExists;
158 BOOLEAN AdvanceOnly;
159 } d;
160 ULONG ClusterCount;
161 HANDLE DeleteHandle;
162 } u;
163 } SetFile;
164 struct
165 {
166 ULONG Length;
167 PUNICODE_STRING FileName;
168 FILE_INFORMATION_CLASS FileInformationClass;
169 ULONG FileIndex;
170 } QueryDirectory;
171 } Parameters;
172
173 PIO_COMPLETION_ROUTINE CompletionRoutine;
174 PVOID CompletionContext;
175
176 struct _DEVICE_OBJECT* DeviceObject;
177
178 struct _FILE_OBJECT* FileObject;
179 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
180
181 typedef struct _IO_STATUS_BLOCK
182 {
183 NTSTATUS Status;
184 ULONG Information;
185 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
186
187 /*
188 * Driver entry point declaration
189 */
190 typedef NTSTATUS (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
191 PUNICODE_STRING RegistryPath);
192
193 /*
194 * Driver cancel declaration
195 */
196 typedef NTSTATUS (*PDRIVER_CANCEL)(struct _DEVICE_OBJECT* DeviceObject,
197 struct _IRP* RegistryPath);
198
199
200 typedef struct _SECTION_OBJECT_POINTERS
201 {
202 PVOID DataSectionObject;
203 PVOID SharedCacheMap;
204 PVOID ImageSectionObject;
205 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
206
207 typedef struct _IO_COMPLETION_CONTEXT
208 {
209 PVOID Port;
210 ULONG Key;
211 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
212
213 #define FO_FILE_OPEN 0x00000001
214 #define FO_SYNCHRONOUS_IO 0x00000002
215 #define FO_ALERTABLE_IO 0x00000004
216 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
217 #define FO_WRITE_THROUGH 0x00000010
218 #define FO_SEQUENTIAL_ONLY 0x00000020
219 #define FO_CACHE_SUPPORTED 0x00000040
220 #define FO_NAMED_PIPE 0x00000080
221 #define FO_STREAM_FILE 0x00000100
222 #define FO_MAILSLOT 0x00000200
223 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
224 #define FO_DIRECT_DEVICE_OPEN 0x00000800
225 #define FO_FILE_MODIFIED 0x00001000
226 #define FO_FILE_SIZE_CHANGED 0x00002000
227 #define FO_CLEANUP_COMPLETE 0x00004000
228 #define FO_TEMPORARY_FILE 0x00008000
229 #define FO_DELETE_ON_CLOSE 0x00010000
230 #define FO_OPENED_CASE_SENSITIVE 0x00020000
231 #define FO_HANDLE_CREATED 0x00040000
232 #define FO_FILE_FAST_IO_READ 0x00080000
233
234 typedef struct _FILE_OBJECT
235 {
236 CSHORT Type;
237 CSHORT Size;
238 struct _DEVICE_OBJECT* DeviceObject;
239 struct _VPB* Vpb;
240 PVOID FsContext;
241 PVOID FsContext2;
242 PSECTION_OBJECT_POINTERS SectionObjectPointers;
243 PVOID PrivateCacheMap;
244 NTSTATUS FinalStatus;
245 struct _FILE_OBJECT* RelatedFileObject;
246 BOOLEAN LockOperation;
247 BOOLEAN DeletePending;
248 BOOLEAN ReadAccess;
249 BOOLEAN WriteAccess;
250 BOOLEAN DeleteAccess;
251 BOOLEAN SharedRead;
252 BOOLEAN SharedWrite;
253 BOOLEAN SharedDelete;
254 ULONG Flags;
255 UNICODE_STRING FileName;
256 LARGE_INTEGER CurrentByteOffset;
257 ULONG Waiters;
258 ULONG Busy;
259 PVOID LastLock;
260 KEVENT Lock;
261 KEVENT Event;
262 PIO_COMPLETION_CONTEXT CompletionContext;
263 } FILE_OBJECT, *PFILE_OBJECT;
264
265
266 typedef struct _IRP
267 {
268 PMDL MdlAddress;
269 ULONG Flags;
270 union
271 {
272 struct _IRP* MasterIrp;
273 LONG IrpCount;
274 PVOID SystemBuffer;
275 } AssociatedIrp;
276 LIST_ENTRY ThreadListEntry;
277 IO_STATUS_BLOCK IoStatus;
278 KPROCESSOR_MODE RequestorMode;
279 BOOLEAN PendingReturned;
280 BOOLEAN Cancel;
281 KIRQL CancelIrql;
282 PDRIVER_CANCEL CancelRoutine;
283 PVOID UserBuffer;
284 PVOID ApcEnvironment;
285 ULONG AllocationFlags;
286 PIO_STATUS_BLOCK UserIosb;
287 PKEVENT UserEvent;
288 union
289 {
290 struct
291 {
292 PIO_APC_ROUTINE UserApcRoutine;
293 PVOID UserApcContext;
294 } AsynchronousParameters;
295 LARGE_INTEGER AllocationSize;
296 } Overlay;
297 union
298 {
299 struct
300 {
301 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
302 struct _ETHREAD* Thread;
303 PCHAR AuxiliaryBuffer;
304 LIST_ENTRY ListEntry;
305 struct _IO_STACK_LOCATION* CurrentStackLocation;
306 PFILE_OBJECT OriginalFileObject;
307 } Overlay;
308 KAPC Apc;
309 ULONG CompletionKey;
310 } Tail;
311 CHAR StackCount;
312 CHAR CurrentLocation;
313 IO_STACK_LOCATION Stack[1];
314 } IRP, *PIRP;
315
316 #define VPB_MOUNTED 0x00000001
317 #define VPB_LOCKED 0x00000002
318 #define VPB_PERSISTENT 0x00000004
319 #define VPB_REMOVE_PENDING 0x00000008
320
321 typedef struct _VPB
322 {
323 CSHORT Type;
324 CSHORT Size;
325 USHORT Flags;
326 USHORT VolumeLabelLength;
327 struct _DEVICE_OBJECT* DeviceObject;
328 struct _DEVICE_OBJECT* RealDevice;
329 ULONG SerialNumber;
330 ULONG ReferenceCount;
331 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH];
332 } VPB, *PVPB;
333
334
335 typedef struct _DEVICE_OBJECT
336 {
337 CSHORT Type;
338 CSHORT Size;
339 LONG ReferenceCount;
340 struct _DRIVER_OBJECT* DriverObject;
341 struct _DEVICE_OBJECT* NextDevice;
342 struct _DEVICE_OBJECT* AttachedDevice;
343 struct _IRP* CurrentIrp;
344 PIO_TIMER Timer;
345 ULONG Flags;
346 ULONG Characteristics;
347 PVPB Vpb;
348 PVOID DeviceExtension;
349 DEVICE_TYPE DeviceType;
350 CCHAR StackSize;
351 union
352 {
353 LIST_ENTRY ListHead;
354 WAIT_CONTEXT_BLOCK Wcb;
355 } Queue;
356 ULONG AlignmentRequirement;
357 KDEVICE_QUEUE DeviceQueue;
358 KDPC Dpc;
359 ULONG ActiveThreadCount;
360 PSECURITY_DESCRIPTOR SecurityDescriptor;
361 KEVENT DeviceLock;
362 USHORT SectorSize;
363 USHORT Spare1;
364 struct _DEVOBJ_EXTENSION* DeviceObjectExtension;
365 PVOID Reserved;
366 } DEVICE_OBJECT, *PDEVICE_OBJECT;
367
368 /*
369 * Dispatch routine type declaration
370 */
371 typedef NTSTATUS (*PDRIVER_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
372
373 /*
374 * Fast i/o routine type declaration
375 */
376 typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
377
378 /*
379 * Dispatch routine type declaration
380 */
381 typedef VOID (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT*, IRP*);
382
383 /*
384 * Dispatch routine type declaration
385 */
386 typedef NTSTATUS (*PDRIVER_UNLOAD)(struct _DRIVER_OBJECT*);
387
388 typedef struct _DRIVER_EXTENSION
389 {
390 struct _DRIVER_OBJECT* DriverObject;
391 PDRIVER_ADD_DEVICE AddDevice;
392 ULONG Count;
393 UNICODE_STRING ServiceKeyName;
394 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
395
396 #if 0
397 typedef
398 struct _FAST_IO_DISPATCH_TABLE
399 {
400 ULONG Count;
401 PFAST_IO_DISPATCH Dispatch;
402
403 } FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE;
404 #endif
405
406 typedef struct _DRIVER_OBJECT
407 {
408 CSHORT Type;
409 CSHORT Size;
410 PDEVICE_OBJECT DeviceObject;
411 ULONG Flags;
412 PVOID DriverStart;
413 ULONG DriverSize;
414 PVOID DriverSection;
415 PDRIVER_EXTENSION DriverExtension;
416 UNICODE_STRING DriverName;
417 PUNICODE_STRING HardwareDatabase;
418 #if 0
419 PFAST_IO_DISPATCH_TABLE FastIoDispatch;
420 #else
421 PFAST_IO_DISPATCH FastIoDispatch;
422 #endif
423 PDRIVER_INITIALIZE DriverInit;
424 PDRIVER_STARTIO DriverStartIo;
425 PDRIVER_UNLOAD DriverUnload;
426 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
427 } DRIVER_OBJECT, *PDRIVER_OBJECT;
428
429
430 typedef struct _CONFIGURATION_INFORMATION
431 {
432 ULONG DiskCount;
433 ULONG FloppyCount;
434 ULONG CDRomCount;
435 ULONG TapeCount;
436 ULONG ScsiPortCount;
437 ULONG SerialCount;
438 ULONG ParallelCount;
439 BOOLEAN AtDiskPrimaryAddressClaimed;
440 BOOLEAN AtDiskSecondaryAddressClaimed;
441 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
442
443 typedef VOID (*PIO_DPC_ROUTINE)(PKDPC Dpc,
444 PDEVICE_OBJECT DeviceObject,
445 PIRP Irp,
446 PVOID Context);
447
448 typedef VOID (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
449 PVOID Context);
450
451 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
452 typedef struct _PARTITION_INFORMATION
453 {
454 LARGE_INTEGER StartingOffset;
455 LARGE_INTEGER PartitionLength;
456 ULONG HiddenSectors;
457 ULONG PartitionNumber;
458 UCHAR PartitionType;
459 BOOLEAN BootIndicator;
460 BOOLEAN RecognizedPartition;
461 BOOLEAN RewritePartition;
462 } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
463 #endif
464
465 typedef struct _DRIVER_LAYOUT_INFORMATION
466 {
467 ULONG PartitionCount;
468 ULONG Signature;
469 PARTITION_INFORMATION PartitionEntry[1];
470 } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
471
472
473
474
475
476 typedef struct _IO_RESOURCE_DESCRIPTOR
477 {
478 UCHAR Option;
479 UCHAR Type;
480 UCHAR SharedDisposition;
481
482 /*
483 * Reserved for system use
484 */
485 UCHAR Spare1;
486
487 USHORT Flags;
488
489 /*
490 * Reserved for system use
491 */
492 UCHAR Spare2;
493
494 union
495 {
496 struct
497 {
498 ULONG Length;
499 ULONG Alignment;
500 PHYSICAL_ADDRESS MinimumAddress;
501 PHYSICAL_ADDRESS MaximumAddress;
502 } Port;
503 struct
504 {
505 ULONG Length;
506 ULONG Alignment;
507 PHYSICAL_ADDRESS MinimumAddress;
508 PHYSICAL_ADDRESS MaximumAddress;
509 } Memory;
510 struct
511 {
512 ULONG MinimumVector;
513 ULONG MaximumVector;
514 } Interrupt;
515 struct
516 {
517 ULONG MinimumChannel;
518 ULONG MaximumChannel;
519 } Dma;
520 } u;
521 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
522
523 typedef struct _IO_RESOURCE_LIST
524 {
525 USHORT Version;
526 USHORT Revision;
527 ULONG Count;
528 IO_RESOURCE_DESCRIPTOR Descriptors[1];
529 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
530
531 typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
532 {
533 /*
534 * List size in bytes
535 */
536 ULONG ListSize;
537
538 /*
539 * System defined enum for the bus
540 */
541 INTERFACE_TYPE InterfaceType;
542
543 ULONG BusNumber;
544 ULONG SlotNumber;
545 ULONG Reserved[3];
546 ULONG AlternativeLists;
547 IO_RESOURCE_LIST List[1];
548 } IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
549
550 typedef struct
551 {
552 UCHAR Type;
553 UCHAR ShareDisposition;
554 USHORT Flags;
555 union
556 {
557 struct
558 {
559 PHYSICAL_ADDRESS Start;
560 ULONG Length;
561 } Port;
562 struct
563 {
564 ULONG Level;
565 ULONG Vector;
566 ULONG Affinity;
567 } Interrupt;
568 struct
569 {
570 PHYSICAL_ADDRESS Start;
571 ULONG Length;
572 } Memory;
573 struct
574 {
575 ULONG Channel;
576 ULONG Port;
577 ULONG Reserved1;
578 } Dma;
579 struct
580 {
581 ULONG DataSize;
582 ULONG Reserved1;
583 ULONG Reserved2;
584 } DeviceSpecificData;
585 } u;
586 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
587
588 typedef struct
589 {
590 USHORT Version;
591 USHORT Revision;
592 ULONG Count;
593 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
594 } CM_PARTIAL_RESOURCE_LIST;
595
596 typedef struct
597 {
598 INTERFACE_TYPE InterfaceType;
599 ULONG BusNumber;
600 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
601 } CM_FULL_RESOURCE_DESCRIPTOR;
602
603 typedef struct
604 {
605 ULONG Count;
606 CM_FULL_RESOURCE_DESCRIPTOR List[1];
607 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
608
609
610 #endif __INCLUDE_DDK_IOTYPES_H