44a19b9e7385e7ced77d97f5a68d7c6a7a6d6b59
[reactos.git] / reactos / include / ddk / iotypes.h
1 /* $Id: iotypes.h,v 1.64 2004/10/19 20:36:52 navaraf 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 IO_STACK_LOCATION Stack[1];
873 } IRP, *PIRP;
874
875 #define VPB_MOUNTED 0x00000001
876 #define VPB_LOCKED 0x00000002
877 #define VPB_PERSISTENT 0x00000004
878 #define VPB_REMOVE_PENDING 0x00000008
879
880 typedef struct _VPB
881 {
882 CSHORT Type;
883 CSHORT Size;
884 USHORT Flags;
885 USHORT VolumeLabelLength;
886 struct _DEVICE_OBJECT* DeviceObject;
887 struct _DEVICE_OBJECT* RealDevice;
888 ULONG SerialNumber;
889 ULONG ReferenceCount;
890 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH];
891 } VPB, *PVPB;
892
893
894 typedef struct _DEVICE_OBJECT
895 {
896 CSHORT Type;
897 CSHORT Size;
898 LONG ReferenceCount;
899 struct _DRIVER_OBJECT* DriverObject;
900 struct _DEVICE_OBJECT* NextDevice;
901 struct _DEVICE_OBJECT* AttachedDevice;
902 struct _IRP* CurrentIrp;
903 struct _IO_TIMER *Timer;
904 ULONG Flags;
905 ULONG Characteristics;
906 PVPB Vpb;
907 PVOID DeviceExtension;
908 DEVICE_TYPE DeviceType;
909 CCHAR StackSize;
910 union
911 {
912 LIST_ENTRY ListHead;
913 WAIT_CONTEXT_BLOCK Wcb;
914 } Queue;
915 ULONG AlignmentRequirement;
916 KDEVICE_QUEUE DeviceQueue;
917 KDPC Dpc;
918 ULONG ActiveThreadCount;
919 PSECURITY_DESCRIPTOR SecurityDescriptor;
920 KEVENT DeviceLock;
921 USHORT SectorSize;
922 USHORT Spare1;
923 struct _DEVOBJ_EXTENSION* DeviceObjectExtension;
924 PVOID Reserved;
925 } DEVICE_OBJECT, *PDEVICE_OBJECT;
926
927
928 /*
929 * Fast i/o routine type declaration
930 */
931 //typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
932 //FIXME : this type is ok for read and write, but not for all routines
933 typedef BOOLEAN STDCALL_FUNC
934 (*PFAST_IO_ROUTINE)(IN struct _FILE_OBJECT *FileObject,
935 IN PLARGE_INTEGER FileOffset,
936 IN ULONG Length,
937 IN BOOLEAN Wait,
938 IN ULONG LockKey,
939 OUT PVOID Buffer,
940 OUT PIO_STATUS_BLOCK IoStatus,
941 IN struct _DEVICE_OBJECT *DeviceObject);
942
943 typedef struct _FAST_IO_DISPATCH {
944 ULONG SizeOfFastIoDispatch;
945 PFAST_IO_ROUTINE FastIoCheckIfPossible;
946 PFAST_IO_ROUTINE FastIoRead;
947 PFAST_IO_ROUTINE FastIoWrite;
948 PFAST_IO_ROUTINE FastIoQueryBasicInfo;
949 PFAST_IO_ROUTINE FastIoQueryStandardInfo;
950 PFAST_IO_ROUTINE FastIoLock;
951 PFAST_IO_ROUTINE FastIoUnlockSingle;
952 PFAST_IO_ROUTINE FastIoUnlockAll;
953 PFAST_IO_ROUTINE FastIoUnlockAllByKey;
954 PFAST_IO_ROUTINE FastIoDeviceControl;
955 PFAST_IO_ROUTINE AcquireFileForNtCreateSection;
956 PFAST_IO_ROUTINE ReleaseFileForNtCreateSection;
957 PFAST_IO_ROUTINE FastIoDetachDevice;
958 PFAST_IO_ROUTINE FastIoQueryNetworkOpenInfo;
959 PFAST_IO_ROUTINE AcquireForModWrite;
960 PFAST_IO_ROUTINE MdlRead;
961 PFAST_IO_ROUTINE MdlReadComplete;
962 PFAST_IO_ROUTINE PrepareMdlWrite;
963 PFAST_IO_ROUTINE MdlWriteComplete;
964 PFAST_IO_ROUTINE FastIoReadCompressed;
965 PFAST_IO_ROUTINE FastIoWriteCompressed;
966 PFAST_IO_ROUTINE MdlReadCompleteCompressed;
967 PFAST_IO_ROUTINE MdlWriteCompleteCompressed;
968 PFAST_IO_ROUTINE FastIoQueryOpen;
969 PFAST_IO_ROUTINE ReleaseForModWrite;
970 PFAST_IO_ROUTINE AcquireForCcFlush;
971 PFAST_IO_ROUTINE ReleaseForCcFlush;
972 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
973
974 /*
975 * Dispatch routine type declaration
976 */
977 typedef NTSTATUS STDCALL_FUNC
978 (*PDRIVER_DISPATCH)(IN struct _DEVICE_OBJECT *DeviceObject,
979 IN struct _IRP *Irp);
980
981 /*
982 * StartIo routine type declaration
983 */
984 typedef VOID STDCALL_FUNC
985 (*PDRIVER_STARTIO)(IN PDEVICE_OBJECT DeviceObject,
986 IN PIRP Irp);
987
988 /*
989 * Unload routine type declaration
990 */
991 typedef VOID STDCALL_FUNC
992 (*PDRIVER_UNLOAD)(IN struct _DRIVER_OBJECT *DriverObject);
993
994 /*
995 * AddDevice routine type declaration
996 */
997 typedef NTSTATUS STDCALL_FUNC
998 (*PDRIVER_ADD_DEVICE)(IN struct _DRIVER_OBJECT *DriverObject,
999 IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
1000
1001
1002 typedef struct _DRIVER_EXTENSION
1003 {
1004 struct _DRIVER_OBJECT* DriverObject;
1005 PDRIVER_ADD_DEVICE AddDevice;
1006 ULONG Count;
1007 UNICODE_STRING ServiceKeyName;
1008 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
1009
1010 #if 0
1011 typedef
1012 struct _FAST_IO_DISPATCH_TABLE
1013 {
1014 ULONG Count;
1015 PFAST_IO_DISPATCH Dispatch;
1016
1017 } FAST_IO_DISPATCH_TABLE, * PFAST_IO_DISPATCH_TABLE;
1018 #endif
1019
1020 typedef struct _DRIVER_OBJECT
1021 {
1022 CSHORT Type;
1023 CSHORT Size;
1024 PDEVICE_OBJECT DeviceObject;
1025 ULONG Flags;
1026 PVOID DriverStart;
1027 ULONG DriverSize;
1028 PVOID DriverSection;
1029 PDRIVER_EXTENSION DriverExtension;
1030 UNICODE_STRING DriverName;
1031 PUNICODE_STRING HardwareDatabase;
1032 #if 0
1033 PFAST_IO_DISPATCH_TABLE FastIoDispatch;
1034 #else
1035 PFAST_IO_DISPATCH FastIoDispatch;
1036 #endif
1037 PDRIVER_INITIALIZE DriverInit;
1038 PDRIVER_STARTIO DriverStartIo;
1039 PDRIVER_UNLOAD DriverUnload;
1040 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
1041 } DRIVER_OBJECT, *PDRIVER_OBJECT;
1042
1043
1044 typedef struct _CONFIGURATION_INFORMATION
1045 {
1046 ULONG DiskCount;
1047 ULONG FloppyCount;
1048 ULONG CdRomCount;
1049 ULONG TapeCount;
1050 ULONG ScsiPortCount;
1051 ULONG SerialCount;
1052 ULONG ParallelCount;
1053 BOOLEAN AtDiskPrimaryAddressClaimed;
1054 BOOLEAN AtDiskSecondaryAddressClaimed;
1055 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
1056
1057 typedef VOID STDCALL_FUNC
1058 (*PIO_DPC_ROUTINE)(PKDPC Dpc,
1059 PDEVICE_OBJECT DeviceObject,
1060 PIRP Irp,
1061 PVOID Context);
1062
1063 typedef VOID STDCALL_FUNC
1064 (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
1065 PVOID Context);
1066
1067 /*
1068 * PURPOSE: Special timer associated with each device
1069 * NOTES: This is a guess
1070 */
1071 typedef struct _IO_TIMER
1072 {
1073 KTIMER timer;
1074 KDPC dpc;
1075 PDEVICE_OBJECT DeviceObject;
1076 PIO_TIMER_ROUTINE TimerRoutine;
1077 PVOID Context;
1078 } IO_TIMER, *PIO_TIMER;
1079
1080 typedef struct _IO_WORKITEM *PIO_WORKITEM;
1081 typedef VOID (*PIO_WORKITEM_ROUTINE)(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context);
1082
1083 #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
1084 typedef struct _PARTITION_INFORMATION
1085 {
1086 LARGE_INTEGER StartingOffset;
1087 LARGE_INTEGER PartitionLength;
1088 ULONG HiddenSectors;
1089 ULONG PartitionNumber;
1090 UCHAR PartitionType;
1091 BOOLEAN BootIndicator;
1092 BOOLEAN RecognizedPartition;
1093 BOOLEAN RewritePartition;
1094 } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
1095 #endif
1096
1097 typedef enum _PARTITION_STYLE {
1098 PARTITION_STYLE_MBR,
1099 PARTITION_STYLE_GPT,
1100 PARTITION_STYLE_RAW
1101 } PARTITION_STYLE;
1102
1103 typedef struct _PARTITION_INFORMATION_GPT {
1104 GUID PartitionType;
1105 GUID PartitionId;
1106 ULONG64 Attributes;
1107 WCHAR Name [36];
1108 } PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
1109
1110 typedef struct _PARTITION_INFORMATION_MBR {
1111 UCHAR PartitionType;
1112 BOOLEAN BootIndicator;
1113 BOOLEAN RecognizedPartition;
1114 ULONG HiddenSectors;
1115 } PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
1116
1117 typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
1118 typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
1119
1120 typedef struct _SET_PARTITION_INFORMATION_EX {
1121 PARTITION_STYLE PartitionStyle;
1122 union {
1123 SET_PARTITION_INFORMATION_MBR Mbr;
1124 SET_PARTITION_INFORMATION_GPT Gpt;
1125 };
1126 } SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX;
1127
1128 typedef struct _CREATE_DISK_GPT {
1129 GUID DiskId;
1130 ULONG MaxPartitionCount;
1131 } CREATE_DISK_GPT, *PCREATE_DISK_GPT;
1132
1133 typedef struct _CREATE_DISK_MBR {
1134 ULONG Signature;
1135 } CREATE_DISK_MBR, *PCREATE_DISK_MBR;
1136
1137
1138 typedef struct _CREATE_DISK {
1139 PARTITION_STYLE PartitionStyle;
1140 union {
1141 CREATE_DISK_MBR Mbr;
1142 CREATE_DISK_GPT Gpt;
1143 };
1144 } CREATE_DISK, *PCREATE_DISK;
1145
1146 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
1147 GUID DiskId;
1148 LARGE_INTEGER StartingUsableOffset;
1149 LARGE_INTEGER UsableLength;
1150 ULONG MaxPartitionCount;
1151 } DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
1152
1153 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
1154 ULONG Signature;
1155 } DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
1156
1157 typedef struct _PARTITION_INFORMATION_EX {
1158 PARTITION_STYLE PartitionStyle;
1159 LARGE_INTEGER StartingOffset;
1160 LARGE_INTEGER PartitionLength;
1161 ULONG PartitionNumber;
1162 BOOLEAN RewritePartition;
1163 union {
1164 PARTITION_INFORMATION_MBR Mbr;
1165 PARTITION_INFORMATION_GPT Gpt;
1166 };
1167 } PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
1168
1169 typedef struct _DRIVE_LAYOUT_INFORMATION_EX {
1170 ULONG PartitionStyle;
1171 ULONG PartitionCount;
1172 union {
1173 DRIVE_LAYOUT_INFORMATION_MBR Mbr;
1174 DRIVE_LAYOUT_INFORMATION_GPT Gpt;
1175 };
1176 PARTITION_INFORMATION_EX PartitionEntry[1];
1177 } DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX;
1178
1179 typedef struct _BOOTDISK_INFORMATION {
1180 LONGLONG BootPartitionOffset;
1181 LONGLONG SystemPartitionOffset;
1182 ULONG BootDeviceSignature;
1183 ULONG SystemDeviceSignature;
1184 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
1185
1186
1187 typedef struct _DISK_SIGNATURE {
1188 ULONG PartitionStyle;
1189 union {
1190 struct {
1191 ULONG Signature;
1192 ULONG CheckSum;
1193 } Mbr;
1194
1195 struct {
1196 GUID DiskId;
1197 } Gpt;
1198 };
1199 } DISK_SIGNATURE, *PDISK_SIGNATURE;
1200
1201 typedef struct _REPARSE_DATA_BUFFER {
1202 ULONG ReparseTag;
1203 USHORT ReparseDataLength;
1204 USHORT Reserved;
1205 union {
1206 struct {
1207 USHORT SubstituteNameOffset;
1208 USHORT SubstituteNameLength;
1209 USHORT PrintNameOffset;
1210 USHORT PrintNameLength;
1211 WCHAR PathBuffer[1];
1212 } SymbolicLinkReparseBuffer;
1213 struct {
1214 USHORT SubstituteNameOffset;
1215 USHORT SubstituteNameLength;
1216 USHORT PrintNameOffset;
1217 USHORT PrintNameLength;
1218 WCHAR PathBuffer[1];
1219 } MountPointReparseBuffer;
1220 struct {
1221 UCHAR DataBuffer[1];
1222 } GenericReparseBuffer;
1223 };
1224 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
1225
1226 typedef struct _DRIVER_LAYOUT_INFORMATION
1227 {
1228 ULONG PartitionCount;
1229 ULONG Signature;
1230 PARTITION_INFORMATION PartitionEntry[1];
1231 } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
1232
1233
1234 typedef IO_ALLOCATION_ACTION STDCALL_FUNC
1235 (*PDRIVER_CONTROL)(PDEVICE_OBJECT DeviceObject,
1236 PIRP Irp,
1237 PVOID MapRegisterBase,
1238 PVOID Context);
1239 #if (_WIN32_WINNT >= 0x0400)
1240 typedef VOID STDCALL_FUNC
1241 (*PFSDNOTIFICATIONPROC)(IN PDEVICE_OBJECT PtrTargetFileSystemDeviceObject,
1242 IN BOOLEAN DriverActive);
1243 #endif // (_WIN32_WINNT >= 0x0400)
1244
1245
1246 typedef struct _IO_PIPE_CREATE_BUFFER
1247 {
1248 BOOLEAN WriteModeMessage;
1249 BOOLEAN ReadModeMessage;
1250 BOOLEAN NonBlocking;
1251 ULONG MaxInstances;
1252 ULONG InBufferSize;
1253 ULONG OutBufferSize;
1254 LARGE_INTEGER TimeOut;
1255 } IO_PIPE_CREATE_BUFFER, *PIO_PIPE_CREATE_BUFFER;
1256
1257 typedef struct _IO_MAILSLOT_CREATE_BUFFER
1258 {
1259 ULONG Param; /* ?? */
1260 ULONG MaxMessageSize;
1261 LARGE_INTEGER TimeOut;
1262 } IO_MAILSLOT_CREATE_BUFFER, *PIO_MAILSLOT_CREATE_BUFFER;
1263
1264 /* error logging */
1265
1266 typedef struct _IO_ERROR_LOG_PACKET
1267 {
1268 UCHAR MajorFunctionCode;
1269 UCHAR RetryCount;
1270 USHORT DumpDataSize;
1271 USHORT NumberOfStrings;
1272 USHORT StringOffset;
1273 USHORT EventCategory;
1274 NTSTATUS ErrorCode;
1275 ULONG UniqueErrorValue;
1276 NTSTATUS FinalStatus;
1277 ULONG SequenceNumber;
1278 ULONG IoControlCode;
1279 LARGE_INTEGER DeviceOffset;
1280 ULONG DumpData[1];
1281 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
1282
1283 typedef struct _IO_ERROR_LOG_MESSAGE
1284 {
1285 USHORT Type;
1286 USHORT Size;
1287 USHORT DriverNameLength;
1288 LARGE_INTEGER TimeStamp;
1289 ULONG DriverNameOffset;
1290 IO_ERROR_LOG_PACKET EntryData;
1291 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
1292
1293
1294 /* DMA types */
1295
1296 typedef struct _SCATTER_GATHER_ELEMENT {
1297 PHYSICAL_ADDRESS Address;
1298 ULONG Length;
1299 ULONG_PTR Reserved;
1300 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
1301
1302 typedef struct _SCATTER_GATHER_LIST {
1303 ULONG NumberOfElements;
1304 ULONG_PTR Reserved;
1305 SCATTER_GATHER_ELEMENT Elements[];
1306 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
1307
1308 typedef struct _DMA_OPERATIONS *PDMA_OPERATIONS;
1309
1310 typedef struct _DMA_ADAPTER {
1311 USHORT Version;
1312 USHORT Size;
1313 PDMA_OPERATIONS DmaOperations;
1314 PADAPTER_OBJECT HalAdapter;
1315 } DMA_ADAPTER, *PDMA_ADAPTER;
1316
1317 typedef VOID (*PPUT_DMA_ADAPTER)(
1318 PDMA_ADAPTER DmaAdapter
1319 );
1320
1321 typedef PVOID (*PALLOCATE_COMMON_BUFFER)(
1322 IN PDMA_ADAPTER DmaAdapter,
1323 IN ULONG Length,
1324 OUT PPHYSICAL_ADDRESS LogicalAddress,
1325 IN BOOLEAN CacheEnabled
1326 );
1327
1328 typedef VOID (*PFREE_COMMON_BUFFER)(
1329 IN PDMA_ADAPTER DmaAdapter,
1330 IN ULONG Length,
1331 IN PHYSICAL_ADDRESS LogicalAddress,
1332 IN PVOID VirtualAddress,
1333 IN BOOLEAN CacheEnabled
1334 );
1335
1336 typedef NTSTATUS (*PALLOCATE_ADAPTER_CHANNEL)(
1337 IN PDMA_ADAPTER DmaAdapter,
1338 IN PDEVICE_OBJECT DeviceObject,
1339 IN ULONG NumberOfMapRegisters,
1340 IN PDRIVER_CONTROL ExecutionRoutine,
1341 IN PVOID Context
1342 );
1343
1344 typedef BOOLEAN (*PFLUSH_ADAPTER_BUFFERS)(
1345 IN PDMA_ADAPTER DmaAdapter,
1346 IN PMDL Mdl,
1347 IN PVOID MapRegisterBase,
1348 IN PVOID CurrentVa,
1349 IN ULONG Length,
1350 IN BOOLEAN WriteToDevice
1351 );
1352
1353 typedef VOID (*PFREE_ADAPTER_CHANNEL)(
1354 IN PDMA_ADAPTER DmaAdapter
1355 );
1356
1357 typedef VOID (*PFREE_MAP_REGISTERS)(
1358 IN PDMA_ADAPTER DmaAdapter,
1359 PVOID MapRegisterBase,
1360 ULONG NumberOfMapRegisters
1361 );
1362
1363 typedef PHYSICAL_ADDRESS (*PMAP_TRANSFER)(
1364 IN PDMA_ADAPTER DmaAdapter,
1365 IN PMDL Mdl,
1366 IN PVOID MapRegisterBase,
1367 IN PVOID CurrentVa,
1368 IN OUT PULONG Length,
1369 IN BOOLEAN WriteToDevice
1370 );
1371
1372 typedef ULONG (*PGET_DMA_ALIGNMENT)(
1373 IN PDMA_ADAPTER DmaAdapter
1374 );
1375
1376 typedef ULONG (*PREAD_DMA_COUNTER)(
1377 IN PDMA_ADAPTER DmaAdapter
1378 );
1379
1380 typedef VOID (*PDRIVER_LIST_CONTROL)(
1381 IN struct _DEVICE_OBJECT *DeviceObject,
1382 IN struct _IRP *Irp,
1383 IN PSCATTER_GATHER_LIST ScatterGather,
1384 IN PVOID Context
1385 );
1386
1387 typedef NTSTATUS (*PGET_SCATTER_GATHER_LIST)(
1388 IN PDMA_ADAPTER DmaAdapter,
1389 IN PDEVICE_OBJECT DeviceObject,
1390 IN PMDL Mdl,
1391 IN PVOID CurrentVa,
1392 IN ULONG Length,
1393 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
1394 IN PVOID Context,
1395 IN BOOLEAN WriteToDevice
1396 );
1397
1398 typedef VOID (*PPUT_SCATTER_GATHER_LIST)(
1399 IN PDMA_ADAPTER DmaAdapter,
1400 IN PSCATTER_GATHER_LIST ScatterGather,
1401 IN BOOLEAN WriteToDevice
1402 );
1403
1404 typedef struct _DMA_OPERATIONS {
1405 ULONG Size;
1406 PPUT_DMA_ADAPTER PutDmaAdapter;
1407 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
1408 PFREE_COMMON_BUFFER FreeCommonBuffer;
1409 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
1410 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
1411 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
1412 PFREE_MAP_REGISTERS FreeMapRegisters;
1413 PMAP_TRANSFER MapTransfer;
1414 PGET_DMA_ALIGNMENT GetDmaAlignment;
1415 PREAD_DMA_COUNTER ReadDmaCounter;
1416 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
1417 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
1418 } DMA_OPERATIONS;
1419
1420
1421 /* Standard bus interface */
1422
1423 struct _DEVICE_DESCRIPTION;
1424
1425 typedef BOOLEAN STDCALL_FUNC (*PTRANSLATE_BUS_ADDRESS)(
1426 IN PVOID Context,
1427 IN PHYSICAL_ADDRESS BusAddress,
1428 IN ULONG Length,
1429 IN OUT PULONG AddressSpace,
1430 OUT PPHYSICAL_ADDRESS TranslatedAddress);
1431
1432 typedef PDMA_ADAPTER STDCALL_FUNC (*PGET_DMA_ADAPTER)(
1433 IN PVOID Context,
1434 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
1435 OUT PULONG NumberOfMapRegisters);
1436
1437 typedef ULONG STDCALL_FUNC (*PGET_SET_DEVICE_DATA)(
1438 IN PVOID Context,
1439 IN ULONG DataType,
1440 IN PVOID Buffer,
1441 IN ULONG Offset,
1442 IN ULONG Length);
1443
1444 typedef struct _BUS_INTERFACE_STANDARD {
1445 USHORT Size;
1446 USHORT Version;
1447 PVOID Context;
1448 PINTERFACE_REFERENCE InterfaceReference;
1449 PINTERFACE_DEREFERENCE InterfaceDereference;
1450 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
1451 PGET_DMA_ADAPTER GetDmaAdapter;
1452 PGET_SET_DEVICE_DATA SetBusData;
1453 PGET_SET_DEVICE_DATA GetBusData;
1454 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
1455
1456 #include <poppack.h>
1457
1458 #endif /* __INCLUDE_DDK_IOTYPES_H */