ReactOS  0.4.15-dev-2144-g2282205
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 /* DEVICE_OBJECT.DeviceType */
49 #define DEVICE_TYPE ULONG
50 
51 #define FILE_DEVICE_BEEP 0x00000001
52 #define FILE_DEVICE_CD_ROM 0x00000002
53 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
54 #define FILE_DEVICE_CONTROLLER 0x00000004
55 #define FILE_DEVICE_DATALINK 0x00000005
56 #define FILE_DEVICE_DFS 0x00000006
57 #define FILE_DEVICE_DISK 0x00000007
58 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
59 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
60 #define FILE_DEVICE_INPORT_PORT 0x0000000a
61 #define FILE_DEVICE_KEYBOARD 0x0000000b
62 #define FILE_DEVICE_MAILSLOT 0x0000000c
63 #define FILE_DEVICE_MIDI_IN 0x0000000d
64 #define FILE_DEVICE_MIDI_OUT 0x0000000e
65 #define FILE_DEVICE_MOUSE 0x0000000f
66 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
67 #define FILE_DEVICE_NAMED_PIPE 0x00000011
68 #define FILE_DEVICE_NETWORK 0x00000012
69 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
70 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
71 #define FILE_DEVICE_NULL 0x00000015
72 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
73 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
74 #define FILE_DEVICE_PRINTER 0x00000018
75 #define FILE_DEVICE_SCANNER 0x00000019
76 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
77 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
78 #define FILE_DEVICE_SCREEN 0x0000001c
79 #define FILE_DEVICE_SOUND 0x0000001d
80 #define FILE_DEVICE_STREAMS 0x0000001e
81 #define FILE_DEVICE_TAPE 0x0000001f
82 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
83 #define FILE_DEVICE_TRANSPORT 0x00000021
84 #define FILE_DEVICE_UNKNOWN 0x00000022
85 #define FILE_DEVICE_VIDEO 0x00000023
86 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
87 #define FILE_DEVICE_WAVE_IN 0x00000025
88 #define FILE_DEVICE_WAVE_OUT 0x00000026
89 #define FILE_DEVICE_8042_PORT 0x00000027
90 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
91 #define FILE_DEVICE_BATTERY 0x00000029
92 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
93 #define FILE_DEVICE_MODEM 0x0000002b
94 #define FILE_DEVICE_VDM 0x0000002c
95 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
96 #define FILE_DEVICE_SMB 0x0000002e
97 #define FILE_DEVICE_KS 0x0000002f
98 #define FILE_DEVICE_CHANGER 0x00000030
99 #define FILE_DEVICE_SMARTCARD 0x00000031
100 #define FILE_DEVICE_ACPI 0x00000032
101 #define FILE_DEVICE_DVD 0x00000033
102 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
103 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
104 #define FILE_DEVICE_DFS_VOLUME 0x00000036
105 #define FILE_DEVICE_SERENUM 0x00000037
106 #define FILE_DEVICE_TERMSRV 0x00000038
107 #define FILE_DEVICE_KSEC 0x00000039
108 #define FILE_DEVICE_FIPS 0x0000003a
109 #define FILE_DEVICE_INFINIBAND 0x0000003b
110 #define FILE_DEVICE_VMBUS 0x0000003e
111 #define FILE_DEVICE_CRYPT_PROVIDER 0x0000003f
112 #define FILE_DEVICE_WPD 0x00000040
113 #define FILE_DEVICE_BLUETOOTH 0x00000041
114 #define FILE_DEVICE_MT_COMPOSITE 0x00000042
115 #define FILE_DEVICE_MT_TRANSPORT 0x00000043
116 #define FILE_DEVICE_BIOMETRIC 0x00000044
117 #define FILE_DEVICE_PMI 0x00000045
118 #define FILE_DEVICE_EHSTOR 0x00000046
119 #define FILE_DEVICE_DEVAPI 0x00000047
120 #define FILE_DEVICE_GPIO 0x00000048
121 #define FILE_DEVICE_USBEX 0x00000049
122 #define FILE_DEVICE_CONSOLE 0x00000050
123 #define FILE_DEVICE_NFP 0x00000051
124 #define FILE_DEVICE_SYSENV 0x00000052
125 #define FILE_DEVICE_VIRTUAL_BLOCK 0x00000053
126 #define FILE_DEVICE_POINT_OF_SERVICE 0x00000054
127 #define FILE_DEVICE_STORAGE_REPLICATION 0x00000055
128 #define FILE_DEVICE_TRUST_ENV 0x00000056
129 #define FILE_DEVICE_UCM 0x00000057
130 #define FILE_DEVICE_UCMTCPCI 0x00000058
131 #define FILE_DEVICE_PERSISTENT_MEMORY 0x00000059
132 #define FILE_DEVICE_NVDIMM 0x0000005a
133 #define FILE_DEVICE_HOLOGRAPHIC 0x0000005b
134 #define FILE_DEVICE_SDFXHCI 0x0000005c
135 #define FILE_DEVICE_UCMUCSI 0x0000005d
136 
138 $if (_WDMDDK_)
139 #if defined(NT_PROCESSOR_GROUPS)
140 
142 
143 enum _IRQ_DEVICE_POLICY_USHORT {
148  IrqPolicyAllProcessorsInGroup = 3,
151 
152 #else /* defined(NT_PROCESSOR_GROUPS) */
153 
154 typedef enum _IRQ_DEVICE_POLICY {
162 
163 #endif
164 
165 typedef enum _IRQ_PRIORITY {
171 
172 typedef enum _IRQ_GROUP_POLICY {
176 
177 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
178 
183 
184 typedef struct _CLIENT_ID {
188 
189 typedef struct _VPB {
199 } VPB, *PVPB;
200 
201 typedef enum _IO_ALLOCATION_ACTION {
206 
207 _Function_class_(DRIVER_CONTROL)
209 typedef IO_ALLOCATION_ACTION
210 (NTAPI DRIVER_CONTROL)(
212  _Inout_ struct _IRP *Irp,
214  _In_ PVOID Context);
215 typedef DRIVER_CONTROL *PDRIVER_CONTROL;
216 
217 typedef struct _WAIT_CONTEXT_BLOCK {
226 
228 $if (_NTDDK_)
229 /* DEVICE_OBJECT.Flags */
230 #define DO_DEVICE_HAS_NAME 0x00000040
231 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
232 #define DO_LONG_TERM_REQUESTS 0x00000200
233 #define DO_NEVER_LAST_DEVICE 0x00000400
234 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
235 #define DO_SUPPORTS_TRANSACTIONS 0x00040000
236 #define DO_FORCE_NEITHER_IO 0x00080000
237 #define DO_VOLUME_DEVICE_OBJECT 0x00100000
238 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
239 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
240 #define DO_DISALLOW_EXECUTE 0x00800000
241 
242 $endif (_NTDDK_)
243 $if (_WDMDDK_)
244 /* DEVICE_OBJECT.Flags */
245 #define DO_UNLOAD_PENDING 0x00000001
246 #define DO_VERIFY_VOLUME 0x00000002
247 #define DO_BUFFERED_IO 0x00000004
248 #define DO_EXCLUSIVE 0x00000008
249 #define DO_DIRECT_IO 0x00000010
250 #define DO_MAP_IO_BUFFER 0x00000020
251 #define DO_DEVICE_INITIALIZING 0x00000080
252 #define DO_SHUTDOWN_REGISTERED 0x00000800
253 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
254 #define DO_POWER_PAGABLE 0x00002000
255 #define DO_POWER_INRUSH 0x00004000
256 
257 /* DEVICE_OBJECT.Characteristics */
258 #define FILE_REMOVABLE_MEDIA 0x00000001
259 #define FILE_READ_ONLY_DEVICE 0x00000002
260 #define FILE_FLOPPY_DISKETTE 0x00000004
261 #define FILE_WRITE_ONCE_MEDIA 0x00000008
262 #define FILE_REMOTE_DEVICE 0x00000010
263 #define FILE_DEVICE_IS_MOUNTED 0x00000020
264 #define FILE_VIRTUAL_VOLUME 0x00000040
265 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
266 #define FILE_DEVICE_SECURE_OPEN 0x00000100
267 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
268 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
269 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
270 #define FILE_PORTABLE_DEVICE 0x00004000
271 #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
272 
273 /* DEVICE_OBJECT.AlignmentRequirement */
274 #define FILE_BYTE_ALIGNMENT 0x00000000
275 #define FILE_WORD_ALIGNMENT 0x00000001
276 #define FILE_LONG_ALIGNMENT 0x00000003
277 #define FILE_QUAD_ALIGNMENT 0x00000007
278 #define FILE_OCTA_ALIGNMENT 0x0000000f
279 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
280 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
281 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
282 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
283 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
284 
286 
287 $if (_WDMDDK_)
288 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {
289  CSHORT Type;
290  USHORT Size;
291  LONG ReferenceCount;
293  struct _DEVICE_OBJECT *NextDevice;
294  struct _DEVICE_OBJECT *AttachedDevice;
295  struct _IRP *CurrentIrp;
297  ULONG Flags;
298  ULONG Characteristics;
299  volatile PVPB Vpb;
300  PVOID DeviceExtension;
303  union {
304  LIST_ENTRY ListEntry;
305  WAIT_CONTEXT_BLOCK Wcb;
306  } Queue;
308  KDEVICE_QUEUE DeviceQueue;
309  KDPC Dpc;
310  ULONG ActiveThreadCount;
312  KEVENT DeviceLock;
314  USHORT Spare1;
315  struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
316  PVOID Reserved;
318 
319 typedef enum _IO_SESSION_STATE {
330 
335 
346 
352 
368 
378 
381  union {
385  } ConnectionContext;
393 
396  _ANONYMOUS_UNION union {
400  } DUMMYUNIONNAME;
402 
405  union {
409  } ConnectionContext;
411 
413 {
415  union
416  {
420  } ConnectionContext;
422 
423 typedef enum _IO_ACCESS_TYPE {
428 
429 typedef enum _IO_ACCESS_MODE {
433 
438 
446 
451 
457 
458 #if (NTDDI_VERSION >= NTDDI_WIN7)
459 
460 typedef NTSTATUS
462  VOID);
463 
464 typedef NTSTATUS
465 (NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
468  _In_ ULONG Event,
472 
473 typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
474 
475 #endif
476 
478 
482  volatile LONG IoCount;
485 
498 
499 typedef struct _IO_REMOVE_LOCK {
501 #if DBG
503 #endif
505 
506 typedef struct _IO_WORKITEM *PIO_WORKITEM;
507 
508 _Function_class_(IO_WORKITEM_ROUTINE)
511 typedef VOID
512 (NTAPI IO_WORKITEM_ROUTINE)(
515 typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
516 
517 typedef VOID
518 (NTAPI IO_WORKITEM_ROUTINE_EX)(
522 typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
523 
524 typedef struct _SHARE_ACCESS {
533 
534 typedef enum _CREATE_FILE_TYPE {
539 
540 #define IO_FORCE_ACCESS_CHECK 0x001
541 #define IO_NO_PARAMETER_CHECKING 0x100
542 
543 #define IO_REPARSE 0x0
544 #define IO_REMOUNT 0x1
545 
546 typedef struct _IO_STATUS_BLOCK {
547  _ANONYMOUS_UNION union {
549  PVOID Pointer;
550  } DUMMYUNIONNAME;
553 
554 #if defined(_WIN64)
555 typedef struct _IO_STATUS_BLOCK32 {
558 } IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
559 #endif
560 
561 typedef VOID
566 
567 #define PIO_APC_ROUTINE_DEFINED
568 
569 typedef enum _IO_SESSION_EVENT {
579 
580 #define IO_SESSION_STATE_ALL_EVENTS 0xffffffff
581 #define IO_SESSION_STATE_CREATION_EVENT 0x00000001
582 #define IO_SESSION_STATE_TERMINATION_EVENT 0x00000002
583 #define IO_SESSION_STATE_CONNECT_EVENT 0x00000004
584 #define IO_SESSION_STATE_DISCONNECT_EVENT 0x00000008
585 #define IO_SESSION_STATE_LOGON_EVENT 0x00000010
586 #define IO_SESSION_STATE_LOGOFF_EVENT 0x00000020
587 
588 #define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
589 
590 #define IO_SESSION_MAX_PAYLOAD_SIZE 256L
591 
592 typedef struct _IO_SESSION_CONNECT_INFO {
596 
597 #define EVENT_INCREMENT 1
598 #define IO_NO_INCREMENT 0
599 #define IO_CD_ROM_INCREMENT 1
600 #define IO_DISK_INCREMENT 1
601 #define IO_KEYBOARD_INCREMENT 6
602 #define IO_MAILSLOT_INCREMENT 2
603 #define IO_MOUSE_INCREMENT 6
604 #define IO_NAMED_PIPE_INCREMENT 2
605 #define IO_NETWORK_INCREMENT 2
606 #define IO_PARALLEL_INCREMENT 1
607 #define IO_SERIAL_INCREMENT 2
608 #define IO_SOUND_INCREMENT 8
609 #define IO_VIDEO_INCREMENT 1
610 #define SEMAPHORE_INCREMENT 1
611 
612 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
613 
614 typedef struct _BOOTDISK_INFORMATION {
620 
621 typedef struct _BOOTDISK_INFORMATION_EX {
631 
632 #if (NTDDI_VERSION >= NTDDI_WIN7)
633 
637  _ANONYMOUS_UNION union {
640  } DUMMYUNIONNAME;
643 
648 
649 #else
650 
651 #if (NTDDI_VERSION >= NTDDI_VISTA)
652 typedef struct _BOOTDISK_INFORMATION_LITE {
653  ULONG BootDeviceSignature;
654  ULONG SystemDeviceSignature;
655  GUID BootDeviceGuid;
656  GUID SystemDeviceGuid;
657  BOOLEAN BootDeviceIsGpt;
658  BOOLEAN SystemDeviceIsGpt;
660 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
661 
662 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
663 
664 #include <pshpack1.h>
665 
666 typedef struct _EISA_MEMORY_TYPE {
675 
683 
684 typedef struct _EISA_IRQ_DESCRIPTOR {
691 
692 typedef struct _EISA_IRQ_CONFIGURATION {
696 
697 typedef struct _DMA_CONFIGURATION_BYTE0 {
703 
704 typedef struct _DMA_CONFIGURATION_BYTE1 {
710 
711 typedef struct _EISA_DMA_CONFIGURATION {
715 
716 typedef struct _EISA_PORT_DESCRIPTOR {
722 
723 typedef struct _EISA_PORT_CONFIGURATION {
727 
738 
745  UCHAR Selections[26];
747  UCHAR TypeString[80];
754 
755 #include <poppack.h>
756 
757 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
758 
759 #define EISA_FUNCTION_ENABLED 0x80
760 #define EISA_FREE_FORM_DATA 0x40
761 #define EISA_HAS_PORT_INIT_ENTRY 0x20
762 #define EISA_HAS_PORT_RANGE 0x10
763 #define EISA_HAS_DMA_ENTRY 0x08
764 #define EISA_HAS_IRQ_ENTRY 0x04
765 #define EISA_HAS_MEMORY_ENTRY 0x02
766 #define EISA_HAS_TYPE_ENTRY 0x01
767 #define EISA_HAS_INFORMATION \
768  (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
769  + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
770 
771 #define EISA_MORE_ENTRIES 0x80
772 #define EISA_SYSTEM_MEMORY 0x00
773 #define EISA_MEMORY_TYPE_RAM 0x01
774 
775 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
776 
777 #define EISA_INVALID_SLOT 0x80
778 #define EISA_INVALID_FUNCTION 0x81
779 #define EISA_INVALID_CONFIGURATION 0x82
780 #define EISA_EMPTY_SLOT 0x83
781 #define EISA_INVALID_BIOS_CALL 0x86
782 
783 /*
784 ** Plug and Play structures
785 */
786 
787 typedef VOID
789  PVOID Context);
790 
791 typedef VOID
793  PVOID Context);
794 
795 _Function_class_(TRANSLATE_BUS_ADDRESS)
797 typedef BOOLEAN
798 (NTAPI TRANSLATE_BUS_ADDRESS)(
801  _In_ ULONG Length,
804 typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
805 
806 _Function_class_(GET_DMA_ADAPTER)
808 typedef struct _DMA_ADAPTER*
809 (NTAPI GET_DMA_ADAPTER)(
813 typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
814 
815 _Function_class_(GET_SET_DEVICE_DATA)
817 typedef ULONG
818 (NTAPI GET_SET_DEVICE_DATA)(
823  _In_ ULONG Length);
824 typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
825 
826 typedef enum _DEVICE_INSTALL_STATE {
832 
833 typedef struct _LEGACY_BUS_INFORMATION {
838 
844 
845 typedef VOID
847  _In_ PVOID Context);
848 
857 
858 typedef VOID
862 
863 #define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
864 
865 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
866 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
867 #define PCI_USE_REVISION 0x00000002
868 #define PCI_USE_VENDEV_IDS 0x00000004
869 #define PCI_USE_CLASS_SUBCLASS 0x00000008
870 #define PCI_USE_PROGIF 0x00000010
871 #define PCI_USE_LOCAL_BUS 0x00000020
872 #define PCI_USE_LOCAL_DEVICE 0x00000040
873 
886 
889 typedef BOOLEAN
890 (NTAPI PCI_IS_DEVICE_PRESENT)(
891  _In_ USHORT VendorID,
896  _In_ ULONG Flags);
897 typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
898 
901 typedef BOOLEAN
902 (NTAPI PCI_IS_DEVICE_PRESENT_EX)(
905 typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
906 
907 typedef struct _BUS_INTERFACE_STANDARD {
918 
928 
930 typedef struct _DEVICE_CAPABILITIES {
931  _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
932  USHORT Version;
933  ULONG DeviceD1:1;
934  ULONG DeviceD2:1;
935  ULONG LockSupported:1;
936  ULONG EjectSupported:1;
937  ULONG Removable:1;
938  ULONG DockDevice:1;
939  ULONG UniqueID:1;
940  ULONG SilentInstall:1;
941  ULONG RawDeviceOK:1;
942  ULONG SurpriseRemovalOK:1;
943  ULONG WakeFromD0:1;
944  ULONG WakeFromD1:1;
945  ULONG WakeFromD2:1;
946  ULONG WakeFromD3:1;
947  ULONG HardwareDisabled:1;
948  ULONG NonDynamic:1;
949  ULONG WarmEjectSupported:1;
950  ULONG NoDisplayInUI:1;
951  ULONG Reserved1:1;
952  ULONG WakeFromInterrupt:1;
953  ULONG SecureDevice:1;
954  ULONG ChildOfVgaEnabledBridge:1;
955  ULONG DecodeIoOnBoot:1;
956  ULONG Reserved:9;
957  ULONG Address;
958  ULONG UINumber;
960  SYSTEM_POWER_STATE SystemWake;
961  DEVICE_POWER_STATE DeviceWake;
962  ULONG D1Latency;
963  ULONG D2Latency;
964  ULONG D3Latency;
966 
974 
980 
981 #undef INTERFACE
982 
983 typedef struct _INTERFACE {
984  USHORT Size;
985  USHORT Version;
986  PVOID Context;
990 
996 
998 
999 /* PNP_DEVICE_STATE */
1000 
1001 #define PNP_DEVICE_DISABLED 0x00000001
1002 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
1003 #define PNP_DEVICE_FAILED 0x00000004
1004 #define PNP_DEVICE_REMOVED 0x00000008
1005 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
1006 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
1007 
1012  struct _FILE_OBJECT *FileObject;
1014  UCHAR CustomDataBuffer[1];
1016 
1021  struct _FILE_OBJECT *FileObject;
1023 
1024 #if (NTDDI_VERSION >= NTDDI_VISTA)
1025 #include <devpropdef.h>
1026 #define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
1027 #endif
1028 
1029 #define PNP_REPLACE_NO_MAP MAXLONGLONG
1030 
1032 typedef NTSTATUS
1033 (NTAPI *PREPLACE_MAP_MEMORY)(
1034  _In_ PHYSICAL_ADDRESS TargetPhysicalAddress,
1039 
1044  struct {
1047  } Ranges[ANYSIZE_ARRAY];
1049 
1052  _Field_range_(<=, MAXIMUM_GROUPS) ULONG GroupCount;
1057 
1064 
1065 #define PNP_REPLACE_PARAMETERS_VERSION 2
1066 
1067 typedef struct _PNP_REPLACE_PARAMETERS {
1076  PREPLACE_MAP_MEMORY MapMemory;
1078 
1079 typedef VOID
1081  VOID);
1082 
1084 typedef NTSTATUS
1085 (NTAPI *PREPLACE_BEGIN)(
1088 
1090 typedef NTSTATUS
1091 (NTAPI *PREPLACE_END)(
1092  _In_ PVOID Context);
1093 
1095 typedef NTSTATUS
1096 (NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1097  _In_ PVOID Context,
1100 
1102 typedef NTSTATUS
1103 (NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1104  _In_ PVOID Context,
1106  _In_ BOOLEAN Target);
1107 
1109 typedef NTSTATUS
1110 (NTAPI *PREPLACE_SWAP)(
1111  _In_ PVOID Context);
1112 
1114 typedef NTSTATUS
1115 (NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1116  _In_ PVOID Context);
1117 
1119 typedef NTSTATUS
1120 (NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1121  _In_ PVOID Context);
1122 
1124 typedef NTSTATUS
1125 (NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1126  _In_ PVOID Context,
1129 
1131 typedef NTSTATUS
1132 (NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1133  _In_ PVOID Context,
1135 
1136 #define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1137 #define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1138  FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
1139 
1140 #define PNP_REPLACE_MEMORY_SUPPORTED 0x0001
1141 #define PNP_REPLACE_PROCESSOR_SUPPORTED 0x0002
1142 #define PNP_REPLACE_HARDWARE_MEMORY_MIRRORING 0x0004
1143 #define PNP_REPLACE_HARDWARE_PAGE_COPY 0x0008
1144 #define PNP_REPLACE_HARDWARE_QUIESCE 0x0010
1145 
1151  PREPLACE_BEGIN BeginReplace;
1152  PREPLACE_END EndReplace;
1153  PREPLACE_MIRROR_PHYSICAL_MEMORY MirrorPhysicalMemory;
1154  PREPLACE_SET_PROCESSOR_ID SetProcessorId;
1155  PREPLACE_SWAP Swap;
1156  PREPLACE_INITIATE_HARDWARE_MIRROR InitiateHardwareMirror;
1157  PREPLACE_MIRROR_PLATFORM_MEMORY MirrorPlatformMemory;
1158  PREPLACE_GET_MEMORY_DESTINATION GetMemoryDestination;
1159  PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE EnableDisableHardwareQuiesce;
1161 
1163 typedef NTSTATUS
1164 (NTAPI *PREPLACE_DRIVER_INIT)(
1167 
1177 
1178 typedef struct _POWER_SEQUENCE {
1183 
1184 #ifdef _PREFAST_
1185 #define __string_type 0x1000
1186 #define __guid_type 0x2000
1187 #define __multiString_type 0x4000
1188 #else
1189 #define __string_type 0
1190 #define __guid_type 0
1191 #define __multiString_type 0
1192 #endif
1193 
1194 typedef enum {
1219 
1226 
1227 typedef enum _IO_PRIORITY_HINT {
1235 
1236 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1237 
1238 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1240 typedef NTSTATUS
1241 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1244 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1245 
1246 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1248 typedef VOID
1249 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1251 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1252 
1294 #if (NTDDI_VERSION >= NTDDI_VISTA)
1304 #endif
1305 #if (NTDDI_VERSION >= NTDDI_WIN7)
1312 #endif
1315 
1320 
1321 typedef struct _FILE_POSITION_INFORMATION {
1322  LARGE_INTEGER CurrentByteOffset;
1324 
1325 typedef struct _FILE_BASIC_INFORMATION {
1326  LARGE_INTEGER CreationTime;
1327  LARGE_INTEGER LastAccessTime;
1328  LARGE_INTEGER LastWriteTime;
1329  LARGE_INTEGER ChangeTime;
1332 
1336 
1338  ULONG Flags;
1340 
1345 
1349 
1353 
1356  ULONG_PTR ProcessIdList[1];
1358 
1359 typedef struct _FILE_STANDARD_INFORMATION {
1361  LARGE_INTEGER EndOfFile;
1362  ULONG NumberOfLinks;
1363  BOOLEAN DeletePending;
1366 
1367 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1368  LARGE_INTEGER CreationTime;
1369  LARGE_INTEGER LastAccessTime;
1370  LARGE_INTEGER LastWriteTime;
1371  LARGE_INTEGER ChangeTime;
1373  LARGE_INTEGER EndOfFile;
1376 
1377 typedef enum _FSINFOCLASS {
1390 
1391 typedef struct _FILE_FS_DEVICE_INFORMATION {
1393  ULONG Characteristics;
1395 
1396 typedef struct _FILE_FULL_EA_INFORMATION {
1397  ULONG NextEntryOffset;
1398  UCHAR Flags;
1399  UCHAR EaNameLength;
1400  USHORT EaValueLength;
1401  CHAR EaName[1];
1403 
1412 
1418 
1419 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1420 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1421 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1422 
1423 #define FM_LOCK_BIT (0x1)
1424 #define FM_LOCK_BIT_V (0x0)
1425 #define FM_LOCK_WAITER_WOKEN (0x2)
1426 #define FM_LOCK_WAITER_INC (0x4)
1427 
1428 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1430 typedef BOOLEAN
1431 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1432  _In_ struct _FILE_OBJECT *FileObject,
1434  _In_ ULONG Length,
1435  _In_ BOOLEAN Wait,
1436  _In_ ULONG LockKey,
1439  _In_ struct _DEVICE_OBJECT *DeviceObject);
1440 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1441 
1442 _Function_class_(FAST_IO_READ)
1444 typedef BOOLEAN
1445 (NTAPI FAST_IO_READ)(
1446  _In_ struct _FILE_OBJECT *FileObject,
1448  _In_ ULONG Length,
1449  _In_ BOOLEAN Wait,
1450  _In_ ULONG LockKey,
1451  _Out_ PVOID Buffer,
1453  _In_ struct _DEVICE_OBJECT *DeviceObject);
1454 typedef FAST_IO_READ *PFAST_IO_READ;
1455 
1456 _Function_class_(FAST_IO_WRITE)
1458 typedef BOOLEAN
1459 (NTAPI FAST_IO_WRITE)(
1460  _In_ struct _FILE_OBJECT *FileObject,
1462  _In_ ULONG Length,
1463  _In_ BOOLEAN Wait,
1464  _In_ ULONG LockKey,
1465  _In_ PVOID Buffer,
1467  _In_ struct _DEVICE_OBJECT *DeviceObject);
1468 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1469 
1470 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1472 typedef BOOLEAN
1473 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1474  _In_ struct _FILE_OBJECT *FileObject,
1475  _In_ BOOLEAN Wait,
1478  _In_ struct _DEVICE_OBJECT *DeviceObject);
1479 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1480 
1481 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1483 typedef BOOLEAN
1484 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1485  _In_ struct _FILE_OBJECT *FileObject,
1486  _In_ BOOLEAN Wait,
1489  _In_ struct _DEVICE_OBJECT *DeviceObject);
1490 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1491 
1492 _Function_class_(FAST_IO_LOCK)
1494 typedef BOOLEAN
1495 (NTAPI FAST_IO_LOCK)(
1496  _In_ struct _FILE_OBJECT *FileObject,
1500  _In_ ULONG Key,
1504  _In_ struct _DEVICE_OBJECT *DeviceObject);
1505 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1506 
1507 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1509 typedef BOOLEAN
1510 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1511  _In_ struct _FILE_OBJECT *FileObject,
1515  _In_ ULONG Key,
1517  _In_ struct _DEVICE_OBJECT *DeviceObject);
1518 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1519 
1520 _Function_class_(FAST_IO_UNLOCK_ALL)
1522 typedef BOOLEAN
1523 (NTAPI FAST_IO_UNLOCK_ALL)(
1524  _In_ struct _FILE_OBJECT *FileObject,
1527  _In_ struct _DEVICE_OBJECT *DeviceObject);
1528 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1529 
1530 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1532 typedef BOOLEAN
1533 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1534  _In_ struct _FILE_OBJECT *FileObject,
1536  _In_ ULONG Key,
1538  _In_ struct _DEVICE_OBJECT *DeviceObject);
1539 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1540 
1541 _Function_class_(FAST_IO_DEVICE_CONTROL)
1543 typedef BOOLEAN
1544 (NTAPI FAST_IO_DEVICE_CONTROL)(
1545  _In_ struct _FILE_OBJECT *FileObject,
1553  _In_ struct _DEVICE_OBJECT *DeviceObject);
1554 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1555 
1556 _Function_class_(FAST_IO_ACQUIRE_FILE)
1558 typedef VOID
1559 (NTAPI FAST_IO_ACQUIRE_FILE)(
1560  _In_ struct _FILE_OBJECT *FileObject);
1561 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1562 
1563 _Function_class_(FAST_IO_RELEASE_FILE)
1565 typedef VOID
1566 (NTAPI FAST_IO_RELEASE_FILE)(
1567  _In_ struct _FILE_OBJECT *FileObject);
1568 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1569 
1570 _Function_class_(FAST_IO_DETACH_DEVICE)
1572 typedef VOID
1573 (NTAPI FAST_IO_DETACH_DEVICE)(
1576 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1577 
1578 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1580 typedef BOOLEAN
1581 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1582  _In_ struct _FILE_OBJECT *FileObject,
1583  _In_ BOOLEAN Wait,
1586  _In_ struct _DEVICE_OBJECT *DeviceObject);
1587 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1588 
1589 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1591 typedef NTSTATUS
1592 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1593  _In_ struct _FILE_OBJECT *FileObject,
1596  _In_ struct _DEVICE_OBJECT *DeviceObject);
1597 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1598 
1599 _Function_class_(FAST_IO_MDL_READ)
1601 typedef BOOLEAN
1602 (NTAPI FAST_IO_MDL_READ)(
1603  _In_ struct _FILE_OBJECT *FileObject,
1605  _In_ ULONG Length,
1606  _In_ ULONG LockKey,
1607  _Out_ PMDL *MdlChain,
1609  _In_ struct _DEVICE_OBJECT *DeviceObject);
1610 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1611 
1612 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1614 typedef BOOLEAN
1615 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1616  _In_ struct _FILE_OBJECT *FileObject,
1617  _In_ PMDL MdlChain,
1618  _In_ struct _DEVICE_OBJECT *DeviceObject);
1619 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1620 
1621 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1623 typedef BOOLEAN
1624 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1625  _In_ struct _FILE_OBJECT *FileObject,
1627  _In_ ULONG Length,
1628  _In_ ULONG LockKey,
1629  _Out_ PMDL *MdlChain,
1631  _In_ struct _DEVICE_OBJECT *DeviceObject);
1632 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1633 
1634 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1636 typedef BOOLEAN
1637 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1638  _In_ struct _FILE_OBJECT *FileObject,
1640  _In_ PMDL MdlChain,
1641  _In_ struct _DEVICE_OBJECT *DeviceObject);
1642 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1643 
1644 _Function_class_(FAST_IO_READ_COMPRESSED)
1646 typedef BOOLEAN
1647 (NTAPI FAST_IO_READ_COMPRESSED)(
1648  _In_ struct _FILE_OBJECT *FileObject,
1650  _In_ ULONG Length,
1651  _In_ ULONG LockKey,
1652  _Out_ PVOID Buffer,
1653  _Out_ PMDL *MdlChain,
1657  _In_ struct _DEVICE_OBJECT *DeviceObject);
1658 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1659 
1660 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1662 typedef BOOLEAN
1663 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1664  _In_ struct _FILE_OBJECT *FileObject,
1666  _In_ ULONG Length,
1667  _In_ ULONG LockKey,
1668  _In_ PVOID Buffer,
1669  _Out_ PMDL *MdlChain,
1673  _In_ struct _DEVICE_OBJECT *DeviceObject);
1674 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1675 
1676 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1678 typedef BOOLEAN
1679 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1680  _In_ struct _FILE_OBJECT *FileObject,
1681  _In_ PMDL MdlChain,
1682  _In_ struct _DEVICE_OBJECT *DeviceObject);
1683 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1684 
1685 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1687 typedef BOOLEAN
1688 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1689  _In_ struct _FILE_OBJECT *FileObject,
1691  _In_ PMDL MdlChain,
1692  _In_ struct _DEVICE_OBJECT *DeviceObject);
1693 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1694 
1695 _Function_class_(FAST_IO_QUERY_OPEN)
1697 typedef BOOLEAN
1698 (NTAPI FAST_IO_QUERY_OPEN)(
1699  _Inout_ struct _IRP *Irp,
1701  _In_ struct _DEVICE_OBJECT *DeviceObject);
1702 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1703 
1704 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1706 typedef NTSTATUS
1707 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1708  _In_ struct _FILE_OBJECT *FileObject,
1710  _In_ struct _DEVICE_OBJECT *DeviceObject);
1711 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1712 
1713 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1715 typedef NTSTATUS
1716 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1717  _In_ struct _FILE_OBJECT *FileObject,
1718  _In_ struct _DEVICE_OBJECT *DeviceObject);
1719 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1720 
1721 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1723 typedef NTSTATUS
1724 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1725  _In_ struct _FILE_OBJECT *FileObject,
1726  _In_ struct _DEVICE_OBJECT *DeviceObject);
1727 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1728 
1729 typedef struct _FAST_IO_DISPATCH {
1759 
1760 typedef struct _SECTION_OBJECT_POINTERS {
1761  PVOID DataSectionObject;
1762  PVOID SharedCacheMap;
1763  PVOID ImageSectionObject;
1765 
1766 typedef struct _IO_COMPLETION_CONTEXT {
1770 
1771 /* FILE_OBJECT.Flags */
1772 #define FO_FILE_OPEN 0x00000001
1773 #define FO_SYNCHRONOUS_IO 0x00000002
1774 #define FO_ALERTABLE_IO 0x00000004
1775 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1776 #define FO_WRITE_THROUGH 0x00000010
1777 #define FO_SEQUENTIAL_ONLY 0x00000020
1778 #define FO_CACHE_SUPPORTED 0x00000040
1779 #define FO_NAMED_PIPE 0x00000080
1780 #define FO_STREAM_FILE 0x00000100
1781 #define FO_MAILSLOT 0x00000200
1782 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1783 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1784 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1785 #define FO_FILE_MODIFIED 0x00001000
1786 #define FO_FILE_SIZE_CHANGED 0x00002000
1787 #define FO_CLEANUP_COMPLETE 0x00004000
1788 #define FO_TEMPORARY_FILE 0x00008000
1789 #define FO_DELETE_ON_CLOSE 0x00010000
1790 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1791 #define FO_HANDLE_CREATED 0x00040000
1792 #define FO_FILE_FAST_IO_READ 0x00080000
1793 #define FO_RANDOM_ACCESS 0x00100000
1794 #define FO_FILE_OPEN_CANCELLED 0x00200000
1795 #define FO_VOLUME_OPEN 0x00400000
1796 #define FO_REMOTE_ORIGIN 0x01000000
1797 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1798 #define FO_SKIP_COMPLETION_PORT 0x02000000
1799 #define FO_SKIP_SET_EVENT 0x04000000
1800 #define FO_SKIP_SET_FAST_IO 0x08000000
1801 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1802 
1803 /* VPB.Flags */
1804 #define VPB_MOUNTED 0x0001
1805 #define VPB_LOCKED 0x0002
1806 #define VPB_PERSISTENT 0x0004
1807 #define VPB_REMOVE_PENDING 0x0008
1808 #define VPB_RAW_MOUNT 0x0010
1809 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1810 
1811 /* IO_STACK_LOCATION.Flags */
1812 
1813 #define SL_FORCE_ACCESS_CHECK 0x01
1814 #define SL_OPEN_PAGING_FILE 0x02
1815 #define SL_OPEN_TARGET_DIRECTORY 0x04
1816 #define SL_STOP_ON_SYMLINK 0x08
1817 #define SL_CASE_SENSITIVE 0x80
1818 
1819 #define SL_KEY_SPECIFIED 0x01
1820 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1821 #define SL_WRITE_THROUGH 0x04
1822 #define SL_FT_SEQUENTIAL_WRITE 0x08
1823 #define SL_FORCE_DIRECT_WRITE 0x10
1824 #define SL_REALTIME_STREAM 0x20
1825 
1826 #define SL_READ_ACCESS_GRANTED 0x01
1827 #define SL_WRITE_ACCESS_GRANTED 0x04
1828 
1829 #define SL_FAIL_IMMEDIATELY 0x01
1830 #define SL_EXCLUSIVE_LOCK 0x02
1831 
1832 #define SL_RESTART_SCAN 0x01
1833 #define SL_RETURN_SINGLE_ENTRY 0x02
1834 #define SL_INDEX_SPECIFIED 0x04
1835 
1836 #define SL_WATCH_TREE 0x01
1837 
1838 #define SL_ALLOW_RAW_MOUNT 0x01
1839 
1840 $endif (_WDMDDK_)
1841 $if (_WDMDDK_ || _DEVIOCTL_)
1842 #define CTL_CODE(DeviceType, Function, Method, Access) \
1843  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1844 
1845 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1846 
1847 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1848 
1850 $if (_WDMDDK_)
1851 
1852 /* IRP.Flags */
1853 #define IRP_NOCACHE 0x00000001
1854 #define IRP_PAGING_IO 0x00000002
1855 #define IRP_MOUNT_COMPLETION 0x00000002
1856 #define IRP_SYNCHRONOUS_API 0x00000004
1857 #define IRP_ASSOCIATED_IRP 0x00000008
1858 #define IRP_BUFFERED_IO 0x00000010
1859 #define IRP_DEALLOCATE_BUFFER 0x00000020
1860 #define IRP_INPUT_OPERATION 0x00000040
1861 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1862 #define IRP_CREATE_OPERATION 0x00000080
1863 #define IRP_READ_OPERATION 0x00000100
1864 #define IRP_WRITE_OPERATION 0x00000200
1865 #define IRP_CLOSE_OPERATION 0x00000400
1866 #define IRP_DEFER_IO_COMPLETION 0x00000800
1867 #define IRP_OB_QUERY_NAME 0x00001000
1868 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1869 /* The following 2 are missing in latest WDK */
1870 #define IRP_RETRY_IO_COMPLETION 0x00004000
1871 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1872 
1873 /* IRP.AllocationFlags */
1874 #define IRP_QUOTA_CHARGED 0x01
1875 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1876 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1877 #define IRP_LOOKASIDE_ALLOCATION 0x08
1878 
1879 /*
1880 ** IRP function codes
1881 */
1882 
1883 #define IRP_MJ_CREATE 0x00
1884 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1885 #define IRP_MJ_CLOSE 0x02
1886 #define IRP_MJ_READ 0x03
1887 #define IRP_MJ_WRITE 0x04
1888 #define IRP_MJ_QUERY_INFORMATION 0x05
1889 #define IRP_MJ_SET_INFORMATION 0x06
1890 #define IRP_MJ_QUERY_EA 0x07
1891 #define IRP_MJ_SET_EA 0x08
1892 #define IRP_MJ_FLUSH_BUFFERS 0x09
1893 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1894 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1895 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1896 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1897 #define IRP_MJ_DEVICE_CONTROL 0x0e
1898 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1899 #define IRP_MJ_SCSI 0x0f
1900 #define IRP_MJ_SHUTDOWN 0x10
1901 #define IRP_MJ_LOCK_CONTROL 0x11
1902 #define IRP_MJ_CLEANUP 0x12
1903 #define IRP_MJ_CREATE_MAILSLOT 0x13
1904 #define IRP_MJ_QUERY_SECURITY 0x14
1905 #define IRP_MJ_SET_SECURITY 0x15
1906 #define IRP_MJ_POWER 0x16
1907 #define IRP_MJ_SYSTEM_CONTROL 0x17
1908 #define IRP_MJ_DEVICE_CHANGE 0x18
1909 #define IRP_MJ_QUERY_QUOTA 0x19
1910 #define IRP_MJ_SET_QUOTA 0x1a
1911 #define IRP_MJ_PNP 0x1b
1912 #define IRP_MJ_PNP_POWER 0x1b
1913 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1914 
1915 #define IRP_MN_SCSI_CLASS 0x01
1916 
1917 #define IRP_MN_START_DEVICE 0x00
1918 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1919 #define IRP_MN_REMOVE_DEVICE 0x02
1920 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1921 #define IRP_MN_STOP_DEVICE 0x04
1922 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1923 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1924 
1925 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1926 #define IRP_MN_QUERY_INTERFACE 0x08
1927 #define IRP_MN_QUERY_CAPABILITIES 0x09
1928 #define IRP_MN_QUERY_RESOURCES 0x0A
1929 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1930 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1931 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1932 
1933 #define IRP_MN_READ_CONFIG 0x0F
1934 #define IRP_MN_WRITE_CONFIG 0x10
1935 #define IRP_MN_EJECT 0x11
1936 #define IRP_MN_SET_LOCK 0x12
1937 #define IRP_MN_QUERY_ID 0x13
1938 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1939 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1940 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1941 #define IRP_MN_SURPRISE_REMOVAL 0x17
1942 #if (NTDDI_VERSION >= NTDDI_WIN7)
1943 #define IRP_MN_DEVICE_ENUMERATED 0x19
1944 #endif
1945 
1946 #define IRP_MN_WAIT_WAKE 0x00
1947 #define IRP_MN_POWER_SEQUENCE 0x01
1948 #define IRP_MN_SET_POWER 0x02
1949 #define IRP_MN_QUERY_POWER 0x03
1950 
1951 #define IRP_MN_QUERY_ALL_DATA 0x00
1952 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1953 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1954 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1955 #define IRP_MN_ENABLE_EVENTS 0x04
1956 #define IRP_MN_DISABLE_EVENTS 0x05
1957 #define IRP_MN_ENABLE_COLLECTION 0x06
1958 #define IRP_MN_DISABLE_COLLECTION 0x07
1959 #define IRP_MN_REGINFO 0x08
1960 #define IRP_MN_EXECUTE_METHOD 0x09
1961 
1962 #define IRP_MN_REGINFO_EX 0x0b
1963 
1964 typedef struct _FILE_OBJECT {
1965  CSHORT Type;
1966  CSHORT Size;
1968  PVPB Vpb;
1969  PVOID FsContext;
1970  PVOID FsContext2;
1972  PVOID PrivateCacheMap;
1973  NTSTATUS FinalStatus;
1974  struct _FILE_OBJECT *RelatedFileObject;
1975  BOOLEAN LockOperation;
1976  BOOLEAN DeletePending;
1979  BOOLEAN DeleteAccess;
1980  BOOLEAN SharedRead;
1981  BOOLEAN SharedWrite;
1982  BOOLEAN SharedDelete;
1983  ULONG Flags;
1985  LARGE_INTEGER CurrentByteOffset;
1986  volatile ULONG Waiters;
1987  volatile ULONG Busy;
1988  PVOID LastLock;
1989  KEVENT Lock;
1990  KEVENT Event;
1992  KSPIN_LOCK IrpListLock;
1993  LIST_ENTRY IrpList;
1994  volatile PVOID FileObjectExtension;
1996 
1997 typedef struct _IO_ERROR_LOG_PACKET {
2012 
2013 typedef struct _IO_ERROR_LOG_MESSAGE {
2021 
2022 /* See ndk/lpctypes.h */
2023 #ifdef _WIN64
2024 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
2025 #else
2026 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
2027 #endif
2028 
2029 #define ERROR_LOG_LIMIT_SIZE 240
2030 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
2031  sizeof(IO_ERROR_LOG_PACKET) + \
2032  (sizeof(WCHAR) * 40))
2033 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
2034  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2035 #define IO_ERROR_LOG_MESSAGE_LENGTH \
2036  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
2037  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
2038  PORT_MAXIMUM_MESSAGE_LENGTH)
2039 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
2040  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2041 
2042 typedef enum _DMA_WIDTH {
2047 } DMA_WIDTH, *PDMA_WIDTH;
2048 
2049 typedef enum _DMA_SPEED {
2056 } DMA_SPEED, *PDMA_SPEED;
2057 
2058 /* DEVICE_DESCRIPTION.Version */
2059 
2060 #define DEVICE_DESCRIPTION_VERSION 0x0000
2061 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2062 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2063 #define DEVICE_DESCRIPTION_VERSION3 0x0003
2064 
2065 typedef struct _DEVICE_DESCRIPTION {
2082 #if (NTDDI_VERSION >= NTDDI_WIN8)
2087 #endif // NTDDI_WIN8
2089 
2090 #define DMA_ADAPTER_INFO_VERSION1 1
2091 
2092 #define ADAPTER_INFO_SYNCHRONOUS_CALLBACK 0x0001
2093 #define ADAPTER_INFO_API_BYPASS 0x0002
2094 
2095 typedef struct _DMA_ADAPTER_INFO_V1
2096 {
2103 
2104 typedef struct _DMA_ADAPTER_INFO
2105 {
2107  union
2108  {
2110  };
2112 
2113 #define DMA_TRANSFER_INFO_VERSION1 1
2114 #define DMA_TRANSFER_INFO_VERSION2 2
2115 
2117 {
2122 
2124 {
2130 
2131 typedef struct _DMA_TRANSFER_INFO
2132 {
2134  union {
2137  };
2139 
2140 #define DMA_TRANSFER_CONTEXT_VERSION1 1
2141 
2142 #ifdef _WIN64
2143 #define DMA_TRANSFER_CONTEXT_SIZE_V1 128
2144 #else
2145 #define DMA_TRANSFER_CONTEXT_SIZE_V1 64
2146 #endif
2147 
2157 
2158 typedef struct _DEVICE_RELATIONS {
2160  PDEVICE_OBJECT Objects[1];
2162 
2163 typedef struct _DEVOBJ_EXTENSION {
2168 
2169 typedef struct _SCATTER_GATHER_ELEMENT {
2174 
2175 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2176 
2177 #if defined(_MSC_VER)
2178 #if _MSC_VER >= 1200
2179 #pragma warning(push)
2180 #endif
2181 #pragma warning(disable:4200)
2182 #endif /* _MSC_VER */
2183 
2184 typedef struct _SCATTER_GATHER_LIST {
2185  ULONG NumberOfElements;
2187  SCATTER_GATHER_ELEMENT Elements[1];
2189 
2190 #if defined(_MSC_VER)
2191 #if _MSC_VER >= 1200
2192 #pragma warning(pop)
2193 #else
2194 #pragma warning(default:4200)
2195 #endif
2196 #endif /* _MSC_VER */
2197 
2198 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2199 
2200 struct _SCATTER_GATHER_LIST;
2201 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2202 
2203 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2204 
2205 _Function_class_(DRIVER_ADD_DEVICE)
2208 _When_(return>=0, _Kernel_clear_do_init_(__yes))
2209 typedef NTSTATUS
2210 (NTAPI DRIVER_ADD_DEVICE)(
2213 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2214 
2215 typedef struct _DRIVER_EXTENSION {
2221 
2222 #define DRVO_UNLOAD_INVOKED 0x00000001
2223 #define DRVO_LEGACY_DRIVER 0x00000002
2224 #define DRVO_BUILTIN_DRIVER 0x00000004
2225 
2226 _Function_class_(DRIVER_INITIALIZE)
2228 typedef NTSTATUS
2229 (NTAPI DRIVER_INITIALIZE)(
2232 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2233 
2234 _Function_class_(DRIVER_STARTIO)
2238 typedef VOID
2239 (NTAPI DRIVER_STARTIO)(
2241  _Inout_ struct _IRP *Irp);
2242 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2243 
2244 _Function_class_(DRIVER_UNLOAD)
2247 typedef VOID
2248 (NTAPI DRIVER_UNLOAD)(
2249  _In_ struct _DRIVER_OBJECT *DriverObject);
2250 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2251 
2255 typedef NTSTATUS
2258  _Inout_ struct _IRP *Irp);
2261 
2265 typedef NTSTATUS
2266 (NTAPI DRIVER_DISPATCH_PAGED)(
2268  _Inout_ struct _IRP *Irp);
2269 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2270 
2271 typedef struct _DRIVER_OBJECT {
2288 
2289 typedef struct _DMA_ADAPTER {
2294 
2295 typedef enum
2296 {
2302 
2303 typedef VOID
2305  PDMA_ADAPTER DmaAdapter);
2306 
2307 typedef PVOID
2309  _In_ PDMA_ADAPTER DmaAdapter,
2310  _In_ ULONG Length,
2311  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2312  _In_ BOOLEAN CacheEnabled);
2313 
2314 typedef VOID
2316  _In_ PDMA_ADAPTER DmaAdapter,
2317  _In_ ULONG Length,
2318  _In_ PHYSICAL_ADDRESS LogicalAddress,
2320  _In_ BOOLEAN CacheEnabled);
2321 
2322 typedef NTSTATUS
2324  _In_ PDMA_ADAPTER DmaAdapter,
2328  _In_ PVOID Context);
2329 
2330 typedef BOOLEAN
2332  _In_ PDMA_ADAPTER DmaAdapter,
2333  _In_ PMDL Mdl,
2335  _In_ PVOID CurrentVa,
2336  _In_ ULONG Length,
2338 
2339 typedef VOID
2341  _In_ PDMA_ADAPTER DmaAdapter);
2342 
2343 typedef VOID
2345  _In_ PDMA_ADAPTER DmaAdapter,
2348 
2349 typedef PHYSICAL_ADDRESS
2351  _In_ PDMA_ADAPTER DmaAdapter,
2352  _In_ PMDL Mdl,
2354  _In_ PVOID CurrentVa,
2357 
2358 typedef ULONG
2360  _In_ PDMA_ADAPTER DmaAdapter);
2361 
2362 typedef ULONG
2364  _In_ PDMA_ADAPTER DmaAdapter);
2365 
2366 _Function_class_(DRIVER_LIST_CONTROL)
2368 typedef VOID
2369 (NTAPI DRIVER_LIST_CONTROL)(
2371  _In_ struct _IRP *Irp,
2372  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2373  _In_ PVOID Context);
2374 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2375 
2376 typedef NTSTATUS
2378  _In_ PDMA_ADAPTER DmaAdapter,
2380  _In_ PMDL Mdl,
2381  _In_ PVOID CurrentVa,
2382  _In_ ULONG Length,
2384  _In_ PVOID Context,
2386 
2387 typedef VOID
2389  _In_ PDMA_ADAPTER DmaAdapter,
2392 
2393 typedef NTSTATUS
2395  _In_ PDMA_ADAPTER DmaAdapter,
2397  _In_ PVOID CurrentVa,
2398  _In_ ULONG Length,
2399  _Out_ PULONG ScatterGatherListSize,
2400  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2401 
2402 typedef NTSTATUS
2404  _In_ PDMA_ADAPTER DmaAdapter,
2406  _In_ PMDL Mdl,
2407  _In_ PVOID CurrentVa,
2408  _In_ ULONG Length,
2410  _In_ PVOID Context,
2412  _In_ PVOID ScatterGatherBuffer,
2413  _In_ ULONG ScatterGatherLength);
2414 
2415 typedef NTSTATUS
2417  _In_ PDMA_ADAPTER DmaAdapter,
2419  _In_ PMDL OriginalMdl,
2420  _Out_ PMDL *TargetMdl);
2421 
2422 typedef NTSTATUS
2424  _In_ PDMA_ADAPTER DmaAdapter,
2425  _Inout_ PDMA_ADAPTER_INFO AdapterInfo);
2426 
2427 typedef NTSTATUS
2429  _In_ PDMA_ADAPTER DmaAdapter,
2430  _In_ PMDL Mdl,
2432  _In_ ULONG Length,
2433  _In_ BOOLEAN WriteOnly,
2434  _Inout_ PDMA_TRANSFER_INFO TransferInfo);
2435 
2436 typedef NTSTATUS
2438  _In_ PDMA_ADAPTER DmaAdapter,
2439  _Out_ PVOID DmaTransferContext);
2440 
2441 typedef PVOID
2443  _In_ PDMA_ADAPTER DmaAdapter,
2444  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2445  _In_ ULONG Length,
2446  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2447  _In_ BOOLEAN CacheEnabled,
2448  _In_ NODE_REQUIREMENT PreferredNode);
2449 
2450 typedef NTSTATUS
2452  _In_ PDMA_ADAPTER DmaAdapter,
2454  _In_ PVOID DmaTransferContext,
2456  _In_ ULONG Flags,
2458  _In_opt_ PVOID ExecutionContext,
2460 
2461 typedef NTSTATUS
2463  _In_ PDMA_ADAPTER DmaAdapter,
2464  _In_ ULONG FunctionNumber,
2465  _In_ PVOID Context);
2466 
2467 typedef BOOLEAN
2469  _In_ PDMA_ADAPTER DmaAdapter,
2471  _In_ PVOID DmaTransferContext);
2472 
2473 typedef
2474 _Function_class_(DMA_COMPLETION_ROUTINE)
2477 VOID
2478 NTAPI
2479 DMA_COMPLETION_ROUTINE(
2480  _In_ PDMA_ADAPTER DmaAdapter,
2484 
2485 typedef DMA_COMPLETION_ROUTINE *PDMA_COMPLETION_ROUTINE;
2486 
2487 typedef NTSTATUS
2489  _In_ PDMA_ADAPTER DmaAdapter,
2490  _In_ PMDL Mdl,
2496  _Out_writes_bytes_opt_(ScatterGatherBufferLength) PSCATTER_GATHER_LIST ScatterGatherBuffer,
2497  _In_ ULONG ScatterGatherBufferLength,
2500 
2501 typedef NTSTATUS
2503  _In_ PDMA_ADAPTER DmaAdapter,
2505  _In_ PVOID DmaTransferContext,
2506  _In_ PMDL Mdl,
2508  _In_ ULONG Length,
2509  _In_ ULONG Flags,
2515  _Out_opt_ PSCATTER_GATHER_LIST *ScatterGatherList);
2516 
2517 typedef NTSTATUS
2519  _In_ PDMA_ADAPTER DmaAdapter,
2521  _In_ PVOID DmaTransferContext,
2522  _In_ PMDL Mdl,
2524  _In_ ULONG Length,
2525  _In_ ULONG Flags,
2529  _In_ PVOID ScatterGatherBuffer,
2530  _In_ ULONG ScatterGatherLength,
2533  _Out_opt_ PVOID ScatterGatherList);
2534 
2535 typedef NTSTATUS
2537  _In_ PDMA_ADAPTER DmaAdapter,
2538  _In_ PMDL Mdl,
2541  _In_ ULONG Length,
2543 
2544 typedef VOID
2546  _In_ PDMA_ADAPTER DmaAdapter,
2547  _In_ IO_ALLOCATION_ACTION AllocationAction);
2548 
2549 typedef NTSTATUS
2551  _In_ PDMA_ADAPTER DmaAdapter,
2552  _In_ PVOID DmaTransferContext);
2553 
2554 typedef NTSTATUS
2556  _In_ PDMA_ADAPTER DmaAdapter,
2557  _In_ HANDLE DomainHandle,
2558  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2559  _In_ ULONG Length,
2560  _In_ ULONG Flags,
2562  _In_ NODE_REQUIREMENT PreferredNode,
2563  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2565 
2566 typedef NTSTATUS
2568  _In_ PDMA_ADAPTER DmaAdapter,
2569  _In_ PMDL Mdl,
2570  _In_ BOOLEAN ReadOperation);
2571 
2572 typedef NTSTATUS
2574  _In_ PDMA_ADAPTER DmaAdapter,
2575  _In_ HANDLE DomainHandle);
2576 
2577 typedef NTSTATUS
2579  _In_ PDMA_ADAPTER DmaAdapter);
2580 
2581 typedef HANDLE
2583  _In_ PDMA_ADAPTER DmaAdapter);
2584 
2585 typedef PVOID
2587  _In_ PDMA_ADAPTER DmaAdapter,
2588  _In_opt_ PPHYSICAL_ADDRESS MinimumAddress,
2589  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2590  _In_ ULONG Length,
2591  _In_ ULONG Flags,
2593  _In_ NODE_REQUIREMENT PreferredNode,
2594  _Out_ PPHYSICAL_ADDRESS LogicalAddress);
2595 
2596 typedef struct _DMA_COMMON_BUFFER_VECTOR DMA_COMMON_BUFFER_VECTOR, *PDMA_COMMON_BUFFER_VECTOR;
2597 
2598 typedef NTSTATUS
2600  _In_ PDMA_ADAPTER DmaAdapter,
2601  _In_ PHYSICAL_ADDRESS LowAddress,
2604  _In_ ULONG IdealNode,
2605  _In_ ULONG Flags,
2606  _In_ ULONG NumberOfElements,
2607  _In_ ULONGLONG SizeOfElements,
2608  _Out_ PDMA_COMMON_BUFFER_VECTOR *VectorOut);
2609 
2610 typedef VOID
2612  _In_ PDMA_ADAPTER DmaAdapter,
2614  _In_ ULONG Index,
2615  _Out_ PVOID *VirtualAddressOut,
2616  _Out_ PPHYSICAL_ADDRESS LogicalAddressOut);
2617 
2618 typedef VOID
2620  _In_ PDMA_ADAPTER DmaAdapter,
2622  _In_ ULONG Index);
2623 
2624 typedef VOID
2626  _In_ PDMA_ADAPTER DmaAdapter,
2628 
2629 typedef struct _DMA_OPERATIONS {
2670 
2671 typedef struct _IO_RESOURCE_DESCRIPTOR {
2672  UCHAR Option;
2673  UCHAR Type;
2674  UCHAR ShareDisposition;
2675  UCHAR Spare1;
2676  USHORT Flags;
2677  USHORT Spare2;
2678  union {
2679  struct {
2680  ULONG Length;
2681  ULONG Alignment;
2682  PHYSICAL_ADDRESS MinimumAddress;
2683  PHYSICAL_ADDRESS MaximumAddress;
2684  } Port;
2685  struct {
2686  ULONG Length;
2687  ULONG Alignment;
2688  PHYSICAL_ADDRESS MinimumAddress;
2689  PHYSICAL_ADDRESS MaximumAddress;
2690  } Memory;
2691  struct {
2692  ULONG MinimumVector;
2693  ULONG MaximumVector;
2694 #if defined(NT_PROCESSOR_GROUPS)
2695  IRQ_DEVICE_POLICY AffinityPolicy;
2696  USHORT Group;
2697 #else
2698  IRQ_DEVICE_POLICY AffinityPolicy;
2699 #endif
2700  IRQ_PRIORITY PriorityPolicy;
2701  KAFFINITY TargetedProcessors;
2702  } Interrupt;
2703  struct {
2704  ULONG MinimumChannel;
2705  ULONG MaximumChannel;
2706  } Dma;
2707  struct {
2708  ULONG Length;
2709  ULONG Alignment;
2710  PHYSICAL_ADDRESS MinimumAddress;
2711  PHYSICAL_ADDRESS MaximumAddress;
2712  } Generic;
2713  struct {
2714  ULONG Data[3];
2715  } DevicePrivate;
2716  struct {
2717  ULONG Length;
2718  ULONG MinBusNumber;
2719  ULONG MaxBusNumber;
2720  ULONG Reserved;
2721  } BusNumber;
2722  struct {
2723  ULONG Priority;
2724  ULONG Reserved1;
2725  ULONG Reserved2;
2726  } ConfigData;
2727  } u;
2729 
2730 typedef struct _IO_RESOURCE_LIST {
2731  USHORT Version;
2732  USHORT Revision;
2733  ULONG Count;
2734  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2736 
2737 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
2738  ULONG ListSize;
2740  ULONG BusNumber;
2741  ULONG SlotNumber;
2742  ULONG Reserved[3];
2743  ULONG AlternativeLists;
2746 
2747 _Function_class_(DRIVER_CANCEL)
2748 _Requires_lock_held_(_Global_cancel_spin_lock_)
2749 _Releases_lock_(_Global_cancel_spin_lock_)
2752 typedef VOID
2753 (NTAPI DRIVER_CANCEL)(
2756 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2757 
2758 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
2759  CSHORT Type;
2760  USHORT Size;
2761  struct _MDL *MdlAddress;
2762  ULONG Flags;
2763  union {
2764  struct _IRP *MasterIrp;
2765  volatile LONG IrpCount;
2766  PVOID SystemBuffer;
2767  } AssociatedIrp;
2768  LIST_ENTRY ThreadListEntry;
2770  KPROCESSOR_MODE RequestorMode;
2771  BOOLEAN PendingReturned;
2772  CHAR StackCount;
2773  CHAR CurrentLocation;
2774  BOOLEAN Cancel;
2775  KIRQL CancelIrql;
2776  CCHAR ApcEnvironment;
2777  UCHAR AllocationFlags;
2778  PIO_STATUS_BLOCK UserIosb;
2779  PKEVENT UserEvent;
2780  union {
2781  struct {
2782  _ANONYMOUS_UNION union {
2783  PIO_APC_ROUTINE UserApcRoutine;
2784  PVOID IssuingProcess;
2785  } DUMMYUNIONNAME;
2786  PVOID UserApcContext;
2787  } AsynchronousParameters;
2789  } Overlay;
2790  volatile PDRIVER_CANCEL CancelRoutine;
2791  PVOID UserBuffer;
2792  union {
2793  struct {
2794  _ANONYMOUS_UNION union {
2796  _ANONYMOUS_STRUCT struct {
2797  PVOID DriverContext[4];
2798  } DUMMYSTRUCTNAME;
2799  } DUMMYUNIONNAME;
2800  PETHREAD Thread;
2801  PCHAR AuxiliaryBuffer;
2802  _ANONYMOUS_STRUCT struct {
2803  LIST_ENTRY ListEntry;
2804  _ANONYMOUS_UNION union {
2805  struct _IO_STACK_LOCATION *CurrentStackLocation;
2806  ULONG PacketType;
2807  } DUMMYUNIONNAME;
2808  } DUMMYSTRUCTNAME;
2809  struct _FILE_OBJECT *OriginalFileObject;
2810  } Overlay;
2811  KAPC Apc;
2812  PVOID CompletionKey;
2813  } Tail;
2814 } IRP, *PIRP;
2815 
2816 typedef enum _IO_PAGING_PRIORITY {
2823 
2824 _Function_class_(IO_COMPLETION_ROUTINE)
2826 typedef NTSTATUS
2827 (NTAPI IO_COMPLETION_ROUTINE)(
2829  _In_ struct _IRP *Irp,
2831 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2832 
2833 _Function_class_(IO_DPC_ROUTINE)
2837 typedef VOID
2838 (NTAPI IO_DPC_ROUTINE)(
2839  _In_ struct _KDPC *Dpc,
2841  _Inout_ struct _IRP *Irp,
2843 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2844 
2845 typedef NTSTATUS
2848 
2849 typedef NTSTATUS
2851  VOID);
2852 
2853 _Function_class_(IO_TIMER_ROUTINE)
2855 typedef VOID
2856 (NTAPI IO_TIMER_ROUTINE)(
2859 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2860 
2861 typedef struct _IO_SECURITY_CONTEXT {
2867 
2868 struct _IO_CSQ;
2869 
2870 typedef struct _IO_CSQ_IRP_CONTEXT {
2871  ULONG Type;
2872  struct _IRP *Irp;
2873  struct _IO_CSQ *Csq;
2875 
2876 typedef VOID
2877 (NTAPI IO_CSQ_INSERT_IRP)(
2878  _In_ struct _IO_CSQ *Csq,
2880 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2881 
2882 typedef NTSTATUS
2883 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2884  _In_ struct _IO_CSQ *Csq,
2887 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2888 
2889 typedef VOID
2890 (NTAPI IO_CSQ_REMOVE_IRP)(
2891  _In_ struct _IO_CSQ *Csq,
2892  _In_ PIRP Irp);
2893 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2894 
2895 typedef PIRP
2896 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2897  _In_ struct _IO_CSQ *Csq,
2900 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2901 
2902 typedef VOID
2903 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2904  _In_ struct _IO_CSQ *Csq,
2906 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2907 
2908 typedef VOID
2909 (NTAPI IO_CSQ_RELEASE_LOCK)(
2910  _In_ struct _IO_CSQ *Csq,
2911  _In_ KIRQL Irql);
2912 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2913 
2914 typedef VOID
2915 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2916  _In_ struct _IO_CSQ *Csq,
2917  _In_ PIRP Irp);
2918 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2919 
2920 typedef struct _IO_CSQ {
2921  ULONG Type;
2928  PVOID ReservePointer;
2929 } IO_CSQ, *PIO_CSQ;
2930 
2931 typedef enum _BUS_QUERY_ID_TYPE {
2939 
2940 typedef enum _DEVICE_TEXT_TYPE {
2944 
2945 typedef BOOLEAN
2947  PVOID,
2948  PVOID);
2949 
2952 typedef NTSTATUS
2953 (NTAPI *PGPE_CONNECT_VECTOR)(
2957  BOOLEAN,
2959  PVOID,
2960  PVOID);
2961 
2964 typedef NTSTATUS
2965 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2966  PVOID);
2967 
2970 typedef NTSTATUS
2971 (NTAPI *PGPE_ENABLE_EVENT)(
2973  PVOID);
2974 
2977 typedef NTSTATUS
2978 (NTAPI *PGPE_DISABLE_EVENT)(
2980  PVOID);
2981 
2984 typedef NTSTATUS
2985 (NTAPI *PGPE_CLEAR_STATUS)(
2987  PVOID);
2988 
2989 typedef VOID
2991  PVOID,
2992  ULONG);
2993 
2996 typedef NTSTATUS
2997 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3000  PVOID);
3001 
3003 typedef VOID
3004 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3007 
3014  PGPE_CONNECT_VECTOR GpeConnectVector;
3015  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
3016  PGPE_ENABLE_EVENT GpeEnableEvent;
3017  PGPE_DISABLE_EVENT GpeDisableEvent;
3018  PGPE_CLEAR_STATUS GpeClearStatus;
3019  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
3020  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
3022 
3023 typedef BOOLEAN
3027 
3030 typedef NTSTATUS
3031 (NTAPI *PGPE_CONNECT_VECTOR2)(
3032  PVOID Context,
3038  PVOID *ObjectContext);
3039 
3042 typedef NTSTATUS
3043 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
3044  PVOID Context,
3046 
3049 typedef NTSTATUS
3050 (NTAPI *PGPE_ENABLE_EVENT2)(
3051  PVOID Context,
3053 
3056 typedef NTSTATUS
3057 (NTAPI *PGPE_DISABLE_EVENT2)(
3058  PVOID Context,
3060 
3063 typedef NTSTATUS
3064 (NTAPI *PGPE_CLEAR_STATUS2)(
3065  PVOID Context,
3067 
3069 typedef VOID
3070 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
3073 
3076 typedef NTSTATUS
3077 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3078  PVOID Context,
3079  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
3081 
3083 typedef VOID
3084 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3085  PVOID Context);
3086 
3093  PGPE_CONNECT_VECTOR2 GpeConnectVector;
3094  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
3095  PGPE_ENABLE_EVENT2 GpeEnableEvent;
3096  PGPE_DISABLE_EVENT2 GpeDisableEvent;
3097  PGPE_CLEAR_STATUS2 GpeClearStatus;
3098  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
3099  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
3101 
3102 #if !defined(_AMD64_) && !defined(_ARM_)
3103 #include <pshpack4.h>
3104 #endif
3105 
3106 typedef struct _IO_STACK_LOCATION {
3111  union {
3112  struct {
3118  } Create;
3119  struct {
3121  ULONG Options;
3125  } CreatePipe;
3126  struct {
3127  PIO_SECURITY_CONTEXT SecurityContext;
3128  ULONG Options;
3132  } CreateMailslot;
3133  struct {
3137  } Read;
3138  struct {
3139  ULONG Length;
3142  } Write;
3143  struct {
3144  ULONG Length;
3148  } QueryDirectory;
3149  struct {
3150  ULONG Length;
3152  } NotifyDirectory;
3153  struct {
3154  ULONG Length;
3157  } NotifyDirectoryEx;
3158  struct {
3159  ULONG Length;
3161  } QueryFile;
3162  struct {
3163  ULONG Length;
3166  _ANONYMOUS_UNION union {
3167  _ANONYMOUS_STRUCT struct {
3170  } DUMMYSTRUCTNAME;
3173  } DUMMYUNIONNAME;
3174  } SetFile;
3175  struct {
3176  ULONG Length;
3180  } QueryEa;
3181  struct {
3182  ULONG Length;
3183  } SetEa;
3184  struct {
3185  ULONG Length;
3187  } QueryVolume;
3188  struct {
3189  ULONG Length;
3191  } SetVolume;
3192  struct {
3197  } FileSystemControl;
3198  struct {
3202  } LockControl;
3203  struct {
3207  PVOID Type3InputBuffer;
3208  } DeviceIoControl;
3209  struct {
3212  } QuerySecurity;
3213  struct {
3216  } SetSecurity;
3217  struct {
3220  } MountVolume;
3221  struct {
3222  PVPB Vpb;
3224  } VerifyVolume;
3225  struct {
3227  } Scsi;
3228  struct {
3229  ULONG Length;
3233  } QueryQuota;
3234  struct {
3235  ULONG Length;
3236  } SetQuota;
3237  struct {
3239  } QueryDeviceRelations;
3240  struct {
3246  } QueryInterface;
3247  struct {
3250  struct {
3252  } FilterResourceRequirements;
3253  struct {
3258  } ReadWriteConfig;
3259  struct {
3261  } SetLock;
3262  struct {
3264  } QueryId;
3265  struct {
3268  } QueryDeviceText;
3269  struct {
3273  } UsageNotification;
3274  struct {
3276  } WaitWake;
3277  struct {
3279  } PowerSequence;
3280  struct {
3281  union {
3283 #if (NTDDI_VERSION >= NTDDI_VISTA)
3285 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
3286  };
3290  } Power;
3291  struct {
3294  } StartDevice;
3295  struct {
3299  PVOID Buffer;
3300  } WMI;
3301  struct {
3306  } Others;
3307  } Parameters;
3313 
3314 #if !defined(_AMD64_) && !defined(_ARM_)
3315 #include "poppack.h"
3316 #endif
3317 
3318 
3319 /* IO_STACK_LOCATION.Control */
3320 
3321 #define SL_PENDING_RETURNED 0x01
3322 #define SL_ERROR_RETURNED 0x02
3323 #define SL_INVOKE_ON_CANCEL 0x20
3324 #define SL_INVOKE_ON_SUCCESS 0x40
3325 #define SL_INVOKE_ON_ERROR 0x80
3326 
3327 $endif (_WDMDDK_)
3328 $if (_WDMDDK_ || _DEVIOCTL_)
3329 #define METHOD_BUFFERED 0
3330 #define METHOD_IN_DIRECT 1
3331 #define METHOD_OUT_DIRECT 2
3332 #define METHOD_NEITHER 3
3333 
3334 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
3335 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
3336 
3338 $if (_WDMDDK_)
3339 #define FILE_SUPERSEDED 0x00000000
3340 #define FILE_OPENED 0x00000001
3341 #define FILE_CREATED 0x00000002
3342 #define FILE_OVERWRITTEN 0x00000003
3343 #define FILE_EXISTS 0x00000004
3344 #define FILE_DOES_NOT_EXIST 0x00000005
3345 
3346 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
3347 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
3348 
3349 /* also in winnt.h */
3350 #define FILE_LIST_DIRECTORY 0x00000001
3351 #define FILE_READ_DATA 0x00000001
3352 #define FILE_ADD_FILE 0x00000002
3353 #define FILE_WRITE_DATA 0x00000002
3354 #define FILE_ADD_SUBDIRECTORY 0x00000004
3355 #define FILE_APPEND_DATA 0x00000004
3356 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3357 #define FILE_READ_EA 0x00000008
3358 #define FILE_WRITE_EA 0x00000010
3359 #define FILE_EXECUTE 0x00000020
3360 #define FILE_TRAVERSE 0x00000020
3361 #define FILE_DELETE_CHILD 0x00000040
3362 #define FILE_READ_ATTRIBUTES 0x00000080
3363 #define FILE_WRITE_ATTRIBUTES 0x00000100
3364 
3365 #define FILE_SHARE_READ 0x00000001
3366 #define FILE_SHARE_WRITE 0x00000002
3367 #define FILE_SHARE_DELETE 0x00000004
3368 #define FILE_SHARE_VALID_FLAGS 0x00000007
3369 
3370 #define FILE_ATTRIBUTE_READONLY 0x00000001
3371 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3372 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3373 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3374 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3375 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3376 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3377 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3378 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3379 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3380 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3381 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3382 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3383 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3384 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3385 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3386 
3387 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3388 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3389 
3390 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3391 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3392 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3393 #define FILE_VALID_SET_FLAGS 0x00000036
3394 
3395 #define FILE_SUPERSEDE 0x00000000
3396 #define FILE_OPEN 0x00000001
3397 #define FILE_CREATE 0x00000002
3398 #define FILE_OPEN_IF 0x00000003
3399 #define FILE_OVERWRITE 0x00000004
3400 #define FILE_OVERWRITE_IF 0x00000005
3401 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3402 
3403 #define FILE_DIRECTORY_FILE 0x00000001
3404 #define FILE_WRITE_THROUGH 0x00000002
3405 #define FILE_SEQUENTIAL_ONLY 0x00000004
3406 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3407 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3408 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3409 #define FILE_NON_DIRECTORY_FILE 0x00000040
3410 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3411 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3412 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3413 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3414 #define FILE_RANDOM_ACCESS 0x00000800
3415 #define FILE_DELETE_ON_CLOSE 0x00001000
3416 #define FILE_OPEN_BY_FILE_ID 0x00002000
3417 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3418 #define FILE_NO_COMPRESSION 0x00008000
3419 #if (NTDDI_VERSION >= NTDDI_WIN7)
3420 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3421 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3422 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3423 #define FILE_RESERVE_OPFILTER 0x00100000
3424 #define FILE_OPEN_REPARSE_POINT 0x00200000
3425 #define FILE_OPEN_NO_RECALL 0x00400000
3426 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3427 
3428 $endif (_WDMDDK_)
3429 $if (_WDMDDK_ || _DEVIOCTL_)
3430 #define FILE_ANY_ACCESS 0x00000000
3431 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3432 #define FILE_READ_ACCESS 0x00000001
3433 #define FILE_WRITE_ACCESS 0x00000002
3434 
3436 $if (_WDMDDK_)
3437 #define FILE_ALL_ACCESS \
3438  (STANDARD_RIGHTS_REQUIRED | \
3439  SYNCHRONIZE | \
3440  0x1FF)
3441 
3442 #define FILE_GENERIC_EXECUTE \
3443  (STANDARD_RIGHTS_EXECUTE | \
3444  FILE_READ_ATTRIBUTES | \
3445  FILE_EXECUTE | \
3446  SYNCHRONIZE)
3447 
3448 #define FILE_GENERIC_READ \
3449  (STANDARD_RIGHTS_READ | \
3450  FILE_READ_DATA | \
3451  FILE_READ_ATTRIBUTES | \
3452  FILE_READ_EA | \
3453  SYNCHRONIZE)
3454 
3455 #define FILE_GENERIC_WRITE \
3456  (STANDARD_RIGHTS_WRITE | \
3457  FILE_WRITE_DATA | \
3458  FILE_WRITE_ATTRIBUTES | \
3459  FILE_WRITE_EA | \
3460  FILE_APPEND_DATA | \
3461  SYNCHRONIZE)
3462 
3463 /* end winnt.h */
3464 
3465 #define WMIREG_ACTION_REGISTER 1
3466 #define WMIREG_ACTION_DEREGISTER 2
3467 #define WMIREG_ACTION_REREGISTER 3
3468 #define WMIREG_ACTION_UPDATE_GUIDS 4
3469 #define WMIREG_ACTION_BLOCK_IRPS 5
3470 
3471 #define WMIREGISTER 0
3472 #define WMIUPDATE 1
3473 
3476 typedef VOID
3477 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3478  PVOID Wnode,
3479  PVOID Context);
3480 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3481 
3482 #ifndef _PCI_X_
3483 #define _PCI_X_
3484 
3485 typedef struct _PCI_SLOT_NUMBER {
3486  union {
3487  struct {
3491  } bits;
3493  } u;
3495 
3496 #define PCI_TYPE0_ADDRESSES 6
3497 #define PCI_TYPE1_ADDRESSES 2
3498 #define PCI_TYPE2_ADDRESSES 5
3499 
3500 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3501  inheritance, even from a struct renders the type non-POD. So we use
3502  this hack */
3503 #define PCI_COMMON_HEADER_LAYOUT \
3504  USHORT VendorID; \
3505  USHORT DeviceID; \
3506  USHORT Command; \
3507  USHORT Status; \
3508  UCHAR RevisionID; \
3509  UCHAR ProgIf; \
3510  UCHAR SubClass; \
3511  UCHAR BaseClass; \
3512  UCHAR CacheLineSize; \
3513  UCHAR LatencyTimer; \
3514  UCHAR HeaderType; \
3515  UCHAR BIST; \
3516  union { \
3517  struct _PCI_HEADER_TYPE_0 { \
3518  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3519  ULONG CIS; \
3520  USHORT SubVendorID; \
3521  USHORT SubSystemID; \
3522  ULONG ROMBaseAddress; \
3523  UCHAR CapabilitiesPtr; \
3524  UCHAR Reserved1[3]; \
3525  ULONG Reserved2; \
3526  UCHAR InterruptLine; \
3527  UCHAR InterruptPin; \
3528  UCHAR MinimumGrant; \
3529  UCHAR MaximumLatency; \
3530  } type0; \
3531  struct _PCI_HEADER_TYPE_1 { \
3532  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3533  UCHAR PrimaryBus; \
3534  UCHAR SecondaryBus; \
3535  UCHAR SubordinateBus; \
3536  UCHAR SecondaryLatency; \
3537  UCHAR IOBase; \
3538  UCHAR IOLimit; \
3539  USHORT SecondaryStatus; \
3540  USHORT MemoryBase; \
3541  USHORT MemoryLimit; \
3542  USHORT PrefetchBase; \
3543  USHORT PrefetchLimit; \
3544  ULONG PrefetchBaseUpper32; \
3545  ULONG PrefetchLimitUpper32; \
3546  USHORT IOBaseUpper16; \
3547  USHORT IOLimitUpper16; \
3548  UCHAR CapabilitiesPtr; \
3549  UCHAR Reserved1[3]; \
3550  ULONG ROMBaseAddress; \
3551  UCHAR InterruptLine; \
3552  UCHAR InterruptPin; \
3553  USHORT BridgeControl; \
3554  } type1; \
3555  struct _PCI_HEADER_TYPE_2 { \
3556  ULONG SocketRegistersBaseAddress; \
3557  UCHAR CapabilitiesPtr; \
3558  UCHAR Reserved; \
3559  USHORT SecondaryStatus; \
3560  UCHAR PrimaryBus; \
3561  UCHAR SecondaryBus; \
3562  UCHAR SubordinateBus; \
3563  UCHAR SecondaryLatency; \
3564  struct { \
3565  ULONG Base; \
3566  ULONG Limit; \
3567  } Range[PCI_TYPE2_ADDRESSES-1]; \
3568  UCHAR InterruptLine; \
3569  UCHAR InterruptPin; \
3570  USHORT BridgeControl; \
3571  } type2; \
3572  } u;
3573 
3574 typedef struct _PCI_COMMON_HEADER {
3577 
3578 #ifdef __cplusplus
3579 typedef struct _PCI_COMMON_CONFIG {
3581  UCHAR DeviceSpecific[192];
3583 #else
3584 typedef struct _PCI_COMMON_CONFIG {
3586  UCHAR DeviceSpecific[192];
3588 #endif
3589 
3590 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3591 
3592 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3593 
3594 #define PCI_MAX_DEVICES 32
3595 #define PCI_MAX_FUNCTION 8
3596 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3597 #define PCI_INVALID_VENDORID 0xFFFF
3598 
3599 /* PCI_COMMON_CONFIG.HeaderType */
3600 #define PCI_MULTIFUNCTION 0x80
3601 #define PCI_DEVICE_TYPE 0x00
3602 #define PCI_BRIDGE_TYPE 0x01
3603 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3604 
3605 #define PCI_CONFIGURATION_TYPE(PciData) \
3606  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3607 
3608 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3609  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3610 
3611 /* PCI_COMMON_CONFIG.Command */
3612 #define PCI_ENABLE_IO_SPACE 0x0001
3613 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3614 #define PCI_ENABLE_BUS_MASTER 0x0004
3615 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3616 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3617 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3618 #define PCI_ENABLE_PARITY 0x0040
3619 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3620 #define PCI_ENABLE_SERR 0x0100
3621 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3622 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3623 
3624 /* PCI_COMMON_CONFIG.Status */
3625 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3626 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3627 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3628 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3629 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3630 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3631 #define PCI_STATUS_DEVSEL 0x0600
3632 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3633 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3634 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3635 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3636 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3637 
3638 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3639 
3640 #define PCI_WHICHSPACE_CONFIG 0x0
3641 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3642 
3643 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3644 #define PCI_CAPABILITY_ID_AGP 0x02
3645 #define PCI_CAPABILITY_ID_VPD 0x03
3646 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3647 #define PCI_CAPABILITY_ID_MSI 0x05
3648 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3649 #define PCI_CAPABILITY_ID_PCIX 0x07
3650 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3651 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3652 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3653 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3654 #define PCI_CAPABILITY_ID_SHPC 0x0C
3655 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3656 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3657 #define PCI_CAPABILITY_ID_SECURE 0x0F
3658 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3659 #define PCI_CAPABILITY_ID_MSIX 0x11
3660 
3665 
3666 typedef struct _PCI_PMC {
3672  struct _PM_SUPPORT {
3681  } Support;
3682 } PCI_PMC, *PPCI_PMC;
3683 
3684 typedef struct _PCI_PMCSR {
3691 } PCI_PMCSR, *PPCI_PMCSR;
3692 
3693 typedef struct _PCI_PMCSR_BSE {
3698 
3699 typedef struct _PCI_PM_CAPABILITY {
3701  union {
3704  } PMC;
3705  union {
3707  USHORT AsUSHORT;
3708  } PMCSR;
3709  union {
3712  } PMCSR_BSE;
3715 
3716 typedef struct {
3718  union {
3719  struct {
3725  } bits;
3727  } Command;
3728  union {
3729  struct {
3744  } bits;
3746  } Status;
3748 
3749 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3750 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3751 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3752 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3753 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3754 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3755 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3756 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3757 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3758 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3759 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3760 
3766 
3772 
3774  _ANONYMOUS_STRUCT struct {
3790  } DUMMYSTRUCTNAME;
3793 
3795  _ANONYMOUS_STRUCT struct {
3811  } DUMMYSTRUCTNAME;
3814 
3816  _ANONYMOUS_STRUCT struct {