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