ReactOS  0.4.15-dev-2535-gcf6c191
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 #undef __string_type
1220 #undef __guid_type
1221 #undef __multiString_type
1222 
1229 
1230 typedef enum _IO_PRIORITY_HINT {
1238 
1239 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1240 
1241 _Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1243 typedef NTSTATUS
1244 (NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1247 typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1248 
1249 _Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1251 typedef VOID
1252 (NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1254 typedef DEVICE_CHANGE_COMPLETE_CALLBACK *PDEVICE_CHANGE_COMPLETE_CALLBACK;
1255 
1297 #if (NTDDI_VERSION >= NTDDI_VISTA)
1307 #endif
1308 #if (NTDDI_VERSION >= NTDDI_WIN7)
1315 #endif
1318 
1323 
1324 typedef struct _FILE_POSITION_INFORMATION {
1325  LARGE_INTEGER CurrentByteOffset;
1327 
1328 typedef struct _FILE_BASIC_INFORMATION {
1329  LARGE_INTEGER CreationTime;
1330  LARGE_INTEGER LastAccessTime;
1331  LARGE_INTEGER LastWriteTime;
1332  LARGE_INTEGER ChangeTime;
1335 
1339 
1341  ULONG Flags;
1343 
1348 
1352 
1356 
1359  ULONG_PTR ProcessIdList[1];
1361 
1362 typedef struct _FILE_STANDARD_INFORMATION {
1364  LARGE_INTEGER EndOfFile;
1365  ULONG NumberOfLinks;
1366  BOOLEAN DeletePending;
1369 
1370 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
1371  LARGE_INTEGER CreationTime;
1372  LARGE_INTEGER LastAccessTime;
1373  LARGE_INTEGER LastWriteTime;
1374  LARGE_INTEGER ChangeTime;
1376  LARGE_INTEGER EndOfFile;
1379 
1380 typedef enum _FSINFOCLASS {
1393 
1394 typedef struct _FILE_FS_DEVICE_INFORMATION {
1396  ULONG Characteristics;
1398 
1399 typedef struct _FILE_FULL_EA_INFORMATION {
1400  ULONG NextEntryOffset;
1401  UCHAR Flags;
1402  UCHAR EaNameLength;
1403  USHORT EaValueLength;
1404  CHAR EaName[1];
1406 
1415 
1421 
1422 #define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
1423 #define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
1424 #define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
1425 
1426 #define FM_LOCK_BIT (0x1)
1427 #define FM_LOCK_BIT_V (0x0)
1428 #define FM_LOCK_WAITER_WOKEN (0x2)
1429 #define FM_LOCK_WAITER_INC (0x4)
1430 
1431 _Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
1433 typedef BOOLEAN
1434 (NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1435  _In_ struct _FILE_OBJECT *FileObject,
1437  _In_ ULONG Length,
1438  _In_ BOOLEAN Wait,
1439  _In_ ULONG LockKey,
1442  _In_ struct _DEVICE_OBJECT *DeviceObject);
1443 typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1444 
1445 _Function_class_(FAST_IO_READ)
1447 typedef BOOLEAN
1448 (NTAPI FAST_IO_READ)(
1449  _In_ struct _FILE_OBJECT *FileObject,
1451  _In_ ULONG Length,
1452  _In_ BOOLEAN Wait,
1453  _In_ ULONG LockKey,
1454  _Out_ PVOID Buffer,
1456  _In_ struct _DEVICE_OBJECT *DeviceObject);
1457 typedef FAST_IO_READ *PFAST_IO_READ;
1458 
1459 _Function_class_(FAST_IO_WRITE)
1461 typedef BOOLEAN
1462 (NTAPI FAST_IO_WRITE)(
1463  _In_ struct _FILE_OBJECT *FileObject,
1465  _In_ ULONG Length,
1466  _In_ BOOLEAN Wait,
1467  _In_ ULONG LockKey,
1468  _In_ PVOID Buffer,
1470  _In_ struct _DEVICE_OBJECT *DeviceObject);
1471 typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1472 
1473 _Function_class_(FAST_IO_QUERY_BASIC_INFO)
1475 typedef BOOLEAN
1476 (NTAPI FAST_IO_QUERY_BASIC_INFO)(
1477  _In_ struct _FILE_OBJECT *FileObject,
1478  _In_ BOOLEAN Wait,
1481  _In_ struct _DEVICE_OBJECT *DeviceObject);
1482 typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1483 
1484 _Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1486 typedef BOOLEAN
1487 (NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1488  _In_ struct _FILE_OBJECT *FileObject,
1489  _In_ BOOLEAN Wait,
1492  _In_ struct _DEVICE_OBJECT *DeviceObject);
1493 typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1494 
1495 _Function_class_(FAST_IO_LOCK)
1497 typedef BOOLEAN
1498 (NTAPI FAST_IO_LOCK)(
1499  _In_ struct _FILE_OBJECT *FileObject,
1503  _In_ ULONG Key,
1507  _In_ struct _DEVICE_OBJECT *DeviceObject);
1508 typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1509 
1510 _Function_class_(FAST_IO_UNLOCK_SINGLE)
1512 typedef BOOLEAN
1513 (NTAPI FAST_IO_UNLOCK_SINGLE)(
1514  _In_ struct _FILE_OBJECT *FileObject,
1518  _In_ ULONG Key,
1520  _In_ struct _DEVICE_OBJECT *DeviceObject);
1521 typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1522 
1523 _Function_class_(FAST_IO_UNLOCK_ALL)
1525 typedef BOOLEAN
1526 (NTAPI FAST_IO_UNLOCK_ALL)(
1527  _In_ struct _FILE_OBJECT *FileObject,
1530  _In_ struct _DEVICE_OBJECT *DeviceObject);
1531 typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1532 
1533 _Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1535 typedef BOOLEAN
1536 (NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1537  _In_ struct _FILE_OBJECT *FileObject,
1539  _In_ ULONG Key,
1541  _In_ struct _DEVICE_OBJECT *DeviceObject);
1542 typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1543 
1544 _Function_class_(FAST_IO_DEVICE_CONTROL)
1546 typedef BOOLEAN
1547 (NTAPI FAST_IO_DEVICE_CONTROL)(
1548  _In_ struct _FILE_OBJECT *FileObject,
1556  _In_ struct _DEVICE_OBJECT *DeviceObject);
1557 typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1558 
1559 _Function_class_(FAST_IO_ACQUIRE_FILE)
1561 typedef VOID
1562 (NTAPI FAST_IO_ACQUIRE_FILE)(
1563  _In_ struct _FILE_OBJECT *FileObject);
1564 typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1565 
1566 _Function_class_(FAST_IO_RELEASE_FILE)
1568 typedef VOID
1569 (NTAPI FAST_IO_RELEASE_FILE)(
1570  _In_ struct _FILE_OBJECT *FileObject);
1571 typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1572 
1573 _Function_class_(FAST_IO_DETACH_DEVICE)
1575 typedef VOID
1576 (NTAPI FAST_IO_DETACH_DEVICE)(
1579 typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1580 
1581 _Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1583 typedef BOOLEAN
1584 (NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1585  _In_ struct _FILE_OBJECT *FileObject,
1586  _In_ BOOLEAN Wait,
1589  _In_ struct _DEVICE_OBJECT *DeviceObject);
1590 typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1591 
1592 _Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1594 typedef NTSTATUS
1595 (NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1596  _In_ struct _FILE_OBJECT *FileObject,
1599  _In_ struct _DEVICE_OBJECT *DeviceObject);
1600 typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1601 
1602 _Function_class_(FAST_IO_MDL_READ)
1604 typedef BOOLEAN
1605 (NTAPI FAST_IO_MDL_READ)(
1606  _In_ struct _FILE_OBJECT *FileObject,
1608  _In_ ULONG Length,
1609  _In_ ULONG LockKey,
1610  _Out_ PMDL *MdlChain,
1612  _In_ struct _DEVICE_OBJECT *DeviceObject);
1613 typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1614 
1615 _Function_class_(FAST_IO_MDL_READ_COMPLETE)
1617 typedef BOOLEAN
1618 (NTAPI FAST_IO_MDL_READ_COMPLETE)(
1619  _In_ struct _FILE_OBJECT *FileObject,
1620  _In_ PMDL MdlChain,
1621  _In_ struct _DEVICE_OBJECT *DeviceObject);
1622 typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1623 
1624 _Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1626 typedef BOOLEAN
1627 (NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1628  _In_ struct _FILE_OBJECT *FileObject,
1630  _In_ ULONG Length,
1631  _In_ ULONG LockKey,
1632  _Out_ PMDL *MdlChain,
1634  _In_ struct _DEVICE_OBJECT *DeviceObject);
1635 typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1636 
1637 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1639 typedef BOOLEAN
1640 (NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1641  _In_ struct _FILE_OBJECT *FileObject,
1643  _In_ PMDL MdlChain,
1644  _In_ struct _DEVICE_OBJECT *DeviceObject);
1645 typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1646 
1647 _Function_class_(FAST_IO_READ_COMPRESSED)
1649 typedef BOOLEAN
1650 (NTAPI FAST_IO_READ_COMPRESSED)(
1651  _In_ struct _FILE_OBJECT *FileObject,
1653  _In_ ULONG Length,
1654  _In_ ULONG LockKey,
1655  _Out_ PVOID Buffer,
1656  _Out_ PMDL *MdlChain,
1660  _In_ struct _DEVICE_OBJECT *DeviceObject);
1661 typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1662 
1663 _Function_class_(FAST_IO_WRITE_COMPRESSED)
1665 typedef BOOLEAN
1666 (NTAPI FAST_IO_WRITE_COMPRESSED)(
1667  _In_ struct _FILE_OBJECT *FileObject,
1669  _In_ ULONG Length,
1670  _In_ ULONG LockKey,
1671  _In_ PVOID Buffer,
1672  _Out_ PMDL *MdlChain,
1676  _In_ struct _DEVICE_OBJECT *DeviceObject);
1677 typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1678 
1679 _Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1681 typedef BOOLEAN
1682 (NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1683  _In_ struct _FILE_OBJECT *FileObject,
1684  _In_ PMDL MdlChain,
1685  _In_ struct _DEVICE_OBJECT *DeviceObject);
1686 typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1687 
1688 _Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1690 typedef BOOLEAN
1691 (NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1692  _In_ struct _FILE_OBJECT *FileObject,
1694  _In_ PMDL MdlChain,
1695  _In_ struct _DEVICE_OBJECT *DeviceObject);
1696 typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1697 
1698 _Function_class_(FAST_IO_QUERY_OPEN)
1700 typedef BOOLEAN
1701 (NTAPI FAST_IO_QUERY_OPEN)(
1702  _Inout_ struct _IRP *Irp,
1704  _In_ struct _DEVICE_OBJECT *DeviceObject);
1705 typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1706 
1707 _Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1709 typedef NTSTATUS
1710 (NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1711  _In_ struct _FILE_OBJECT *FileObject,
1713  _In_ struct _DEVICE_OBJECT *DeviceObject);
1714 typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1715 
1716 _Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1718 typedef NTSTATUS
1719 (NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1720  _In_ struct _FILE_OBJECT *FileObject,
1721  _In_ struct _DEVICE_OBJECT *DeviceObject);
1722 typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1723 
1724 _Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1726 typedef NTSTATUS
1727 (NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1728  _In_ struct _FILE_OBJECT *FileObject,
1729  _In_ struct _DEVICE_OBJECT *DeviceObject);
1730 typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1731 
1732 typedef struct _FAST_IO_DISPATCH {
1762 
1763 typedef struct _SECTION_OBJECT_POINTERS {
1764  PVOID DataSectionObject;
1765  PVOID SharedCacheMap;
1766  PVOID ImageSectionObject;
1768 
1769 typedef struct _IO_COMPLETION_CONTEXT {
1773 
1774 /* FILE_OBJECT.Flags */
1775 #define FO_FILE_OPEN 0x00000001
1776 #define FO_SYNCHRONOUS_IO 0x00000002
1777 #define FO_ALERTABLE_IO 0x00000004
1778 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
1779 #define FO_WRITE_THROUGH 0x00000010
1780 #define FO_SEQUENTIAL_ONLY 0x00000020
1781 #define FO_CACHE_SUPPORTED 0x00000040
1782 #define FO_NAMED_PIPE 0x00000080
1783 #define FO_STREAM_FILE 0x00000100
1784 #define FO_MAILSLOT 0x00000200
1785 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
1786 #define FO_QUEUE_IRP_TO_THREAD 0x00000400
1787 #define FO_DIRECT_DEVICE_OPEN 0x00000800
1788 #define FO_FILE_MODIFIED 0x00001000
1789 #define FO_FILE_SIZE_CHANGED 0x00002000
1790 #define FO_CLEANUP_COMPLETE 0x00004000
1791 #define FO_TEMPORARY_FILE 0x00008000
1792 #define FO_DELETE_ON_CLOSE 0x00010000
1793 #define FO_OPENED_CASE_SENSITIVE 0x00020000
1794 #define FO_HANDLE_CREATED 0x00040000
1795 #define FO_FILE_FAST_IO_READ 0x00080000
1796 #define FO_RANDOM_ACCESS 0x00100000
1797 #define FO_FILE_OPEN_CANCELLED 0x00200000
1798 #define FO_VOLUME_OPEN 0x00400000
1799 #define FO_REMOTE_ORIGIN 0x01000000
1800 #define FO_DISALLOW_EXCLUSIVE 0x02000000
1801 #define FO_SKIP_COMPLETION_PORT 0x02000000
1802 #define FO_SKIP_SET_EVENT 0x04000000
1803 #define FO_SKIP_SET_FAST_IO 0x08000000
1804 #define FO_FLAGS_VALID_ONLY_DURING_CREATE FO_DISALLOW_EXCLUSIVE
1805 
1806 /* VPB.Flags */
1807 #define VPB_MOUNTED 0x0001
1808 #define VPB_LOCKED 0x0002
1809 #define VPB_PERSISTENT 0x0004
1810 #define VPB_REMOVE_PENDING 0x0008
1811 #define VPB_RAW_MOUNT 0x0010
1812 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1813 
1814 /* IO_STACK_LOCATION.Flags */
1815 
1816 #define SL_FORCE_ACCESS_CHECK 0x01
1817 #define SL_OPEN_PAGING_FILE 0x02
1818 #define SL_OPEN_TARGET_DIRECTORY 0x04
1819 #define SL_STOP_ON_SYMLINK 0x08
1820 #define SL_CASE_SENSITIVE 0x80
1821 
1822 #define SL_KEY_SPECIFIED 0x01
1823 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1824 #define SL_WRITE_THROUGH 0x04
1825 #define SL_FT_SEQUENTIAL_WRITE 0x08
1826 #define SL_FORCE_DIRECT_WRITE 0x10
1827 #define SL_REALTIME_STREAM 0x20
1828 
1829 #define SL_READ_ACCESS_GRANTED 0x01
1830 #define SL_WRITE_ACCESS_GRANTED 0x04
1831 
1832 #define SL_FAIL_IMMEDIATELY 0x01
1833 #define SL_EXCLUSIVE_LOCK 0x02
1834 
1835 #define SL_RESTART_SCAN 0x01
1836 #define SL_RETURN_SINGLE_ENTRY 0x02
1837 #define SL_INDEX_SPECIFIED 0x04
1838 
1839 #define SL_WATCH_TREE 0x01
1840 
1841 #define SL_ALLOW_RAW_MOUNT 0x01
1842 
1843 $endif (_WDMDDK_)
1844 $if (_WDMDDK_ || _DEVIOCTL_)
1845 #define CTL_CODE(DeviceType, Function, Method, Access) \
1846  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1847 
1848 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1849 
1850 #define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
1851 
1853 $if (_WDMDDK_)
1854 
1855 /* IRP.Flags */
1856 #define IRP_NOCACHE 0x00000001
1857 #define IRP_PAGING_IO 0x00000002
1858 #define IRP_MOUNT_COMPLETION 0x00000002
1859 #define IRP_SYNCHRONOUS_API 0x00000004
1860 #define IRP_ASSOCIATED_IRP 0x00000008
1861 #define IRP_BUFFERED_IO 0x00000010
1862 #define IRP_DEALLOCATE_BUFFER 0x00000020
1863 #define IRP_INPUT_OPERATION 0x00000040
1864 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1865 #define IRP_CREATE_OPERATION 0x00000080
1866 #define IRP_READ_OPERATION 0x00000100
1867 #define IRP_WRITE_OPERATION 0x00000200
1868 #define IRP_CLOSE_OPERATION 0x00000400
1869 #define IRP_DEFER_IO_COMPLETION 0x00000800
1870 #define IRP_OB_QUERY_NAME 0x00001000
1871 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1872 /* The following 2 are missing in latest WDK */
1873 #define IRP_RETRY_IO_COMPLETION 0x00004000
1874 #define IRP_CLASS_CACHE_OPERATION 0x00008000
1875 
1876 /* IRP.AllocationFlags */
1877 #define IRP_QUOTA_CHARGED 0x01
1878 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1879 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1880 #define IRP_LOOKASIDE_ALLOCATION 0x08
1881 
1882 /*
1883 ** IRP function codes
1884 */
1885 
1886 #define IRP_MJ_CREATE 0x00
1887 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
1888 #define IRP_MJ_CLOSE 0x02
1889 #define IRP_MJ_READ 0x03
1890 #define IRP_MJ_WRITE 0x04
1891 #define IRP_MJ_QUERY_INFORMATION 0x05
1892 #define IRP_MJ_SET_INFORMATION 0x06
1893 #define IRP_MJ_QUERY_EA 0x07
1894 #define IRP_MJ_SET_EA 0x08
1895 #define IRP_MJ_FLUSH_BUFFERS 0x09
1896 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
1897 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
1898 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
1899 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
1900 #define IRP_MJ_DEVICE_CONTROL 0x0e
1901 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
1902 #define IRP_MJ_SCSI 0x0f
1903 #define IRP_MJ_SHUTDOWN 0x10
1904 #define IRP_MJ_LOCK_CONTROL 0x11
1905 #define IRP_MJ_CLEANUP 0x12
1906 #define IRP_MJ_CREATE_MAILSLOT 0x13
1907 #define IRP_MJ_QUERY_SECURITY 0x14
1908 #define IRP_MJ_SET_SECURITY 0x15
1909 #define IRP_MJ_POWER 0x16
1910 #define IRP_MJ_SYSTEM_CONTROL 0x17
1911 #define IRP_MJ_DEVICE_CHANGE 0x18
1912 #define IRP_MJ_QUERY_QUOTA 0x19
1913 #define IRP_MJ_SET_QUOTA 0x1a
1914 #define IRP_MJ_PNP 0x1b
1915 #define IRP_MJ_PNP_POWER 0x1b
1916 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
1917 
1918 #define IRP_MN_SCSI_CLASS 0x01
1919 
1920 #define IRP_MN_START_DEVICE 0x00
1921 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
1922 #define IRP_MN_REMOVE_DEVICE 0x02
1923 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
1924 #define IRP_MN_STOP_DEVICE 0x04
1925 #define IRP_MN_QUERY_STOP_DEVICE 0x05
1926 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
1927 
1928 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
1929 #define IRP_MN_QUERY_INTERFACE 0x08
1930 #define IRP_MN_QUERY_CAPABILITIES 0x09
1931 #define IRP_MN_QUERY_RESOURCES 0x0A
1932 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
1933 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
1934 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
1935 
1936 #define IRP_MN_READ_CONFIG 0x0F
1937 #define IRP_MN_WRITE_CONFIG 0x10
1938 #define IRP_MN_EJECT 0x11
1939 #define IRP_MN_SET_LOCK 0x12
1940 #define IRP_MN_QUERY_ID 0x13
1941 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
1942 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
1943 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
1944 #define IRP_MN_SURPRISE_REMOVAL 0x17
1945 #if (NTDDI_VERSION >= NTDDI_WIN7)
1946 #define IRP_MN_DEVICE_ENUMERATED 0x19
1947 #endif
1948 
1949 #define IRP_MN_WAIT_WAKE 0x00
1950 #define IRP_MN_POWER_SEQUENCE 0x01
1951 #define IRP_MN_SET_POWER 0x02
1952 #define IRP_MN_QUERY_POWER 0x03
1953 
1954 #define IRP_MN_QUERY_ALL_DATA 0x00
1955 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
1956 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
1957 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
1958 #define IRP_MN_ENABLE_EVENTS 0x04
1959 #define IRP_MN_DISABLE_EVENTS 0x05
1960 #define IRP_MN_ENABLE_COLLECTION 0x06
1961 #define IRP_MN_DISABLE_COLLECTION 0x07
1962 #define IRP_MN_REGINFO 0x08
1963 #define IRP_MN_EXECUTE_METHOD 0x09
1964 
1965 #define IRP_MN_REGINFO_EX 0x0b
1966 
1967 typedef struct _FILE_OBJECT {
1968  CSHORT Type;
1969  CSHORT Size;
1971  PVPB Vpb;
1972  PVOID FsContext;
1973  PVOID FsContext2;
1975  PVOID PrivateCacheMap;
1976  NTSTATUS FinalStatus;
1977  struct _FILE_OBJECT *RelatedFileObject;
1978  BOOLEAN LockOperation;
1979  BOOLEAN DeletePending;
1982  BOOLEAN DeleteAccess;
1983  BOOLEAN SharedRead;
1984  BOOLEAN SharedWrite;
1985  BOOLEAN SharedDelete;
1986  ULONG Flags;
1988  LARGE_INTEGER CurrentByteOffset;
1989  volatile ULONG Waiters;
1990  volatile ULONG Busy;
1991  PVOID LastLock;
1992  KEVENT Lock;
1993  KEVENT Event;
1995  KSPIN_LOCK IrpListLock;
1996  LIST_ENTRY IrpList;
1997  volatile PVOID FileObjectExtension;
1999 
2000 typedef struct _IO_ERROR_LOG_PACKET {
2015 
2016 typedef struct _IO_ERROR_LOG_MESSAGE {
2024 
2025 /* See ndk/lpctypes.h */
2026 #ifdef _WIN64
2027 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
2028 #else
2029 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
2030 #endif
2031 
2032 #define ERROR_LOG_LIMIT_SIZE 240
2033 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
2034  sizeof(IO_ERROR_LOG_PACKET) + \
2035  (sizeof(WCHAR) * 40))
2036 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
2037  (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2038 #define IO_ERROR_LOG_MESSAGE_LENGTH \
2039  ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
2040  ERROR_LOG_MESSAGE_LIMIT_SIZE : \
2041  PORT_MAXIMUM_MESSAGE_LENGTH)
2042 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
2043  IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
2044 
2045 typedef enum _DMA_WIDTH {
2050 } DMA_WIDTH, *PDMA_WIDTH;
2051 
2052 typedef enum _DMA_SPEED {
2059 } DMA_SPEED, *PDMA_SPEED;
2060 
2061 /* DEVICE_DESCRIPTION.Version */
2062 
2063 #define DEVICE_DESCRIPTION_VERSION 0x0000
2064 #define DEVICE_DESCRIPTION_VERSION1 0x0001
2065 #define DEVICE_DESCRIPTION_VERSION2 0x0002
2066 #define DEVICE_DESCRIPTION_VERSION3 0x0003
2067 
2068 typedef struct _DEVICE_DESCRIPTION {
2085 #if (NTDDI_VERSION >= NTDDI_WIN8)
2090 #endif // NTDDI_WIN8
2092 
2093 #define DMA_ADAPTER_INFO_VERSION1 1
2094 
2095 #define ADAPTER_INFO_SYNCHRONOUS_CALLBACK 0x0001
2096 #define ADAPTER_INFO_API_BYPASS 0x0002
2097 
2098 typedef struct _DMA_ADAPTER_INFO_V1
2099 {
2106 
2107 typedef struct _DMA_ADAPTER_INFO
2108 {
2110  union
2111  {
2113  };
2115 
2116 #define DMA_TRANSFER_INFO_VERSION1 1
2117 #define DMA_TRANSFER_INFO_VERSION2 2
2118 
2120 {
2125 
2127 {
2133 
2134 typedef struct _DMA_TRANSFER_INFO
2135 {
2137  union {
2140  };
2142 
2143 #define DMA_TRANSFER_CONTEXT_VERSION1 1
2144 
2145 #ifdef _WIN64
2146 #define DMA_TRANSFER_CONTEXT_SIZE_V1 128
2147 #else
2148 #define DMA_TRANSFER_CONTEXT_SIZE_V1 64
2149 #endif
2150 
2160 
2161 typedef struct _DEVICE_RELATIONS {
2163  PDEVICE_OBJECT Objects[1];
2165 
2166 typedef struct _DEVOBJ_EXTENSION {
2171 
2172 typedef struct _SCATTER_GATHER_ELEMENT {
2177 
2178 #if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2179 
2180 #if defined(_MSC_VER)
2181 #if _MSC_VER >= 1200
2182 #pragma warning(push)
2183 #endif
2184 #pragma warning(disable:4200)
2185 #endif /* _MSC_VER */
2186 
2187 typedef struct _SCATTER_GATHER_LIST {
2188  ULONG NumberOfElements;
2190  SCATTER_GATHER_ELEMENT Elements[1];
2192 
2193 #if defined(_MSC_VER)
2194 #if _MSC_VER >= 1200
2195 #pragma warning(pop)
2196 #else
2197 #pragma warning(default:4200)
2198 #endif
2199 #endif /* _MSC_VER */
2200 
2201 #else /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2202 
2203 struct _SCATTER_GATHER_LIST;
2204 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2205 
2206 #endif /* defined(_MSC_EXTENSIONS) || defined(__GNUC__) */
2207 
2208 _Function_class_(DRIVER_ADD_DEVICE)
2211 _When_(return>=0, _Kernel_clear_do_init_(__yes))
2212 typedef NTSTATUS
2213 (NTAPI DRIVER_ADD_DEVICE)(
2216 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2217 
2218 typedef struct _DRIVER_EXTENSION {
2224 
2225 #define DRVO_UNLOAD_INVOKED 0x00000001
2226 #define DRVO_LEGACY_DRIVER 0x00000002
2227 #define DRVO_BUILTIN_DRIVER 0x00000004
2228 
2229 _Function_class_(DRIVER_INITIALIZE)
2231 typedef NTSTATUS
2232 (NTAPI DRIVER_INITIALIZE)(
2235 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2236 
2237 _Function_class_(DRIVER_STARTIO)
2241 typedef VOID
2242 (NTAPI DRIVER_STARTIO)(
2244  _Inout_ struct _IRP *Irp);
2245 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2246 
2247 _Function_class_(DRIVER_UNLOAD)
2250 typedef VOID
2251 (NTAPI DRIVER_UNLOAD)(
2252  _In_ struct _DRIVER_OBJECT *DriverObject);
2253 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2254 
2258 typedef NTSTATUS
2261  _Inout_ struct _IRP *Irp);
2264 
2268 typedef NTSTATUS
2269 (NTAPI DRIVER_DISPATCH_PAGED)(
2271  _Inout_ struct _IRP *Irp);
2272 typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2273 
2274 typedef struct _DRIVER_OBJECT {
2291 
2292 typedef struct _DMA_ADAPTER {
2297 
2298 typedef enum
2299 {
2305 
2306 typedef VOID
2308  PDMA_ADAPTER DmaAdapter);
2309 
2310 typedef PVOID
2312  _In_ PDMA_ADAPTER DmaAdapter,
2313  _In_ ULONG Length,
2314  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2315  _In_ BOOLEAN CacheEnabled);
2316 
2317 typedef VOID
2319  _In_ PDMA_ADAPTER DmaAdapter,
2320  _In_ ULONG Length,
2321  _In_ PHYSICAL_ADDRESS LogicalAddress,
2323  _In_ BOOLEAN CacheEnabled);
2324 
2325 typedef NTSTATUS
2327  _In_ PDMA_ADAPTER DmaAdapter,
2331  _In_ PVOID Context);
2332 
2333 typedef BOOLEAN
2335  _In_ PDMA_ADAPTER DmaAdapter,
2336  _In_ PMDL Mdl,
2338  _In_ PVOID CurrentVa,
2339  _In_ ULONG Length,
2341 
2342 typedef VOID
2344  _In_ PDMA_ADAPTER DmaAdapter);
2345 
2346 typedef VOID
2348  _In_ PDMA_ADAPTER DmaAdapter,
2351 
2352 typedef PHYSICAL_ADDRESS
2354  _In_ PDMA_ADAPTER DmaAdapter,
2355  _In_ PMDL Mdl,
2357  _In_ PVOID CurrentVa,
2360 
2361 typedef ULONG
2363  _In_ PDMA_ADAPTER DmaAdapter);
2364 
2365 typedef ULONG
2367  _In_ PDMA_ADAPTER DmaAdapter);
2368 
2369 _Function_class_(DRIVER_LIST_CONTROL)
2371 typedef VOID
2372 (NTAPI DRIVER_LIST_CONTROL)(
2374  _In_ struct _IRP *Irp,
2375  _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2376  _In_ PVOID Context);
2377 typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2378 
2379 typedef NTSTATUS
2381  _In_ PDMA_ADAPTER DmaAdapter,
2383  _In_ PMDL Mdl,
2384  _In_ PVOID CurrentVa,
2385  _In_ ULONG Length,
2387  _In_ PVOID Context,
2389 
2390 typedef VOID
2392  _In_ PDMA_ADAPTER DmaAdapter,
2395 
2396 typedef NTSTATUS
2398  _In_ PDMA_ADAPTER DmaAdapter,
2400  _In_ PVOID CurrentVa,
2401  _In_ ULONG Length,
2402  _Out_ PULONG ScatterGatherListSize,
2403  _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2404 
2405 typedef NTSTATUS
2407  _In_ PDMA_ADAPTER DmaAdapter,
2409  _In_ PMDL Mdl,
2410  _In_ PVOID CurrentVa,
2411  _In_ ULONG Length,
2413  _In_ PVOID Context,
2415  _In_ PVOID ScatterGatherBuffer,
2416  _In_ ULONG ScatterGatherLength);
2417 
2418 typedef NTSTATUS
2420  _In_ PDMA_ADAPTER DmaAdapter,
2422  _In_ PMDL OriginalMdl,
2423  _Out_ PMDL *TargetMdl);
2424 
2425 typedef NTSTATUS
2427  _In_ PDMA_ADAPTER DmaAdapter,
2428  _Inout_ PDMA_ADAPTER_INFO AdapterInfo);
2429 
2430 typedef NTSTATUS
2432  _In_ PDMA_ADAPTER DmaAdapter,
2433  _In_ PMDL Mdl,
2435  _In_ ULONG Length,
2436  _In_ BOOLEAN WriteOnly,
2437  _Inout_ PDMA_TRANSFER_INFO TransferInfo);
2438 
2439 typedef NTSTATUS
2441  _In_ PDMA_ADAPTER DmaAdapter,
2442  _Out_ PVOID DmaTransferContext);
2443 
2444 typedef PVOID
2446  _In_ PDMA_ADAPTER DmaAdapter,
2447  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2448  _In_ ULONG Length,
2449  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2450  _In_ BOOLEAN CacheEnabled,
2451  _In_ NODE_REQUIREMENT PreferredNode);
2452 
2453 typedef NTSTATUS
2455  _In_ PDMA_ADAPTER DmaAdapter,
2457  _In_ PVOID DmaTransferContext,
2459  _In_ ULONG Flags,
2461  _In_opt_ PVOID ExecutionContext,
2463 
2464 typedef NTSTATUS
2466  _In_ PDMA_ADAPTER DmaAdapter,
2467  _In_ ULONG FunctionNumber,
2468  _In_ PVOID Context);
2469 
2470 typedef BOOLEAN
2472  _In_ PDMA_ADAPTER DmaAdapter,
2474  _In_ PVOID DmaTransferContext);
2475 
2476 typedef
2477 _Function_class_(DMA_COMPLETION_ROUTINE)
2480 VOID
2481 NTAPI
2482 DMA_COMPLETION_ROUTINE(
2483  _In_ PDMA_ADAPTER DmaAdapter,
2487 
2488 typedef DMA_COMPLETION_ROUTINE *PDMA_COMPLETION_ROUTINE;
2489 
2490 typedef NTSTATUS
2492  _In_ PDMA_ADAPTER DmaAdapter,
2493  _In_ PMDL Mdl,
2499  _Out_writes_bytes_opt_(ScatterGatherBufferLength) PSCATTER_GATHER_LIST ScatterGatherBuffer,
2500  _In_ ULONG ScatterGatherBufferLength,
2503 
2504 typedef NTSTATUS
2506  _In_ PDMA_ADAPTER DmaAdapter,
2508  _In_ PVOID DmaTransferContext,
2509  _In_ PMDL Mdl,
2511  _In_ ULONG Length,
2512  _In_ ULONG Flags,
2518  _Out_opt_ PSCATTER_GATHER_LIST *ScatterGatherList);
2519 
2520 typedef NTSTATUS
2522  _In_ PDMA_ADAPTER DmaAdapter,
2524  _In_ PVOID DmaTransferContext,
2525  _In_ PMDL Mdl,
2527  _In_ ULONG Length,
2528  _In_ ULONG Flags,
2532  _In_ PVOID ScatterGatherBuffer,
2533  _In_ ULONG ScatterGatherLength,
2536  _Out_opt_ PVOID ScatterGatherList);
2537 
2538 typedef NTSTATUS
2540  _In_ PDMA_ADAPTER DmaAdapter,
2541  _In_ PMDL Mdl,
2544  _In_ ULONG Length,
2546 
2547 typedef VOID
2549  _In_ PDMA_ADAPTER DmaAdapter,
2550  _In_ IO_ALLOCATION_ACTION AllocationAction);
2551 
2552 typedef NTSTATUS
2554  _In_ PDMA_ADAPTER DmaAdapter,
2555  _In_ PVOID DmaTransferContext);
2556 
2557 typedef NTSTATUS
2559  _In_ PDMA_ADAPTER DmaAdapter,
2560  _In_ HANDLE DomainHandle,
2561  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2562  _In_ ULONG Length,
2563  _In_ ULONG Flags,
2565  _In_ NODE_REQUIREMENT PreferredNode,
2566  _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2568 
2569 typedef NTSTATUS
2571  _In_ PDMA_ADAPTER DmaAdapter,
2572  _In_ PMDL Mdl,
2573  _In_ BOOLEAN ReadOperation);
2574 
2575 typedef NTSTATUS
2577  _In_ PDMA_ADAPTER DmaAdapter,
2578  _In_ HANDLE DomainHandle);
2579 
2580 typedef NTSTATUS
2582  _In_ PDMA_ADAPTER DmaAdapter);
2583 
2584 typedef HANDLE
2586  _In_ PDMA_ADAPTER DmaAdapter);
2587 
2588 typedef PVOID
2590  _In_ PDMA_ADAPTER DmaAdapter,
2591  _In_opt_ PPHYSICAL_ADDRESS MinimumAddress,
2592  _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2593  _In_ ULONG Length,
2594  _In_ ULONG Flags,
2596  _In_ NODE_REQUIREMENT PreferredNode,
2597  _Out_ PPHYSICAL_ADDRESS LogicalAddress);
2598 
2599 typedef struct _DMA_COMMON_BUFFER_VECTOR DMA_COMMON_BUFFER_VECTOR, *PDMA_COMMON_BUFFER_VECTOR;
2600 
2601 typedef NTSTATUS
2603  _In_ PDMA_ADAPTER DmaAdapter,
2604  _In_ PHYSICAL_ADDRESS LowAddress,
2607  _In_ ULONG IdealNode,
2608  _In_ ULONG Flags,
2609  _In_ ULONG NumberOfElements,
2610  _In_ ULONGLONG SizeOfElements,
2611  _Out_ PDMA_COMMON_BUFFER_VECTOR *VectorOut);
2612 
2613 typedef VOID
2615  _In_ PDMA_ADAPTER DmaAdapter,
2617  _In_ ULONG Index,
2618  _Out_ PVOID *VirtualAddressOut,
2619  _Out_ PPHYSICAL_ADDRESS LogicalAddressOut);
2620 
2621 typedef VOID
2623  _In_ PDMA_ADAPTER DmaAdapter,
2625  _In_ ULONG Index);
2626 
2627 typedef VOID
2629  _In_ PDMA_ADAPTER DmaAdapter,
2631 
2632 typedef struct _DMA_OPERATIONS {
2673 
2674 typedef struct _IO_RESOURCE_DESCRIPTOR {
2675  UCHAR Option;
2676  UCHAR Type;
2677  UCHAR ShareDisposition;
2678  UCHAR Spare1;
2679  USHORT Flags;
2680  USHORT Spare2;
2681  union {
2682  struct {
2683  ULONG Length;
2684  ULONG Alignment;
2685  PHYSICAL_ADDRESS MinimumAddress;
2686  PHYSICAL_ADDRESS MaximumAddress;
2687  } Port;
2688  struct {
2689  ULONG Length;
2690  ULONG Alignment;
2691  PHYSICAL_ADDRESS MinimumAddress;
2692  PHYSICAL_ADDRESS MaximumAddress;
2693  } Memory;
2694  struct {
2695  ULONG MinimumVector;
2696  ULONG MaximumVector;
2697 #if defined(NT_PROCESSOR_GROUPS)
2698  IRQ_DEVICE_POLICY AffinityPolicy;
2699  USHORT Group;
2700 #else
2701  IRQ_DEVICE_POLICY AffinityPolicy;
2702 #endif
2703  IRQ_PRIORITY PriorityPolicy;
2704  KAFFINITY TargetedProcessors;
2705  } Interrupt;
2706  struct {
2707  ULONG MinimumChannel;
2708  ULONG MaximumChannel;
2709  } Dma;
2710  struct {
2711  ULONG Length;
2712  ULONG Alignment;
2713  PHYSICAL_ADDRESS MinimumAddress;
2714  PHYSICAL_ADDRESS MaximumAddress;
2715  } Generic;
2716  struct {
2717  ULONG Data[3];
2718  } DevicePrivate;
2719  struct {
2720  ULONG Length;
2721  ULONG MinBusNumber;
2722  ULONG MaxBusNumber;
2723  ULONG Reserved;
2724  } BusNumber;
2725  struct {
2726  ULONG Priority;
2727  ULONG Reserved1;
2728  ULONG Reserved2;
2729  } ConfigData;
2730  } u;
2732 
2733 typedef struct _IO_RESOURCE_LIST {
2734  USHORT Version;
2735  USHORT Revision;
2736  ULONG Count;
2737  IO_RESOURCE_DESCRIPTOR Descriptors[1];
2739 
2740 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
2741  ULONG ListSize;
2743  ULONG BusNumber;
2744  ULONG SlotNumber;
2745  ULONG Reserved[3];
2746  ULONG AlternativeLists;
2749 
2750 _Function_class_(DRIVER_CANCEL)
2751 _Requires_lock_held_(_Global_cancel_spin_lock_)
2752 _Releases_lock_(_Global_cancel_spin_lock_)
2755 typedef VOID
2756 (NTAPI DRIVER_CANCEL)(
2759 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2760 
2761 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP {
2762  CSHORT Type;
2763  USHORT Size;
2764  struct _MDL *MdlAddress;
2765  ULONG Flags;
2766  union {
2767  struct _IRP *MasterIrp;
2768  volatile LONG IrpCount;
2769  PVOID SystemBuffer;
2770  } AssociatedIrp;
2771  LIST_ENTRY ThreadListEntry;
2773  KPROCESSOR_MODE RequestorMode;
2774  BOOLEAN PendingReturned;
2775  CHAR StackCount;
2776  CHAR CurrentLocation;
2777  BOOLEAN Cancel;
2778  KIRQL CancelIrql;
2779  CCHAR ApcEnvironment;
2780  UCHAR AllocationFlags;
2781  PIO_STATUS_BLOCK UserIosb;
2782  PKEVENT UserEvent;
2783  union {
2784  struct {
2785  _ANONYMOUS_UNION union {
2786  PIO_APC_ROUTINE UserApcRoutine;
2787  PVOID IssuingProcess;
2788  } DUMMYUNIONNAME;
2789  PVOID UserApcContext;
2790  } AsynchronousParameters;
2792  } Overlay;
2793  volatile PDRIVER_CANCEL CancelRoutine;
2794  PVOID UserBuffer;
2795  union {
2796  struct {
2797  _ANONYMOUS_UNION union {
2799  _ANONYMOUS_STRUCT struct {
2800  PVOID DriverContext[4];
2801  } DUMMYSTRUCTNAME;
2802  } DUMMYUNIONNAME;
2803  PETHREAD Thread;
2804  PCHAR AuxiliaryBuffer;
2805  _ANONYMOUS_STRUCT struct {
2806  LIST_ENTRY ListEntry;
2807  _ANONYMOUS_UNION union {
2808  struct _IO_STACK_LOCATION *CurrentStackLocation;
2809  ULONG PacketType;
2810  } DUMMYUNIONNAME;
2811  } DUMMYSTRUCTNAME;
2812  struct _FILE_OBJECT *OriginalFileObject;
2813  } Overlay;
2814  KAPC Apc;
2815  PVOID CompletionKey;
2816  } Tail;
2817 } IRP, *PIRP;
2818 
2819 typedef enum _IO_PAGING_PRIORITY {
2826 
2827 _Function_class_(IO_COMPLETION_ROUTINE)
2829 typedef NTSTATUS
2830 (NTAPI IO_COMPLETION_ROUTINE)(
2832  _In_ struct _IRP *Irp,
2834 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2835 
2836 _Function_class_(IO_DPC_ROUTINE)
2840 typedef VOID
2841 (NTAPI IO_DPC_ROUTINE)(
2842  _In_ struct _KDPC *Dpc,
2844  _Inout_ struct _IRP *Irp,
2846 typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2847 
2848 typedef NTSTATUS
2851 
2852 typedef NTSTATUS
2854  VOID);
2855 
2856 _Function_class_(IO_TIMER_ROUTINE)
2858 typedef VOID
2859 (NTAPI IO_TIMER_ROUTINE)(
2862 typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2863 
2864 typedef struct _IO_SECURITY_CONTEXT {
2870 
2871 struct _IO_CSQ;
2872 
2873 typedef struct _IO_CSQ_IRP_CONTEXT {
2874  ULONG Type;
2875  struct _IRP *Irp;
2876  struct _IO_CSQ *Csq;
2878 
2879 typedef VOID
2880 (NTAPI IO_CSQ_INSERT_IRP)(
2881  _In_ struct _IO_CSQ *Csq,
2883 typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2884 
2885 typedef NTSTATUS
2886 (NTAPI IO_CSQ_INSERT_IRP_EX)(
2887  _In_ struct _IO_CSQ *Csq,
2890 typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2891 
2892 typedef VOID
2893 (NTAPI IO_CSQ_REMOVE_IRP)(
2894  _In_ struct _IO_CSQ *Csq,
2895  _In_ PIRP Irp);
2896 typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2897 
2898 typedef PIRP
2899 (NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2900  _In_ struct _IO_CSQ *Csq,
2903 typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2904 
2905 typedef VOID
2906 (NTAPI IO_CSQ_ACQUIRE_LOCK)(
2907  _In_ struct _IO_CSQ *Csq,
2909 typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2910 
2911 typedef VOID
2912 (NTAPI IO_CSQ_RELEASE_LOCK)(
2913  _In_ struct _IO_CSQ *Csq,
2914  _In_ KIRQL Irql);
2915 typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2916 
2917 typedef VOID
2918 (NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2919  _In_ struct _IO_CSQ *Csq,
2920  _In_ PIRP Irp);
2921 typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2922 
2923 typedef struct _IO_CSQ {
2924  ULONG Type;
2931  PVOID ReservePointer;
2932 } IO_CSQ, *PIO_CSQ;
2933 
2934 typedef enum _BUS_QUERY_ID_TYPE {
2942 
2943 typedef enum _DEVICE_TEXT_TYPE {
2947 
2948 typedef BOOLEAN
2950  PVOID,
2951  PVOID);
2952 
2955 typedef NTSTATUS
2956 (NTAPI *PGPE_CONNECT_VECTOR)(
2960  BOOLEAN,
2962  PVOID,
2963  PVOID);
2964 
2967 typedef NTSTATUS
2968 (NTAPI *PGPE_DISCONNECT_VECTOR)(
2969  PVOID);
2970 
2973 typedef NTSTATUS
2974 (NTAPI *PGPE_ENABLE_EVENT)(
2976  PVOID);
2977 
2980 typedef NTSTATUS
2981 (NTAPI *PGPE_DISABLE_EVENT)(
2983  PVOID);
2984 
2987 typedef NTSTATUS
2988 (NTAPI *PGPE_CLEAR_STATUS)(
2990  PVOID);
2991 
2992 typedef VOID
2994  PVOID,
2995  ULONG);
2996 
2999 typedef NTSTATUS
3000 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3003  PVOID);
3004 
3006 typedef VOID
3007 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3010 
3017  PGPE_CONNECT_VECTOR GpeConnectVector;
3018  PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
3019  PGPE_ENABLE_EVENT GpeEnableEvent;
3020  PGPE_DISABLE_EVENT GpeDisableEvent;
3021  PGPE_CLEAR_STATUS GpeClearStatus;
3022  PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
3023  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
3025 
3026 typedef BOOLEAN
3030 
3033 typedef NTSTATUS
3034 (NTAPI *PGPE_CONNECT_VECTOR2)(
3035  PVOID Context,
3041  PVOID *ObjectContext);
3042 
3045 typedef NTSTATUS
3046 (NTAPI *PGPE_DISCONNECT_VECTOR2)(
3047  PVOID Context,
3049 
3052 typedef NTSTATUS
3053 (NTAPI *PGPE_ENABLE_EVENT2)(
3054  PVOID Context,
3056 
3059 typedef NTSTATUS
3060 (NTAPI *PGPE_DISABLE_EVENT2)(
3061  PVOID Context,
3063 
3066 typedef NTSTATUS
3067 (NTAPI *PGPE_CLEAR_STATUS2)(
3068  PVOID Context,
3070 
3072 typedef VOID
3073 (NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
3076 
3079 typedef NTSTATUS
3080 (NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3081  PVOID Context,
3082  PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
3084 
3086 typedef VOID
3087 (NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3088  PVOID Context);
3089 
3096  PGPE_CONNECT_VECTOR2 GpeConnectVector;
3097  PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
3098  PGPE_ENABLE_EVENT2 GpeEnableEvent;
3099  PGPE_DISABLE_EVENT2 GpeDisableEvent;
3100  PGPE_CLEAR_STATUS2 GpeClearStatus;
3101  PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
3102  PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
3104 
3105 #if !defined(_AMD64_) && !defined(_ARM_)
3106 #include <pshpack4.h>
3107 #endif
3108 
3109 typedef struct _IO_STACK_LOCATION {
3114  union {
3115  struct {
3121  } Create;
3122  struct {
3124  ULONG Options;
3128  } CreatePipe;
3129  struct {
3130  PIO_SECURITY_CONTEXT SecurityContext;
3131  ULONG Options;
3135  } CreateMailslot;
3136  struct {
3140  } Read;
3141  struct {
3142  ULONG Length;
3145  } Write;
3146  struct {
3147  ULONG Length;
3151  } QueryDirectory;
3152  struct {
3153  ULONG Length;
3155  } NotifyDirectory;
3156  struct {
3157  ULONG Length;
3160  } NotifyDirectoryEx;
3161  struct {
3162  ULONG Length;
3164  } QueryFile;
3165  struct {
3166  ULONG Length;
3169  _ANONYMOUS_UNION union {
3170  _ANONYMOUS_STRUCT struct {
3173  } DUMMYSTRUCTNAME;
3176  } DUMMYUNIONNAME;
3177  } SetFile;
3178  struct {
3179  ULONG Length;
3183  } QueryEa;
3184  struct {
3185  ULONG Length;
3186  } SetEa;
3187  struct {
3188  ULONG Length;
3190  } QueryVolume;
3191  struct {
3192  ULONG Length;
3194  } SetVolume;
3195  struct {
3200  } FileSystemControl;
3201  struct {
3205  } LockControl;
3206  struct {
3210  PVOID Type3InputBuffer;
3211  } DeviceIoControl;
3212  struct {
3215  } QuerySecurity;
3216  struct {
3219  } SetSecurity;
3220  struct {
3223  } MountVolume;
3224  struct {
3225  PVPB Vpb;
3227  } VerifyVolume;
3228  struct {
3230  } Scsi;
3231  struct {
3232  ULONG Length;
3236  } QueryQuota;
3237  struct {
3238  ULONG Length;
3239  } SetQuota;
3240  struct {
3242  } QueryDeviceRelations;
3243  struct {
3249  } QueryInterface;
3250  struct {
3253  struct {
3255  } FilterResourceRequirements;
3256  struct {
3261  } ReadWriteConfig;
3262  struct {
3264  } SetLock;
3265  struct {
3267  } QueryId;
3268  struct {
3271  } QueryDeviceText;
3272  struct {
3276  } UsageNotification;
3277  struct {
3279  } WaitWake;
3280  struct {
3282  } PowerSequence;
3283  struct {
3284  union {
3286 #if (NTDDI_VERSION >= NTDDI_VISTA)
3288 #endif // (NTDDI_VERSION >= NTDDI_VISTA)
3289  };
3293  } Power;
3294  struct {
3297  } StartDevice;
3298  struct {
3302  PVOID Buffer;
3303  } WMI;
3304  struct {
3309  } Others;
3310  } Parameters;
3316 
3317 #if !defined(_AMD64_) && !defined(_ARM_)
3318 #include "poppack.h"
3319 #endif
3320 
3321 
3322 /* IO_STACK_LOCATION.Control */
3323 
3324 #define SL_PENDING_RETURNED 0x01
3325 #define SL_ERROR_RETURNED 0x02
3326 #define SL_INVOKE_ON_CANCEL 0x20
3327 #define SL_INVOKE_ON_SUCCESS 0x40
3328 #define SL_INVOKE_ON_ERROR 0x80
3329 
3330 $endif (_WDMDDK_)
3331 $if (_WDMDDK_ || _DEVIOCTL_)
3332 #define METHOD_BUFFERED 0
3333 #define METHOD_IN_DIRECT 1
3334 #define METHOD_OUT_DIRECT 2
3335 #define METHOD_NEITHER 3
3336 
3337 #define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
3338 #define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
3339 
3341 $if (_WDMDDK_)
3342 #define FILE_SUPERSEDED 0x00000000
3343 #define FILE_OPENED 0x00000001
3344 #define FILE_CREATED 0x00000002
3345 #define FILE_OVERWRITTEN 0x00000003
3346 #define FILE_EXISTS 0x00000004
3347 #define FILE_DOES_NOT_EXIST 0x00000005
3348 
3349 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
3350 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
3351 
3352 /* also in winnt.h */
3353 #define FILE_LIST_DIRECTORY 0x00000001
3354 #define FILE_READ_DATA 0x00000001
3355 #define FILE_ADD_FILE 0x00000002
3356 #define FILE_WRITE_DATA 0x00000002
3357 #define FILE_ADD_SUBDIRECTORY 0x00000004
3358 #define FILE_APPEND_DATA 0x00000004
3359 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
3360 #define FILE_READ_EA 0x00000008
3361 #define FILE_WRITE_EA 0x00000010
3362 #define FILE_EXECUTE 0x00000020
3363 #define FILE_TRAVERSE 0x00000020
3364 #define FILE_DELETE_CHILD 0x00000040
3365 #define FILE_READ_ATTRIBUTES 0x00000080
3366 #define FILE_WRITE_ATTRIBUTES 0x00000100
3367 
3368 #define FILE_SHARE_READ 0x00000001
3369 #define FILE_SHARE_WRITE 0x00000002
3370 #define FILE_SHARE_DELETE 0x00000004
3371 #define FILE_SHARE_VALID_FLAGS 0x00000007
3372 
3373 #define FILE_ATTRIBUTE_READONLY 0x00000001
3374 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3375 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3376 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3377 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3378 #define FILE_ATTRIBUTE_DEVICE 0x00000040
3379 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3380 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3381 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3382 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3383 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3384 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3385 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3386 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3387 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3388 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3389 
3390 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3391 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3392 
3393 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
3394 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3395 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3396 #define FILE_VALID_SET_FLAGS 0x00000036
3397 
3398 #define FILE_SUPERSEDE 0x00000000
3399 #define FILE_OPEN 0x00000001
3400 #define FILE_CREATE 0x00000002
3401 #define FILE_OPEN_IF 0x00000003
3402 #define FILE_OVERWRITE 0x00000004
3403 #define FILE_OVERWRITE_IF 0x00000005
3404 #define FILE_MAXIMUM_DISPOSITION 0x00000005
3405 
3406 #define FILE_DIRECTORY_FILE 0x00000001
3407 #define FILE_WRITE_THROUGH 0x00000002
3408 #define FILE_SEQUENTIAL_ONLY 0x00000004
3409 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3410 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3411 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3412 #define FILE_NON_DIRECTORY_FILE 0x00000040
3413 #define FILE_CREATE_TREE_CONNECTION 0x00000080
3414 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3415 #define FILE_NO_EA_KNOWLEDGE 0x00000200
3416 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3417 #define FILE_RANDOM_ACCESS 0x00000800
3418 #define FILE_DELETE_ON_CLOSE 0x00001000
3419 #define FILE_OPEN_BY_FILE_ID 0x00002000
3420 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3421 #define FILE_NO_COMPRESSION 0x00008000
3422 #if (NTDDI_VERSION >= NTDDI_WIN7)
3423 #define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3424 #define FILE_DISALLOW_EXCLUSIVE 0x00020000
3425 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3426 #define FILE_RESERVE_OPFILTER 0x00100000
3427 #define FILE_OPEN_REPARSE_POINT 0x00200000
3428 #define FILE_OPEN_NO_RECALL 0x00400000
3429 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3430 
3431 $endif (_WDMDDK_)
3432 $if (_WDMDDK_ || _DEVIOCTL_)
3433 #define FILE_ANY_ACCESS 0x00000000
3434 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3435 #define FILE_READ_ACCESS 0x00000001
3436 #define FILE_WRITE_ACCESS 0x00000002
3437 
3439 $if (_WDMDDK_)
3440 #define FILE_ALL_ACCESS \
3441  (STANDARD_RIGHTS_REQUIRED | \
3442  SYNCHRONIZE | \
3443  0x1FF)
3444 
3445 #define FILE_GENERIC_EXECUTE \
3446  (STANDARD_RIGHTS_EXECUTE | \
3447  FILE_READ_ATTRIBUTES | \
3448  FILE_EXECUTE | \
3449  SYNCHRONIZE)
3450 
3451 #define FILE_GENERIC_READ \
3452  (STANDARD_RIGHTS_READ | \
3453  FILE_READ_DATA | \
3454  FILE_READ_ATTRIBUTES | \
3455  FILE_READ_EA | \
3456  SYNCHRONIZE)
3457 
3458 #define FILE_GENERIC_WRITE \
3459  (STANDARD_RIGHTS_WRITE | \
3460  FILE_WRITE_DATA | \
3461  FILE_WRITE_ATTRIBUTES | \
3462  FILE_WRITE_EA | \
3463  FILE_APPEND_DATA | \
3464  SYNCHRONIZE)
3465 
3466 /* end winnt.h */
3467 
3468 #define WMIREG_ACTION_REGISTER 1
3469 #define WMIREG_ACTION_DEREGISTER 2
3470 #define WMIREG_ACTION_REREGISTER 3
3471 #define WMIREG_ACTION_UPDATE_GUIDS 4
3472 #define WMIREG_ACTION_BLOCK_IRPS 5
3473 
3474 #define WMIREGISTER 0
3475 #define WMIUPDATE 1
3476 
3479 typedef VOID
3480 (NTAPI FWMI_NOTIFICATION_CALLBACK)(
3481  PVOID Wnode,
3482  PVOID Context);
3483 typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3484 
3485 #ifndef _PCI_X_
3486 #define _PCI_X_
3487 
3488 typedef struct _PCI_SLOT_NUMBER {
3489  union {
3490  struct {
3494  } bits;
3496  } u;
3498 
3499 #define PCI_TYPE0_ADDRESSES 6
3500 #define PCI_TYPE1_ADDRESSES 2
3501 #define PCI_TYPE2_ADDRESSES 5
3502 
3503 /* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3504  inheritance, even from a struct renders the type non-POD. So we use
3505  this hack */
3506 #define PCI_COMMON_HEADER_LAYOUT \
3507  USHORT VendorID; \
3508  USHORT DeviceID; \
3509  USHORT Command; \
3510  USHORT Status; \
3511  UCHAR RevisionID; \
3512  UCHAR ProgIf; \
3513  UCHAR SubClass; \
3514  UCHAR BaseClass; \
3515  UCHAR CacheLineSize; \
3516  UCHAR LatencyTimer; \
3517  UCHAR HeaderType; \
3518  UCHAR BIST; \
3519  union { \
3520  struct _PCI_HEADER_TYPE_0 { \
3521  ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
3522  ULONG CIS; \
3523  USHORT SubVendorID; \
3524  USHORT SubSystemID; \
3525  ULONG ROMBaseAddress; \
3526  UCHAR CapabilitiesPtr; \
3527  UCHAR Reserved1[3]; \
3528  ULONG Reserved2; \
3529  UCHAR InterruptLine; \
3530  UCHAR InterruptPin; \
3531  UCHAR MinimumGrant; \
3532  UCHAR MaximumLatency; \
3533  } type0; \
3534  struct _PCI_HEADER_TYPE_1 { \
3535  ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
3536  UCHAR PrimaryBus; \
3537  UCHAR SecondaryBus; \
3538  UCHAR SubordinateBus; \
3539  UCHAR SecondaryLatency; \
3540  UCHAR IOBase; \
3541  UCHAR IOLimit; \
3542  USHORT SecondaryStatus; \
3543  USHORT MemoryBase; \
3544  USHORT MemoryLimit; \
3545  USHORT PrefetchBase; \
3546  USHORT PrefetchLimit; \
3547  ULONG PrefetchBaseUpper32; \
3548  ULONG PrefetchLimitUpper32; \
3549  USHORT IOBaseUpper16; \
3550  USHORT IOLimitUpper16; \
3551  UCHAR CapabilitiesPtr; \
3552  UCHAR Reserved1[3]; \
3553  ULONG ROMBaseAddress; \
3554  UCHAR InterruptLine; \
3555  UCHAR InterruptPin; \
3556  USHORT BridgeControl; \
3557  } type1; \
3558  struct _PCI_HEADER_TYPE_2 { \
3559  ULONG SocketRegistersBaseAddress; \
3560  UCHAR CapabilitiesPtr; \
3561  UCHAR Reserved; \
3562  USHORT SecondaryStatus; \
3563  UCHAR PrimaryBus; \
3564  UCHAR SecondaryBus; \
3565  UCHAR SubordinateBus; \
3566  UCHAR SecondaryLatency; \
3567  struct { \
3568  ULONG Base; \
3569  ULONG Limit; \
3570  } Range[PCI_TYPE2_ADDRESSES-1]; \
3571  UCHAR InterruptLine; \
3572  UCHAR InterruptPin; \
3573  USHORT BridgeControl; \
3574  } type2; \
3575  } u;
3576 
3577 typedef struct _PCI_COMMON_HEADER {
3580 
3581 #ifdef __cplusplus
3582 typedef struct _PCI_COMMON_CONFIG {
3584  UCHAR DeviceSpecific[192];
3586 #else
3587 typedef struct _PCI_COMMON_CONFIG {
3589  UCHAR DeviceSpecific[192];
3591 #endif
3592 
3593 #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET(PCI_COMMON_CONFIG, DeviceSpecific))
3594 
3595 #define PCI_EXTENDED_CONFIG_LENGTH 0x1000
3596 
3597 #define PCI_MAX_DEVICES 32
3598 #define PCI_MAX_FUNCTION 8
3599 #define PCI_MAX_BRIDGE_NUMBER 0xFF
3600 #define PCI_INVALID_VENDORID 0xFFFF
3601 
3602 /* PCI_COMMON_CONFIG.HeaderType */
3603 #define PCI_MULTIFUNCTION 0x80
3604 #define PCI_DEVICE_TYPE 0x00
3605 #define PCI_BRIDGE_TYPE 0x01
3606 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
3607 
3608 #define PCI_CONFIGURATION_TYPE(PciData) \
3609  (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3610 
3611 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
3612  ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3613 
3614 /* PCI_COMMON_CONFIG.Command */
3615 #define PCI_ENABLE_IO_SPACE 0x0001
3616 #define PCI_ENABLE_MEMORY_SPACE 0x0002
3617 #define PCI_ENABLE_BUS_MASTER 0x0004
3618 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3619 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3620 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3621 #define PCI_ENABLE_PARITY 0x0040
3622 #define PCI_ENABLE_WAIT_CYCLE 0x0080
3623 #define PCI_ENABLE_SERR 0x0100
3624 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3625 #define PCI_DISABLE_LEVEL_INTERRUPT 0x0400
3626 
3627 /* PCI_COMMON_CONFIG.Status */
3628 #define PCI_STATUS_INTERRUPT_PENDING 0x0008
3629 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
3630 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
3631 #define PCI_STATUS_UDF_SUPPORTED 0x0040
3632 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3633 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3634 #define PCI_STATUS_DEVSEL 0x0600
3635 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3636 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3637 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3638 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3639 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3640 
3641 /* IO_STACK_LOCATION.Parameters.ReadWriteControl.WhichSpace */
3642 
3643 #define PCI_WHICHSPACE_CONFIG 0x0
3644 #define PCI_WHICHSPACE_ROM 0x52696350 /* 'PciR' */
3645 
3646 #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
3647 #define PCI_CAPABILITY_ID_AGP 0x02
3648 #define PCI_CAPABILITY_ID_VPD 0x03
3649 #define PCI_CAPABILITY_ID_SLOT_ID 0x04
3650 #define PCI_CAPABILITY_ID_MSI 0x05
3651 #define PCI_CAPABILITY_ID_CPCI_HOTSWAP 0x06
3652 #define PCI_CAPABILITY_ID_PCIX 0x07
3653 #define PCI_CAPABILITY_ID_HYPERTRANSPORT 0x08
3654 #define PCI_CAPABILITY_ID_VENDOR_SPECIFIC 0x09
3655 #define PCI_CAPABILITY_ID_DEBUG_PORT 0x0A
3656 #define PCI_CAPABILITY_ID_CPCI_RES_CTRL 0x0B
3657 #define PCI_CAPABILITY_ID_SHPC 0x0C
3658 #define PCI_CAPABILITY_ID_P2P_SSID 0x0D
3659 #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
3660 #define PCI_CAPABILITY_ID_SECURE 0x0F
3661 #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10
3662 #define PCI_CAPABILITY_ID_MSIX 0x11
3663 
3668 
3669 typedef struct _PCI_PMC {
3675  struct _PM_SUPPORT {
3684  } Support;
3685 } PCI_PMC, *PPCI_PMC;
3686 
3687 typedef struct _PCI_PMCSR {
3694 } PCI_PMCSR, *PPCI_PMCSR;
3695 
3696 typedef struct _PCI_PMCSR_BSE {
3701 
3702 typedef struct _PCI_PM_CAPABILITY {
3704  union {
3707  } PMC;
3708  union {
3710  USHORT AsUSHORT;
3711  } PMCSR;
3712  union {
3715  } PMCSR_BSE;
3718 
3719 typedef struct {
3721  union {
3722  struct {
3728  } bits;
3730  } Command;
3731  union {
3732  struct {
3747  } bits;
3749  } Status;
3751 
3752 #define PCI_EXPRESS_ADVANCED_ERROR_REPORTING_CAP_ID 0x0001
3753 #define PCI_EXPRESS_VIRTUAL_CHANNEL_CAP_ID 0x0002
3754 #define PCI_EXPRESS_DEVICE_SERIAL_NUMBER_CAP_ID 0x0003
3755 #define PCI_EXPRESS_POWER_BUDGETING_CAP_ID 0x0004
3756 #define PCI_EXPRESS_RC_LINK_DECLARATION_CAP_ID 0x0005
3757 #define PCI_EXPRESS_RC_INTERNAL_LINK_CONTROL_CAP_ID 0x0006
3758 #define PCI_EXPRESS_RC_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_CAP_ID 0x0007
3759 #define PCI_EXPRESS_MFVC_CAP_ID 0x0008
3760 #define PCI_EXPRESS_VC_AND_MFVC_CAP_ID 0x0009
3761 #define PCI_EXPRESS_RCRB_HEADER_CAP_ID 0x000A
3762 #define PCI_EXPRESS_SINGLE_ROOT_IO_VIRTUALIZATION_CAP_ID 0x0010
3763 
3769 
3775 
3777  _ANONYMOUS_STRUCT struct {
3793  } DUMMYSTRUCTNAME;
3796 
3798  _ANONYMOUS_STRUCT struct {
3814  } DUMMYSTRUCTNAME;
3817 
3819  _ANONYMOUS_STRUCT struct {