ReactOS  0.4.15-dev-976-g0f66c66
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 typedef 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;
290  ULONG AlignmentRequirement;
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 
395 typedef enum _IO_ACCESS_TYPE {
400 
401 typedef enum _IO_ACCESS_MODE {
405 
410 
418 
423 
429 
430 #if (NTDDI_VERSION >= NTDDI_WIN7)
431 
432 typedef NTSTATUS
434  VOID);
435 
436 typedef NTSTATUS
437 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
440  _In_ ULONG Event,
444 
445 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
446 
447 #endif
448 
450 
454  volatile LONG IoCount;
457 
470 
471 typedef struct _IO_REMOVE_LOCK {
473 #if DBG
475 #endif
477 
478 typedef struct _IO_WORKITEM *PIO_WORKITEM;
479 
480 _Function_class_(IO_WORKITEM_ROUTINE)
483 typedef VOID
484 (NTAPI IO_WORKITEM_ROUTINE)(
487 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
488 
489 typedef VOID
490 (NTAPI IO_WORKITEM_ROUTINE_EX)(
494 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
495 
496 typedef struct _SHARE_ACCESS {
505 
506 typedef enum _CREATE_FILE_TYPE {
511 
512 #define IO_FORCE_ACCESS_CHECK 0x001
513 #define IO_NO_PARAMETER_CHECKING 0x100
514 
515 #define IO_REPARSE 0x0
516 #define IO_REMOUNT 0x1
517 
518 typedef struct _IO_STATUS_BLOCK {
519  _ANONYMOUS_UNION union {
521  PVOID Pointer;
522  } DUMMYUNIONNAME;
525 
526 #if defined(_WIN64)
527 typedef struct _IO_STATUS_BLOCK32 {
530 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
531 #endif
532 
533 typedef VOID
538 
539 #define PIO_APC_ROUTINE_DEFINED
540 
541 typedef enum _IO_SESSION_EVENT {
551 
552 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff
553 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001
554 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002
555 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004
556 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008
557 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010
558 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020
559 
560 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
561 
562 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L
563 
564 typedef struct _IO_SESSION_CONNECT_INFO {
568 
569 #define EVENT_INCREMENT 1
570 #define IO_NO_INCREMENT 0
571 #define IO_CD_ROM_INCREMENT 1
572 #define IO_DISK_INCREMENT 1
573 #define IO_KEYBOARD_INCREMENT 6
574 #define IO_MAILSLOT_INCREMENT 2
575 #define IO_MOUSE_INCREMENT 6
576 #define IO_NAMED_PIPE_INCREMENT 2
577 #define IO_NETWORK_INCREMENT 2
578 #define IO_PARALLEL_INCREMENT 1
579 #define IO_SERIAL_INCREMENT 2
580 #define IO_SOUND_INCREMENT 8
581 #define IO_VIDEO_INCREMENT 1
582 #define SEMAPHORE_INCREMENT 1
583 
584 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
585 
586 typedef struct _BOOTDISK_INFORMATION {
592 
593 typedef struct _BOOTDISK_INFORMATION_EX {
603 
604 #if (NTDDI_VERSION >= NTDDI_WIN7)
605 
609  _ANONYMOUS_UNION union {
612  } DUMMYUNIONNAME;
615 
620 
621 #else
622 
623 #if (NTDDI_VERSION >= NTDDI_VISTA)
624 typedef struct _BOOTDISK_INFORMATION_LITE {
625  ULONG BootDeviceSignature;
626  ULONG SystemDeviceSignature;
627  GUID BootDeviceGuid;
628  GUID SystemDeviceGuid;
629  BOOLEAN BootDeviceIsGpt;
630  BOOLEAN SystemDeviceIsGpt;
632 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
633 
634 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
635 
636 #include <pshpack1.h>
637 
638 typedef struct _EISA_MEMORY_TYPE {
647 
655 
656 typedef struct _EISA_IRQ_DESCRIPTOR {
663 
664 typedef struct _EISA_IRQ_CONFIGURATION {
668 
669 typedef struct _DMA_CONFIGURATION_BYTE0 {
675 
676 typedef struct _DMA_CONFIGURATION_BYTE1 {
682 
683 typedef struct _EISA_DMA_CONFIGURATION {
687 
688 typedef struct _EISA_PORT_DESCRIPTOR {
694 
695 typedef struct _EISA_PORT_CONFIGURATION {
699 
710 
717  UCHAR Selections[26];
719  UCHAR TypeString[80];
726 
727 #include <poppack.h>
728 
729 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
730 
731 #define EISA_FUNCTION_ENABLED 0x80
732 #define EISA_FREE_FORM_DATA 0x40
733 #define EISA_HAS_PORT_INIT_ENTRY 0x20
734 #define EISA_HAS_PORT_RANGE 0x10
735 #define EISA_HAS_DMA_ENTRY 0x08
736 #define EISA_HAS_IRQ_ENTRY 0x04
737 #define EISA_HAS_MEMORY_ENTRY 0x02
738 #define EISA_HAS_TYPE_ENTRY 0x01
739 #define EISA_HAS_INFORMATION \
740  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
741  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
742 
743 #define EISA_MORE_ENTRIES 0x80
744 #define EISA_SYSTEM_MEMORY 0x00
745 #define EISA_MEMORY_TYPE_RAM 0x01
746 
747 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
748 
749 #define EISA_INVALID_SLOT 0x80
750 #define EISA_INVALID_FUNCTION 0x81
751 #define EISA_INVALID_CONFIGURATION 0x82
752 #define EISA_EMPTY_SLOT 0x83
753 #define EISA_INVALID_BIOS_CALL 0x86
754 
755 /*
756 ** Plug and Play structures
757 */
758 
759 typedef VOID
761  PVOID Context);
762 
763 typedef VOID
765  PVOID Context);
766 
767 _Function_class_(TRANSLATE_BUS_ADDRESS)
769 typedef BOOLEAN
770 (NTAPI TRANSLATE_BUS_ADDRESS)(
773  _In_ ULONG Length,
776 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
777 
778 _Function_class_(GET_DMA_ADAPTER)
780 typedef struct _DMA_ADAPTER*
781 (NTAPI GET_DMA_ADAPTER)(
785 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
786 
787 _Function_class_(GET_SET_DEVICE_DATA)
789 typedef ULONG
790 (NTAPI GET_SET_DEVICE_DATA)(
795  _In_ ULONG Length);
796 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
797 
798 typedef enum _DEVICE_INSTALL_STATE {
804 
805 typedef struct _LEGACY_BUS_INFORMATION {
810 
816 
817 typedef VOID
819  _In_ PVOID Context);
820 
829 
830 typedef VOID
834 
835 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
836 
837 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
838 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
839 #define PCI_USE_REVISION 0x00000002
840 #define PCI_USE_VENDEV_IDS 0x00000004
841 #define PCI_USE_CLASS_SUBCLASS 0x00000008
842 #define PCI_USE_PROGIF 0x00000010
843 #define PCI_USE_LOCAL_BUS 0x00000020
844 #define PCI_USE_LOCAL_DEVICE 0x00000040
845 
858 
861 typedef BOOLEAN
862 (NTAPI PCI_IS_DEVICE_PRESENT)(
863  _In_ USHORT VendorID,
868  _In_ ULONG Flags);
869 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
870 
873 typedef BOOLEAN
874 (NTAPI PCI_IS_DEVICE_PRESENT_EX)(
877 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
878 
879 typedef struct _BUS_INTERFACE_STANDARD {
890 
900 
902 typedef struct _DEVICE_CAPABILITIES {
903  _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
904  USHORT Version;
905  ULONG DeviceD1:1;
906  ULONG DeviceD2:1;
907  ULONG LockSupported:1;
908  ULONG EjectSupported:1;
909  ULONG Removable:1;
910  ULONG DockDevice:1;
911  ULONG UniqueID:1;
912  ULONG SilentInstall:1;
913  ULONG RawDeviceOK:1;
914  ULONG SurpriseRemovalOK:1;
915  ULONG WakeFromD0:1;
916  ULONG WakeFromD1:1;
917  ULONG WakeFromD2:1;
918  ULONG WakeFromD3:1;
919  ULONG HardwareDisabled:1;
920  ULONG NonDynamic:1;
921  ULONG WarmEjectSupported:1;
922  ULONG NoDisplayInUI:1;
923  ULONG Reserved:14;
924  ULONG Address;
925  ULONG UINumber;
927  SYSTEM_POWER_STATE SystemWake;
928  DEVICE_POWER_STATE DeviceWake;
929  ULONG D1Latency;
930  ULONG D2Latency;
931  ULONG D3Latency;
933 
941 
947 
948 #undef INTERFACE
949 
950 typedef struct _INTERFACE {
951  USHORT Size;
952  USHORT Version;
953  PVOID Context;
957 
963 
965 
966 /* PNP_DEVICE_STATE */
967 
968 #define PNP_DEVICE_DISABLED 0x00000001
969 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
970 #define PNP_DEVICE_FAILED 0x00000004
971 #define PNP_DEVICE_REMOVED 0x00000008
972 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
973 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
974 
979  struct _FILE_OBJECT *FileObject;
981  UCHAR CustomDataBuffer[1];
983 
988  struct _FILE_OBJECT *FileObject;
990 
991 #if (NTDDI_VERSION >= NTDDI_VISTA)
992 #include <devpropdef.h>
993 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
994 #endif
995 
996 #define PNP_REPLACE_NO_MAP MAXLONGLONG
997 
999 typedef NTSTATUS
1000 (NTAPI *PREPLACE_MAP_MEMORY)(
1001  _In_ PHYSICAL_ADDRESS TargetPhysicalAddress,
1006 
1011  struct {
1014  } Ranges[ANYSIZE_ARRAY];
1016 
1019  _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount;
1024 
1031 
1032 #define PNP_REPLACE_PARAMETERS_VERSION 2
1033 
1034 typedef struct _PNP_REPLACE_PARAMETERS {
1043  PREPLACE_MAP_MEMORY MapMemory;
1045 
1046 typedef VOID
1048  VOID);
1049 
1051 typedef NTSTATUS
1052 (NTAPI *PREPLACE_BEGIN)(
1055 
1057 typedef NTSTATUS
1058 (NTAPI *PREPLACE_END)(
1059  _In_ PVOID Context);
1060 
1062 typedef NTSTATUS
1063 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1064  _In_ PVOID Context,
1067 
1069 typedef NTSTATUS
1070 (NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1071  _In_ PVOID Context,
1073  _In_ BOOLEAN Target);
1074 
1076 typedef NTSTATUS
1077 (NTAPI *PREPLACE_SWAP)(
1078  _In_ PVOID Context);
1079 
1081 typedef NTSTATUS
1082 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1083  _In_ PVOID Context);
1084 
1086 typedef NTSTATUS
1087 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1088  _In_ PVOID Context);
1089 
1091 typedef NTSTATUS
1092 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1093  _In_ PVOID Context,
1096 
1098 typedef NTSTATUS
1099 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1100  _In_ PVOID Context,
1102 
1103 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1104 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1105  FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
1106 
1107 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001
1108 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002
1109 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004
1110 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008
1111 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010
1112 
1118  PREPLACE_BEGIN BeginReplace;
1119  PREPLACE_END EndReplace;
1120  PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory;
1121  PREPLACE_SET_PROCESSOR_ID SetProcessorId;
1122  PREPLACE_SWAP Swap;
1123  PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror;
1124  PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory;
1125  PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination;
1126  PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce;
1128 
1130 typedef NTSTATUS
1131 (NTAPI *PREPLACE_DRIVER_INIT)(
1134 
1144 
1145 typedef struct _POWER_SEQUENCE {
1150 
1151 #ifdef _PREFAST_
1152 #define __string_type 0x1000
1153 #define __guid_type 0x2000
1154 #define __multiString_type 0x4000
1155 #else
1156 #define __string_type 0
1157 #define __guid_type 0
1158 #define __multiString_type 0
1159 #endif
1160 
1161 typedef enum {
1186 
1193 
1194 typedef enum _IO_PRIORITY_HINT {
1202 
1203 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1204 
1205 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1207 typedef NTSTATUS
1208 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1211 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1212 
1213 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1215 typedef VOID
1216 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1218 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1219 
1261 #if (NTDDI_VERSION >= NTDDI_VISTA)
1271 #endif
1272 #if (NTDDI_VERSION >= NTDDI_WIN7)
1279 #endif
1282 
1287 
1288 typedef struct _FILE_POSITION_INFORMATION {
1289  LARGE_INTEGER CurrentByteOffset;
1291 
1292 typedef struct _FILE_BASIC_INFORMATION {
1293  LARGE_INTEGER CreationTime;
1294  LARGE_INTEGER LastAccessTime;
1295  LARGE_INTEGER LastWriteTime;
1296  LARGE_INTEGER ChangeTime;
1299 
1303 
1305  ULONG Flags;
1307 
1312 
1316 
1320 
1323  ULONG_PTR ProcessIdList[1];
1325 
1326 typedef struct _FILE_STANDARD_INFORMATION {
1328  LARGE_INTEGER EndOfFile;
1329  ULONG NumberOfLinks;
1330  BOOLEAN DeletePending;
1333 
1334 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1335  LARGE_INTEGER CreationTime;
1336  LARGE_INTEGER LastAccessTime;
1337  LARGE_INTEGER LastWriteTime;
1338  LARGE_INTEGER ChangeTime;
1340  LARGE_INTEGER EndOfFile;
1343 
1344 typedef enum _FSINFOCLASS {
1357 
1358 typedef struct _FILE_FS_DEVICE_INFORMATION {
1360  ULONG Characteristics;
1362 
1363 typedef struct _FILE_FULL_EA_INFORMATION {
1364  ULONG NextEntryOffset;
1365  UCHAR Flags;
1366  UCHAR EaNameLength;
1367  USHORT EaValueLength;
1368  CHAR EaName[1];
1370 
1379 
1385 
1386 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1387 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1388 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1389 
1390 #define FM_LOCK_BIT (0x1)
1391 #define FM_LOCK_BIT_V (0x0)
1392 #define FM_LOCK_WAITER_WOKEN (0x2)
1393 #define FM_LOCK_WAITER_INC (0x4)
1394 
1395 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1397 typedef BOOLEAN
1398 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1399  _In_ struct _FILE_OBJECT *FileObject,
1401  _In_ ULONG Length,
1402  _In_ BOOLEAN Wait,
1403  _In_ ULONG LockKey,
1407 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1408 
1409 _Function_class_(FAST_IO_READ)
1411 typedef BOOLEAN
1412 (NTAPI FAST_IO_READ)(
1413  _In_ struct _FILE_OBJECT *FileObject,
1415  _In_ ULONG Length,
1416  _In_ BOOLEAN Wait,
1417  _In_ ULONG LockKey,
1418  _Out_ PVOID Buffer,
1420  _In_ struct _DEVICE_OBJECT *DeviceObject);
1421 typedef FAST_IO_READ *PFAST_IO_READ;
1422 
1423 _Function_class_(FAST_IO_WRITE)
1425 typedef BOOLEAN
1426 (NTAPI FAST_IO_WRITE)(
1427  _In_ struct _FILE_OBJECT *FileObject,
1429  _In_ ULONG Length,
1430  _In_ BOOLEAN Wait,
1431  _In_ ULONG LockKey,
1432  _In_ PVOID Buffer,
1434  _In_ struct _DEVICE_OBJECT *DeviceObject);
1435 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1436 
1437 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1439 typedef BOOLEAN
1440 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1441  _In_ struct _FILE_OBJECT *FileObject,
1442  _In_ BOOLEAN Wait,
1445  _In_ struct _DEVICE_OBJECT *DeviceObject);
1446 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1447 
1448 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1450 typedef BOOLEAN
1451 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1452  _In_ struct _FILE_OBJECT *FileObject,
1453  _In_ BOOLEAN Wait,
1456  _In_ struct _DEVICE_OBJECT *DeviceObject);
1457 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1458 
1459 _Function_class_(FAST_IO_LOCK)
1461 typedef BOOLEAN
1462 (NTAPI FAST_IO_LOCK)(
1463  _In_ struct _FILE_OBJECT *FileObject,
1467  _In_ ULONG Key,
1471  _In_ struct _DEVICE_OBJECT *DeviceObject);
1472 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1473 
1474 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1476 typedef BOOLEAN
1477 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1478  _In_ struct _FILE_OBJECT *FileObject,
1482  _In_ ULONG Key,
1484  _In_ struct _DEVICE_OBJECT *DeviceObject);
1485 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1486 
1487 _Function_class_(FAST_IO_UNLOCK_ALL)
1489 typedef BOOLEAN
1490 (NTAPI FAST_IO_UNLOCK_ALL)(
1491  _In_ struct _FILE_OBJECT *FileObject,
1494  _In_ struct _DEVICE_OBJECT *DeviceObject);
1495 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1496 
1497 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1499 typedef BOOLEAN
1500 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1501  _In_ struct _FILE_OBJECT *FileObject,
1503  _In_ ULONG Key,
1505  _In_ struct _DEVICE_OBJECT *DeviceObject);
1506 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1507 
1508 _Function_class_(FAST_IO_DEVICE_CONTROL)
1510 typedef BOOLEAN
1511 (NTAPI FAST_IO_DEVICE_CONTROL)(
1512  _In_ struct _FILE_OBJECT *FileObject,
1520  _In_ struct _DEVICE_OBJECT *DeviceObject);
1521 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1522 
1523 _Function_class_(FAST_IO_ACQUIRE_FILE)
1525 typedef VOID
1526 (NTAPI FAST_IO_ACQUIRE_FILE)(
1527  _In_ struct _FILE_OBJECT *FileObject);
1528 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1529 
1530 _Function_class_(FAST_IO_RELEASE_FILE)
1532 typedef VOID
1533 (NTAPI FAST_IO_RELEASE_FILE)(
1534  _In_ struct _FILE_OBJECT *FileObject);
1535 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1536 
1537 _Function_class_(FAST_IO_DETACH_DEVICE)
1539 typedef VOID
1540 (NTAPI FAST_IO_DETACH_DEVICE)(
1543 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1544 
1545 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1547 typedef BOOLEAN
1548 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1549  _In_ struct _FILE_OBJECT *FileObject,
1550  _In_ BOOLEAN Wait,
1553  _In_ struct _DEVICE_OBJECT *DeviceObject);
1554 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1555 
1556 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1558 typedef NTSTATUS
1559 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1560  _In_ struct _FILE_OBJECT *FileObject,
1563  _In_ struct _DEVICE_OBJECT *DeviceObject);
1564 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1565 
1566 _Function_class_(FAST_IO_MDL_READ)
1568 typedef BOOLEAN
1569 (NTAPI FAST_IO_MDL_READ)(
1570  _In_ struct _FILE_OBJECT *FileObject,
1572  _In_ ULONG Length,
1573  _In_ ULONG LockKey,
1574  _Out_ PMDL *MdlChain,
1576  _In_ struct _DEVICE_OBJECT *DeviceObject);
1577 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1578 
1579 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1581 typedef BOOLEAN
1582 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1583  _In_ struct _FILE_OBJECT *FileObject,
1584  _In_ PMDL MdlChain,
1585  _In_ struct _DEVICE_OBJECT *DeviceObject);
1586 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1587 
1588 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1590 typedef BOOLEAN
1591 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1592  _In_ struct _FILE_OBJECT *FileObject,
1594  _In_ ULONG Length,
1595  _In_ ULONG LockKey,
1596  _Out_ PMDL *MdlChain,
1598  _In_ struct _DEVICE_OBJECT *DeviceObject);
1599 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1600 
1601 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1603 typedef BOOLEAN
1604 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1605  _In_ struct _FILE_OBJECT *FileObject,
1607  _In_ PMDL MdlChain,
1608  _In_ struct _DEVICE_OBJECT *DeviceObject);
1609 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1610 
1611 _Function_class_(FAST_IO_READ_COMPRESSED)
1613 typedef BOOLEAN
1614 (NTAPI FAST_IO_READ_COMPRESSED)(
1615  _In_ struct _FILE_OBJECT *FileObject,
1617  _In_ ULONG Length,
1618  _In_ ULONG LockKey,
1619  _Out_ PVOID Buffer,
1620  _Out_ PMDL *MdlChain,
1624  _In_ struct _DEVICE_OBJECT *DeviceObject);
1625 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1626 
1627 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1629 typedef BOOLEAN
1630 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1631  _In_ struct _FILE_OBJECT *FileObject,
1633  _In_ ULONG Length,
1634  _In_ ULONG LockKey,
1635  _In_ PVOID Buffer,
1636  _Out_ PMDL *MdlChain,
1640  _In_ struct _DEVICE_OBJECT *DeviceObject);
1641 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1642 
1643 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1645 typedef BOOLEAN
1646 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1647  _In_ struct _FILE_OBJECT *FileObject,
1648  _In_ PMDL MdlChain,
1649  _In_ struct _DEVICE_OBJECT *DeviceObject);
1650 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1651 
1652 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1654 typedef BOOLEAN
1655 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1656  _In_ struct _FILE_OBJECT *FileObject,
1658  _In_ PMDL MdlChain,
1659  _In_ struct _DEVICE_OBJECT *DeviceObject);
1660 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1661 
1662 _Function_class_(FAST_IO_QUERY_OPEN)
1664 typedef BOOLEAN
1665 (NTAPI FAST_IO_QUERY_OPEN)(
1666  _Inout_ struct _IRP *Irp,
1668  _In_ struct _DEVICE_OBJECT *DeviceObject);
1669 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1670 
1671 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1673 typedef NTSTATUS
1674 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1675  _In_ struct _FILE_OBJECT *FileObject,
1677  _In_ struct _DEVICE_OBJECT *DeviceObject);
1678 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1679 
1680 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1682 typedef NTSTATUS
1683 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1684  _In_ struct _FILE_OBJECT *FileObject,
1685  _In_ struct _DEVICE_OBJECT *DeviceObject);
1686 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1687 
1688 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1690 typedef NTSTATUS
1691 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1692  _In_ struct _FILE_OBJECT *FileObject,
1693  _In_ struct _DEVICE_OBJECT *DeviceObject);
1694 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1695 
1696 typedef struct _FAST_IO_DISPATCH {
1726 
1727 typedef struct _SECTION_OBJECT_POINTERS {
1728  PVOID DataSectionObject;
1729  PVOID SharedCacheMap;
1730  PVOID ImageSectionObject;
1732 
1733 typedef struct _IO_COMPLETION_CONTEXT {
1737 
1738 /* FILE_OBJECT.Flags */
1739 #define FO_FILE_OPEN 0x00000001
1740 #define FO_SYNCHRONOUS_IO 0x00000002
1741 #define FO_ALERTABLE_IO 0x00000004
1742 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1743 #define FO_WRITE_THROUGH 0x00000010
1744 #define FO_SEQUENTIAL_ONLY 0x00000020
1745 #define FO_CACHE_SUPPORTED 0x00000040
1746 #define FO_NAMED_PIPE 0x00000080
1747 #define FO_STREAM_FILE 0x00000100
1748 #define FO_MAILSLOT 0x00000200
1749 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1750 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1751 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1752 #define FO_FILE_MODIFIED 0x00001000
1753 #define FO_FILE_SIZE_CHANGED 0x00002000
1754 #define FO_CLEANUP_COMPLETE 0x00004000
1755 #define FO_TEMPORARY_FILE 0x00008000
1756 #define FO_DELETE_ON_CLOSE 0x00010000
1757 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1758 #define FO_HANDLE_CREATED 0x00040000
1759 #define FO_FILE_FAST_IO_READ 0x00080000
1760 #define FO_RANDOM_ACCESS 0x00100000
1761 #define FO_FILE_OPEN_CANCELLED 0x00200000
1762 #define FO_VOLUME_OPEN 0x00400000
1763 #define FO_REMOTE_ORIGIN 0x01000000
1764 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1765 #define FO_SKIP_COMPLETION_PORT 0x02000000
1766 #define FO_SKIP_SET_EVENT 0x04000000
1767 #define FO_SKIP_SET_FAST_IO 0x08000000
1768 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1769 
1770 /* VPB.Flags */
1771 #define VPB_MOUNTED 0x0001
1772 #define VPB_LOCKED 0x0002
1773 #define VPB_PERSISTENT 0x0004
1774 #define VPB_REMOVE_PENDING 0x0008
1775 #define VPB_RAW_MOUNT 0x0010
1776 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1777 
1778 /* IO_STACK_LOCATION.Flags */
1779 
1780 #define SL_FORCE_ACCESS_CHECK 0x01
1781 #define SL_OPEN_PAGING_FILE 0x02
1782 #define SL_OPEN_TARGET_DIRECTORY 0x04
1783 #define SL_STOP_ON_SYMLINK 0x08
1784 #define SL_CASE_SENSITIVE 0x80
1785 
1786 #define SL_KEY_SPECIFIED 0x01
1787 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1788 #define SL_WRITE_THROUGH 0x04
1789 #define SL_FT_SEQUENTIAL_WRITE 0x08
1790 #define SL_FORCE_DIRECT_WRITE 0x10
1791 #define SL_REALTIME_STREAM 0x20
1792 
1793 #define SL_READ_ACCESS_GRANTED 0x01
1794 #define SL_WRITE_ACCESS_GRANTED 0x04
1795 
1796 #define SL_FAIL_IMMEDIATELY 0x01
1797 #define SL_EXCLUSIVE_LOCK 0x02
1798 
1799 #define SL_RESTART_SCAN 0x01
1800 #define SL_RETURN_SINGLE_ENTRY 0x02
1801 #define SL_INDEX_SPECIFIED 0x04
1802 
1803 #define SL_WATCH_TREE 0x01
1804 
1805 #define SL_ALLOW_RAW_MOUNT 0x01
1806 
1807 $endif (_WDMDDK_)
1808 $if (_WDMDDK_ || _DEVIOCTL_)
1809 #define CTL_CODE(DeviceType, Function, Method, Access) \
1810  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1811 
1812 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1813 
1814 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1815 
1817 $if (_WDMDDK_)
1818 
1819 /* IRP.Flags */
1820 #define IRP_NOCACHE 0x00000001
1821 #define IRP_PAGING_IO 0x00000002
1822 #define IRP_MOUNT_COMPLETION 0x00000002
1823 #define IRP_SYNCHRONOUS_API 0x00000004
1824 #define IRP_ASSOCIATED_IRP 0x00000008
1825 #define IRP_BUFFERED_IO 0x00000010
1826 #define IRP_DEALLOCATE_BUFFER 0x00000020
1827 #define IRP_INPUT_OPERATION 0x00000040
1828 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1829 #define IRP_CREATE_OPERATION 0x00000080
1830 #define IRP_READ_OPERATION 0x00000100
1831 #define IRP_WRITE_OPERATION 0x00000200
1832 #define IRP_CLOSE_OPERATION 0x00000400
1833 #define IRP_DEFER_IO_COMPLETION 0x00000800
1834 #define IRP_OB_QUERY_NAME 0x00001000
1835 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1836 /* The following 2 are missing in latest WDK */
1837 #define IRP_RETRY_IO_COMPLETION 0x00004000
1838 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1839 
1840 /* IRP.AllocationFlags */
1841 #define IRP_QUOTA_CHARGED 0x01
1842 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1843 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1844 #define IRP_LOOKASIDE_ALLOCATION 0x08
1845 
1846 /*
1847 ** IRP function codes
1848 */
1849 
1850 #define IRP_MJ_CREATE 0x00
1851 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1852 #define IRP_MJ_CLOSE 0x02
1853 #define IRP_MJ_READ 0x03
1854 #define IRP_MJ_WRITE 0x04
1855 #define IRP_MJ_QUERY_INFORMATION 0x05
1856 #define IRP_MJ_SET_INFORMATION 0x06
1857 #define IRP_MJ_QUERY_EA 0x07
1858 #define IRP_MJ_SET_EA 0x08
1859 #define IRP_MJ_FLUSH_BUFFERS 0x09
1860 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1861 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1862 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1863 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1864 #define IRP_MJ_DEVICE_CONTROL 0x0e
1865 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1866 #define IRP_MJ_SCSI 0x0f
1867 #define IRP_MJ_SHUTDOWN 0x10
1868 #define IRP_MJ_LOCK_CONTROL 0x11
1869 #define IRP_MJ_CLEANUP 0x12
1870 #define IRP_MJ_CREATE_MAILSLOT 0x13
1871 #define IRP_MJ_QUERY_SECURITY 0x14
1872 #define IRP_MJ_SET_SECURITY 0x15
1873 #define IRP_MJ_POWER 0x16
1874 #define IRP_MJ_SYSTEM_CONTROL 0x17
1875 #define IRP_MJ_DEVICE_CHANGE 0x18
1876 #define IRP_MJ_QUERY_QUOTA 0x19
1877 #define IRP_MJ_SET_QUOTA 0x1a
1878 #define IRP_MJ_PNP 0x1b
1879 #define IRP_MJ_PNP_POWER 0x1b
1880 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1881 
1882 #define IRP_MN_SCSI_CLASS 0x01
1883 
1884 #define IRP_MN_START_DEVICE 0x00
1885 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1886 #define IRP_MN_REMOVE_DEVICE 0x02
1887 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1888 #define IRP_MN_STOP_DEVICE 0x04
1889 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1890 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1891 
1892 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1893 #define IRP_MN_QUERY_INTERFACE 0x08
1894 #define IRP_MN_QUERY_CAPABILITIES 0x09
1895 #define IRP_MN_QUERY_RESOURCES 0x0A
1896 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1897 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1898 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1899 
1900 #define IRP_MN_READ_CONFIG 0x0F
1901 #define IRP_MN_WRITE_CONFIG 0x10
1902 #define IRP_MN_EJECT 0x11
1903 #define IRP_MN_SET_LOCK 0x12
1904 #define IRP_MN_QUERY_ID 0x13
1905 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1906 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1907 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1908 #define IRP_MN_SURPRISE_REMOVAL 0x17
1909 #if (NTDDI_VERSION >= NTDDI_WIN7)
1910 #define IRP_MN_DEVICE_ENUMERATED 0x19
1911 #endif
1912 
1913 #define IRP_MN_WAIT_WAKE 0x00
1914 #define IRP_MN_POWER_SEQUENCE 0x01
1915 #define IRP_MN_SET_POWER 0x02
1916 #define IRP_MN_QUERY_POWER 0x03
1917 
1918 #define IRP_MN_QUERY_ALL_DATA 0x00
1919 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1920 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1921 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1922 #define IRP_MN_ENABLE_EVENTS 0x04
1923 #define IRP_MN_DISABLE_EVENTS 0x05
1924 #define IRP_MN_ENABLE_COLLECTION 0x06
1925 #define IRP_MN_DISABLE_COLLECTION 0x07
1926 #define IRP_MN_REGINFO 0x08
1927 #define IRP_MN_EXECUTE_METHOD 0x09
1928 
1929 #define IRP_MN_REGINFO_EX 0x0b
1930 
1931 typedef struct _FILE_OBJECT {
1932  CSHORT Type;
1933  CSHORT Size;
1935  PVPB Vpb;
1936  PVOID FsContext;
1937  PVOID FsContext2;
1939  PVOID PrivateCacheMap;
1940  NTSTATUS FinalStatus;
1941  struct _FILE_OBJECT *RelatedFileObject;
1942  BOOLEAN LockOperation;
1943  BOOLEAN DeletePending;
1946  BOOLEAN DeleteAccess;
1947  BOOLEAN SharedRead;
1948  BOOLEAN SharedWrite;
1949  BOOLEAN SharedDelete;
1950  ULONG Flags;
1952  LARGE_INTEGER CurrentByteOffset;
1953  volatile ULONG Waiters;
1954  volatile ULONG Busy;
1955  PVOID LastLock;
1956  KEVENT Lock;
1957  KEVENT Event;
1959  KSPIN_LOCK IrpListLock;
1960  LIST_ENTRY IrpList;
1961  volatile PVOID FileObjectExtension;
1963 
1964 typedef struct _IO_ERROR_LOG_PACKET {
1979 
1980 typedef struct _IO_ERROR_LOG_MESSAGE {
1988 
1989 /* See ndk/lpctypes.h */
1990 #ifdef _WIN64
1991 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
1992 #else
1993 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
1994 #endif
1995 
1996 #define ERROR_LOG_LIMIT_SIZE 240
1997 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1998  sizeof(IO_ERROR_LOG_PACKET) + \
1999  (sizeof(WCHAR) * 40))
2000 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
2001  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2002 #define IO_ERROR_LOG_MESSAGE_LENGTH \
2003  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
2004  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
2005  PORT_MAXIMUM_MESSAGE_LENGTH)
2006 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
2007  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2008 
2009 typedef enum _DMA_WIDTH {
2014 } DMA_WIDTH, *PDMA_WIDTH;
2015 
2016 typedef enum _DMA_SPEED {
2023 } DMA_SPEED, *PDMA_SPEED;
2024 
2025 /* DEVICE_DESCRIPTION.Version */
2026 
2027 #define DEVICE_DESCRIPTION_VERSION 0x0000
2028 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2029 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2030 
2031 typedef struct _DEVICE_DESCRIPTION {
2049 
2059 
2060 typedef struct _DEVICE_RELATIONS {
2062  PDEVICE_OBJECT Objects[1];
2064 
2065 typedef struct _DEVOBJ_EXTENSION {
2070 
2071 typedef struct _SCATTER_GATHER_ELEMENT {
2076 
2077 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2078 
2079 #if defined(_MSC_VER)
2080 #if _MSC_VER >= 1200
2081 #pragma warning(push)
2082 #endif
2083 #pragma warning(disable:4200)
2084 #endif /* _MSC_VER */
2085 
2086 typedef struct _SCATTER_GATHER_LIST {
2087  ULONG NumberOfElements;
2089  SCATTER_GATHER_ELEMENT Elements[1];
2091 
2092 #if defined(_MSC_VER)
2093 #if _MSC_VER >= 1200
2094 #pragma warning(pop)
2095 #else
2096 #pragma warning(default:4200)
2097 #endif
2098 #endif /* _MSC_VER */
2099 
2100 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2101 
2102 struct _SCATTER_GATHER_LIST;
2103 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2104 
2105 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2106 
2107 _Function_class_(DRIVER_ADD_DEVICE)
2110 _When_(return>=0, _Kernel_clear_do_init_(__yes))
2111 typedef NTSTATUS
2112 (NTAPI DRIVER_ADD_DEVICE)(
2115 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2116 
2117 typedef struct _DRIVER_EXTENSION {
2123 
2124 #define DRVO_UNLOAD_INVOKED 0x00000001
2125 #define DRVO_LEGACY_DRIVER 0x00000002
2126 #define DRVO_BUILTIN_DRIVER 0x00000004
2127 
2128 _Function_class_(DRIVER_INITIALIZE)
2130 typedef NTSTATUS
2131 (NTAPI DRIVER_INITIALIZE)(
2134 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2135 
2136 _Function_class_(DRIVER_STARTIO)
2140 typedef VOID
2141 (NTAPI DRIVER_STARTIO)(
2143  _Inout_ struct _IRP *Irp);
2144 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2145 
2146 _Function_class_(DRIVER_UNLOAD)
2149 typedef VOID
2150 (NTAPI DRIVER_UNLOAD)(
2151  _In_ struct _DRIVER_OBJECT *DriverObject);
2152 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2153 
2157 typedef NTSTATUS
2160  _Inout_ struct _IRP *Irp);
2163 
2167 typedef NTSTATUS
2168 (NTAPI DRIVER_DISPATCH_PAGED)(
2170  _Inout_ struct _IRP *Irp);
2171 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2172 
2173 typedef struct _DRIVER_OBJECT {
2190 
2191 typedef struct _DMA_ADAPTER {
2196 
2197 typedef VOID
2199  PDMA_ADAPTER DmaAdapter);
2200 
2201 typedef PVOID
2203  _In_ PDMA_ADAPTER DmaAdapter,
2204  _In_ ULONG Length,
2205  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2206  _In_ BOOLEAN CacheEnabled);
2207 
2208 typedef VOID
2210  _In_ PDMA_ADAPTER DmaAdapter,
2211  _In_ ULONG Length,
2212  _In_ PHYSICAL_ADDRESS LogicalAddress,
2214  _In_ BOOLEAN CacheEnabled);
2215 
2216 typedef NTSTATUS
2218  _In_ PDMA_ADAPTER DmaAdapter,
2222  _In_ PVOID Context);
2223 
2224 typedef BOOLEAN
2226  _In_ PDMA_ADAPTER DmaAdapter,
2227  _In_ PMDL Mdl,
2229  _In_ PVOID CurrentVa,
2230  _In_ ULONG Length,
2231  _In_ BOOLEAN WriteToDevice);
2232 
2233 typedef VOID
2235  _In_ PDMA_ADAPTER DmaAdapter);
2236 
2237 typedef VOID
2239  _In_ PDMA_ADAPTER DmaAdapter,
2242 
2243 typedef PHYSICAL_ADDRESS
2245  _In_ PDMA_ADAPTER DmaAdapter,
2246  _In_ PMDL Mdl,
2248  _In_ PVOID CurrentVa,
2250  _In_ BOOLEAN WriteToDevice);
2251 
2252 typedef ULONG
2254  _In_ PDMA_ADAPTER DmaAdapter);
2255 
2256 typedef ULONG
2258  _In_ PDMA_ADAPTER DmaAdapter);
2259 
2260 _Function_class_(DRIVER_LIST_CONTROL)
2262 typedef VOID
2263 (NTAPI DRIVER_LIST_CONTROL)(
2265  _In_ struct _IRP *Irp,
2266  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2267  _In_ PVOID Context);
2268 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2269 
2270 typedef NTSTATUS
2272  _In_ PDMA_ADAPTER DmaAdapter,
2274  _In_ PMDL Mdl,
2275  _In_ PVOID CurrentVa,
2276  _In_ ULONG Length,
2278  _In_ PVOID Context,
2279  _In_ BOOLEAN WriteToDevice);
2280 
2281 typedef VOID
2283  _In_ PDMA_ADAPTER DmaAdapter,
2285  _In_ BOOLEAN WriteToDevice);
2286 
2287 typedef NTSTATUS
2289  _In_ PDMA_ADAPTER DmaAdapter,
2290  _In_ PMDL Mdl OPTIONAL,
2291  _In_ PVOID CurrentVa,
2292  _In_ ULONG Length,
2293  _Out_ PULONG ScatterGatherListSize,
2294  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2295 
2296 typedef NTSTATUS
2298  _In_ PDMA_ADAPTER DmaAdapter,
2300  _In_ PMDL Mdl,
2301  _In_ PVOID CurrentVa,
2302  _In_ ULONG Length,
2304  _In_ PVOID Context,
2305  _In_ BOOLEAN WriteToDevice,
2306  _In_ PVOID ScatterGatherBuffer,
2307  _In_ ULONG ScatterGatherLength);
2308 
2309 typedef NTSTATUS
2311  _In_ PDMA_ADAPTER DmaAdapter,
2313  _In_ PMDL OriginalMdl,
2314  _Out_ PMDL *TargetMdl);
2315 
2316 typedef struct _DMA_OPERATIONS {
2334 
2335 typedef struct _IO_RESOURCE_DESCRIPTOR {
2336  UCHAR Option;
2337  UCHAR Type;
2338  UCHAR ShareDisposition;
2339  UCHAR Spare1;
2340  USHORT Flags;
2341  USHORT Spare2;
2342  union {
2343  struct {
2344  ULONG Length;
2345  ULONG Alignment;
2346  PHYSICAL_ADDRESS MinimumAddress;
2347  PHYSICAL_ADDRESS MaximumAddress;
2348  } Port;
2349  struct {
2350  ULONG Length;
2351  ULONG Alignment;
2352  PHYSICAL_ADDRESS MinimumAddress;
2353  PHYSICAL_ADDRESS MaximumAddress;
2354  } Memory;
2355  struct {
2356  ULONG MinimumVector;
2357  ULONG MaximumVector;
2358  } Interrupt;
2359  struct {
2360  ULONG MinimumChannel;
2361  ULONG MaximumChannel;
2362  } Dma;
2363  struct {
2364  ULONG Length;
2365  ULONG Alignment;
2366  PHYSICAL_ADDRESS MinimumAddress;
2367  PHYSICAL_ADDRESS MaximumAddress;
2368  } Generic;
2369  struct {
2370  ULONG Data[3];
2371  } DevicePrivate;
2372  struct {
2373  ULONG Length;
2374  ULONG MinBusNumber;
2375  ULONG MaxBusNumber;
2376  ULONG Reserved;
2377  } BusNumber;
2378  struct {
2379  ULONG Priority;
2380  ULONG Reserved1;
2381  ULONG Reserved2;
2382  } ConfigData;
2383  } u;
2385 
2386 typedef struct _IO_RESOURCE_LIST {
2387  USHORT Version;
2388  USHORT Revision;
2389  ULONG Count;
2390  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2392 
2393 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
2394  ULONG ListSize;
2395  INTERFACE_TYPE InterfaceType;
2396  ULONG BusNumber;
2397  ULONG SlotNumber;
2398  ULONG Reserved[3];
2399  ULONG AlternativeLists;
2402 
2403 _Function_class_(DRIVER_CANCEL)
2404 _Requires_lock_held_(_Global_cancel_spin_lock_)
2405 _Releases_lock_(_Global_cancel_spin_lock_)
2408 typedef VOID
2409 (NTAPI DRIVER_CANCEL)(
2412 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2413 
2414 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
2415  CSHORT Type;
2416  USHORT Size;
2417  struct _MDL *MdlAddress;
2418  ULONG Flags;
2419  union {
2420  struct _IRP *MasterIrp;
2421  volatile LONG IrpCount;
2422  PVOID SystemBuffer;
2423  } AssociatedIrp;
2424  LIST_ENTRY ThreadListEntry;
2426  KPROCESSOR_MODE RequestorMode;
2427  BOOLEAN PendingReturned;
2428  CHAR StackCount;
2429  CHAR CurrentLocation;
2430  BOOLEAN Cancel;
2431  KIRQL CancelIrql;
2432  CCHAR ApcEnvironment;
2433  UCHAR AllocationFlags;
2434  PIO_STATUS_BLOCK UserIosb;
2435  PKEVENT UserEvent;
2436  union {
2437  struct {
2438  _ANONYMOUS_UNION union {
2439  PIO_APC_ROUTINE UserApcRoutine;
2440  PVOID IssuingProcess;
2441  } DUMMYUNIONNAME;
2442  PVOID UserApcContext;
2443  } AsynchronousParameters;
2445  } Overlay;
2446  volatile PDRIVER_CANCEL CancelRoutine;
2447  PVOID UserBuffer;
2448  union {
2449  struct {
2450  _ANONYMOUS_UNION union {
2452  _ANONYMOUS_STRUCT struct {
2453  PVOID DriverContext[4];
2454  } DUMMYSTRUCTNAME;
2455  } DUMMYUNIONNAME;
2456  PETHREAD Thread;
2457  PCHAR AuxiliaryBuffer;
2458  _ANONYMOUS_STRUCT struct {
2459  LIST_ENTRY ListEntry;
2460  _ANONYMOUS_UNION union {
2461  struct _IO_STACK_LOCATION *CurrentStackLocation;
2462  ULONG PacketType;
2463  } DUMMYUNIONNAME;
2464  } DUMMYSTRUCTNAME;
2465  struct _FILE_OBJECT *OriginalFileObject;
2466  } Overlay;
2467  KAPC Apc;
2468  PVOID CompletionKey;
2469  } Tail;
2470 } IRP, *PIRP;
2471 
2472 typedef enum _IO_PAGING_PRIORITY {
2479 
2480 _Function_class_(IO_COMPLETION_ROUTINE)
2482 typedef NTSTATUS
2483 (NTAPI IO_COMPLETION_ROUTINE)(
2485  _In_ struct _IRP *Irp,
2487 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2488 
2489 _Function_class_(IO_DPC_ROUTINE)
2493 typedef VOID
2494 (NTAPI IO_DPC_ROUTINE)(
2495  _In_ struct _KDPC *Dpc,
2497  _Inout_ struct _IRP *Irp,
2499 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2500 
2501 typedef NTSTATUS
2504 
2505 typedef NTSTATUS
2507  VOID);
2508 
2509 _Function_class_(IO_TIMER_ROUTINE)
2511 typedef VOID
2512 (NTAPI IO_TIMER_ROUTINE)(
2515 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2516 
2517 typedef struct _IO_SECURITY_CONTEXT {
2523 
2524 struct _IO_CSQ;
2525 
2526 typedef struct _IO_CSQ_IRP_CONTEXT {
2527  ULONG Type;
2528  struct _IRP *Irp;
2529  struct _IO_CSQ *Csq;
2531 
2532 typedef VOID
2533 (NTAPI IO_CSQ_INSERT_IRP)(
2534  _In_ struct _IO_CSQ *Csq,
2536 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2537 
2538 typedef NTSTATUS
2539 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2540  _In_ struct _IO_CSQ *Csq,
2543 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2544 
2545 typedef VOID
2546 (NTAPI IO_CSQ_REMOVE_IRP)(
2547  _In_ struct _IO_CSQ *Csq,
2548  _In_ PIRP Irp);
2549 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2550 
2551 typedef PIRP
2552 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2553  _In_ struct _IO_CSQ *Csq,
2556 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2557 
2558 typedef VOID
2559 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2560  _In_ struct _IO_CSQ *Csq,
2562 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2563 
2564 typedef VOID
2565 (NTAPI IO_CSQ_RELEASE_LOCK)(
2566  _In_ struct _IO_CSQ *Csq,
2567  _In_ KIRQL Irql);
2568 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2569 
2570 typedef VOID
2571 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2572  _In_ struct _IO_CSQ *Csq,
2573  _In_ PIRP Irp);
2574 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2575 
2576 typedef struct _IO_CSQ {
2577  ULONG Type;
2584  PVOID ReservePointer;
2585 } IO_CSQ, *PIO_CSQ;
2586 
2587 typedef enum _BUS_QUERY_ID_TYPE {
2594 
2595 typedef enum _DEVICE_TEXT_TYPE {
2599 
2600 typedef BOOLEAN
2602  PVOID,
2603  PVOID);
2604 
2607 typedef NTSTATUS
2608 (NTAPI *PGPE_CONNECT_VECTOR)(
2612  BOOLEAN,
2614  PVOID,
2615  PVOID);
2616 
2619 typedef NTSTATUS
2620 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2621  PVOID);
2622 
2625 typedef NTSTATUS
2626 (NTAPI *PGPE_ENABLE_EVENT)(
2628  PVOID);
2629 
2632 typedef NTSTATUS
2633 (NTAPI *PGPE_DISABLE_EVENT)(
2635  PVOID);
2636 
2639 typedef NTSTATUS
2640 (NTAPI *PGPE_CLEAR_STATUS)(
2642  PVOID);
2643 
2644 typedef VOID
2646  PVOID,
2647  ULONG);
2648 
2651 typedef NTSTATUS
2652 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2655  PVOID);
2656 
2658 typedef VOID
2659 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
2662 
2669  PGPE_CONNECT_VECTOR GpeConnectVector;
2670  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
2671  PGPE_ENABLE_EVENT GpeEnableEvent;
2672  PGPE_DISABLE_EVENT GpeDisableEvent;
2673  PGPE_CLEAR_STATUS GpeClearStatus;
2674  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
2675  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
2677 
2678 typedef BOOLEAN
2682 
2685 typedef NTSTATUS
2686 (NTAPI *PGPE_CONNECT_VECTOR2)(
2687  PVOID Context,
2693  PVOID *ObjectContext);
2694 
2697 typedef NTSTATUS
2698 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
2699  PVOID Context,
2701 
2704 typedef NTSTATUS
2705 (NTAPI *PGPE_ENABLE_EVENT2)(
2706  PVOID Context,
2708 
2711 typedef NTSTATUS
2712 (NTAPI *PGPE_DISABLE_EVENT2)(
2713  PVOID Context,
2715 
2718 typedef NTSTATUS
2719 (NTAPI *PGPE_CLEAR_STATUS2)(
2720  PVOID Context,
2722 
2724 typedef VOID
2725 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
2728 
2731 typedef NTSTATUS
2732 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2733  PVOID Context,
2734  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
2736 
2738 typedef VOID
2739 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
2740  PVOID Context);
2741 
2748  PGPE_CONNECT_VECTOR2 GpeConnectVector;
2749  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
2750  PGPE_ENABLE_EVENT2 GpeEnableEvent;
2751  PGPE_DISABLE_EVENT2 GpeDisableEvent;
2752  PGPE_CLEAR_STATUS2 GpeClearStatus;
2753  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
2754  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
2756 
2757 #if !defined(_AMD64_) && !defined(_ARM_)
2758 #include <pshpack4.h>
2759 #endif
2760 
2761 typedef struct _IO_STACK_LOCATION {
2766  union {
2767  struct {
2773  } Create;
2774  struct {
2776  ULONG Options;
2780  } CreatePipe;
2781  struct {
2782  PIO_SECURITY_CONTEXT SecurityContext;
2783  ULONG Options;
2787  } CreateMailslot;
2788  struct {
2792  } Read;
2793  struct {
2794  ULONG Length;
2797  } Write;
2798  struct {
2799  ULONG Length;
2803  } QueryDirectory;
2804  struct {
2805  ULONG Length;
2807  } NotifyDirectory;
2808  struct {
2809  ULONG Length;
2812  } NotifyDirectoryEx;
2813  struct {
2814  ULONG Length;
2816  } QueryFile;
2817  struct {
2818  ULONG Length;
2821  _ANONYMOUS_UNION union {
2822  _ANONYMOUS_STRUCT struct {
2825  } DUMMYSTRUCTNAME;
2828  } DUMMYUNIONNAME;
2829  } SetFile;
2830  struct {
2831  ULONG Length;
2835  } QueryEa;
2836  struct {
2837  ULONG Length;
2838  } SetEa;
2839  struct {
2840  ULONG Length;
2842  } QueryVolume;
2843  struct {
2844  ULONG Length;
2846  } SetVolume;
2847  struct {
2852  } FileSystemControl;
2853  struct {
2857  } LockControl;
2858  struct {
2862  PVOID Type3InputBuffer;
2863  } DeviceIoControl;
2864  struct {
2867  } QuerySecurity;
2868  struct {
2871  } SetSecurity;
2872  struct {
2875  } MountVolume;
2876  struct {
2877  PVPB Vpb;
2879  } VerifyVolume;
2880  struct {
2882  } Scsi;
2883  struct {
2884  ULONG Length;
2888  } QueryQuota;
2889  struct {
2890  ULONG Length;
2891  } SetQuota;
2892  struct {
2894  } QueryDeviceRelations;
2895  struct {
2901  } QueryInterface;
2902  struct {
2905  struct {
2907  } FilterResourceRequirements;
2908  struct {
2913  } ReadWriteConfig;
2914  struct {
2916  } SetLock;
2917  struct {
2919  } QueryId;
2920  struct {
2923  } QueryDeviceText;
2924  struct {
2928  } UsageNotification;
2929  struct {
2931  } WaitWake;
2932  struct {
2934  } PowerSequence;
2935  struct {
2936  union {
2938 #if (NTDDI_VERSION >= NTDDI_VISTA)
2940 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
2941  };
2945  } Power;
2946  struct {
2949  } StartDevice;
2950  struct {
2954  PVOID Buffer;
2955  } WMI;
2956  struct {
2961  } Others;
2962  } Parameters;
2968 
2969 #if !defined(_AMD64_) && !defined(_ARM_)
2970 #include "poppack.h"
2971 #endif
2972 
2973 
2974 /* IO_STACK_LOCATION.Control */
2975 
2976 #define SL_PENDING_RETURNED 0x01
2977 #define SL_ERROR_RETURNED 0x02
2978 #define SL_INVOKE_ON_CANCEL 0x20
2979 #define SL_INVOKE_ON_SUCCESS 0x40
2980 #define SL_INVOKE_ON_ERROR 0x80
2981 
2982 $endif (_WDMDDK_)
2983 $if (_WDMDDK_ || _DEVIOCTL_)
2984 #define METHOD_BUFFERED 0
2985 #define METHOD_IN_DIRECT 1
2986 #define METHOD_OUT_DIRECT 2
2987 #define METHOD_NEITHER 3
2988 
2989 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
2990 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
2991 
2993 $if (_WDMDDK_)
2994 #define FILE_SUPERSEDED 0x00000000
2995 #define FILE_OPENED 0x00000001
2996 #define FILE_CREATED 0x00000002
2997 #define FILE_OVERWRITTEN 0x00000003
2998 #define FILE_EXISTS 0x00000004
2999 #define FILE_DOES_NOT_EXIST 0x00000005
3000 
3001 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
3002 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
3003 
3004 /* also in winnt.h */
3005 #define FILE_LIST_DIRECTORY 0x00000001
3006 #define FILE_READ_DATA 0x00000001
3007 #define FILE_ADD_FILE 0x00000002
3008 #define FILE_WRITE_DATA 0x00000002
3009 #define FILE_ADD_SUBDIRECTORY 0x00000004
3010 #define FILE_APPEND_DATA 0x00000004
3011 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3012 #define FILE_READ_EA 0x00000008
3013 #define FILE_WRITE_EA 0x00000010
3014 #define FILE_EXECUTE 0x00000020
3015 #define FILE_TRAVERSE 0x00000020
3016 #define FILE_DELETE_CHILD 0x00000040
3017 #define FILE_READ_ATTRIBUTES 0x00000080
3018 #define FILE_WRITE_ATTRIBUTES 0x00000100
3019 
3020 #define FILE_SHARE_READ 0x00000001
3021 #define FILE_SHARE_WRITE 0x00000002
3022 #define FILE_SHARE_DELETE 0x00000004
3023 #define FILE_SHARE_VALID_FLAGS 0x00000007
3024 
3025 #define FILE_ATTRIBUTE_READONLY 0x00000001
3026 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3027 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3028 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3029 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3030 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3031 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3032 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3033 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3034 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3035 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3036 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3037 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3038 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3039 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3040 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3041 
3042 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3043 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3044 
3045 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3046 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3047 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3048 #define FILE_VALID_SET_FLAGS 0x00000036
3049 
3050 #define FILE_SUPERSEDE 0x00000000
3051 #define FILE_OPEN 0x00000001
3052 #define FILE_CREATE 0x00000002
3053 #define FILE_OPEN_IF 0x00000003
3054 #define FILE_OVERWRITE 0x00000004
3055 #define FILE_OVERWRITE_IF 0x00000005
3056 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3057 
3058 #define FILE_DIRECTORY_FILE 0x00000001
3059 #define FILE_WRITE_THROUGH 0x00000002
3060 #define FILE_SEQUENTIAL_ONLY 0x00000004
3061 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3062 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3063 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3064 #define FILE_NON_DIRECTORY_FILE 0x00000040
3065 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3066 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3067 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3068 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3069 #define FILE_RANDOM_ACCESS 0x00000800
3070 #define FILE_DELETE_ON_CLOSE 0x00001000
3071 #define FILE_OPEN_BY_FILE_ID 0x00002000
3072 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3073 #define FILE_NO_COMPRESSION 0x00008000
3074 #if (NTDDI_VERSION >= NTDDI_WIN7)
3075 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3076 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3077 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3078 #define FILE_RESERVE_OPFILTER 0x00100000
3079 #define FILE_OPEN_REPARSE_POINT 0x00200000
3080 #define FILE_OPEN_NO_RECALL 0x00400000
3081 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3082 
3083 $endif (_WDMDDK_)
3084 $if (_WDMDDK_ || _DEVIOCTL_)
3085 #define FILE_ANY_ACCESS 0x00000000
3086 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3087 #define FILE_READ_ACCESS 0x00000001
3088 #define FILE_WRITE_ACCESS 0x00000002
3089 
3091 $if (_WDMDDK_)
3092 #define FILE_ALL_ACCESS \
3093  (STANDARD_RIGHTS_REQUIRED | \
3094  SYNCHRONIZE | \
3095  0x1FF)
3096 
3097 #define FILE_GENERIC_EXECUTE \
3098  (STANDARD_RIGHTS_EXECUTE | \
3099  FILE_READ_ATTRIBUTES | \
3100  FILE_EXECUTE | \
3101  SYNCHRONIZE)
3102 
3103 #define FILE_GENERIC_READ \
3104  (STANDARD_RIGHTS_READ | \
3105  FILE_READ_DATA | \
3106  FILE_READ_ATTRIBUTES | \
3107  FILE_READ_EA | \
3108  SYNCHRONIZE)
3109 
3110 #define FILE_GENERIC_WRITE \
3111  (STANDARD_RIGHTS_WRITE | \
3112  FILE_WRITE_DATA | \
3113  FILE_WRITE_ATTRIBUTES | \
3114  FILE_WRITE_EA | \
3115  FILE_APPEND_DATA | \
3116  SYNCHRONIZE)
3117 
3118 /* end winnt.h */
3119 
3120 #define WMIREG_ACTION_REGISTER 1
3121 #define WMIREG_ACTION_DEREGISTER 2
3122 #define WMIREG_ACTION_REREGISTER 3
3123 #define WMIREG_ACTION_UPDATE_GUIDS 4
3124 #define WMIREG_ACTION_BLOCK_IRPS 5
3125 
3126 #define WMIREGISTER 0
3127 #define WMIUPDATE 1
3128 
3131 typedef VOID
3132 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3133  PVOID Wnode,
3134  PVOID Context);
3135 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3136 
3137 #ifndef _PCI_X_
3138 #define _PCI_X_
3139 
3140 typedef struct _PCI_SLOT_NUMBER {
3141  union {
3142  struct {
3146  } bits;
3148  } u;
3150 
3151 #define PCI_TYPE0_ADDRESSES 6
3152 #define PCI_TYPE1_ADDRESSES 2
3153 #define PCI_TYPE2_ADDRESSES 5
3154 
3155 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3156  inheritance, even from a struct renders the type non-POD. So we use
3157  this hack */
3158 #define PCI_COMMON_HEADER_LAYOUT \
3159  USHORT VendorID; \
3160  USHORT DeviceID; \
3161  USHORT Command; \
3162  USHORT Status; \
3163  UCHAR RevisionID; \
3164  UCHAR ProgIf; \
3165  UCHAR SubClass; \
3166  UCHAR BaseClass; \
3167  UCHAR CacheLineSize; \
3168  UCHAR LatencyTimer; \
3169  UCHAR HeaderType; \
3170  UCHAR BIST; \
3171  union { \
3172  struct _PCI_HEADER_TYPE_0 { \
3173  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3174  ULONG CIS; \
3175  USHORT SubVendorID; \
3176  USHORT SubSystemID; \
3177  ULONG ROMBaseAddress; \
3178  UCHAR CapabilitiesPtr; \
3179  UCHAR Reserved1[3]; \
3180  ULONG Reserved2; \
3181  UCHAR InterruptLine; \
3182  UCHAR InterruptPin; \
3183  UCHAR MinimumGrant; \
3184  UCHAR MaximumLatency; \
3185  } type0; \
3186  struct _PCI_HEADER_TYPE_1 { \
3187  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3188  UCHAR PrimaryBus; \
3189  UCHAR SecondaryBus; \
3190  UCHAR SubordinateBus; \
3191  UCHAR SecondaryLatency; \
3192  UCHAR IOBase; \
3193  UCHAR IOLimit; \
3194  USHORT SecondaryStatus; \
3195  USHORT MemoryBase; \
3196  USHORT MemoryLimit; \
3197  USHORT PrefetchBase; \
3198  USHORT PrefetchLimit; \
3199  ULONG PrefetchBaseUpper32; \
3200  ULONG PrefetchLimitUpper32; \
3201  USHORT IOBaseUpper16; \
3202  USHORT IOLimitUpper16; \
3203  UCHAR CapabilitiesPtr; \
3204  UCHAR Reserved1[3]; \
3205  ULONG ROMBaseAddress; \
3206  UCHAR InterruptLine; \
3207  UCHAR InterruptPin; \
3208  USHORT BridgeControl; \
3209  } type1; \
3210  struct _PCI_HEADER_TYPE_2 { \
3211  ULONG SocketRegistersBaseAddress; \
3212  UCHAR CapabilitiesPtr; \
3213  UCHAR Reserved; \
3214  USHORT SecondaryStatus; \
3215  UCHAR PrimaryBus; \
3216  UCHAR SecondaryBus; \
3217  UCHAR SubordinateBus; \
3218  UCHAR SecondaryLatency; \
3219  struct { \
3220  ULONG Base; \
3221  ULONG Limit; \
3222  } Range[PCI_TYPE2_ADDRESSES-1]; \
3223  UCHAR InterruptLine; \
3224  UCHAR InterruptPin; \
3225  USHORT BridgeControl; \
3226  } type2; \
3227  } u;
3228 
3229 typedef struct _PCI_COMMON_HEADER {
3232 
3233 #ifdef __cplusplus
3234 typedef struct _PCI_COMMON_CONFIG {
3236  UCHAR DeviceSpecific[192];
3238 #else
3239 typedef struct _PCI_COMMON_CONFIG {
3241  UCHAR DeviceSpecific[192];
3243 #endif
3244 
3245 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3246 
3247 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3248 
3249 #define PCI_MAX_DEVICES 32
3250 #define PCI_MAX_FUNCTION 8
3251 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3252 #define PCI_INVALID_VENDORID 0xFFFF
3253 
3254 /* PCI_COMMON_CONFIG.HeaderType */
3255 #define PCI_MULTIFUNCTION 0x80
3256 #define PCI_DEVICE_TYPE 0x00
3257 #define PCI_BRIDGE_TYPE 0x01
3258 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3259 
3260 #define PCI_CONFIGURATION_TYPE(PciData) \
3261  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3262 
3263 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3264  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3265 
3266 /* PCI_COMMON_CONFIG.Command */
3267 #define PCI_ENABLE_IO_SPACE 0x0001
3268 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3269 #define PCI_ENABLE_BUS_MASTER 0x0004
3270 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3271 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3272 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3273 #define PCI_ENABLE_PARITY 0x0040
3274 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3275 #define PCI_ENABLE_SERR 0x0100
3276 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3277 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3278 
3279 /* PCI_COMMON_CONFIG.Status */
3280 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3281 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3282 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3283 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3284 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3285 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3286 #define PCI_STATUS_DEVSEL 0x0600
3287 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3288 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3289 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3290 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3291 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3292 
3293 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3294 
3295 #define PCI_WHICHSPACE_CONFIG 0x0
3296 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3297 
3298 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3299 #define PCI_CAPABILITY_ID_AGP 0x02
3300 #define PCI_CAPABILITY_ID_VPD 0x03
3301 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3302 #define PCI_CAPABILITY_ID_MSI 0x05
3303 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3304 #define PCI_CAPABILITY_ID_PCIX 0x07
3305 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3306 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3307 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3308 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3309 #define PCI_CAPABILITY_ID_SHPC 0x0C
3310 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3311 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3312 #define PCI_CAPABILITY_ID_SECURE 0x0F
3313 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3314 #define PCI_CAPABILITY_ID_MSIX 0x11
3315 
3320 
3321 typedef struct _PCI_PMC {
3327  struct _PM_SUPPORT {
3336  } Support;
3337 } PCI_PMC, *PPCI_PMC;
3338 
3339 typedef struct _PCI_PMCSR {
3346 } PCI_PMCSR, *PPCI_PMCSR;
3347 
3348 typedef struct _PCI_PMCSR_BSE {
3353 
3354 typedef struct _PCI_PM_CAPABILITY {
3356  union {
3359  } PMC;
3360  union {
3362  USHORT AsUSHORT;
3363  } PMCSR;
3364  union {
3367  } PMCSR_BSE;
3370 
3371 typedef struct {
3373  union {
3374  struct {
3380  } bits;
3382  } Command;
3383  union {
3384  struct {
3399  } bits;
3401  } Status;
3403 
3404 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3405 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3406 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3407 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3408 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3409 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3410 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3411 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3412 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3413 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3414 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3415 
3421 
3427 
3429  _ANONYMOUS_STRUCT struct {
3445  } DUMMYSTRUCTNAME;
3448 
3450  _ANONYMOUS_STRUCT struct {
3466  } DUMMYSTRUCTNAME;
3469 
3471  _ANONYMOUS_STRUCT struct {
3487  } DUMMYSTRUCTNAME;
3490 
3492  _ANONYMOUS_STRUCT struct {
3502  } DUMMYSTRUCTNAME;
3505 
3507  _ANONYMOUS_STRUCT struct {
3517  } DUMMYSTRUCTNAME;
3520 
3522  _ANONYMOUS_STRUCT struct {
3529  } DUMMYSTRUCTNAME;
3532 
3534  _ANONYMOUS_STRUCT struct {
3539  } DUMMYSTRUCTNAME;
3542 
3544  _ANONYMOUS_STRUCT struct {
3554  } DUMMYSTRUCTNAME;
3557 
3559  _ANONYMOUS_STRUCT struct {
3566  } DUMMYSTRUCTNAME;
3569 
3571  _ANONYMOUS_STRUCT struct {
3587  } DUMMYSTRUCTNAME;
3590 
3592  _ANONYMOUS_STRUCT struct {
3608  } DUMMYSTRUCTNAME;
3611 
3613  _ANONYMOUS_STRUCT struct {
3629  } DUMMYSTRUCTNAME;
3632 
3634  _ANONYMOUS_STRUCT struct {
3637  } DUMMYSTRUCTNAME;
3640 
3641 #define ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING 0x00000001
3642 #define ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING 0x00000002
3643 #define ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING 0x00000004
3644 
3645 #define ROOT_CMD_ERROR_REPORTING_ENABLE_MASK \
3646  (ROOT_CMD_ENABLE_FATAL_ERROR_REPORTING | \
3647  ROOT_CMD_ENABLE_NONFATAL_ERROR_REPORTING | \
3648  ROOT_CMD_ENABLE_CORRECTABLE_ERROR_REPORTING)
3649 
3658  ULONG HeaderLog[4];
3663  ULONG SecHeaderLog[4];
3665 
3674  ULONG HeaderLog[4];
3679 
3688  ULONG HeaderLog[4];
3693  ULONG SecHeaderLog[4];
3695 
3697  _ANONYMOUS_STRUCT struct {
3701  } DUMMYSTRUCTNAME;
3704 
3706  _ANONYMOUS_STRUCT struct {
3713  } DUMMYSTRUCTNAME;
3716 
3718  _ANONYMOUS_STRUCT struct {
3721  } DUMMYSTRUCTNAME;
3724 
3726  _ANONYMOUS_STRUCT struct {
3729  } DUMMYSTRUCTNAME;
3732