ReactOS 0.4.16-dev-226-g79f2289
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
139#if defined(NT_PROCESSOR_GROUPS)
140
142
143enum _IRQ_DEVICE_POLICY_USHORT {
148 IrqPolicyAllProcessorsInGroup = 3,
151
152#else /* defined(NT_PROCESSOR_GROUPS) */
153
154typedef enum _IRQ_DEVICE_POLICY {
162
163#endif
164
165typedef enum _IRQ_PRIORITY {
171
172typedef enum _IRQ_GROUP_POLICY {
176
177#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
178
183
184typedef struct _CLIENT_ID {
188
189typedef struct _VPB {
200
206
207_Function_class_(DRIVER_CONTROL)
210(NTAPI DRIVER_CONTROL)(
212 _Inout_ struct _IRP *Irp,
215typedef DRIVER_CONTROL *PDRIVER_CONTROL;
216
217typedef 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
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
288typedef 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;
306 } Queue;
308 KDEVICE_QUEUE DeviceQueue;
309 KDPC Dpc;
310 ULONG ActiveThreadCount;
312 KEVENT DeviceLock;
314 USHORT Spare1;
315 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
318
319typedef enum _IO_SESSION_STATE {
330
335
346
352
368
378
381 union {
385 } ConnectionContext;
393
396 _ANONYMOUS_UNION union {
402
405 union {
409 } ConnectionContext;
411
413{
415 union
416 {
420 } ConnectionContext;
422
423typedef enum _IO_ACCESS_TYPE {
428
429typedef enum _IO_ACCESS_MODE {
433
438
446
451
457
458#if (NTDDI_VERSION >= NTDDI_WIN7)
459
460typedef NTSTATUS
462 VOID);
463
464typedef NTSTATUS
465(NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
466 _In_ PVOID SessionObject,
472
473typedef IO_SESSION_NOTIFICATION_FUNCTION *PIO_SESSION_NOTIFICATION_FUNCTION;
474
475#endif
476
478
482 volatile LONG IoCount;
485
498
499typedef struct _IO_REMOVE_LOCK {
501#if DBG
503#endif
505
507
508_Function_class_(IO_WORKITEM_ROUTINE)
511typedef VOID
512(NTAPI IO_WORKITEM_ROUTINE)(
515typedef IO_WORKITEM_ROUTINE *PIO_WORKITEM_ROUTINE;
516
517typedef VOID
518(NTAPI IO_WORKITEM_ROUTINE_EX)(
522typedef IO_WORKITEM_ROUTINE_EX *PIO_WORKITEM_ROUTINE_EX;
523
524typedef struct _SHARE_ACCESS {
533
534typedef 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
546typedef struct _IO_STATUS_BLOCK {
547 _ANONYMOUS_UNION union {
549 PVOID Pointer;
553
554#if defined(_WIN64)
555typedef struct _IO_STATUS_BLOCK32 {
558} IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
559#endif
560
561typedef VOID
566
567#define PIO_APC_ROUTINE_DEFINED
568
569typedef 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
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
614typedef struct _BOOTDISK_INFORMATION {
620
631
632#if (NTDDI_VERSION >= NTDDI_WIN7)
633
637 _ANONYMOUS_UNION union {
643
648
649#else
650
651#if (NTDDI_VERSION >= NTDDI_VISTA)
652typedef 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
666typedef struct _EISA_MEMORY_TYPE {
675
683
684typedef struct _EISA_IRQ_DESCRIPTOR {
691
696
703
710
715
716typedef struct _EISA_PORT_DESCRIPTOR {
722
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
787typedef VOID
789 PVOID Context);
790
791typedef VOID
793 PVOID Context);
794
795_Function_class_(TRANSLATE_BUS_ADDRESS)
797typedef BOOLEAN
798(NTAPI TRANSLATE_BUS_ADDRESS)(
804typedef TRANSLATE_BUS_ADDRESS *PTRANSLATE_BUS_ADDRESS;
805
806_Function_class_(GET_DMA_ADAPTER)
808typedef struct _DMA_ADAPTER*
809(NTAPI GET_DMA_ADAPTER)(
813typedef GET_DMA_ADAPTER *PGET_DMA_ADAPTER;
814
815_Function_class_(GET_SET_DEVICE_DATA)
817typedef ULONG
818(NTAPI GET_SET_DEVICE_DATA)(
824typedef GET_SET_DEVICE_DATA *PGET_SET_DEVICE_DATA;
825
832
838
844
845typedef VOID
848
857
858typedef 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
889typedef BOOLEAN
890(NTAPI PCI_IS_DEVICE_PRESENT)(
891 _In_ USHORT VendorID,
897typedef PCI_IS_DEVICE_PRESENT *PPCI_IS_DEVICE_PRESENT;
898
901typedef BOOLEAN
902(NTAPI PCI_IS_DEVICE_PRESENT_EX)(
905typedef PCI_IS_DEVICE_PRESENT_EX *PPCI_IS_DEVICE_PRESENT_EX;
906
918
928
930typedef struct _DEVICE_CAPABILITIES {
931 _Field_range_(==, sizeof(struct _DEVICE_CAPABILITIES)) USHORT Size;
933 ULONG DeviceD1:1;
934 ULONG DeviceD2:1;
935 ULONG LockSupported:1;
936 ULONG EjectSupported: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;
952 ULONG WakeFromInterrupt:1;
953 ULONG SecureDevice:1;
954 ULONG ChildOfVgaEnabledBridge:1;
955 ULONG DecodeIoOnBoot:1;
956 ULONG Reserved:9;
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
983typedef struct _INTERFACE {
984 USHORT Size;
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
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
1076 PREPLACE_MAP_MEMORY MapMemory;
1078
1079typedef VOID
1081 VOID);
1082
1084typedef NTSTATUS
1085(NTAPI *PREPLACE_BEGIN)(
1088
1090typedef NTSTATUS
1091(NTAPI *PREPLACE_END)(
1093
1095typedef NTSTATUS
1096(NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1100
1102typedef NTSTATUS
1103(NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1107
1109typedef NTSTATUS
1110(NTAPI *PREPLACE_SWAP)(
1112
1114typedef NTSTATUS
1115(NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1117
1119typedef NTSTATUS
1120(NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1122
1124typedef NTSTATUS
1125(NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1129
1131typedef NTSTATUS
1132(NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
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
1163typedef NTSTATUS
1164(NTAPI *PREPLACE_DRIVER_INIT)(
1167
1177
1178typedef 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
1194typedef enum {
1219#undef __string_type
1220#undef __guid_type
1221#undef __multiString_type
1222
1229
1230typedef enum _IO_PRIORITY_HINT {
1238
1239#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1240
1241_Function_class_(DRIVER_NOTIFICATION_CALLBACK_ROUTINE)
1243typedef NTSTATUS
1244(NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1247typedef DRIVER_NOTIFICATION_CALLBACK_ROUTINE *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE;
1248
1249_Function_class_(DEVICE_CHANGE_COMPLETE_CALLBACK)
1251typedef VOID
1252(NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1254typedef 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
1324typedef struct _FILE_POSITION_INFORMATION {
1325 LARGE_INTEGER CurrentByteOffset;
1327
1328typedef 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
1362typedef struct _FILE_STANDARD_INFORMATION {
1364 LARGE_INTEGER EndOfFile;
1365 ULONG NumberOfLinks;
1366 BOOLEAN DeletePending;
1369
1370typedef 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
1380typedef enum _FSINFOCLASS {
1393
1394typedef struct _FILE_FS_DEVICE_INFORMATION {
1396 ULONG Characteristics;
1398
1399typedef 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)
1433typedef BOOLEAN
1434(NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1435 _In_ struct _FILE_OBJECT *FileObject,
1443typedef FAST_IO_CHECK_IF_POSSIBLE *PFAST_IO_CHECK_IF_POSSIBLE;
1444
1445_Function_class_(FAST_IO_READ)
1447typedef BOOLEAN
1448(NTAPI FAST_IO_READ)(
1449 _In_ struct _FILE_OBJECT *FileObject,
1457typedef FAST_IO_READ *PFAST_IO_READ;
1458
1459_Function_class_(FAST_IO_WRITE)
1461typedef BOOLEAN
1462(NTAPI FAST_IO_WRITE)(
1463 _In_ struct _FILE_OBJECT *FileObject,
1471typedef FAST_IO_WRITE *PFAST_IO_WRITE;
1472
1473_Function_class_(FAST_IO_QUERY_BASIC_INFO)
1475typedef BOOLEAN
1476(NTAPI FAST_IO_QUERY_BASIC_INFO)(
1477 _In_ struct _FILE_OBJECT *FileObject,
1482typedef FAST_IO_QUERY_BASIC_INFO *PFAST_IO_QUERY_BASIC_INFO;
1483
1484_Function_class_(FAST_IO_QUERY_STANDARD_INFO)
1486typedef BOOLEAN
1487(NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1488 _In_ struct _FILE_OBJECT *FileObject,
1493typedef FAST_IO_QUERY_STANDARD_INFO *PFAST_IO_QUERY_STANDARD_INFO;
1494
1495_Function_class_(FAST_IO_LOCK)
1497typedef BOOLEAN
1498(NTAPI FAST_IO_LOCK)(
1499 _In_ struct _FILE_OBJECT *FileObject,
1508typedef FAST_IO_LOCK *PFAST_IO_LOCK;
1509
1510_Function_class_(FAST_IO_UNLOCK_SINGLE)
1512typedef BOOLEAN
1513(NTAPI FAST_IO_UNLOCK_SINGLE)(
1514 _In_ struct _FILE_OBJECT *FileObject,
1518 _In_ ULONG Key,
1521typedef FAST_IO_UNLOCK_SINGLE *PFAST_IO_UNLOCK_SINGLE;
1522
1523_Function_class_(FAST_IO_UNLOCK_ALL)
1525typedef BOOLEAN
1526(NTAPI FAST_IO_UNLOCK_ALL)(
1527 _In_ struct _FILE_OBJECT *FileObject,
1531typedef FAST_IO_UNLOCK_ALL *PFAST_IO_UNLOCK_ALL;
1532
1533_Function_class_(FAST_IO_UNLOCK_ALL_BY_KEY)
1535typedef BOOLEAN
1536(NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1537 _In_ struct _FILE_OBJECT *FileObject,
1539 _In_ ULONG Key,
1542typedef FAST_IO_UNLOCK_ALL_BY_KEY *PFAST_IO_UNLOCK_ALL_BY_KEY;
1543
1544_Function_class_(FAST_IO_DEVICE_CONTROL)
1546typedef BOOLEAN
1547(NTAPI FAST_IO_DEVICE_CONTROL)(
1548 _In_ struct _FILE_OBJECT *FileObject,
1557typedef FAST_IO_DEVICE_CONTROL *PFAST_IO_DEVICE_CONTROL;
1558
1559_Function_class_(FAST_IO_ACQUIRE_FILE)
1561typedef VOID
1562(NTAPI FAST_IO_ACQUIRE_FILE)(
1563 _In_ struct _FILE_OBJECT *FileObject);
1564typedef FAST_IO_ACQUIRE_FILE *PFAST_IO_ACQUIRE_FILE;
1565
1566_Function_class_(FAST_IO_RELEASE_FILE)
1568typedef VOID
1569(NTAPI FAST_IO_RELEASE_FILE)(
1570 _In_ struct _FILE_OBJECT *FileObject);
1571typedef FAST_IO_RELEASE_FILE *PFAST_IO_RELEASE_FILE;
1572
1573_Function_class_(FAST_IO_DETACH_DEVICE)
1575typedef VOID
1576(NTAPI FAST_IO_DETACH_DEVICE)(
1579typedef FAST_IO_DETACH_DEVICE *PFAST_IO_DETACH_DEVICE;
1580
1581_Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
1583typedef BOOLEAN
1584(NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1585 _In_ struct _FILE_OBJECT *FileObject,
1590typedef FAST_IO_QUERY_NETWORK_OPEN_INFO *PFAST_IO_QUERY_NETWORK_OPEN_INFO;
1591
1592_Function_class_(FAST_IO_ACQUIRE_FOR_MOD_WRITE)
1594typedef NTSTATUS
1595(NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1596 _In_ struct _FILE_OBJECT *FileObject,
1600typedef FAST_IO_ACQUIRE_FOR_MOD_WRITE *PFAST_IO_ACQUIRE_FOR_MOD_WRITE;
1601
1602_Function_class_(FAST_IO_MDL_READ)
1604typedef BOOLEAN
1605(NTAPI FAST_IO_MDL_READ)(
1606 _In_ struct _FILE_OBJECT *FileObject,
1613typedef FAST_IO_MDL_READ *PFAST_IO_MDL_READ;
1614
1615_Function_class_(FAST_IO_MDL_READ_COMPLETE)
1617typedef BOOLEAN
1618(NTAPI FAST_IO_MDL_READ_COMPLETE)(
1619 _In_ struct _FILE_OBJECT *FileObject,
1622typedef FAST_IO_MDL_READ_COMPLETE *PFAST_IO_MDL_READ_COMPLETE;
1623
1624_Function_class_(FAST_IO_PREPARE_MDL_WRITE)
1626typedef BOOLEAN
1627(NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1628 _In_ struct _FILE_OBJECT *FileObject,
1635typedef FAST_IO_PREPARE_MDL_WRITE *PFAST_IO_PREPARE_MDL_WRITE;
1636
1637_Function_class_(FAST_IO_MDL_WRITE_COMPLETE)
1639typedef BOOLEAN
1640(NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1641 _In_ struct _FILE_OBJECT *FileObject,
1645typedef FAST_IO_MDL_WRITE_COMPLETE *PFAST_IO_MDL_WRITE_COMPLETE;
1646
1647_Function_class_(FAST_IO_READ_COMPRESSED)
1649typedef BOOLEAN
1650(NTAPI FAST_IO_READ_COMPRESSED)(
1651 _In_ struct _FILE_OBJECT *FileObject,
1661typedef FAST_IO_READ_COMPRESSED *PFAST_IO_READ_COMPRESSED;
1662
1663_Function_class_(FAST_IO_WRITE_COMPRESSED)
1665typedef BOOLEAN
1666(NTAPI FAST_IO_WRITE_COMPRESSED)(
1667 _In_ struct _FILE_OBJECT *FileObject,
1677typedef FAST_IO_WRITE_COMPRESSED *PFAST_IO_WRITE_COMPRESSED;
1678
1679_Function_class_(FAST_IO_MDL_READ_COMPLETE_COMPRESSED)
1681typedef BOOLEAN
1682(NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1683 _In_ struct _FILE_OBJECT *FileObject,
1686typedef FAST_IO_MDL_READ_COMPLETE_COMPRESSED *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED;
1687
1688_Function_class_(FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)
1690typedef BOOLEAN
1691(NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1692 _In_ struct _FILE_OBJECT *FileObject,
1696typedef FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED;
1697
1698_Function_class_(FAST_IO_QUERY_OPEN)
1700typedef BOOLEAN
1701(NTAPI FAST_IO_QUERY_OPEN)(
1702 _Inout_ struct _IRP *Irp,
1705typedef FAST_IO_QUERY_OPEN *PFAST_IO_QUERY_OPEN;
1706
1707_Function_class_(FAST_IO_RELEASE_FOR_MOD_WRITE)
1709typedef NTSTATUS
1710(NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1711 _In_ struct _FILE_OBJECT *FileObject,
1714typedef FAST_IO_RELEASE_FOR_MOD_WRITE *PFAST_IO_RELEASE_FOR_MOD_WRITE;
1715
1716_Function_class_(FAST_IO_ACQUIRE_FOR_CCFLUSH)
1718typedef NTSTATUS
1719(NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1720 _In_ struct _FILE_OBJECT *FileObject,
1722typedef FAST_IO_ACQUIRE_FOR_CCFLUSH *PFAST_IO_ACQUIRE_FOR_CCFLUSH;
1723
1724_Function_class_(FAST_IO_RELEASE_FOR_CCFLUSH)
1726typedef NTSTATUS
1727(NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1728 _In_ struct _FILE_OBJECT *FileObject,
1730typedef FAST_IO_RELEASE_FOR_CCFLUSH *PFAST_IO_RELEASE_FOR_CCFLUSH;
1731
1732typedef struct _FAST_IO_DISPATCH {
1762
1763typedef struct _SECTION_OBJECT_POINTERS {
1764 PVOID DataSectionObject;
1765 PVOID SharedCacheMap;
1766 PVOID ImageSectionObject;
1768
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
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
1967typedef struct _FILE_OBJECT {
1968 CSHORT Type;
1969 CSHORT Size;
1971 PVPB Vpb;
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
2000typedef struct _IO_ERROR_LOG_PACKET {
2015
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
2045typedef enum _DMA_WIDTH {
2051
2052typedef enum _DMA_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
2068typedef 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
2099{
2106
2107typedef 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
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
2161typedef struct _DEVICE_RELATIONS {
2163 PDEVICE_OBJECT Objects[1];
2165
2166typedef struct _DEVOBJ_EXTENSION {
2171
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
2187typedef 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
2203struct _SCATTER_GATHER_LIST;
2204typedef 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)
2212typedef NTSTATUS
2213(NTAPI DRIVER_ADD_DEVICE)(
2216typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
2217
2218typedef 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)
2231typedef NTSTATUS
2232(NTAPI DRIVER_INITIALIZE)(
2235typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
2236
2237_Function_class_(DRIVER_STARTIO)
2241typedef VOID
2242(NTAPI DRIVER_STARTIO)(
2244 _Inout_ struct _IRP *Irp);
2245typedef DRIVER_STARTIO *PDRIVER_STARTIO;
2246
2247_Function_class_(DRIVER_UNLOAD)
2250typedef VOID
2251(NTAPI DRIVER_UNLOAD)(
2253typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
2254
2258typedef NTSTATUS
2261 _Inout_ struct _IRP *Irp);
2264
2268typedef NTSTATUS
2269(NTAPI DRIVER_DISPATCH_PAGED)(
2271 _Inout_ struct _IRP *Irp);
2272typedef DRIVER_DISPATCH_PAGED *PDRIVER_DISPATCH_PAGED;
2273
2274typedef struct _DRIVER_OBJECT {
2291
2292typedef struct _DMA_ADAPTER {
2297
2298typedef enum
2299{
2305
2306typedef VOID
2308 PDMA_ADAPTER DmaAdapter);
2309
2310typedef PVOID
2312 _In_ PDMA_ADAPTER DmaAdapter,
2314 _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2315 _In_ BOOLEAN CacheEnabled);
2316
2317typedef VOID
2319 _In_ PDMA_ADAPTER DmaAdapter,
2321 _In_ PHYSICAL_ADDRESS LogicalAddress,
2323 _In_ BOOLEAN CacheEnabled);
2324
2327 _In_ PDMA_ADAPTER DmaAdapter,
2332
2333typedef BOOLEAN
2335 _In_ PDMA_ADAPTER DmaAdapter,
2336 _In_ PMDL Mdl,
2338 _In_ PVOID CurrentVa,
2341
2342typedef VOID
2344 _In_ PDMA_ADAPTER DmaAdapter);
2345
2346typedef VOID
2348 _In_ PDMA_ADAPTER DmaAdapter,
2351
2354 _In_ PDMA_ADAPTER DmaAdapter,
2355 _In_ PMDL Mdl,
2357 _In_ PVOID CurrentVa,
2360
2361typedef ULONG
2363 _In_ PDMA_ADAPTER DmaAdapter);
2364
2365typedef ULONG
2367 _In_ PDMA_ADAPTER DmaAdapter);
2368
2369_Function_class_(DRIVER_LIST_CONTROL)
2371typedef VOID
2372(NTAPI DRIVER_LIST_CONTROL)(
2374 _In_ struct _IRP *Irp,
2375 _In_ struct _SCATTER_GATHER_LIST *ScatterGather,
2377typedef DRIVER_LIST_CONTROL *PDRIVER_LIST_CONTROL;
2378
2381 _In_ PDMA_ADAPTER DmaAdapter,
2383 _In_ PMDL Mdl,
2384 _In_ PVOID CurrentVa,
2389
2390typedef VOID
2392 _In_ PDMA_ADAPTER DmaAdapter,
2395
2398 _In_ PDMA_ADAPTER DmaAdapter,
2400 _In_ PVOID CurrentVa,
2402 _Out_ PULONG ScatterGatherListSize,
2403 _Out_ OPTIONAL PULONG pNumberOfMapRegisters);
2404
2407 _In_ PDMA_ADAPTER DmaAdapter,
2409 _In_ PMDL Mdl,
2410 _In_ PVOID CurrentVa,
2415 _In_ PVOID ScatterGatherBuffer,
2416 _In_ ULONG ScatterGatherLength);
2417
2420 _In_ PDMA_ADAPTER DmaAdapter,
2422 _In_ PMDL OriginalMdl,
2424
2427 _In_ PDMA_ADAPTER DmaAdapter,
2428 _Inout_ PDMA_ADAPTER_INFO AdapterInfo);
2429
2432 _In_ PDMA_ADAPTER DmaAdapter,
2433 _In_ PMDL Mdl,
2436 _In_ BOOLEAN WriteOnly,
2437 _Inout_ PDMA_TRANSFER_INFO TransferInfo);
2438
2441 _In_ PDMA_ADAPTER DmaAdapter,
2442 _Out_ PVOID DmaTransferContext);
2443
2444typedef PVOID
2446 _In_ PDMA_ADAPTER DmaAdapter,
2447 _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2449 _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2450 _In_ BOOLEAN CacheEnabled,
2451 _In_ NODE_REQUIREMENT PreferredNode);
2452
2455 _In_ PDMA_ADAPTER DmaAdapter,
2457 _In_ PVOID DmaTransferContext,
2461 _In_opt_ PVOID ExecutionContext,
2463
2466 _In_ PDMA_ADAPTER DmaAdapter,
2467 _In_ ULONG FunctionNumber,
2469
2470typedef BOOLEAN
2472 _In_ PDMA_ADAPTER DmaAdapter,
2474 _In_ PVOID DmaTransferContext);
2475
2476typedef
2477_Function_class_(DMA_COMPLETION_ROUTINE)
2480VOID
2481NTAPI
2482DMA_COMPLETION_ROUTINE(
2483 _In_ PDMA_ADAPTER DmaAdapter,
2487
2488typedef DMA_COMPLETION_ROUTINE *PDMA_COMPLETION_ROUTINE;
2489
2492 _In_ PDMA_ADAPTER DmaAdapter,
2493 _In_ PMDL Mdl,
2499 _Out_writes_bytes_opt_(ScatterGatherBufferLength) PSCATTER_GATHER_LIST ScatterGatherBuffer,
2500 _In_ ULONG ScatterGatherBufferLength,
2503
2506 _In_ PDMA_ADAPTER DmaAdapter,
2508 _In_ PVOID DmaTransferContext,
2509 _In_ PMDL Mdl,
2518 _Out_opt_ PSCATTER_GATHER_LIST *ScatterGatherList);
2519
2522 _In_ PDMA_ADAPTER DmaAdapter,
2524 _In_ PVOID DmaTransferContext,
2525 _In_ PMDL Mdl,
2532 _In_ PVOID ScatterGatherBuffer,
2533 _In_ ULONG ScatterGatherLength,
2536 _Out_opt_ PVOID ScatterGatherList);
2537
2540 _In_ PDMA_ADAPTER DmaAdapter,
2541 _In_ PMDL Mdl,
2546
2547typedef VOID
2549 _In_ PDMA_ADAPTER DmaAdapter,
2550 _In_ IO_ALLOCATION_ACTION AllocationAction);
2551
2554 _In_ PDMA_ADAPTER DmaAdapter,
2555 _In_ PVOID DmaTransferContext);
2556
2559 _In_ PDMA_ADAPTER DmaAdapter,
2560 _In_ HANDLE DomainHandle,
2561 _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2565 _In_ NODE_REQUIREMENT PreferredNode,
2566 _Out_ PPHYSICAL_ADDRESS LogicalAddress,
2568
2571 _In_ PDMA_ADAPTER DmaAdapter,
2572 _In_ PMDL Mdl,
2573 _In_ BOOLEAN ReadOperation);
2574
2577 _In_ PDMA_ADAPTER DmaAdapter,
2578 _In_ HANDLE DomainHandle);
2579
2582 _In_ PDMA_ADAPTER DmaAdapter);
2583
2584typedef HANDLE
2586 _In_ PDMA_ADAPTER DmaAdapter);
2587
2588typedef PVOID
2590 _In_ PDMA_ADAPTER DmaAdapter,
2591 _In_opt_ PPHYSICAL_ADDRESS MinimumAddress,
2592 _In_opt_ PPHYSICAL_ADDRESS MaximumAddress,
2596 _In_ NODE_REQUIREMENT PreferredNode,
2597 _Out_ PPHYSICAL_ADDRESS LogicalAddress);
2598
2599typedef struct _DMA_COMMON_BUFFER_VECTOR DMA_COMMON_BUFFER_VECTOR, *PDMA_COMMON_BUFFER_VECTOR;
2600
2603 _In_ PDMA_ADAPTER DmaAdapter,
2604 _In_ PHYSICAL_ADDRESS LowAddress,
2607 _In_ ULONG IdealNode,
2609 _In_ ULONG NumberOfElements,
2610 _In_ ULONGLONG SizeOfElements,
2611 _Out_ PDMA_COMMON_BUFFER_VECTOR *VectorOut);
2612
2613typedef VOID
2615 _In_ PDMA_ADAPTER DmaAdapter,
2618 _Out_ PVOID *VirtualAddressOut,
2619 _Out_ PPHYSICAL_ADDRESS LogicalAddressOut);
2620
2621typedef VOID
2623 _In_ PDMA_ADAPTER DmaAdapter,
2625 _In_ ULONG Index);
2626
2627typedef VOID
2629 _In_ PDMA_ADAPTER DmaAdapter,
2631
2632typedef struct _DMA_OPERATIONS {
2673
2674typedef 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;
2685 PHYSICAL_ADDRESS MinimumAddress;
2686 PHYSICAL_ADDRESS MaximumAddress;
2688 struct {
2689 ULONG Length;
2691 PHYSICAL_ADDRESS MinimumAddress;
2692 PHYSICAL_ADDRESS MaximumAddress;
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;
2706 struct {
2707 ULONG MinimumChannel;
2708 ULONG MaximumChannel;
2709 } Dma;
2710 struct {
2711 ULONG Length;
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;
2725 struct {
2729 } ConfigData;
2730 } u;
2732
2733typedef struct _IO_RESOURCE_LIST {
2739
2749
2750_Function_class_(DRIVER_CANCEL)
2751_Requires_lock_held_(_Global_cancel_spin_lock_)
2752_Releases_lock_(_Global_cancel_spin_lock_)
2755typedef VOID
2756(NTAPI DRIVER_CANCEL)(
2759typedef DRIVER_CANCEL *PDRIVER_CANCEL;
2760
2761typedef 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;
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;
2789 PVOID UserApcContext;
2790 } AsynchronousParameters;
2792 } Overlay;
2794 PVOID UserBuffer;
2795 union {
2796 struct {
2797 _ANONYMOUS_UNION union {
2799 _ANONYMOUS_STRUCT struct {
2804 PCHAR AuxiliaryBuffer;
2805 _ANONYMOUS_STRUCT struct {
2806 LIST_ENTRY ListEntry;
2807 _ANONYMOUS_UNION union {
2808 struct _IO_STACK_LOCATION *CurrentStackLocation;
2809 ULONG PacketType;
2812 struct _FILE_OBJECT *OriginalFileObject;
2813 } Overlay;
2814 KAPC Apc;
2815 PVOID CompletionKey;
2816 } Tail;
2818
2826
2827_Function_class_(IO_COMPLETION_ROUTINE)
2830typedef NTSTATUS
2831(NTAPI IO_COMPLETION_ROUTINE)(
2833 _In_ struct _IRP *Irp,
2834 _In_reads_opt_(_Inexpressible_("varies")) PVOID Context);
2835typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
2836
2837_Function_class_(IO_DPC_ROUTINE)
2841typedef VOID
2842(NTAPI IO_DPC_ROUTINE)(
2847typedef IO_DPC_ROUTINE *PIO_DPC_ROUTINE;
2848
2852
2855 VOID);
2856
2857_Function_class_(IO_TIMER_ROUTINE)
2859typedef VOID
2860(NTAPI IO_TIMER_ROUTINE)(
2863typedef IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
2864
2871
2872struct _IO_CSQ;
2873
2874typedef struct _IO_CSQ_IRP_CONTEXT {
2875 ULONG Type;
2876 struct _IRP *Irp;
2877 struct _IO_CSQ *Csq;
2879
2880typedef VOID
2881(NTAPI IO_CSQ_INSERT_IRP)(
2882 _In_ struct _IO_CSQ *Csq,
2884typedef IO_CSQ_INSERT_IRP *PIO_CSQ_INSERT_IRP;
2885
2886typedef NTSTATUS
2887(NTAPI IO_CSQ_INSERT_IRP_EX)(
2888 _In_ struct _IO_CSQ *Csq,
2889 _In_ PIRP Irp,
2891typedef IO_CSQ_INSERT_IRP_EX *PIO_CSQ_INSERT_IRP_EX;
2892
2893typedef VOID
2894(NTAPI IO_CSQ_REMOVE_IRP)(
2895 _In_ struct _IO_CSQ *Csq,
2896 _In_ PIRP Irp);
2897typedef IO_CSQ_REMOVE_IRP *PIO_CSQ_REMOVE_IRP;
2898
2899typedef PIRP
2900(NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2901 _In_ struct _IO_CSQ *Csq,
2902 _In_ PIRP Irp,
2904typedef IO_CSQ_PEEK_NEXT_IRP *PIO_CSQ_PEEK_NEXT_IRP;
2905
2906typedef VOID
2907(NTAPI IO_CSQ_ACQUIRE_LOCK)(
2908 _In_ struct _IO_CSQ *Csq,
2910typedef IO_CSQ_ACQUIRE_LOCK *PIO_CSQ_ACQUIRE_LOCK;
2911
2912typedef VOID
2913(NTAPI IO_CSQ_RELEASE_LOCK)(
2914 _In_ struct _IO_CSQ *Csq,
2915 _In_ KIRQL Irql);
2916typedef IO_CSQ_RELEASE_LOCK *PIO_CSQ_RELEASE_LOCK;
2917
2918typedef VOID
2919(NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2920 _In_ struct _IO_CSQ *Csq,
2921 _In_ PIRP Irp);
2922typedef IO_CSQ_COMPLETE_CANCELED_IRP *PIO_CSQ_COMPLETE_CANCELED_IRP;
2923
2924typedef struct _IO_CSQ {
2925 ULONG Type;
2932 PVOID ReservePointer;
2934
2943
2944typedef enum _DEVICE_TEXT_TYPE {
2948
2949typedef BOOLEAN
2951 PVOID,
2952 PVOID);
2953
2956typedef NTSTATUS
2957(NTAPI *PGPE_CONNECT_VECTOR)(
2964 PVOID);
2965
2968typedef NTSTATUS
2969(NTAPI *PGPE_DISCONNECT_VECTOR)(
2970 PVOID);
2971
2974typedef NTSTATUS
2975(NTAPI *PGPE_ENABLE_EVENT)(
2977 PVOID);
2978
2981typedef NTSTATUS
2982(NTAPI *PGPE_DISABLE_EVENT)(
2984 PVOID);
2985
2988typedef NTSTATUS
2989(NTAPI *PGPE_CLEAR_STATUS)(
2991 PVOID);
2992
2993typedef VOID
2995 PVOID,
2996 ULONG);
2997
3000typedef NTSTATUS
3001(NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3004 PVOID);
3005
3007typedef VOID
3008(NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3011
3018 PGPE_CONNECT_VECTOR GpeConnectVector;
3019 PGPE_DISCONNECT_VECTOR GpeDisconnectVector;
3020 PGPE_ENABLE_EVENT GpeEnableEvent;
3021 PGPE_DISABLE_EVENT GpeDisableEvent;
3022 PGPE_CLEAR_STATUS GpeClearStatus;
3023 PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications;
3024 PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications;
3026
3027typedef BOOLEAN
3031
3034typedef NTSTATUS
3035(NTAPI *PGPE_CONNECT_VECTOR2)(
3036 PVOID Context,
3043
3046typedef NTSTATUS
3047(NTAPI *PGPE_DISCONNECT_VECTOR2)(
3048 PVOID Context,
3050
3053typedef NTSTATUS
3054(NTAPI *PGPE_ENABLE_EVENT2)(
3055 PVOID Context,
3057
3060typedef NTSTATUS
3061(NTAPI *PGPE_DISABLE_EVENT2)(
3062 PVOID Context,
3064
3067typedef NTSTATUS
3068(NTAPI *PGPE_CLEAR_STATUS2)(
3069 PVOID Context,
3071
3073typedef VOID
3074(NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
3077
3080typedef NTSTATUS
3081(NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3082 PVOID Context,
3083 PDEVICE_NOTIFY_CALLBACK2 NotificationHandler,
3085
3087typedef VOID
3088(NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3089 PVOID Context);
3090
3097 PGPE_CONNECT_VECTOR2 GpeConnectVector;
3098 PGPE_DISCONNECT_VECTOR2 GpeDisconnectVector;
3099 PGPE_ENABLE_EVENT2 GpeEnableEvent;
3100 PGPE_DISABLE_EVENT2 GpeDisableEvent;
3101 PGPE_CLEAR_STATUS2 GpeClearStatus;
3102 PREGISTER_FOR_DEVICE_NOTIFICATIONS2 RegisterForDeviceNotifications;
3103 PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2 UnregisterForDeviceNotifications;
3105
3106#if !defined(_AMD64_) && !defined(_ARM_)
3107#include <pshpack4.h>
3108#endif
3109
3110typedef struct _IO_STACK_LOCATION {
3115 union {
3116 struct {
3123 struct {
3125 ULONG Options;
3130 struct {
3131 PIO_SECURITY_CONTEXT SecurityContext;
3132 ULONG Options;
3137 struct {
3142 struct {
3143 ULONG Length;
3147 struct {
3148 ULONG Length;
3152 } QueryDirectory;
3153 struct {
3154 ULONG Length;
3156 } NotifyDirectory;
3157 struct {
3158 ULONG Length;
3161 } NotifyDirectoryEx;
3162 struct {
3163 ULONG Length;
3165 } QueryFile;
3166 struct {
3167 ULONG Length;
3170 _ANONYMOUS_UNION union {
3171 _ANONYMOUS_STRUCT struct {
3178 } SetFile;
3179 struct {
3180 ULONG Length;
3184 } QueryEa;
3185 struct {
3186 ULONG Length;
3187 } SetEa;
3188 struct {
3189 ULONG Length;
3191 } QueryVolume;
3192 struct {
3193 ULONG Length;
3195 } SetVolume;
3196 struct {
3201 } FileSystemControl;
3202 struct {
3206 } LockControl;
3207 struct {
3211 PVOID Type3InputBuffer;
3213 struct {
3216 } QuerySecurity;
3217 struct {
3220 } SetSecurity;
3221 struct {
3225 struct {
3226 PVPB Vpb;
3228 } VerifyVolume;
3229 struct {
3231 } Scsi;
3232 struct {
3233 ULONG Length;
3237 } QueryQuota;
3238 struct {
3239 ULONG Length;
3240 } SetQuota;
3241 struct {
3243 } QueryDeviceRelations;
3244 struct {
3251 struct {
3254 struct {
3256 } FilterResourceRequirements;
3257 struct {
3262 } ReadWriteConfig;
3263 struct {
3265 } SetLock;
3266 struct {
3268 } QueryId;
3269 struct {
3272 } QueryDeviceText;
3273 struct {
3277 } UsageNotification;
3278 struct {
3280 } WaitWake;
3281 struct {
3283 } PowerSequence;
3284 struct {
3285 union {
3287#if (NTDDI_VERSION >= NTDDI_VISTA)
3289#endif // (NTDDI_VERSION >= NTDDI_VISTA)
3290 };
3294 } Power;
3295 struct {
3299 struct {
3303 PVOID Buffer;
3304 } WMI;
3305 struct {
3310 } Others;
3317
3318#if !defined(_AMD64_) && !defined(_ARM_)
3319#include "poppack.h"
3320#endif
3321
3322
3323/* IO_STACK_LOCATION.Control */
3324
3325#define SL_PENDING_RETURNED 0x01
3326#define SL_ERROR_RETURNED 0x02
3327#define SL_INVOKE_ON_CANCEL 0x20
3328#define SL_INVOKE_ON_SUCCESS 0x40
3329#define SL_INVOKE_ON_ERROR 0x80
3330
3333#define METHOD_BUFFERED 0
3334#define METHOD_IN_DIRECT 1
3335#define METHOD_OUT_DIRECT 2
3336#define METHOD_NEITHER 3
3337
3338#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
3339#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
3340
3342$if (_WDMDDK_)
3343#define FILE_SUPERSEDED 0x00000000
3344#define FILE_OPENED 0x00000001
3345#define FILE_CREATED 0x00000002
3346#define FILE_OVERWRITTEN 0x00000003
3347#define FILE_EXISTS 0x00000004
3348#define FILE_DOES_NOT_EXIST 0x00000005
3349
3350#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
3351#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
3352
3353/* also in winnt.h */
3354#define FILE_LIST_DIRECTORY 0x00000001
3355#define FILE_READ_DATA 0x00000001
3356#define FILE_ADD_FILE 0x00000002
3357#define FILE_WRITE_DATA 0x00000002
3358#define FILE_ADD_SUBDIRECTORY 0x00000004
3359#define FILE_APPEND_DATA 0x00000004
3360#define FILE_CREATE_PIPE_INSTANCE 0x00000004
3361#define FILE_READ_EA 0x00000008
3362#define FILE_WRITE_EA 0x00000010
3363#define FILE_EXECUTE 0x00000020
3364#define FILE_TRAVERSE 0x00000020
3365#define FILE_DELETE_CHILD 0x00000040
3366#define FILE_READ_ATTRIBUTES 0x00000080
3367#define FILE_WRITE_ATTRIBUTES 0x00000100
3368
3369#define FILE_SHARE_READ 0x00000001
3370#define FILE_SHARE_WRITE 0x00000002
3371#define FILE_SHARE_DELETE 0x00000004
3372#define FILE_SHARE_VALID_FLAGS 0x00000007
3373
3374#define FILE_ATTRIBUTE_READONLY 0x00000001
3375#define FILE_ATTRIBUTE_HIDDEN 0x00000002
3376#define FILE_ATTRIBUTE_SYSTEM 0x00000004
3377#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3378#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3379#define FILE_ATTRIBUTE_DEVICE 0x00000040
3380#define FILE_ATTRIBUTE_NORMAL 0x00000080
3381#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3382#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3383#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3384#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3385#define FILE_ATTRIBUTE_OFFLINE 0x00001000
3386#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3387#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3388#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
3389#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
3390
3391#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3392#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
3393
3394#define FILE_VALID_OPTION_FLAGS 0x00ffffff
3395#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
3396#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
3397#define FILE_VALID_SET_FLAGS 0x00000036
3398
3399#define FILE_SUPERSEDE 0x00000000
3400#define FILE_OPEN 0x00000001
3401#define FILE_CREATE 0x00000002
3402#define FILE_OPEN_IF 0x00000003
3403#define FILE_OVERWRITE 0x00000004
3404#define FILE_OVERWRITE_IF 0x00000005
3405#define FILE_MAXIMUM_DISPOSITION 0x00000005
3406
3407#define FILE_DIRECTORY_FILE 0x00000001
3408#define FILE_WRITE_THROUGH 0x00000002
3409#define FILE_SEQUENTIAL_ONLY 0x00000004
3410#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
3411#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
3412#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
3413#define FILE_NON_DIRECTORY_FILE 0x00000040
3414#define FILE_CREATE_TREE_CONNECTION 0x00000080
3415#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
3416#define FILE_NO_EA_KNOWLEDGE 0x00000200
3417#define FILE_OPEN_REMOTE_INSTANCE 0x00000400
3418#define FILE_RANDOM_ACCESS 0x00000800
3419#define FILE_DELETE_ON_CLOSE 0x00001000
3420#define FILE_OPEN_BY_FILE_ID 0x00002000
3421#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
3422#define FILE_NO_COMPRESSION 0x00008000
3423#if (NTDDI_VERSION >= NTDDI_WIN7)
3424#define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
3425#define FILE_DISALLOW_EXCLUSIVE 0x00020000
3426#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3427#define FILE_RESERVE_OPFILTER 0x00100000
3428#define FILE_OPEN_REPARSE_POINT 0x00200000
3429#define FILE_OPEN_NO_RECALL 0x00400000
3430#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
3431
3434#define FILE_ANY_ACCESS 0x00000000
3435#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
3436#define FILE_READ_ACCESS 0x00000001
3437#define FILE_WRITE_ACCESS 0x00000002
3438
3440$if (_WDMDDK_)
3441#define FILE_ALL_ACCESS \
3442 (STANDARD_RIGHTS_REQUIRED | \
3443 SYNCHRONIZE | \
3444 0x1FF)
3445
3446#define FILE_GENERIC_EXECUTE \
3447 (STANDARD_RIGHTS_EXECUTE | \
3448 FILE_READ_ATTRIBUTES | \
3449 FILE_EXECUTE | \
3450 SYNCHRONIZE)
3451
3452#define FILE_GENERIC_READ \
3453 (STANDARD_RIGHTS_READ | \
3454 FILE_READ_DATA | \
3455 FILE_READ_ATTRIBUTES | \
3456 FILE_READ_EA | \
3457 SYNCHRONIZE)
3458
3459#define FILE_GENERIC_WRITE \
3460 (STANDARD_RIGHTS_WRITE | \
3461 FILE_WRITE_DATA | \
3462 FILE_WRITE_ATTRIBUTES | \
3463 FILE_WRITE_EA | \
3464 FILE_APPEND_DATA | \
3465 SYNCHRONIZE)
3466
3467/* end winnt.h */
3468
3469#define WMIREG_ACTION_REGISTER 1
3470#define WMIREG_ACTION_DEREGISTER 2
3471#define WMIREG_ACTION_REREGISTER 3
3472#define WMIREG_ACTION_UPDATE_GUIDS 4
3473#define WMIREG_ACTION_BLOCK_IRPS 5
3474
3475#define WMIREGISTER 0
3476#define WMIUPDATE 1
3477
3480typedef VOID
3481(NTAPI FWMI_NOTIFICATION_CALLBACK)(
3482 PVOID Wnode,
3483 PVOID Context);
3484typedef FWMI_NOTIFICATION_CALLBACK *WMI_NOTIFICATION_CALLBACK;
3485
3486#ifndef _PCI_X_
3487#define _PCI_X_
3488
3489typedef struct _PCI_SLOT_NUMBER {
3490 union {
3491 struct {
3497 } u;
3499
3500#define PCI_TYPE0_ADDRESSES 6
3501#define PCI_TYPE1_ADDRESSES 2
3502#define PCI_TYPE2_ADDRESSES 5
3503
3504/* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
3505 inheritance, even from a struct renders the type non-POD. So we use
3506 this hack */
3507#define PCI_COMMON_HEADER_LAYOUT \
3508 USHORT VendorID; \
3509 USHORT DeviceID; \
3510 USHORT Command; \
3511 USHORT Status; \
3512 UCHAR RevisionID; \
3513 UCHAR ProgIf; \
3514 UCHAR SubClass; \