ReactOS  0.4.14-dev-604-gcfdd483
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_COLD_ALLOCATION 256
18 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 8
19 #define POOL_RAISE_IF_ALLOCATION_FAILURE 16
20 
21 #define IO_TYPE_ADAPTER 1
22 #define IO_TYPE_CONTROLLER 2
23 #define IO_TYPE_DEVICE 3
24 #define IO_TYPE_DRIVER 4
25 #define IO_TYPE_FILE 5
26 #define IO_TYPE_IRP 6
27 #define IO_TYPE_MASTER_ADAPTER 7
28 #define IO_TYPE_OPEN_PACKET 8
29 #define IO_TYPE_TIMER 9
30 #define IO_TYPE_VPB 10
31 #define IO_TYPE_ERROR_LOG 11
32 #define IO_TYPE_ERROR_MESSAGE 12
33 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
34 
35 #define IO_TYPE_CSQ_IRP_CONTEXT 1
36 #define IO_TYPE_CSQ 2
37 #define IO_TYPE_CSQ_EX 3
38 
39 /* IO_RESOURCE_DESCRIPTOR.Option */
40 #define IO_RESOURCE_PREFERRED 0x01
41 #define IO_RESOURCE_DEFAULT 0x02
42 #define IO_RESOURCE_ALTERNATIVE 0x08
43 
46 #define FILE_DEVICE_BEEP 0x00000001
47 #define FILE_DEVICE_CD_ROM 0x00000002
48 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
49 #define FILE_DEVICE_CONTROLLER 0x00000004
50 #define FILE_DEVICE_DATALINK 0x00000005
51 #define FILE_DEVICE_DFS 0x00000006
52 #define FILE_DEVICE_DISK 0x00000007
53 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
54 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
55 #define FILE_DEVICE_INPORT_PORT 0x0000000a
56 #define FILE_DEVICE_KEYBOARD 0x0000000b
57 #define FILE_DEVICE_MAILSLOT 0x0000000c
58 #define FILE_DEVICE_MIDI_IN 0x0000000d
59 #define FILE_DEVICE_MIDI_OUT 0x0000000e
60 #define FILE_DEVICE_MOUSE 0x0000000f
61 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
62 #define FILE_DEVICE_NAMED_PIPE 0x00000011
63 #define FILE_DEVICE_NETWORK 0x00000012
64 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
65 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
66 #define FILE_DEVICE_NULL 0x00000015
67 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
68 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
69 #define FILE_DEVICE_PRINTER 0x00000018
70 #define FILE_DEVICE_SCANNER 0x00000019
71 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
72 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
73 #define FILE_DEVICE_SCREEN 0x0000001c
74 #define FILE_DEVICE_SOUND 0x0000001d
75 #define FILE_DEVICE_STREAMS 0x0000001e
76 #define FILE_DEVICE_TAPE 0x0000001f
77 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
78 #define FILE_DEVICE_TRANSPORT 0x00000021
79 #define FILE_DEVICE_UNKNOWN 0x00000022
80 #define FILE_DEVICE_VIDEO 0x00000023
81 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
82 #define FILE_DEVICE_WAVE_IN 0x00000025
83 #define FILE_DEVICE_WAVE_OUT 0x00000026
84 #define FILE_DEVICE_8042_PORT 0x00000027
85 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
86 #define FILE_DEVICE_BATTERY 0x00000029
87 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
88 #define FILE_DEVICE_MODEM 0x0000002b
89 #define FILE_DEVICE_VDM 0x0000002c
90 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
91 #define FILE_DEVICE_SMB 0x0000002e
92 #define FILE_DEVICE_KS 0x0000002f
93 #define FILE_DEVICE_CHANGER 0x00000030
94 #define FILE_DEVICE_SMARTCARD 0x00000031
95 #define FILE_DEVICE_ACPI 0x00000032
96 #define FILE_DEVICE_DVD 0x00000033
97 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
98 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
99 #define FILE_DEVICE_DFS_VOLUME 0x00000036
100 #define FILE_DEVICE_SERENUM 0x00000037
101 #define FILE_DEVICE_TERMSRV 0x00000038
102 #define FILE_DEVICE_KSEC 0x00000039
103 #define FILE_DEVICE_FIPS 0x0000003A
104 #define FILE_DEVICE_INFINIBAND 0x0000003B
105 #define FILE_DEVICE_VMBUS 0x0000003E
106 #define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F
107 #define FILE_DEVICE_WPD 0x00000040
108 #define FILE_DEVICE_BLUETOOTH 0x00000041
109 #define FILE_DEVICE_MT_COMPOSITE 0x00000042
110 #define FILE_DEVICE_MT_TRANSPORT 0x00000043
111 #define FILE_DEVICE_BIOMETRIC 0x00000044
112 #define FILE_DEVICE_PMI 0x00000045
113 
115 $if (_WDMDDK_)
116 #if defined(NT_PROCESSOR_GROUPS)
117 
119 
120 typedef enum _IRQ_DEVICE_POLICY_USHORT {
125  IrqPolicyAllProcessorsInGroup = 3,
128 
129 #else /* defined(NT_PROCESSOR_GROUPS) */
130 
131 typedef enum _IRQ_DEVICE_POLICY {
139 
140 #endif
141 
142 typedef enum _IRQ_PRIORITY {
148 
149 typedef enum _IRQ_GROUP_POLICY {
153 
154 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
155 
160 
161 typedef struct _CLIENT_ID {
165 
166 typedef struct _VPB {
176 } VPB, *PVPB;
177 
178 typedef enum _IO_ALLOCATION_ACTION {
183 
184 _Function_class_(DRIVER_CONTROL)
186 typedef IO_ALLOCATION_ACTION
187 (NTAPI DRIVER_CONTROL)(
189  _Inout_ struct _IRP *Irp,
191  _In_ PVOID Context);
192 typedef DRIVER_CONTROL *PDRIVER_CONTROL;
193 
194 typedef struct _WAIT_CONTEXT_BLOCK {
203 
205 $if (_NTDDK_)
206 /* DEVICE_OBJECT.Flags */
207 #define DO_DEVICE_HAS_NAME 0x00000040
208 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
209 #define DO_LONG_TERM_REQUESTS 0x00000200
210 #define DO_NEVER_LAST_DEVICE 0x00000400
211 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
212 #define DO_SUPPORTS_TRANSACTIONS 0x00040000
213 #define DO_FORCE_NEITHER_IO 0x00080000
214 #define DO_VOLUME_DEVICE_OBJECT 0x00100000
215 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
216 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
217 #define DO_DISALLOW_EXECUTE 0x00800000
218 
219 $endif (_NTDDK_)
220 $if (_WDMDDK_)
221 /* DEVICE_OBJECT.Flags */
222 #define DO_UNLOAD_PENDING 0x00000001
223 #define DO_VERIFY_VOLUME 0x00000002
224 #define DO_BUFFERED_IO 0x00000004
225 #define DO_EXCLUSIVE 0x00000008
226 #define DO_DIRECT_IO 0x00000010
227 #define DO_MAP_IO_BUFFER 0x00000020
228 #define DO_DEVICE_INITIALIZING 0x00000080
229 #define DO_SHUTDOWN_REGISTERED 0x00000800
230 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
231 #define DO_POWER_PAGABLE 0x00002000
232 #define DO_POWER_INRUSH 0x00004000
233 
234 /* DEVICE_OBJECT.Characteristics */
235 #define FILE_REMOVABLE_MEDIA 0x00000001
236 #define FILE_READ_ONLY_DEVICE 0x00000002
237 #define FILE_FLOPPY_DISKETTE 0x00000004
238 #define FILE_WRITE_ONCE_MEDIA 0x00000008
239 #define FILE_REMOTE_DEVICE 0x00000010
240 #define FILE_DEVICE_IS_MOUNTED 0x00000020
241 #define FILE_VIRTUAL_VOLUME 0x00000040
242 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
243 #define FILE_DEVICE_SECURE_OPEN 0x00000100
244 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
245 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
246 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
247 
248 /* DEVICE_OBJECT.AlignmentRequirement */
249 #define FILE_BYTE_ALIGNMENT 0x00000000
250 #define FILE_WORD_ALIGNMENT 0x00000001
251 #define FILE_LONG_ALIGNMENT 0x00000003
252 #define FILE_QUAD_ALIGNMENT 0x00000007
253 #define FILE_OCTA_ALIGNMENT 0x0000000f
254 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
255 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
256 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
257 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
258 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
259 
260 $endif (_NTDDK_)
262 /* DEVICE_OBJECT.DeviceType */
263 #define DEVICE_TYPE ULONG
264 
266 $if (_WDMDDK_)
267 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {
268  CSHORT Type;
269  USHORT Size;
270  LONG ReferenceCount;
272  struct _DEVICE_OBJECT *NextDevice;
273  struct _DEVICE_OBJECT *AttachedDevice;
274  struct _IRP *CurrentIrp;
276  ULONG Flags;
277  ULONG Characteristics;
278  volatile PVPB Vpb;
279  PVOID DeviceExtension;
282  union {
283  LIST_ENTRY ListEntry;
284  WAIT_CONTEXT_BLOCK Wcb;
285  } Queue;
286  ULONG AlignmentRequirement;
287  KDEVICE_QUEUE DeviceQueue;
288  KDPC Dpc;
289  ULONG ActiveThreadCount;
291  KEVENT DeviceLock;
293  USHORT Spare1;
294  struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
295  PVOID Reserved;
297 
298 typedef enum _IO_SESSION_STATE {
309 
314 
325 
331 
347 
357 
360  union {
364  } ConnectionContext;
372 
375  _ANONYMOUS_UNION union {
379  } DUMMYUNIONNAME;
381 
384  union {
388  } ConnectionContext;
390 
391 typedef enum _IO_ACCESS_TYPE {
396 
397 typedef enum _IO_ACCESS_MODE {
401 
406 
414 
419 
425 
426 #if (NTDDI_VERSION >= NTDDI_WIN7)
427 
428 typedef NTSTATUS
430  VOID);
431 
432 typedef NTSTATUS
433 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
436  _In_ ULONG Event,
440 
441 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
442 
443 #endif
444 
446 
450  volatile LONG IoCount;
453 
466 
467 typedef struct _IO_REMOVE_LOCK {
469 #if DBG
471 #endif
473 
474 typedef struct _IO_WORKITEM *PIO_WORKITEM;
475 
476 _Function_class_(IO_WORKITEM_ROUTINE)
479 typedef VOID
480 (NTAPI IO_WORKITEM_ROUTINE)(
483 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
484 
485 typedef VOID
486 (NTAPI IO_WORKITEM_ROUTINE_EX)(
490 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
491 
492 typedef struct _SHARE_ACCESS {
501 
502 typedef enum _CREATE_FILE_TYPE {
507 
508 #define IO_FORCE_ACCESS_CHECK 0x001
509 #define IO_NO_PARAMETER_CHECKING 0x100
510 
511 #define IO_REPARSE 0x0
512 #define IO_REMOUNT 0x1
513 
514 typedef struct _IO_STATUS_BLOCK {
515  _ANONYMOUS_UNION union {
517  PVOID Pointer;
518  } DUMMYUNIONNAME;
521 
522 #if defined(_WIN64)
523 typedef struct _IO_STATUS_BLOCK32 {
526 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
527 #endif
528 
529 typedef VOID
534 
535 #define PIO_APC_ROUTINE_DEFINED
536 
537 typedef enum _IO_SESSION_EVENT {
547 
548 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff
549 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001
550 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002
551 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004
552 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008
553 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010
554 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020
555 
556 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
557 
558 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L
559 
560 typedef struct _IO_SESSION_CONNECT_INFO {
564 
565 #define EVENT_INCREMENT 1
566 #define IO_NO_INCREMENT 0
567 #define IO_CD_ROM_INCREMENT 1
568 #define IO_DISK_INCREMENT 1
569 #define IO_KEYBOARD_INCREMENT 6
570 #define IO_MAILSLOT_INCREMENT 2
571 #define IO_MOUSE_INCREMENT 6
572 #define IO_NAMED_PIPE_INCREMENT 2
573 #define IO_NETWORK_INCREMENT 2
574 #define IO_PARALLEL_INCREMENT 1
575 #define IO_SERIAL_INCREMENT 2
576 #define IO_SOUND_INCREMENT 8
577 #define IO_VIDEO_INCREMENT 1
578 #define SEMAPHORE_INCREMENT 1
579 
580 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
581 
582 typedef struct _BOOTDISK_INFORMATION {
588 
589 typedef struct _BOOTDISK_INFORMATION_EX {
599 
600 #if (NTDDI_VERSION >= NTDDI_WIN7)
601 
605  _ANONYMOUS_UNION union {
608  } DUMMYUNIONNAME;
611 
616 
617 #else
618 
619 #if (NTDDI_VERSION >= NTDDI_VISTA)
620 typedef struct _BOOTDISK_INFORMATION_LITE {
621  ULONG BootDeviceSignature;
622  ULONG SystemDeviceSignature;
623  GUID BootDeviceGuid;
624  GUID SystemDeviceGuid;
625  BOOLEAN BootDeviceIsGpt;
626  BOOLEAN SystemDeviceIsGpt;
628 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
629 
630 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
631 
632 #include <pshpack1.h>
633 
634 typedef struct _EISA_MEMORY_TYPE {
643 
651 
652 typedef struct _EISA_IRQ_DESCRIPTOR {
659 
660 typedef struct _EISA_IRQ_CONFIGURATION {
664 
665 typedef struct _DMA_CONFIGURATION_BYTE0 {
671 
672 typedef struct _DMA_CONFIGURATION_BYTE1 {
678 
679 typedef struct _EISA_DMA_CONFIGURATION {
683 
684 typedef struct _EISA_PORT_DESCRIPTOR {
690 
691 typedef struct _EISA_PORT_CONFIGURATION {
695 
706 
713  UCHAR Selections[26];
715  UCHAR TypeString[80];
722 
723 #include <poppack.h>
724 
725 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
726 
727 #define EISA_FUNCTION_ENABLED 0x80
728 #define EISA_FREE_FORM_DATA 0x40
729 #define EISA_HAS_PORT_INIT_ENTRY 0x20
730 #define EISA_HAS_PORT_RANGE 0x10
731 #define EISA_HAS_DMA_ENTRY 0x08
732 #define EISA_HAS_IRQ_ENTRY 0x04
733 #define EISA_HAS_MEMORY_ENTRY 0x02
734 #define EISA_HAS_TYPE_ENTRY 0x01
735 #define EISA_HAS_INFORMATION \
736  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
737  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
738 
739 #define EISA_MORE_ENTRIES 0x80
740 #define EISA_SYSTEM_MEMORY 0x00
741 #define EISA_MEMORY_TYPE_RAM 0x01
742 
743 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
744 
745 #define EISA_INVALID_SLOT 0x80
746 #define EISA_INVALID_FUNCTION 0x81
747 #define EISA_INVALID_CONFIGURATION 0x82
748 #define EISA_EMPTY_SLOT 0x83
749 #define EISA_INVALID_BIOS_CALL 0x86
750 
751 /*
752 ** Plug and Play structures
753 */
754 
755 typedef VOID
757  PVOID Context);
758 
759 typedef VOID
761  PVOID Context);
762 
763 _Function_class_(TRANSLATE_BUS_ADDRESS)
765 typedef BOOLEAN
766 (NTAPI TRANSLATE_BUS_ADDRESS)(
769  _In_ ULONG Length,
772 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
773 
774 _Function_class_(GET_DMA_ADAPTER)
776 typedef struct _DMA_ADAPTER*
777 (NTAPI GET_DMA_ADAPTER)(
781 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
782 
783 _Function_class_(GET_SET_DEVICE_DATA)
785 typedef ULONG
786 (NTAPI GET_SET_DEVICE_DATA)(
791  _In_ ULONG Length);
792 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
793 
794 typedef enum _DEVICE_INSTALL_STATE {
800 
801 typedef struct _LEGACY_BUS_INFORMATION {
806 
812 
813 typedef VOID
815  _In_ PVOID Context);
816 
825 
826 typedef VOID
830 
831 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
832 
833 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
834 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
835 #define PCI_USE_REVISION 0x00000002
836 #define PCI_USE_VENDEV_IDS 0x00000004
837 #define PCI_USE_CLASS_SUBCLASS 0x00000008
838 #define PCI_USE_PROGIF 0x00000010
839 #define PCI_USE_LOCAL_BUS 0x00000020
840 #define PCI_USE_LOCAL_DEVICE 0x00000040
841 
854 
857 typedef BOOLEAN
858 (NTAPI PCI_IS_DEVICE_PRESENT)(
859  _In_ USHORT VendorID,
864  _In_ ULONG Flags);
865 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
866 
869 typedef BOOLEAN
870 (NTAPI PCI_IS_DEVICE_PRESENT_EX)(
873 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
874 
875 typedef struct _BUS_INTERFACE_STANDARD {
886 
896 
898 typedef struct _DEVICE_CAPABILITIES {
899  _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
900  USHORT Version;
901  ULONG DeviceD1:1;
902  ULONG DeviceD2:1;
903  ULONG LockSupported:1;
904  ULONG EjectSupported:1;
905  ULONG Removable:1;
906  ULONG DockDevice:1;
907  ULONG UniqueID:1;
908  ULONG SilentInstall:1;
909  ULONG RawDeviceOK:1;
910  ULONG SurpriseRemovalOK:1;
911  ULONG WakeFromD0:1;
912  ULONG WakeFromD1:1;
913  ULONG WakeFromD2:1;
914  ULONG WakeFromD3:1;
915  ULONG HardwareDisabled:1;
916  ULONG NonDynamic:1;
917  ULONG WarmEjectSupported:1;
918  ULONG NoDisplayInUI:1;
919  ULONG Reserved:14;
920  ULONG Address;
921  ULONG UINumber;
923  SYSTEM_POWER_STATE SystemWake;
924  DEVICE_POWER_STATE DeviceWake;
925  ULONG D1Latency;
926  ULONG D2Latency;
927  ULONG D3Latency;
929 
937 
943 
944 #undef INTERFACE
945 
946 typedef struct _INTERFACE {
947  USHORT Size;
948  USHORT Version;
949  PVOID Context;
953 
959 
961 
962 /* PNP_DEVICE_STATE */
963 
964 #define PNP_DEVICE_DISABLED 0x00000001
965 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
966 #define PNP_DEVICE_FAILED 0x00000004
967 #define PNP_DEVICE_REMOVED 0x00000008
968 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
969 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
970 
975  struct _FILE_OBJECT *FileObject;
977  UCHAR CustomDataBuffer[1];
979 
984  struct _FILE_OBJECT *FileObject;
986 
987 #if (NTDDI_VERSION >= NTDDI_VISTA)
988 #include <devpropdef.h>
989 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
990 #endif
991 
992 #define PNP_REPLACE_NO_MAP MAXLONGLONG
993 
995 typedef NTSTATUS
996 (NTAPI *PREPLACE_MAP_MEMORY)(
997  _In_ PHYSICAL_ADDRESS TargetPhysicalAddress,
1002 
1007  struct {
1010  } Ranges[ANYSIZE_ARRAY];
1012 
1015  _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount;
1020 
1027 
1028 #define PNP_REPLACE_PARAMETERS_VERSION 2
1029 
1030 typedef struct _PNP_REPLACE_PARAMETERS {
1039  PREPLACE_MAP_MEMORY MapMemory;
1041 
1042 typedef VOID
1044  VOID);
1045 
1047 typedef NTSTATUS
1048 (NTAPI *PREPLACE_BEGIN)(
1051 
1053 typedef NTSTATUS
1054 (NTAPI *PREPLACE_END)(
1055  _In_ PVOID Context);
1056 
1058 typedef NTSTATUS
1059 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1060  _In_ PVOID Context,
1063 
1065 typedef NTSTATUS
1066 (NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1067  _In_ PVOID Context,
1069  _In_ BOOLEAN Target);
1070 
1072 typedef NTSTATUS
1073 (NTAPI *PREPLACE_SWAP)(
1074  _In_ PVOID Context);
1075 
1077 typedef NTSTATUS
1078 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1079  _In_ PVOID Context);
1080 
1082 typedef NTSTATUS
1083 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1084  _In_ PVOID Context);
1085 
1087 typedef NTSTATUS
1088 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1089  _In_ PVOID Context,
1092 
1094 typedef NTSTATUS
1095 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1096  _In_ PVOID Context,
1098 
1099 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1100 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1101  FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
1102 
1103 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001
1104 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002
1105 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004
1106 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008
1107 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010
1108 
1114  PREPLACE_BEGIN BeginReplace;
1115  PREPLACE_END EndReplace;
1116  PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory;
1117  PREPLACE_SET_PROCESSOR_ID SetProcessorId;
1118  PREPLACE_SWAP Swap;
1119  PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror;
1120  PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory;
1121  PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination;
1122  PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce;
1124 
1126 typedef NTSTATUS
1127 (NTAPI *PREPLACE_DRIVER_INIT)(
1130 
1137 
1138 typedef struct _POWER_SEQUENCE {
1143 
1144 #ifdef _PREFAST_
1145 #define __string_type 0x1000
1146 #define __guid_type 0x2000
1147 #define __multiString_type 0x4000
1148 #else
1149 #define __string_type 0
1150 #define __guid_type 0
1151 #define __multiString_type 0
1152 #endif
1153 
1154 typedef enum {
1179 
1186 
1187 typedef enum _IO_PRIORITY_HINT {
1195 
1196 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1197 
1198 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1200 typedef NTSTATUS
1201 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1204 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1205 
1206 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1208 typedef VOID
1209 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1211 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1212 
1254 #if (NTDDI_VERSION >= NTDDI_VISTA)
1264 #endif
1265 #if (NTDDI_VERSION >= NTDDI_WIN7)
1272 #endif
1275 
1280 
1281 typedef struct _FILE_POSITION_INFORMATION {
1282  LARGE_INTEGER CurrentByteOffset;
1284 
1285 typedef struct _FILE_BASIC_INFORMATION {
1286  LARGE_INTEGER CreationTime;
1287  LARGE_INTEGER LastAccessTime;
1288  LARGE_INTEGER LastWriteTime;
1289  LARGE_INTEGER ChangeTime;
1292 
1296 
1298  ULONG Flags;
1300 
1305 
1309 
1313 
1316  ULONG_PTR ProcessIdList[1];
1318 
1319 typedef struct _FILE_STANDARD_INFORMATION {
1321  LARGE_INTEGER EndOfFile;
1322  ULONG NumberOfLinks;
1323  BOOLEAN DeletePending;
1326 
1327 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1328  LARGE_INTEGER CreationTime;
1329  LARGE_INTEGER LastAccessTime;
1330  LARGE_INTEGER LastWriteTime;
1331  LARGE_INTEGER ChangeTime;
1333  LARGE_INTEGER EndOfFile;
1336 
1337 typedef enum _FSINFOCLASS {
1350 
1351 typedef struct _FILE_FS_DEVICE_INFORMATION {
1353  ULONG Characteristics;
1355 
1356 typedef struct _FILE_FULL_EA_INFORMATION {
1357  ULONG NextEntryOffset;
1358  UCHAR Flags;
1359  UCHAR EaNameLength;
1360  USHORT EaValueLength;
1361  CHAR EaName[1];
1363 
1372 
1378 
1379 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1380 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1381 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1382 
1383 #define FM_LOCK_BIT (0x1)
1384 #define FM_LOCK_BIT_V (0x0)
1385 #define FM_LOCK_WAITER_WOKEN (0x2)
1386 #define FM_LOCK_WAITER_INC (0x4)
1387 
1388 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1390 typedef BOOLEAN
1391 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1392  _In_ struct _FILE_OBJECT *FileObject,
1394  _In_ ULONG Length,
1395  _In_ BOOLEAN Wait,
1396  _In_ ULONG LockKey,
1400 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1401 
1402 _Function_class_(FAST_IO_READ)
1404 typedef BOOLEAN
1405 (NTAPI FAST_IO_READ)(
1406  _In_ struct _FILE_OBJECT *FileObject,
1408  _In_ ULONG Length,
1409  _In_ BOOLEAN Wait,
1410  _In_ ULONG LockKey,
1411  _Out_ PVOID Buffer,
1413  _In_ struct _DEVICE_OBJECT *DeviceObject);
1414 typedef FAST_IO_READ *PFAST_IO_READ;
1415 
1416 _Function_class_(FAST_IO_WRITE)
1418 typedef BOOLEAN
1419 (NTAPI FAST_IO_WRITE)(
1420  _In_ struct _FILE_OBJECT *FileObject,
1422  _In_ ULONG Length,
1423  _In_ BOOLEAN Wait,
1424  _In_ ULONG LockKey,
1425  _In_ PVOID Buffer,
1427  _In_ struct _DEVICE_OBJECT *DeviceObject);
1428 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1429 
1430 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1432 typedef BOOLEAN
1433 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1434  _In_ struct _FILE_OBJECT *FileObject,
1435  _In_ BOOLEAN Wait,
1438  _In_ struct _DEVICE_OBJECT *DeviceObject);
1439 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1440 
1441 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1443 typedef BOOLEAN
1444 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1445  _In_ struct _FILE_OBJECT *FileObject,
1446  _In_ BOOLEAN Wait,
1449  _In_ struct _DEVICE_OBJECT *DeviceObject);
1450 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1451 
1452 _Function_class_(FAST_IO_LOCK)
1454 typedef BOOLEAN
1455 (NTAPI FAST_IO_LOCK)(
1456  _In_ struct _FILE_OBJECT *FileObject,
1460  _In_ ULONG Key,
1464  _In_ struct _DEVICE_OBJECT *DeviceObject);
1465 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1466 
1467 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1469 typedef BOOLEAN
1470 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1471  _In_ struct _FILE_OBJECT *FileObject,
1475  _In_ ULONG Key,
1477  _In_ struct _DEVICE_OBJECT *DeviceObject);
1478 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1479 
1480 _Function_class_(FAST_IO_UNLOCK_ALL)
1482 typedef BOOLEAN
1483 (NTAPI FAST_IO_UNLOCK_ALL)(
1484  _In_ struct _FILE_OBJECT *FileObject,
1487  _In_ struct _DEVICE_OBJECT *DeviceObject);
1488 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1489 
1490 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1492 typedef BOOLEAN
1493 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1494  _In_ struct _FILE_OBJECT *FileObject,
1496  _In_ ULONG Key,
1498  _In_ struct _DEVICE_OBJECT *DeviceObject);
1499 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1500 
1501 _Function_class_(FAST_IO_DEVICE_CONTROL)
1503 typedef BOOLEAN
1504 (NTAPI FAST_IO_DEVICE_CONTROL)(
1505  _In_ struct _FILE_OBJECT *FileObject,
1513  _In_ struct _DEVICE_OBJECT *DeviceObject);
1514 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1515 
1516 _Function_class_(FAST_IO_ACQUIRE_FILE)
1518 typedef VOID
1519 (NTAPI FAST_IO_ACQUIRE_FILE)(
1520  _In_ struct _FILE_OBJECT *FileObject);
1521 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1522 
1523 _Function_class_(FAST_IO_RELEASE_FILE)
1525 typedef VOID
1526 (NTAPI FAST_IO_RELEASE_FILE)(
1527  _In_ struct _FILE_OBJECT *FileObject);
1528 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1529 
1530 _Function_class_(FAST_IO_DETACH_DEVICE)
1532 typedef VOID
1533 (NTAPI FAST_IO_DETACH_DEVICE)(
1536 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1537 
1538 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1540 typedef BOOLEAN
1541 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1542  _In_ struct _FILE_OBJECT *FileObject,
1543  _In_ BOOLEAN Wait,
1546  _In_ struct _DEVICE_OBJECT *DeviceObject);
1547 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1548 
1549 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1551 typedef NTSTATUS
1552 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1553  _In_ struct _FILE_OBJECT *FileObject,
1556  _In_ struct _DEVICE_OBJECT *DeviceObject);
1557 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1558 
1559 _Function_class_(FAST_IO_MDL_READ)
1561 typedef BOOLEAN
1562 (NTAPI FAST_IO_MDL_READ)(
1563  _In_ struct _FILE_OBJECT *FileObject,
1565  _In_ ULONG Length,
1566  _In_ ULONG LockKey,
1567  _Out_ PMDL *MdlChain,
1569  _In_ struct _DEVICE_OBJECT *DeviceObject);
1570 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1571 
1572 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1574 typedef BOOLEAN
1575 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1576  _In_ struct _FILE_OBJECT *FileObject,
1577  _In_ PMDL MdlChain,
1578  _In_ struct _DEVICE_OBJECT *DeviceObject);
1579 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1580 
1581 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1583 typedef BOOLEAN
1584 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1585  _In_ struct _FILE_OBJECT *FileObject,
1587  _In_ ULONG Length,
1588  _In_ ULONG LockKey,
1589  _Out_ PMDL *MdlChain,
1591  _In_ struct _DEVICE_OBJECT *DeviceObject);
1592 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1593 
1594 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1596 typedef BOOLEAN
1597 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1598  _In_ struct _FILE_OBJECT *FileObject,
1600  _In_ PMDL MdlChain,
1601  _In_ struct _DEVICE_OBJECT *DeviceObject);
1602 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1603 
1604 _Function_class_(FAST_IO_READ_COMPRESSED)
1606 typedef BOOLEAN
1607 (NTAPI FAST_IO_READ_COMPRESSED)(
1608  _In_ struct _FILE_OBJECT *FileObject,
1610  _In_ ULONG Length,
1611  _In_ ULONG LockKey,
1612  _Out_ PVOID Buffer,
1613  _Out_ PMDL *MdlChain,
1617  _In_ struct _DEVICE_OBJECT *DeviceObject);
1618 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1619 
1620 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1622 typedef BOOLEAN
1623 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1624  _In_ struct _FILE_OBJECT *FileObject,
1626  _In_ ULONG Length,
1627  _In_ ULONG LockKey,
1628  _In_ PVOID Buffer,
1629  _Out_ PMDL *MdlChain,
1633  _In_ struct _DEVICE_OBJECT *DeviceObject);
1634 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1635 
1636 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1638 typedef BOOLEAN
1639 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1640  _In_ struct _FILE_OBJECT *FileObject,
1641  _In_ PMDL MdlChain,
1642  _In_ struct _DEVICE_OBJECT *DeviceObject);
1643 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1644 
1645 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1647 typedef BOOLEAN
1648 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1649  _In_ struct _FILE_OBJECT *FileObject,
1651  _In_ PMDL MdlChain,
1652  _In_ struct _DEVICE_OBJECT *DeviceObject);
1653 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1654 
1655 _Function_class_(FAST_IO_QUERY_OPEN)
1657 typedef BOOLEAN
1658 (NTAPI FAST_IO_QUERY_OPEN)(
1659  _Inout_ struct _IRP *Irp,
1661  _In_ struct _DEVICE_OBJECT *DeviceObject);
1662 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1663 
1664 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1666 typedef NTSTATUS
1667 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1668  _In_ struct _FILE_OBJECT *FileObject,
1670  _In_ struct _DEVICE_OBJECT *DeviceObject);
1671 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1672 
1673 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1675 typedef NTSTATUS
1676 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1677  _In_ struct _FILE_OBJECT *FileObject,
1678  _In_ struct _DEVICE_OBJECT *DeviceObject);
1679 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1680 
1681 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1683 typedef NTSTATUS
1684 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1685  _In_ struct _FILE_OBJECT *FileObject,
1686  _In_ struct _DEVICE_OBJECT *DeviceObject);
1687 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1688 
1689 typedef struct _FAST_IO_DISPATCH {
1719 
1720 typedef struct _SECTION_OBJECT_POINTERS {
1721  PVOID DataSectionObject;
1722  PVOID SharedCacheMap;
1723  PVOID ImageSectionObject;
1725 
1726 typedef struct _IO_COMPLETION_CONTEXT {
1730 
1731 /* FILE_OBJECT.Flags */
1732 #define FO_FILE_OPEN 0x00000001
1733 #define FO_SYNCHRONOUS_IO 0x00000002
1734 #define FO_ALERTABLE_IO 0x00000004
1735 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1736 #define FO_WRITE_THROUGH 0x00000010
1737 #define FO_SEQUENTIAL_ONLY 0x00000020
1738 #define FO_CACHE_SUPPORTED 0x00000040
1739 #define FO_NAMED_PIPE 0x00000080
1740 #define FO_STREAM_FILE 0x00000100
1741 #define FO_MAILSLOT 0x00000200
1742 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1743 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1744 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1745 #define FO_FILE_MODIFIED 0x00001000
1746 #define FO_FILE_SIZE_CHANGED 0x00002000
1747 #define FO_CLEANUP_COMPLETE 0x00004000
1748 #define FO_TEMPORARY_FILE 0x00008000
1749 #define FO_DELETE_ON_CLOSE 0x00010000
1750 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1751 #define FO_HANDLE_CREATED 0x00040000
1752 #define FO_FILE_FAST_IO_READ 0x00080000
1753 #define FO_RANDOM_ACCESS 0x00100000
1754 #define FO_FILE_OPEN_CANCELLED 0x00200000
1755 #define FO_VOLUME_OPEN 0x00400000
1756 #define FO_REMOTE_ORIGIN 0x01000000
1757 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1758 #define FO_SKIP_COMPLETION_PORT 0x02000000
1759 #define FO_SKIP_SET_EVENT 0x04000000
1760 #define FO_SKIP_SET_FAST_IO 0x08000000
1761 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1762 
1763 /* VPB.Flags */
1764 #define VPB_MOUNTED 0x0001
1765 #define VPB_LOCKED 0x0002
1766 #define VPB_PERSISTENT 0x0004
1767 #define VPB_REMOVE_PENDING 0x0008
1768 #define VPB_RAW_MOUNT 0x0010
1769 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1770 
1771 /* IO_STACK_LOCATION.Flags */
1772 
1773 #define SL_FORCE_ACCESS_CHECK 0x01
1774 #define SL_OPEN_PAGING_FILE 0x02
1775 #define SL_OPEN_TARGET_DIRECTORY 0x04
1776 #define SL_STOP_ON_SYMLINK 0x08
1777 #define SL_CASE_SENSITIVE 0x80
1778 
1779 #define SL_KEY_SPECIFIED 0x01
1780 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1781 #define SL_WRITE_THROUGH 0x04
1782 #define SL_FT_SEQUENTIAL_WRITE 0x08
1783 #define SL_FORCE_DIRECT_WRITE 0x10
1784 #define SL_REALTIME_STREAM 0x20
1785 
1786 #define SL_READ_ACCESS_GRANTED 0x01
1787 #define SL_WRITE_ACCESS_GRANTED 0x04
1788 
1789 #define SL_FAIL_IMMEDIATELY 0x01
1790 #define SL_EXCLUSIVE_LOCK 0x02
1791 
1792 #define SL_RESTART_SCAN 0x01
1793 #define SL_RETURN_SINGLE_ENTRY 0x02
1794 #define SL_INDEX_SPECIFIED 0x04
1795 
1796 #define SL_WATCH_TREE 0x01
1797 
1798 #define SL_ALLOW_RAW_MOUNT 0x01
1799 
1800 $endif (_WDMDDK_)
1801 $if (_WDMDDK_ || _DEVIOCTL_)
1802 #define CTL_CODE(DeviceType, Function, Method, Access) \
1803  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1804 
1805 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1806 
1807 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1808 
1810 $if (_WDMDDK_)
1811 
1812 /* IRP.Flags */
1813 #define IRP_NOCACHE 0x00000001
1814 #define IRP_PAGING_IO 0x00000002
1815 #define IRP_MOUNT_COMPLETION 0x00000002
1816 #define IRP_SYNCHRONOUS_API 0x00000004
1817 #define IRP_ASSOCIATED_IRP 0x00000008
1818 #define IRP_BUFFERED_IO 0x00000010
1819 #define IRP_DEALLOCATE_BUFFER 0x00000020
1820 #define IRP_INPUT_OPERATION 0x00000040
1821 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1822 #define IRP_CREATE_OPERATION 0x00000080
1823 #define IRP_READ_OPERATION 0x00000100
1824 #define IRP_WRITE_OPERATION 0x00000200
1825 #define IRP_CLOSE_OPERATION 0x00000400
1826 #define IRP_DEFER_IO_COMPLETION 0x00000800
1827 #define IRP_OB_QUERY_NAME 0x00001000
1828 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1829 /* The following 2 are missing in latest WDK */
1830 #define IRP_RETRY_IO_COMPLETION 0x00004000
1831 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1832 
1833 /* IRP.AllocationFlags */
1834 #define IRP_QUOTA_CHARGED 0x01
1835 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1836 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1837 #define IRP_LOOKASIDE_ALLOCATION 0x08
1838 
1839 /*
1840 ** IRP function codes
1841 */
1842 
1843 #define IRP_MJ_CREATE 0x00
1844 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1845 #define IRP_MJ_CLOSE 0x02
1846 #define IRP_MJ_READ 0x03
1847 #define IRP_MJ_WRITE 0x04
1848 #define IRP_MJ_QUERY_INFORMATION 0x05
1849 #define IRP_MJ_SET_INFORMATION 0x06
1850 #define IRP_MJ_QUERY_EA 0x07
1851 #define IRP_MJ_SET_EA 0x08
1852 #define IRP_MJ_FLUSH_BUFFERS 0x09
1853 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1854 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1855 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1856 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1857 #define IRP_MJ_DEVICE_CONTROL 0x0e
1858 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1859 #define IRP_MJ_SCSI 0x0f
1860 #define IRP_MJ_SHUTDOWN 0x10
1861 #define IRP_MJ_LOCK_CONTROL 0x11
1862 #define IRP_MJ_CLEANUP 0x12
1863 #define IRP_MJ_CREATE_MAILSLOT 0x13
1864 #define IRP_MJ_QUERY_SECURITY 0x14
1865 #define IRP_MJ_SET_SECURITY 0x15
1866 #define IRP_MJ_POWER 0x16
1867 #define IRP_MJ_SYSTEM_CONTROL 0x17
1868 #define IRP_MJ_DEVICE_CHANGE 0x18
1869 #define IRP_MJ_QUERY_QUOTA 0x19
1870 #define IRP_MJ_SET_QUOTA 0x1a
1871 #define IRP_MJ_PNP 0x1b
1872 #define IRP_MJ_PNP_POWER 0x1b
1873 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1874 
1875 #define IRP_MN_SCSI_CLASS 0x01
1876 
1877 #define IRP_MN_START_DEVICE 0x00
1878 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1879 #define IRP_MN_REMOVE_DEVICE 0x02
1880 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1881 #define IRP_MN_STOP_DEVICE 0x04
1882 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1883 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1884 
1885 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1886 #define IRP_MN_QUERY_INTERFACE 0x08
1887 #define IRP_MN_QUERY_CAPABILITIES 0x09
1888 #define IRP_MN_QUERY_RESOURCES 0x0A
1889 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1890 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1891 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1892 
1893 #define IRP_MN_READ_CONFIG 0x0F
1894 #define IRP_MN_WRITE_CONFIG 0x10
1895 #define IRP_MN_EJECT 0x11
1896 #define IRP_MN_SET_LOCK 0x12
1897 #define IRP_MN_QUERY_ID 0x13
1898 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1899 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1900 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1901 #define IRP_MN_SURPRISE_REMOVAL 0x17
1902 #if (NTDDI_VERSION >= NTDDI_WIN7)
1903 #define IRP_MN_DEVICE_ENUMERATED 0x19
1904 #endif
1905 
1906 #define IRP_MN_WAIT_WAKE 0x00
1907 #define IRP_MN_POWER_SEQUENCE 0x01
1908 #define IRP_MN_SET_POWER 0x02
1909 #define IRP_MN_QUERY_POWER 0x03
1910 
1911 #define IRP_MN_QUERY_ALL_DATA 0x00
1912 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1913 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1914 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1915 #define IRP_MN_ENABLE_EVENTS 0x04
1916 #define IRP_MN_DISABLE_EVENTS 0x05
1917 #define IRP_MN_ENABLE_COLLECTION 0x06
1918 #define IRP_MN_DISABLE_COLLECTION 0x07
1919 #define IRP_MN_REGINFO 0x08
1920 #define IRP_MN_EXECUTE_METHOD 0x09
1921 
1922 #define IRP_MN_REGINFO_EX 0x0b
1923 
1924 typedef struct _FILE_OBJECT {
1925  CSHORT Type;
1926  CSHORT Size;
1928  PVPB Vpb;
1929  PVOID FsContext;
1930  PVOID FsContext2;
1932  PVOID PrivateCacheMap;
1933  NTSTATUS FinalStatus;
1934  struct _FILE_OBJECT *RelatedFileObject;
1935  BOOLEAN LockOperation;
1936  BOOLEAN DeletePending;
1939  BOOLEAN DeleteAccess;
1940  BOOLEAN SharedRead;
1941  BOOLEAN SharedWrite;
1942  BOOLEAN SharedDelete;
1943  ULONG Flags;
1945  LARGE_INTEGER CurrentByteOffset;
1946  volatile ULONG Waiters;
1947  volatile ULONG Busy;
1948  PVOID LastLock;
1949  KEVENT Lock;
1950  KEVENT Event;
1952  KSPIN_LOCK IrpListLock;
1953  LIST_ENTRY IrpList;
1954  volatile PVOID FileObjectExtension;
1956 
1957 typedef struct _IO_ERROR_LOG_PACKET {
1972 
1973 typedef struct _IO_ERROR_LOG_MESSAGE {
1981 
1982 /* See ndk/lpctypes.h */
1983 #ifdef _WIN64
1984 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
1985 #else
1986 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
1987 #endif
1988 
1989 #define ERROR_LOG_LIMIT_SIZE 240
1990 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1991  sizeof(IO_ERROR_LOG_PACKET) + \
1992  (sizeof(WCHAR) * 40))
1993 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
1994  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1995 #define IO_ERROR_LOG_MESSAGE_LENGTH \
1996  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
1997  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
1998  PORT_MAXIMUM_MESSAGE_LENGTH)
1999 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
2000  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2001 
2002 typedef enum _DMA_WIDTH {
2007 } DMA_WIDTH, *PDMA_WIDTH;
2008 
2009 typedef enum _DMA_SPEED {
2016 } DMA_SPEED, *PDMA_SPEED;
2017 
2018 /* DEVICE_DESCRIPTION.Version */
2019 
2020 #define DEVICE_DESCRIPTION_VERSION 0x0000
2021 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2022 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2023 
2024 typedef struct _DEVICE_DESCRIPTION {
2042 
2052 
2053 typedef struct _DEVICE_RELATIONS {
2055  PDEVICE_OBJECT Objects[1];
2057 
2058 typedef struct _DEVOBJ_EXTENSION {
2063 
2064 typedef struct _SCATTER_GATHER_ELEMENT {
2069 
2070 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2071 
2072 #if defined(_MSC_VER)
2073 #if _MSC_VER >= 1200
2074 #pragma warning(push)
2075 #endif
2076 #pragma warning(disable:4200)
2077 #endif /* _MSC_VER */
2078 
2079 typedef struct _SCATTER_GATHER_LIST {
2080  ULONG NumberOfElements;
2082  SCATTER_GATHER_ELEMENT Elements[1];
2084 
2085 #if defined(_MSC_VER)
2086 #if _MSC_VER >= 1200
2087 #pragma warning(pop)
2088 #else
2089 #pragma warning(default:4200)
2090 #endif
2091 #endif /* _MSC_VER */
2092 
2093 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2094 
2095 struct _SCATTER_GATHER_LIST;
2096 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2097 
2098 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2099 
2100 _Function_class_(DRIVER_ADD_DEVICE)
2103 _When_(return>=0, _Kernel_clear_do_init_(__yes))
2104 typedef NTSTATUS
2105 (NTAPI DRIVER_ADD_DEVICE)(
2108 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2109 
2110 typedef struct _DRIVER_EXTENSION {
2116 
2117 #define DRVO_UNLOAD_INVOKED 0x00000001
2118 #define DRVO_LEGACY_DRIVER 0x00000002
2119 #define DRVO_BUILTIN_DRIVER 0x00000004
2120 
2121 _Function_class_(DRIVER_INITIALIZE)
2123 typedef NTSTATUS
2124 (NTAPI DRIVER_INITIALIZE)(
2127 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2128 
2129 _Function_class_(DRIVER_STARTIO)
2133 typedef VOID
2134 (NTAPI DRIVER_STARTIO)(
2136  _Inout_ struct _IRP *Irp);
2137 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2138 
2139 _Function_class_(DRIVER_UNLOAD)
2142 typedef VOID
2143 (NTAPI DRIVER_UNLOAD)(
2144  _In_ struct _DRIVER_OBJECT *DriverObject);
2145 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2146 
2150 typedef NTSTATUS
2153  _Inout_ struct _IRP *Irp);
2156 
2160 typedef NTSTATUS
2161 (NTAPI DRIVER_DISPATCH_PAGED)(
2163  _Inout_ struct _IRP *Irp);
2164 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2165 
2166 typedef struct _DRIVER_OBJECT {
2183 
2184 typedef struct _DMA_ADAPTER {
2189 
2190 typedef VOID
2192  PDMA_ADAPTER DmaAdapter);
2193 
2194 typedef PVOID
2196  _In_ PDMA_ADAPTER DmaAdapter,
2197  _In_ ULONG Length,
2198  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2199  _In_ BOOLEAN CacheEnabled);
2200 
2201 typedef VOID
2203  _In_ PDMA_ADAPTER DmaAdapter,
2204  _In_ ULONG Length,
2205  _In_ PHYSICAL_ADDRESS LogicalAddress,
2207  _In_ BOOLEAN CacheEnabled);
2208 
2209 typedef NTSTATUS
2211  _In_ PDMA_ADAPTER DmaAdapter,
2215  _In_ PVOID Context);
2216 
2217 typedef BOOLEAN
2219  _In_ PDMA_ADAPTER DmaAdapter,
2220  _In_ PMDL Mdl,
2222  _In_ PVOID CurrentVa,
2223  _In_ ULONG Length,
2224  _In_ BOOLEAN WriteToDevice);
2225 
2226 typedef VOID
2228  _In_ PDMA_ADAPTER DmaAdapter);
2229 
2230 typedef VOID
2232  _In_ PDMA_ADAPTER DmaAdapter,
2235 
2236 typedef PHYSICAL_ADDRESS
2238  _In_ PDMA_ADAPTER DmaAdapter,
2239  _In_ PMDL Mdl,
2241  _In_ PVOID CurrentVa,
2243  _In_ BOOLEAN WriteToDevice);
2244 
2245 typedef ULONG
2247  _In_ PDMA_ADAPTER DmaAdapter);
2248 
2249 typedef ULONG
2251  _In_ PDMA_ADAPTER DmaAdapter);
2252 
2253 _Function_class_(DRIVER_LIST_CONTROL)
2255 typedef VOID
2256 (NTAPI DRIVER_LIST_CONTROL)(
2258  _In_ struct _IRP *Irp,
2259  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2260  _In_ PVOID Context);
2261 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2262 
2263 typedef NTSTATUS
2265  _In_ PDMA_ADAPTER DmaAdapter,
2267  _In_ PMDL Mdl,
2268  _In_ PVOID CurrentVa,
2269  _In_ ULONG Length,
2271  _In_ PVOID Context,
2272  _In_ BOOLEAN WriteToDevice);
2273 
2274 typedef VOID
2276  _In_ PDMA_ADAPTER DmaAdapter,
2278  _In_ BOOLEAN WriteToDevice);
2279 
2280 typedef NTSTATUS
2282  _In_ PDMA_ADAPTER DmaAdapter,
2283  _In_ PMDL Mdl OPTIONAL,
2284  _In_ PVOID CurrentVa,
2285  _In_ ULONG Length,
2286  _Out_ PULONG ScatterGatherListSize,
2287  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2288 
2289 typedef NTSTATUS
2291  _In_ PDMA_ADAPTER DmaAdapter,
2293  _In_ PMDL Mdl,
2294  _In_ PVOID CurrentVa,
2295  _In_ ULONG Length,
2297  _In_ PVOID Context,
2298  _In_ BOOLEAN WriteToDevice,
2299  _In_ PVOID ScatterGatherBuffer,
2300  _In_ ULONG ScatterGatherLength);
2301 
2302 typedef NTSTATUS
2304  _In_ PDMA_ADAPTER DmaAdapter,
2306  _In_ PMDL OriginalMdl,
2307  _Out_ PMDL *TargetMdl);
2308 
2309 typedef struct _DMA_OPERATIONS {
2327 
2328 typedef struct _IO_RESOURCE_DESCRIPTOR {
2329  UCHAR Option;
2330  UCHAR Type;
2331  UCHAR ShareDisposition;
2332  UCHAR Spare1;
2333  USHORT Flags;
2334  USHORT Spare2;
2335  union {
2336  struct {
2337  ULONG Length;
2338  ULONG Alignment;
2339  PHYSICAL_ADDRESS MinimumAddress;
2340  PHYSICAL_ADDRESS MaximumAddress;
2341  } Port;
2342  struct {
2343  ULONG Length;
2344  ULONG Alignment;
2345  PHYSICAL_ADDRESS MinimumAddress;
2346  PHYSICAL_ADDRESS MaximumAddress;
2347  } Memory;
2348  struct {
2349  ULONG MinimumVector;
2350  ULONG MaximumVector;
2351  } Interrupt;
2352  struct {
2353  ULONG MinimumChannel;
2354  ULONG MaximumChannel;
2355  } Dma;
2356  struct {
2357  ULONG Length;
2358  ULONG Alignment;
2359  PHYSICAL_ADDRESS MinimumAddress;
2360  PHYSICAL_ADDRESS MaximumAddress;
2361  } Generic;
2362  struct {
2363  ULONG Data[3];
2364  } DevicePrivate;
2365  struct {
2366  ULONG Length;
2367  ULONG MinBusNumber;
2368  ULONG MaxBusNumber;
2369  ULONG Reserved;
2370  } BusNumber;
2371  struct {
2372  ULONG Priority;
2373  ULONG Reserved1;
2374  ULONG Reserved2;
2375  } ConfigData;
2376  } u;
2378 
2379 typedef struct _IO_RESOURCE_LIST {
2383  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2385 
2395 
2396 _Function_class_(DRIVER_CANCEL)
2397 _Requires_lock_held_(_Global_cancel_spin_lock_)
2398 _Releases_lock_(_Global_cancel_spin_lock_)
2401 typedef VOID
2402 (NTAPI DRIVER_CANCEL)(
2404  _Inout_ _IRQL_uses_cancel_ struct _IRP *Irp);
2405 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2406 
2407 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
2408  CSHORT Type;
2409  USHORT Size;
2410  struct _MDL *MdlAddress;
2411  ULONG Flags;
2412  union {
2413  struct _IRP *MasterIrp;
2414  volatile LONG IrpCount;
2415  PVOID SystemBuffer;
2416  } AssociatedIrp;
2417  LIST_ENTRY ThreadListEntry;
2419  KPROCESSOR_MODE RequestorMode;
2420  BOOLEAN PendingReturned;
2421  CHAR StackCount;
2422  CHAR CurrentLocation;
2423  BOOLEAN Cancel;
2424  KIRQL CancelIrql;
2425  CCHAR ApcEnvironment;
2426  UCHAR AllocationFlags;
2427  PIO_STATUS_BLOCK UserIosb;
2428  PKEVENT UserEvent;
2429  union {
2430  struct {
2431  _ANONYMOUS_UNION union {
2432  PIO_APC_ROUTINE UserApcRoutine;
2433  PVOID IssuingProcess;
2434  } DUMMYUNIONNAME;
2435  PVOID UserApcContext;
2436  } AsynchronousParameters;
2438  } Overlay;
2439  volatile PDRIVER_CANCEL CancelRoutine;
2440  PVOID UserBuffer;
2441  union {
2442  struct {
2443  _ANONYMOUS_UNION union {
2445  _ANONYMOUS_STRUCT struct {
2446  PVOID DriverContext[4];
2447  } DUMMYSTRUCTNAME;
2448  } DUMMYUNIONNAME;
2449  PETHREAD Thread;
2450  PCHAR AuxiliaryBuffer;
2451  _ANONYMOUS_STRUCT struct {
2452  LIST_ENTRY ListEntry;
2453  _ANONYMOUS_UNION union {
2454  struct _IO_STACK_LOCATION *CurrentStackLocation;
2455  ULONG PacketType;
2456  } DUMMYUNIONNAME;
2457  } DUMMYSTRUCTNAME;
2458  struct _FILE_OBJECT *OriginalFileObject;
2459  } Overlay;
2460  KAPC Apc;
2461  PVOID CompletionKey;
2462  } Tail;
2463 } IRP, *PIRP;
2464 
2465 typedef enum _IO_PAGING_PRIORITY {
2472 
2473 _Function_class_(IO_COMPLETION_ROUTINE)
2475 typedef NTSTATUS
2476 (NTAPI IO_COMPLETION_ROUTINE)(
2478  _In_ struct _IRP *Irp,
2480 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2481 
2482 _Function_class_(IO_DPC_ROUTINE)
2486 typedef VOID
2487 (NTAPI IO_DPC_ROUTINE)(
2488  _In_ struct _KDPC *Dpc,
2490  _Inout_ struct _IRP *Irp,
2492 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2493 
2494 typedef NTSTATUS
2497 
2498 typedef NTSTATUS
2500  VOID);
2501 
2502 _Function_class_(IO_TIMER_ROUTINE)
2504 typedef VOID
2505 (NTAPI IO_TIMER_ROUTINE)(
2508 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2509 
2510 typedef struct _IO_SECURITY_CONTEXT {
2516 
2517 struct _IO_CSQ;
2518 
2519 typedef struct _IO_CSQ_IRP_CONTEXT {
2520  ULONG Type;
2521  struct _IRP *Irp;
2522  struct _IO_CSQ *Csq;
2524 
2525 typedef VOID
2526 (NTAPI IO_CSQ_INSERT_IRP)(
2527  _In_ struct _IO_CSQ *Csq,
2529 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2530 
2531 typedef NTSTATUS
2532 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2533  _In_ struct _IO_CSQ *Csq,
2536 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2537 
2538 typedef VOID
2539 (NTAPI IO_CSQ_REMOVE_IRP)(
2540  _In_ struct _IO_CSQ *Csq,
2541  _In_ PIRP Irp);
2542 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2543 
2544 typedef PIRP
2545 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2546  _In_ struct _IO_CSQ *Csq,
2549 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2550 
2551 typedef VOID
2552 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2553  _In_ struct _IO_CSQ *Csq,
2555 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2556 
2557 typedef VOID
2558 (NTAPI IO_CSQ_RELEASE_LOCK)(
2559  _In_ struct _IO_CSQ *Csq,
2560  _In_ KIRQL Irql);
2561 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2562 
2563 typedef VOID
2564 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2565  _In_ struct _IO_CSQ *Csq,
2566  _In_ PIRP Irp);
2567 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2568 
2569 typedef struct _IO_CSQ {
2570  ULONG Type;
2577  PVOID ReservePointer;
2578 } IO_CSQ, *PIO_CSQ;
2579 
2580 typedef enum _BUS_QUERY_ID_TYPE {
2587 
2588 typedef enum _DEVICE_TEXT_TYPE {
2592 
2593 typedef BOOLEAN
2595  PVOID,
2596  PVOID);
2597 
2600 typedef NTSTATUS
2601 (NTAPI *PGPE_CONNECT_VECTOR)(
2605  BOOLEAN,
2607  PVOID,
2608  PVOID);
2609 
2612 typedef NTSTATUS
2613 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2614  PVOID);
2615 
2618 typedef NTSTATUS
2619 (NTAPI *PGPE_ENABLE_EVENT)(
2621  PVOID);
2622 
2625 typedef NTSTATUS
2626 (NTAPI *PGPE_DISABLE_EVENT)(
2628  PVOID);
2629 
2632 typedef NTSTATUS
2633 (NTAPI *PGPE_CLEAR_STATUS)(
2635  PVOID);
2636 
2637 typedef VOID
2639  PVOID,
2640  ULONG);
2641 
2644 typedef NTSTATUS
2645 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2648  PVOID);
2649 
2651 typedef VOID
2652 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2655 
2662  PGPE_CONNECT_VECTOR GpeConnectVector;
2663  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
2664  PGPE_ENABLE_EVENT GpeEnableEvent;
2665  PGPE_DISABLE_EVENT GpeDisableEvent;
2666  PGPE_CLEAR_STATUS GpeClearStatus;
2667  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
2668  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
2670 
2671 typedef BOOLEAN
2675 
2678 typedef NTSTATUS
2679 (NTAPI *PGPE_CONNECT_VECTOR2)(
2680  PVOID Context,
2686  PVOID *ObjectContext);
2687 
2690 typedef NTSTATUS
2691 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
2692  PVOID Context,
2694 
2697 typedef NTSTATUS
2698 (NTAPI *PGPE_ENABLE_EVENT2)(
2699  PVOID Context,
2701 
2704 typedef NTSTATUS
2705 (NTAPI *PGPE_DISABLE_EVENT2)(
2706  PVOID Context,
2708 
2711 typedef NTSTATUS
2712 (NTAPI *PGPE_CLEAR_STATUS2)(
2713  PVOID Context,
2715 
2717 typedef VOID
2718 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
2721 
2724 typedef NTSTATUS
2725 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2726  PVOID Context,
2727  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
2729 
2731 typedef VOID
2732 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2733  PVOID Context);
2734 
2741  PGPE_CONNECT_VECTOR2 GpeConnectVector;
2742  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
2743  PGPE_ENABLE_EVENT2 GpeEnableEvent;
2744  PGPE_DISABLE_EVENT2 GpeDisableEvent;
2745  PGPE_CLEAR_STATUS2 GpeClearStatus;
2746  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
2747  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
2749 
2750 #if !defined(_AMD64_) && !defined(_ARM_)
2751 #include <pshpack4.h>
2752 #endif
2753 
2754 typedef struct _IO_STACK_LOCATION {
2759  union {
2760  struct {
2766  } Create;
2767  struct {
2769  ULONG Options;
2773  } CreatePipe;
2774  struct {
2775  PIO_SECURITY_CONTEXT SecurityContext;
2776  ULONG Options;
2780  } CreateMailslot;
2781  struct {
2785  } Read;
2786  struct {
2787  ULONG Length;
2790  } Write;
2791  struct {
2792  ULONG Length;
2796  } QueryDirectory;
2797  struct {
2798  ULONG Length;
2800  } NotifyDirectory;
2801  struct {
2802  ULONG Length;
2805  } NotifyDirectoryEx;
2806  struct {
2807  ULONG Length;
2809  } QueryFile;
2810  struct {
2811  ULONG Length;
2814  _ANONYMOUS_UNION union {
2815  _ANONYMOUS_STRUCT struct {
2818  } DUMMYSTRUCTNAME;
2821  } DUMMYUNIONNAME;
2822  } SetFile;
2823  struct {
2824  ULONG Length;
2828  } QueryEa;
2829  struct {
2830  ULONG Length;
2831  } SetEa;
2832  struct {
2833  ULONG Length;
2835  } QueryVolume;
2836  struct {
2837  ULONG Length;
2839  } SetVolume;
2840  struct {
2845  } FileSystemControl;
2846  struct {
2850  } LockControl;
2851  struct {
2855  PVOID Type3InputBuffer;
2856  } DeviceIoControl;
2857  struct {
2860  } QuerySecurity;
2861  struct {
2864  } SetSecurity;
2865  struct {
2868  } MountVolume;
2869  struct {
2870  PVPB Vpb;
2872  } VerifyVolume;
2873  struct {
2875  } Scsi;
2876  struct {
2877  ULONG Length;
2881  } QueryQuota;
2882  struct {
2883  ULONG Length;
2884  } SetQuota;
2885  struct {
2887  } QueryDeviceRelations;
2888  struct {
2894  } QueryInterface;
2895  struct {
2898  struct {
2900  } FilterResourceRequirements;
2901  struct {
2906  } ReadWriteConfig;
2907  struct {
2909  } SetLock;
2910  struct {
2912  } QueryId;
2913  struct {
2916  } QueryDeviceText;
2917  struct {
2921  } UsageNotification;
2922  struct {
2924  } WaitWake;
2925  struct {
2927  } PowerSequence;
2928  struct {
2929  union {
2931 #if (NTDDI_VERSION >= NTDDI_VISTA)
2933 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
2934  };
2938  } Power;
2939  struct {
2942  } StartDevice;
2943  struct {
2947  PVOID Buffer;
2948  } WMI;
2949  struct {
2954  } Others;
2955  } Parameters;
2961 
2962 #if !defined(_AMD64_) && !defined(_ARM_)
2963 #include "poppack.h"
2964 #endif
2965 
2966 
2967 /* IO_STACK_LOCATION.Control */
2968 
2969 #define SL_PENDING_RETURNED 0x01
2970 #define SL_ERROR_RETURNED 0x02
2971 #define SL_INVOKE_ON_CANCEL 0x20
2972 #define SL_INVOKE_ON_SUCCESS 0x40
2973 #define SL_INVOKE_ON_ERROR 0x80
2974 
2975 $endif (_WDMDDK_)
2976 $if (_WDMDDK_ || _DEVIOCTL_)
2977 #define METHOD_BUFFERED 0
2978 #define METHOD_IN_DIRECT 1
2979 #define METHOD_OUT_DIRECT 2
2980 #define METHOD_NEITHER 3
2981 
2982 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2983 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2984 
2986 $if (_WDMDDK_)
2987 #define FILE_SUPERSEDED 0x00000000
2988 #define FILE_OPENED 0x00000001
2989 #define FILE_CREATED 0x00000002
2990 #define FILE_OVERWRITTEN 0x00000003
2991 #define FILE_EXISTS 0x00000004
2992 #define FILE_DOES_NOT_EXIST 0x00000005
2993 
2994 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
2995 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
2996 
2997 /* also in winnt.h */
2998 #define FILE_LIST_DIRECTORY 0x00000001
2999 #define FILE_READ_DATA 0x00000001
3000 #define FILE_ADD_FILE 0x00000002
3001 #define FILE_WRITE_DATA 0x00000002
3002 #define FILE_ADD_SUBDIRECTORY 0x00000004
3003 #define FILE_APPEND_DATA 0x00000004
3004 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3005 #define FILE_READ_EA 0x00000008
3006 #define FILE_WRITE_EA 0x00000010
3007 #define FILE_EXECUTE 0x00000020
3008 #define FILE_TRAVERSE 0x00000020
3009 #define FILE_DELETE_CHILD 0x00000040
3010 #define FILE_READ_ATTRIBUTES 0x00000080
3011 #define FILE_WRITE_ATTRIBUTES 0x00000100
3012 
3013 #define FILE_SHARE_READ 0x00000001
3014 #define FILE_SHARE_WRITE 0x00000002
3015 #define FILE_SHARE_DELETE 0x00000004
3016 #define FILE_SHARE_VALID_FLAGS 0x00000007
3017 
3018 #define FILE_ATTRIBUTE_READONLY 0x00000001
3019 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3020 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3021 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3022 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3023 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3024 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3025 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3026 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3027 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3028 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3029 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3030 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3031 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3032 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3033 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3034 
3035 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3036 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3037 
3038 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3039 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3040 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3041 #define FILE_VALID_SET_FLAGS 0x00000036
3042 
3043 #define FILE_SUPERSEDE 0x00000000
3044 #define FILE_OPEN 0x00000001
3045 #define FILE_CREATE 0x00000002
3046 #define FILE_OPEN_IF 0x00000003
3047 #define FILE_OVERWRITE 0x00000004
3048 #define FILE_OVERWRITE_IF 0x00000005
3049 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3050 
3051 #define FILE_DIRECTORY_FILE 0x00000001
3052 #define FILE_WRITE_THROUGH 0x00000002
3053 #define FILE_SEQUENTIAL_ONLY 0x00000004
3054 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3055 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3056 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3057 #define FILE_NON_DIRECTORY_FILE 0x00000040
3058 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3059 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3060 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3061 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3062 #define FILE_RANDOM_ACCESS 0x00000800
3063 #define FILE_DELETE_ON_CLOSE 0x00001000
3064 #define FILE_OPEN_BY_FILE_ID 0x00002000
3065 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3066 #define FILE_NO_COMPRESSION 0x00008000
3067 #if (NTDDI_VERSION >= NTDDI_WIN7)
3068 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3069 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3070 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3071 #define FILE_RESERVE_OPFILTER 0x00100000
3072 #define FILE_OPEN_REPARSE_POINT 0x00200000
3073 #define FILE_OPEN_NO_RECALL 0x00400000
3074 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3075 
3076 $endif (_WDMDDK_)
3077 $if (_WDMDDK_ || _DEVIOCTL_)
3078 #define FILE_ANY_ACCESS 0x00000000
3079 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3080 #define FILE_READ_ACCESS 0x00000001
3081 #define FILE_WRITE_ACCESS 0x00000002
3082 
3084 $if (_WDMDDK_)
3085 #define FILE_ALL_ACCESS \
3086  (STANDARD_RIGHTS_REQUIRED | \
3087  SYNCHRONIZE | \
3088  0x1FF)
3089 
3090 #define FILE_GENERIC_EXECUTE \
3091  (STANDARD_RIGHTS_EXECUTE | \
3092  FILE_READ_ATTRIBUTES | \
3093  FILE_EXECUTE | \
3094  SYNCHRONIZE)
3095 
3096 #define FILE_GENERIC_READ \
3097  (STANDARD_RIGHTS_READ | \
3098  FILE_READ_DATA | \
3099  FILE_READ_ATTRIBUTES | \
3100  FILE_READ_EA | \
3101  SYNCHRONIZE)
3102 
3103 #define FILE_GENERIC_WRITE \
3104  (STANDARD_RIGHTS_WRITE | \
3105  FILE_WRITE_DATA | \
3106  FILE_WRITE_ATTRIBUTES | \
3107  FILE_WRITE_EA | \
3108  FILE_APPEND_DATA | \
3109  SYNCHRONIZE)
3110 
3111 /* end winnt.h */
3112 
3113 #define WMIREG_ACTION_REGISTER 1
3114 #define WMIREG_ACTION_DEREGISTER 2
3115 #define WMIREG_ACTION_REREGISTER 3
3116 #define WMIREG_ACTION_UPDATE_GUIDS 4
3117 #define WMIREG_ACTION_BLOCK_IRPS 5
3118 
3119 #define WMIREGISTER 0
3120 #define WMIUPDATE 1
3121 
3124 typedef VOID
3125 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3126  PVOID Wnode,
3127  PVOID Context);
3128 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3129 
3130 #ifndef _PCI_X_
3131 #define _PCI_X_
3132 
3133 typedef struct _PCI_SLOT_NUMBER {
3134  union {
3135  struct {
3139  } bits;
3141  } u;
3143 
3144 #define PCI_TYPE0_ADDRESSES 6
3145 #define PCI_TYPE1_ADDRESSES 2
3146 #define PCI_TYPE2_ADDRESSES 5
3147 
3148 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3149  inheritance, even from a struct renders the type non-POD. So we use
3150  this hack */
3151 #define PCI_COMMON_HEADER_LAYOUT \
3152  USHORT VendorID; \
3153  USHORT DeviceID; \
3154  USHORT Command; \
3155  USHORT Status; \
3156  UCHAR RevisionID; \
3157  UCHAR ProgIf; \
3158  UCHAR SubClass; \
3159  UCHAR BaseClass; \
3160  UCHAR CacheLineSize; \
3161  UCHAR LatencyTimer; \
3162  UCHAR HeaderType; \
3163  UCHAR BIST; \
3164  union { \
3165  struct _PCI_HEADER_TYPE_0 { \
3166  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3167  ULONG CIS; \
3168  USHORT SubVendorID; \
3169  USHORT SubSystemID; \
3170  ULONG ROMBaseAddress; \
3171  UCHAR CapabilitiesPtr; \
3172  UCHAR Reserved1[3]; \
3173  ULONG Reserved2; \
3174  UCHAR InterruptLine; \
3175  UCHAR InterruptPin; \
3176  UCHAR MinimumGrant; \
3177  UCHAR MaximumLatency; \
3178  } type0; \
3179  struct _PCI_HEADER_TYPE_1 { \
3180  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3181  UCHAR PrimaryBus; \
3182  UCHAR SecondaryBus; \
3183  UCHAR SubordinateBus; \
3184  UCHAR SecondaryLatency; \
3185  UCHAR IOBase; \
3186  UCHAR IOLimit; \
3187  USHORT SecondaryStatus; \
3188  USHORT MemoryBase; \
3189  USHORT MemoryLimit; \
3190  USHORT PrefetchBase; \
3191  USHORT PrefetchLimit; \
3192  ULONG PrefetchBaseUpper32; \
3193  ULONG PrefetchLimitUpper32; \
3194  USHORT IOBaseUpper16; \
3195  USHORT IOLimitUpper16; \
3196  UCHAR CapabilitiesPtr; \
3197  UCHAR Reserved1[3]; \
3198  ULONG ROMBaseAddress; \
3199  UCHAR InterruptLine; \
3200  UCHAR InterruptPin; \
3201  USHORT BridgeControl; \
3202  } type1; \
3203  struct _PCI_HEADER_TYPE_2 { \
3204  ULONG SocketRegistersBaseAddress; \
3205  UCHAR CapabilitiesPtr; \
3206  UCHAR Reserved; \
3207  USHORT SecondaryStatus; \
3208  UCHAR PrimaryBus; \
3209  UCHAR SecondaryBus; \
3210  UCHAR SubordinateBus; \
3211  UCHAR SecondaryLatency; \
3212  struct { \
3213  ULONG Base; \
3214  ULONG Limit; \
3215  } Range[PCI_TYPE2_ADDRESSES-1]; \
3216  UCHAR InterruptLine; \
3217  UCHAR InterruptPin; \
3218  USHORT BridgeControl; \
3219  } type2; \
3220  } u;
3221 
3222 typedef struct _PCI_COMMON_HEADER {
3225 
3226 #ifdef __cplusplus
3227 typedef struct _PCI_COMMON_CONFIG {
3229  UCHAR DeviceSpecific[192];
3231 #else
3232 typedef struct _PCI_COMMON_CONFIG {
3234  UCHAR DeviceSpecific[192];
3236 #endif
3237 
3238 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3239 
3240 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3241 
3242 #define PCI_MAX_DEVICES 32
3243 #define PCI_MAX_FUNCTION 8
3244 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3245 #define PCI_INVALID_VENDORID 0xFFFF
3246 
3247 /* PCI_COMMON_CONFIG.HeaderType */
3248 #define PCI_MULTIFUNCTION 0x80
3249 #define PCI_DEVICE_TYPE 0x00
3250 #define PCI_BRIDGE_TYPE 0x01
3251 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3252 
3253 #define PCI_CONFIGURATION_TYPE(PciData) \
3254  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3255 
3256 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3257  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3258 
3259 /* PCI_COMMON_CONFIG.Command */
3260 #define PCI_ENABLE_IO_SPACE 0x0001
3261 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3262 #define PCI_ENABLE_BUS_MASTER 0x0004
3263 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3264 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3265 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3266 #define PCI_ENABLE_PARITY 0x0040
3267 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3268 #define PCI_ENABLE_SERR 0x0100
3269 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3270 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3271 
3272 /* PCI_COMMON_CONFIG.Status */
3273 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3274 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3275 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3276 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3277 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3278 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3279 #define PCI_STATUS_DEVSEL 0x0600
3280 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3281 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3282 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3283 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3284 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3285 
3286 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3287 
3288 #define PCI_WHICHSPACE_CONFIG 0x0
3289 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3290 
3291 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3292 #define PCI_CAPABILITY_ID_AGP 0x02
3293 #define PCI_CAPABILITY_ID_VPD 0x03
3294 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3295 #define PCI_CAPABILITY_ID_MSI 0x05
3296 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3297 #define PCI_CAPABILITY_ID_PCIX 0x07
3298 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3299 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3300 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3301 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3302 #define PCI_CAPABILITY_ID_SHPC 0x0C
3303 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3304 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3305 #define PCI_CAPABILITY_ID_SECURE 0x0F
3306 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3307 #define PCI_CAPABILITY_ID_MSIX 0x11
3308 
3313 
3314 typedef struct _PCI_PMC {
3320  struct _PM_SUPPORT {
3329  } Support;
3330 } PCI_PMC, *PPCI_PMC;
3331 
3332 typedef struct _PCI_PMCSR {
3339 } PCI_PMCSR, *PPCI_PMCSR;
3340 
3341 typedef struct _PCI_PMCSR_BSE {
3346 
3347 typedef struct _PCI_PM_CAPABILITY {
3349  union {
3352  } PMC;
3353  union {
3355  USHORT AsUSHORT;
3356  } PMCSR;
3357  union {
3360  } PMCSR_BSE;
3363 
3364 typedef struct {
3366  union {
3367  struct {
3373  } bits;
3375  } Command;
3376  union {
3377  struct {
3392  } bits;
3394  } Status;
3396 
3397 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3398 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3399 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3400 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3401 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3402 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3403 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3404 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3405 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3406 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3407 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3408 
3414 
3420 
3422  _ANONYMOUS_STRUCT struct {
3438  } DUMMYSTRUCTNAME;
3441 
3443  _ANONYMOUS_STRUCT struct {
3459  } DUMMYSTRUCTNAME;
3462 
3464  _ANONYMOUS_STRUCT struct {
3480  } DUMMYSTRUCTNAME;
3483 
3485  _ANONYMOUS_STRUCT struct {
3495  } DUMMYSTRUCTNAME;
3498 
3500  _ANONYMOUS_STRUCT struct {
3510  } DUMMYSTRUCTNAME;
3513 
3515  _ANONYMOUS_STRUCT struct {
3522  } DUMMYSTRUCTNAME;
3525 
3527  _ANONYMOUS_STRUCT struct {
3532  } DUMMYSTRUCTNAME;
3535 
3537  _ANONYMOUS_STRUCT struct {
3547  } DUMMYSTRUCTNAME;
3550 
3552  _ANONYMOUS_STRUCT struct {
3559  } DUMMYSTRUCTNAME;
3562 
3564  _ANONYMOUS_STRUCT struct {
3580  } DUMMYSTRUCTNAME;
3583 
3585  _ANONYMOUS_STRUCT struct {
3601  } DUMMYSTRUCTNAME;
3604 
3606  _ANONYMOUS_STRUCT struct {
3622  } DUMMYSTRUCTNAME;
3625 
3627  _ANONYMOUS_STRUCT struct {
3630  } DUMMYSTRUCTNAME;
3633 
3634 #define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001
3635 #define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002
3636 #define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004
3637 
3638 #define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \
3639  (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \
3640  ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \
3641  ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING)
3642 
3651  ULONG HeaderLog[4];
3656  ULONG SecHeaderLog[4];
3658 
3667  ULONG HeaderLog[4];
3672 
3681  ULONG HeaderLog[4];
3686  ULONG SecHeaderLog[4];
3688 
3690  _ANONYMOUS_STRUCT struct {
3694  } DUMMYSTRUCTNAME;
3697 
3699  _ANONYMOUS_STRUCT struct {
3706  } DUMMYSTRUCTNAME;
3709 
3711  _ANONYMOUS_STRUCT struct {
3714  } DUMMYSTRUCTNAME;
3717 
3719  _ANONYMOUS_STRUCT struct {
3722  } DUMMYSTRUCTNAME;
3725