ReactOS  0.4.15-dev-1386-g5cb9f87
iotypes.h
Go to the documentation of this file.
2 /******************************************************************************
3  * I/O Manager Types *
4  ******************************************************************************/
6 
8 
9 #define STATUS_CONTINUE_COMPLETION STATUS_SUCCESS
10 
11 #define CONNECT_FULLY_SPECIFIED 0x1
12 #define CONNECT_LINE_BASED 0x2
13 #define CONNECT_MESSAGE_BASED 0x3
14 #define CONNECT_FULLY_SPECIFIED_GROUP 0x4
15 #define CONNECT_CURRENT_VERSION 0x4
16 
17 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 0x8
18 #define POOL_RAISE_IF_ALLOCATION_FAILURE 0x10
19 #define POOL_COLD_ALLOCATION 0x100
20 #define POOL_NX_ALLOCATION 0x200
21 #define POOL_ZERO_ALLOCATION 0x400
22 
23 #define IO_TYPE_ADAPTER 1
24 #define IO_TYPE_CONTROLLER 2
25 #define IO_TYPE_DEVICE 3
26 #define IO_TYPE_DRIVER 4
27 #define IO_TYPE_FILE 5
28 #define IO_TYPE_IRP 6
29 #define IO_TYPE_MASTER_ADAPTER 7
30 #define IO_TYPE_OPEN_PACKET 8
31 #define IO_TYPE_TIMER 9
32 #define IO_TYPE_VPB 10
33 #define IO_TYPE_ERROR_LOG 11
34 #define IO_TYPE_ERROR_MESSAGE 12
35 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
36 
37 #define IO_TYPE_CSQ_IRP_CONTEXT 1
38 #define IO_TYPE_CSQ 2
39 #define IO_TYPE_CSQ_EX 3
40 
41 /* IO_RESOURCE_DESCRIPTOR.Option */
42 #define IO_RESOURCE_PREFERRED 0x01
43 #define IO_RESOURCE_DEFAULT 0x02
44 #define IO_RESOURCE_ALTERNATIVE 0x08
45 
48 #define FILE_DEVICE_BEEP 0x00000001
49 #define FILE_DEVICE_CD_ROM 0x00000002
50 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
51 #define FILE_DEVICE_CONTROLLER 0x00000004
52 #define FILE_DEVICE_DATALINK 0x00000005
53 #define FILE_DEVICE_DFS 0x00000006
54 #define FILE_DEVICE_DISK 0x00000007
55 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
56 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
57 #define FILE_DEVICE_INPORT_PORT 0x0000000a
58 #define FILE_DEVICE_KEYBOARD 0x0000000b
59 #define FILE_DEVICE_MAILSLOT 0x0000000c
60 #define FILE_DEVICE_MIDI_IN 0x0000000d
61 #define FILE_DEVICE_MIDI_OUT 0x0000000e
62 #define FILE_DEVICE_MOUSE 0x0000000f
63 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
64 #define FILE_DEVICE_NAMED_PIPE 0x00000011
65 #define FILE_DEVICE_NETWORK 0x00000012
66 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
67 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
68 #define FILE_DEVICE_NULL 0x00000015
69 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
70 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
71 #define FILE_DEVICE_PRINTER 0x00000018
72 #define FILE_DEVICE_SCANNER 0x00000019
73 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
74 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
75 #define FILE_DEVICE_SCREEN 0x0000001c
76 #define FILE_DEVICE_SOUND 0x0000001d
77 #define FILE_DEVICE_STREAMS 0x0000001e
78 #define FILE_DEVICE_TAPE 0x0000001f
79 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
80 #define FILE_DEVICE_TRANSPORT 0x00000021
81 #define FILE_DEVICE_UNKNOWN 0x00000022
82 #define FILE_DEVICE_VIDEO 0x00000023
83 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
84 #define FILE_DEVICE_WAVE_IN 0x00000025
85 #define FILE_DEVICE_WAVE_OUT 0x00000026
86 #define FILE_DEVICE_8042_PORT 0x00000027
87 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
88 #define FILE_DEVICE_BATTERY 0x00000029
89 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
90 #define FILE_DEVICE_MODEM 0x0000002b
91 #define FILE_DEVICE_VDM 0x0000002c
92 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
93 #define FILE_DEVICE_SMB 0x0000002e
94 #define FILE_DEVICE_KS 0x0000002f
95 #define FILE_DEVICE_CHANGER 0x00000030
96 #define FILE_DEVICE_SMARTCARD 0x00000031
97 #define FILE_DEVICE_ACPI 0x00000032
98 #define FILE_DEVICE_DVD 0x00000033
99 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
100 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
101 #define FILE_DEVICE_DFS_VOLUME 0x00000036
102 #define FILE_DEVICE_SERENUM 0x00000037
103 #define FILE_DEVICE_TERMSRV 0x00000038
104 #define FILE_DEVICE_KSEC 0x00000039
105 #define FILE_DEVICE_FIPS 0x0000003A
106 #define FILE_DEVICE_INFINIBAND 0x0000003B
107 #define FILE_DEVICE_VMBUS 0x0000003E
108 #define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F
109 #define FILE_DEVICE_WPD 0x00000040
110 #define FILE_DEVICE_BLUETOOTH 0x00000041
111 #define FILE_DEVICE_MT_COMPOSITE 0x00000042
112 #define FILE_DEVICE_MT_TRANSPORT 0x00000043
113 #define FILE_DEVICE_BIOMETRIC 0x00000044
114 #define FILE_DEVICE_PMI 0x00000045
115 
117 $if (_WDMDDK_)
118 #if defined(NT_PROCESSOR_GROUPS)
119 
121 
122 enum _IRQ_DEVICE_POLICY_USHORT {
127  IrqPolicyAllProcessorsInGroup = 3,
130 
131 #else /* defined(NT_PROCESSOR_GROUPS) */
132 
133 typedef enum _IRQ_DEVICE_POLICY {
141 
142 #endif
143 
144 typedef enum _IRQ_PRIORITY {
150 
151 typedef enum _IRQ_GROUP_POLICY {
155 
156 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
157 
162 
163 typedef struct _CLIENT_ID {
167 
168 typedef struct _VPB {
178 } VPB, *PVPB;
179 
180 typedef enum _IO_ALLOCATION_ACTION {
185 
186 _Function_class_(DRIVER_CONTROL)
188 typedef IO_ALLOCATION_ACTION
189 (NTAPI DRIVER_CONTROL)(
191  _Inout_ struct _IRP *Irp,
193  _In_ PVOID Context);
194 typedef DRIVER_CONTROL *PDRIVER_CONTROL;
195 
196 typedef struct _WAIT_CONTEXT_BLOCK {
205 
207 $if (_NTDDK_)
208 /* DEVICE_OBJECT.Flags */
209 #define DO_DEVICE_HAS_NAME 0x00000040
210 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
211 #define DO_LONG_TERM_REQUESTS 0x00000200
212 #define DO_NEVER_LAST_DEVICE 0x00000400
213 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
214 #define DO_SUPPORTS_TRANSACTIONS 0x00040000
215 #define DO_FORCE_NEITHER_IO 0x00080000
216 #define DO_VOLUME_DEVICE_OBJECT 0x00100000
217 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
218 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
219 #define DO_DISALLOW_EXECUTE 0x00800000
220 
221 $endif (_NTDDK_)
222 $if (_WDMDDK_)
223 /* DEVICE_OBJECT.Flags */
224 #define DO_UNLOAD_PENDING 0x00000001
225 #define DO_VERIFY_VOLUME 0x00000002
226 #define DO_BUFFERED_IO 0x00000004
227 #define DO_EXCLUSIVE 0x00000008
228 #define DO_DIRECT_IO 0x00000010
229 #define DO_MAP_IO_BUFFER 0x00000020
230 #define DO_DEVICE_INITIALIZING 0x00000080
231 #define DO_SHUTDOWN_REGISTERED 0x00000800
232 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
233 #define DO_POWER_PAGABLE 0x00002000
234 #define DO_POWER_INRUSH 0x00004000
235 
236 /* DEVICE_OBJECT.Characteristics */
237 #define FILE_REMOVABLE_MEDIA 0x00000001
238 #define FILE_READ_ONLY_DEVICE 0x00000002
239 #define FILE_FLOPPY_DISKETTE 0x00000004
240 #define FILE_WRITE_ONCE_MEDIA 0x00000008
241 #define FILE_REMOTE_DEVICE 0x00000010
242 #define FILE_DEVICE_IS_MOUNTED 0x00000020
243 #define FILE_VIRTUAL_VOLUME 0x00000040
244 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
245 #define FILE_DEVICE_SECURE_OPEN 0x00000100
246 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
247 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
248 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
249 #define FILE_PORTABLE_DEVICE 0x00004000
250 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
251 
252 /* DEVICE_OBJECT.AlignmentRequirement */
253 #define FILE_BYTE_ALIGNMENT 0x00000000
254 #define FILE_WORD_ALIGNMENT 0x00000001
255 #define FILE_LONG_ALIGNMENT 0x00000003
256 #define FILE_QUAD_ALIGNMENT 0x00000007
257 #define FILE_OCTA_ALIGNMENT 0x0000000f
258 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
259 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
260 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
261 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
262 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
263 
264 $endif (_NTDDK_)
266 /* DEVICE_OBJECT.DeviceType */
267 #define DEVICE_TYPE ULONG
268 
270 $if (_WDMDDK_)
271 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {
272  CSHORT Type;
273  USHORT Size;
274  LONG ReferenceCount;
276  struct _DEVICE_OBJECT *NextDevice;
277  struct _DEVICE_OBJECT *AttachedDevice;
278  struct _IRP *CurrentIrp;
280  ULONG Flags;
281  ULONG Characteristics;
282  volatile PVPB Vpb;
283  PVOID DeviceExtension;
286  union {
287  LIST_ENTRY ListEntry;
288  WAIT_CONTEXT_BLOCK Wcb;
289  } Queue;
291  KDEVICE_QUEUE DeviceQueue;
292  KDPC Dpc;
293  ULONG ActiveThreadCount;
295  KEVENT DeviceLock;
297  USHORT Spare1;
298  struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
299  PVOID Reserved;
301 
302 typedef enum _IO_SESSION_STATE {
313 
318 
329 
335 
351 
361 
364  union {
368  } ConnectionContext;
376 
379  _ANONYMOUS_UNION union {
383  } DUMMYUNIONNAME;
385 
388  union {
392  } ConnectionContext;
394 
396 {
398  union
399  {
403  } ConnectionContext;
405 
406 typedef enum _IO_ACCESS_TYPE {
411 
412 typedef enum _IO_ACCESS_MODE {
416 
421 
429 
434 
440 
441 #if (NTDDI_VERSION >= NTDDI_WIN7)
442 
443 typedef NTSTATUS
445  VOID);
446 
447 typedef NTSTATUS
448 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
451  _In_ ULONG Event,
455 
456 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
457 
458 #endif
459 
461 
465  volatile LONG IoCount;
468 
481 
482 typedef struct _IO_REMOVE_LOCK {
484 #if DBG
486 #endif
488 
489 typedef struct _IO_WORKITEM *PIO_WORKITEM;
490 
491 _Function_class_(IO_WORKITEM_ROUTINE)
494 typedef VOID
495 (NTAPI IO_WORKITEM_ROUTINE)(
498 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
499 
500 typedef VOID
501 (NTAPI IO_WORKITEM_ROUTINE_EX)(
505 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
506 
507 typedef struct _SHARE_ACCESS {
516 
517 typedef enum _CREATE_FILE_TYPE {
522 
523 #define IO_FORCE_ACCESS_CHECK 0x001
524 #define IO_NO_PARAMETER_CHECKING 0x100
525 
526 #define IO_REPARSE 0x0
527 #define IO_REMOUNT 0x1
528 
529 typedef struct _IO_STATUS_BLOCK {
530  _ANONYMOUS_UNION union {
532  PVOID Pointer;
533  } DUMMYUNIONNAME;
536 
537 #if defined(_WIN64)
538 typedef struct _IO_STATUS_BLOCK32 {
541 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
542 #endif
543 
544 typedef VOID
549 
550 #define PIO_APC_ROUTINE_DEFINED
551 
552 typedef enum _IO_SESSION_EVENT {
562 
563 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff
564 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001
565 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002
566 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004
567 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008
568 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010
569 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020
570 
571 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
572 
573 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L
574 
575 typedef struct _IO_SESSION_CONNECT_INFO {
579 
580 #define EVENT_INCREMENT 1
581 #define IO_NO_INCREMENT 0
582 #define IO_CD_ROM_INCREMENT 1
583 #define IO_DISK_INCREMENT 1
584 #define IO_KEYBOARD_INCREMENT 6
585 #define IO_MAILSLOT_INCREMENT 2
586 #define IO_MOUSE_INCREMENT 6
587 #define IO_NAMED_PIPE_INCREMENT 2
588 #define IO_NETWORK_INCREMENT 2
589 #define IO_PARALLEL_INCREMENT 1
590 #define IO_SERIAL_INCREMENT 2
591 #define IO_SOUND_INCREMENT 8
592 #define IO_VIDEO_INCREMENT 1
593 #define SEMAPHORE_INCREMENT 1
594 
595 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
596 
597 typedef struct _BOOTDISK_INFORMATION {
603 
604 typedef struct _BOOTDISK_INFORMATION_EX {
614 
615 #if (NTDDI_VERSION >= NTDDI_WIN7)
616 
620  _ANONYMOUS_UNION union {
623  } DUMMYUNIONNAME;
626 
631 
632 #else
633 
634 #if (NTDDI_VERSION >= NTDDI_VISTA)
635 typedef struct _BOOTDISK_INFORMATION_LITE {
636  ULONG BootDeviceSignature;
637  ULONG SystemDeviceSignature;
638  GUID BootDeviceGuid;
639  GUID SystemDeviceGuid;
640  BOOLEAN BootDeviceIsGpt;
641  BOOLEAN SystemDeviceIsGpt;
643 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
644 
645 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
646 
647 #include <pshpack1.h>
648 
649 typedef struct _EISA_MEMORY_TYPE {
658 
666 
667 typedef struct _EISA_IRQ_DESCRIPTOR {
674 
675 typedef struct _EISA_IRQ_CONFIGURATION {
679 
680 typedef struct _DMA_CONFIGURATION_BYTE0 {
686 
687 typedef struct _DMA_CONFIGURATION_BYTE1 {
693 
694 typedef struct _EISA_DMA_CONFIGURATION {
698 
699 typedef struct _EISA_PORT_DESCRIPTOR {
705 
706 typedef struct _EISA_PORT_CONFIGURATION {
710 
721 
728  UCHAR Selections[26];
730  UCHAR TypeString[80];
737 
738 #include <poppack.h>
739 
740 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
741 
742 #define EISA_FUNCTION_ENABLED 0x80
743 #define EISA_FREE_FORM_DATA 0x40
744 #define EISA_HAS_PORT_INIT_ENTRY 0x20
745 #define EISA_HAS_PORT_RANGE 0x10
746 #define EISA_HAS_DMA_ENTRY 0x08
747 #define EISA_HAS_IRQ_ENTRY 0x04
748 #define EISA_HAS_MEMORY_ENTRY 0x02
749 #define EISA_HAS_TYPE_ENTRY 0x01
750 #define EISA_HAS_INFORMATION \
751  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
752  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
753 
754 #define EISA_MORE_ENTRIES 0x80
755 #define EISA_SYSTEM_MEMORY 0x00
756 #define EISA_MEMORY_TYPE_RAM 0x01
757 
758 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
759 
760 #define EISA_INVALID_SLOT 0x80
761 #define EISA_INVALID_FUNCTION 0x81
762 #define EISA_INVALID_CONFIGURATION 0x82
763 #define EISA_EMPTY_SLOT 0x83
764 #define EISA_INVALID_BIOS_CALL 0x86
765 
766 /*
767 ** Plug and Play structures
768 */
769 
770 typedef VOID
772  PVOID Context);
773 
774 typedef VOID
776  PVOID Context);
777 
778 _Function_class_(TRANSLATE_BUS_ADDRESS)
780 typedef BOOLEAN
781 (NTAPI TRANSLATE_BUS_ADDRESS)(
784  _In_ ULONG Length,
787 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
788 
789 _Function_class_(GET_DMA_ADAPTER)
791 typedef struct _DMA_ADAPTER*
792 (NTAPI GET_DMA_ADAPTER)(
796 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
797 
798 _Function_class_(GET_SET_DEVICE_DATA)
800 typedef ULONG
801 (NTAPI GET_SET_DEVICE_DATA)(
806  _In_ ULONG Length);
807 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
808 
809 typedef enum _DEVICE_INSTALL_STATE {
815 
816 typedef struct _LEGACY_BUS_INFORMATION {
821 
827 
828 typedef VOID
830  _In_ PVOID Context);
831 
840 
841 typedef VOID
845 
846 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
847 
848 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
849 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
850 #define PCI_USE_REVISION 0x00000002
851 #define PCI_USE_VENDEV_IDS 0x00000004
852 #define PCI_USE_CLASS_SUBCLASS 0x00000008
853 #define PCI_USE_PROGIF 0x00000010
854 #define PCI_USE_LOCAL_BUS 0x00000020
855 #define PCI_USE_LOCAL_DEVICE 0x00000040
856 
869 
872 typedef BOOLEAN
873 (NTAPI PCI_IS_DEVICE_PRESENT)(
874  _In_ USHORT VendorID,
879  _In_ ULONG Flags);
880 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
881 
884 typedef BOOLEAN
885 (NTAPI PCI_IS_DEVICE_PRESENT_EX)(
888 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
889 
890 typedef struct _BUS_INTERFACE_STANDARD {
901 
911 
913 typedef struct _DEVICE_CAPABILITIES {
914  _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
915  USHORT Version;
916  ULONG DeviceD1:1;
917  ULONG DeviceD2:1;
918  ULONG LockSupported:1;
919  ULONG EjectSupported:1;
920  ULONG Removable:1;
921  ULONG DockDevice:1;
922  ULONG UniqueID:1;
923  ULONG SilentInstall:1;
924  ULONG RawDeviceOK:1;
925  ULONG SurpriseRemovalOK:1;
926  ULONG WakeFromD0:1;
927  ULONG WakeFromD1:1;
928  ULONG WakeFromD2:1;
929  ULONG WakeFromD3:1;
930  ULONG HardwareDisabled:1;
931  ULONG NonDynamic:1;
932  ULONG WarmEjectSupported:1;
933  ULONG NoDisplayInUI:1;
934  ULONG Reserved1:1;
935  ULONG WakeFromInterrupt:1;
936  ULONG SecureDevice:1;
937  ULONG ChildOfVgaEnabledBridge:1;
938  ULONG DecodeIoOnBoot:1;
939  ULONG Reserved:9;
940  ULONG Address;
941  ULONG UINumber;
943  SYSTEM_POWER_STATE SystemWake;
944  DEVICE_POWER_STATE DeviceWake;
945  ULONG D1Latency;
946  ULONG D2Latency;
947  ULONG D3Latency;
949 
957 
963 
964 #undef INTERFACE
965 
966 typedef struct _INTERFACE {
967  USHORT Size;
968  USHORT Version;
969  PVOID Context;
973 
979 
981 
982 /* PNP_DEVICE_STATE */
983 
984 #define PNP_DEVICE_DISABLED 0x00000001
985 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
986 #define PNP_DEVICE_FAILED 0x00000004
987 #define PNP_DEVICE_REMOVED 0x00000008
988 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
989 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
990 
995  struct _FILE_OBJECT *FileObject;
997  UCHAR CustomDataBuffer[1];
999 
1004  struct _FILE_OBJECT *FileObject;
1006 
1007 #if (NTDDI_VERSION >= NTDDI_VISTA)
1008 #include <devpropdef.h>
1009 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
1010 #endif
1011 
1012 #define PNP_REPLACE_NO_MAP MAXLONGLONG
1013 
1015 typedef NTSTATUS
1016 (NTAPI *PREPLACE_MAP_MEMORY)(
1017  _In_ PHYSICAL_ADDRESS TargetPhysicalAddress,
1022 
1027  struct {
1030  } Ranges[ANYSIZE_ARRAY];
1032 
1035  _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount;
1040 
1047 
1048 #define PNP_REPLACE_PARAMETERS_VERSION 2
1049 
1050 typedef struct _PNP_REPLACE_PARAMETERS {
1059  PREPLACE_MAP_MEMORY MapMemory;
1061 
1062 typedef VOID
1064  VOID);
1065 
1067 typedef NTSTATUS
1068 (NTAPI *PREPLACE_BEGIN)(
1071 
1073 typedef NTSTATUS
1074 (NTAPI *PREPLACE_END)(
1075  _In_ PVOID Context);
1076 
1078 typedef NTSTATUS
1079 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1080  _In_ PVOID Context,
1083 
1085 typedef NTSTATUS
1086 (NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1087  _In_ PVOID Context,
1089  _In_ BOOLEAN Target);
1090 
1092 typedef NTSTATUS
1093 (NTAPI *PREPLACE_SWAP)(
1094  _In_ PVOID Context);
1095 
1097 typedef NTSTATUS
1098 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1099  _In_ PVOID Context);
1100 
1102 typedef NTSTATUS
1103 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1104  _In_ PVOID Context);
1105 
1107 typedef NTSTATUS
1108 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1109  _In_ PVOID Context,
1112 
1114 typedef NTSTATUS
1115 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1116  _In_ PVOID Context,
1118 
1119 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1120 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1121  FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
1122 
1123 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001
1124 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002
1125 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004
1126 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008
1127 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010
1128 
1134  PREPLACE_BEGIN BeginReplace;
1135  PREPLACE_END EndReplace;
1136  PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory;
1137  PREPLACE_SET_PROCESSOR_ID SetProcessorId;
1138  PREPLACE_SWAP Swap;
1139  PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror;
1140  PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory;
1141  PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination;
1142  PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce;
1144 
1146 typedef NTSTATUS
1147 (NTAPI *PREPLACE_DRIVER_INIT)(
1150 
1160 
1161 typedef struct _POWER_SEQUENCE {
1166 
1167 #ifdef _PREFAST_
1168 #define __string_type 0x1000
1169 #define __guid_type 0x2000
1170 #define __multiString_type 0x4000
1171 #else
1172 #define __string_type 0
1173 #define __guid_type 0
1174 #define __multiString_type 0
1175 #endif
1176 
1177 typedef enum {
1202 
1209 
1210 typedef enum _IO_PRIORITY_HINT {
1218 
1219 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1220 
1221 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1223 typedef NTSTATUS
1224 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1227 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1228 
1229 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1231 typedef VOID
1232 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1234 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1235 
1277 #if (NTDDI_VERSION >= NTDDI_VISTA)
1287 #endif
1288 #if (NTDDI_VERSION >= NTDDI_WIN7)
1295 #endif
1298 
1303 
1304 typedef struct _FILE_POSITION_INFORMATION {
1305  LARGE_INTEGER CurrentByteOffset;
1307 
1308 typedef struct _FILE_BASIC_INFORMATION {
1309  LARGE_INTEGER CreationTime;
1310  LARGE_INTEGER LastAccessTime;
1311  LARGE_INTEGER LastWriteTime;
1312  LARGE_INTEGER ChangeTime;
1315 
1319 
1321  ULONG Flags;
1323 
1328 
1332 
1336 
1339  ULONG_PTR ProcessIdList[1];
1341 
1342 typedef struct _FILE_STANDARD_INFORMATION {
1344  LARGE_INTEGER EndOfFile;
1345  ULONG NumberOfLinks;
1346  BOOLEAN DeletePending;
1349 
1350 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1351  LARGE_INTEGER CreationTime;
1352  LARGE_INTEGER LastAccessTime;
1353  LARGE_INTEGER LastWriteTime;
1354  LARGE_INTEGER ChangeTime;
1356  LARGE_INTEGER EndOfFile;
1359 
1360 typedef enum _FSINFOCLASS {
1373 
1374 typedef struct _FILE_FS_DEVICE_INFORMATION {
1376  ULONG Characteristics;
1378 
1379 typedef struct _FILE_FULL_EA_INFORMATION {
1380  ULONG NextEntryOffset;
1381  UCHAR Flags;
1382  UCHAR EaNameLength;
1383  USHORT EaValueLength;
1384  CHAR EaName[1];
1386 
1395 
1401 
1402 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1403 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1404 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1405 
1406 #define FM_LOCK_BIT (0x1)
1407 #define FM_LOCK_BIT_V (0x0)
1408 #define FM_LOCK_WAITER_WOKEN (0x2)
1409 #define FM_LOCK_WAITER_INC (0x4)
1410 
1411 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1413 typedef BOOLEAN
1414 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1415  _In_ struct _FILE_OBJECT *FileObject,
1417  _In_ ULONG Length,
1418  _In_ BOOLEAN Wait,
1419  _In_ ULONG LockKey,
1422  _In_ struct _DEVICE_OBJECT *DeviceObject);
1423 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1424 
1425 _Function_class_(FAST_IO_READ)
1427 typedef BOOLEAN
1428 (NTAPI FAST_IO_READ)(
1429  _In_ struct _FILE_OBJECT *FileObject,
1431  _In_ ULONG Length,
1432  _In_ BOOLEAN Wait,
1433  _In_ ULONG LockKey,
1434  _Out_ PVOID Buffer,
1436  _In_ struct _DEVICE_OBJECT *DeviceObject);
1437 typedef FAST_IO_READ *PFAST_IO_READ;
1438 
1439 _Function_class_(FAST_IO_WRITE)
1441 typedef BOOLEAN
1442 (NTAPI FAST_IO_WRITE)(
1443  _In_ struct _FILE_OBJECT *FileObject,
1445  _In_ ULONG Length,
1446  _In_ BOOLEAN Wait,
1447  _In_ ULONG LockKey,
1448  _In_ PVOID Buffer,
1450  _In_ struct _DEVICE_OBJECT *DeviceObject);
1451 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1452 
1453 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1455 typedef BOOLEAN
1456 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1457  _In_ struct _FILE_OBJECT *FileObject,
1458  _In_ BOOLEAN Wait,
1461  _In_ struct _DEVICE_OBJECT *DeviceObject);
1462 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1463 
1464 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1466 typedef BOOLEAN
1467 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1468  _In_ struct _FILE_OBJECT *FileObject,
1469  _In_ BOOLEAN Wait,
1472  _In_ struct _DEVICE_OBJECT *DeviceObject);
1473 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1474 
1475 _Function_class_(FAST_IO_LOCK)
1477 typedef BOOLEAN
1478 (NTAPI FAST_IO_LOCK)(
1479  _In_ struct _FILE_OBJECT *FileObject,
1483  _In_ ULONG Key,
1487  _In_ struct _DEVICE_OBJECT *DeviceObject);
1488 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1489 
1490 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1492 typedef BOOLEAN
1493 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1494  _In_ struct _FILE_OBJECT *FileObject,
1498  _In_ ULONG Key,
1500  _In_ struct _DEVICE_OBJECT *DeviceObject);
1501 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1502 
1503 _Function_class_(FAST_IO_UNLOCK_ALL)
1505 typedef BOOLEAN
1506 (NTAPI FAST_IO_UNLOCK_ALL)(
1507  _In_ struct _FILE_OBJECT *FileObject,
1510  _In_ struct _DEVICE_OBJECT *DeviceObject);
1511 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1512 
1513 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1515 typedef BOOLEAN
1516 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1517  _In_ struct _FILE_OBJECT *FileObject,
1519  _In_ ULONG Key,
1521  _In_ struct _DEVICE_OBJECT *DeviceObject);
1522 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1523 
1524 _Function_class_(FAST_IO_DEVICE_CONTROL)
1526 typedef BOOLEAN
1527 (NTAPI FAST_IO_DEVICE_CONTROL)(
1528  _In_ struct _FILE_OBJECT *FileObject,
1536  _In_ struct _DEVICE_OBJECT *DeviceObject);
1537 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1538 
1539 _Function_class_(FAST_IO_ACQUIRE_FILE)
1541 typedef VOID
1542 (NTAPI FAST_IO_ACQUIRE_FILE)(
1543  _In_ struct _FILE_OBJECT *FileObject);
1544 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1545 
1546 _Function_class_(FAST_IO_RELEASE_FILE)
1548 typedef VOID
1549 (NTAPI FAST_IO_RELEASE_FILE)(
1550  _In_ struct _FILE_OBJECT *FileObject);
1551 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1552 
1553 _Function_class_(FAST_IO_DETACH_DEVICE)
1555 typedef VOID
1556 (NTAPI FAST_IO_DETACH_DEVICE)(
1559 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1560 
1561 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1563 typedef BOOLEAN
1564 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1565  _In_ struct _FILE_OBJECT *FileObject,
1566  _In_ BOOLEAN Wait,
1569  _In_ struct _DEVICE_OBJECT *DeviceObject);
1570 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1571 
1572 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1574 typedef NTSTATUS
1575 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1576  _In_ struct _FILE_OBJECT *FileObject,
1579  _In_ struct _DEVICE_OBJECT *DeviceObject);
1580 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1581 
1582 _Function_class_(FAST_IO_MDL_READ)
1584 typedef BOOLEAN
1585 (NTAPI FAST_IO_MDL_READ)(
1586  _In_ struct _FILE_OBJECT *FileObject,
1588  _In_ ULONG Length,
1589  _In_ ULONG LockKey,
1590  _Out_ PMDL *MdlChain,
1592  _In_ struct _DEVICE_OBJECT *DeviceObject);
1593 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1594 
1595 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1597 typedef BOOLEAN
1598 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1599  _In_ struct _FILE_OBJECT *FileObject,
1600  _In_ PMDL MdlChain,
1601  _In_ struct _DEVICE_OBJECT *DeviceObject);
1602 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1603 
1604 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1606 typedef BOOLEAN
1607 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1608  _In_ struct _FILE_OBJECT *FileObject,
1610  _In_ ULONG Length,
1611  _In_ ULONG LockKey,
1612  _Out_ PMDL *MdlChain,
1614  _In_ struct _DEVICE_OBJECT *DeviceObject);
1615 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1616 
1617 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1619 typedef BOOLEAN
1620 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1621  _In_ struct _FILE_OBJECT *FileObject,
1623  _In_ PMDL MdlChain,
1624  _In_ struct _DEVICE_OBJECT *DeviceObject);
1625 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1626 
1627 _Function_class_(FAST_IO_READ_COMPRESSED)
1629 typedef BOOLEAN
1630 (NTAPI FAST_IO_READ_COMPRESSED)(
1631  _In_ struct _FILE_OBJECT *FileObject,
1633  _In_ ULONG Length,
1634  _In_ ULONG LockKey,
1635  _Out_ PVOID Buffer,
1636  _Out_ PMDL *MdlChain,
1640  _In_ struct _DEVICE_OBJECT *DeviceObject);
1641 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1642 
1643 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1645 typedef BOOLEAN
1646 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1647  _In_ struct _FILE_OBJECT *FileObject,
1649  _In_ ULONG Length,
1650  _In_ ULONG LockKey,
1651  _In_ PVOID Buffer,
1652  _Out_ PMDL *MdlChain,
1656  _In_ struct _DEVICE_OBJECT *DeviceObject);
1657 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1658 
1659 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1661 typedef BOOLEAN
1662 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1663  _In_ struct _FILE_OBJECT *FileObject,
1664  _In_ PMDL MdlChain,
1665  _In_ struct _DEVICE_OBJECT *DeviceObject);
1666 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1667 
1668 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1670 typedef BOOLEAN
1671 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1672  _In_ struct _FILE_OBJECT *FileObject,
1674  _In_ PMDL MdlChain,
1675  _In_ struct _DEVICE_OBJECT *DeviceObject);
1676 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1677 
1678 _Function_class_(FAST_IO_QUERY_OPEN)
1680 typedef BOOLEAN
1681 (NTAPI FAST_IO_QUERY_OPEN)(
1682  _Inout_ struct _IRP *Irp,
1684  _In_ struct _DEVICE_OBJECT *DeviceObject);
1685 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1686 
1687 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1689 typedef NTSTATUS
1690 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1691  _In_ struct _FILE_OBJECT *FileObject,
1693  _In_ struct _DEVICE_OBJECT *DeviceObject);
1694 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1695 
1696 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1698 typedef NTSTATUS
1699 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1700  _In_ struct _FILE_OBJECT *FileObject,
1701  _In_ struct _DEVICE_OBJECT *DeviceObject);
1702 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1703 
1704 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1706 typedef NTSTATUS
1707 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1708  _In_ struct _FILE_OBJECT *FileObject,
1709  _In_ struct _DEVICE_OBJECT *DeviceObject);
1710 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1711 
1712 typedef struct _FAST_IO_DISPATCH {
1742 
1743 typedef struct _SECTION_OBJECT_POINTERS {
1744  PVOID DataSectionObject;
1745  PVOID SharedCacheMap;
1746  PVOID ImageSectionObject;
1748 
1749 typedef struct _IO_COMPLETION_CONTEXT {
1753 
1754 /* FILE_OBJECT.Flags */
1755 #define FO_FILE_OPEN 0x00000001
1756 #define FO_SYNCHRONOUS_IO 0x00000002
1757 #define FO_ALERTABLE_IO 0x00000004
1758 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1759 #define FO_WRITE_THROUGH 0x00000010
1760 #define FO_SEQUENTIAL_ONLY 0x00000020
1761 #define FO_CACHE_SUPPORTED 0x00000040
1762 #define FO_NAMED_PIPE 0x00000080
1763 #define FO_STREAM_FILE 0x00000100
1764 #define FO_MAILSLOT 0x00000200
1765 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1766 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1767 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1768 #define FO_FILE_MODIFIED 0x00001000
1769 #define FO_FILE_SIZE_CHANGED 0x00002000
1770 #define FO_CLEANUP_COMPLETE 0x00004000
1771 #define FO_TEMPORARY_FILE 0x00008000
1772 #define FO_DELETE_ON_CLOSE 0x00010000
1773 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1774 #define FO_HANDLE_CREATED 0x00040000
1775 #define FO_FILE_FAST_IO_READ 0x00080000
1776 #define FO_RANDOM_ACCESS 0x00100000
1777 #define FO_FILE_OPEN_CANCELLED 0x00200000
1778 #define FO_VOLUME_OPEN 0x00400000
1779 #define FO_REMOTE_ORIGIN 0x01000000
1780 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1781 #define FO_SKIP_COMPLETION_PORT 0x02000000
1782 #define FO_SKIP_SET_EVENT 0x04000000
1783 #define FO_SKIP_SET_FAST_IO 0x08000000
1784 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1785 
1786 /* VPB.Flags */
1787 #define VPB_MOUNTED 0x0001
1788 #define VPB_LOCKED 0x0002
1789 #define VPB_PERSISTENT 0x0004
1790 #define VPB_REMOVE_PENDING 0x0008
1791 #define VPB_RAW_MOUNT 0x0010
1792 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1793 
1794 /* IO_STACK_LOCATION.Flags */
1795 
1796 #define SL_FORCE_ACCESS_CHECK 0x01
1797 #define SL_OPEN_PAGING_FILE 0x02
1798 #define SL_OPEN_TARGET_DIRECTORY 0x04
1799 #define SL_STOP_ON_SYMLINK 0x08
1800 #define SL_CASE_SENSITIVE 0x80
1801 
1802 #define SL_KEY_SPECIFIED 0x01
1803 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1804 #define SL_WRITE_THROUGH 0x04
1805 #define SL_FT_SEQUENTIAL_WRITE 0x08
1806 #define SL_FORCE_DIRECT_WRITE 0x10
1807 #define SL_REALTIME_STREAM 0x20
1808 
1809 #define SL_READ_ACCESS_GRANTED 0x01
1810 #define SL_WRITE_ACCESS_GRANTED 0x04
1811 
1812 #define SL_FAIL_IMMEDIATELY 0x01
1813 #define SL_EXCLUSIVE_LOCK 0x02
1814 
1815 #define SL_RESTART_SCAN 0x01
1816 #define SL_RETURN_SINGLE_ENTRY 0x02
1817 #define SL_INDEX_SPECIFIED 0x04
1818 
1819 #define SL_WATCH_TREE 0x01
1820 
1821 #define SL_ALLOW_RAW_MOUNT 0x01
1822 
1823 $endif (_WDMDDK_)
1824 $if (_WDMDDK_ || _DEVIOCTL_)
1825 #define CTL_CODE(DeviceType, Function, Method, Access) \
1826  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1827 
1828 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1829 
1830 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1831 
1833 $if (_WDMDDK_)
1834 
1835 /* IRP.Flags */
1836 #define IRP_NOCACHE 0x00000001
1837 #define IRP_PAGING_IO 0x00000002
1838 #define IRP_MOUNT_COMPLETION 0x00000002
1839 #define IRP_SYNCHRONOUS_API 0x00000004
1840 #define IRP_ASSOCIATED_IRP 0x00000008
1841 #define IRP_BUFFERED_IO 0x00000010
1842 #define IRP_DEALLOCATE_BUFFER 0x00000020
1843 #define IRP_INPUT_OPERATION 0x00000040
1844 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1845 #define IRP_CREATE_OPERATION 0x00000080
1846 #define IRP_READ_OPERATION 0x00000100
1847 #define IRP_WRITE_OPERATION 0x00000200
1848 #define IRP_CLOSE_OPERATION 0x00000400
1849 #define IRP_DEFER_IO_COMPLETION 0x00000800
1850 #define IRP_OB_QUERY_NAME 0x00001000
1851 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1852 /* The following 2 are missing in latest WDK */
1853 #define IRP_RETRY_IO_COMPLETION 0x00004000
1854 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1855 
1856 /* IRP.AllocationFlags */
1857 #define IRP_QUOTA_CHARGED 0x01
1858 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1859 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1860 #define IRP_LOOKASIDE_ALLOCATION 0x08
1861 
1862 /*
1863 ** IRP function codes
1864 */
1865 
1866 #define IRP_MJ_CREATE 0x00
1867 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1868 #define IRP_MJ_CLOSE 0x02
1869 #define IRP_MJ_READ 0x03
1870 #define IRP_MJ_WRITE 0x04
1871 #define IRP_MJ_QUERY_INFORMATION 0x05
1872 #define IRP_MJ_SET_INFORMATION 0x06
1873 #define IRP_MJ_QUERY_EA 0x07
1874 #define IRP_MJ_SET_EA 0x08
1875 #define IRP_MJ_FLUSH_BUFFERS 0x09
1876 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1877 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1878 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1879 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1880 #define IRP_MJ_DEVICE_CONTROL 0x0e
1881 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1882 #define IRP_MJ_SCSI 0x0f
1883 #define IRP_MJ_SHUTDOWN 0x10
1884 #define IRP_MJ_LOCK_CONTROL 0x11
1885 #define IRP_MJ_CLEANUP 0x12
1886 #define IRP_MJ_CREATE_MAILSLOT 0x13
1887 #define IRP_MJ_QUERY_SECURITY 0x14
1888 #define IRP_MJ_SET_SECURITY 0x15
1889 #define IRP_MJ_POWER 0x16
1890 #define IRP_MJ_SYSTEM_CONTROL 0x17
1891 #define IRP_MJ_DEVICE_CHANGE 0x18
1892 #define IRP_MJ_QUERY_QUOTA 0x19
1893 #define IRP_MJ_SET_QUOTA 0x1a
1894 #define IRP_MJ_PNP 0x1b
1895 #define IRP_MJ_PNP_POWER 0x1b
1896 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1897 
1898 #define IRP_MN_SCSI_CLASS 0x01
1899 
1900 #define IRP_MN_START_DEVICE 0x00
1901 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1902 #define IRP_MN_REMOVE_DEVICE 0x02
1903 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1904 #define IRP_MN_STOP_DEVICE 0x04
1905 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1906 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1907 
1908 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1909 #define IRP_MN_QUERY_INTERFACE 0x08
1910 #define IRP_MN_QUERY_CAPABILITIES 0x09
1911 #define IRP_MN_QUERY_RESOURCES 0x0A
1912 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1913 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1914 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1915 
1916 #define IRP_MN_READ_CONFIG 0x0F
1917 #define IRP_MN_WRITE_CONFIG 0x10
1918 #define IRP_MN_EJECT 0x11
1919 #define IRP_MN_SET_LOCK 0x12
1920 #define IRP_MN_QUERY_ID 0x13
1921 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1922 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1923 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1924 #define IRP_MN_SURPRISE_REMOVAL 0x17
1925 #if (NTDDI_VERSION >= NTDDI_WIN7)
1926 #define IRP_MN_DEVICE_ENUMERATED 0x19
1927 #endif
1928 
1929 #define IRP_MN_WAIT_WAKE 0x00
1930 #define IRP_MN_POWER_SEQUENCE 0x01
1931 #define IRP_MN_SET_POWER 0x02
1932 #define IRP_MN_QUERY_POWER 0x03
1933 
1934 #define IRP_MN_QUERY_ALL_DATA 0x00
1935 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1936 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1937 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1938 #define IRP_MN_ENABLE_EVENTS 0x04
1939 #define IRP_MN_DISABLE_EVENTS 0x05
1940 #define IRP_MN_ENABLE_COLLECTION 0x06
1941 #define IRP_MN_DISABLE_COLLECTION 0x07
1942 #define IRP_MN_REGINFO 0x08
1943 #define IRP_MN_EXECUTE_METHOD 0x09
1944 
1945 #define IRP_MN_REGINFO_EX 0x0b
1946 
1947 typedef struct _FILE_OBJECT {
1948  CSHORT Type;
1949  CSHORT Size;
1951  PVPB Vpb;
1952  PVOID FsContext;
1953  PVOID FsContext2;
1955  PVOID PrivateCacheMap;
1956  NTSTATUS FinalStatus;
1957  struct _FILE_OBJECT *RelatedFileObject;
1958  BOOLEAN LockOperation;
1959  BOOLEAN DeletePending;
1962  BOOLEAN DeleteAccess;
1963  BOOLEAN SharedRead;
1964  BOOLEAN SharedWrite;
1965  BOOLEAN SharedDelete;
1966  ULONG Flags;
1968  LARGE_INTEGER CurrentByteOffset;
1969  volatile ULONG Waiters;
1970  volatile ULONG Busy;
1971  PVOID LastLock;
1972  KEVENT Lock;
1973  KEVENT Event;
1975  KSPIN_LOCK IrpListLock;
1976  LIST_ENTRY IrpList;
1977  volatile PVOID FileObjectExtension;
1979 
1980 typedef struct _IO_ERROR_LOG_PACKET {
1995 
1996 typedef struct _IO_ERROR_LOG_MESSAGE {
2004 
2005 /* See ndk/lpctypes.h */
2006 #ifdef _WIN64
2007 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
2008 #else
2009 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
2010 #endif
2011 
2012 #define ERROR_LOG_LIMIT_SIZE 240
2013 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
2014  sizeof(IO_ERROR_LOG_PACKET) + \
2015  (sizeof(WCHAR) * 40))
2016 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
2017  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2018 #define IO_ERROR_LOG_MESSAGE_LENGTH \
2019  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
2020  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
2021  PORT_MAXIMUM_MESSAGE_LENGTH)
2022 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
2023  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2024 
2025 typedef enum _DMA_WIDTH {
2030 } DMA_WIDTH, *PDMA_WIDTH;
2031 
2032 typedef enum _DMA_SPEED {
2039 } DMA_SPEED, *PDMA_SPEED;
2040 
2041 /* DEVICE_DESCRIPTION.Version */
2042 
2043 #define DEVICE_DESCRIPTION_VERSION 0x0000
2044 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2045 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2046 #define DEVICE_DESCRIPTION_VERSION3 0x0003
2047 
2048 typedef struct _DEVICE_DESCRIPTION {
2065 #if (NTDDI_VERSION >= NTDDI_WIN8)
2070 #endif // NTDDI_WIN8
2072 
2073 #define DMA_ADAPTER_INFO_VERSION1 1
2074 
2075 #define ADAPTER_INFO_SYNCHRONOUS_CALLBACK 0x0001
2076 #define ADAPTER_INFO_API_BYPASS 0x0002
2077 
2078 typedef struct _DMA_ADAPTER_INFO_V1
2079 {
2086 
2087 typedef struct _DMA_ADAPTER_INFO
2088 {
2090  union
2091  {
2093  };
2095 
2096 #define DMA_TRANSFER_INFO_VERSION1 1
2097 #define DMA_TRANSFER_INFO_VERSION2 2
2098 
2100 {
2105 
2107 {
2113 
2114 typedef struct _DMA_TRANSFER_INFO
2115 {
2117  union {
2120  };
2122 
2123 #define DMA_TRANSFER_CONTEXT_VERSION1 1
2124 
2125 #ifdef _WIN64
2126 #define DMA_TRANSFER_CONTEXT_SIZE_V1 128
2127 #else
2128 #define DMA_TRANSFER_CONTEXT_SIZE_V1 64
2129 #endif
2130 
2140 
2141 typedef struct _DEVICE_RELATIONS {
2143  PDEVICE_OBJECT Objects[1];
2145 
2146 typedef struct _DEVOBJ_EXTENSION {
2151 
2152 typedef struct _SCATTER_GATHER_ELEMENT {
2157 
2158 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2159 
2160 #if defined(_MSC_VER)
2161 #if _MSC_VER >= 1200
2162 #pragma warning(push)
2163 #endif
2164 #pragma warning(disable:4200)
2165 #endif /* _MSC_VER */
2166 
2167 typedef struct _SCATTER_GATHER_LIST {
2168  ULONG NumberOfElements;
2170  SCATTER_GATHER_ELEMENT Elements[1];
2172 
2173 #if defined(_MSC_VER)
2174 #if _MSC_VER >= 1200
2175 #pragma warning(pop)
2176 #else
2177 #pragma warning(default:4200)
2178 #endif
2179 #endif /* _MSC_VER */
2180 
2181 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2182 
2183 struct _SCATTER_GATHER_LIST;
2184 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2185 
2186 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2187 
2188 _Function_class_(DRIVER_ADD_DEVICE)
2191 _When_(return>=0, _Kernel_clear_do_init_(__yes))
2192 typedef NTSTATUS
2193 (NTAPI DRIVER_ADD_DEVICE)(
2196 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2197 
2198 typedef struct _DRIVER_EXTENSION {
2204 
2205 #define DRVO_UNLOAD_INVOKED 0x00000001
2206 #define DRVO_LEGACY_DRIVER 0x00000002
2207 #define DRVO_BUILTIN_DRIVER 0x00000004
2208 
2209 _Function_class_(DRIVER_INITIALIZE)
2211 typedef NTSTATUS
2212 (NTAPI DRIVER_INITIALIZE)(
2215 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2216 
2217 _Function_class_(DRIVER_STARTIO)
2221 typedef VOID
2222 (NTAPI DRIVER_STARTIO)(
2224  _Inout_ struct _IRP *Irp);
2225 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2226 
2227 _Function_class_(DRIVER_UNLOAD)
2230 typedef VOID
2231 (NTAPI DRIVER_UNLOAD)(
2232  _In_ struct _DRIVER_OBJECT *DriverObject);
2233 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2234 
2238 typedef NTSTATUS
2241  _Inout_ struct _IRP *Irp);
2244 
2248 typedef NTSTATUS
2249 (NTAPI DRIVER_DISPATCH_PAGED)(
2251  _Inout_ struct _IRP *Irp);
2252 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2253 
2254 typedef struct _DRIVER_OBJECT {
2271 
2272 typedef struct _DMA_ADAPTER {
2277 
2278 typedef enum
2279 {
2285 
2286 typedef VOID
2288  PDMA_ADAPTER DmaAdapter);
2289 
2290 typedef PVOID
2292  _In_ PDMA_ADAPTER DmaAdapter,
2293  _In_ ULONG Length,
2294  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2295  _In_ BOOLEAN CacheEnabled);
2296 
2297 typedef VOID
2299  _In_ PDMA_ADAPTER DmaAdapter,
2300  _In_ ULONG Length,
2301  _In_ PHYSICAL_ADDRESS LogicalAddress,
2303  _In_ BOOLEAN CacheEnabled);
2304 
2305 typedef NTSTATUS
2307  _In_ PDMA_ADAPTER DmaAdapter,
2311  _In_ PVOID Context);
2312 
2313 typedef BOOLEAN
2315  _In_ PDMA_ADAPTER DmaAdapter,
2316  _In_ PMDL Mdl,
2318  _In_ PVOID CurrentVa,
2319  _In_ ULONG Length,
2321 
2322 typedef VOID
2324  _In_ PDMA_ADAPTER DmaAdapter);
2325 
2326 typedef VOID
2328  _In_ PDMA_ADAPTER DmaAdapter,
2331 
2332 typedef PHYSICAL_ADDRESS
2334  _In_ PDMA_ADAPTER DmaAdapter,
2335  _In_ PMDL Mdl,
2337  _In_ PVOID CurrentVa,
2340 
2341 typedef ULONG
2343  _In_ PDMA_ADAPTER DmaAdapter);
2344 
2345 typedef ULONG
2347  _In_ PDMA_ADAPTER DmaAdapter);
2348 
2349 _Function_class_(DRIVER_LIST_CONTROL)
2351 typedef VOID
2352 (NTAPI DRIVER_LIST_CONTROL)(
2354  _In_ struct _IRP *Irp,
2355  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2356  _In_ PVOID Context);
2357 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2358 
2359 typedef NTSTATUS
2361  _In_ PDMA_ADAPTER DmaAdapter,
2363  _In_ PMDL Mdl,
2364  _In_ PVOID CurrentVa,
2365  _In_ ULONG Length,
2367  _In_ PVOID Context,
2369 
2370 typedef VOID
2372  _In_ PDMA_ADAPTER DmaAdapter,
2375 
2376 typedef NTSTATUS
2378  _In_ PDMA_ADAPTER DmaAdapter,
2380  _In_ PVOID CurrentVa,
2381  _In_ ULONG Length,
2382  _Out_ PULONG ScatterGatherListSize,
2383  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2384 
2385 typedef NTSTATUS
2387  _In_ PDMA_ADAPTER DmaAdapter,
2389  _In_ PMDL Mdl,
2390  _In_ PVOID CurrentVa,
2391  _In_ ULONG Length,
2393  _In_ PVOID Context,
2395  _In_ PVOID ScatterGatherBuffer,
2396  _In_ ULONG ScatterGatherLength);
2397 
2398 typedef NTSTATUS
2400  _In_ PDMA_ADAPTER DmaAdapter,
2402  _In_ PMDL OriginalMdl,
2403  _Out_ PMDL *TargetMdl);
2404 
2405 typedef NTSTATUS
2407  _In_ PDMA_ADAPTER DmaAdapter,
2408  _Inout_ PDMA_ADAPTER_INFO AdapterInfo);
2409 
2410 typedef NTSTATUS
2412  _In_ PDMA_ADAPTER DmaAdapter,
2413  _In_ PMDL Mdl,
2415  _In_ ULONG Length,
2416  _In_ BOOLEAN WriteOnly,
2417  _Inout_ PDMA_TRANSFER_INFO TransferInfo);
2418 
2419 typedef NTSTATUS
2421  _In_ PDMA_ADAPTER DmaAdapter,
2422  _Out_ PVOID DmaTransferContext);
2423 
2424 typedef PVOID
2426  _In_ PDMA_ADAPTER DmaAdapter,
2427  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2428  _In_ ULONG Length,
2429  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2430  _In_ BOOLEAN CacheEnabled,
2431  _In_ NODE_REQUIREMENT PreferredNode);
2432 
2433 typedef NTSTATUS
2435  _In_ PDMA_ADAPTER DmaAdapter,
2437  _In_ PVOID DmaTransferContext,
2439  _In_ ULONG Flags,
2441  _In_opt_ PVOID ExecutionContext,
2443 
2444 typedef NTSTATUS
2446  _In_ PDMA_ADAPTER DmaAdapter,
2447  _In_ ULONG FunctionNumber,
2448  _In_ PVOID Context);
2449 
2450 typedef BOOLEAN
2452  _In_ PDMA_ADAPTER DmaAdapter,
2454  _In_ PVOID DmaTransferContext);
2455 
2456 typedef
2457 _Function_class_(DMA_COMPLETION_ROUTINE)
2460 VOID
2461 NTAPI
2462 DMA_COMPLETION_ROUTINE(
2463  _In_ PDMA_ADAPTER DmaAdapter,
2467 
2468 typedef DMA_COMPLETION_ROUTINE *PDMA_COMPLETION_ROUTINE;
2469 
2470 typedef NTSTATUS
2472  _In_ PDMA_ADAPTER DmaAdapter,
2473  _In_ PMDL Mdl,
2479  _Out_writes_bytes_opt_(ScatterGatherBufferLength) PSCATTER_GATHER_LIST ScatterGatherBuffer,
2480  _In_ ULONG ScatterGatherBufferLength,
2483 
2484 typedef NTSTATUS
2486  _In_ PDMA_ADAPTER DmaAdapter,
2488  _In_ PVOID DmaTransferContext,
2489  _In_ PMDL Mdl,
2491  _In_ ULONG Length,
2492  _In_ ULONG Flags,
2498  _Out_opt_ PSCATTER_GATHER_LIST *ScatterGatherList);
2499 
2500 typedef NTSTATUS
2502  _In_ PDMA_ADAPTER DmaAdapter,
2504  _In_ PVOID DmaTransferContext,
2505  _In_ PMDL Mdl,
2507  _In_ ULONG Length,
2508  _In_ ULONG Flags,
2512  _In_ PVOID ScatterGatherBuffer,
2513  _In_ ULONG ScatterGatherLength,
2516  _Out_opt_ PVOID ScatterGatherList);
2517 
2518 typedef NTSTATUS
2520  _In_ PDMA_ADAPTER DmaAdapter,
2521  _In_ PMDL Mdl,
2524  _In_ ULONG Length,
2526 
2527 typedef VOID
2529  _In_ PDMA_ADAPTER DmaAdapter,
2530  _In_ IO_ALLOCATION_ACTION AllocationAction);
2531 
2532 typedef NTSTATUS
2534  _In_ PDMA_ADAPTER DmaAdapter,
2535  _In_ PVOID DmaTransferContext);
2536 
2537 typedef NTSTATUS
2539  _In_ PDMA_ADAPTER DmaAdapter,
2540  _In_ HANDLE DomainHandle,
2541  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2542  _In_ ULONG Length,
2543  _In_ ULONG Flags,
2545  _In_ NODE_REQUIREMENT PreferredNode,
2546  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2548 
2549 typedef NTSTATUS
2551  _In_ PDMA_ADAPTER DmaAdapter,
2552  _In_ PMDL Mdl,
2553  _In_ BOOLEAN ReadOperation);
2554 
2555 typedef NTSTATUS
2557  _In_ PDMA_ADAPTER DmaAdapter,
2558  _In_ HANDLE DomainHandle);
2559 
2560 typedef NTSTATUS
2562  _In_ PDMA_ADAPTER DmaAdapter);
2563 
2564 typedef HANDLE
2566  _In_ PDMA_ADAPTER DmaAdapter);
2567 
2568 typedef PVOID
2570  _In_ PDMA_ADAPTER DmaAdapter,
2571  _In_opt_ PPHYSICAL_ADDRESS MinimumAddress,
2572  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2573  _In_ ULONG Length,
2574  _In_ ULONG Flags,
2576  _In_ NODE_REQUIREMENT PreferredNode,
2577  _Out_ PPHYSICAL_ADDRESS LogicalAddress);
2578 
2579 typedef struct _DMA_COMMON_BUFFER_VECTOR DMA_COMMON_BUFFER_VECTOR, *PDMA_COMMON_BUFFER_VECTOR;
2580 
2581 typedef NTSTATUS
2583  _In_ PDMA_ADAPTER DmaAdapter,
2584  _In_ PHYSICAL_ADDRESS LowAddress,
2587  _In_ ULONG IdealNode,
2588  _In_ ULONG Flags,
2589  _In_ ULONG NumberOfElements,
2590  _In_ ULONGLONG SizeOfElements,
2591  _Out_ PDMA_COMMON_BUFFER_VECTOR *VectorOut);
2592 
2593 typedef VOID
2595  _In_ PDMA_ADAPTER DmaAdapter,
2597  _In_ ULONG Index,
2598  _Out_ PVOID *VirtualAddressOut,
2599  _Out_ PPHYSICAL_ADDRESS LogicalAddressOut);
2600 
2601 typedef VOID
2603  _In_ PDMA_ADAPTER DmaAdapter,
2605  _In_ ULONG Index);
2606 
2607 typedef VOID
2609  _In_ PDMA_ADAPTER DmaAdapter,
2611 
2612 typedef struct _DMA_OPERATIONS {
2653 
2654 typedef struct _IO_RESOURCE_DESCRIPTOR {
2655  UCHAR Option;
2656  UCHAR Type;
2657  UCHAR ShareDisposition;
2658  UCHAR Spare1;
2659  USHORT Flags;
2660  USHORT Spare2;
2661  union {
2662  struct {
2663  ULONG Length;
2664  ULONG Alignment;
2665  PHYSICAL_ADDRESS MinimumAddress;
2666  PHYSICAL_ADDRESS MaximumAddress;
2667  } Port;
2668  struct {
2669  ULONG Length;
2670  ULONG Alignment;
2671  PHYSICAL_ADDRESS MinimumAddress;
2672  PHYSICAL_ADDRESS MaximumAddress;
2673  } Memory;
2674  struct {
2675  ULONG MinimumVector;
2676  ULONG MaximumVector;
2677 #if defined(NT_PROCESSOR_GROUPS)
2678  IRQ_DEVICE_POLICY AffinityPolicy;
2679  USHORT Group;
2680 #else
2681  IRQ_DEVICE_POLICY AffinityPolicy;
2682 #endif
2683  IRQ_PRIORITY PriorityPolicy;
2684  KAFFINITY TargetedProcessors;
2685  } Interrupt;
2686  struct {
2687  ULONG MinimumChannel;
2688  ULONG MaximumChannel;
2689  } Dma;
2690  struct {
2691  ULONG Length;
2692  ULONG Alignment;
2693  PHYSICAL_ADDRESS MinimumAddress;
2694  PHYSICAL_ADDRESS MaximumAddress;
2695  } Generic;
2696  struct {
2697  ULONG Data[3];
2698  } DevicePrivate;
2699  struct {
2700  ULONG Length;
2701  ULONG MinBusNumber;
2702  ULONG MaxBusNumber;
2703  ULONG Reserved;
2704  } BusNumber;
2705  struct {
2706  ULONG Priority;
2707  ULONG Reserved1;
2708  ULONG Reserved2;
2709  } ConfigData;
2710  } u;
2712 
2713 typedef struct _IO_RESOURCE_LIST {
2714  USHORT Version;
2715  USHORT Revision;
2716  ULONG Count;
2717  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2719 
2720 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
2721  ULONG ListSize;
2723  ULONG BusNumber;
2724  ULONG SlotNumber;
2725  ULONG Reserved[3];
2726  ULONG AlternativeLists;
2729 
2730 _Function_class_(DRIVER_CANCEL)
2731 _Requires_lock_held_(_Global_cancel_spin_lock_)
2732 _Releases_lock_(_Global_cancel_spin_lock_)
2735 typedef VOID
2736 (NTAPI DRIVER_CANCEL)(
2739 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2740 
2741 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
2742  CSHORT Type;
2743  USHORT Size;
2744  struct _MDL *MdlAddress;
2745  ULONG Flags;
2746  union {
2747  struct _IRP *MasterIrp;
2748  volatile LONG IrpCount;
2749  PVOID SystemBuffer;
2750  } AssociatedIrp;
2751  LIST_ENTRY ThreadListEntry;
2753  KPROCESSOR_MODE RequestorMode;
2754  BOOLEAN PendingReturned;
2755  CHAR StackCount;
2756  CHAR CurrentLocation;
2757  BOOLEAN Cancel;
2758  KIRQL CancelIrql;
2759  CCHAR ApcEnvironment;
2760  UCHAR AllocationFlags;
2761  PIO_STATUS_BLOCK UserIosb;
2762  PKEVENT UserEvent;
2763  union {
2764  struct {
2765  _ANONYMOUS_UNION union {
2766  PIO_APC_ROUTINE UserApcRoutine;
2767  PVOID IssuingProcess;
2768  } DUMMYUNIONNAME;
2769  PVOID UserApcContext;
2770  } AsynchronousParameters;
2772  } Overlay;
2773  volatile PDRIVER_CANCEL CancelRoutine;
2774  PVOID UserBuffer;
2775  union {
2776  struct {
2777  _ANONYMOUS_UNION union {
2779  _ANONYMOUS_STRUCT struct {
2780  PVOID DriverContext[4];
2781  } DUMMYSTRUCTNAME;
2782  } DUMMYUNIONNAME;
2783  PETHREAD Thread;
2784  PCHAR AuxiliaryBuffer;
2785  _ANONYMOUS_STRUCT struct {
2786  LIST_ENTRY ListEntry;
2787  _ANONYMOUS_UNION union {
2788  struct _IO_STACK_LOCATION *CurrentStackLocation;
2789  ULONG PacketType;
2790  } DUMMYUNIONNAME;
2791  } DUMMYSTRUCTNAME;
2792  struct _FILE_OBJECT *OriginalFileObject;
2793  } Overlay;
2794  KAPC Apc;
2795  PVOID CompletionKey;
2796  } Tail;
2797 } IRP, *PIRP;
2798 
2799 typedef enum _IO_PAGING_PRIORITY {
2806 
2807 _Function_class_(IO_COMPLETION_ROUTINE)
2809 typedef NTSTATUS
2810 (NTAPI IO_COMPLETION_ROUTINE)(
2812  _In_ struct _IRP *Irp,
2814 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2815 
2816 _Function_class_(IO_DPC_ROUTINE)
2820 typedef VOID
2821 (NTAPI IO_DPC_ROUTINE)(
2822  _In_ struct _KDPC *Dpc,
2824  _Inout_ struct _IRP *Irp,
2826 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2827 
2828 typedef NTSTATUS
2831 
2832 typedef NTSTATUS
2834  VOID);
2835 
2836 _Function_class_(IO_TIMER_ROUTINE)
2838 typedef VOID
2839 (NTAPI IO_TIMER_ROUTINE)(
2842 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2843 
2844 typedef struct _IO_SECURITY_CONTEXT {
2850 
2851 struct _IO_CSQ;
2852 
2853 typedef struct _IO_CSQ_IRP_CONTEXT {
2854  ULONG Type;
2855  struct _IRP *Irp;
2856  struct _IO_CSQ *Csq;
2858 
2859 typedef VOID
2860 (NTAPI IO_CSQ_INSERT_IRP)(
2861  _In_ struct _IO_CSQ *Csq,
2863 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2864 
2865 typedef NTSTATUS
2866 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2867  _In_ struct _IO_CSQ *Csq,
2870 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2871 
2872 typedef VOID
2873 (NTAPI IO_CSQ_REMOVE_IRP)(
2874  _In_ struct _IO_CSQ *Csq,
2875  _In_ PIRP Irp);
2876 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2877 
2878 typedef PIRP
2879 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2880  _In_ struct _IO_CSQ *Csq,
2883 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2884 
2885 typedef VOID
2886 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2887  _In_ struct _IO_CSQ *Csq,
2889 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2890 
2891 typedef VOID
2892 (NTAPI IO_CSQ_RELEASE_LOCK)(
2893  _In_ struct _IO_CSQ *Csq,
2894  _In_ KIRQL Irql);
2895 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2896 
2897 typedef VOID
2898 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2899  _In_ struct _IO_CSQ *Csq,
2900  _In_ PIRP Irp);
2901 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2902 
2903 typedef struct _IO_CSQ {
2904  ULONG Type;
2911  PVOID ReservePointer;
2912 } IO_CSQ, *PIO_CSQ;
2913 
2914 typedef enum _BUS_QUERY_ID_TYPE {
2922 
2923 typedef enum _DEVICE_TEXT_TYPE {
2927 
2928 typedef BOOLEAN
2930  PVOID,
2931  PVOID);
2932 
2935 typedef NTSTATUS
2936 (NTAPI *PGPE_CONNECT_VECTOR)(
2940  BOOLEAN,
2942  PVOID,
2943  PVOID);
2944 
2947 typedef NTSTATUS
2948 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2949  PVOID);
2950 
2953 typedef NTSTATUS
2954 (NTAPI *PGPE_ENABLE_EVENT)(
2956  PVOID);
2957 
2960 typedef NTSTATUS
2961 (NTAPI *PGPE_DISABLE_EVENT)(
2963  PVOID);
2964 
2967 typedef NTSTATUS
2968 (NTAPI *PGPE_CLEAR_STATUS)(
2970  PVOID);
2971 
2972 typedef VOID
2974  PVOID,
2975  ULONG);
2976 
2979 typedef NTSTATUS
2980 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2983  PVOID);
2984 
2986 typedef VOID
2987 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2990 
2997  PGPE_CONNECT_VECTOR GpeConnectVector;
2998  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
2999  PGPE_ENABLE_EVENT GpeEnableEvent;
3000  PGPE_DISABLE_EVENT GpeDisableEvent;
3001  PGPE_CLEAR_STATUS GpeClearStatus;
3002  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
3003  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
3005 
3006 typedef BOOLEAN
3010 
3013 typedef NTSTATUS
3014 (NTAPI *PGPE_CONNECT_VECTOR2)(
3015  PVOID Context,
3021  PVOID *ObjectContext);
3022 
3025 typedef NTSTATUS
3026 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
3027  PVOID Context,
3029 
3032 typedef NTSTATUS
3033 (NTAPI *PGPE_ENABLE_EVENT2)(
3034  PVOID Context,
3036 
3039 typedef NTSTATUS
3040 (NTAPI *PGPE_DISABLE_EVENT2)(
3041  PVOID Context,
3043 
3046 typedef NTSTATUS
3047 (NTAPI *PGPE_CLEAR_STATUS2)(
3048  PVOID Context,
3050 
3052 typedef VOID
3053 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
3056 
3059 typedef NTSTATUS
3060 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3061  PVOID Context,
3062  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
3064 
3066 typedef VOID
3067 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3068  PVOID Context);
3069 
3076  PGPE_CONNECT_VECTOR2 GpeConnectVector;
3077  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
3078  PGPE_ENABLE_EVENT2 GpeEnableEvent;
3079  PGPE_DISABLE_EVENT2 GpeDisableEvent;
3080  PGPE_CLEAR_STATUS2 GpeClearStatus;
3081  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
3082  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
3084 
3085 #if !defined(_AMD64_) && !defined(_ARM_)
3086 #include <pshpack4.h>
3087 #endif
3088 
3089 typedef struct _IO_STACK_LOCATION {
3094  union {
3095  struct {
3101  } Create;
3102  struct {
3104  ULONG Options;
3108  } CreatePipe;
3109  struct {
3110  PIO_SECURITY_CONTEXT SecurityContext;
3111  ULONG Options;
3115  } CreateMailslot;
3116  struct {
3120  } Read;
3121  struct {
3122  ULONG Length;
3125  } Write;
3126  struct {
3127  ULONG Length;
3131  } QueryDirectory;
3132  struct {
3133  ULONG Length;
3135  } NotifyDirectory;
3136  struct {
3137  ULONG Length;
3140  } NotifyDirectoryEx;
3141  struct {
3142  ULONG Length;
3144  } QueryFile;
3145  struct {
3146  ULONG Length;
3149  _ANONYMOUS_UNION union {
3150  _ANONYMOUS_STRUCT struct {
3153  } DUMMYSTRUCTNAME;
3156  } DUMMYUNIONNAME;
3157  } SetFile;
3158  struct {
3159  ULONG Length;
3163  } QueryEa;
3164  struct {
3165  ULONG Length;
3166  } SetEa;
3167  struct {
3168  ULONG Length;
3170  } QueryVolume;
3171  struct {
3172  ULONG Length;
3174  } SetVolume;
3175  struct {
3180  } FileSystemControl;
3181  struct {
3185  } LockControl;
3186  struct {
3190  PVOID Type3InputBuffer;
3191  } DeviceIoControl;
3192  struct {
3195  } QuerySecurity;
3196  struct {
3199  } SetSecurity;
3200  struct {
3203  } MountVolume;
3204  struct {
3205  PVPB Vpb;
3207  } VerifyVolume;
3208  struct {
3210  } Scsi;
3211  struct {
3212  ULONG Length;
3216  } QueryQuota;
3217  struct {
3218  ULONG Length;
3219  } SetQuota;
3220  struct {
3222  } QueryDeviceRelations;
3223  struct {
3229  } QueryInterface;
3230  struct {
3233  struct {
3235  } FilterResourceRequirements;
3236  struct {
3241  } ReadWriteConfig;
3242  struct {
3244  } SetLock;
3245  struct {
3247  } QueryId;
3248  struct {
3251  } QueryDeviceText;
3252  struct {
3256  } UsageNotification;
3257  struct {
3259  } WaitWake;
3260  struct {
3262  } PowerSequence;
3263  struct {
3264  union {
3266 #if (NTDDI_VERSION >= NTDDI_VISTA)
3268 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
3269  };
3273  } Power;
3274  struct {
3277  } StartDevice;
3278  struct {
3282  PVOID Buffer;
3283  } WMI;
3284  struct {
3289  } Others;
3290  } Parameters;
3296 
3297 #if !defined(_AMD64_) && !defined(_ARM_)
3298 #include "poppack.h"
3299 #endif
3300 
3301 
3302 /* IO_STACK_LOCATION.Control */
3303 
3304 #define SL_PENDING_RETURNED 0x01
3305 #define SL_ERROR_RETURNED 0x02
3306 #define SL_INVOKE_ON_CANCEL 0x20
3307 #define SL_INVOKE_ON_SUCCESS 0x40
3308 #define SL_INVOKE_ON_ERROR 0x80
3309 
3310 $endif (_WDMDDK_)
3311 $if (_WDMDDK_ || _DEVIOCTL_)
3312 #define METHOD_BUFFERED 0
3313 #define METHOD_IN_DIRECT 1
3314 #define METHOD_OUT_DIRECT 2
3315 #define METHOD_NEITHER 3
3316 
3317 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
3318 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
3319 
3321 $if (_WDMDDK_)
3322 #define FILE_SUPERSEDED 0x00000000
3323 #define FILE_OPENED 0x00000001
3324 #define FILE_CREATED 0x00000002
3325 #define FILE_OVERWRITTEN 0x00000003
3326 #define FILE_EXISTS 0x00000004
3327 #define FILE_DOES_NOT_EXIST 0x00000005
3328 
3329 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
3330 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
3331 
3332 /* also in winnt.h */
3333 #define FILE_LIST_DIRECTORY 0x00000001
3334 #define FILE_READ_DATA 0x00000001
3335 #define FILE_ADD_FILE 0x00000002
3336 #define FILE_WRITE_DATA 0x00000002
3337 #define FILE_ADD_SUBDIRECTORY 0x00000004
3338 #define FILE_APPEND_DATA 0x00000004
3339 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3340 #define FILE_READ_EA 0x00000008
3341 #define FILE_WRITE_EA 0x00000010
3342 #define FILE_EXECUTE 0x00000020
3343 #define FILE_TRAVERSE 0x00000020
3344 #define FILE_DELETE_CHILD 0x00000040
3345 #define FILE_READ_ATTRIBUTES 0x00000080
3346 #define FILE_WRITE_ATTRIBUTES 0x00000100
3347 
3348 #define FILE_SHARE_READ 0x00000001
3349 #define FILE_SHARE_WRITE 0x00000002
3350 #define FILE_SHARE_DELETE 0x00000004
3351 #define FILE_SHARE_VALID_FLAGS 0x00000007
3352 
3353 #define FILE_ATTRIBUTE_READONLY 0x00000001
3354 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3355 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3356 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3357 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3358 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3359 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3360 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3361 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3362 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3363 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3364 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3365 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3366 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3367 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3368 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3369 
3370 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3371 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3372 
3373 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3374 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3375 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3376 #define FILE_VALID_SET_FLAGS 0x00000036
3377 
3378 #define FILE_SUPERSEDE 0x00000000
3379 #define FILE_OPEN 0x00000001
3380 #define FILE_CREATE 0x00000002
3381 #define FILE_OPEN_IF 0x00000003
3382 #define FILE_OVERWRITE 0x00000004
3383 #define FILE_OVERWRITE_IF 0x00000005
3384 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3385 
3386 #define FILE_DIRECTORY_FILE 0x00000001
3387 #define FILE_WRITE_THROUGH 0x00000002
3388 #define FILE_SEQUENTIAL_ONLY 0x00000004
3389 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3390 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3391 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3392 #define FILE_NON_DIRECTORY_FILE 0x00000040
3393 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3394 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3395 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3396 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3397 #define FILE_RANDOM_ACCESS 0x00000800
3398 #define FILE_DELETE_ON_CLOSE 0x00001000
3399 #define FILE_OPEN_BY_FILE_ID 0x00002000
3400 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3401 #define FILE_NO_COMPRESSION 0x00008000
3402 #if (NTDDI_VERSION >= NTDDI_WIN7)
3403 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3404 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3405 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3406 #define FILE_RESERVE_OPFILTER 0x00100000
3407 #define FILE_OPEN_REPARSE_POINT 0x00200000
3408 #define FILE_OPEN_NO_RECALL 0x00400000
3409 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3410 
3411 $endif (_WDMDDK_)
3412 $if (_WDMDDK_ || _DEVIOCTL_)
3413 #define FILE_ANY_ACCESS 0x00000000
3414 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3415 #define FILE_READ_ACCESS 0x00000001
3416 #define FILE_WRITE_ACCESS 0x00000002
3417 
3419 $if (_WDMDDK_)
3420 #define FILE_ALL_ACCESS \
3421  (STANDARD_RIGHTS_REQUIRED | \
3422  SYNCHRONIZE | \
3423  0x1FF)
3424 
3425 #define FILE_GENERIC_EXECUTE \
3426  (STANDARD_RIGHTS_EXECUTE | \
3427  FILE_READ_ATTRIBUTES | \
3428  FILE_EXECUTE | \
3429  SYNCHRONIZE)
3430 
3431 #define FILE_GENERIC_READ \
3432  (STANDARD_RIGHTS_READ | \
3433  FILE_READ_DATA | \
3434  FILE_READ_ATTRIBUTES | \
3435  FILE_READ_EA | \
3436  SYNCHRONIZE)
3437 
3438 #define FILE_GENERIC_WRITE \
3439  (STANDARD_RIGHTS_WRITE | \
3440  FILE_WRITE_DATA | \
3441  FILE_WRITE_ATTRIBUTES | \
3442  FILE_WRITE_EA | \
3443  FILE_APPEND_DATA | \
3444  SYNCHRONIZE)
3445 
3446 /* end winnt.h */
3447 
3448 #define WMIREG_ACTION_REGISTER 1
3449 #define WMIREG_ACTION_DEREGISTER 2
3450 #define WMIREG_ACTION_REREGISTER 3
3451 #define WMIREG_ACTION_UPDATE_GUIDS 4
3452 #define WMIREG_ACTION_BLOCK_IRPS 5
3453 
3454 #define WMIREGISTER 0
3455 #define WMIUPDATE 1
3456 
3459 typedef VOID
3460 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3461  PVOID Wnode,
3462  PVOID Context);
3463 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3464 
3465 #ifndef _PCI_X_
3466 #define _PCI_X_
3467 
3468 typedef struct _PCI_SLOT_NUMBER {
3469  union {
3470  struct {
3474  } bits;
3476  } u;
3478 
3479 #define PCI_TYPE0_ADDRESSES 6
3480 #define PCI_TYPE1_ADDRESSES 2
3481 #define PCI_TYPE2_ADDRESSES 5
3482 
3483 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3484  inheritance, even from a struct renders the type non-POD. So we use
3485  this hack */
3486 #define PCI_COMMON_HEADER_LAYOUT \
3487  USHORT VendorID; \
3488  USHORT DeviceID; \
3489  USHORT Command; \
3490  USHORT Status; \
3491  UCHAR RevisionID; \
3492  UCHAR ProgIf; \
3493  UCHAR SubClass; \
3494  UCHAR BaseClass; \
3495  UCHAR CacheLineSize; \
3496  UCHAR LatencyTimer; \
3497  UCHAR HeaderType; \
3498  UCHAR BIST; \
3499  union { \
3500  struct _PCI_HEADER_TYPE_0 { \
3501  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3502  ULONG CIS; \
3503  USHORT SubVendorID; \
3504  USHORT SubSystemID; \
3505  ULONG ROMBaseAddress; \
3506  UCHAR CapabilitiesPtr; \
3507  UCHAR Reserved1[3]; \
3508  ULONG Reserved2; \
3509  UCHAR InterruptLine; \
3510  UCHAR InterruptPin; \
3511  UCHAR MinimumGrant; \
3512  UCHAR MaximumLatency; \
3513  } type0; \
3514  struct _PCI_HEADER_TYPE_1 { \
3515  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3516  UCHAR PrimaryBus; \
3517  UCHAR SecondaryBus; \
3518  UCHAR SubordinateBus; \
3519  UCHAR SecondaryLatency; \
3520  UCHAR IOBase; \
3521  UCHAR IOLimit; \
3522  USHORT SecondaryStatus; \
3523  USHORT MemoryBase; \
3524  USHORT MemoryLimit; \
3525  USHORT PrefetchBase; \
3526  USHORT PrefetchLimit; \
3527  ULONG PrefetchBaseUpper32; \
3528  ULONG PrefetchLimitUpper32; \
3529  USHORT IOBaseUpper16; \
3530  USHORT IOLimitUpper16; \
3531  UCHAR CapabilitiesPtr; \
3532  UCHAR Reserved1[3]; \
3533  ULONG ROMBaseAddress; \
3534  UCHAR InterruptLine; \
3535  UCHAR InterruptPin; \
3536  USHORT BridgeControl; \
3537  } type1; \
3538  struct _PCI_HEADER_TYPE_2 { \
3539  ULONG SocketRegistersBaseAddress; \
3540  UCHAR CapabilitiesPtr; \
3541  UCHAR Reserved; \
3542  USHORT SecondaryStatus; \
3543  UCHAR PrimaryBus; \
3544  UCHAR SecondaryBus; \
3545  UCHAR SubordinateBus; \
3546  UCHAR SecondaryLatency; \
3547  struct { \
3548  ULONG Base; \
3549  ULONG Limit; \
3550  } Range[PCI_TYPE2_ADDRESSES-1]; \
3551  UCHAR InterruptLine; \
3552  UCHAR InterruptPin; \
3553  USHORT BridgeControl; \
3554  } type2; \
3555  } u;
3556 
3557 typedef struct _PCI_COMMON_HEADER {
3560 
3561 #ifdef __cplusplus
3562 typedef struct _PCI_COMMON_CONFIG {
3564  UCHAR DeviceSpecific[192];
3566 #else
3567 typedef struct _PCI_COMMON_CONFIG {
3569  UCHAR DeviceSpecific[192];
3571 #endif
3572 
3573 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3574 
3575 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3576 
3577 #define PCI_MAX_DEVICES 32
3578 #define PCI_MAX_FUNCTION 8
3579 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3580 #define PCI_INVALID_VENDORID 0xFFFF
3581 
3582 /* PCI_COMMON_CONFIG.HeaderType */
3583 #define PCI_MULTIFUNCTION 0x80
3584 #define PCI_DEVICE_TYPE 0x00
3585 #define PCI_BRIDGE_TYPE 0x01
3586 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3587 
3588 #define PCI_CONFIGURATION_TYPE(PciData) \
3589  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3590 
3591 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3592  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3593 
3594 /* PCI_COMMON_CONFIG.Command */
3595 #define PCI_ENABLE_IO_SPACE 0x0001
3596 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3597 #define PCI_ENABLE_BUS_MASTER 0x0004
3598 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3599 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3600 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3601 #define PCI_ENABLE_PARITY 0x0040
3602 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3603 #define PCI_ENABLE_SERR 0x0100
3604 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3605 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3606 
3607 /* PCI_COMMON_CONFIG.Status */
3608 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3609 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3610 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3611 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3612 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3613 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3614 #define PCI_STATUS_DEVSEL 0x0600
3615 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3616 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3617 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3618 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3619 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3620 
3621 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3622 
3623 #define PCI_WHICHSPACE_CONFIG 0x0
3624 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3625 
3626 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3627 #define PCI_CAPABILITY_ID_AGP 0x02
3628 #define PCI_CAPABILITY_ID_VPD 0x03
3629 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3630 #define PCI_CAPABILITY_ID_MSI 0x05
3631 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3632 #define PCI_CAPABILITY_ID_PCIX 0x07
3633 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3634 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3635 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3636 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3637 #define PCI_CAPABILITY_ID_SHPC 0x0C
3638 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3639 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3640 #define PCI_CAPABILITY_ID_SECURE 0x0F
3641 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3642 #define PCI_CAPABILITY_ID_MSIX 0x11
3643 
3648 
3649 typedef struct _PCI_PMC {
3655  struct _PM_SUPPORT {
3664  } Support;
3665 } PCI_PMC, *PPCI_PMC;
3666 
3667 typedef struct _PCI_PMCSR {
3674 } PCI_PMCSR, *PPCI_PMCSR;
3675 
3676 typedef struct _PCI_PMCSR_BSE {
3681 
3682 typedef struct _PCI_PM_CAPABILITY {
3684  union {
3687  } PMC;
3688  union {
3690  USHORT AsUSHORT;
3691  } PMCSR;
3692  union {
3695  } PMCSR_BSE;
3698 
3699 typedef struct {
3701  union {
3702  struct {
3708  } bits;
3710  } Command;
3711  union {
3712  struct {
3727  } bits;
3729  } Status;
3731 
3732 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3733 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3734 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3735 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3736 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3737 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3738 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3739 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3740 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3741 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3742 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3743 
3749 
3755 
3757  _ANONYMOUS_STRUCT struct {
3773  } DUMMYSTRUCTNAME;
3776 
3778  _ANONYMOUS_STRUCT struct {
3794  } DUMMYSTRUCTNAME;
3797 
3799  _ANONYMOUS_STRUCT struct {
3815  } DUMMYSTRUCTNAME;
3818 
3820  _ANONYMOUS_STRUCT struct {