fix a typo
[reactos.git] / reactos / include / ddk / winddk.h
1 /*
2 * winddk.h
3 *
4 * Windows Device Driver Kit
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __WINDDK_H
24 #define __WINDDK_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #include <excpt.h>
31 #include <ntdef.h>
32 #include <ntstatus.h>
33
34 #include "intrin.h"
35
36 #if !defined(_NTHAL_)
37 #define NTHALAPI DECLSPEC_IMPORT
38 #else
39 #define NTHALAPI
40 #endif
41
42 /* Pseudo modifiers for parameters */
43 #define IN
44 #define OUT
45 #define OPTIONAL
46 #define UNALIGNED
47
48 #define CONST const
49
50 #define RESTRICTED_POINTER
51
52 #if defined(_WIN64)
53 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
54 #else
55 #define POINTER_ALIGNMENT
56 #endif
57
58 #define DECLSPEC_ADDRSAFE
59
60 #ifdef NONAMELESSUNION
61 # define _DDK_DUMMYUNION_MEMBER(name) DUMMYUNIONNAME.name
62 # define _DDK_DUMMYUNION_N_MEMBER(n, name) DUMMYUNIONNAME##n.name
63 #else
64 # define _DDK_DUMMYUNION_MEMBER(name) name
65 # define _DDK_DUMMYUNION_N_MEMBER(n, name) name
66 #endif
67
68 /*
69 * Alignment Macros
70 */
71 #define ALIGN_DOWN(s, t) \
72 ((ULONG)(s) & ~(sizeof(t) - 1))
73
74 #define ALIGN_UP(s, t) \
75 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
76
77 #define ALIGN_DOWN_POINTER(p, t) \
78 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
79
80 #define ALIGN_UP_POINTER(p, t) \
81 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
82
83 /*
84 * GUID Comparison
85 */
86
87 #ifndef __IID_ALIGNED__
88 #define __IID_ALIGNED__
89 #ifdef __cplusplus
90 inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
91 {
92 return ((*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)));
93 }
94 #else
95 #define IsEqualGUIDAligned(guid1, guid2) \
96 ((*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)))
97 #endif
98 #endif
99
100 /*
101 ** Forward declarations
102 */
103
104 struct _IRP;
105 struct _MDL;
106 struct _KAPC;
107 struct _KDPC;
108 struct _KPCR;
109 struct _KPRCB;
110 struct _KTSS;
111 struct _FILE_OBJECT;
112 struct _DMA_ADAPTER;
113 struct _DEVICE_OBJECT;
114 struct _DRIVER_OBJECT;
115 struct _IO_STATUS_BLOCK;
116 struct _DEVICE_DESCRIPTION;
117 struct _SCATTER_GATHER_LIST;
118 struct _DRIVE_LAYOUT_INFORMATION;
119 struct _DRIVE_LAYOUT_INFORMATION_EX;
120 struct _LOADER_PARAMETER_BLOCK;
121
122 typedef PVOID PSID;
123
124 #if 1
125 /* FIXME: Unknown definitions */
126 struct _SET_PARTITION_INFORMATION_EX;
127 typedef ULONG WAIT_TYPE;
128 #define WaitAll 0
129 #define WaitAny 1
130 typedef HANDLE TRACEHANDLE;
131 typedef PVOID PWMILIB_CONTEXT;
132 typedef ULONG LOGICAL;
133 #endif
134
135 /*
136 ** WmiLib specific structure
137 */
138 typedef enum
139 {
140 IrpProcessed, // Irp was processed and possibly completed
141 IrpNotCompleted, // Irp was process and NOT completed
142 IrpNotWmi, // Irp is not a WMI irp
143 IrpForward // Irp is wmi irp, but targeted at another device object
144 } SYSCTL_IRP_DISPOSITION, *PSYSCTL_IRP_DISPOSITION;
145
146 /*
147 ** Routines specific to this DDK
148 */
149 #define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )
150
151 /*
152 ** Simple structures
153 */
154
155 typedef UCHAR KIRQL, *PKIRQL;
156
157 typedef enum _MODE {
158 KernelMode,
159 UserMode,
160 MaximumMode
161 } MODE;
162
163 //
164 // Forwarder
165 //
166 struct _COMPRESSED_DATA_INFO;
167
168 /* Constants */
169 #define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )
170 #define ZwCurrentProcess() NtCurrentProcess()
171 #define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )
172 #define ZwCurrentThread() NtCurrentThread()
173
174 #if (_M_IX86)
175 #define KIP0PCRADDRESS 0xffdff000
176
177 #endif
178
179 #define KERNEL_STACK_SIZE 12288
180 #define KERNEL_LARGE_STACK_SIZE 61440
181 #define KERNEL_LARGE_STACK_COMMIT 12288
182
183 #define EXCEPTION_READ_FAULT 0
184 #define EXCEPTION_WRITE_FAULT 1
185 #define EXCEPTION_EXECUTE_FAULT 8
186
187 #define DPFLTR_ERROR_LEVEL 0
188 #define DPFLTR_WARNING_LEVEL 1
189 #define DPFLTR_TRACE_LEVEL 2
190 #define DPFLTR_INFO_LEVEL 3
191 #define DPFLTR_MASK 0x80000000
192
193 typedef enum _DPFLTR_TYPE
194 {
195 DPFLTR_SYSTEM_ID = 0,
196 DPFLTR_SMSS_ID = 1,
197 DPFLTR_SETUP_ID = 2,
198 DPFLTR_NTFS_ID = 3,
199 DPFLTR_FSTUB_ID = 4,
200 DPFLTR_CRASHDUMP_ID = 5,
201 DPFLTR_CDAUDIO_ID = 6,
202 DPFLTR_CDROM_ID = 7,
203 DPFLTR_CLASSPNP_ID = 8,
204 DPFLTR_DISK_ID = 9,
205 DPFLTR_REDBOOK_ID = 10,
206 DPFLTR_STORPROP_ID = 11,
207 DPFLTR_SCSIPORT_ID = 12,
208 DPFLTR_SCSIMINIPORT_ID = 13,
209 DPFLTR_CONFIG_ID = 14,
210 DPFLTR_I8042PRT_ID = 15,
211 DPFLTR_SERMOUSE_ID = 16,
212 DPFLTR_LSERMOUS_ID = 17,
213 DPFLTR_KBDHID_ID = 18,
214 DPFLTR_MOUHID_ID = 19,
215 DPFLTR_KBDCLASS_ID = 20,
216 DPFLTR_MOUCLASS_ID = 21,
217 DPFLTR_TWOTRACK_ID = 22,
218 DPFLTR_WMILIB_ID = 23,
219 DPFLTR_ACPI_ID = 24,
220 DPFLTR_AMLI_ID = 25,
221 DPFLTR_HALIA64_ID = 26,
222 DPFLTR_VIDEO_ID = 27,
223 DPFLTR_SVCHOST_ID = 28,
224 DPFLTR_VIDEOPRT_ID = 29,
225 DPFLTR_TCPIP_ID = 30,
226 DPFLTR_DMSYNTH_ID = 31,
227 DPFLTR_NTOSPNP_ID = 32,
228 DPFLTR_FASTFAT_ID = 33,
229 DPFLTR_SAMSS_ID = 34,
230 DPFLTR_PNPMGR_ID = 35,
231 DPFLTR_NETAPI_ID = 36,
232 DPFLTR_SCSERVER_ID = 37,
233 DPFLTR_SCCLIENT_ID = 38,
234 DPFLTR_SERIAL_ID = 39,
235 DPFLTR_SERENUM_ID = 40,
236 DPFLTR_UHCD_ID = 41,
237 DPFLTR_BOOTOK_ID = 42,
238 DPFLTR_BOOTVRFY_ID = 43,
239 DPFLTR_RPCPROXY_ID = 44,
240 DPFLTR_AUTOCHK_ID = 45,
241 DPFLTR_DCOMSS_ID = 46,
242 DPFLTR_UNIMODEM_ID = 47,
243 DPFLTR_SIS_ID = 48,
244 DPFLTR_FLTMGR_ID = 49,
245 DPFLTR_WMICORE_ID = 50,
246 DPFLTR_BURNENG_ID = 51,
247 DPFLTR_IMAPI_ID = 52,
248 DPFLTR_SXS_ID = 53,
249 DPFLTR_FUSION_ID = 54,
250 DPFLTR_IDLETASK_ID = 55,
251 DPFLTR_SOFTPCI_ID = 56,
252 DPFLTR_TAPE_ID = 57,
253 DPFLTR_MCHGR_ID = 58,
254 DPFLTR_IDEP_ID = 59,
255 DPFLTR_PCIIDE_ID = 60,
256 DPFLTR_FLOPPY_ID = 61,
257 DPFLTR_FDC_ID = 62,
258 DPFLTR_TERMSRV_ID = 63,
259 DPFLTR_W32TIME_ID = 64,
260 DPFLTR_PREFETCHER_ID = 65,
261 DPFLTR_RSFILTER_ID = 66,
262 DPFLTR_FCPORT_ID = 67,
263 DPFLTR_PCI_ID = 68,
264 DPFLTR_DMIO_ID = 69,
265 DPFLTR_DMCONFIG_ID = 70,
266 DPFLTR_DMADMIN_ID = 71,
267 DPFLTR_WSOCKTRANSPORT_ID = 72,
268 DPFLTR_VSS_ID = 73,
269 DPFLTR_PNPMEM_ID = 74,
270 DPFLTR_PROCESSOR_ID = 75,
271 DPFLTR_DMSERVER_ID = 76,
272 DPFLTR_SR_ID = 77,
273 DPFLTR_INFINIBAND_ID = 78,
274 DPFLTR_IHVDRIVER_ID = 79,
275 DPFLTR_IHVVIDEO_ID = 80,
276 DPFLTR_IHVAUDIO_ID = 81,
277 DPFLTR_IHVNETWORK_ID = 82,
278 DPFLTR_IHVSTREAMING_ID = 83,
279 DPFLTR_IHVBUS_ID = 84,
280 DPFLTR_HPS_ID = 85,
281 DPFLTR_RTLTHREADPOOL_ID = 86,
282 DPFLTR_LDR_ID = 87,
283 DPFLTR_TCPIP6_ID = 88,
284 DPFLTR_ISAPNP_ID = 89,
285 DPFLTR_SHPC_ID = 90,
286 DPFLTR_STORPORT_ID = 91,
287 DPFLTR_STORMINIPORT_ID = 92,
288 DPFLTR_PRINTSPOOLER_ID = 93,
289 DPFLTR_VDS_ID = 94,
290 DPFLTR_VDSBAS_ID = 95,
291 DPFLTR_VDSDYNDR_ID = 96,
292 DPFLTR_VDSUTIL_ID = 97,
293 DPFLTR_DFRGIFC_ID = 98,
294 DPFLTR_DEFAULT_ID = 99,
295 DPFLTR_MM_ID = 100,
296 DPFLTR_DFSC_ID = 101,
297 DPFLTR_WOW64_ID = 102,
298 DPFLTR_ENDOFTABLE_ID
299 } DPFLTR_TYPE;
300
301 #define MAXIMUM_PROCESSORS 32
302
303 #define MAXIMUM_WAIT_OBJECTS 64
304
305 #define EX_RUNDOWN_ACTIVE 0x1
306 #define EX_RUNDOWN_COUNT_SHIFT 0x1
307 #define EX_RUNDOWN_COUNT_INC (1 << EX_RUNDOWN_COUNT_SHIFT)
308
309 #define METHOD_BUFFERED 0
310 #define METHOD_IN_DIRECT 1
311 #define METHOD_OUT_DIRECT 2
312 #define METHOD_NEITHER 3
313
314 #define LOW_PRIORITY 0
315 #define LOW_REALTIME_PRIORITY 16
316 #define HIGH_PRIORITY 31
317 #define MAXIMUM_PRIORITY 32
318
319 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
320
321 #define MAXIMUM_FILENAME_LENGTH 256
322
323 #define FILE_SUPERSEDED 0x00000000
324 #define FILE_OPENED 0x00000001
325 #define FILE_CREATED 0x00000002
326 #define FILE_OVERWRITTEN 0x00000003
327 #define FILE_EXISTS 0x00000004
328 #define FILE_DOES_NOT_EXIST 0x00000005
329
330 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
331 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
332
333 /* also in winnt.h */
334 #define FILE_LIST_DIRECTORY 0x00000001
335 #define FILE_READ_DATA 0x00000001
336 #define FILE_ADD_FILE 0x00000002
337 #define FILE_WRITE_DATA 0x00000002
338 #define FILE_ADD_SUBDIRECTORY 0x00000004
339 #define FILE_APPEND_DATA 0x00000004
340 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
341 #define FILE_READ_EA 0x00000008
342 #define FILE_WRITE_EA 0x00000010
343 #define FILE_EXECUTE 0x00000020
344 #define FILE_TRAVERSE 0x00000020
345 #define FILE_DELETE_CHILD 0x00000040
346 #define FILE_READ_ATTRIBUTES 0x00000080
347 #define FILE_WRITE_ATTRIBUTES 0x00000100
348
349 #define FILE_SHARE_READ 0x00000001
350 #define FILE_SHARE_WRITE 0x00000002
351 #define FILE_SHARE_DELETE 0x00000004
352 #define FILE_SHARE_VALID_FLAGS 0x00000007
353
354 #define FILE_ATTRIBUTE_READONLY 0x00000001
355 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
356 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
357 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
358 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
359 #define FILE_ATTRIBUTE_DEVICE 0x00000040
360 #define FILE_ATTRIBUTE_NORMAL 0x00000080
361 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
362 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
363 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
364 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
365 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
366 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
367 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
368
369 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
370 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
371
372 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
373 #define FILE_STRUCTURED_STORAGE 0x00000441
374
375 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
376 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
377 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
378 #define FILE_VALID_SET_FLAGS 0x00000036
379
380 #define FILE_SUPERSEDE 0x00000000
381 #define FILE_OPEN 0x00000001
382 #define FILE_CREATE 0x00000002
383 #define FILE_OPEN_IF 0x00000003
384 #define FILE_OVERWRITE 0x00000004
385 #define FILE_OVERWRITE_IF 0x00000005
386 #define FILE_MAXIMUM_DISPOSITION 0x00000005
387
388 #define FILE_DIRECTORY_FILE 0x00000001
389 #define FILE_WRITE_THROUGH 0x00000002
390 #define FILE_SEQUENTIAL_ONLY 0x00000004
391 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
392 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
393 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
394 #define FILE_NON_DIRECTORY_FILE 0x00000040
395 #define FILE_CREATE_TREE_CONNECTION 0x00000080
396 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
397 #define FILE_NO_EA_KNOWLEDGE 0x00000200
398 #define FILE_OPEN_FOR_RECOVERY 0x00000400
399 #define FILE_RANDOM_ACCESS 0x00000800
400 #define FILE_DELETE_ON_CLOSE 0x00001000
401 #define FILE_OPEN_BY_FILE_ID 0x00002000
402 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
403 #define FILE_NO_COMPRESSION 0x00008000
404 #define FILE_RESERVE_OPFILTER 0x00100000
405 #define FILE_OPEN_REPARSE_POINT 0x00200000
406 #define FILE_OPEN_NO_RECALL 0x00400000
407 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
408
409 #define FILE_ANY_ACCESS 0x00000000
410 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
411 #define FILE_READ_ACCESS 0x00000001
412 #define FILE_WRITE_ACCESS 0x00000002
413
414 #define FILE_ALL_ACCESS \
415 (STANDARD_RIGHTS_REQUIRED | \
416 SYNCHRONIZE | \
417 0x1FF)
418
419 #define FILE_GENERIC_EXECUTE \
420 (STANDARD_RIGHTS_EXECUTE | \
421 FILE_READ_ATTRIBUTES | \
422 FILE_EXECUTE | \
423 SYNCHRONIZE)
424
425 #define FILE_GENERIC_READ \
426 (STANDARD_RIGHTS_READ | \
427 FILE_READ_DATA | \
428 FILE_READ_ATTRIBUTES | \
429 FILE_READ_EA | \
430 SYNCHRONIZE)
431
432 #define FILE_GENERIC_WRITE \
433 (STANDARD_RIGHTS_WRITE | \
434 FILE_WRITE_DATA | \
435 FILE_WRITE_ATTRIBUTES | \
436 FILE_WRITE_EA | \
437 FILE_APPEND_DATA | \
438 SYNCHRONIZE)
439 /* end winnt.h */
440
441 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
442
443 #define OBJECT_TYPE_CREATE (0x0001)
444 #define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
445
446 #define DIRECTORY_QUERY (0x0001)
447 #define DIRECTORY_TRAVERSE (0x0002)
448 #define DIRECTORY_CREATE_OBJECT (0x0004)
449 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
450 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
451
452 #define EVENT_QUERY_STATE (0x0001)
453 #define EVENT_MODIFY_STATE (0x0002)
454 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
455
456 #define SEMAPHORE_QUERY_STATE (0x0001)
457 #define SEMAPHORE_MODIFY_STATE (0x0002)
458 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
459
460 #define THREAD_ALERT (0x0004)
461
462 #define FM_LOCK_BIT (0x1)
463 #define FM_LOCK_BIT_V (0x0)
464 #define FM_LOCK_WAITER_WOKEN (0x2)
465 #define FM_LOCK_WAITER_INC (0x4)
466
467 /* Exported object types */
468 extern POBJECT_TYPE NTSYSAPI ExDesktopObjectType;
469 extern POBJECT_TYPE NTSYSAPI ExEventObjectType;
470 extern POBJECT_TYPE NTSYSAPI ExSemaphoreObjectType;
471 extern POBJECT_TYPE NTSYSAPI ExWindowStationObjectType;
472 extern ULONG NTSYSAPI IoDeviceHandlerObjectSize;
473 extern POBJECT_TYPE NTSYSAPI IoDeviceHandlerObjectType;
474 extern POBJECT_TYPE NTSYSAPI IoDeviceObjectType;
475 extern POBJECT_TYPE NTSYSAPI IoDriverObjectType;
476 extern POBJECT_TYPE NTSYSAPI IoFileObjectType;
477 extern POBJECT_TYPE NTSYSAPI PsThreadType;
478 extern POBJECT_TYPE NTSYSAPI LpcPortObjectType;
479 extern POBJECT_TYPE NTSYSAPI SeTokenObjectType;
480 extern POBJECT_TYPE NTSYSAPI PsProcessType;
481
482 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
483 extern volatile CCHAR NTSYSAPI KeNumberProcessors;
484 #else
485 #if (NTDDI_VERSION >= NTDDI_WINXP)
486 extern CCHAR NTSYSAPI KeNumberProcessors;
487 #else
488 //extern PCCHAR KeNumberProcessors;
489 extern NTSYSAPI CCHAR KeNumberProcessors; //FIXME: Note to Alex: I won't fix this atm, since I prefer to discuss this with you first.
490 #endif
491 #endif
492
493 #define PROCESSOR_FEATURE_MAX 64
494 #define MAX_WOW64_SHARED_ENTRIES 16
495
496 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
497 {
498 StandardDesign,
499 NEC98x86,
500 EndAlternatives
501 } ALTERNATIVE_ARCHITECTURE_TYPE;
502
503 typedef struct _KSYSTEM_TIME
504 {
505 ULONG LowPart;
506 LONG High1Time;
507 LONG High2Time;
508 } KSYSTEM_TIME, *PKSYSTEM_TIME;
509
510 extern volatile KSYSTEM_TIME KeTickCount;
511
512 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
513 #define NX_SUPPORT_POLICY_ALWAYSON 1
514 #define NX_SUPPORT_POLICY_OPTIN 2
515 #define NX_SUPPORT_POLICY_OPTOUT 3
516
517 typedef struct _KUSER_SHARED_DATA
518 {
519 ULONG TickCountLowDeprecated;
520 ULONG TickCountMultiplier;
521 volatile KSYSTEM_TIME InterruptTime;
522 volatile KSYSTEM_TIME SystemTime;
523 volatile KSYSTEM_TIME TimeZoneBias;
524 USHORT ImageNumberLow;
525 USHORT ImageNumberHigh;
526 WCHAR NtSystemRoot[260];
527 ULONG MaxStackTraceDepth;
528 ULONG CryptoExponent;
529 ULONG TimeZoneId;
530 ULONG LargePageMinimum;
531 ULONG Reserved2[7];
532 NT_PRODUCT_TYPE NtProductType;
533 BOOLEAN ProductTypeIsValid;
534 ULONG NtMajorVersion;
535 ULONG NtMinorVersion;
536 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
537 ULONG Reserved1;
538 ULONG Reserved3;
539 volatile ULONG TimeSlip;
540 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
541 LARGE_INTEGER SystemExpirationDate;
542 ULONG SuiteMask;
543 BOOLEAN KdDebuggerEnabled;
544 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
545 UCHAR NXSupportPolicy;
546 #endif
547 volatile ULONG ActiveConsoleId;
548 volatile ULONG DismountCount;
549 ULONG ComPlusPackage;
550 ULONG LastSystemRITEventTickCount;
551 ULONG NumberOfPhysicalPages;
552 BOOLEAN SafeBootMode;
553 ULONG TraceLogging;
554 ULONG Fill0;
555 ULONGLONG TestRetInstruction;
556 ULONG SystemCall;
557 ULONG SystemCallReturn;
558 ULONGLONG SystemCallPad[3];
559 union {
560 volatile KSYSTEM_TIME TickCount;
561 volatile ULONG64 TickCountQuad;
562 };
563 ULONG Cookie;
564 #if (NTDDI_VERSION >= NTDDI_WS03)
565 LONGLONG ConsoleSessionForegroundProcessId;
566 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
567 #endif
568 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
569 USHORT UserModeGlobalLogger[8];
570 ULONG HeapTracingPid[2];
571 ULONG CritSecTracingPid[2];
572 union
573 {
574 ULONG SharedDataFlags;
575 struct
576 {
577 ULONG DbgErrorPortPresent:1;
578 ULONG DbgElevationEnabled:1;
579 ULONG DbgVirtEnabled:1;
580 ULONG DbgInstallerDetectEnabled:1;
581 ULONG SpareBits:28;
582 };
583 };
584 ULONG ImageFileExecutionOptions;
585 KAFFINITY ActiveProcessorAffinity;
586 #endif
587 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
588
589 /*
590 ** IRP function codes
591 */
592
593 #define IRP_MJ_CREATE 0x00
594 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
595 #define IRP_MJ_CLOSE 0x02
596 #define IRP_MJ_READ 0x03
597 #define IRP_MJ_WRITE 0x04
598 #define IRP_MJ_QUERY_INFORMATION 0x05
599 #define IRP_MJ_SET_INFORMATION 0x06
600 #define IRP_MJ_QUERY_EA 0x07
601 #define IRP_MJ_SET_EA 0x08
602 #define IRP_MJ_FLUSH_BUFFERS 0x09
603 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
604 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
605 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
606 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
607 #define IRP_MJ_DEVICE_CONTROL 0x0e
608 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
609 #define IRP_MJ_SCSI 0x0f
610 #define IRP_MJ_SHUTDOWN 0x10
611 #define IRP_MJ_LOCK_CONTROL 0x11
612 #define IRP_MJ_CLEANUP 0x12
613 #define IRP_MJ_CREATE_MAILSLOT 0x13
614 #define IRP_MJ_QUERY_SECURITY 0x14
615 #define IRP_MJ_SET_SECURITY 0x15
616 #define IRP_MJ_POWER 0x16
617 #define IRP_MJ_SYSTEM_CONTROL 0x17
618 #define IRP_MJ_DEVICE_CHANGE 0x18
619 #define IRP_MJ_QUERY_QUOTA 0x19
620 #define IRP_MJ_SET_QUOTA 0x1a
621 #define IRP_MJ_PNP 0x1b
622 #define IRP_MJ_PNP_POWER 0x1b
623 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
624
625 #define IRP_MN_QUERY_DIRECTORY 0x01
626 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
627
628 #define IRP_MN_USER_FS_REQUEST 0x00
629 #define IRP_MN_MOUNT_VOLUME 0x01
630 #define IRP_MN_VERIFY_VOLUME 0x02
631 #define IRP_MN_LOAD_FILE_SYSTEM 0x03
632 #define IRP_MN_TRACK_LINK 0x04
633 #define IRP_MN_KERNEL_CALL 0x04
634
635 #define IRP_MN_LOCK 0x01
636 #define IRP_MN_UNLOCK_SINGLE 0x02
637 #define IRP_MN_UNLOCK_ALL 0x03
638 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
639
640 #define IRP_MN_NORMAL 0x00
641 #define IRP_MN_DPC 0x01
642 #define IRP_MN_MDL 0x02
643 #define IRP_MN_COMPLETE 0x04
644 #define IRP_MN_COMPRESSED 0x08
645
646 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
647 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
648 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
649
650 #define IRP_MN_SCSI_CLASS 0x01
651
652 #define IRP_MN_START_DEVICE 0x00
653 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
654 #define IRP_MN_REMOVE_DEVICE 0x02
655 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
656 #define IRP_MN_STOP_DEVICE 0x04
657 #define IRP_MN_QUERY_STOP_DEVICE 0x05
658 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
659
660 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
661 #define IRP_MN_QUERY_INTERFACE 0x08
662 #define IRP_MN_QUERY_CAPABILITIES 0x09
663 #define IRP_MN_QUERY_RESOURCES 0x0A
664 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
665 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
666 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
667
668 #define IRP_MN_READ_CONFIG 0x0F
669 #define IRP_MN_WRITE_CONFIG 0x10
670 #define IRP_MN_EJECT 0x11
671 #define IRP_MN_SET_LOCK 0x12
672 #define IRP_MN_QUERY_ID 0x13
673 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
674 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
675 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
676 #define IRP_MN_SURPRISE_REMOVAL 0x17
677 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
678
679 #define IRP_MN_WAIT_WAKE 0x00
680 #define IRP_MN_POWER_SEQUENCE 0x01
681 #define IRP_MN_SET_POWER 0x02
682 #define IRP_MN_QUERY_POWER 0x03
683
684 #define IRP_MN_QUERY_ALL_DATA 0x00
685 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
686 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
687 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
688 #define IRP_MN_ENABLE_EVENTS 0x04
689 #define IRP_MN_DISABLE_EVENTS 0x05
690 #define IRP_MN_ENABLE_COLLECTION 0x06
691 #define IRP_MN_DISABLE_COLLECTION 0x07
692 #define IRP_MN_REGINFO 0x08
693 #define IRP_MN_EXECUTE_METHOD 0x09
694
695 #define IRP_MN_REGINFO_EX 0x0b
696
697 typedef enum _IO_PAGING_PRIORITY
698 {
699 IoPagingPriorityInvalid,
700 IoPagingPriorityNormal,
701 IoPagingPriorityHigh,
702 IoPagingPriorityReserved1,
703 IoPagingPriorityReserved2
704 } IO_PAGING_PRIORITY;
705
706 typedef enum _IO_ALLOCATION_ACTION {
707 KeepObject = 1,
708 DeallocateObject,
709 DeallocateObjectKeepRegisters
710 } IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
711
712 typedef IO_ALLOCATION_ACTION
713 (DDKAPI *PDRIVER_CONTROL)(
714 IN struct _DEVICE_OBJECT *DeviceObject,
715 IN struct _IRP *Irp,
716 IN PVOID MapRegisterBase,
717 IN PVOID Context);
718
719
720 typedef EXCEPTION_DISPOSITION
721 (DDKAPI *PEXCEPTION_ROUTINE)(
722 IN struct _EXCEPTION_RECORD *ExceptionRecord,
723 IN PVOID EstablisherFrame,
724 IN OUT struct _CONTEXT *ContextRecord,
725 IN OUT PVOID DispatcherContext);
726
727 typedef VOID
728 (DDKAPI *PDRIVER_LIST_CONTROL)(
729 IN struct _DEVICE_OBJECT *DeviceObject,
730 IN struct _IRP *Irp,
731 IN struct _SCATTER_GATHER_LIST *ScatterGather,
732 IN PVOID Context);
733
734 typedef NTSTATUS
735 (DDKAPI DRIVER_ADD_DEVICE)(
736 IN struct _DRIVER_OBJECT *DriverObject,
737 IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
738 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
739
740 typedef NTSTATUS
741 (DDKAPI IO_COMPLETION_ROUTINE)(
742 IN struct _DEVICE_OBJECT *DeviceObject,
743 IN struct _IRP *Irp,
744 IN PVOID Context);
745 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
746
747 typedef VOID
748 (DDKAPI DRIVER_CANCEL)(
749 IN struct _DEVICE_OBJECT *DeviceObject,
750 IN struct _IRP *Irp);
751 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
752
753 typedef VOID
754 (DDKAPI *PKDEFERRED_ROUTINE)(
755 IN struct _KDPC *Dpc,
756 IN PVOID DeferredContext,
757 IN PVOID SystemArgument1,
758 IN PVOID SystemArgument2);
759
760 typedef NTSTATUS
761 (DDKAPI DRIVER_DISPATCH)(
762 IN struct _DEVICE_OBJECT *DeviceObject,
763 IN struct _IRP *Irp);
764 typedef DRIVER_DISPATCH *PDRIVER_DISPATCH;
765
766 typedef VOID
767 (DDKAPI *PIO_DPC_ROUTINE)(
768 IN struct _KDPC *Dpc,
769 IN struct _DEVICE_OBJECT *DeviceObject,
770 IN struct _IRP *Irp,
771 IN PVOID Context);
772
773 typedef NTSTATUS
774 (DDKAPI *PMM_DLL_INITIALIZE)(
775 IN PUNICODE_STRING RegistryPath);
776
777 typedef NTSTATUS
778 (DDKAPI *PMM_DLL_UNLOAD)(
779 VOID);
780
781 typedef NTSTATUS
782 (DDKAPI *PDRIVER_ENTRY)(
783 IN struct _DRIVER_OBJECT *DriverObject,
784 IN PUNICODE_STRING RegistryPath);
785
786 typedef NTSTATUS
787 (DDKAPI DRIVER_INITIALIZE)(
788 IN struct _DRIVER_OBJECT *DriverObject,
789 IN PUNICODE_STRING RegistryPath);
790 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
791
792 typedef BOOLEAN
793 (DDKAPI KSERVICE_ROUTINE)(
794 IN struct _KINTERRUPT *Interrupt,
795 IN PVOID ServiceContext);
796 typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE;
797
798 typedef VOID
799 (DDKAPI *PIO_TIMER_ROUTINE)(
800 IN struct _DEVICE_OBJECT *DeviceObject,
801 IN PVOID Context);
802
803 typedef VOID
804 (DDKAPI *PDRIVER_REINITIALIZE)(
805 IN struct _DRIVER_OBJECT *DriverObject,
806 IN PVOID Context,
807 IN ULONG Count);
808
809 typedef VOID
810 (DDKAPI DRIVER_STARTIO)(
811 IN struct _DEVICE_OBJECT *DeviceObject,
812 IN struct _IRP *Irp);
813 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
814
815 typedef BOOLEAN
816 (DDKAPI *PKSYNCHRONIZE_ROUTINE)(
817 IN PVOID SynchronizeContext);
818
819 typedef VOID
820 (DDKAPI DRIVER_UNLOAD)(
821 IN struct _DRIVER_OBJECT *DriverObject);
822 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
823
824
825
826 /*
827 ** Plug and Play structures
828 */
829
830 typedef VOID
831 (DDKAPI *PINTERFACE_REFERENCE)(
832 PVOID Context);
833
834 typedef VOID
835 (DDKAPI *PINTERFACE_DEREFERENCE)(
836 PVOID Context);
837
838 typedef BOOLEAN
839 (DDKAPI *PTRANSLATE_BUS_ADDRESS)(
840 IN PVOID Context,
841 IN PHYSICAL_ADDRESS BusAddress,
842 IN ULONG Length,
843 IN OUT PULONG AddressSpace,
844 OUT PPHYSICAL_ADDRESS TranslatedAddress);
845
846 typedef struct _DMA_ADAPTER*
847 (DDKAPI *PGET_DMA_ADAPTER)(
848 IN PVOID Context,
849 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
850 OUT PULONG NumberOfMapRegisters);
851
852 typedef ULONG
853 (DDKAPI *PGET_SET_DEVICE_DATA)(
854 IN PVOID Context,
855 IN ULONG DataType,
856 IN PVOID Buffer,
857 IN ULONG Offset,
858 IN ULONG Length);
859
860 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
861 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
862 #define PCI_USE_REVISION 0x00000002
863 #define PCI_USE_VENDEV_IDS 0x00000004
864 #define PCI_USE_CLASS_SUBCLASS 0x00000008
865 #define PCI_USE_PROGIF 0x00000010
866 #define PCI_USE_LOCAL_BUS 0x00000020
867 #define PCI_USE_LOCAL_DEVICE 0x00000040
868
869 typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS {
870 ULONG Size;
871 ULONG Flags;
872 USHORT VendorID;
873 USHORT DeviceID;
874 UCHAR RevisionID;
875 USHORT SubVendorID;
876 USHORT SubSystemID;
877 UCHAR BaseClass;
878 UCHAR SubClass;
879 UCHAR ProgIf;
880 } PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS;
881
882 typedef BOOLEAN
883 (DDKAPI *PPCI_IS_DEVICE_PRESENT)(
884 IN USHORT VendorID,
885 IN USHORT DeviceID,
886 IN UCHAR RevisionID,
887 IN USHORT SubVendorID,
888 IN USHORT SubSystemID,
889 IN ULONG Flags);
890
891 typedef BOOLEAN
892 (DDKAPI *PPCI_IS_DEVICE_PRESENT_EX)(
893 IN PVOID Context,
894 IN PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
895
896 typedef union _POWER_STATE {
897 SYSTEM_POWER_STATE SystemState;
898 DEVICE_POWER_STATE DeviceState;
899 } POWER_STATE, *PPOWER_STATE;
900
901 typedef enum _POWER_STATE_TYPE {
902 SystemPowerState,
903 DevicePowerState
904 } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
905
906 typedef struct _BUS_INTERFACE_STANDARD {
907 USHORT Size;
908 USHORT Version;
909 PVOID Context;
910 PINTERFACE_REFERENCE InterfaceReference;
911 PINTERFACE_DEREFERENCE InterfaceDereference;
912 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
913 PGET_DMA_ADAPTER GetDmaAdapter;
914 PGET_SET_DEVICE_DATA SetBusData;
915 PGET_SET_DEVICE_DATA GetBusData;
916 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
917
918 typedef struct _PCI_DEVICE_PRESENT_INTERFACE {
919 USHORT Size;
920 USHORT Version;
921 PVOID Context;
922 PINTERFACE_REFERENCE InterfaceReference;
923 PINTERFACE_DEREFERENCE InterfaceDereference;
924 PPCI_IS_DEVICE_PRESENT IsDevicePresent;
925 PPCI_IS_DEVICE_PRESENT_EX IsDevicePresentEx;
926 } PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE;
927
928 typedef struct _DEVICE_CAPABILITIES {
929 USHORT Size;
930 USHORT Version;
931 ULONG DeviceD1 : 1;
932 ULONG DeviceD2 : 1;
933 ULONG LockSupported : 1;
934 ULONG EjectSupported : 1;
935 ULONG Removable : 1;
936 ULONG DockDevice : 1;
937 ULONG UniqueID : 1;
938 ULONG SilentInstall : 1;
939 ULONG RawDeviceOK : 1;
940 ULONG SurpriseRemovalOK : 1;
941 ULONG WakeFromD0 : 1;
942 ULONG WakeFromD1 : 1;
943 ULONG WakeFromD2 : 1;
944 ULONG WakeFromD3 : 1;
945 ULONG HardwareDisabled : 1;
946 ULONG NonDynamic : 1;
947 ULONG WarmEjectSupported : 1;
948 ULONG NoDisplayInUI : 1;
949 ULONG Reserved : 14;
950 ULONG Address;
951 ULONG UINumber;
952 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
953 SYSTEM_POWER_STATE SystemWake;
954 DEVICE_POWER_STATE DeviceWake;
955 ULONG D1Latency;
956 ULONG D2Latency;
957 ULONG D3Latency;
958 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
959
960 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
961 USHORT Version;
962 USHORT Size;
963 GUID Event;
964 GUID InterfaceClassGuid;
965 PUNICODE_STRING SymbolicLinkName;
966 } DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
967
968 typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
969 USHORT Version;
970 USHORT Size;
971 GUID Event;
972 } HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
973
974 #undef INTERFACE
975
976 typedef struct _INTERFACE {
977 USHORT Size;
978 USHORT Version;
979 PVOID Context;
980 PINTERFACE_REFERENCE InterfaceReference;
981 PINTERFACE_DEREFERENCE InterfaceDereference;
982 } INTERFACE, *PINTERFACE;
983
984 typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
985 USHORT Version;
986 USHORT Size;
987 GUID Event;
988 } PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
989
990 typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
991
992 /* PNP_DEVICE_STATE */
993
994 #define PNP_DEVICE_DISABLED 0x00000001
995 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
996 #define PNP_DEVICE_FAILED 0x00000004
997 #define PNP_DEVICE_REMOVED 0x00000008
998 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
999 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
1000
1001 typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
1002 USHORT Version;
1003 USHORT Size;
1004 GUID Event;
1005 struct _FILE_OBJECT *FileObject;
1006 LONG NameBufferOffset;
1007 UCHAR CustomDataBuffer[1];
1008 } TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
1009
1010 typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
1011 USHORT Version;
1012 USHORT Size;
1013 GUID Event;
1014 struct _FILE_OBJECT *FileObject;
1015 } TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
1016
1017 typedef enum _BUS_QUERY_ID_TYPE {
1018 BusQueryDeviceID,
1019 BusQueryHardwareIDs,
1020 BusQueryCompatibleIDs,
1021 BusQueryInstanceID,
1022 BusQueryDeviceSerialNumber
1023 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
1024
1025 typedef enum _DEVICE_TEXT_TYPE {
1026 DeviceTextDescription,
1027 DeviceTextLocationInformation
1028 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
1029
1030 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
1031 DeviceUsageTypeUndefined,
1032 DeviceUsageTypePaging,
1033 DeviceUsageTypeHibernation,
1034 DeviceUsageTypeDumpFile
1035 } DEVICE_USAGE_NOTIFICATION_TYPE;
1036
1037 typedef struct _POWER_SEQUENCE {
1038 ULONG SequenceD1;
1039 ULONG SequenceD2;
1040 ULONG SequenceD3;
1041 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
1042
1043 typedef enum {
1044 DevicePropertyDeviceDescription,
1045 DevicePropertyHardwareID,
1046 DevicePropertyCompatibleIDs,
1047 DevicePropertyBootConfiguration,
1048 DevicePropertyBootConfigurationTranslated,
1049 DevicePropertyClassName,
1050 DevicePropertyClassGuid,
1051 DevicePropertyDriverKeyName,
1052 DevicePropertyManufacturer,
1053 DevicePropertyFriendlyName,
1054 DevicePropertyLocationInformation,
1055 DevicePropertyPhysicalDeviceObjectName,
1056 DevicePropertyBusTypeGuid,
1057 DevicePropertyLegacyBusType,
1058 DevicePropertyBusNumber,
1059 DevicePropertyEnumeratorName,
1060 DevicePropertyAddress,
1061 DevicePropertyUINumber,
1062 DevicePropertyInstallState,
1063 DevicePropertyRemovalPolicy
1064 } DEVICE_REGISTRY_PROPERTY;
1065
1066 typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
1067 EventCategoryReserved,
1068 EventCategoryHardwareProfileChange,
1069 EventCategoryDeviceInterfaceChange,
1070 EventCategoryTargetDeviceChange
1071 } IO_NOTIFICATION_EVENT_CATEGORY;
1072
1073 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
1074
1075 typedef NTSTATUS
1076 (DDKAPI *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
1077 IN PVOID NotificationStructure,
1078 IN PVOID Context);
1079
1080 typedef VOID
1081 (DDKAPI *PDEVICE_CHANGE_COMPLETE_CALLBACK)(
1082 IN PVOID Context);
1083
1084
1085 /*
1086 ** System structures
1087 */
1088
1089 #define SYMBOLIC_LINK_QUERY 0x0001
1090 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1091
1092 /* also in winnt,h */
1093 #define DUPLICATE_CLOSE_SOURCE 0x00000001
1094 #define DUPLICATE_SAME_ACCESS 0x00000002
1095 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
1096 /* end winnt.h */
1097
1098 typedef struct _OBJECT_NAME_INFORMATION {
1099 UNICODE_STRING Name;
1100 } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
1101
1102 typedef struct _IO_STATUS_BLOCK {
1103 _ANONYMOUS_UNION union {
1104 NTSTATUS Status;
1105 PVOID Pointer;
1106 } DUMMYUNIONNAME;
1107 ULONG_PTR Information;
1108 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
1109
1110 typedef VOID
1111 (DDKAPI *PIO_APC_ROUTINE)(
1112 IN PVOID ApcContext,
1113 IN PIO_STATUS_BLOCK IoStatusBlock,
1114 IN ULONG Reserved);
1115
1116 typedef VOID
1117 (DDKAPI *PKNORMAL_ROUTINE)(
1118 IN PVOID NormalContext,
1119 IN PVOID SystemArgument1,
1120 IN PVOID SystemArgument2);
1121
1122 typedef VOID
1123 (DDKAPI *PKKERNEL_ROUTINE)(
1124 IN struct _KAPC *Apc,
1125 IN OUT PKNORMAL_ROUTINE *NormalRoutine,
1126 IN OUT PVOID *NormalContext,
1127 IN OUT PVOID *SystemArgument1,
1128 IN OUT PVOID *SystemArgument2);
1129
1130 typedef VOID
1131 (DDKAPI *PKRUNDOWN_ROUTINE)(
1132 IN struct _KAPC *Apc);
1133
1134 typedef BOOLEAN
1135 (DDKAPI *PKTRANSFER_ROUTINE)(
1136 VOID);
1137
1138 typedef struct _KAPC
1139 {
1140 UCHAR Type;
1141 UCHAR SpareByte0;
1142 UCHAR Size;
1143 UCHAR SpareByte1;
1144 ULONG SpareLong0;
1145 struct _KTHREAD *Thread;
1146 LIST_ENTRY ApcListEntry;
1147 PKKERNEL_ROUTINE KernelRoutine;
1148 PKRUNDOWN_ROUTINE RundownRoutine;
1149 PKNORMAL_ROUTINE NormalRoutine;
1150 PVOID NormalContext;
1151 PVOID SystemArgument1;
1152 PVOID SystemArgument2;
1153 CCHAR ApcStateIndex;
1154 KPROCESSOR_MODE ApcMode;
1155 BOOLEAN Inserted;
1156 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
1157
1158 typedef struct _KDEVICE_QUEUE {
1159 CSHORT Type;
1160 CSHORT Size;
1161 LIST_ENTRY DeviceListHead;
1162 KSPIN_LOCK Lock;
1163 BOOLEAN Busy;
1164 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
1165
1166 typedef struct _KDEVICE_QUEUE_ENTRY {
1167 LIST_ENTRY DeviceListEntry;
1168 ULONG SortKey;
1169 BOOLEAN Inserted;
1170 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
1171 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
1172
1173 #define LOCK_QUEUE_WAIT 1
1174 #define LOCK_QUEUE_OWNER 2
1175 #define LOCK_QUEUE_TIMER_LOCK_SHIFT 4
1176 #define LOCK_QUEUE_TIMER_TABLE_LOCKS (1 << (8 - LOCK_QUEUE_TIMER_LOCK_SHIFT))
1177
1178 typedef enum _KSPIN_LOCK_QUEUE_NUMBER
1179 {
1180 LockQueueDispatcherLock,
1181 LockQueueExpansionLock,
1182 LockQueuePfnLock,
1183 LockQueueSystemSpaceLock,
1184 LockQueueVacbLock,
1185 LockQueueMasterLock,
1186 LockQueueNonPagedPoolLock,
1187 LockQueueIoCancelLock,
1188 LockQueueWorkQueueLock,
1189 LockQueueIoVpbLock,
1190 LockQueueIoDatabaseLock,
1191 LockQueueIoCompletionLock,
1192 LockQueueNtfsStructLock,
1193 LockQueueAfdWorkQueueLock,
1194 LockQueueBcbLock,
1195 LockQueueMmNonPagedPoolLock,
1196 LockQueueUnusedSpare16,
1197 LockQueueTimerTableLock,
1198 LockQueueMaximumLock = LockQueueTimerTableLock + LOCK_QUEUE_TIMER_TABLE_LOCKS
1199 } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
1200
1201 typedef struct _KSPIN_LOCK_QUEUE {
1202 struct _KSPIN_LOCK_QUEUE *volatile Next;
1203 PKSPIN_LOCK volatile Lock;
1204 } KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
1205
1206 typedef struct _KLOCK_QUEUE_HANDLE {
1207 KSPIN_LOCK_QUEUE LockQueue;
1208 KIRQL OldIrql;
1209 } KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
1210
1211 #define DPC_NORMAL 0
1212 #define DPC_THREADED 1
1213
1214 #define ASSERT_APC(Object) \
1215 ASSERT((Object)->Type == ApcObject)
1216
1217 #define ASSERT_DPC(Object) \
1218 ASSERT(((Object)->Type == 0) || \
1219 ((Object)->Type == DpcObject) || \
1220 ((Object)->Type == ThreadedDpcObject))
1221
1222 #define ASSERT_DEVICE_QUEUE(Object) \
1223 ASSERT((Object)->Type == DeviceQueueObject)
1224
1225 typedef struct _KDPC
1226 {
1227 UCHAR Type;
1228 UCHAR Importance;
1229 USHORT Number;
1230 LIST_ENTRY DpcListEntry;
1231 PKDEFERRED_ROUTINE DeferredRoutine;
1232 PVOID DeferredContext;
1233 PVOID SystemArgument1;
1234 PVOID SystemArgument2;
1235 volatile PVOID DpcData;
1236 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
1237
1238 typedef PVOID PKIPI_CONTEXT;
1239
1240 typedef
1241 VOID
1242 (NTAPI *PKIPI_WORKER)(
1243 IN PKIPI_CONTEXT PacketContext,
1244 IN PVOID Parameter1,
1245 IN PVOID Parameter2,
1246 IN PVOID Parameter3
1247 );
1248
1249 typedef struct _WAIT_CONTEXT_BLOCK {
1250 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
1251 PDRIVER_CONTROL DeviceRoutine;
1252 PVOID DeviceContext;
1253 ULONG NumberOfMapRegisters;
1254 PVOID DeviceObject;
1255 PVOID CurrentIrp;
1256 PKDPC BufferChainingDpc;
1257 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
1258
1259 #define ASSERT_GATE(object) \
1260 ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == GateObject) || \
1261 (((object)->Header.Type & KOBJECT_TYPE_MASK) == EventSynchronizationObject))
1262
1263 typedef struct _KGATE
1264 {
1265 DISPATCHER_HEADER Header;
1266 } KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE;
1267
1268 #define GM_LOCK_BIT 0x1
1269 #define GM_LOCK_BIT_V 0x0
1270 #define GM_LOCK_WAITER_WOKEN 0x2
1271 #define GM_LOCK_WAITER_INC 0x4
1272
1273 typedef struct _KGUARDED_MUTEX
1274 {
1275 volatile LONG Count;
1276 PKTHREAD Owner;
1277 ULONG Contention;
1278 KGATE Gate;
1279 union
1280 {
1281 struct
1282 {
1283 SHORT KernelApcDisable;
1284 SHORT SpecialApcDisable;
1285 };
1286 ULONG CombinedApcDisable;
1287 };
1288 } KGUARDED_MUTEX, *PKGUARDED_MUTEX;
1289
1290 #define TIMER_TABLE_SIZE 512
1291 #define TIMER_TABLE_SHIFT 9
1292
1293 typedef struct _KTIMER {
1294 DISPATCHER_HEADER Header;
1295 ULARGE_INTEGER DueTime;
1296 LIST_ENTRY TimerListEntry;
1297 struct _KDPC *Dpc;
1298 LONG Period;
1299 } KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
1300
1301 #define ASSERT_TIMER(E) \
1302 ASSERT(((E)->Header.Type == TimerNotificationObject) || \
1303 ((E)->Header.Type == TimerSynchronizationObject))
1304
1305 #define ASSERT_MUTANT(E) \
1306 ASSERT((E)->Header.Type == MutantObject)
1307
1308 #define ASSERT_SEMAPHORE(E) \
1309 ASSERT((E)->Header.Type == SemaphoreObject)
1310
1311 #define ASSERT_EVENT(E) \
1312 ASSERT(((E)->Header.Type == NotificationEvent) || \
1313 ((E)->Header.Type == SynchronizationEvent))
1314
1315 typedef struct _KMUTANT {
1316 DISPATCHER_HEADER Header;
1317 LIST_ENTRY MutantListEntry;
1318 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
1319 BOOLEAN Abandoned;
1320 UCHAR ApcDisable;
1321 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
1322
1323 typedef enum _TIMER_TYPE {
1324 NotificationTimer,
1325 SynchronizationTimer
1326 } TIMER_TYPE;
1327
1328 #define EVENT_INCREMENT 1
1329 #define IO_NO_INCREMENT 0
1330 #define IO_CD_ROM_INCREMENT 1
1331 #define IO_DISK_INCREMENT 1
1332 #define IO_KEYBOARD_INCREMENT 6
1333 #define IO_MAILSLOT_INCREMENT 2
1334 #define IO_MOUSE_INCREMENT 6
1335 #define IO_NAMED_PIPE_INCREMENT 2
1336 #define IO_NETWORK_INCREMENT 2
1337 #define IO_PARALLEL_INCREMENT 1
1338 #define IO_SERIAL_INCREMENT 2
1339 #define IO_SOUND_INCREMENT 8
1340 #define IO_VIDEO_INCREMENT 1
1341 #define SEMAPHORE_INCREMENT 1
1342
1343 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
1344
1345 typedef struct _IRP {
1346 CSHORT Type;
1347 USHORT Size;
1348 struct _MDL *MdlAddress;
1349 ULONG Flags;
1350 union {
1351 struct _IRP *MasterIrp;
1352 volatile LONG IrpCount;
1353 PVOID SystemBuffer;
1354 } AssociatedIrp;
1355 LIST_ENTRY ThreadListEntry;
1356 IO_STATUS_BLOCK IoStatus;
1357 KPROCESSOR_MODE RequestorMode;
1358 BOOLEAN PendingReturned;
1359 CHAR StackCount;
1360 CHAR CurrentLocation;
1361 BOOLEAN Cancel;
1362 KIRQL CancelIrql;
1363 CCHAR ApcEnvironment;
1364 UCHAR AllocationFlags;
1365 PIO_STATUS_BLOCK UserIosb;
1366 PKEVENT UserEvent;
1367 union {
1368 struct {
1369 PIO_APC_ROUTINE UserApcRoutine;
1370 PVOID UserApcContext;
1371 } AsynchronousParameters;
1372 LARGE_INTEGER AllocationSize;
1373 } Overlay;
1374 volatile PDRIVER_CANCEL CancelRoutine;
1375 PVOID UserBuffer;
1376 union {
1377 struct {
1378 _ANONYMOUS_UNION union {
1379 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
1380 _ANONYMOUS_STRUCT struct {
1381 PVOID DriverContext[4];
1382 } DUMMYSTRUCTNAME;
1383 } DUMMYUNIONNAME;
1384 PETHREAD Thread;
1385 PCHAR AuxiliaryBuffer;
1386 _ANONYMOUS_STRUCT struct {
1387 LIST_ENTRY ListEntry;
1388 _ANONYMOUS_UNION union {
1389 struct _IO_STACK_LOCATION *CurrentStackLocation;
1390 ULONG PacketType;
1391 } DUMMYUNIONNAME;
1392 } DUMMYSTRUCTNAME;
1393 struct _FILE_OBJECT *OriginalFileObject;
1394 } Overlay;
1395 KAPC Apc;
1396 PVOID CompletionKey;
1397 } Tail;
1398 } IRP;
1399 typedef struct _IRP *PIRP;
1400
1401 /* IRP.Flags */
1402
1403 #define SL_FORCE_ACCESS_CHECK 0x01
1404 #define SL_OPEN_PAGING_FILE 0x02
1405 #define SL_OPEN_TARGET_DIRECTORY 0x04
1406 #define SL_CASE_SENSITIVE 0x80
1407
1408 #define SL_KEY_SPECIFIED 0x01
1409 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1410 #define SL_WRITE_THROUGH 0x04
1411 #define SL_FT_SEQUENTIAL_WRITE 0x08
1412
1413 #define SL_FAIL_IMMEDIATELY 0x01
1414 #define SL_EXCLUSIVE_LOCK 0x02
1415
1416 #define SL_RESTART_SCAN 0x01
1417 #define SL_RETURN_SINGLE_ENTRY 0x02
1418 #define SL_INDEX_SPECIFIED 0x04
1419
1420 #define SL_WATCH_TREE 0x01
1421
1422 #define SL_ALLOW_RAW_MOUNT 0x01
1423
1424 #define CTL_CODE(DeviceType, Function, Method, Access)( \
1425 ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1426
1427 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1428
1429 enum
1430 {
1431 IRP_NOCACHE = 0x1,
1432 IRP_PAGING_IO = 0x2,
1433 IRP_MOUNT_COMPLETION = 0x2,
1434 IRP_SYNCHRONOUS_API = 0x4,
1435 IRP_ASSOCIATED_IRP = 0x8,
1436 IRP_BUFFERED_IO = 0x10,
1437 IRP_DEALLOCATE_BUFFER = 0x20,
1438 IRP_INPUT_OPERATION = 0x40,
1439 IRP_SYNCHRONOUS_PAGING_IO = 0x40,
1440 IRP_CREATE_OPERATION = 0x80,
1441 IRP_READ_OPERATION = 0x100,
1442 IRP_WRITE_OPERATION = 0x200,
1443 IRP_CLOSE_OPERATION = 0x400,
1444 IRP_DEFER_IO_COMPLETION = 0x800,
1445 IRP_OB_QUERY_NAME = 0x1000,
1446 IRP_HOLD_DEVICE_QUEUE = 0x2000,
1447 IRP_RETRY_IO_COMPLETION = 0x4000
1448 };
1449
1450 #define IRP_QUOTA_CHARGED 0x01
1451 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1452 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1453 #define IRP_LOOKASIDE_ALLOCATION 0x08
1454
1455 typedef struct _BOOTDISK_INFORMATION {
1456 LONGLONG BootPartitionOffset;
1457 LONGLONG SystemPartitionOffset;
1458 ULONG BootDeviceSignature;
1459 ULONG SystemDeviceSignature;
1460 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
1461
1462 typedef struct _BOOTDISK_INFORMATION_EX {
1463 LONGLONG BootPartitionOffset;
1464 LONGLONG SystemPartitionOffset;
1465 ULONG BootDeviceSignature;
1466 ULONG SystemDeviceSignature;
1467 GUID BootDeviceGuid;
1468 GUID SystemDeviceGuid;
1469 BOOLEAN BootDeviceIsGpt;
1470 BOOLEAN SystemDeviceIsGpt;
1471 } BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
1472
1473 typedef struct _EISA_MEMORY_TYPE {
1474 UCHAR ReadWrite : 1;
1475 UCHAR Cached : 1;
1476 UCHAR Reserved0 : 1;
1477 UCHAR Type : 2;
1478 UCHAR Shared : 1;
1479 UCHAR Reserved1 : 1;
1480 UCHAR MoreEntries : 1;
1481 } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
1482
1483 #include <pshpack1.h>
1484 typedef struct _EISA_MEMORY_CONFIGURATION {
1485 EISA_MEMORY_TYPE ConfigurationByte;
1486 UCHAR DataSize;
1487 USHORT AddressLowWord;
1488 UCHAR AddressHighByte;
1489 USHORT MemorySize;
1490 } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
1491 #include <poppack.h>
1492
1493 typedef struct _EISA_IRQ_DESCRIPTOR {
1494 UCHAR Interrupt : 4;
1495 UCHAR Reserved : 1;
1496 UCHAR LevelTriggered : 1;
1497 UCHAR Shared : 1;
1498 UCHAR MoreEntries : 1;
1499 } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
1500
1501 typedef struct _EISA_IRQ_CONFIGURATION {
1502 EISA_IRQ_DESCRIPTOR ConfigurationByte;
1503 UCHAR Reserved;
1504 } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
1505
1506 typedef struct _DMA_CONFIGURATION_BYTE0 {
1507 UCHAR Channel : 3;
1508 UCHAR Reserved : 3;
1509 UCHAR Shared : 1;
1510 UCHAR MoreEntries : 1;
1511 } DMA_CONFIGURATION_BYTE0;
1512
1513 typedef struct _DMA_CONFIGURATION_BYTE1 {
1514 UCHAR Reserved0 : 2;
1515 UCHAR TransferSize : 2;
1516 UCHAR Timing : 2;
1517 UCHAR Reserved1 : 2;
1518 } DMA_CONFIGURATION_BYTE1;
1519
1520 typedef struct _EISA_DMA_CONFIGURATION {
1521 DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
1522 DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
1523 } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
1524
1525 #include <pshpack1.h>
1526 typedef struct _EISA_PORT_DESCRIPTOR {
1527 UCHAR NumberPorts : 5;
1528 UCHAR Reserved : 1;
1529 UCHAR Shared : 1;
1530 UCHAR MoreEntries : 1;
1531 } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
1532
1533 typedef struct _EISA_PORT_CONFIGURATION {
1534 EISA_PORT_DESCRIPTOR Configuration;
1535 USHORT PortAddress;
1536 } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
1537 #include <poppack.h>
1538
1539 typedef struct _CM_EISA_FUNCTION_INFORMATION {
1540 ULONG CompressedId;
1541 UCHAR IdSlotFlags1;
1542 UCHAR IdSlotFlags2;
1543 UCHAR MinorRevision;
1544 UCHAR MajorRevision;
1545 UCHAR Selections[26];
1546 UCHAR FunctionFlags;
1547 UCHAR TypeString[80];
1548 EISA_MEMORY_CONFIGURATION EisaMemory[9];
1549 EISA_IRQ_CONFIGURATION EisaIrq[7];
1550 EISA_DMA_CONFIGURATION EisaDma[4];
1551 EISA_PORT_CONFIGURATION EisaPort[20];
1552 UCHAR InitializationData[60];
1553 } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
1554
1555 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
1556
1557 #define EISA_FUNCTION_ENABLED 0x80
1558 #define EISA_FREE_FORM_DATA 0x40
1559 #define EISA_HAS_PORT_INIT_ENTRY 0x20
1560 #define EISA_HAS_PORT_RANGE 0x10
1561 #define EISA_HAS_DMA_ENTRY 0x08
1562 #define EISA_HAS_IRQ_ENTRY 0x04
1563 #define EISA_HAS_MEMORY_ENTRY 0x02
1564 #define EISA_HAS_TYPE_ENTRY 0x01
1565 #define EISA_HAS_INFORMATION \
1566 (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
1567 + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
1568
1569 typedef struct _CM_EISA_SLOT_INFORMATION {
1570 UCHAR ReturnCode;
1571 UCHAR ReturnFlags;
1572 UCHAR MajorRevision;
1573 UCHAR MinorRevision;
1574 USHORT Checksum;
1575 UCHAR NumberFunctions;
1576 UCHAR FunctionInformation;
1577 ULONG CompressedId;
1578 } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
1579
1580 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
1581
1582 #define EISA_INVALID_SLOT 0x80
1583 #define EISA_INVALID_FUNCTION 0x81
1584 #define EISA_INVALID_CONFIGURATION 0x82
1585 #define EISA_EMPTY_SLOT 0x83
1586 #define EISA_INVALID_BIOS_CALL 0x86
1587
1588 typedef struct _CM_FLOPPY_DEVICE_DATA {
1589 USHORT Version;
1590 USHORT Revision;
1591 CHAR Size[8];
1592 ULONG MaxDensity;
1593 ULONG MountDensity;
1594 UCHAR StepRateHeadUnloadTime;
1595 UCHAR HeadLoadTime;
1596 UCHAR MotorOffTime;
1597 UCHAR SectorLengthCode;
1598 UCHAR SectorPerTrack;
1599 UCHAR ReadWriteGapLength;
1600 UCHAR DataTransferLength;
1601 UCHAR FormatGapLength;
1602 UCHAR FormatFillCharacter;
1603 UCHAR HeadSettleTime;
1604 UCHAR MotorSettleTime;
1605 UCHAR MaximumTrackValue;
1606 UCHAR DataTransferRate;
1607 } CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
1608
1609 typedef struct _PNP_BUS_INFORMATION {
1610 GUID BusTypeGuid;
1611 INTERFACE_TYPE LegacyBusType;
1612 ULONG BusNumber;
1613 } PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
1614
1615 #include <pshpack1.h>
1616 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
1617
1618 #define CmResourceTypeNull 0
1619 #define CmResourceTypePort 1
1620 #define CmResourceTypeInterrupt 2
1621 #define CmResourceTypeMemory 3
1622 #define CmResourceTypeDma 4
1623 #define CmResourceTypeDeviceSpecific 5
1624 #define CmResourceTypeBusNumber 6
1625 #define CmResourceTypeMaximum 7
1626 #define CmResourceTypeNonArbitrated 128
1627 #define CmResourceTypeConfigData 128
1628 #define CmResourceTypeDevicePrivate 129
1629 #define CmResourceTypePcCardConfig 130
1630 #define CmResourceTypeMfCardConfig 131
1631
1632 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
1633
1634 typedef enum _CM_SHARE_DISPOSITION {
1635 CmResourceShareUndetermined,
1636 CmResourceShareDeviceExclusive,
1637 CmResourceShareDriverExclusive,
1638 CmResourceShareShared
1639 } CM_SHARE_DISPOSITION;
1640
1641 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
1642
1643 #define CM_RESOURCE_PORT_MEMORY 0x0000
1644 #define CM_RESOURCE_PORT_IO 0x0001
1645 #define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
1646 #define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
1647 #define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
1648 #define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
1649 #define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
1650 #define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
1651
1652 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
1653
1654 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
1655 #define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
1656
1657 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
1658
1659 #define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
1660 #define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
1661 #define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
1662 #define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
1663 #define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
1664 #define CM_RESOURCE_MEMORY_24 0x0010
1665 #define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
1666
1667 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
1668
1669 #define CM_RESOURCE_DMA_8 0x0000
1670 #define CM_RESOURCE_DMA_16 0x0001
1671 #define CM_RESOURCE_DMA_32 0x0002
1672 #define CM_RESOURCE_DMA_8_AND_16 0x0004
1673 #define CM_RESOURCE_DMA_BUS_MASTER 0x0008
1674 #define CM_RESOURCE_DMA_TYPE_A 0x0010
1675 #define CM_RESOURCE_DMA_TYPE_B 0x0020
1676 #define CM_RESOURCE_DMA_TYPE_F 0x0040
1677
1678 typedef struct _CM_PARTIAL_RESOURCE_LIST {
1679 USHORT Version;
1680 USHORT Revision;
1681 ULONG Count;
1682 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
1683 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
1684
1685 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
1686 INTERFACE_TYPE InterfaceType;
1687 ULONG BusNumber;
1688 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
1689 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
1690
1691 typedef struct _CM_RESOURCE_LIST {
1692 ULONG Count;
1693 CM_FULL_RESOURCE_DESCRIPTOR List[1];
1694 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
1695
1696 typedef struct _CM_INT13_DRIVE_PARAMETER {
1697 USHORT DriveSelect;
1698 ULONG MaxCylinders;
1699 USHORT SectorsPerTrack;
1700 USHORT MaxHeads;
1701 USHORT NumberDrives;
1702 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
1703
1704 typedef struct _CM_PNP_BIOS_DEVICE_NODE
1705 {
1706 USHORT Size;
1707 UCHAR Node;
1708 ULONG ProductId;
1709 UCHAR DeviceType[3];
1710 USHORT DeviceAttributes;
1711 } CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE;
1712
1713 typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK
1714 {
1715 UCHAR Signature[4];
1716 UCHAR Revision;
1717 UCHAR Length;
1718 USHORT ControlField;
1719 UCHAR Checksum;
1720 ULONG EventFlagAddress;
1721 USHORT RealModeEntryOffset;
1722 USHORT RealModeEntrySegment;
1723 USHORT ProtectedModeEntryOffset;
1724 ULONG ProtectedModeCodeBaseAddress;
1725 ULONG OemDeviceId;
1726 USHORT RealModeDataBaseAddress;
1727 ULONG ProtectedModeDataBaseAddress;
1728 } CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
1729
1730 #include <poppack.h>
1731
1732
1733 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
1734 {
1735 ULONG BytesPerSector;
1736 ULONG NumberOfCylinders;
1737 ULONG SectorsPerTrack;
1738 ULONG NumberOfHeads;
1739 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
1740
1741 typedef struct _CM_KEYBOARD_DEVICE_DATA {
1742 USHORT Version;
1743 USHORT Revision;
1744 UCHAR Type;
1745 UCHAR Subtype;
1746 USHORT KeyboardFlags;
1747 } CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
1748
1749 #define KEYBOARD_INSERT_ON 0x08
1750 #define KEYBOARD_CAPS_LOCK_ON 0x04
1751 #define KEYBOARD_NUM_LOCK_ON 0x02
1752 #define KEYBOARD_SCROLL_LOCK_ON 0x01
1753 #define KEYBOARD_ALT_KEY_DOWN 0x80
1754 #define KEYBOARD_CTRL_KEY_DOWN 0x40
1755 #define KEYBOARD_LEFT_SHIFT_DOWN 0x20
1756 #define KEYBOARD_RIGHT_SHIFT_DOWN 0x10
1757
1758 typedef struct _CM_MCA_POS_DATA {
1759 USHORT AdapterId;
1760 UCHAR PosData1;
1761 UCHAR PosData2;
1762 UCHAR PosData3;
1763 UCHAR PosData4;
1764 } CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
1765
1766 typedef struct CM_Power_Data_s {
1767 ULONG PD_Size;
1768 DEVICE_POWER_STATE PD_MostRecentPowerState;
1769 ULONG PD_Capabilities;
1770 ULONG PD_D1Latency;
1771 ULONG PD_D2Latency;
1772 ULONG PD_D3Latency;
1773 DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum];
1774 } CM_POWER_DATA, *PCM_POWER_DATA;
1775
1776 #define PDCAP_D0_SUPPORTED 0x00000001
1777 #define PDCAP_D1_SUPPORTED 0x00000002
1778 #define PDCAP_D2_SUPPORTED 0x00000004
1779 #define PDCAP_D3_SUPPORTED 0x00000008
1780 #define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
1781 #define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
1782 #define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
1783 #define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
1784 #define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
1785
1786 typedef struct _CM_SCSI_DEVICE_DATA {
1787 USHORT Version;
1788 USHORT Revision;
1789 UCHAR HostIdentifier;
1790 } CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
1791
1792 typedef struct _CM_SERIAL_DEVICE_DATA {
1793 USHORT Version;
1794 USHORT Revision;
1795 ULONG BaudClock;
1796 } CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
1797
1798 typedef struct _IO_COUNTERS {
1799 ULONGLONG ReadOperationCount;
1800 ULONGLONG WriteOperationCount;
1801 ULONGLONG OtherOperationCount;
1802 ULONGLONG ReadTransferCount;
1803 ULONGLONG WriteTransferCount;
1804 ULONGLONG OtherTransferCount;
1805 } IO_COUNTERS, *PIO_COUNTERS;
1806
1807 typedef struct _VM_COUNTERS
1808 {
1809 SIZE_T PeakVirtualSize;
1810 SIZE_T VirtualSize;
1811 ULONG PageFaultCount;
1812 SIZE_T PeakWorkingSetSize;
1813 SIZE_T WorkingSetSize;
1814 SIZE_T QuotaPeakPagedPoolUsage;
1815 SIZE_T QuotaPagedPoolUsage;
1816 SIZE_T QuotaPeakNonPagedPoolUsage;
1817 SIZE_T QuotaNonPagedPoolUsage;
1818 SIZE_T PagefileUsage;
1819 SIZE_T PeakPagefileUsage;
1820 } VM_COUNTERS, *PVM_COUNTERS;
1821
1822 typedef struct _VM_COUNTERS_EX
1823 {
1824 SIZE_T PeakVirtualSize;
1825 SIZE_T VirtualSize;
1826 ULONG PageFaultCount;
1827 SIZE_T PeakWorkingSetSize;
1828 SIZE_T WorkingSetSize;
1829 SIZE_T QuotaPeakPagedPoolUsage;
1830 SIZE_T QuotaPagedPoolUsage;
1831 SIZE_T QuotaPeakNonPagedPoolUsage;
1832 SIZE_T QuotaNonPagedPoolUsage;
1833 SIZE_T PagefileUsage;
1834 SIZE_T PeakPagefileUsage;
1835 SIZE_T PrivateUsage;
1836 } VM_COUNTERS_EX, *PVM_COUNTERS_EX;
1837
1838 typedef struct _POOLED_USAGE_AND_LIMITS
1839 {
1840 SIZE_T PeakPagedPoolUsage;
1841 SIZE_T PagedPoolUsage;
1842 SIZE_T PagedPoolLimit;
1843 SIZE_T PeakNonPagedPoolUsage;
1844 SIZE_T NonPagedPoolUsage;
1845 SIZE_T NonPagedPoolLimit;
1846 SIZE_T PeakPagefileUsage;
1847 SIZE_T PagefileUsage;
1848 SIZE_T PagefileLimit;
1849 } POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS;
1850
1851 typedef enum _KINTERRUPT_POLARITY
1852 {
1853 InterruptPolarityUnknown,
1854 InterruptActiveHigh,
1855 InterruptActiveLow
1856 } KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY;
1857
1858 typedef struct _IO_ERROR_LOG_PACKET {
1859 UCHAR MajorFunctionCode;
1860 UCHAR RetryCount;
1861 USHORT DumpDataSize;
1862 USHORT NumberOfStrings;
1863 USHORT StringOffset;
1864 USHORT EventCategory;
1865 NTSTATUS ErrorCode;
1866 ULONG UniqueErrorValue;
1867 NTSTATUS FinalStatus;
1868 ULONG SequenceNumber;
1869 ULONG IoControlCode;
1870 LARGE_INTEGER DeviceOffset;
1871 ULONG DumpData[1];
1872 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
1873
1874 typedef struct _IO_ERROR_LOG_MESSAGE {
1875 USHORT Type;
1876 USHORT Size;
1877 USHORT DriverNameLength;
1878 LARGE_INTEGER TimeStamp;
1879 ULONG DriverNameOffset;
1880 IO_ERROR_LOG_PACKET EntryData;
1881 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
1882
1883 #define ERROR_LOG_LIMIT_SIZE 240
1884 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1885 sizeof(IO_ERROR_LOG_PACKET) + \
1886 (sizeof(WCHAR) * 40))
1887 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
1888 (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1889 #define IO_ERROR_LOG_MESSAGE_LENGTH \
1890 ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
1891 ERROR_LOG_MESSAGE_LIMIT_SIZE : \
1892 PORT_MAXIMUM_MESSAGE_LENGTH)
1893 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
1894 IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1895
1896 typedef struct _CONTROLLER_OBJECT {
1897 CSHORT Type;
1898 CSHORT Size;
1899 PVOID ControllerExtension;
1900 KDEVICE_QUEUE DeviceWaitQueue;
1901 ULONG Spare1;
1902 LARGE_INTEGER Spare2;
1903 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
1904
1905 typedef enum _DMA_WIDTH {
1906 Width8Bits,
1907 Width16Bits,
1908 Width32Bits,
1909 MaximumDmaWidth
1910 } DMA_WIDTH, *PDMA_WIDTH;
1911
1912 typedef enum _DMA_SPEED {
1913 Compatible,
1914 TypeA,
1915 TypeB,
1916 TypeC,
1917 TypeF,
1918 MaximumDmaSpeed
1919 } DMA_SPEED, *PDMA_SPEED;
1920
1921 /* DEVICE_DESCRIPTION.Version */
1922
1923 #define DEVICE_DESCRIPTION_VERSION 0x0000
1924 #define DEVICE_DESCRIPTION_VERSION1 0x0001
1925 #define DEVICE_DESCRIPTION_VERSION2 0x0002
1926
1927 typedef struct _DEVICE_DESCRIPTION {
1928 ULONG Version;
1929 BOOLEAN Master;
1930 BOOLEAN ScatterGather;
1931 BOOLEAN DemandMode;
1932 BOOLEAN AutoInitialize;
1933 BOOLEAN Dma32BitAddresses;
1934 BOOLEAN IgnoreCount;
1935 BOOLEAN Reserved1;
1936 BOOLEAN Dma64BitAddresses;
1937 ULONG BusNumber;
1938 ULONG DmaChannel;
1939 INTERFACE_TYPE InterfaceType;
1940 DMA_WIDTH DmaWidth;
1941 DMA_SPEED DmaSpeed;
1942 ULONG MaximumLength;
1943 ULONG DmaPort;
1944 } DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
1945
1946 /* VPB.Flags */
1947 #define VPB_MOUNTED 0x0001
1948 #define VPB_LOCKED 0x0002
1949 #define VPB_PERSISTENT 0x0004
1950 #define VPB_REMOVE_PENDING 0x0008
1951 #define VPB_RAW_MOUNT 0x0010
1952
1953 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
1954
1955 typedef struct _VPB {
1956 CSHORT Type;
1957 CSHORT Size;
1958 USHORT Flags;
1959 USHORT VolumeLabelLength;
1960 struct _DEVICE_OBJECT *DeviceObject;
1961 struct _DEVICE_OBJECT *RealDevice;
1962 ULONG SerialNumber;
1963 ULONG ReferenceCount;
1964 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
1965 } VPB, *PVPB;
1966
1967 /* DEVICE_OBJECT.Flags */
1968
1969 #define DO_VERIFY_VOLUME 0x00000002
1970 #define DO_BUFFERED_IO 0x00000004
1971 #define DO_EXCLUSIVE 0x00000008
1972 #define DO_DIRECT_IO 0x00000010
1973 #define DO_MAP_IO_BUFFER 0x00000020
1974 #define DO_DEVICE_HAS_NAME 0x00000040
1975 #define DO_DEVICE_INITIALIZING 0x00000080
1976 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
1977 #define DO_LONG_TERM_REQUESTS 0x00000200
1978 #define DO_NEVER_LAST_DEVICE 0x00000400
1979 #define DO_SHUTDOWN_REGISTERED 0x00000800
1980 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
1981 #define DO_POWER_PAGABLE 0x00002000
1982 #define DO_POWER_INRUSH 0x00004000
1983 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
1984 #define DO_XIP 0x00020000
1985
1986 /* DEVICE_OBJECT.Characteristics */
1987
1988 #define FILE_REMOVABLE_MEDIA 0x00000001
1989 #define FILE_READ_ONLY_DEVICE 0x00000002
1990 #define FILE_FLOPPY_DISKETTE 0x00000004
1991 #define FILE_WRITE_ONCE_MEDIA 0x00000008
1992 #define FILE_REMOTE_DEVICE 0x00000010
1993 #define FILE_DEVICE_IS_MOUNTED 0x00000020
1994 #define FILE_VIRTUAL_VOLUME 0x00000040
1995 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
1996 #define FILE_DEVICE_SECURE_OPEN 0x00000100
1997
1998 /* DEVICE_OBJECT.AlignmentRequirement */
1999
2000 #define FILE_BYTE_ALIGNMENT 0x00000000
2001 #define FILE_WORD_ALIGNMENT 0x00000001
2002 #define FILE_LONG_ALIGNMENT 0x00000003
2003 #define FILE_QUAD_ALIGNMENT 0x00000007
2004 #define FILE_OCTA_ALIGNMENT 0x0000000f
2005 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
2006 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
2007 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
2008 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
2009 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
2010
2011 /* DEVICE_OBJECT.DeviceType */
2012
2013 #define DEVICE_TYPE ULONG
2014
2015 #define FILE_DEVICE_BEEP 0x00000001
2016 #define FILE_DEVICE_CD_ROM 0x00000002
2017 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
2018 #define FILE_DEVICE_CONTROLLER 0x00000004
2019 #define FILE_DEVICE_DATALINK 0x00000005
2020 #define FILE_DEVICE_DFS 0x00000006
2021 #define FILE_DEVICE_DISK 0x00000007
2022 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
2023 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
2024 #define FILE_DEVICE_INPORT_PORT 0x0000000a
2025 #define FILE_DEVICE_KEYBOARD 0x0000000b
2026 #define FILE_DEVICE_MAILSLOT 0x0000000c
2027 #define FILE_DEVICE_MIDI_IN 0x0000000d
2028 #define FILE_DEVICE_MIDI_OUT 0x0000000e
2029 #define FILE_DEVICE_MOUSE 0x0000000f
2030 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
2031 #define FILE_DEVICE_NAMED_PIPE 0x00000011
2032 #define FILE_DEVICE_NETWORK 0x00000012
2033 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
2034 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
2035 #define FILE_DEVICE_NULL 0x00000015
2036 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
2037 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
2038 #define FILE_DEVICE_PRINTER 0x00000018
2039 #define FILE_DEVICE_SCANNER 0x00000019
2040 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
2041 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
2042 #define FILE_DEVICE_SCREEN 0x0000001c
2043 #define FILE_DEVICE_SOUND 0x0000001d
2044 #define FILE_DEVICE_STREAMS 0x0000001e
2045 #define FILE_DEVICE_TAPE 0x0000001f
2046 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
2047 #define FILE_DEVICE_TRANSPORT 0x00000021
2048 #define FILE_DEVICE_UNKNOWN 0x00000022
2049 #define FILE_DEVICE_VIDEO 0x00000023
2050 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
2051 #define FILE_DEVICE_WAVE_IN 0x00000025
2052 #define FILE_DEVICE_WAVE_OUT 0x00000026
2053 #define FILE_DEVICE_8042_PORT 0x00000027
2054 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
2055 #define FILE_DEVICE_BATTERY 0x00000029
2056 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
2057 #define FILE_DEVICE_MODEM 0x0000002b
2058 #define FILE_DEVICE_VDM 0x0000002c
2059 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
2060 #define FILE_DEVICE_SMB 0x0000002e
2061 #define FILE_DEVICE_KS 0x0000002f
2062 #define FILE_DEVICE_CHANGER 0x00000030
2063 #define FILE_DEVICE_SMARTCARD 0x00000031
2064 #define FILE_DEVICE_ACPI 0x00000032
2065 #define FILE_DEVICE_DVD 0x00000033
2066 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
2067 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
2068 #define FILE_DEVICE_DFS_VOLUME 0x00000036
2069 #define FILE_DEVICE_SERENUM 0x00000037
2070 #define FILE_DEVICE_TERMSRV 0x00000038
2071 #define FILE_DEVICE_KSEC 0x00000039
2072 #define FILE_DEVICE_FIPS 0x0000003a
2073
2074 typedef struct _DEVICE_OBJECT {
2075 CSHORT Type;
2076 USHORT Size;
2077 LONG ReferenceCount;
2078 struct _DRIVER_OBJECT *DriverObject;
2079 struct _DEVICE_OBJECT *NextDevice;
2080 struct _DEVICE_OBJECT *AttachedDevice;
2081 struct _IRP *CurrentIrp;
2082 PIO_TIMER Timer;
2083 ULONG Flags;
2084 ULONG Characteristics;
2085 volatile PVPB Vpb;
2086 PVOID DeviceExtension;
2087 DEVICE_TYPE DeviceType;
2088 CCHAR StackSize;
2089 union {
2090 LIST_ENTRY ListEntry;
2091 WAIT_CONTEXT_BLOCK Wcb;
2092 } Queue;
2093 ULONG AlignmentRequirement;
2094 KDEVICE_QUEUE DeviceQueue;
2095 KDPC Dpc;
2096 ULONG ActiveThreadCount;
2097 PSECURITY_DESCRIPTOR SecurityDescriptor;
2098 KEVENT DeviceLock;
2099 USHORT SectorSize;
2100 USHORT Spare1;
2101 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
2102 PVOID Reserved;
2103 } DEVICE_OBJECT, *PDEVICE_OBJECT;
2104
2105 typedef enum _DEVICE_RELATION_TYPE {
2106 BusRelations,
2107 EjectionRelations,
2108 PowerRelations,
2109 RemovalRelations,
2110 TargetDeviceRelation,
2111 SingleBusRelations
2112 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
2113
2114 typedef struct _DEVICE_RELATIONS {
2115 ULONG Count;
2116 PDEVICE_OBJECT Objects[1];
2117 } DEVICE_RELATIONS, *PDEVICE_RELATIONS;
2118
2119 typedef struct _SCATTER_GATHER_ELEMENT {
2120 PHYSICAL_ADDRESS Address;
2121 ULONG Length;
2122 ULONG_PTR Reserved;
2123 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
2124
2125 typedef struct _SCATTER_GATHER_LIST {
2126 ULONG NumberOfElements;
2127 ULONG_PTR Reserved;
2128 SCATTER_GATHER_ELEMENT Elements[1];
2129 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
2130
2131 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
2132 #define MDL_PAGES_LOCKED 0x0002
2133 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
2134 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
2135 #define MDL_PARTIAL 0x0010
2136 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
2137 #define MDL_IO_PAGE_READ 0x0040
2138 #define MDL_WRITE_OPERATION 0x0080
2139 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
2140 #define MDL_FREE_EXTRA_PTES 0x0200
2141 #define MDL_DESCRIBES_AWE 0x0400
2142 #define MDL_IO_SPACE 0x0800
2143 #define MDL_NETWORK_HEADER 0x1000
2144 #define MDL_MAPPING_CAN_FAIL 0x2000
2145 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
2146 #define MDL_INTERNAL 0x8000
2147
2148
2149 #define MDL_MAPPING_FLAGS ( \
2150 MDL_MAPPED_TO_SYSTEM_VA | \
2151 MDL_PAGES_LOCKED | \
2152 MDL_SOURCE_IS_NONPAGED_POOL | \
2153 MDL_PARTIAL_HAS_BEEN_MAPPED | \
2154 MDL_PARENT_MAPPED_SYSTEM_VA | \
2155 MDL_SYSTEM_VA | \
2156 MDL_IO_SPACE)
2157
2158 typedef struct _DRIVER_EXTENSION {
2159 struct _DRIVER_OBJECT *DriverObject;
2160 PDRIVER_ADD_DEVICE AddDevice;
2161 ULONG Count;
2162 UNICODE_STRING ServiceKeyName;
2163 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
2164
2165 #define DRVO_UNLOAD_INVOKED 0x00000001
2166 #define DRVO_LEGACY_DRIVER 0x00000002
2167 #define DRVO_BUILTIN_DRIVER 0x00000004
2168 #define DRVO_REINIT_REGISTERED 0x00000008
2169 #define DRVO_INITIALIZED 0x00000010
2170 #define DRVO_BOOTREINIT_REGISTERED 0x00000020
2171 #define DRVO_LEGACY_RESOURCES 0x00000040
2172
2173 typedef struct _DRIVER_OBJECT {
2174 CSHORT Type;
2175 CSHORT Size;
2176 PDEVICE_OBJECT DeviceObject;
2177 ULONG Flags;
2178 PVOID DriverStart;
2179 ULONG DriverSize;
2180 PVOID DriverSection;
2181 PDRIVER_EXTENSION DriverExtension;
2182 UNICODE_STRING DriverName;
2183 PUNICODE_STRING HardwareDatabase;
2184 struct _FAST_IO_DISPATCH *FastIoDispatch;
2185 PDRIVER_INITIALIZE DriverInit;
2186 PDRIVER_STARTIO DriverStartIo;
2187 PDRIVER_UNLOAD DriverUnload;
2188 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
2189 } DRIVER_OBJECT;
2190 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
2191
2192 typedef struct _DMA_ADAPTER {
2193 USHORT Version;
2194 USHORT Size;
2195 struct _DMA_OPERATIONS* DmaOperations;
2196 } DMA_ADAPTER, *PDMA_ADAPTER;
2197
2198 typedef VOID
2199 (DDKAPI *PPUT_DMA_ADAPTER)(
2200 IN PDMA_ADAPTER DmaAdapter);
2201
2202 typedef PVOID
2203 (DDKAPI *PALLOCATE_COMMON_BUFFER)(
2204 IN PDMA_ADAPTER DmaAdapter,
2205 IN ULONG Length,
2206 OUT PPHYSICAL_ADDRESS LogicalAddress,
2207 IN BOOLEAN CacheEnabled);
2208
2209 typedef VOID
2210 (DDKAPI *PFREE_COMMON_BUFFER)(
2211 IN PDMA_ADAPTER DmaAdapter,
2212 IN ULONG Length,
2213 IN PHYSICAL_ADDRESS LogicalAddress,
2214 IN PVOID VirtualAddress,
2215 IN BOOLEAN CacheEnabled);
2216
2217 typedef NTSTATUS
2218 (DDKAPI *PALLOCATE_ADAPTER_CHANNEL)(
2219 IN PDMA_ADAPTER DmaAdapter,
2220 IN PDEVICE_OBJECT DeviceObject,
2221 IN ULONG NumberOfMapRegisters,
2222 IN PDRIVER_CONTROL ExecutionRoutine,
2223 IN PVOID Context);
2224
2225 typedef BOOLEAN
2226 (DDKAPI *PFLUSH_ADAPTER_BUFFERS)(
2227 IN PDMA_ADAPTER DmaAdapter,
2228 IN PMDL Mdl,
2229 IN PVOID MapRegisterBase,
2230 IN PVOID CurrentVa,
2231 IN ULONG Length,
2232 IN BOOLEAN WriteToDevice);
2233
2234 typedef VOID
2235 (DDKAPI *PFREE_ADAPTER_CHANNEL)(
2236 IN PDMA_ADAPTER DmaAdapter);
2237
2238 typedef VOID
2239 (DDKAPI *PFREE_MAP_REGISTERS)(
2240 IN PDMA_ADAPTER DmaAdapter,
2241 PVOID MapRegisterBase,
2242 ULONG NumberOfMapRegisters);
2243
2244 typedef PHYSICAL_ADDRESS
2245 (DDKAPI *PMAP_TRANSFER)(
2246 IN PDMA_ADAPTER DmaAdapter,
2247 IN PMDL Mdl,
2248 IN PVOID MapRegisterBase,
2249 IN PVOID CurrentVa,
2250 IN OUT PULONG Length,
2251 IN BOOLEAN WriteToDevice);
2252
2253 typedef ULONG
2254 (DDKAPI *PGET_DMA_ALIGNMENT)(
2255 IN PDMA_ADAPTER DmaAdapter);
2256
2257 typedef ULONG
2258 (DDKAPI *PREAD_DMA_COUNTER)(
2259 IN PDMA_ADAPTER DmaAdapter);
2260
2261 typedef NTSTATUS
2262 (DDKAPI *PGET_SCATTER_GATHER_LIST)(
2263 IN PDMA_ADAPTER DmaAdapter,
2264 IN PDEVICE_OBJECT DeviceObject,
2265 IN PMDL Mdl,
2266 IN PVOID CurrentVa,
2267 IN ULONG Length,
2268 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
2269 IN PVOID Context,
2270 IN BOOLEAN WriteToDevice);
2271
2272 typedef VOID
2273 (DDKAPI *PPUT_SCATTER_GATHER_LIST)(
2274 IN PDMA_ADAPTER DmaAdapter,
2275 IN PSCATTER_GATHER_LIST ScatterGather,
2276 IN BOOLEAN WriteToDevice);
2277
2278 typedef NTSTATUS
2279 (DDKAPI *PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
2280 IN PDMA_ADAPTER DmaAdapter,
2281 IN PMDL Mdl OPTIONAL,
2282 IN PVOID CurrentVa,
2283 IN ULONG Length,
2284 OUT PULONG ScatterGatherListSize,
2285 OUT PULONG pNumberOfMapRegisters OPTIONAL);
2286
2287 typedef NTSTATUS
2288 (DDKAPI *PBUILD_SCATTER_GATHER_LIST)(
2289 IN PDMA_ADAPTER DmaAdapter,
2290 IN PDEVICE_OBJECT DeviceObject,
2291 IN PMDL Mdl,
2292 IN PVOID CurrentVa,
2293 IN ULONG Length,
2294 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
2295 IN PVOID Context,
2296 IN BOOLEAN WriteToDevice,
2297 IN PVOID ScatterGatherBuffer,
2298 IN ULONG ScatterGatherLength);
2299
2300 typedef NTSTATUS
2301 (DDKAPI *PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
2302 IN PDMA_ADAPTER DmaAdapter,
2303 IN PSCATTER_GATHER_LIST ScatterGather,
2304 IN PMDL OriginalMdl,
2305 OUT PMDL *TargetMdl);
2306
2307 typedef struct _DMA_OPERATIONS {
2308 ULONG Size;
2309 PPUT_DMA_ADAPTER PutDmaAdapter;
2310 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
2311 PFREE_COMMON_BUFFER FreeCommonBuffer;
2312 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
2313 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
2314 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
2315 PFREE_MAP_REGISTERS FreeMapRegisters;
2316 PMAP_TRANSFER MapTransfer;
2317 PGET_DMA_ALIGNMENT GetDmaAlignment;
2318 PREAD_DMA_COUNTER ReadDmaCounter;
2319 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
2320 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
2321 PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList;
2322 PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList;
2323 PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList;
2324 } DMA_OPERATIONS, *PDMA_OPERATIONS;
2325
2326 typedef enum _ARBITER_REQUEST_SOURCE {
2327 ArbiterRequestUndefined = -1,
2328 ArbiterRequestLegacyReported,
2329 ArbiterRequestHalReported,
2330 ArbiterRequestLegacyAssigned,
2331 ArbiterRequestPnpDetected,
2332 ArbiterRequestPnpEnumerated
2333 } ARBITER_REQUEST_SOURCE;
2334
2335 typedef enum _ARBITER_RESULT {
2336 ArbiterResultUndefined = -1,
2337 ArbiterResultSuccess,
2338 ArbiterResultExternalConflict,
2339 ArbiterResultNullRequest
2340 } ARBITER_RESULT;
2341
2342 typedef enum _ARBITER_ACTION {
2343 ArbiterActionTestAllocation,
2344 ArbiterActionRetestAllocation,
2345 ArbiterActionCommitAllocation,
2346 ArbiterActionRollbackAllocation,
2347 ArbiterActionQueryAllocatedResources,
2348 ArbiterActionWriteReservedResources,
2349 ArbiterActionQueryConflict,
2350 ArbiterActionQueryArbitrate,
2351 ArbiterActionAddReserved,
2352 ArbiterActionBootAllocation
2353 } ARBITER_ACTION, *PARBITER_ACTION;
2354
2355 typedef struct _ARBITER_CONFLICT_INFO {
2356 PDEVICE_OBJECT OwningObject;
2357 ULONGLONG Start;
2358 ULONGLONG End;
2359 } ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO;
2360
2361 typedef struct _ARBITER_PARAMETERS {
2362 union {
2363 struct {
2364 IN OUT PLIST_ENTRY ArbitrationList;
2365 IN ULONG AllocateFromCount;
2366 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
2367 } TestAllocation;
2368
2369 struct {
2370 IN OUT PLIST_ENTRY ArbitrationList;
2371 IN ULONG AllocateFromCount;
2372 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
2373 } RetestAllocation;
2374
2375 struct {
2376 IN OUT PLIST_ENTRY ArbitrationList;
2377 } BootAllocation;
2378
2379 struct {
2380 OUT PCM_PARTIAL_RESOURCE_LIST *AllocatedResources;
2381 } QueryAllocatedResources;
2382
2383 struct {
2384 IN PDEVICE_OBJECT PhysicalDeviceObject;
2385 IN PIO_RESOURCE_DESCRIPTOR ConflictingResource;
2386 OUT PULONG ConflictCount;
2387 OUT PARBITER_CONFLICT_INFO *Conflicts;
2388 } QueryConflict;
2389
2390 struct {
2391 IN PLIST_ENTRY ArbitrationList;
2392 } QueryArbitrate;
2393
2394 struct {
2395 IN PDEVICE_OBJECT ReserveDevice;
2396 } AddReserved;
2397 } Parameters;
2398 } ARBITER_PARAMETERS, *PARBITER_PARAMETERS;
2399
2400 #define ARBITER_FLAG_BOOT_CONFIG 0x00000001
2401
2402 typedef struct _ARBITER_LIST_ENTRY {
2403 LIST_ENTRY ListEntry;
2404 ULONG AlternativeCount;
2405 PIO_RESOURCE_DESCRIPTOR Alternatives;
2406 PDEVICE_OBJECT PhysicalDeviceObject;
2407 ARBITER_REQUEST_SOURCE RequestSource;
2408 ULONG Flags;
2409 LONG_PTR WorkSpace;
2410 INTERFACE_TYPE InterfaceType;
2411 ULONG SlotNumber;
2412 ULONG BusNumber;
2413 PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment;
2414 PIO_RESOURCE_DESCRIPTOR SelectedAlternative;
2415 ARBITER_RESULT Result;
2416 } ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY;
2417
2418 typedef NTSTATUS
2419 (DDKAPI *PARBITER_HANDLER)(
2420 IN PVOID Context,
2421 IN ARBITER_ACTION Action,
2422 IN OUT PARBITER_PARAMETERS Parameters);
2423
2424 #define ARBITER_PARTIAL 0x00000001
2425
2426 typedef struct _ARBITER_INTERFACE {
2427 USHORT Size;
2428 USHORT Version;
2429 PVOID Context;
2430 PINTERFACE_REFERENCE InterfaceReference;
2431 PINTERFACE_DEREFERENCE InterfaceDereference;
2432 PARBITER_HANDLER ArbiterHandler;
2433 ULONG Flags;
2434 } ARBITER_INTERFACE, *PARBITER_INTERFACE;
2435
2436 typedef enum _KPROFILE_SOURCE {
2437 ProfileTime,
2438 ProfileAlignmentFixup,
2439 ProfileTotalIssues,
2440 ProfilePipelineDry,
2441 ProfileLoadInstructions,
2442 ProfilePipelineFrozen,
2443 ProfileBranchInstructions,
2444 ProfileTotalNonissues,
2445 ProfileDcacheMisses,
2446 ProfileIcacheMisses,
2447 ProfileCacheMisses,
2448 ProfileBranchMispredictions,
2449 ProfileStoreInstructions,
2450 ProfileFpInstructions,
2451 ProfileIntegerInstructions,
2452 Profile2Issue,
2453 Profile3Issue,
2454 Profile4Issue,
2455 ProfileSpecialInstructions,
2456 ProfileTotalCycles,
2457 ProfileIcacheIssues,
2458 ProfileDcacheAccesses,
2459 ProfileMemoryBarrierCycles,
2460 ProfileLoadLinkedIssues,
2461 ProfileMaximum
2462 } KPROFILE_SOURCE;
2463
2464 typedef enum _HAL_QUERY_INFORMATION_CLASS {
2465 HalInstalledBusInformation,
2466 HalProfileSourceInformation,
2467 HalInformationClassUnused1,
2468 HalPowerInformation,
2469 HalProcessorSpeedInformation,
2470 HalCallbackInformation,
2471 HalMapRegisterInformation,
2472 HalMcaLogInformation,
2473 HalFrameBufferCachingInformation,
2474 HalDisplayBiosInformation,
2475 HalProcessorFeatureInformation,
2476 HalNumaTopologyInterface,
2477 HalErrorInformation,
2478 HalCmcLogInformation,
2479 HalCpeLogInformation,
2480 HalQueryMcaInterface,
2481 HalQueryAMLIIllegalIOPortAddresses,
2482 HalQueryMaxHotPlugMemoryAddress,
2483 HalPartitionIpiInterface,
2484 HalPlatformInformation,
2485 HalQueryProfileSourceList
2486 } HAL_QUERY_INFORMATION_CLASS, *PHAL_QUERY_INFORMATION_CLASS;
2487
2488 typedef enum _HAL_SET_INFORMATION_CLASS {
2489 HalProfileSourceInterval,
2490 HalProfileSourceInterruptHandler,
2491 HalMcaRegisterDriver,
2492 HalKernelErrorHandler,
2493 HalCmcRegisterDriver,
2494 HalCpeRegisterDriver,
2495 HalMcaLog,
2496 HalCmcLog,
2497 HalCpeLog,
2498 HalGenerateCmcInterrupt
2499 } HAL_SET_INFORMATION_CLASS, *PHAL_SET_INFORMATION_CLASS;
2500
2501 typedef struct _HAL_PROFILE_SOURCE_INTERVAL
2502 {
2503 KPROFILE_SOURCE Source;
2504 ULONG_PTR Interval;
2505 } HAL_PROFILE_SOURCE_INTERVAL, *PHAL_PROFILE_SOURCE_INTERVAL;
2506
2507 typedef struct _HAL_PROFILE_SOURCE_INFORMATION
2508 {
2509 KPROFILE_SOURCE Source;
2510 BOOLEAN Supported;
2511 ULONG Interval;
2512 } HAL_PROFILE_SOURCE_INFORMATION, *PHAL_PROFILE_SOURCE_INFORMATION;
2513
2514 typedef struct _MAP_REGISTER_ENTRY
2515 {
2516 PVOID MapRegister;
2517 BOOLEAN WriteToDevice;
2518 } MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
2519
2520 typedef struct
2521 {
2522 UCHAR Type;
2523 BOOLEAN Valid;
2524 UCHAR Reserved[2];
2525 PUCHAR TranslatedAddress;
2526 ULONG Length;
2527 } DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS;
2528
2529 typedef struct
2530 {
2531 PHYSICAL_ADDRESS Start;
2532 PHYSICAL_ADDRESS MaxEnd;
2533 PVOID VirtualAddress;
2534 ULONG Length;
2535 BOOLEAN Cached;
2536 BOOLEAN Aligned;
2537 } DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS;
2538
2539 typedef struct
2540 {
2541 ULONG Bus;
2542 ULONG Slot;
2543 USHORT VendorID;
2544 USHORT DeviceID;
2545 UCHAR BaseClass;
2546 UCHAR SubClass;
2547 UCHAR ProgIf;
2548 BOOLEAN Initialized;
2549 DEBUG_DEVICE_ADDRESS BaseAddress[6];
2550 DEBUG_MEMORY_REQUIREMENTS Memory;
2551 } DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR;
2552
2553 typedef enum _KD_OPTION {
2554 KD_OPTION_SET_BLOCK_ENABLE,
2555 } KD_OPTION;
2556
2557 /* Function Type Defintions for Dispatch Functions */
2558 struct _DEVICE_CONTROL_CONTEXT;
2559
2560 typedef VOID
2561 (DDKAPI *PDEVICE_CONTROL_COMPLETION)(
2562 IN struct _DEVICE_CONTROL_CONTEXT *ControlContext);
2563
2564 typedef struct _DEVICE_CONTROL_CONTEXT {
2565 NTSTATUS Status;
2566 PDEVICE_HANDLER_OBJECT DeviceHandler;
2567 PDEVICE_OBJECT DeviceObject;
2568 ULONG ControlCode;
2569 PVOID Buffer;
2570 PULONG BufferLength;
2571 PVOID Context;
2572 } DEVICE_CONTROL_CONTEXT, *PDEVICE_CONTROL_CONTEXT;
2573
2574 typedef struct _PM_DISPATCH_TABLE {
2575 ULONG Signature;
2576 ULONG Version;
2577 PVOID Function[1];
2578 } PM_DISPATCH_TABLE, *PPM_DISPATCH_TABLE;
2579
2580 typedef enum _RESOURCE_TRANSLATION_DIRECTION {
2581 TranslateChildToParent,
2582 TranslateParentToChild
2583 } RESOURCE_TRANSLATION_DIRECTION;
2584
2585 typedef NTSTATUS
2586 (DDKAPI *PTRANSLATE_RESOURCE_HANDLER)(
2587 IN PVOID Context,
2588 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Source,
2589 IN RESOURCE_TRANSLATION_DIRECTION Direction,
2590 IN ULONG AlternativesCount,
2591 IN IO_RESOURCE_DESCRIPTOR Alternatives[],
2592 IN PDEVICE_OBJECT PhysicalDeviceObject,
2593 OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Target);
2594
2595 typedef NTSTATUS
2596 (DDKAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)(
2597 IN PVOID Context,
2598 IN PIO_RESOURCE_DESCRIPTOR Source,
2599 IN PDEVICE_OBJECT PhysicalDeviceObject,
2600 OUT PULONG TargetCount,
2601 OUT PIO_RESOURCE_DESCRIPTOR *Target);
2602
2603 typedef struct _TRANSLATOR_INTERFACE {
2604 USHORT Size;
2605 USHORT Version;
2606 PVOID Context;
2607 PINTERFACE_REFERENCE InterfaceReference;
2608 PINTERFACE_DEREFERENCE InterfaceDereference;
2609 PTRANSLATE_RESOURCE_HANDLER TranslateResources;
2610 PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements;
2611 } TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE;
2612
2613 typedef NTSTATUS
2614 (DDKAPI *pHalDeviceControl)(
2615 IN PDEVICE_HANDLER_OBJECT DeviceHandler,
2616 IN PDEVICE_OBJECT DeviceObject,
2617 IN ULONG ControlCode,
2618 IN OUT PVOID Buffer OPTIONAL,
2619 IN OUT PULONG BufferLength OPTIONAL,
2620 IN PVOID Context,
2621 IN PDEVICE_CONTROL_COMPLETION CompletionRoutine);
2622
2623 typedef VOID
2624 (FASTCALL *pHalExamineMBR)(
2625 IN PDEVICE_OBJECT DeviceObject,
2626 IN ULONG SectorSize,
2627 IN ULONG MBRTypeIdentifier,
2628 OUT PVOID *Buffer);
2629
2630 typedef VOID
2631 (FASTCALL *pHalIoAssignDriveLetters)(
2632 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
2633 IN PSTRING NtDeviceName,
2634 OUT PUCHAR NtSystemPath,
2635 OUT PSTRING NtSystemPathString);
2636
2637 typedef NTSTATUS
2638 (FASTCALL *pHalIoReadPartitionTable)(
2639 IN PDEVICE_OBJECT DeviceObject,
2640 IN ULONG SectorSize,
2641 IN BOOLEAN ReturnRecognizedPartitions,
2642 OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
2643
2644 typedef NTSTATUS
2645 (FASTCALL *pHalIoSetPartitionInformation)(
2646 IN PDEVICE_OBJECT DeviceObject,
2647 IN ULONG SectorSize,
2648 IN ULONG PartitionNumber,
2649 IN ULONG PartitionType);
2650
2651 typedef NTSTATUS
2652 (FASTCALL *pHalIoWritePartitionTable)(
2653 IN PDEVICE_OBJECT DeviceObject,
2654 IN ULONG SectorSize,
2655 IN ULONG SectorsPerTrack,
2656 IN ULONG NumberOfHeads,
2657 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
2658
2659 typedef PBUS_HANDLER
2660 (FASTCALL *pHalHandlerForBus)(
2661 IN INTERFACE_TYPE InterfaceType,
2662 IN ULONG BusNumber);
2663
2664 typedef VOID
2665 (FASTCALL *pHalReferenceBusHandler)(
2666 IN PBUS_HANDLER BusHandler);
2667
2668 typedef NTSTATUS
2669 (DDKAPI *pHalQuerySystemInformation)(
2670 IN HAL_QUERY_INFORMATION_CLASS InformationClass,
2671 IN ULONG BufferSize,
2672 IN OUT PVOID Buffer,
2673 OUT PULONG ReturnedLength);
2674
2675 typedef NTSTATUS
2676 (DDKAPI *pHalSetSystemInformation)(
2677 IN HAL_SET_INFORMATION_CLASS InformationClass,
2678 IN ULONG BufferSize,
2679 IN PVOID Buffer);
2680
2681 typedef NTSTATUS
2682 (DDKAPI *pHalQueryBusSlots)(
2683 IN PBUS_HANDLER BusHandler,
2684 IN ULONG BufferSize,
2685 OUT PULONG SlotNumbers,
2686 OUT PULONG ReturnedLength);
2687
2688 typedef NTSTATUS
2689 (DDKAPI *pHalInitPnpDriver)(
2690 VOID);
2691
2692 typedef NTSTATUS
2693 (DDKAPI *pHalInitPowerManagement)(
2694 IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
2695 OUT PPM_DISPATCH_TABLE *PmHalDispatchTable);
2696
2697 typedef struct _DMA_ADAPTER*
2698 (DDKAPI *pHalGetDmaAdapter)(
2699 IN PVOID Context,
2700 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
2701 OUT PULONG NumberOfMapRegisters);
2702
2703 typedef NTSTATUS
2704 (DDKAPI *pHalGetInterruptTranslator)(
2705 IN INTERFACE_TYPE ParentInterfaceType,
2706 IN ULONG ParentBusNumber,
2707 IN INTERFACE_TYPE BridgeInterfaceType,
2708 IN USHORT Size,
2709 IN USHORT Version,
2710 OUT PTRANSLATOR_INTERFACE Translator,
2711 OUT PULONG BridgeBusNumber);
2712
2713 typedef NTSTATUS
2714 (DDKAPI *pHalStartMirroring)(
2715 VOID);
2716
2717 typedef NTSTATUS
2718 (DDKAPI *pHalEndMirroring)(
2719 IN ULONG PassNumber);
2720
2721 typedef NTSTATUS
2722 (DDKAPI *pHalMirrorPhysicalMemory)(
2723 IN PHYSICAL_ADDRESS PhysicalAddress,
2724 IN LARGE_INTEGER NumberOfBytes);
2725
2726 typedef NTSTATUS
2727 (DDKAPI *pHalMirrorVerify)(
2728 IN PHYSICAL_ADDRESS PhysicalAddress,
2729 IN LARGE_INTEGER NumberOfBytes);
2730
2731 typedef VOID
2732 (DDKAPI *pHalEndOfBoot)(
2733 VOID);
2734
2735 typedef
2736 BOOLEAN
2737 (DDKAPI *pHalTranslateBusAddress)(
2738 IN INTERFACE_TYPE InterfaceType,
2739 IN ULONG BusNumber,
2740 IN PHYSICAL_ADDRESS BusAddress,
2741 IN OUT PULONG AddressSpace,
2742 OUT PPHYSICAL_ADDRESS TranslatedAddress
2743 );
2744
2745 typedef
2746 NTSTATUS
2747 (DDKAPI *pHalAssignSlotResources)(
2748 IN PUNICODE_STRING RegistryPath,
2749 IN PUNICODE_STRING DriverClassName OPTIONAL,
2750 IN PDRIVER_OBJECT DriverObject,
2751 IN PDEVICE_OBJECT DeviceObject,
2752 IN INTERFACE_TYPE BusType,
2753 IN ULONG BusNumber,
2754 IN ULONG SlotNumber,
2755 IN OUT PCM_RESOURCE_LIST *AllocatedResources
2756 );
2757
2758 typedef
2759 VOID
2760 (DDKAPI *pHalHaltSystem)(
2761 VOID
2762 );
2763
2764 typedef
2765 BOOLEAN
2766 (DDKAPI *pHalResetDisplay)(
2767 VOID
2768 );
2769
2770 typedef
2771 UCHAR
2772 (DDKAPI *pHalVectorToIDTEntry)(
2773 ULONG Vector
2774 );
2775
2776 typedef
2777 BOOLEAN
2778 (DDKAPI *pHalFindBusAddressTranslation)(
2779 IN PHYSICAL_ADDRESS BusAddress,
2780 IN OUT PULONG AddressSpace,
2781 OUT PPHYSICAL_ADDRESS TranslatedAddress,
2782 IN OUT PULONG_PTR Context,
2783 IN BOOLEAN NextBus
2784 );
2785
2786 typedef
2787 NTSTATUS
2788 (DDKAPI *pKdSetupPciDeviceForDebugging)(
2789 IN PVOID LoaderBlock OPTIONAL,
2790 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
2791 );
2792
2793 typedef
2794 NTSTATUS
2795 (DDKAPI *pKdReleasePciDeviceForDebugging)(
2796 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
2797 );
2798
2799 typedef
2800 PVOID
2801 (DDKAPI *pKdGetAcpiTablePhase0)(
2802 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
2803 IN ULONG Signature
2804 );
2805
2806 typedef
2807 VOID
2808 (DDKAPI *pKdCheckPowerButton)(
2809 VOID
2810 );
2811
2812 typedef
2813 ULONG
2814 (DDKAPI *pHalGetInterruptVector)(
2815 IN INTERFACE_TYPE InterfaceType,
2816 IN ULONG BusNumber,
2817 IN ULONG BusInterruptLevel,
2818 IN ULONG BusInterruptVector,
2819 OUT PKIRQL Irql,
2820 OUT PKAFFINITY Affinity
2821 );
2822
2823 typedef
2824 NTSTATUS
2825 (DDKAPI *pHalGetVectorInput)(
2826 IN ULONG Vector,
2827 IN KAFFINITY Affinity,
2828 OUT PULONG Input,
2829 OUT PKINTERRUPT_POLARITY Polarity
2830 );
2831
2832 typedef
2833 PVOID
2834 (DDKAPI *pKdMapPhysicalMemory64)(
2835 IN PHYSICAL_ADDRESS PhysicalAddress,
2836 IN ULONG NumberPages
2837 );
2838
2839 typedef
2840 VOID
2841 (DDKAPI *pKdUnmapVirtualAddress)(
2842 IN PVOID VirtualAddress,
2843 IN ULONG NumberPages
2844 );
2845
2846 typedef
2847 ULONG
2848 (DDKAPI *pKdGetPciDataByOffset)(
2849 IN ULONG BusNumber,
2850 IN ULONG SlotNumber,
2851 OUT PVOID Buffer,
2852 IN ULONG Offset,
2853 IN ULONG Length
2854 );
2855
2856 typedef
2857 ULONG
2858 (DDKAPI *pKdSetPciDataByOffset)(
2859 IN ULONG BusNumber,
2860 IN ULONG SlotNumber,
2861 IN PVOID Buffer,
2862 IN ULONG Offset,
2863 IN ULONG Length
2864 );
2865
2866 typedef BOOLEAN
2867 (DDKAPI *PHAL_RESET_DISPLAY_PARAMETERS)(
2868 ULONG Columns, ULONG Rows);
2869
2870 typedef struct {
2871 ULONG Version;
2872 pHalQuerySystemInformation HalQuerySystemInformation;
2873 pHalSetSystemInformation HalSetSystemInformation;
2874 pHalQueryBusSlots HalQueryBusSlots;
2875 ULONG Spare1;
2876 pHalExamineMBR HalExamineMBR;
2877 pHalIoAssignDriveLetters HalIoAssignDriveLetters;
2878 pHalIoReadPartitionTable HalIoReadPartitionTable;
2879 pHalIoSetPartitionInformation HalIoSetPartitionInformation;
2880 pHalIoWritePartitionTable HalIoWritePartitionTable;
2881 pHalHandlerForBus HalReferenceHandlerForBus;
2882 pHalReferenceBusHandler HalReferenceBusHandler;
2883 pHalReferenceBusHandler HalDereferenceBusHandler;
2884 pHalInitPnpDriver HalInitPnpDriver;
2885 pHalInitPowerManagement HalInitPowerManagement;
2886 pHalGetDmaAdapter HalGetDmaAdapter;
2887 pHalGetInterruptTranslator HalGetInterruptTranslator;
2888 pHalStartMirroring HalStartMirroring;
2889 pHalEndMirroring HalEndMirroring;
2890 pHalMirrorPhysicalMemory HalMirrorPhysicalMemory;
2891 pHalEndOfBoot HalEndOfBoot;
2892 pHalMirrorVerify HalMirrorVerify;
2893 } HAL_DISPATCH, *PHAL_DISPATCH;
2894
2895 #if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTHAL_)
2896 extern NTSYSAPI PHAL_DISPATCH HalDispatchTable;
2897 #define HALDISPATCH ((PHAL_DISPATCH)&HalDispatchTable)
2898 #else
2899 extern __declspec(dllexport) HAL_DISPATCH HalDispatchTable;
2900 #define HALDISPATCH (&HalDispatchTable)
2901 #endif
2902
2903 #define HAL_DISPATCH_VERSION 3
2904 #define HalDispatchTableVersion HALDISPATCH->Version
2905 #define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation
2906 #define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation
2907 #define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots
2908 #define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus
2909 #define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler
2910 #define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler
2911 #define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver
2912 #define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement
2913 #define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter
2914 #define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator
2915 #define HalStartMirroring HALDISPATCH->HalStartMirroring
2916 #define HalEndMirroring HALDISPATCH->HalEndMirroring
2917 #define HalMirrorPhysicalMemory HALDISPATCH->HalMirrorPhysicalMemory
2918 #define HalEndOfBoot HALDISPATCH->HalEndOfBoot
2919 #define HalMirrorVerify HALDISPATCH->HalMirrorVerify
2920
2921 typedef enum _FILE_INFORMATION_CLASS {
2922 FileDirectoryInformation = 1,
2923 FileFullDirectoryInformation,
2924 FileBothDirectoryInformation,
2925 FileBasicInformation,
2926 FileStandardInformation,
2927 FileInternalInformation,
2928 FileEaInformation,
2929 FileAccessInformation,
2930 FileNameInformation,
2931 FileRenameInformation,
2932 FileLinkInformation,
2933 FileNamesInformation,
2934 FileDispositionInformation,
2935 FilePositionInformation,
2936 FileFullEaInformation,
2937 FileModeInformation,
2938 FileAlignmentInformation,
2939 FileAllInformation,
2940 FileAllocationInformation,
2941 FileEndOfFileInformation,
2942 FileAlternateNameInformation,
2943 FileStreamInformation,
2944 FilePipeInformation,
2945 FilePipeLocalInformation,
2946 FilePipeRemoteInformation,
2947 FileMailslotQueryInformation,
2948 FileMailslotSetInformation,
2949 FileCompressionInformation,
2950 FileObjectIdInformation,
2951 FileCompletionInformation,
2952 FileMoveClusterInformation,
2953 FileQuotaInformation,
2954 FileReparsePointInformation,
2955 FileNetworkOpenInformation,
2956 FileAttributeTagInformation,
2957 FileTrackingInformation,
2958 FileIdBothDirectoryInformation,
2959 FileIdFullDirectoryInformation,
2960 FileValidDataLengthInformation,
2961 FileShortNameInformation,
2962 FileMaximumInformation
2963 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
2964
2965 typedef struct _FILE_POSITION_INFORMATION {
2966 LARGE_INTEGER CurrentByteOffset;
2967 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
2968
2969 typedef struct _FILE_ALIGNMENT_INFORMATION {
2970 ULONG AlignmentRequirement;
2971 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
2972
2973 typedef struct _FILE_NAME_INFORMATION {
2974 ULONG FileNameLength;
2975 WCHAR FileName[1];
2976 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
2977
2978 #include <pshpack8.h>
2979 typedef struct _FILE_BASIC_INFORMATION {
2980 LARGE_INTEGER CreationTime;
2981 LARGE_INTEGER LastAccessTime;
2982 LARGE_INTEGER LastWriteTime;
2983 LARGE_INTEGER ChangeTime;
2984 ULONG FileAttributes;
2985 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
2986 #include <poppack.h>
2987
2988 typedef struct _FILE_STANDARD_INFORMATION {
2989 LARGE_INTEGER AllocationSize;
2990 LARGE_INTEGER EndOfFile;
2991 ULONG NumberOfLinks;
2992 BOOLEAN DeletePending;
2993 BOOLEAN Directory;
2994 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
2995
2996 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
2997 LARGE_INTEGER CreationTime;
2998 LARGE_INTEGER LastAccessTime;
2999 LARGE_INTEGER LastWriteTime;
3000 LARGE_INTEGER ChangeTime;
3001 LARGE_INTEGER AllocationSize;
3002 LARGE_INTEGER EndOfFile;
3003 ULONG FileAttributes;
3004 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
3005
3006 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION {
3007 ULONG FileAttributes;
3008 ULONG ReparseTag;
3009 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
3010
3011 typedef struct _FILE_DISPOSITION_INFORMATION {
3012 BOOLEAN DeleteFile;
3013 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
3014
3015 typedef struct _FILE_END_OF_FILE_INFORMATION {
3016 LARGE_INTEGER EndOfFile;
3017 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
3018
3019 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION {
3020 LARGE_INTEGER ValidDataLength;
3021 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
3022
3023 typedef union _FILE_SEGMENT_ELEMENT {
3024 PVOID64 Buffer;
3025 ULONGLONG Alignment;
3026 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
3027
3028 typedef enum _FSINFOCLASS {
3029 FileFsVolumeInformation = 1,
3030 FileFsLabelInformation,
3031 FileFsSizeInformation,
3032 FileFsDeviceInformation,
3033 FileFsAttributeInformation,
3034 FileFsControlInformation,
3035 FileFsFullSizeInformation,
3036 FileFsObjectIdInformation,
3037 FileFsDriverPathInformation,
3038 FileFsMaximumInformation
3039 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
3040
3041 typedef struct _FILE_FS_DEVICE_INFORMATION {
3042 DEVICE_TYPE DeviceType;
3043 ULONG Characteristics;
3044 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
3045
3046 typedef struct _FILE_FULL_EA_INFORMATION {
3047 ULONG NextEntryOffset;
3048 UCHAR Flags;
3049 UCHAR EaNameLength;
3050 USHORT EaValueLength;
3051 CHAR EaName[1];
3052 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
3053
3054 /* ERESOURCE.Flag */
3055
3056 #define ResourceNeverExclusive 0x0010
3057 #define ResourceReleaseByOtherThread 0x0020
3058 #define ResourceOwnedExclusive 0x0080
3059
3060 #define RESOURCE_HASH_TABLE_SIZE 64
3061
3062 typedef struct _DEVOBJ_EXTENSION
3063 {
3064 CSHORT Type;
3065 USHORT Size;
3066 PDEVICE_OBJECT DeviceObject;
3067 } DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
3068
3069 typedef BOOLEAN
3070 (DDKAPI *PFAST_IO_CHECK_IF_POSSIBLE)(
3071 IN struct _FILE_OBJECT *FileObject,
3072 IN PLARGE_INTEGER FileOffset,
3073 IN ULONG Length,
3074 IN BOOLEAN Wait,
3075 IN ULONG LockKey,
3076 IN BOOLEAN CheckForReadOperation,
3077 OUT PIO_STATUS_BLOCK IoStatus,
3078 IN struct _DEVICE_OBJECT *DeviceObject);
3079
3080 typedef BOOLEAN
3081 (DDKAPI *PFAST_IO_READ)(
3082 IN struct _FILE_OBJECT *FileObject,
3083 IN PLARGE_INTEGER FileOffset,
3084 IN ULONG Length,
3085 IN BOOLEAN Wait,
3086 IN ULONG LockKey,
3087 OUT PVOID Buffer,
3088 OUT PIO_STATUS_BLOCK IoStatus,
3089 IN struct _DEVICE_OBJECT *DeviceObject);
3090
3091 typedef BOOLEAN
3092 (DDKAPI *PFAST_IO_WRITE)(
3093 IN struct _FILE_OBJECT *FileObject,
3094 IN PLARGE_INTEGER FileOffset,
3095 IN ULONG Length,
3096 IN BOOLEAN Wait,
3097 IN ULONG LockKey,
3098 IN PVOID Buffer,
3099 OUT PIO_STATUS_BLOCK IoStatus,
3100 IN struct _DEVICE_OBJECT *DeviceObject);
3101
3102 typedef BOOLEAN
3103 (DDKAPI *PFAST_IO_QUERY_BASIC_INFO)(
3104 IN struct _FILE_OBJECT *FileObject,
3105 IN BOOLEAN Wait,
3106 OUT PFILE_BASIC_INFORMATION Buffer,
3107 OUT PIO_STATUS_BLOCK IoStatus,
3108 IN struct _DEVICE_OBJECT *DeviceObject);
3109
3110 typedef BOOLEAN
3111 (DDKAPI *PFAST_IO_QUERY_STANDARD_INFO)(
3112 IN struct _FILE_OBJECT *FileObject,
3113 IN BOOLEAN Wait,
3114 OUT PFILE_STANDARD_INFORMATION Buffer,
3115 OUT PIO_STATUS_BLOCK IoStatus,
3116 IN struct _DEVICE_OBJECT *DeviceObject);
3117
3118 typedef BOOLEAN
3119 (DDKAPI *PFAST_IO_LOCK)(
3120 IN struct _FILE_OBJECT *FileObject,
3121 IN PLARGE_INTEGER FileOffset,
3122 IN PLARGE_INTEGER Length,
3123 PEPROCESS ProcessId,
3124 ULONG Key,
3125 BOOLEAN FailImmediately,
3126 BOOLEAN ExclusiveLock,
3127 OUT PIO_STATUS_BLOCK IoStatus,
3128 IN struct _DEVICE_OBJECT *DeviceObject);
3129
3130 typedef BOOLEAN
3131 (DDKAPI *PFAST_IO_UNLOCK_SINGLE)(
3132 IN struct _FILE_OBJECT *FileObject,
3133 IN PLARGE_INTEGER FileOffset,
3134 IN PLARGE_INTEGER Length,
3135 PEPROCESS ProcessId,
3136 ULONG Key,
3137 OUT PIO_STATUS_BLOCK IoStatus,
3138 IN struct _DEVICE_OBJECT *DeviceObject);
3139
3140 typedef BOOLEAN
3141 (DDKAPI *PFAST_IO_UNLOCK_ALL)(
3142 IN struct _FILE_OBJECT *FileObject,
3143 PEPROCESS ProcessId,
3144 OUT PIO_STATUS_BLOCK IoStatus,
3145 IN struct _DEVICE_OBJECT *DeviceObject);
3146
3147 typedef BOOLEAN
3148 (DDKAPI *PFAST_IO_UNLOCK_ALL_BY_KEY)(
3149 IN struct _FILE_OBJECT *FileObject,
3150 PVOID ProcessId,
3151 ULONG Key,
3152 OUT PIO_STATUS_BLOCK IoStatus,
3153 IN struct _DEVICE_OBJECT *DeviceObject);
3154
3155 typedef BOOLEAN
3156 (DDKAPI *PFAST_IO_DEVICE_CONTROL)(
3157 IN struct _FILE_OBJECT *FileObject,
3158 IN BOOLEAN Wait,
3159 IN PVOID InputBuffer OPTIONAL,
3160 IN ULONG InputBufferLength,
3161 OUT PVOID OutputBuffer OPTIONAL,
3162 IN ULONG OutputBufferLength,
3163 IN ULONG IoControlCode,
3164 OUT PIO_STATUS_BLOCK IoStatus,
3165 IN struct _DEVICE_OBJECT *DeviceObject);
3166
3167 typedef VOID
3168 (DDKAPI *PFAST_IO_ACQUIRE_FILE)(
3169 IN struct _FILE_OBJECT *FileObject);
3170
3171 typedef VOID
3172 (DDKAPI *PFAST_IO_RELEASE_FILE)(
3173 IN struct _FILE_OBJECT *FileObject);
3174
3175 typedef VOID
3176 (DDKAPI *PFAST_IO_DETACH_DEVICE)(
3177 IN struct _DEVICE_OBJECT *SourceDevice,
3178 IN struct _DEVICE_OBJECT *TargetDevice);
3179
3180 typedef BOOLEAN
3181 (DDKAPI *PFAST_IO_QUERY_NETWORK_OPEN_INFO)(
3182 IN struct _FILE_OBJECT *FileObject,
3183 IN BOOLEAN Wait,
3184 OUT struct _FILE_NETWORK_OPEN_INFORMATION *Buffer,
3185 OUT struct _IO_STATUS_BLOCK *IoStatus,
3186 IN struct _DEVICE_OBJECT *DeviceObject);
3187
3188 typedef NTSTATUS
3189 (DDKAPI *PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
3190 IN struct _FILE_OBJECT *FileObject,
3191 IN PLARGE_INTEGER EndingOffset,
3192 OUT struct _ERESOURCE **ResourceToRelease,
3193 IN struct _DEVICE_OBJECT *DeviceObject);
3194
3195 typedef BOOLEAN
3196 (DDKAPI *PFAST_IO_MDL_READ)(
3197 IN struct _FILE_OBJECT *FileObject,
3198 IN PLARGE_INTEGER FileOffset,
3199 IN ULONG Length,
3200 IN ULONG LockKey,
3201 OUT PMDL *MdlChain,
3202 OUT PIO_STATUS_BLOCK IoStatus,
3203 IN struct _DEVICE_OBJECT *DeviceObject);
3204
3205 typedef BOOLEAN
3206 (DDKAPI *PFAST_IO_MDL_READ_COMPLETE)(
3207 IN struct _FILE_OBJECT *FileObject,
3208 IN PMDL MdlChain,
3209 IN struct _DEVICE_OBJECT *DeviceObject);
3210
3211 typedef BOOLEAN
3212 (DDKAPI *PFAST_IO_PREPARE_MDL_WRITE)(
3213 IN struct _FILE_OBJECT *FileObject,
3214 IN PLARGE_INTEGER FileOffset,
3215 IN ULONG Length,
3216 IN ULONG LockKey,
3217 OUT PMDL *MdlChain,
3218 OUT PIO_STATUS_BLOCK IoStatus,
3219 IN struct _DEVICE_OBJECT *DeviceObject);
3220
3221 typedef BOOLEAN
3222 (DDKAPI *PFAST_IO_MDL_WRITE_COMPLETE)(
3223 IN struct _FILE_OBJECT *FileObject,
3224 IN PLARGE_INTEGER FileOffset,
3225 IN PMDL MdlChain,
3226 IN struct _DEVICE_OBJECT *DeviceObject);
3227
3228 typedef BOOLEAN
3229 (DDKAPI *PFAST_IO_READ_COMPRESSED)(
3230 IN struct _FILE_OBJECT *FileObject,
3231 IN PLARGE_INTEGER FileOffset,
3232 IN ULONG Length,
3233 IN ULONG LockKey,
3234 OUT PVOID Buffer,
3235 OUT PMDL *MdlChain,
3236 OUT PIO_STATUS_BLOCK IoStatus,
3237 OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
3238 IN ULONG CompressedDataInfoLength,
3239 IN struct _DEVICE_OBJECT *DeviceObject);
3240
3241 typedef BOOLEAN
3242 (DDKAPI *PFAST_IO_WRITE_COMPRESSED)(
3243 IN struct _FILE_OBJECT *FileObject,
3244 IN PLARGE_INTEGER FileOffset,
3245 IN ULONG Length,
3246 IN ULONG LockKey,
3247 IN PVOID Buffer,
3248 OUT PMDL *MdlChain,
3249 OUT PIO_STATUS_BLOCK IoStatus,
3250 IN struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
3251 IN ULONG CompressedDataInfoLength,
3252 IN struct _DEVICE_OBJECT *DeviceObject);
3253
3254 typedef BOOLEAN
3255 (DDKAPI *PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
3256 IN struct _FILE_OBJECT *FileObject,
3257 IN PMDL MdlChain,
3258 IN struct _DEVICE_OBJECT *DeviceObject);
3259
3260 typedef BOOLEAN
3261 (DDKAPI *PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
3262 IN struct _FILE_OBJECT *FileObject,
3263 IN PLARGE_INTEGER FileOffset,
3264 IN PMDL MdlChain,
3265 IN struct _DEVICE_OBJECT *DeviceObject);
3266
3267 typedef BOOLEAN
3268 (DDKAPI *PFAST_IO_QUERY_OPEN)(
3269 IN struct _IRP *Irp,
3270 OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
3271 IN struct _DEVICE_OBJECT *DeviceObject);
3272
3273 typedef NTSTATUS
3274 (DDKAPI *PFAST_IO_RELEASE_FOR_MOD_WRITE)(
3275 IN struct _FILE_OBJECT *FileObject,
3276 IN struct _ERESOURCE *ResourceToRelease,
3277 IN struct _DEVICE_OBJECT *DeviceObject);
3278
3279 typedef NTSTATUS
3280 (DDKAPI *PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
3281 IN struct _FILE_OBJECT *FileObject,
3282 IN struct _DEVICE_OBJECT *DeviceObject);
3283
3284 typedef NTSTATUS
3285 (DDKAPI *PFAST_IO_RELEASE_FOR_CCFLUSH) (
3286 IN struct _FILE_OBJECT *FileObject,
3287 IN struct _DEVICE_OBJECT *DeviceObject);
3288
3289 typedef struct _FAST_IO_DISPATCH {
3290 ULONG SizeOfFastIoDispatch;
3291 PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
3292 PFAST_IO_READ FastIoRead;
3293 PFAST_IO_WRITE FastIoWrite;
3294 PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
3295 PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
3296 PFAST_IO_LOCK FastIoLock;
3297 PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
3298 PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
3299 PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
3300 PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
3301 PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
3302 PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
3303 PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
3304 PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
3305 PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
3306 PFAST_IO_MDL_READ MdlRead;
3307 PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
3308 PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
3309 PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
3310 PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
3311 PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
3312 PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
3313 PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
3314 PFAST_IO_QUERY_OPEN FastIoQueryOpen;
3315 PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
3316 PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
3317 PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
3318 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
3319
3320 typedef struct _SECTION_OBJECT_POINTERS {
3321 PVOID DataSectionObject;
3322 PVOID SharedCacheMap;
3323 PVOID ImageSectionObject;
3324 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
3325
3326 typedef struct _IO_COMPLETION_CONTEXT {
3327 PVOID Port;
3328 PVOID Key;
3329 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
3330
3331 /* FILE_OBJECT.Flags */
3332
3333 #define FO_FILE_OPEN 0x00000001
3334 #define FO_SYNCHRONOUS_IO 0x00000002
3335 #define FO_ALERTABLE_IO 0x00000004
3336 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
3337 #define FO_WRITE_THROUGH 0x00000010
3338 #define FO_SEQUENTIAL_ONLY 0x00000020
3339 #define FO_CACHE_SUPPORTED 0x00000040
3340 #define FO_NAMED_PIPE 0x00000080
3341 #define FO_STREAM_FILE 0x00000100
3342 #define FO_MAILSLOT 0x00000200
3343 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
3344 #define FO_DIRECT_DEVICE_OPEN 0x00000800
3345 #define FO_FILE_MODIFIED 0x00001000
3346 #define FO_FILE_SIZE_CHANGED 0x00002000
3347 #define FO_CLEANUP_COMPLETE 0x00004000
3348 #define FO_TEMPORARY_FILE 0x00008000
3349 #define FO_DELETE_ON_CLOSE 0x00010000
3350 #define FO_OPENED_CASE_SENSITIVE 0x00020000
3351 #define FO_HANDLE_CREATED 0x00040000
3352 #define FO_FILE_FAST_IO_READ 0x00080000
3353 #define FO_RANDOM_ACCESS 0x00100000
3354 #define FO_FILE_OPEN_CANCELLED 0x00200000
3355 #define FO_VOLUME_OPEN 0x00400000
3356 #define FO_REMOTE_ORIGIN 0x01000000
3357
3358 typedef struct _FILE_OBJECT
3359 {
3360 CSHORT Type;
3361 CSHORT Size;
3362 PDEVICE_OBJECT DeviceObject;
3363 PVPB Vpb;
3364 PVOID FsContext;
3365 PVOID FsContext2;
3366 PSECTION_OBJECT_POINTERS SectionObjectPointer;
3367 PVOID PrivateCacheMap;
3368 NTSTATUS FinalStatus;
3369 struct _FILE_OBJECT *RelatedFileObject;
3370 BOOLEAN LockOperation;
3371 BOOLEAN DeletePending;
3372 BOOLEAN ReadAccess;
3373 BOOLEAN WriteAccess;
3374 BOOLEAN DeleteAccess;
3375 BOOLEAN SharedRead;
3376 BOOLEAN SharedWrite;
3377 BOOLEAN SharedDelete;
3378 ULONG Flags;
3379 UNICODE_STRING FileName;
3380 LARGE_INTEGER CurrentByteOffset;
3381 volatile ULONG Waiters;
3382 volatile ULONG Busy;
3383 PVOID LastLock;
3384 KEVENT Lock;
3385 KEVENT Event;
3386 volatile PIO_COMPLETION_CONTEXT CompletionContext;
3387 KSPIN_LOCK IrpListLock;
3388 LIST_ENTRY IrpList;
3389 volatile PVOID FileObjectExtension;
3390 } FILE_OBJECT;
3391 typedef struct _FILE_OBJECT *PFILE_OBJECT;
3392
3393 typedef enum _SECURITY_OPERATION_CODE {
3394 SetSecurityDescriptor,
3395 QuerySecurityDescriptor,
3396 DeleteSecurityDescriptor,
3397 AssignSecurityDescriptor
3398 } SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
3399
3400 #define INITIAL_PRIVILEGE_COUNT 3
3401
3402 typedef struct _INITIAL_PRIVILEGE_SET {
3403 ULONG PrivilegeCount;
3404 ULONG Control;
3405 LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
3406 } INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
3407
3408 #define SE_MIN_WELL_KNOWN_PRIVILEGE 2
3409 #define SE_CREATE_TOKEN_PRIVILEGE 2
3410 #define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE 3
3411 #define SE_LOCK_MEMORY_PRIVILEGE 4
3412 #define SE_INCREASE_QUOTA_PRIVILEGE 5
3413 #define SE_UNSOLICITED_INPUT_PRIVILEGE 6
3414 #define SE_MACHINE_ACCOUNT_PRIVILEGE 6
3415 #define SE_TCB_PRIVILEGE 7
3416 #define SE_SECURITY_PRIVILEGE 8
3417 #define SE_TAKE_OWNERSHIP_PRIVILEGE 9
3418 #define SE_LOAD_DRIVER_PRIVILEGE 10
3419 #define SE_SYSTEM_PROFILE_PRIVILEGE 11
3420 #define SE_SYSTEMTIME_PRIVILEGE 12
3421 #define SE_PROF_SINGLE_PROCESS_PRIVILEGE 13
3422 #define SE_INC_BASE_PRIORITY_PRIVILEGE 14
3423 #define SE_CREATE_PAGEFILE_PRIVILEGE 15
3424 #define SE_CREATE_PERMANENT_PRIVILEGE 16
3425 #define SE_BACKUP_PRIVILEGE 17
3426 #define SE_RESTORE_PRIVILEGE 18
3427 #define SE_SHUTDOWN_PRIVILEGE 19
3428 #define SE_DEBUG_PRIVILEGE 20
3429 #define SE_AUDIT_PRIVILEGE 21
3430 #define SE_SYSTEM_ENVIRONMENT_PRIVILEGE 22
3431 #define SE_CHANGE_NOTIFY_PRIVILEGE 23
3432 #define SE_REMOTE_SHUTDOWN_PRIVILEGE 24
3433 #define SE_UNDOCK_PRIVILEGE 25
3434 #define SE_SYNC_AGENT_PRIVILEGE 26
3435 #define SE_ENABLE_DELEGATION_PRIVILEGE 27
3436 #define SE_MANAGE_VOLUME_PRIVILEGE 28
3437 #define SE_IMPERSONATE_PRIVILEGE 29
3438 #define SE_CREATE_GLOBAL_PRIVILEGE 30
3439 #define SE_MAX_WELL_KNOWN_PRIVILEGE SE_CREATE_GLOBAL_PRIVILEGE
3440
3441 typedef struct _SECURITY_SUBJECT_CONTEXT {
3442 PACCESS_TOKEN ClientToken;
3443 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3444 PACCESS_TOKEN PrimaryToken;
3445 PVOID ProcessAuditId;
3446 } SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
3447
3448 #include <pshpack4.h>
3449 typedef struct _ACCESS_STATE {
3450 LUID OperationID;
3451 BOOLEAN SecurityEvaluated;
3452 BOOLEAN GenerateAudit;
3453 BOOLEAN GenerateOnClose;
3454 BOOLEAN PrivilegesAllocated;
3455 ULONG Flags;
3456 ACCESS_MASK RemainingDesiredAccess;
3457 ACCESS_MASK PreviouslyGrantedAccess;
3458 ACCESS_MASK OriginalDesiredAccess;
3459 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
3460 PSECURITY_DESCRIPTOR SecurityDescriptor;
3461 PVOID AuxData;
3462 union {
3463 INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
3464 PRIVILEGE_SET PrivilegeSet;
3465 } Privileges;
3466
3467 BOOLEAN AuditPrivileges;
3468 UNICODE_STRING ObjectName;
3469 UNICODE_STRING ObjectTypeName;
3470 } ACCESS_STATE, *PACCESS_STATE;
3471 #include <poppack.h>
3472
3473 typedef struct _IO_SECURITY_CONTEXT {
3474 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
3475 PACCESS_STATE AccessState;
3476 ACCESS_MASK DesiredAccess;
3477 ULONG FullCreateOptions;
3478 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
3479
3480 #define IO_TYPE_ADAPTER 1
3481 #define IO_TYPE_CONTROLLER 2
3482 #define IO_TYPE_DEVICE 3
3483 #define IO_TYPE_DRIVER 4
3484 #define IO_TYPE_FILE 5
3485 #define IO_TYPE_IRP 6
3486 #define IO_TYPE_MASTER_ADAPTER 7
3487 #define IO_TYPE_OPEN_PACKET 8
3488 #define IO_TYPE_TIMER 9
3489 #define IO_TYPE_VPB 10
3490 #define IO_TYPE_ERROR_LOG 11
3491 #define IO_TYPE_ERROR_MESSAGE 12
3492 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 13
3493
3494 #define IO_TYPE_CSQ_IRP_CONTEXT 1
3495 #define IO_TYPE_CSQ 2
3496
3497 struct _IO_CSQ;
3498
3499 typedef struct _IO_CSQ_IRP_CONTEXT {
3500 ULONG Type;
3501 struct _IRP *Irp;
3502 struct _IO_CSQ *Csq;
3503 } IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
3504
3505 typedef VOID
3506 (DDKAPI *PIO_CSQ_INSERT_IRP)(
3507 IN struct _IO_CSQ *Csq,
3508 IN PIRP Irp);
3509
3510 typedef VOID
3511 (DDKAPI *PIO_CSQ_REMOVE_IRP)(
3512 IN struct _IO_CSQ *Csq,
3513 IN PIRP Irp);
3514
3515 typedef PIRP
3516 (DDKAPI *PIO_CSQ_PEEK_NEXT_IRP)(
3517 IN struct _IO_CSQ *Csq,
3518 IN PIRP Irp,
3519 IN PVOID PeekContext);
3520
3521 typedef VOID
3522 (DDKAPI *PIO_CSQ_ACQUIRE_LOCK)(
3523 IN struct _IO_CSQ *Csq,
3524 OUT PKIRQL Irql);
3525
3526 typedef VOID
3527 (DDKAPI *PIO_CSQ_RELEASE_LOCK)(
3528 IN struct _IO_CSQ *Csq,
3529 IN KIRQL Irql);
3530
3531 typedef VOID
3532 (DDKAPI *PIO_CSQ_COMPLETE_CANCELED_IRP)(
3533 IN struct _IO_CSQ *Csq,
3534 IN PIRP Irp);
3535
3536 typedef struct _IO_CSQ {
3537 ULONG Type;
3538 PIO_CSQ_INSERT_IRP CsqInsertIrp;
3539 PIO_CSQ_REMOVE_IRP CsqRemoveIrp;
3540 PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;
3541 PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock;
3542 PIO_CSQ_RELEASE_LOCK CsqReleaseLock;
3543 PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp;
3544 PVOID ReservePointer;
3545 } IO_CSQ, *PIO_CSQ;
3546
3547 #if !defined(_ALPHA_)
3548 #include <pshpack4.h>
3549 #endif
3550 typedef struct _IO_STACK_LOCATION {
3551 UCHAR MajorFunction;
3552 UCHAR MinorFunction;
3553 UCHAR Flags;
3554 UCHAR Control;
3555 union {
3556 struct {
3557 PIO_SECURITY_CONTEXT SecurityContext;
3558 ULONG Options;
3559 USHORT POINTER_ALIGNMENT FileAttributes;
3560 USHORT ShareAccess;
3561 ULONG POINTER_ALIGNMENT EaLength;
3562 } Create;
3563 struct {
3564 ULONG Length;
3565 ULONG POINTER_ALIGNMENT Key;
3566 LARGE_INTEGER ByteOffset;
3567 } Read;
3568 struct {
3569 ULONG Length;
3570 ULONG POINTER_ALIGNMENT Key;
3571 LARGE_INTEGER ByteOffset;
3572 } Write;
3573 struct {
3574 ULONG Length;
3575 PUNICODE_STRING FileName;
3576 FILE_INFORMATION_CLASS FileInformationClass;
3577 ULONG FileIndex;
3578 } QueryDirectory;
3579 struct {
3580 ULONG Length;
3581 ULONG CompletionFilter;
3582 } NotifyDirectory;
3583 struct {
3584 ULONG Length;
3585 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
3586 } QueryFile;
3587 struct {
3588 ULONG Length;
3589 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
3590 PFILE_OBJECT FileObject;
3591 _ANONYMOUS_UNION union {
3592 _ANONYMOUS_STRUCT struct {
3593 BOOLEAN ReplaceIfExists;
3594 BOOLEAN AdvanceOnly;
3595 } DUMMYSTRUCTNAME;
3596 ULONG ClusterCount;
3597 HANDLE DeleteHandle;
3598 } DUMMYUNIONNAME;
3599 } SetFile;
3600 struct {
3601 ULONG Length;
3602 PVOID EaList;
3603 ULONG EaListLength;
3604 ULONG EaIndex;
3605 } QueryEa;
3606 struct {
3607 ULONG Length;
3608 } SetEa;
3609 struct {
3610 ULONG Length;
3611 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
3612 } QueryVolume;
3613 struct {
3614 ULONG Length;
3615 FS_INFORMATION_CLASS FsInformationClass;
3616 } SetVolume;
3617 struct {
3618 ULONG OutputBufferLength;
3619 ULONG InputBufferLength;
3620 ULONG FsControlCode;
3621 PVOID Type3InputBuffer;
3622 } FileSystemControl;
3623 struct {
3624 PLARGE_INTEGER Length;
3625 ULONG Key;
3626 LARGE_INTEGER ByteOffset;
3627 } LockControl;
3628 struct {
3629 ULONG OutputBufferLength;
3630 ULONG POINTER_ALIGNMENT InputBufferLength;
3631 ULONG POINTER_ALIGNMENT IoControlCode;
3632 PVOID Type3InputBuffer;
3633 } DeviceIoControl;
3634 struct {
3635 SECURITY_INFORMATION SecurityInformation;
3636 ULONG POINTER_ALIGNMENT Length;
3637 } QuerySecurity;
3638 struct {
3639 SECURITY_INFORMATION SecurityInformation;
3640 PSECURITY_DESCRIPTOR SecurityDescriptor;
3641 } SetSecurity;
3642 struct {
3643 PVPB Vpb;
3644 PDEVICE_OBJECT DeviceObject;
3645 } MountVolume;
3646 struct {
3647 PVPB Vpb;
3648 PDEVICE_OBJECT DeviceObject;
3649 } VerifyVolume;
3650 struct {
3651 struct _SCSI_REQUEST_BLOCK *Srb;
3652 } Scsi;
3653 struct {
3654 ULONG Length;
3655 PSID StartSid;
3656 struct _FILE_GET_QUOTA_INFORMATION *SidList;
3657 ULONG SidListLength;
3658 } QueryQuota;
3659 struct {
3660 ULONG Length;
3661 } SetQuota;
3662 struct {
3663 DEVICE_RELATION_TYPE Type;
3664 } QueryDeviceRelations;
3665 struct {
3666 CONST GUID *InterfaceType;
3667 USHORT Size;
3668 USHORT Version;
3669 PINTERFACE Interface;
3670 PVOID InterfaceSpecificData;
3671 } QueryInterface;
3672 struct {
3673 PDEVICE_CAPABILITIES Capabilities;
3674 } DeviceCapabilities;
3675 struct {
3676 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
3677 } FilterResourceRequirements;
3678 struct {
3679 ULONG WhichSpace;
3680 PVOID Buffer;
3681 ULONG Offset;
3682 ULONG POINTER_ALIGNMENT Length;
3683 } ReadWriteConfig;
3684 struct {
3685 BOOLEAN Lock;
3686 } SetLock;
3687 struct {
3688 BUS_QUERY_ID_TYPE IdType;
3689 } QueryId;
3690 struct {
3691 DEVICE_TEXT_TYPE DeviceTextType;
3692 LCID POINTER_ALIGNMENT LocaleId;
3693 } QueryDeviceText;
3694 struct {
3695 BOOLEAN InPath;
3696 BOOLEAN Reserved[3];
3697 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
3698 } UsageNotification;
3699 struct {
3700 SYSTEM_POWER_STATE PowerState;
3701 } WaitWake;
3702 struct {
3703 PPOWER_SEQUENCE PowerSequence;
3704 } PowerSequence;
3705 struct {
3706 ULONG SystemContext;
3707 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
3708 POWER_STATE POINTER_ALIGNMENT State;
3709 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
3710 } Power;
3711 struct {
3712 PCM_RESOURCE_LIST AllocatedResources;
3713 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
3714 } StartDevice;
3715 struct {
3716 ULONG_PTR ProviderId;
3717 PVOID DataPath;
3718 ULONG BufferSize;
3719 PVOID Buffer;
3720 } WMI;
3721 struct {