9#define STATUS_CONTINUE_COMPLETION STATUS_SUCCESS
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
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
23#define IO_TYPE_ADAPTER 1
24#define IO_TYPE_CONTROLLER 2
25#define IO_TYPE_DEVICE 3
26#define IO_TYPE_DRIVER 4
29#define IO_TYPE_MASTER_ADAPTER 7
30#define IO_TYPE_OPEN_PACKET 8
31#define IO_TYPE_TIMER 9
33#define IO_TYPE_ERROR_LOG 11
34#define IO_TYPE_ERROR_MESSAGE 12
35#define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
37#define IO_TYPE_CSQ_IRP_CONTEXT 1
39#define IO_TYPE_CSQ_EX 3
42#define IO_RESOURCE_PREFERRED 0x01
43#define IO_RESOURCE_DEFAULT 0x02
44#define IO_RESOURCE_ALTERNATIVE 0x08
49#define DEVICE_TYPE ULONG
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
139#if defined(NT_PROCESSOR_GROUPS)
143enum _IRQ_DEVICE_POLICY_USHORT {
148 IrqPolicyAllProcessorsInGroup = 3,
177#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
210(
NTAPI DRIVER_CONTROL)(
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
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
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
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
288typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)
_DEVICE_OBJECT {
295 struct _IRP *CurrentIrp;
298 ULONG Characteristics;
300 PVOID DeviceExtension;
310 ULONG ActiveThreadCount;
458#if (NTDDI_VERSION >= NTDDI_WIN7)
465(
NTAPI IO_SESSION_NOTIFICATION_FUNCTION)(
512(
NTAPI IO_WORKITEM_ROUTINE)(
518(
NTAPI IO_WORKITEM_ROUTINE_EX)(
540#define IO_FORCE_ACCESS_CHECK 0x001
541#define IO_NO_PARAMETER_CHECKING 0x100
543#define IO_REPARSE 0x0
544#define IO_REMOUNT 0x1
555typedef struct _IO_STATUS_BLOCK32 {
558} IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
567#define PIO_APC_ROUTINE_DEFINED
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
588#define IO_SESSION_STATE_VALID_EVENT_MASK 0x0000003f
590#define IO_SESSION_MAX_PAYLOAD_SIZE 256L
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
612#define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
632#if (NTDDI_VERSION >= NTDDI_WIN7)
651#if (NTDDI_VERSION >= NTDDI_VISTA)
653 ULONG BootDeviceSignature;
654 ULONG SystemDeviceSignature;
656 GUID SystemDeviceGuid;
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)
771#define EISA_MORE_ENTRIES 0x80
772#define EISA_SYSTEM_MEMORY 0x00
773#define EISA_MEMORY_TYPE_RAM 0x01
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
798(
NTAPI TRANSLATE_BUS_ADDRESS)(
809(
NTAPI GET_DMA_ADAPTER)(
818(
NTAPI GET_SET_DEVICE_DATA)(
863#define PCI_DEVICE_PRESENT_INTERFACE_VERSION 1
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
890(
NTAPI PCI_IS_DEVICE_PRESENT)(
902(
NTAPI PCI_IS_DEVICE_PRESENT_EX)(
930typedef struct _DEVICE_CAPABILITIES {
935 ULONG LockSupported:1;
936 ULONG EjectSupported:1;
940 ULONG SilentInstall:1;
942 ULONG SurpriseRemovalOK:1;
947 ULONG HardwareDisabled: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;
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
1024#if (NTDDI_VERSION >= NTDDI_VISTA)
1026#define PLUGPLAY_PROPERTY_PERSISTENT 0x00000001
1029#define PNP_REPLACE_NO_MAP MAXLONGLONG
1033(
NTAPI *PREPLACE_MAP_MEMORY)(
1065#define PNP_REPLACE_PARAMETERS_VERSION 2
1085(
NTAPI *PREPLACE_BEGIN)(
1091(
NTAPI *PREPLACE_END)(
1096(
NTAPI *PREPLACE_MIRROR_PHYSICAL_MEMORY)(
1103(
NTAPI *PREPLACE_SET_PROCESSOR_ID)(
1110(
NTAPI *PREPLACE_SWAP)(
1115(
NTAPI *PREPLACE_INITIATE_HARDWARE_MIRROR)(
1120(
NTAPI *PREPLACE_MIRROR_PLATFORM_MEMORY)(
1125(
NTAPI *PREPLACE_GET_MEMORY_DESTINATION)(
1132(
NTAPI *PREPLACE_ENABLE_DISABLE_HARDWARE_QUIESCE)(
1136#define PNP_REPLACE_DRIVER_INTERFACE_VERSION 1
1137#define PNP_REPLACE_DRIVER_INTERFACE_MINIMUM_SIZE \
1138 FIELD_OFFSET(PNP_REPLACE_DRIVER_INTERFACE, InitiateHardwareMirror)
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
1164(
NTAPI *PREPLACE_DRIVER_INIT)(
1185#define __string_type 0x1000
1186#define __guid_type 0x2000
1187#define __multiString_type 0x4000
1189#define __string_type 0
1190#define __guid_type 0
1191#define __multiString_type 0
1221#undef __multiString_type
1239#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1244(
NTAPI DRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1252(
NTAPI DEVICE_CHANGE_COMPLETE_CALLBACK)(
1297#if (NTDDI_VERSION >= NTDDI_VISTA)
1308#if (NTDDI_VERSION >= NTDDI_WIN7)
1365 ULONG NumberOfLinks;
1396 ULONG Characteristics;
1400 ULONG NextEntryOffset;
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
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)
1434(
NTAPI FAST_IO_CHECK_IF_POSSIBLE)(
1448(
NTAPI FAST_IO_READ)(
1462(
NTAPI FAST_IO_WRITE)(
1476(
NTAPI FAST_IO_QUERY_BASIC_INFO)(
1487(
NTAPI FAST_IO_QUERY_STANDARD_INFO)(
1498(
NTAPI FAST_IO_LOCK)(
1513(
NTAPI FAST_IO_UNLOCK_SINGLE)(
1526(
NTAPI FAST_IO_UNLOCK_ALL)(
1536(
NTAPI FAST_IO_UNLOCK_ALL_BY_KEY)(
1547(
NTAPI FAST_IO_DEVICE_CONTROL)(
1562(
NTAPI FAST_IO_ACQUIRE_FILE)(
1569(
NTAPI FAST_IO_RELEASE_FILE)(
1576(
NTAPI FAST_IO_DETACH_DEVICE)(
1584(
NTAPI FAST_IO_QUERY_NETWORK_OPEN_INFO)(
1595(
NTAPI FAST_IO_ACQUIRE_FOR_MOD_WRITE)(
1605(
NTAPI FAST_IO_MDL_READ)(
1618(
NTAPI FAST_IO_MDL_READ_COMPLETE)(
1627(
NTAPI FAST_IO_PREPARE_MDL_WRITE)(
1640(
NTAPI FAST_IO_MDL_WRITE_COMPLETE)(
1650(
NTAPI FAST_IO_READ_COMPRESSED)(
1666(
NTAPI FAST_IO_WRITE_COMPRESSED)(
1682(
NTAPI FAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
1691(
NTAPI FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
1701(
NTAPI FAST_IO_QUERY_OPEN)(
1710(
NTAPI FAST_IO_RELEASE_FOR_MOD_WRITE)(
1719(
NTAPI FAST_IO_ACQUIRE_FOR_CCFLUSH)(
1727(
NTAPI FAST_IO_RELEASE_FOR_CCFLUSH)(
1764 PVOID DataSectionObject;
1765 PVOID SharedCacheMap;
1766 PVOID ImageSectionObject;
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
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
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
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
1829#define SL_READ_ACCESS_GRANTED 0x01
1830#define SL_WRITE_ACCESS_GRANTED 0x04
1832#define SL_FAIL_IMMEDIATELY 0x01
1833#define SL_EXCLUSIVE_LOCK 0x02
1835#define SL_RESTART_SCAN 0x01
1836#define SL_RETURN_SINGLE_ENTRY 0x02
1837#define SL_INDEX_SPECIFIED 0x04
1839#define SL_WATCH_TREE 0x01
1841#define SL_ALLOW_RAW_MOUNT 0x01
1845#define CTL_CODE(DeviceType, Function, Method, Access) \
1846 (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1848#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1850#define METHOD_FROM_CTL_CODE(ctrlCode) ((ULONG)(ctrlCode & 3))
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
1873#define IRP_RETRY_IO_COMPLETION 0x00004000
1874#define IRP_CLASS_CACHE_OPERATION 0x00008000
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
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
1918#define IRP_MN_SCSI_CLASS 0x01
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
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
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
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
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
1965#define IRP_MN_REGINFO_EX 0x0b
1967typedef struct _FILE_OBJECT {
1975 PVOID PrivateCacheMap;
1977 struct _FILE_OBJECT *RelatedFileObject;
1989 volatile ULONG Waiters;
1990 volatile ULONG Busy;
1997 volatile PVOID FileObjectExtension;
2027#define PORT_MAXIMUM_MESSAGE_LENGTH 512
2029#define PORT_MAXIMUM_MESSAGE_LENGTH 256
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)
2063#define DEVICE_DESCRIPTION_VERSION 0x0000
2064#define DEVICE_DESCRIPTION_VERSION1 0x0001
2065#define DEVICE_DESCRIPTION_VERSION2 0x0002
2066#define DEVICE_DESCRIPTION_VERSION3 0x0003
2085#if (NTDDI_VERSION >= NTDDI_WIN8)
2093#define DMA_ADAPTER_INFO_VERSION1 1
2095#define ADAPTER_INFO_SYNCHRONOUS_CALLBACK 0x0001
2096#define ADAPTER_INFO_API_BYPASS 0x0002
2116#define DMA_TRANSFER_INFO_VERSION1 1
2117#define DMA_TRANSFER_INFO_VERSION2 2
2143#define DMA_TRANSFER_CONTEXT_VERSION1 1
2146#define DMA_TRANSFER_CONTEXT_SIZE_V1 128
2148#define DMA_TRANSFER_CONTEXT_SIZE_V1 64
2178#if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
2180#if defined(_MSC_VER)
2182#pragma warning(push)
2184#pragma warning(disable:4200)
2187typedef struct _SCATTER_GATHER_LIST {
2188 ULONG NumberOfElements;
2193#if defined(_MSC_VER)
2197#pragma warning(default:4200)
2203struct _SCATTER_GATHER_LIST;
2213(
NTAPI DRIVER_ADD_DEVICE)(
2225#define DRVO_UNLOAD_INVOKED 0x00000001
2226#define DRVO_LEGACY_DRIVER 0x00000002
2227#define DRVO_BUILTIN_DRIVER 0x00000004
2232(
NTAPI DRIVER_INITIALIZE)(
2242(
NTAPI DRIVER_STARTIO)(
2251(
NTAPI DRIVER_UNLOAD)(
2269(
NTAPI DRIVER_DISPATCH_PAGED)(
2372(
NTAPI DRIVER_LIST_CONTROL)(
2482DMA_COMPLETION_ROUTINE(
2677 UCHAR ShareDisposition;
2695 ULONG MinimumVector;
2696 ULONG MaximumVector;
2697#if defined(NT_PROCESSOR_GROUPS)
2707 ULONG MinimumChannel;
2708 ULONG MaximumChannel;
2756(
NTAPI DRIVER_CANCEL)(
2761typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT)
_IRP {
2764 struct _MDL *MdlAddress;
2767 struct _IRP *MasterIrp;
2768 volatile LONG IrpCount;
2776 CHAR CurrentLocation;
2779 CCHAR ApcEnvironment;
2780 UCHAR AllocationFlags;
2787 PVOID IssuingProcess;
2789 PVOID UserApcContext;
2790 } AsynchronousParameters;
2804 PCHAR AuxiliaryBuffer;
2812 struct _FILE_OBJECT *OriginalFileObject;
2815 PVOID CompletionKey;
2831(
NTAPI IO_COMPLETION_ROUTINE)(
2842(
NTAPI IO_DPC_ROUTINE)(
2860(
NTAPI IO_TIMER_ROUTINE)(
2881(
NTAPI IO_CSQ_INSERT_IRP)(
2887(
NTAPI IO_CSQ_INSERT_IRP_EX)(
2894(
NTAPI IO_CSQ_REMOVE_IRP)(
2900(
NTAPI IO_CSQ_PEEK_NEXT_IRP)(
2907(
NTAPI IO_CSQ_ACQUIRE_LOCK)(
2913(
NTAPI IO_CSQ_RELEASE_LOCK)(
2919(
NTAPI IO_CSQ_COMPLETE_CANCELED_IRP)(
2932 PVOID ReservePointer;
2957(
NTAPI *PGPE_CONNECT_VECTOR)(
2969(
NTAPI *PGPE_DISCONNECT_VECTOR)(
2975(
NTAPI *PGPE_ENABLE_EVENT)(
2982(
NTAPI *PGPE_DISABLE_EVENT)(
2989(
NTAPI *PGPE_CLEAR_STATUS)(
3001(
NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3008(
NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS)(
3035(
NTAPI *PGPE_CONNECT_VECTOR2)(
3047(
NTAPI *PGPE_DISCONNECT_VECTOR2)(
3054(
NTAPI *PGPE_ENABLE_EVENT2)(
3061(
NTAPI *PGPE_DISABLE_EVENT2)(
3068(
NTAPI *PGPE_CLEAR_STATUS2)(
3074(
NTAPI *PDEVICE_NOTIFY_CALLBACK2)(
3081(
NTAPI *PREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3088(
NTAPI *PUNREGISTER_FOR_DEVICE_NOTIFICATIONS2)(
3106#if !defined(_AMD64_) && !defined(_ARM_)
3107#include <pshpack4.h>
3161 } NotifyDirectoryEx;
3201 } FileSystemControl;
3211 PVOID Type3InputBuffer;
3243 } QueryDeviceRelations;
3256 } FilterResourceRequirements;
3277 } UsageNotification;
3287#if (NTDDI_VERSION >= NTDDI_VISTA)
3318#if !defined(_AMD64_) && !defined(_ARM_)
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
3333#define METHOD_BUFFERED 0
3334#define METHOD_IN_DIRECT 1
3335#define METHOD_OUT_DIRECT 2
3336#define METHOD_NEITHER 3
3338#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
3339#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
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
3350#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
3351#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
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
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
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
3391#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
3392#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
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
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
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
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
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
3441#define FILE_ALL_ACCESS \
3442 (STANDARD_RIGHTS_REQUIRED | \
3446#define FILE_GENERIC_EXECUTE \
3447 (STANDARD_RIGHTS_EXECUTE | \
3448 FILE_READ_ATTRIBUTES | \
3452#define FILE_GENERIC_READ \
3453 (STANDARD_RIGHTS_READ | \
3455 FILE_READ_ATTRIBUTES | \
3459#define FILE_GENERIC_WRITE \
3460 (STANDARD_RIGHTS_WRITE | \
3462 FILE_WRITE_ATTRIBUTES | \
3464 FILE_APPEND_DATA | \
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
3475#define WMIREGISTER 0
3481(
NTAPI FWMI_NOTIFICATION_CALLBACK)(
3500#define PCI_TYPE0_ADDRESSES 6
3501#define PCI_TYPE1_ADDRESSES 2
3502#define PCI_TYPE2_ADDRESSES 5
3507#define PCI_COMMON_HEADER_LAYOUT \