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