- Replace WIN32 types by corresponding native types.
[reactos.git] / reactos / include / ddk / iotypes.h
1 /* $Id: iotypes.h,v 1.69 2004/11/06 04:12:59 ion Exp $
2 *
3 */
4
5 #ifndef __INCLUDE_DDK_IOTYPES_H
6 #define __INCLUDE_DDK_IOTYPES_H
7
8 #include <ntos/obtypes.h>
9 #include <ntos/disk.h>
10 #include <ntos/file.h>
11
12 #include <pshpack4.h>
13
14 /* from winddk.h */
15 #define POINTER_ALIGNMENT
16
17
18 /*
19 * These are referenced before they can be fully defined
20 */
21 struct _DRIVER_OBJECT;
22 struct _FILE_OBJECT;
23 struct _DEVICE_OBJECT;
24 struct _IRP;
25 struct _IO_STATUS_BLOCK;
26 struct _SCSI_REQUEST_BLOCK;
27 struct _IO_TIMER;
28
29 /* SIMPLE TYPES *************************************************************/
30
31 enum
32 {
33 KeepObject = 1,
34 DeallocateObject,
35 DeallocateObjectKeepRegisters
36 };
37
38
39 typedef enum _CREATE_FILE_TYPE
40 {
41 CreateFileTypeNone,
42 CreateFileTypeNamedPipe,
43 CreateFileTypeMailslot
44 } CREATE_FILE_TYPE;
45
46
47 typedef struct _SHARE_ACCESS
48 {
49 ULONG OpenCount;
50 ULONG Readers;
51 ULONG Writers;
52 ULONG Deleters;
53 ULONG SharedRead;
54 ULONG SharedWrite;
55 ULONG SharedDelete;
56 } SHARE_ACCESS, *PSHARE_ACCESS;
57
58 /* FUNCTION TYPES ************************************************************/
59
60 typedef VOID STDCALL_FUNC
61 (*PDRIVER_REINITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
62 PVOID Context,
63 ULONG Count);
64
65 typedef NTSTATUS STDCALL_FUNC
66 (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
67 PUNICODE_STRING Pathname,
68 INTERFACE_TYPE BusType,
69 ULONG BusNumber,
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);
77
78 typedef NTSTATUS STDCALL_FUNC
79 (*PIO_COMPLETION_ROUTINE)(struct _DEVICE_OBJECT* DeviceObject,
80 struct _IRP* Irp,
81 PVOID Context);
82
83 typedef VOID STDCALL_FUNC
84 (*PIO_APC_ROUTINE)(PVOID ApcContext,
85 struct _IO_STATUS_BLOCK* IoStatusBlock,
86 ULONG Reserved);
87
88
89 /* STRUCTURE TYPES ***********************************************************/
90
91 typedef struct _ADAPTER_OBJECT ADAPTER_OBJECT, *PADAPTER_OBJECT;
92
93 typedef struct _IO_SECURITY_CONTEXT
94 {
95 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
96 PACCESS_STATE AccessState;
97 ACCESS_MASK DesiredAccess;
98 ULONG FullCreateOptions;
99 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
100
101
102 typedef struct _IO_RESOURCE_DESCRIPTOR
103 {
104 UCHAR Option;
105 UCHAR Type;
106 UCHAR ShareDisposition;
107
108 /*
109 * Reserved for system use
110 */
111 UCHAR Spare1;
112
113 USHORT Flags;
114
115 /*
116 * Reserved for system use
117 */
118 UCHAR Spare2;
119
120 union
121 {
122 struct
123 {
124 ULONG Length;
125 ULONG Alignment;
126 PHYSICAL_ADDRESS MinimumAddress;
127 PHYSICAL_ADDRESS MaximumAddress;
128 } Port;
129 struct
130 {
131 ULONG Length;
132 ULONG Alignment;
133 PHYSICAL_ADDRESS MinimumAddress;
134 PHYSICAL_ADDRESS MaximumAddress;
135 } Memory;
136 struct
137 {
138 ULONG MinimumVector;
139 ULONG MaximumVector;
140 } Interrupt;
141 struct
142 {
143 ULONG MinimumChannel;
144 ULONG MaximumChannel;
145 } Dma;
146 } u;
147 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
148
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
154
155 typedef struct _IO_RESOURCE_LIST
156 {
157 USHORT Version;
158 USHORT Revision;
159 ULONG Count;
160 IO_RESOURCE_DESCRIPTOR Descriptors[1];
161 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
162
163 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
164 {
165 /*
166 * List size in bytes
167 */
168 ULONG ListSize;
169
170 /*
171 * System defined enum for the bus
172 */
173 INTERFACE_TYPE InterfaceType;
174
175 ULONG BusNumber;
176 ULONG SlotNumber;
177 ULONG Reserved[3];
178 ULONG AlternativeLists;
179 IO_RESOURCE_LIST List[1];
180 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
181
182
183 /* MicroChannel bus data */
184
185 typedef struct _CM_MCA_POS_DATA
186 {
187 USHORT AdapterId;
188 UCHAR PosData1;
189 UCHAR PosData2;
190 UCHAR PosData3;
191 UCHAR PosData4;
192 } CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
193
194
195 /* Int13 drive geometry data */
196
197 typedef struct _CM_INT13_DRIVE_PARAMETER
198 {
199 USHORT DriveSelect;
200 ULONG MaxCylinders;
201 USHORT SectorsPerTrack;
202 USHORT MaxHeads;
203 USHORT NumberDrives;
204 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
205
206
207 /* Extended drive geometry data */
208
209 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
210 {
211 ULONG BytesPerSector;
212 ULONG NumberOfCylinders;
213 ULONG SectorsPerTrack;
214 ULONG NumberOfHeads;
215 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
216
217
218 #include <pshpack1.h>
219
220 typedef struct
221 {
222 UCHAR Type;
223 UCHAR ShareDisposition;
224 USHORT Flags;
225 union
226 {
227 struct
228 {
229 PHYSICAL_ADDRESS Start;
230 ULONG Length;
231 } Generic;
232 struct
233 {
234 PHYSICAL_ADDRESS Start;
235 ULONG Length;
236 } Port;
237 struct
238 {
239 ULONG Level;
240 ULONG Vector;
241 ULONG Affinity;
242 } Interrupt;
243 struct
244 {
245 PHYSICAL_ADDRESS Start;
246 ULONG Length;
247 } Memory;
248 struct
249 {
250 ULONG Channel;
251 ULONG Port;
252 ULONG Reserved1;
253 } Dma;
254 struct
255 {
256 ULONG DataSize;
257 ULONG Reserved1;
258 ULONG Reserved2;
259 } DeviceSpecificData;
260 } u;
261 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
262
263 typedef struct
264 {
265 USHORT Version;
266 USHORT Revision;
267 ULONG Count;
268 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
269 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
270
271 typedef struct
272 {
273 INTERFACE_TYPE InterfaceType;
274 ULONG BusNumber;
275 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
276 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
277
278 typedef struct
279 {
280 ULONG Count;
281 CM_FULL_RESOURCE_DESCRIPTOR List[1];
282 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
283
284 #include <poppack.h>
285
286
287 /*
288 * PURPOSE: IRP stack location
289 */
290
291 /*
292 typedef struct _IO_STACK_LOCATION
293 {
294 UCHAR MajorFunction;
295 UCHAR MinorFunction;
296 UCHAR Flags;
297 UCHAR Control;
298
299 union
300 {
301 struct
302 {
303 PIO_SECURITY_CONTEXT SecurityContext;
304 ULONG Options;
305 USHORT FileAttributes;
306 USHORT ShareAccess;
307 ULONG EaLength;
308 } Create;
309 struct
310 {
311 ULONG Length;
312 ULONG Key;
313 LARGE_INTEGER ByteOffset;
314 } Read;
315 struct
316 {
317 ULONG Length;
318 ULONG Key;
319 LARGE_INTEGER ByteOffset;
320 } Write;
321 struct
322 {
323 ULONG OutputBufferLength;
324 ULONG InputBufferLength;
325 ULONG IoControlCode;
326 PVOID Type3InputBuffer;
327 } DeviceIoControl;
328 struct
329 {
330 ULONG OutputBufferLength;
331 ULONG InputBufferLength;
332 ULONG IoControlCode;
333 PVOID Type3InputBuffer;
334 } FileSystemControl;
335 struct
336 {
337 struct _VPB* Vpb;
338 struct _DEVICE_OBJECT* DeviceObject;
339 } MountVolume;
340 struct
341 {
342 struct _VPB* Vpb;
343 struct _DEVICE_OBJECT* DeviceObject;
344 } VerifyVolume;
345 struct
346 {
347 ULONG Length;
348 FILE_INFORMATION_CLASS FileInformationClass;
349 } QueryFile;
350 struct
351 {
352 ULONG Length;
353 FS_INFORMATION_CLASS FsInformationClass;
354 } QueryVolume;
355 struct
356 {
357 ULONG Length;
358 FS_INFORMATION_CLASS FsInformationClass;
359 } SetVolume;
360 struct
361 {
362 ULONG Length;
363 FILE_INFORMATION_CLASS FileInformationClass;
364 struct _FILE_OBJECT* FileObject;
365 union
366 {
367 struct
368 {
369 BOOLEAN ReplaceIfExists;
370 BOOLEAN AdvanceOnly;
371 } d;
372 ULONG ClusterCount;
373 HANDLE DeleteHandle;
374 } u;
375 } SetFile;
376 struct
377 {
378 ULONG Length;
379 PUNICODE_STRING FileName;
380 FILE_INFORMATION_CLASS FileInformationClass;
381 ULONG FileIndex;
382 } QueryDirectory;
383
384 // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS
385 struct
386 {
387 DEVICE_RELATION_TYPE Type;
388 } QueryDeviceRelations;
389
390 // Parameters for IRP_MN_QUERY_INTERFACE
391 struct
392 {
393 CONST GUID *InterfaceType;
394 USHORT Size;
395 USHORT Version;
396 PINTERFACE Interface;
397 PVOID InterfaceSpecificData;
398 } QueryInterface;
399
400 // Parameters for IRP_MN_QUERY_CAPABILITIES
401 struct
402 {
403 PDEVICE_CAPABILITIES Capabilities;
404 } DeviceCapabilities;
405
406 // Parameters for IRP_MN_FILTER_RESOURCE_REQUIREMENTS
407 struct
408 {
409 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
410 } FilterResourceRequirements;
411
412 // Parameters for IRP_MN_QUERY_ID
413 struct
414 {
415 BUS_QUERY_ID_TYPE IdType;
416 } QueryId;
417
418 // Parameters for IRP_MN_QUERY_DEVICE_TEXT
419 struct
420 {
421 DEVICE_TEXT_TYPE DeviceTextType;
422 LCID LocaleId;
423 } QueryDeviceText;
424
425 // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION
426 struct
427 {
428 BOOLEAN InPath;
429 BOOLEAN Reserved[3];
430 DEVICE_USAGE_NOTIFICATION_TYPE Type;
431 } UsageNotification;
432
433 // Parameters for IRP_MN_WAIT_WAKE
434 struct
435 {
436 SYSTEM_POWER_STATE PowerState;
437 } WaitWake;
438
439 // Parameter for IRP_MN_POWER_SEQUENCE
440 struct
441 {
442 PPOWER_SEQUENCE PowerSequence;
443 } PowerSequence;
444
445 // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER
446 struct
447 {
448 ULONG SystemContext;
449 POWER_STATE_TYPE Type;
450 POWER_STATE State;
451 POWER_ACTION ShutdownType;
452 } Power;
453
454 // Parameters for IRP_MN_START_DEVICE
455 struct
456 {
457 PCM_RESOURCE_LIST AllocatedResources;
458 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
459 } StartDevice;
460 */
461 /* Parameters for IRP_MN_SCSI_CLASS */
462 /* struct
463 {
464 struct _SCSI_REQUEST_BLOCK *Srb;
465 } Scsi;
466
467 //byte range file locking
468 struct
469 {
470 PLARGE_INTEGER Length;
471 ULONG Key;
472 LARGE_INTEGER ByteOffset;
473 } LockControl;
474 */
475 /* Paramters for other calls */
476 /* struct
477 {
478 PVOID Argument1;
479 PVOID Argument2;
480 PVOID Argument3;
481 PVOID Argument4;
482 } Others;
483 } Parameters;
484
485 struct _DEVICE_OBJECT* DeviceObject;
486 struct _FILE_OBJECT* FileObject;
487
488 PIO_COMPLETION_ROUTINE CompletionRoutine;
489 PVOID CompletionContext;
490
491 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;*/
492
493 typedef struct _IO_STACK_LOCATION {
494 UCHAR MajorFunction;
495 UCHAR MinorFunction;
496 UCHAR Flags;
497 UCHAR Control;
498 union {
499 struct {
500 PIO_SECURITY_CONTEXT SecurityContext;
501 ULONG Options;
502 USHORT POINTER_ALIGNMENT FileAttributes;
503 USHORT ShareAccess;
504 ULONG POINTER_ALIGNMENT EaLength;
505 } Create;
506 struct {
507 ULONG Length;
508 ULONG POINTER_ALIGNMENT Key;
509 LARGE_INTEGER ByteOffset;
510 } Read;
511 struct {
512 ULONG Length;
513 ULONG POINTER_ALIGNMENT Key;
514 LARGE_INTEGER ByteOffset;
515 } Write;
516 struct {
517 ULONG Length;
518 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
519 } QueryFile;
520 struct {
521 ULONG Length;
522 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
523 struct _FILE_OBJECT* FileObject;
524 union {
525 struct {
526 BOOLEAN ReplaceIfExists;
527 BOOLEAN AdvanceOnly;
528 };
529 ULONG ClusterCount;
530 HANDLE DeleteHandle;
531 };
532 } SetFile;
533 struct {
534 ULONG Length;
535 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
536 } QueryVolume;
537 struct {
538 ULONG OutputBufferLength;
539 ULONG POINTER_ALIGNMENT InputBufferLength;
540 ULONG POINTER_ALIGNMENT IoControlCode;
541 PVOID Type3InputBuffer;
542 } DeviceIoControl;
543 struct {
544 SECURITY_INFORMATION SecurityInformation;
545 ULONG POINTER_ALIGNMENT Length;
546 } QuerySecurity;
547 struct {
548 SECURITY_INFORMATION SecurityInformation;
549 PSECURITY_DESCRIPTOR SecurityDescriptor;
550 } SetSecurity;
551 struct {
552 struct _VPB* Vpb;
553 struct _DEVICE_OBJECT* DeviceObject;
554 } MountVolume;
555 struct {
556 struct _VPB* Vpb;
557 struct _DEVICE_OBJECT* DeviceObject;
558 } VerifyVolume;
559 struct {
560 struct _SCSI_REQUEST_BLOCK *Srb;
561 } Scsi;
562 struct {
563 DEVICE_RELATION_TYPE Type;
564 } QueryDeviceRelations;
565 struct {
566 CONST GUID *InterfaceType;
567 USHORT Size;
568 USHORT Version;
569 PINTERFACE Interface;
570 PVOID InterfaceSpecificData;
571 } QueryInterface;
572 struct {
573 PDEVICE_CAPABILITIES Capabilities;
574 } DeviceCapabilities;
575 struct {
576 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
577 } FilterResourceRequirements;
578 struct {
579 ULONG WhichSpace;
580 PVOID Buffer;
581 ULONG Offset;
582 ULONG POINTER_ALIGNMENT Length;
583 } ReadWriteConfig;
584 struct {
585 BOOLEAN Lock;
586 } SetLock;
587 struct {
588 BUS_QUERY_ID_TYPE IdType;
589 } QueryId;
590 struct {
591 DEVICE_TEXT_TYPE DeviceTextType;
592 LCID POINTER_ALIGNMENT LocaleId;
593 } QueryDeviceText;
594 struct {
595 BOOLEAN InPath;
596 BOOLEAN Reserved[3];
597 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
598 } UsageNotification;
599 struct {
600 SYSTEM_POWER_STATE PowerState;
601 } WaitWake;
602 struct {
603 PPOWER_SEQUENCE PowerSequence;
604 } PowerSequence;
605 struct {
606 ULONG SystemContext;
607 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
608 POWER_STATE POINTER_ALIGNMENT State;
609 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
610 } Power;
611 struct {
612 PCM_RESOURCE_LIST AllocatedResources;
613 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
614 } StartDevice;
615 struct {
616 ULONG_PTR ProviderId;
617 PVOID DataPath;
618 ULONG BufferSize;
619 PVOID Buffer;
620 } WMI;
621 struct {
622 PVOID Argument1;
623 PVOID Argument2;
624 PVOID Argument3;
625 PVOID Argument4;
626 } Others;
627 } Parameters;
628 struct _DEVICE_OBJECT* DeviceObject;
629 struct _FILE_OBJECT* FileObject;
630 PIO_COMPLETION_ROUTINE CompletionRoutine;
631 PVOID Context;
632 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
633
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
636 // defined.
637
638 typedef struct _EXTENDED_IO_STACK_LOCATION {
639
640 /* Included for padding */
641 UCHAR MajorFunction;
642 UCHAR MinorFunction;
643 UCHAR Flags;
644 UCHAR Control;
645
646 union {
647
648 // struct {
649 // PIO_SECURITY_CONTEXT SecurityContext;
650 // ULONG Options;
651 // USHORT Reserved;
652 // USHORT ShareAccess;
653 // PMAILSLOT_CREATE_PARAMETERS Parameters;
654 // } CreateMailslot;
655
656 // struct {
657 // PIO_SECURITY_CONTEXT SecurityContext;
658 // ULONG Options;
659 // USHORT Reserved;
660 // USHORT ShareAccess;
661 // PNAMED_PIPE_CREATE_PARAMETERS Parameters;
662 // } CreatePipe;
663
664 struct {
665 ULONG OutputBufferLength;
666 ULONG InputBufferLength;
667 ULONG FsControlCode;
668 PVOID Type3InputBuffer;
669 } FileSystemControl;
670
671 struct {
672 PLARGE_INTEGER Length;
673 ULONG Key;
674 LARGE_INTEGER ByteOffset;
675 } LockControl;
676
677 struct {
678 ULONG Length;
679 ULONG CompletionFilter;
680 } NotifyDirectory;
681
682 struct {
683 ULONG Length;
684 PUNICODE_STRING FileName;
685 FILE_INFORMATION_CLASS FileInformationClass;
686 ULONG FileIndex;
687 } QueryDirectory;
688
689 struct {
690 ULONG Length;
691 PVOID EaList;
692 ULONG EaListLength;
693 ULONG EaIndex;
694 } QueryEa;
695
696 // struct {
697 // ULONG Length;
698 // PSID StartSid;
699 // PFILE_GET_QUOTA_INFORMATION SidList;
700 // ULONG SidListLength;
701 // } QueryQuota;
702
703 struct {
704 ULONG Length;
705 } SetEa;
706
707 struct {
708 ULONG Length;
709 } SetQuota;
710
711 struct {
712 ULONG Length;
713 FS_INFORMATION_CLASS FsInformationClass;
714 } SetVolume;
715
716 } Parameters;
717 struct _DEVICE_OBJECT* DeviceObject;
718 struct _FILE_OBJECT* FileObject;
719 PIO_COMPLETION_ROUTINE CompletionRoutine;
720 PVOID Context;
721
722 } EXTENDED_IO_STACK_LOCATION, *PEXTENDED_IO_STACK_LOCATION;
723
724 typedef struct _IO_STATUS_BLOCK
725 {
726 NTSTATUS Status;
727 ULONG Information;
728 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
729
730 /*
731 * Driver entry point declaration
732 */
733 typedef NTSTATUS STDCALL_FUNC
734 (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
735 PUNICODE_STRING RegistryPath);
736
737 /*
738 * Driver cancel declaration
739 */
740 typedef NTSTATUS STDCALL_FUNC
741 (*PDRIVER_CANCEL)(struct _DEVICE_OBJECT* DeviceObject,
742 struct _IRP* RegistryPath);
743
744
745 typedef struct _SECTION_OBJECT_POINTERS
746 {
747 PVOID DataSectionObject;
748 PVOID SharedCacheMap;
749 PVOID ImageSectionObject;
750 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
751
752 typedef struct _IO_COMPLETION_CONTEXT
753 {
754 PVOID Port;
755 ULONG Key;
756 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
757
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
778
779 /*
780 * ReactOS specific flags
781 */
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
787
788 typedef struct _FILE_OBJECT
789 {
790 CSHORT Type;
791 CSHORT Size;
792 struct _DEVICE_OBJECT* DeviceObject;
793 struct _VPB* Vpb;
794 PVOID FsContext;
795 PVOID FsContext2;
796 PSECTION_OBJECT_POINTERS SectionObjectPointer;
797 PVOID PrivateCacheMap;
798 NTSTATUS FinalStatus;
799 struct _FILE_OBJECT* RelatedFileObject;
800 BOOLEAN LockOperation;
801 BOOLEAN DeletePending;
802 BOOLEAN ReadAccess;
803 BOOLEAN WriteAccess;
804 BOOLEAN DeleteAccess;
805 BOOLEAN SharedRead;
806 BOOLEAN SharedWrite;
807 BOOLEAN SharedDelete;
808 ULONG Flags;
809 UNICODE_STRING FileName;
810 LARGE_INTEGER CurrentByteOffset;
811 ULONG Waiters;
812 ULONG Busy;
813 PVOID LastLock;
814 KEVENT Lock;
815 KEVENT Event;
816 PIO_COMPLETION_CONTEXT CompletionContext;
817 } FILE_OBJECT, *PFILE_OBJECT;
818
819
820 typedef struct _IRP
821 {
822 CSHORT Type;
823 USHORT Size;
824 PMDL MdlAddress;
825 ULONG Flags;
826 union
827 {
828 struct _IRP* MasterIrp;
829 LONG IrpCount;
830 PVOID SystemBuffer;
831 } AssociatedIrp;
832 LIST_ENTRY ThreadListEntry;
833 IO_STATUS_BLOCK IoStatus;
834 KPROCESSOR_MODE RequestorMode;
835 BOOLEAN PendingReturned;
836 CHAR StackCount;
837 CHAR CurrentLocation;
838 BOOLEAN Cancel;
839 KIRQL CancelIrql;
840 CCHAR ApcEnvironment;// CCHAR or PVOID?
841 UCHAR AllocationFlags;//UCHAR or ULONG?
842 PIO_STATUS_BLOCK UserIosb;
843 PKEVENT UserEvent;
844 union
845 {
846 struct
847 {
848 PIO_APC_ROUTINE UserApcRoutine;
849 PVOID UserApcContext;
850 } AsynchronousParameters;
851 LARGE_INTEGER AllocationSize;
852 } Overlay;
853 PDRIVER_CANCEL CancelRoutine;
854 PVOID UserBuffer;
855 union
856 {
857 struct
858 {
859 union {
860 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
861 PVOID DriverContext[4];
862 };
863 struct _ETHREAD* Thread;
864 PCHAR AuxiliaryBuffer;
865 LIST_ENTRY ListEntry;
866 struct _IO_STACK_LOCATION* CurrentStackLocation;
867 PFILE_OBJECT OriginalFileObject;
868 } Overlay;
869 KAPC Apc;
870 ULONG CompletionKey;
871 } Tail;
872 } IRP, *PIRP;
873
874 #define VPB_MOUNTED 0x00000001
875 #define VPB_LOCKED 0x00000002
876 #define VPB_PERSISTENT 0x00000004
877 #define VPB_REMOVE_PENDING 0x00000008
878
879 typedef struct _VPB
880 {
881 CSHORT Type;
882 CSHORT Size;
883 USHORT Flags;
884 USHORT VolumeLabelLength;
885 struct _DEVICE_OBJECT* DeviceObject;
886 struct _DEVICE_OBJECT* RealDevice;
887 ULONG SerialNumber;
888 ULONG ReferenceCount;
889 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH];
890 } VPB, *PVPB;
891
892
893 typedef struct _DEVICE_OBJECT
894 {
895 CSHORT Type;
896 CSHORT Size;
897 LONG ReferenceCount;
898 struct _DRIVER_OBJECT* DriverObject;
899 struct _DEVICE_OBJECT* NextDevice;
900 struct _DEVICE_OBJECT* AttachedDevice;
901 struct _IRP* CurrentIrp;
902 struct _IO_TIMER *Timer;
903 ULONG Flags;
904 ULONG Characteristics;
905 PVPB Vpb;
906 PVOID DeviceExtension;
907 DEVICE_TYPE DeviceType;
908 CCHAR StackSize;
909 union
910 {
911 LIST_ENTRY ListHead;
912 WAIT_CONTEXT_BLOCK Wcb;
913 } Queue;
914 ULONG AlignmentRequirement;
915 KDEVICE_QUEUE DeviceQueue;
916 KDPC Dpc;
917 ULONG ActiveThreadCount;
918 PSECURITY_DESCRIPTOR SecurityDescriptor;
919 KEVENT DeviceLock;
920 USHORT SectorSize;
921 USHORT Spare1;
922 struct _DEVOBJ_EXTENSION* DeviceObjectExtension;
923 PVOID Reserved;
924 } DEVICE_OBJECT, *PDEVICE_OBJECT;
925
926
927 /*
928 * Fast i/o routine type declaration
929 */
930 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
931 //FIXME : this type is ok for read and write, but not for all routines
932 typedef BOOLEAN STDCALL_FUNC
933 (*PFAST_IO_ROUTINE)(IN struct _FILE_OBJECT *FileObject,
934 IN PLARGE_INTEGER FileOffset,
935 IN ULONG Length,
936 IN BOOLEAN Wait,
937 IN ULONG LockKey,
938 OUT PVOID Buffer,
939 OUT PIO_STATUS_BLOCK IoStatus,
940 IN struct _DEVICE_OBJECT *DeviceObject);
941
942 typedef struct _FAST_IO_DISPATCH {
943 ULONG SizeOfFastIoDispatch;
944 PFAST_IO_ROUTINE FastIoCheckIfPossible;
945 PFAST_IO_ROUTINE FastIoRead;
946 PFAST_IO_ROUTINE FastIoWrite;
947 PFAST_IO_ROUTINE FastIoQueryBasicInfo;
948 PFAST_IO_ROUTINE FastIoQueryStandardInfo;
949 PFAST_IO_ROUTINE FastIoLock;
950 PFAST_IO_ROUTINE FastIoUnlockSingle;
951 PFAST_IO_ROUTINE FastIoUnlockAll;
952 PFAST_IO_ROUTINE FastIoUnlockAllByKey;
953 PFAST_IO_ROUTINE FastIoDeviceControl;
954 PFAST_IO_ROUTINE AcquireFileForNtCreateSection;
955 PFAST_IO_ROUTINE ReleaseFileForNtCreateSection;
956 PFAST_IO_ROUTINE FastIoDetachDevice;
957 PFAST_IO_ROUTINE FastIoQueryNetworkOpenInfo;
958 PFAST_IO_ROUTINE AcquireForModWrite;
959 PFAST_IO_ROUTINE MdlRead;
960 PFAST_IO_ROUTINE MdlReadComplete;
961 PFAST_IO_ROUTINE PrepareMdlWrite;
962 PFAST_IO_ROUTINE MdlWriteComplete;
963 PFAST_IO_ROUTINE FastIoReadCompressed;
964 PFAST_IO_ROUTINE FastIoWriteCompressed;
965 PFAST_IO_ROUTINE MdlReadCompleteCompressed;
966 PFAST_IO_ROUTINE MdlWriteCompleteCompressed;
967 PFAST_IO_ROUTINE FastIoQueryOpen;
968 PFAST_IO_ROUTINE ReleaseForModWrite;
969 PFAST_IO_ROUTINE AcquireForCcFlush;
970 PFAST_IO_ROUTINE ReleaseForCcFlush;
971 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
972
973 /*
974 * Dispatch routine type declaration
975 */
976 typedef NTSTATUS STDCALL_FUNC
977 (*PDRIVER_DISPATCH)(IN struct _DEVICE_OBJECT *DeviceObject,
978 IN struct _IRP *Irp);
979
980 /*
981 * StartIo routine type declaration
982 */
983 typedef VOID STDCALL_FUNC
984 (*PDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject,
985 IN PIRP Irp);
986
987 /*
988 * Unload routine type declaration
989 */
990 typedef VOID STDCALL_FUNC
991 (*PDRIVER_UNLOAD)(IN struct _DRIVER_OBJECT *DriverObject);
992
993 /*
994 * AddDevice routine type declaration
995 */
996 typedef NTSTATUS STDCALL_FUNC
997 (*PDRIVER_ADD_DEVICE)(IN struct _DRIVER_OBJECT *DriverObject,
998 IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
999
1000
1001 typedef struct _DRIVER_EXTENSION
1002 {
1003 struct _DRIVER_OBJECT* DriverObject;
1004 PDRIVER_ADD_DEVICE AddDevice;
1005 ULONG Count;
1006 UNICODE_STRING ServiceKeyName;
1007 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
1008
1009 #if 0
1010 typedef
1011 struct _FAST_IO_DISPATCH_TABLE
1012 {
1013 ULONG Count;
1014 PFAST_IO_DISPATCH Dispatch;
1015
1016 } FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE;
1017 #endif
1018
1019 typedef struct _DRIVER_OBJECT
1020 {
1021 CSHORT Type;
1022 CSHORT Size;
1023 PDEVICE_OBJECT DeviceObject;
1024 ULONG Flags;
1025 PVOID DriverStart;
1026 ULONG DriverSize;
1027 PVOID DriverSection;
1028 PDRIVER_EXTENSION DriverExtension;
1029 UNICODE_STRING DriverName;
1030 PUNICODE_STRING HardwareDatabase;
1031 #if 0
1032 PFAST_IO_DISPATCH_TABLE FastIoDispatch;
1033 #else
1034 PFAST_IO_DISPATCH FastIoDispatch;
1035 #endif
1036 PDRIVER_INITIALIZE DriverInit;
1037 PDRIVER_STARTIO DriverStartIo;
1038 PDRIVER_UNLOAD DriverUnload;
1039 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
1040 } DRIVER_OBJECT, *PDRIVER_OBJECT;
1041
1042
1043 typedef struct _CONFIGURATION_INFORMATION
1044 {
1045 ULONG DiskCount;
1046 ULONG FloppyCount;
1047 ULONG CdRomCount;
1048 ULONG TapeCount;
1049 ULONG ScsiPortCount;
1050 ULONG SerialCount;
1051 ULONG ParallelCount;
1052 BOOLEAN AtDiskPrimaryAddressClaimed;
1053 BOOLEAN AtDiskSecondaryAddressClaimed;
1054 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
1055
1056 typedef VOID STDCALL_FUNC
1057 (*PIO_DPC_ROUTINE)(PKDPC Dpc,
1058 PDEVICE_OBJECT DeviceObject,
1059 PIRP Irp,
1060 PVOID Context);
1061
1062 typedef VOID STDCALL_FUNC
1063 (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
1064 PVOID Context);
1065
1066 /*
1067 * PURPOSE: Special timer associated with each device
1068 */
1069 #define IO_TYPE_TIMER 9
1070 typedef struct _IO_TIMER {
1071 USHORT Type; /* Every IO Object has a Type */
1072 USHORT TimerEnabled; /* Tells us if the Timer is enabled or not */
1073 LIST_ENTRY IoTimerList; /* List of other Timers on the system */
1074 PIO_TIMER_ROUTINE TimerRoutine; /* The associated timer routine */
1075 PVOID Context; /* Context */
1076 PDEVICE_OBJECT DeviceObject; /* Driver that owns this IO Timer */
1077 } IO_TIMER, *PIO_TIMER;
1078
1079 typedef struct _IO_WORKITEM *PIO_WORKITEM;
1080 typedef VOID (*PIO_WORKITEM_ROUTINE)(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context);
1081
1082 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
1083 typedef struct _PARTITION_INFORMATION
1084 {
1085 LARGE_INTEGER StartingOffset;
1086 LARGE_INTEGER PartitionLength;
1087 ULONG HiddenSectors;
1088 ULONG PartitionNumber;
1089 UCHAR PartitionType;
1090 BOOLEAN BootIndicator;
1091 BOOLEAN RecognizedPartition;
1092 BOOLEAN RewritePartition;
1093 } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
1094 #endif
1095
1096 typedef enum _PARTITION_STYLE {
1097 PARTITION_STYLE_MBR,
1098 PARTITION_STYLE_GPT,
1099 PARTITION_STYLE_RAW
1100 } PARTITION_STYLE;
1101
1102 typedef struct _PARTITION_INFORMATION_GPT {
1103 GUID PartitionType;
1104 GUID PartitionId;
1105 ULONG64 Attributes;
1106 WCHAR Name [36];
1107 } PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
1108
1109 typedef struct _PARTITION_INFORMATION_MBR {
1110 UCHAR PartitionType;
1111 BOOLEAN BootIndicator;
1112 BOOLEAN RecognizedPartition;
1113 ULONG HiddenSectors;
1114 } PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
1115
1116 typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
1117 typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
1118
1119 typedef struct _SET_PARTITION_INFORMATION_EX {
1120 PARTITION_STYLE PartitionStyle;
1121 union {
1122 SET_PARTITION_INFORMATION_MBR Mbr;
1123 SET_PARTITION_INFORMATION_GPT Gpt;
1124 };
1125 } SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX;
1126
1127 typedef struct _CREATE_DISK_GPT {
1128 GUID DiskId;
1129 ULONG MaxPartitionCount;
1130 } CREATE_DISK_GPT, *PCREATE_DISK_GPT;
1131
1132 typedef struct _CREATE_DISK_MBR {
1133 ULONG Signature;
1134 } CREATE_DISK_MBR, *PCREATE_DISK_MBR;
1135
1136
1137 typedef struct _CREATE_DISK {
1138 PARTITION_STYLE PartitionStyle;
1139 union {
1140 CREATE_DISK_MBR Mbr;
1141 CREATE_DISK_GPT Gpt;
1142 };
1143 } CREATE_DISK, *PCREATE_DISK;
1144
1145 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
1146 GUID DiskId;
1147 LARGE_INTEGER StartingUsableOffset;
1148 LARGE_INTEGER UsableLength;
1149 ULONG MaxPartitionCount;
1150 } DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
1151
1152 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
1153 ULONG Signature;
1154 } DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
1155
1156 typedef struct _PARTITION_INFORMATION_EX {
1157 PARTITION_STYLE PartitionStyle;
1158 LARGE_INTEGER StartingOffset;
1159 LARGE_INTEGER PartitionLength;
1160 ULONG PartitionNumber;
1161 BOOLEAN RewritePartition;
1162 union {
1163 PARTITION_INFORMATION_MBR Mbr;
1164 PARTITION_INFORMATION_GPT Gpt;
1165 };
1166 } PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
1167
1168 typedef struct _DRIVE_LAYOUT_INFORMATION_EX {
1169 ULONG PartitionStyle;
1170 ULONG PartitionCount;
1171 union {
1172 DRIVE_LAYOUT_INFORMATION_MBR Mbr;
1173 DRIVE_LAYOUT_INFORMATION_GPT Gpt;
1174 };
1175 PARTITION_INFORMATION_EX PartitionEntry[1];
1176 } DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX;
1177
1178 typedef struct _BOOTDISK_INFORMATION {
1179 LONGLONG BootPartitionOffset;
1180 LONGLONG SystemPartitionOffset;
1181 ULONG BootDeviceSignature;
1182 ULONG SystemDeviceSignature;
1183 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
1184
1185
1186 typedef struct _DISK_SIGNATURE {
1187 ULONG PartitionStyle;
1188 union {
1189 struct {
1190 ULONG Signature;
1191 ULONG CheckSum;
1192 } Mbr;
1193
1194 struct {
1195 GUID DiskId;
1196 } Gpt;
1197 };
1198 } DISK_SIGNATURE, *PDISK_SIGNATURE;
1199
1200 typedef struct _REPARSE_DATA_BUFFER {
1201 ULONG ReparseTag;
1202 USHORT ReparseDataLength;
1203 USHORT Reserved;
1204 union {
1205 struct {
1206 USHORT SubstituteNameOffset;
1207 USHORT SubstituteNameLength;
1208 USHORT PrintNameOffset;
1209 USHORT PrintNameLength;
1210 WCHAR PathBuffer[1];
1211 } SymbolicLinkReparseBuffer;
1212 struct {
1213 USHORT SubstituteNameOffset;
1214 USHORT SubstituteNameLength;
1215 USHORT PrintNameOffset;
1216 USHORT PrintNameLength;
1217 WCHAR PathBuffer[1];
1218 } MountPointReparseBuffer;
1219 struct {
1220 UCHAR DataBuffer[1];
1221 } GenericReparseBuffer;
1222 };
1223 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
1224
1225 typedef struct _DRIVER_LAYOUT_INFORMATION
1226 {
1227 ULONG PartitionCount;
1228 ULONG Signature;
1229 PARTITION_INFORMATION PartitionEntry[1];
1230 } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
1231
1232
1233 typedef IO_ALLOCATION_ACTION STDCALL_FUNC
1234 (*PDRIVER_CONTROL)(PDEVICE_OBJECT DeviceObject,
1235 PIRP Irp,
1236 PVOID MapRegisterBase,
1237 PVOID Context);
1238 #if (_WIN32_WINNT >= 0x0400)
1239 typedef VOID STDCALL_FUNC
1240 (*PFSDNOTIFICATIONPROC)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject,
1241 IN BOOLEAN DriverActive);
1242 #endif // (_WIN32_WINNT >= 0x0400)
1243
1244
1245 typedef struct _NAMED_PIPE_CREATE_PARAMETERS {
1246 ULONG NamedPipeType;
1247 ULONG ReadMode;
1248 ULONG CompletionMode;
1249 ULONG MaximumInstances;
1250 ULONG InboundQuota;
1251 ULONG OutboundQuota;
1252 LARGE_INTEGER DefaultTimeout;
1253 BOOLEAN TimeoutSpecified;
1254 } NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS;
1255
1256 typedef struct _MAILSLOT_CREATE_PARAMETERS {
1257 ULONG MailslotQuota;
1258 ULONG MaximumMessageSize;
1259 LARGE_INTEGER ReadTimeout;
1260 BOOLEAN TimeoutSpecified;
1261 } MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS;
1262
1263 /* error logging */
1264
1265 typedef struct _IO_ERROR_LOG_PACKET
1266 {
1267 UCHAR MajorFunctionCode;
1268 UCHAR RetryCount;
1269 USHORT DumpDataSize;
1270 USHORT NumberOfStrings;
1271 USHORT StringOffset;
1272 USHORT EventCategory;
1273 NTSTATUS ErrorCode;
1274 ULONG UniqueErrorValue;
1275 NTSTATUS FinalStatus;
1276 ULONG SequenceNumber;
1277 ULONG IoControlCode;
1278 LARGE_INTEGER DeviceOffset;
1279 ULONG DumpData[1];
1280 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
1281
1282 typedef struct _IO_ERROR_LOG_MESSAGE
1283 {
1284 USHORT Type;
1285 USHORT Size;
1286 USHORT DriverNameLength;
1287 LARGE_INTEGER TimeStamp;
1288 ULONG DriverNameOffset;
1289 IO_ERROR_LOG_PACKET EntryData;
1290 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
1291
1292
1293 /* DMA types */
1294
1295 typedef struct _DMA_ADAPTER {
1296 USHORT Version;
1297 USHORT Size;
1298 struct _DMA_OPERATIONS *DmaOperations;
1299 } DMA_ADAPTER, *PDMA_ADAPTER;
1300
1301 typedef struct _SCATTER_GATHER_ELEMENT {
1302 PHYSICAL_ADDRESS Address;
1303 ULONG Length;
1304 ULONG_PTR Reserved;
1305 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
1306
1307 typedef struct _SCATTER_GATHER_LIST {
1308 ULONG NumberOfElements;
1309 ULONG_PTR Reserved;
1310 SCATTER_GATHER_ELEMENT Elements[];
1311 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
1312
1313 typedef VOID (*PPUT_DMA_ADAPTER)(
1314 PDMA_ADAPTER DmaAdapter
1315 );
1316
1317 typedef PVOID (*PALLOCATE_COMMON_BUFFER)(
1318 IN PDMA_ADAPTER DmaAdapter,
1319 IN ULONG Length,
1320 OUT PPHYSICAL_ADDRESS LogicalAddress,
1321 IN BOOLEAN CacheEnabled
1322 );
1323
1324 typedef VOID (*PFREE_COMMON_BUFFER)(
1325 IN PDMA_ADAPTER DmaAdapter,
1326 IN ULONG Length,
1327 IN PHYSICAL_ADDRESS LogicalAddress,
1328 IN PVOID VirtualAddress,
1329 IN BOOLEAN CacheEnabled
1330 );
1331
1332 typedef NTSTATUS (*PALLOCATE_ADAPTER_CHANNEL)(
1333 IN PDMA_ADAPTER DmaAdapter,
1334 IN PDEVICE_OBJECT DeviceObject,
1335 IN ULONG NumberOfMapRegisters,
1336 IN PDRIVER_CONTROL ExecutionRoutine,
1337 IN PVOID Context
1338 );
1339
1340 typedef BOOLEAN (*PFLUSH_ADAPTER_BUFFERS)(
1341 IN PDMA_ADAPTER DmaAdapter,
1342 IN PMDL Mdl,
1343 IN PVOID MapRegisterBase,
1344 IN PVOID CurrentVa,
1345 IN ULONG Length,
1346 IN BOOLEAN WriteToDevice
1347 );
1348
1349 typedef VOID (*PFREE_ADAPTER_CHANNEL)(
1350 IN PDMA_ADAPTER DmaAdapter
1351 );
1352
1353 typedef VOID (*PFREE_MAP_REGISTERS)(
1354 IN PDMA_ADAPTER DmaAdapter,
1355 PVOID MapRegisterBase,
1356 ULONG NumberOfMapRegisters
1357 );
1358
1359 typedef PHYSICAL_ADDRESS (*PMAP_TRANSFER)(
1360 IN PDMA_ADAPTER DmaAdapter,
1361 IN PMDL Mdl,
1362 IN PVOID MapRegisterBase,
1363 IN PVOID CurrentVa,
1364 IN OUT PULONG Length,
1365 IN BOOLEAN WriteToDevice
1366 );
1367
1368 typedef ULONG (*PGET_DMA_ALIGNMENT)(
1369 IN PDMA_ADAPTER DmaAdapter
1370 );
1371
1372 typedef ULONG (*PREAD_DMA_COUNTER)(
1373 IN PDMA_ADAPTER DmaAdapter
1374 );
1375
1376 typedef VOID (*PDRIVER_LIST_CONTROL)(
1377 IN struct _DEVICE_OBJECT *DeviceObject,
1378 IN struct _IRP *Irp,
1379 IN PSCATTER_GATHER_LIST ScatterGather,
1380 IN PVOID Context
1381 );
1382
1383 typedef NTSTATUS (*PGET_SCATTER_GATHER_LIST)(
1384 IN PDMA_ADAPTER DmaAdapter,
1385 IN PDEVICE_OBJECT DeviceObject,
1386 IN PMDL Mdl,
1387 IN PVOID CurrentVa,
1388 IN ULONG Length,
1389 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
1390 IN PVOID Context,
1391 IN BOOLEAN WriteToDevice
1392 );
1393
1394 typedef VOID (*PPUT_SCATTER_GATHER_LIST)(
1395 IN PDMA_ADAPTER DmaAdapter,
1396 IN PSCATTER_GATHER_LIST ScatterGather,
1397 IN BOOLEAN WriteToDevice
1398 );
1399
1400 typedef struct _DMA_OPERATIONS {
1401 ULONG Size;
1402 PPUT_DMA_ADAPTER PutDmaAdapter;
1403 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
1404 PFREE_COMMON_BUFFER FreeCommonBuffer;
1405 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
1406 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
1407 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
1408 PFREE_MAP_REGISTERS FreeMapRegisters;
1409 PMAP_TRANSFER MapTransfer;
1410 PGET_DMA_ALIGNMENT GetDmaAlignment;
1411 PREAD_DMA_COUNTER ReadDmaCounter;
1412 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
1413 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
1414 } DMA_OPERATIONS, *PDMA_OPERATIONS;
1415
1416 /* Standard bus interface */
1417
1418 struct _DEVICE_DESCRIPTION;
1419
1420 typedef BOOLEAN STDCALL_FUNC (*PTRANSLATE_BUS_ADDRESS)(
1421 IN PVOID Context,
1422 IN PHYSICAL_ADDRESS BusAddress,
1423 IN ULONG Length,
1424 IN OUT PULONG AddressSpace,
1425 OUT PPHYSICAL_ADDRESS TranslatedAddress);
1426
1427 typedef PDMA_ADAPTER STDCALL_FUNC (*PGET_DMA_ADAPTER)(
1428 IN PVOID Context,
1429 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
1430 OUT PULONG NumberOfMapRegisters);
1431
1432 typedef ULONG STDCALL_FUNC (*PGET_SET_DEVICE_DATA)(
1433 IN PVOID Context,
1434 IN ULONG DataType,
1435 IN PVOID Buffer,
1436 IN ULONG Offset,
1437 IN ULONG Length);
1438
1439 typedef struct _BUS_INTERFACE_STANDARD {
1440 USHORT Size;
1441 USHORT Version;
1442 PVOID Context;
1443 PINTERFACE_REFERENCE InterfaceReference;
1444 PINTERFACE_DEREFERENCE InterfaceDereference;
1445 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
1446 PGET_DMA_ADAPTER GetDmaAdapter;
1447 PGET_SET_DEVICE_DATA SetBusData;
1448 PGET_SET_DEVICE_DATA GetBusData;
1449 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
1450
1451 #include <poppack.h>
1452
1453 #endif /* __INCLUDE_DDK_IOTYPES_H */