Added prototype for IoInitializeWorkerThreads, possibly temporary.
[reactos.git] / reactos / include / ddk / iotypes.h
1 /* $Id: iotypes.h,v 1.41 2002/09/08 10:47:44 chorns Exp $
2 *
3 */
4
5 #ifndef __INCLUDE_DDK_IOTYPES_H
6 #define __INCLUDE_DDK_IOTYPES_H
7
8 #include <ntos/disk.h>
9 #include <ntos/file.h>
10
11 #ifdef __NTOSKRNL__
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;
17 #else
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;
23 #endif
24
25 /*
26 * These are referenced before they can be fully defined
27 */
28 struct _DRIVER_OBJECT;
29 struct _FILE_OBJECT;
30 struct _DEVICE_OBJECT;
31 struct _IRP;
32 struct _IO_STATUS_BLOCK;
33 struct _SCSI_REQUEST_BLOCK;
34
35 /* SIMPLE TYPES *************************************************************/
36
37 enum
38 {
39 DeallocateObject,
40 KeepObject,
41 };
42
43
44 typedef enum _CREATE_FILE_TYPE
45 {
46 CreateFileTypeNone,
47 CreateFileTypeNamedPipe,
48 CreateFileTypeMailslot
49 } CREATE_FILE_TYPE;
50
51
52 typedef struct _SHARE_ACCESS
53 {
54 ULONG OpenCount;
55 ULONG Readers;
56 ULONG Writers;
57 ULONG Deleters;
58 ULONG SharedRead;
59 ULONG SharedWrite;
60 ULONG SharedDelete;
61 } SHARE_ACCESS, *PSHARE_ACCESS;
62
63 /* FUNCTION TYPES ************************************************************/
64
65 typedef VOID STDCALL
66 (*PDRIVER_REINITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
67 PVOID Context,
68 ULONG Count);
69
70 typedef NTSTATUS STDCALL
71 (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
72 PUNICODE_STRING Pathname,
73 INTERFACE_TYPE BusType,
74 ULONG BusNumber,
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);
82
83 typedef NTSTATUS STDCALL
84 (*PIO_COMPLETION_ROUTINE)(struct _DEVICE_OBJECT* DeviceObject,
85 struct _IRP* Irp,
86 PVOID Context);
87
88 typedef VOID STDCALL
89 (*PIO_APC_ROUTINE)(PVOID ApcContext,
90 struct _IO_STATUS_BLOCK* IoStatusBlock,
91 ULONG Reserved);
92
93
94 /* STRUCTURE TYPES ***********************************************************/
95
96 typedef struct _ADAPTER_OBJECT ADAPTER_OBJECT, *PADAPTER_OBJECT;
97
98 /*
99 * PURPOSE: Special timer associated with each device
100 * NOTES: This is a guess
101 */
102 typedef struct _IO_TIMER
103 {
104 KTIMER timer;
105 KDPC dpc;
106 } IO_TIMER, *PIO_TIMER;
107
108 typedef struct _IO_SECURITY_CONTEXT
109 {
110 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
111 PACCESS_STATE AccessState;
112 ACCESS_MASK DesiredAccess;
113 ULONG FullCreateOptions;
114 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
115
116
117 typedef struct _IO_RESOURCE_DESCRIPTOR
118 {
119 UCHAR Option;
120 UCHAR Type;
121 UCHAR ShareDisposition;
122
123 /*
124 * Reserved for system use
125 */
126 UCHAR Spare1;
127
128 USHORT Flags;
129
130 /*
131 * Reserved for system use
132 */
133 UCHAR Spare2;
134
135 union
136 {
137 struct
138 {
139 ULONG Length;
140 ULONG Alignment;
141 PHYSICAL_ADDRESS MinimumAddress;
142 PHYSICAL_ADDRESS MaximumAddress;
143 } Port;
144 struct
145 {
146 ULONG Length;
147 ULONG Alignment;
148 PHYSICAL_ADDRESS MinimumAddress;
149 PHYSICAL_ADDRESS MaximumAddress;
150 } Memory;
151 struct
152 {
153 ULONG MinimumVector;
154 ULONG MaximumVector;
155 } Interrupt;
156 struct
157 {
158 ULONG MinimumChannel;
159 ULONG MaximumChannel;
160 } Dma;
161 } u;
162 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
163
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
169
170 typedef struct _IO_RESOURCE_LIST
171 {
172 USHORT Version;
173 USHORT Revision;
174 ULONG Count;
175 IO_RESOURCE_DESCRIPTOR Descriptors[1];
176 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
177
178 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
179 {
180 /*
181 * List size in bytes
182 */
183 ULONG ListSize;
184
185 /*
186 * System defined enum for the bus
187 */
188 INTERFACE_TYPE InterfaceType;
189
190 ULONG BusNumber;
191 ULONG SlotNumber;
192 ULONG Reserved[3];
193 ULONG AlternativeLists;
194 IO_RESOURCE_LIST List[1];
195 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
196
197 typedef struct
198 {
199 UCHAR Type;
200 UCHAR ShareDisposition;
201 USHORT Flags;
202 union
203 {
204 struct
205 {
206 PHYSICAL_ADDRESS Start;
207 ULONG Length;
208 } __attribute__((packed)) Port;
209 struct
210 {
211 ULONG Level;
212 ULONG Vector;
213 ULONG Affinity;
214 } __attribute__((packed))Interrupt;
215 struct
216 {
217 PHYSICAL_ADDRESS Start;
218 ULONG Length;
219 } __attribute__((packed))Memory;
220 struct
221 {
222 ULONG Channel;
223 ULONG Port;
224 ULONG Reserved1;
225 } __attribute__((packed))Dma;
226 struct
227 {
228 ULONG DataSize;
229 ULONG Reserved1;
230 ULONG Reserved2;
231 } __attribute__((packed))DeviceSpecificData;
232 } __attribute__((packed)) u;
233 } __attribute__((packed)) CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
234
235 typedef struct
236 {
237 USHORT Version;
238 USHORT Revision;
239 ULONG Count;
240 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
241 } __attribute__((packed))CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
242
243 typedef struct
244 {
245 INTERFACE_TYPE InterfaceType;
246 ULONG BusNumber;
247 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
248 } __attribute__((packed)) CM_FULL_RESOURCE_DESCRIPTOR;
249
250 typedef struct
251 {
252 ULONG Count;
253 CM_FULL_RESOURCE_DESCRIPTOR List[1];
254 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
255
256
257 /*
258 * PURPOSE: IRP stack location
259 */
260 typedef struct __attribute__((packed)) _IO_STACK_LOCATION
261 {
262 UCHAR MajorFunction;
263 UCHAR MinorFunction;
264 UCHAR Flags;
265 UCHAR Control;
266
267 union
268 {
269 struct
270 {
271 PIO_SECURITY_CONTEXT SecurityContext;
272 ULONG Options;
273 USHORT FileAttributes;
274 USHORT ShareAccess;
275 ULONG EaLength;
276 } Create;
277 struct
278 {
279 ULONG Length;
280 ULONG Key;
281 LARGE_INTEGER ByteOffset;
282 } Read;
283 struct
284 {
285 ULONG Length;
286 ULONG Key;
287 LARGE_INTEGER ByteOffset;
288 } Write;
289 struct
290 {
291 ULONG OutputBufferLength;
292 ULONG InputBufferLength;
293 ULONG IoControlCode;
294 PVOID Type3InputBuffer;
295 } DeviceIoControl;
296 struct
297 {
298 ULONG OutputBufferLength;
299 ULONG InputBufferLength;
300 ULONG IoControlCode;
301 PVOID Type3InputBuffer;
302 } FileSystemControl;
303 struct
304 {
305 struct _VPB* Vpb;
306 struct _DEVICE_OBJECT* DeviceObject;
307 } MountVolume;
308 struct
309 {
310 struct _VPB* Vpb;
311 struct _DEVICE_OBJECT* DeviceObject;
312 } VerifyVolume;
313 struct
314 {
315 ULONG Length;
316 FILE_INFORMATION_CLASS FileInformationClass;
317 } QueryFile;
318 struct
319 {
320 ULONG Length;
321 FS_INFORMATION_CLASS FsInformationClass;
322 } QueryVolume;
323 struct
324 {
325 ULONG Length;
326 FS_INFORMATION_CLASS FsInformationClass;
327 } SetVolume;
328 struct
329 {
330 ULONG Length;
331 FILE_INFORMATION_CLASS FileInformationClass;
332 struct _FILE_OBJECT* FileObject;
333 union
334 {
335 struct
336 {
337 BOOLEAN ReplaceIfExists;
338 BOOLEAN AdvanceOnly;
339 } d;
340 ULONG ClusterCount;
341 HANDLE DeleteHandle;
342 } u;
343 } SetFile;
344 struct
345 {
346 ULONG Length;
347 PUNICODE_STRING FileName;
348 FILE_INFORMATION_CLASS FileInformationClass;
349 ULONG FileIndex;
350 } QueryDirectory;
351
352 // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS
353 struct
354 {
355 DEVICE_RELATION_TYPE Type;
356 } QueryDeviceRelations;
357
358 // Parameters for IRP_MN_QUERY_INTERFACE
359 struct
360 {
361 CONST GUID *InterfaceType;
362 USHORT Size;
363 USHORT Version;
364 PINTERFACE Interface;
365 PVOID InterfaceSpecificData;
366 } QueryInterface;
367
368 // Parameters for IRP_MN_QUERY_CAPABILITIES
369 struct
370 {
371 PDEVICE_CAPABILITIES Capabilities;
372 } DeviceCapabilities;
373
374 // Parameters for IRP_MN_QUERY_ID
375 struct
376 {
377 BUS_QUERY_ID_TYPE IdType;
378 } QueryId;
379
380 // Parameters for IRP_MN_QUERY_DEVICE_TEXT
381 struct
382 {
383 DEVICE_TEXT_TYPE DeviceTextType;
384 LCID LocaleId;
385 } QueryDeviceText;
386
387 // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION
388 struct
389 {
390 BOOLEAN InPath;
391 BOOLEAN Reserved[3];
392 DEVICE_USAGE_NOTIFICATION_TYPE Type;
393 } UsageNotification;
394
395 // Parameters for IRP_MN_WAIT_WAKE
396 struct
397 {
398 SYSTEM_POWER_STATE PowerState;
399 } WaitWake;
400
401 // Parameter for IRP_MN_POWER_SEQUENCE
402 struct
403 {
404 PPOWER_SEQUENCE PowerSequence;
405 } PowerSequence;
406
407 // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER
408 struct
409 {
410 ULONG SystemContext;
411 POWER_STATE_TYPE Type;
412 POWER_STATE State;
413 POWER_ACTION ShutdownType;
414 } Power;
415
416 // Parameters for IRP_MN_START_DEVICE
417 struct
418 {
419 PCM_RESOURCE_LIST AllocatedResources;
420 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
421 } StartDevice;
422
423 /* Parameters for IRP_MN_SCSI_CLASS */
424 struct
425 {
426 struct _SCSI_REQUEST_BLOCK *Srb;
427 } Scsi;
428
429 /* Paramters for other calls */
430 struct
431 {
432 PVOID Argument1;
433 PVOID Argument2;
434 PVOID Argument3;
435 PVOID Argument4;
436 } Others;
437 } Parameters;
438
439 struct _DEVICE_OBJECT* DeviceObject;
440 struct _FILE_OBJECT* FileObject;
441
442 PIO_COMPLETION_ROUTINE CompletionRoutine;
443 PVOID CompletionContext;
444
445 } __attribute__((packed)) IO_STACK_LOCATION, *PIO_STACK_LOCATION;
446
447
448 typedef struct _IO_STATUS_BLOCK
449 {
450 NTSTATUS Status;
451 ULONG Information;
452 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
453
454
455 typedef struct _IO_PIPE_CREATE_BUFFER
456 {
457 BOOLEAN WriteModeMessage;
458 BOOLEAN ReadModeMessage;
459 BOOLEAN NonBlocking;
460 ULONG MaxInstances;
461 ULONG InBufferSize;
462 ULONG OutBufferSize;
463 LARGE_INTEGER TimeOut;
464 } IO_PIPE_CREATE_BUFFER, *PIO_PIPE_CREATE_BUFFER;
465
466
467 typedef struct _IO_MAILSLOT_CREATE_BUFFER
468 {
469 ULONG Param; /* ?? */
470 ULONG MaxMessageSize;
471 LARGE_INTEGER TimeOut;
472 } IO_MAILSLOT_CREATE_BUFFER, *PIO_MAILSLOT_CREATE_BUFFER;
473
474
475 /*
476 * Driver entry point declaration
477 */
478 typedef NTSTATUS STDCALL
479 (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
480 PUNICODE_STRING RegistryPath);
481
482 /*
483 * Driver cancel declaration
484 */
485 typedef NTSTATUS STDCALL
486 (*PDRIVER_CANCEL)(struct _DEVICE_OBJECT* DeviceObject,
487 struct _IRP* RegistryPath);
488
489
490 typedef struct _SECTION_OBJECT_POINTERS
491 {
492 PVOID DataSectionObject;
493 PVOID SharedCacheMap;
494 PVOID ImageSectionObject;
495 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
496
497 typedef struct _IO_COMPLETION_CONTEXT
498 {
499 PVOID Port;
500 ULONG Key;
501 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
502
503 #define FO_FILE_OPEN 0x00000001
504 #define FO_SYNCHRONOUS_IO 0x00000002
505 #define FO_ALERTABLE_IO 0x00000004
506 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
507 #define FO_WRITE_THROUGH 0x00000010
508 #define FO_SEQUENTIAL_ONLY 0x00000020
509 #define FO_CACHE_SUPPORTED 0x00000040
510 #define FO_NAMED_PIPE 0x00000080
511 #define FO_STREAM_FILE 0x00000100
512 #define FO_MAILSLOT 0x00000200
513 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
514 #define FO_DIRECT_DEVICE_OPEN 0x00000800
515 #define FO_FILE_MODIFIED 0x00001000
516 #define FO_FILE_SIZE_CHANGED 0x00002000
517 #define FO_CLEANUP_COMPLETE 0x00004000
518 #define FO_TEMPORARY_FILE 0x00008000
519 #define FO_DELETE_ON_CLOSE 0x00010000
520 #define FO_OPENED_CASE_SENSITIVE 0x00020000
521 #define FO_HANDLE_CREATED 0x00040000
522 #define FO_FILE_FAST_IO_READ 0x00080000
523
524 /*
525 * ReactOS specific flags
526 */
527 #define FO_DIRECT_CACHE_READ 0x72000001
528 #define FO_DIRECT_CACHE_WRITE 0x72000002
529 #define FO_DIRECT_CACHE_PAGING_READ 0x72000004
530 #define FO_DIRECT_CACHE_PAGING_WRITE 0x72000008
531 #define FO_FCB_IS_VALID 0x72000010
532
533 typedef struct _FILE_OBJECT
534 {
535 CSHORT Type;
536 CSHORT Size;
537 struct _DEVICE_OBJECT* DeviceObject;
538 struct _VPB* Vpb;
539 PVOID FsContext;
540 PVOID FsContext2;
541 PSECTION_OBJECT_POINTERS SectionObjectPointers;
542 PVOID PrivateCacheMap;
543 NTSTATUS FinalStatus;
544 struct _FILE_OBJECT* RelatedFileObject;
545 BOOLEAN LockOperation;
546 BOOLEAN DeletePending;
547 BOOLEAN ReadAccess;
548 BOOLEAN WriteAccess;
549 BOOLEAN DeleteAccess;
550 BOOLEAN SharedRead;
551 BOOLEAN SharedWrite;
552 BOOLEAN SharedDelete;
553 ULONG Flags;
554 UNICODE_STRING FileName;
555 LARGE_INTEGER CurrentByteOffset;
556 ULONG Waiters;
557 ULONG Busy;
558 PVOID LastLock;
559 KEVENT Lock;
560 KEVENT Event;
561 PIO_COMPLETION_CONTEXT CompletionContext;
562 } FILE_OBJECT, *PFILE_OBJECT;
563
564
565 typedef struct _IRP
566 {
567 CSHORT Type;
568 USHORT Size;
569 PMDL MdlAddress;
570 ULONG Flags;
571 union
572 {
573 struct _IRP* MasterIrp;
574 LONG IrpCount;
575 PVOID SystemBuffer;
576 } AssociatedIrp;
577 LIST_ENTRY ThreadListEntry;
578 IO_STATUS_BLOCK IoStatus;
579 KPROCESSOR_MODE RequestorMode;
580 BOOLEAN PendingReturned;
581 CHAR StackCount;
582 CHAR CurrentLocation;
583 BOOLEAN Cancel;
584 KIRQL CancelIrql;
585 CCHAR ApcEnvironment;// CCHAR or PVOID?
586 UCHAR AllocationFlags;//UCHAR or ULONG?
587 PIO_STATUS_BLOCK UserIosb;
588 PKEVENT UserEvent;
589 union
590 {
591 struct
592 {
593 PIO_APC_ROUTINE UserApcRoutine;
594 PVOID UserApcContext;
595 } AsynchronousParameters;
596 LARGE_INTEGER AllocationSize;
597 } Overlay;
598 PDRIVER_CANCEL CancelRoutine;
599 PVOID UserBuffer;
600 union
601 {
602 struct
603 {
604 union {
605 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
606 PVOID DriverContext[4];
607 };
608 struct _ETHREAD* Thread;
609 PCHAR AuxiliaryBuffer;
610 LIST_ENTRY ListEntry;
611 struct _IO_STACK_LOCATION* CurrentStackLocation;
612 PFILE_OBJECT OriginalFileObject;
613 } Overlay;
614 KAPC Apc;
615 ULONG CompletionKey;
616 } Tail;
617 IO_STACK_LOCATION Stack[1];
618 } IRP, *PIRP;
619
620 #define VPB_MOUNTED 0x00000001
621 #define VPB_LOCKED 0x00000002
622 #define VPB_PERSISTENT 0x00000004
623 #define VPB_REMOVE_PENDING 0x00000008
624
625 typedef struct _VPB
626 {
627 CSHORT Type;
628 CSHORT Size;
629 USHORT Flags;
630 USHORT VolumeLabelLength;
631 struct _DEVICE_OBJECT* DeviceObject;
632 struct _DEVICE_OBJECT* RealDevice;
633 ULONG SerialNumber;
634 ULONG ReferenceCount;
635 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH];
636 } VPB, *PVPB;
637
638
639 typedef struct _DEVICE_OBJECT
640 {
641 CSHORT Type;
642 CSHORT Size;
643 LONG ReferenceCount;
644 struct _DRIVER_OBJECT* DriverObject;
645 struct _DEVICE_OBJECT* NextDevice;
646 struct _DEVICE_OBJECT* AttachedDevice;
647 struct _IRP* CurrentIrp;
648 PIO_TIMER Timer;
649 ULONG Flags;
650 ULONG Characteristics;
651 PVPB Vpb;
652 PVOID DeviceExtension;
653 DEVICE_TYPE DeviceType;
654 CCHAR StackSize;
655 union
656 {
657 LIST_ENTRY ListHead;
658 WAIT_CONTEXT_BLOCK Wcb;
659 } Queue;
660 ULONG AlignmentRequirement;
661 KDEVICE_QUEUE DeviceQueue;
662 KDPC Dpc;
663 ULONG ActiveThreadCount;
664 PSECURITY_DESCRIPTOR SecurityDescriptor;
665 KEVENT DeviceLock;
666 USHORT SectorSize;
667 USHORT Spare1;
668 struct _DEVOBJ_EXTENSION* DeviceObjectExtension;
669 PVOID Reserved;
670 } DEVICE_OBJECT, *PDEVICE_OBJECT;
671
672
673 /*
674 * Fast i/o routine type declaration
675 */
676 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
677 //FIXME : this type is ok for read and write, but not for all routines
678 typedef BOOLEAN STDCALL
679 (*PFAST_IO_ROUTINE)(IN struct _FILE_OBJECT *FileObject,
680 IN PLARGE_INTEGER FileOffset,
681 IN ULONG Length,
682 IN BOOLEAN Wait,
683 IN ULONG LockKey,
684 OUT PVOID Buffer,
685 OUT PIO_STATUS_BLOCK IoStatus,
686 IN struct _DEVICE_OBJECT *DeviceObject);
687
688 typedef struct _FAST_IO_DISPATCH {
689 ULONG SizeOfFastIoDispatch;
690 PFAST_IO_ROUTINE FastIoCheckIfPossible;
691 PFAST_IO_ROUTINE FastIoRead;
692 PFAST_IO_ROUTINE FastIoWrite;
693 PFAST_IO_ROUTINE FastIoQueryBasicInfo;
694 PFAST_IO_ROUTINE FastIoQueryStandardInfo;
695 PFAST_IO_ROUTINE FastIoLock;
696 PFAST_IO_ROUTINE FastIoUnlockSingle;
697 PFAST_IO_ROUTINE FastIoUnlockAll;
698 PFAST_IO_ROUTINE FastIoUnlockAllByKey;
699 PFAST_IO_ROUTINE FastIoDeviceControl;
700 PFAST_IO_ROUTINE AcquireFileForNtCreateSection;
701 PFAST_IO_ROUTINE ReleaseFileForNtCreateSection;
702 PFAST_IO_ROUTINE FastIoDetachDevice;
703 PFAST_IO_ROUTINE FastIoQueryNetworkOpenInfo;
704 PFAST_IO_ROUTINE AcquireForModWrite;
705 PFAST_IO_ROUTINE MdlRead;
706 PFAST_IO_ROUTINE MdlReadComplete;
707 PFAST_IO_ROUTINE PrepareMdlWrite;
708 PFAST_IO_ROUTINE MdlWriteComplete;
709 PFAST_IO_ROUTINE FastIoReadCompressed;
710 PFAST_IO_ROUTINE FastIoWriteCompressed;
711 PFAST_IO_ROUTINE MdlReadCompleteCompressed;
712 PFAST_IO_ROUTINE MdlWriteCompleteCompressed;
713 PFAST_IO_ROUTINE FastIoQueryOpen;
714 PFAST_IO_ROUTINE ReleaseForModWrite;
715 PFAST_IO_ROUTINE AcquireForCcFlush;
716 PFAST_IO_ROUTINE ReleaseForCcFlush;
717 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
718
719 /*
720 * Dispatch routine type declaration
721 */
722 typedef NTSTATUS STDCALL
723 (*PDRIVER_DISPATCH)(IN struct _DEVICE_OBJECT *DeviceObject,
724 IN struct _IRP *Irp);
725
726 /*
727 * StartIo routine type declaration
728 */
729 typedef VOID STDCALL
730 (*PDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject,
731 IN PIRP Irp);
732
733 /*
734 * Unload routine type declaration
735 */
736 typedef VOID STDCALL
737 (*PDRIVER_UNLOAD)(IN struct _DRIVER_OBJECT *DriverObject);
738
739 /*
740 * AddDevice routine type declaration
741 */
742 typedef NTSTATUS STDCALL
743 (*PDRIVER_ADD_DEVICE)(IN struct _DRIVER_OBJECT *DriverObject,
744 IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
745
746
747 typedef struct _DRIVER_EXTENSION
748 {
749 struct _DRIVER_OBJECT* DriverObject;
750 PDRIVER_ADD_DEVICE AddDevice;
751 ULONG Count;
752 UNICODE_STRING ServiceKeyName;
753 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
754
755 #if 0
756 typedef
757 struct _FAST_IO_DISPATCH_TABLE
758 {
759 ULONG Count;
760 PFAST_IO_DISPATCH Dispatch;
761
762 } FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE;
763 #endif
764
765 typedef struct _DRIVER_OBJECT
766 {
767 CSHORT Type;
768 CSHORT Size;
769 PDEVICE_OBJECT DeviceObject;
770 ULONG Flags;
771 PVOID DriverStart;
772 ULONG DriverSize;
773 PVOID DriverSection;
774 PDRIVER_EXTENSION DriverExtension;
775 UNICODE_STRING DriverName;
776 PUNICODE_STRING HardwareDatabase;
777 #if 0
778 PFAST_IO_DISPATCH_TABLE FastIoDispatch;
779 #else
780 PFAST_IO_DISPATCH FastIoDispatch;
781 #endif
782 PDRIVER_INITIALIZE DriverInit;
783 PDRIVER_STARTIO DriverStartIo;
784 PDRIVER_UNLOAD DriverUnload;
785 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
786 } DRIVER_OBJECT, *PDRIVER_OBJECT;
787
788
789 typedef struct _CONFIGURATION_INFORMATION
790 {
791 ULONG DiskCount;
792 ULONG FloppyCount;
793 ULONG CDRomCount;
794 ULONG TapeCount;
795 ULONG ScsiPortCount;
796 ULONG SerialCount;
797 ULONG ParallelCount;
798 BOOLEAN AtDiskPrimaryAddressClaimed;
799 BOOLEAN AtDiskSecondaryAddressClaimed;
800 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
801
802 typedef VOID STDCALL
803 (*PIO_DPC_ROUTINE)(PKDPC Dpc,
804 PDEVICE_OBJECT DeviceObject,
805 PIRP Irp,
806 PVOID Context);
807
808 typedef VOID STDCALL
809 (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
810 PVOID Context);
811
812 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
813 typedef struct _PARTITION_INFORMATION
814 {
815 LARGE_INTEGER StartingOffset;
816 LARGE_INTEGER PartitionLength;
817 ULONG HiddenSectors;
818 ULONG PartitionNumber;
819 UCHAR PartitionType;
820 BOOLEAN BootIndicator;
821 BOOLEAN RecognizedPartition;
822 BOOLEAN RewritePartition;
823 } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
824 #endif
825
826 typedef struct _DRIVER_LAYOUT_INFORMATION
827 {
828 ULONG PartitionCount;
829 ULONG Signature;
830 PARTITION_INFORMATION PartitionEntry[1];
831 } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
832
833
834 typedef IO_ALLOCATION_ACTION STDCALL
835 (*PDRIVER_CONTROL)(PDEVICE_OBJECT DeviceObject,
836 PIRP Irp,
837 PVOID MapRegisterBase,
838 PVOID Context);
839 #if (_WIN32_WINNT >= 0x0400)
840 typedef VOID STDCALL
841 (*PFSDNOTIFICATIONPROC)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject,
842 IN BOOLEAN DriverActive);
843 #endif // (_WIN32_WINNT >= 0x0400)
844
845 #endif /* __INCLUDE_DDK_IOTYPES_H */