Install w32api-3.13-mingw32-dev.tar.gz
[git/jnareb-git.git] / mingw / include / ddk / winddk.h
blob964aeefaf583edaf496ca2783062f3268b014519
1 /*
2 * winddk.h
4 * Windows Device Driver Kit
6 * This file is part of the w32api package.
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
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.
23 #ifndef __WINDDK_H
24 #define __WINDDK_H
26 #if __GNUC__ >= 3
27 #pragma GCC system_header
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
35 ** Definitions specific to this Device Driver Kit
37 #define DDKAPI __stdcall
38 #define DDKFASTAPI __fastcall
39 #define DDKCDECLAPI __cdecl
41 #if defined(_NTOSKRNL_)
42 #ifndef NTOSAPI
43 #define NTOSAPI DECL_EXPORT
44 #endif
45 #define DECLARE_INTERNAL_OBJECT(x) typedef struct _##x; typedef struct _##x *P##x;
46 #define DECLARE_INTERNAL_OBJECT2(x,y) typedef struct _##x; typedef struct _##x *P##y;
47 #else
48 #ifndef NTOSAPI
49 #define NTOSAPI DECL_IMPORT
50 #endif
51 #define DECLARE_INTERNAL_OBJECT(x) struct _##x; typedef struct _##x *P##x;
52 #define DECLARE_INTERNAL_OBJECT2(x,y) struct _##x; typedef struct _##x *P##y;
53 #endif
55 /* Pseudo modifiers for parameters
56 We don't use these unnecessary defines in the w32api headers. Define
57 them by default since that is what people expect, but allow users
58 to avoid the pollution. */
59 #ifndef _NO_W32_PSEUDO_MODIFIERS
60 #define IN
61 #define OUT
62 #define OPTIONAL
63 #define UNALLIGNED
64 #endif
66 #define CONST const
67 #define VOLATILE volatile
69 #define RESTRICTED_POINTER
70 #define POINTER_ALIGNMENT
72 #ifdef NONAMELESSUNION
73 # define _DDK_DUMMYUNION_MEMBER(name) DUMMYUNIONNAME.name
74 # define _DDK_DUMMYUNION_N_MEMBER(n, name) DUMMYUNIONNAME##n.name
75 #else
76 # define _DDK_DUMMYUNION_MEMBER(name) name
77 # define _DDK_DUMMYUNION_N_MEMBER(n, name) name
78 #endif
81 ** Forward declarations
84 struct _IRP;
85 struct _MDL;
86 struct _KAPC;
87 struct _KDPC;
88 struct _KPCR;
89 struct _KPRCB;
90 struct _KTSS;
91 struct _FILE_OBJECT;
92 struct _DMA_ADAPTER;
93 struct _DEVICE_OBJECT;
94 struct _DRIVER_OBJECT;
95 struct _SECTION_OBJECT;
96 struct _IO_STATUS_BLOCK;
97 struct _DEVICE_DESCRIPTION;
98 struct _SCATTER_GATHER_LIST;
100 DECLARE_INTERNAL_OBJECT(ADAPTER_OBJECT)
101 DECLARE_INTERNAL_OBJECT(DMA_ADAPTER)
102 DECLARE_INTERNAL_OBJECT(IO_STATUS_BLOCK)
103 DECLARE_INTERNAL_OBJECT(SECTION_OBJECT)
105 #if 1
106 /* FIXME: Unknown definitions */
107 struct _SET_PARTITION_INFORMATION_EX;
108 typedef ULONG WAIT_TYPE;
109 typedef HANDLE TRACEHANDLE;
110 typedef PVOID PWMILIB_CONTEXT;
111 typedef PVOID PSYSCTL_IRP_DISPOSITION;
112 typedef ULONG LOGICAL;
113 #endif
116 ** Routines specific to this DDK
119 #define TAG(_a, _b, _c, _d) (ULONG) \
120 (((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24))
122 #ifdef __GNUC__
123 static __inline struct _KPCR * KeGetCurrentKPCR(
124 VOID)
126 ULONG Value;
128 __asm__ __volatile__ (
129 #if (__GNUC__ >= 3)
130 /* support -masm=intel */
131 "mov{l} {%%fs:0x18, %0|%0, %%fs:0x18}\n\t"
132 #else
133 "movl %%fs:0x18, %0\n\t"
134 #endif
135 : "=r" (Value)
136 : /* no inputs */
138 return (struct _KPCR *) Value;
141 #elif defined( __WATCOMC__ )
143 extern struct _KPCR * KeGetCurrentKPCR( void );
144 #pragma aux KeGetCurrentKPCR = \
145 "mov eax, fs:[0x18]" \
146 value [ eax ];
148 #endif
151 ** Simple structures
154 typedef LONG KPRIORITY;
155 typedef UCHAR KIRQL, *PKIRQL;
156 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
157 typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
158 typedef CCHAR KPROCESSOR_MODE;
160 typedef enum _MODE {
161 KernelMode,
162 UserMode,
163 MaximumMode
164 } MODE;
167 /* Structures not exposed to drivers */
168 typedef struct _IO_TIMER *PIO_TIMER;
169 typedef struct _EPROCESS *PEPROCESS;
170 typedef struct _ETHREAD *PETHREAD;
171 typedef struct _KINTERRUPT *PKINTERRUPT;
172 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
173 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
174 typedef struct _COMPRESSED_DATA_INFO *PCOMPRESSED_DATA_INFO;
175 typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
176 typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
177 typedef struct _DRIVE_LAYOUT_INFORMATION *PDRIVE_LAYOUT_INFORMATION;
178 typedef struct _DRIVE_LAYOUT_INFORMATION_EX *PDRIVE_LAYOUT_INFORMATION_EX;
180 /* Constants */
181 #define MAXIMUM_PROCESSORS 32
183 #define MAXIMUM_WAIT_OBJECTS 64
185 #define METHOD_BUFFERED 0
186 #define METHOD_IN_DIRECT 1
187 #define METHOD_OUT_DIRECT 2
188 #define METHOD_NEITHER 3
190 #define LOW_PRIORITY 0
191 #define LOW_REALTIME_PRIORITY 16
192 #define HIGH_PRIORITY 31
193 #define MAXIMUM_PRIORITY 32
195 #define FILE_SUPERSEDED 0x00000000
196 #define FILE_OPENED 0x00000001
197 #define FILE_CREATED 0x00000002
198 #define FILE_OVERWRITTEN 0x00000003
199 #define FILE_EXISTS 0x00000004
200 #define FILE_DOES_NOT_EXIST 0x00000005
202 /* also in winnt.h */
203 #define FILE_LIST_DIRECTORY 0x00000001
204 #define FILE_READ_DATA 0x00000001
205 #define FILE_ADD_FILE 0x00000002
206 #define FILE_WRITE_DATA 0x00000002
207 #define FILE_ADD_SUBDIRECTORY 0x00000004
208 #define FILE_APPEND_DATA 0x00000004
209 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
210 #define FILE_READ_EA 0x00000008
211 #define FILE_WRITE_EA 0x00000010
212 #define FILE_EXECUTE 0x00000020
213 #define FILE_TRAVERSE 0x00000020
214 #define FILE_DELETE_CHILD 0x00000040
215 #define FILE_READ_ATTRIBUTES 0x00000080
216 #define FILE_WRITE_ATTRIBUTES 0x00000100
218 #define FILE_SHARE_READ 0x00000001
219 #define FILE_SHARE_WRITE 0x00000002
220 #define FILE_SHARE_DELETE 0x00000004
221 #define FILE_SHARE_VALID_FLAGS 0x00000007
223 #define FILE_ATTRIBUTE_READONLY 0x00000001
224 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
225 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
226 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
227 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
228 #define FILE_ATTRIBUTE_DEVICE 0x00000040
229 #define FILE_ATTRIBUTE_NORMAL 0x00000080
230 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
231 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
232 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
233 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
234 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
235 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
236 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
238 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
239 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
241 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
242 #define FILE_STRUCTURED_STORAGE 0x00000441
244 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
245 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
246 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
247 #define FILE_VALID_SET_FLAGS 0x00000036
249 #define FILE_SUPERSEDE 0x00000000
250 #define FILE_OPEN 0x00000001
251 #define FILE_CREATE 0x00000002
252 #define FILE_OPEN_IF 0x00000003
253 #define FILE_OVERWRITE 0x00000004
254 #define FILE_OVERWRITE_IF 0x00000005
255 #define FILE_MAXIMUM_DISPOSITION 0x00000005
257 #define FILE_DIRECTORY_FILE 0x00000001
258 #define FILE_WRITE_THROUGH 0x00000002
259 #define FILE_SEQUENTIAL_ONLY 0x00000004
260 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
261 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
262 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
263 #define FILE_NON_DIRECTORY_FILE 0x00000040
264 #define FILE_CREATE_TREE_CONNECTION 0x00000080
265 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
266 #define FILE_NO_EA_KNOWLEDGE 0x00000200
267 #define FILE_OPEN_FOR_RECOVERY 0x00000400
268 #define FILE_RANDOM_ACCESS 0x00000800
269 #define FILE_DELETE_ON_CLOSE 0x00001000
270 #define FILE_OPEN_BY_FILE_ID 0x00002000
271 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
272 #define FILE_NO_COMPRESSION 0x00008000
273 #define FILE_RESERVE_OPFILTER 0x00100000
274 #define FILE_OPEN_REPARSE_POINT 0x00200000
275 #define FILE_OPEN_NO_RECALL 0x00400000
276 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
278 #define FILE_ANY_ACCESS 0x00000000
279 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
280 #define FILE_READ_ACCESS 0x00000001
281 #define FILE_WRITE_ACCESS 0x00000002
283 #define FILE_ALL_ACCESS \
284 (STANDARD_RIGHTS_REQUIRED | \
285 SYNCHRONIZE | \
286 0x1FF)
288 #define FILE_GENERIC_EXECUTE \
289 (STANDARD_RIGHTS_EXECUTE | \
290 FILE_READ_ATTRIBUTES | \
291 FILE_EXECUTE | \
292 SYNCHRONIZE)
294 #define FILE_GENERIC_READ \
295 (STANDARD_RIGHTS_READ | \
296 FILE_READ_DATA | \
297 FILE_READ_ATTRIBUTES | \
298 FILE_READ_EA | \
299 SYNCHRONIZE)
301 #define FILE_GENERIC_WRITE \
302 (STANDARD_RIGHTS_WRITE | \
303 FILE_WRITE_DATA | \
304 FILE_WRITE_ATTRIBUTES | \
305 FILE_WRITE_EA | \
306 FILE_APPEND_DATA | \
307 SYNCHRONIZE)
308 /* end winnt.h */
310 #define DIRECTORY_QUERY (0x0001)
311 #define DIRECTORY_TRAVERSE (0x0002)
312 #define DIRECTORY_CREATE_OBJECT (0x0004)
313 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
314 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
316 /* Exported object types */
317 extern NTOSAPI POBJECT_TYPE ExDesktopObjectType;
318 extern NTOSAPI POBJECT_TYPE ExEventObjectType;
319 extern NTOSAPI POBJECT_TYPE ExSemaphoreObjectType;
320 extern NTOSAPI POBJECT_TYPE ExWindowStationObjectType;
321 extern NTOSAPI POBJECT_TYPE IoAdapterObjectType;
322 extern NTOSAPI ULONG IoDeviceHandlerObjectSize;
323 extern NTOSAPI POBJECT_TYPE IoDeviceHandlerObjectType;
324 extern NTOSAPI POBJECT_TYPE IoDeviceObjectType;
325 extern NTOSAPI POBJECT_TYPE IoDriverObjectType;
326 extern NTOSAPI POBJECT_TYPE IoFileObjectType;
327 extern NTOSAPI POBJECT_TYPE LpcPortObjectType;
328 extern NTOSAPI POBJECT_TYPE MmSectionObjectType;
329 extern NTOSAPI POBJECT_TYPE SeTokenObjectType;
331 extern NTOSAPI CCHAR KeNumberProcessors;
332 extern NTOSAPI PHAL_DISPATCH_TABLE HalDispatchTable;
333 extern NTOSAPI PHAL_PRIVATE_DISPATCH_TABLE HalPrivateDispatchTable;
337 ** IRP function codes
340 #define IRP_MJ_CREATE 0x00
341 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
342 #define IRP_MJ_CLOSE 0x02
343 #define IRP_MJ_READ 0x03
344 #define IRP_MJ_WRITE 0x04
345 #define IRP_MJ_QUERY_INFORMATION 0x05
346 #define IRP_MJ_SET_INFORMATION 0x06
347 #define IRP_MJ_QUERY_EA 0x07
348 #define IRP_MJ_SET_EA 0x08
349 #define IRP_MJ_FLUSH_BUFFERS 0x09
350 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
351 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
352 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
353 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
354 #define IRP_MJ_DEVICE_CONTROL 0x0e
355 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
356 #define IRP_MJ_SCSI 0x0f
357 #define IRP_MJ_SHUTDOWN 0x10
358 #define IRP_MJ_LOCK_CONTROL 0x11
359 #define IRP_MJ_CLEANUP 0x12
360 #define IRP_MJ_CREATE_MAILSLOT 0x13
361 #define IRP_MJ_QUERY_SECURITY 0x14
362 #define IRP_MJ_SET_SECURITY 0x15
363 #define IRP_MJ_POWER 0x16
364 #define IRP_MJ_SYSTEM_CONTROL 0x17
365 #define IRP_MJ_DEVICE_CHANGE 0x18
366 #define IRP_MJ_QUERY_QUOTA 0x19
367 #define IRP_MJ_SET_QUOTA 0x1a
368 #define IRP_MJ_PNP 0x1b
369 #define IRP_MJ_PNP_POWER 0x1b
370 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
372 #define IRP_MN_QUERY_DIRECTORY 0x01
373 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
375 #define IRP_MN_USER_FS_REQUEST 0x00
376 #define IRP_MN_MOUNT_VOLUME 0x01
377 #define IRP_MN_VERIFY_VOLUME 0x02
378 #define IRP_MN_LOAD_FILE_SYSTEM 0x03
379 #define IRP_MN_TRACK_LINK 0x04
380 #define IRP_MN_KERNEL_CALL 0x04
382 #define IRP_MN_LOCK 0x01
383 #define IRP_MN_UNLOCK_SINGLE 0x02
384 #define IRP_MN_UNLOCK_ALL 0x03
385 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
387 #define IRP_MN_NORMAL 0x00
388 #define IRP_MN_DPC 0x01
389 #define IRP_MN_MDL 0x02
390 #define IRP_MN_COMPLETE 0x04
391 #define IRP_MN_COMPRESSED 0x08
393 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
394 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
395 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
397 #define IRP_MN_SCSI_CLASS 0x01
399 #define IRP_MN_START_DEVICE 0x00
400 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
401 #define IRP_MN_REMOVE_DEVICE 0x02
402 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
403 #define IRP_MN_STOP_DEVICE 0x04
404 #define IRP_MN_QUERY_STOP_DEVICE 0x05
405 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
407 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
408 #define IRP_MN_QUERY_INTERFACE 0x08
409 #define IRP_MN_QUERY_CAPABILITIES 0x09
410 #define IRP_MN_QUERY_RESOURCES 0x0A
411 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
412 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
413 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
415 #define IRP_MN_READ_CONFIG 0x0F
416 #define IRP_MN_WRITE_CONFIG 0x10
417 #define IRP_MN_EJECT 0x11
418 #define IRP_MN_SET_LOCK 0x12
419 #define IRP_MN_QUERY_ID 0x13
420 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
421 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
422 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
423 #define IRP_MN_SURPRISE_REMOVAL 0x17
424 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
426 #define IRP_MN_WAIT_WAKE 0x00
427 #define IRP_MN_POWER_SEQUENCE 0x01
428 #define IRP_MN_SET_POWER 0x02
429 #define IRP_MN_QUERY_POWER 0x03
431 #define IRP_MN_QUERY_ALL_DATA 0x00
432 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
433 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
434 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
435 #define IRP_MN_ENABLE_EVENTS 0x04
436 #define IRP_MN_DISABLE_EVENTS 0x05
437 #define IRP_MN_ENABLE_COLLECTION 0x06
438 #define IRP_MN_DISABLE_COLLECTION 0x07
439 #define IRP_MN_REGINFO 0x08
440 #define IRP_MN_EXECUTE_METHOD 0x09
442 #define IRP_MN_REGINFO_EX 0x0b
444 typedef enum _IO_ALLOCATION_ACTION {
445 KeepObject = 1,
446 DeallocateObject,
447 DeallocateObjectKeepRegisters
448 } IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
450 typedef IO_ALLOCATION_ACTION
451 (DDKAPI *PDRIVER_CONTROL)(
452 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
453 /*IN*/ struct _IRP *Irp,
454 /*IN*/ PVOID MapRegisterBase,
455 /*IN*/ PVOID Context);
457 typedef VOID
458 (DDKAPI *PDRIVER_LIST_CONTROL)(
459 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
460 /*IN*/ struct _IRP *Irp,
461 /*IN*/ struct _SCATTER_GATHER_LIST *ScatterGather,
462 /*IN*/ PVOID Context);
464 typedef NTSTATUS
465 (DDKAPI *PDRIVER_ADD_DEVICE)(
466 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
467 /*IN*/ struct _DEVICE_OBJECT *PhysicalDeviceObject);
469 typedef NTSTATUS
470 (DDKAPI *PIO_COMPLETION_ROUTINE)(
471 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
472 /*IN*/ struct _IRP *Irp,
473 /*IN*/ PVOID Context);
475 typedef VOID
476 (DDKAPI *PDRIVER_CANCEL)(
477 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
478 /*IN*/ struct _IRP *Irp);
480 typedef VOID
481 (DDKAPI *PKDEFERRED_ROUTINE)(
482 /*IN*/ struct _KDPC *Dpc,
483 /*IN*/ PVOID DeferredContext,
484 /*IN*/ PVOID SystemArgument1,
485 /*IN*/ PVOID SystemArgument2);
487 typedef NTSTATUS
488 (DDKAPI *PDRIVER_DISPATCH)(
489 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
490 /*IN*/ struct _IRP *Irp);
492 typedef VOID
493 (DDKAPI *PIO_DPC_ROUTINE)(
494 /*IN*/ struct _KDPC *Dpc,
495 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
496 /*IN*/ struct _IRP *Irp,
497 /*IN*/ PVOID Context);
499 typedef NTSTATUS
500 (DDKAPI *PMM_DLL_INITIALIZE)(
501 /*IN*/ PUNICODE_STRING RegistryPath);
503 typedef NTSTATUS
504 (DDKAPI *PMM_DLL_UNLOAD)(
505 VOID);
507 typedef NTSTATUS
508 (DDKAPI *PDRIVER_ENTRY)(
509 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
510 /*IN*/ PUNICODE_STRING RegistryPath);
512 typedef NTSTATUS
513 (DDKAPI *PDRIVER_INITIALIZE)(
514 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
515 /*IN*/ PUNICODE_STRING RegistryPath);
517 typedef BOOLEAN
518 (DDKAPI *PKSERVICE_ROUTINE)(
519 /*IN*/ struct _KINTERRUPT *Interrupt,
520 /*IN*/ PVOID ServiceContext);
522 typedef VOID
523 (DDKAPI *PIO_TIMER_ROUTINE)(
524 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
525 /*IN*/ PVOID Context);
527 typedef VOID
528 (DDKAPI *PDRIVER_REINITIALIZE)(
529 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
530 /*IN*/ PVOID Context,
531 /*IN*/ ULONG Count);
533 typedef NTSTATUS
534 (DDKAPI *PDRIVER_STARTIO)(
535 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
536 /*IN*/ struct _IRP *Irp);
538 typedef BOOLEAN
539 (DDKAPI *PKSYNCHRONIZE_ROUTINE)(
540 /*IN*/ PVOID SynchronizeContext);
542 typedef VOID
543 (DDKAPI *PDRIVER_UNLOAD)(
544 /*IN*/ struct _DRIVER_OBJECT *DriverObject);
549 ** Plug and Play structures
552 typedef VOID DDKAPI
553 (*PINTERFACE_REFERENCE)(
554 PVOID Context);
556 typedef VOID DDKAPI
557 (*PINTERFACE_DEREFERENCE)(
558 PVOID Context);
560 typedef BOOLEAN DDKAPI
561 (*PTRANSLATE_BUS_ADDRESS)(
562 /*IN*/ PVOID Context,
563 /*IN*/ PHYSICAL_ADDRESS BusAddress,
564 /*IN*/ ULONG Length,
565 /*IN OUT*/ PULONG AddressSpace,
566 /*OUT*/ PPHYSICAL_ADDRESS TranslatedAddress);
568 typedef struct _DMA_ADAPTER* DDKAPI
569 (*PGET_DMA_ADAPTER)(
570 /*IN*/ PVOID Context,
571 /*IN*/ struct _DEVICE_DESCRIPTION *DeviceDescriptor,
572 /*OUT*/ PULONG NumberOfMapRegisters);
574 typedef ULONG DDKAPI
575 (*PGET_SET_DEVICE_DATA)(
576 /*IN*/ PVOID Context,
577 /*IN*/ ULONG DataType,
578 /*IN*/ PVOID Buffer,
579 /*IN*/ ULONG Offset,
580 /*IN*/ ULONG Length);
582 typedef union _POWER_STATE {
583 SYSTEM_POWER_STATE SystemState;
584 DEVICE_POWER_STATE DeviceState;
585 } POWER_STATE, *PPOWER_STATE;
587 typedef enum _POWER_STATE_TYPE {
588 SystemPowerState,
589 DevicePowerState
590 } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
592 typedef struct _BUS_INTERFACE_STANDARD {
593 USHORT Size;
594 USHORT Version;
595 PVOID Context;
596 PINTERFACE_REFERENCE InterfaceReference;
597 PINTERFACE_DEREFERENCE InterfaceDereference;
598 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
599 PGET_DMA_ADAPTER GetDmaAdapter;
600 PGET_SET_DEVICE_DATA SetBusData;
601 PGET_SET_DEVICE_DATA GetBusData;
602 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
604 typedef struct _DEVICE_CAPABILITIES {
605 USHORT Size;
606 USHORT Version;
607 ULONG DeviceD1 : 1;
608 ULONG DeviceD2 : 1;
609 ULONG LockSupported : 1;
610 ULONG EjectSupported : 1;
611 ULONG Removable : 1;
612 ULONG DockDevice : 1;
613 ULONG UniqueID : 1;
614 ULONG SilentInstall : 1;
615 ULONG RawDeviceOK : 1;
616 ULONG SurpriseRemovalOK : 1;
617 ULONG WakeFromD0 : 1;
618 ULONG WakeFromD1 : 1;
619 ULONG WakeFromD2 : 1;
620 ULONG WakeFromD3 : 1;
621 ULONG HardwareDisabled : 1;
622 ULONG NonDynamic : 1;
623 ULONG WarmEjectSupported : 1;
624 ULONG NoDisplayInUI : 1;
625 ULONG Reserved : 14;
626 ULONG Address;
627 ULONG UINumber;
628 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
629 SYSTEM_POWER_STATE SystemWake;
630 DEVICE_POWER_STATE DeviceWake;
631 ULONG D1Latency;
632 ULONG D2Latency;
633 ULONG D3Latency;
634 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
636 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
637 USHORT Version;
638 USHORT Size;
639 GUID Event;
640 GUID InterfaceClassGuid;
641 PUNICODE_STRING SymbolicLinkName;
642 } DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
644 typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
645 USHORT Version;
646 USHORT Size;
647 GUID Event;
648 } HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
650 #undef INTERFACE
652 typedef struct _INTERFACE {
653 USHORT Size;
654 USHORT Version;
655 PVOID Context;
656 PINTERFACE_REFERENCE InterfaceReference;
657 PINTERFACE_DEREFERENCE InterfaceDereference;
658 } INTERFACE, *PINTERFACE;
660 typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
661 USHORT Version;
662 USHORT Size;
663 GUID Event;
664 } PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
666 typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
668 /* PNP_DEVICE_STATE */
670 #define PNP_DEVICE_DISABLED 0x00000001
671 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
672 #define PNP_DEVICE_FAILED 0x00000004
673 #define PNP_DEVICE_REMOVED 0x00000008
674 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
675 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
677 typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
678 USHORT Version;
679 USHORT Size;
680 GUID Event;
681 struct _FILE_OBJECT *FileObject;
682 LONG NameBufferOffset;
683 UCHAR CustomDataBuffer[1];
684 } TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
686 typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
687 USHORT Version;
688 USHORT Size;
689 GUID Event;
690 struct _FILE_OBJECT *FileObject;
691 } TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
693 typedef enum _BUS_QUERY_ID_TYPE {
694 BusQueryDeviceID,
695 BusQueryHardwareIDs,
696 BusQueryCompatibleIDs,
697 BusQueryInstanceID,
698 BusQueryDeviceSerialNumber
699 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
701 typedef enum _DEVICE_TEXT_TYPE {
702 DeviceTextDescription,
703 DeviceTextLocationInformation
704 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
706 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
707 DeviceUsageTypeUndefined,
708 DeviceUsageTypePaging,
709 DeviceUsageTypeHibernation,
710 DeviceUsageTypeDumpFile
711 } DEVICE_USAGE_NOTIFICATION_TYPE;
713 typedef struct _POWER_SEQUENCE {
714 ULONG SequenceD1;
715 ULONG SequenceD2;
716 ULONG SequenceD3;
717 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
719 typedef enum {
720 DevicePropertyDeviceDescription,
721 DevicePropertyHardwareID,
722 DevicePropertyCompatibleIDs,
723 DevicePropertyBootConfiguration,
724 DevicePropertyBootConfigurationTranslated,
725 DevicePropertyClassName,
726 DevicePropertyClassGuid,
727 DevicePropertyDriverKeyName,
728 DevicePropertyManufacturer,
729 DevicePropertyFriendlyName,
730 DevicePropertyLocationInformation,
731 DevicePropertyPhysicalDeviceObjectName,
732 DevicePropertyBusTypeGuid,
733 DevicePropertyLegacyBusType,
734 DevicePropertyBusNumber,
735 DevicePropertyEnumeratorName,
736 DevicePropertyAddress,
737 DevicePropertyUINumber,
738 DevicePropertyInstallState,
739 DevicePropertyRemovalPolicy
740 } DEVICE_REGISTRY_PROPERTY;
742 typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
743 EventCategoryReserved,
744 EventCategoryHardwareProfileChange,
745 EventCategoryDeviceInterfaceChange,
746 EventCategoryTargetDeviceChange
747 } IO_NOTIFICATION_EVENT_CATEGORY;
749 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
751 typedef NTSTATUS DDKAPI
752 (*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
753 /*IN*/ PVOID NotificationStructure,
754 /*IN*/ PVOID Context);
756 typedef VOID DDKAPI
757 (*PDEVICE_CHANGE_COMPLETE_CALLBACK)(
758 /*IN*/ PVOID Context);
763 ** System structures
766 #define SYMBOLIC_LINK_QUERY 0x0001
767 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
769 /* also in winnt,h */
770 #define DUPLICATE_CLOSE_SOURCE 0x00000001
771 #define DUPLICATE_SAME_ACCESS 0x00000002
772 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
773 /* end winnt.h */
775 typedef struct _OBJECT_NAME_INFORMATION {
776 UNICODE_STRING Name;
777 } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
779 typedef VOID DDKAPI
780 (*PIO_APC_ROUTINE)(
781 /*IN*/ PVOID ApcContext,
782 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock,
783 /*IN*/ ULONG Reserved);
785 typedef struct _IO_STATUS_BLOCK {
786 _ANONYMOUS_UNION union {
787 NTSTATUS Status;
788 PVOID Pointer;
789 } DUMMYUNIONNAME;
790 ULONG_PTR Information;
791 } IO_STATUS_BLOCK;
793 typedef VOID DDKAPI
794 (*PKNORMAL_ROUTINE)(
795 /*IN*/ PVOID NormalContext,
796 /*IN*/ PVOID SystemArgument1,
797 /*IN*/ PVOID SystemArgument2);
799 typedef VOID DDKAPI
800 (*PKKERNEL_ROUTINE)(
801 /*IN*/ struct _KAPC *Apc,
802 /*IN OUT*/ PKNORMAL_ROUTINE *NormalRoutine,
803 /*IN OUT*/ PVOID *NormalContext,
804 /*IN OUT*/ PVOID *SystemArgument1,
805 /*IN OUT*/ PVOID *SystemArgument2);
807 typedef VOID DDKAPI
808 (*PKRUNDOWN_ROUTINE)(
809 /*IN*/ struct _KAPC *Apc);
811 typedef BOOLEAN DDKAPI
812 (*PKTRANSFER_ROUTINE)(
813 VOID);
815 typedef struct _KAPC {
816 CSHORT Type;
817 CSHORT Size;
818 ULONG Spare0;
819 struct _KTHREAD *Thread;
820 LIST_ENTRY ApcListEntry;
821 PKKERNEL_ROUTINE KernelRoutine;
822 PKRUNDOWN_ROUTINE RundownRoutine;
823 PKNORMAL_ROUTINE NormalRoutine;
824 PVOID NormalContext;
825 PVOID SystemArgument1;
826 PVOID SystemArgument2;
827 CCHAR ApcStateIndex;
828 KPROCESSOR_MODE ApcMode;
829 BOOLEAN Inserted;
830 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
832 typedef struct _KDEVICE_QUEUE {
833 CSHORT Type;
834 CSHORT Size;
835 LIST_ENTRY DeviceListHead;
836 KSPIN_LOCK Lock;
837 BOOLEAN Busy;
838 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
840 typedef struct _KDEVICE_QUEUE_ENTRY {
841 LIST_ENTRY DeviceListEntry;
842 ULONG SortKey;
843 BOOLEAN Inserted;
844 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
845 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
847 #define LOCK_QUEUE_WAIT 1
848 #define LOCK_QUEUE_OWNER 2
850 typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
851 LockQueueDispatcherLock,
852 LockQueueContextSwapLock,
853 LockQueuePfnLock,
854 LockQueueSystemSpaceLock,
855 LockQueueVacbLock,
856 LockQueueMasterLock,
857 LockQueueNonPagedPoolLock,
858 LockQueueIoCancelLock,
859 LockQueueWorkQueueLock,
860 LockQueueIoVpbLock,
861 LockQueueIoDatabaseLock,
862 LockQueueIoCompletionLock,
863 LockQueueNtfsStructLock,
864 LockQueueAfdWorkQueueLock,
865 LockQueueBcbLock,
866 LockQueueMaximumLock
867 } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
869 typedef struct _KSPIN_LOCK_QUEUE {
870 struct _KSPIN_LOCK_QUEUE *VOLATILE Next;
871 PKSPIN_LOCK VOLATILE Lock;
872 } KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
874 typedef struct _KLOCK_QUEUE_HANDLE {
875 KSPIN_LOCK_QUEUE LockQueue;
876 KIRQL OldIrql;
877 } KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
879 typedef struct _KDPC {
880 CSHORT Type;
881 UCHAR Number;
882 UCHAR Importance;
883 LIST_ENTRY DpcListEntry;
884 PKDEFERRED_ROUTINE DeferredRoutine;
885 PVOID DeferredContext;
886 PVOID SystemArgument1;
887 PVOID SystemArgument2;
888 PULONG_PTR Lock;
889 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
891 typedef struct _WAIT_CONTEXT_BLOCK {
892 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
893 struct _DRIVER_CONTROL *DeviceRoutine;
894 PVOID DeviceContext;
895 ULONG NumberOfMapRegisters;
896 PVOID DeviceObject;
897 PVOID CurrentIrp;
898 PKDPC BufferChainingDpc;
899 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
901 typedef struct _DISPATCHER_HEADER {
902 UCHAR Type;
903 UCHAR Absolute;
904 UCHAR Size;
905 UCHAR Inserted;
906 LONG SignalState;
907 LIST_ENTRY WaitListHead;
908 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
910 typedef struct _KEVENT {
911 DISPATCHER_HEADER Header;
912 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
914 typedef struct _KSEMAPHORE {
915 DISPATCHER_HEADER Header;
916 LONG Limit;
917 } KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
919 typedef struct _FAST_MUTEX {
920 LONG Count;
921 struct _KTHREAD *Owner;
922 ULONG Contention;
923 KEVENT Event;
924 ULONG OldIrql;
925 } FAST_MUTEX, *PFAST_MUTEX;
927 typedef struct _KTIMER {
928 DISPATCHER_HEADER Header;
929 ULARGE_INTEGER DueTime;
930 LIST_ENTRY TimerListEntry;
931 struct _KDPC *Dpc;
932 LONG Period;
933 } KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
935 typedef struct _KMUTANT {
936 DISPATCHER_HEADER Header;
937 LIST_ENTRY MutantListEntry;
938 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
939 BOOLEAN Abandoned;
940 UCHAR ApcDisable;
941 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
943 typedef enum _TIMER_TYPE {
944 NotificationTimer,
945 SynchronizationTimer
946 } TIMER_TYPE;
948 #define EVENT_INCREMENT 1
949 #define IO_NO_INCREMENT 0
950 #define IO_CD_ROM_INCREMENT 1
951 #define IO_DISK_INCREMENT 1
952 #define IO_KEYBOARD_INCREMENT 6
953 #define IO_MAILSLOT_INCREMENT 2
954 #define IO_MOUSE_INCREMENT 6
955 #define IO_NAMED_PIPE_INCREMENT 2
956 #define IO_NETWORK_INCREMENT 2
957 #define IO_PARALLEL_INCREMENT 1
958 #define IO_SERIAL_INCREMENT 2
959 #define IO_SOUND_INCREMENT 8
960 #define IO_VIDEO_INCREMENT 1
961 #define SEMAPHORE_INCREMENT 1
963 typedef struct _IRP {
964 CSHORT Type;
965 USHORT Size;
966 struct _MDL *MdlAddress;
967 ULONG Flags;
968 union {
969 struct _IRP *MasterIrp;
970 LONG IrpCount;
971 PVOID SystemBuffer;
972 } AssociatedIrp;
973 LIST_ENTRY ThreadListEntry;
974 IO_STATUS_BLOCK IoStatus;
975 KPROCESSOR_MODE RequestorMode;
976 BOOLEAN PendingReturned;
977 CHAR StackCount;
978 CHAR CurrentLocation;
979 BOOLEAN Cancel;
980 KIRQL CancelIrql;
981 CCHAR ApcEnvironment;
982 UCHAR AllocationFlags;
983 PIO_STATUS_BLOCK UserIosb;
984 PKEVENT UserEvent;
985 union {
986 struct {
987 PIO_APC_ROUTINE UserApcRoutine;
988 PVOID UserApcContext;
989 } AsynchronousParameters;
990 LARGE_INTEGER AllocationSize;
991 } Overlay;
992 PDRIVER_CANCEL CancelRoutine;
993 PVOID UserBuffer;
994 union {
995 struct {
996 _ANONYMOUS_UNION union {
997 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
998 _ANONYMOUS_STRUCT struct {
999 PVOID DriverContext[4];
1000 } DUMMYSTRUCTNAME;
1001 } DUMMYUNIONNAME;
1002 PETHREAD Thread;
1003 PCHAR AuxiliaryBuffer;
1004 _ANONYMOUS_STRUCT struct {
1005 LIST_ENTRY ListEntry;
1006 _ANONYMOUS_UNION union {
1007 struct _IO_STACK_LOCATION *CurrentStackLocation;
1008 ULONG PacketType;
1009 } DUMMYUNIONNAME;
1010 } DUMMYSTRUCTNAME;
1011 struct _FILE_OBJECT *OriginalFileObject;
1012 } Overlay;
1013 KAPC Apc;
1014 PVOID CompletionKey;
1015 } Tail;
1016 } IRP;
1017 typedef struct _IRP *PIRP;
1019 /* IRP.Flags */
1021 #define SL_FORCE_ACCESS_CHECK 0x01
1022 #define SL_OPEN_PAGING_FILE 0x02
1023 #define SL_OPEN_TARGET_DIRECTORY 0x04
1024 #define SL_CASE_SENSITIVE 0x80
1026 #define SL_KEY_SPECIFIED 0x01
1027 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1028 #define SL_WRITE_THROUGH 0x04
1029 #define SL_FT_SEQUENTIAL_WRITE 0x08
1031 #define SL_FAIL_IMMEDIATELY 0x01
1032 #define SL_EXCLUSIVE_LOCK 0x02
1034 #define SL_RESTART_SCAN 0x01
1035 #define SL_RETURN_SINGLE_ENTRY 0x02
1036 #define SL_INDEX_SPECIFIED 0x04
1038 #define SL_WATCH_TREE 0x01
1040 #define SL_ALLOW_RAW_MOUNT 0x01
1042 #define CTL_CODE(DeviceType, Function, Method, Access)( \
1043 ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1045 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1047 enum
1049 IRP_NOCACHE = 0x1,
1050 IRP_PAGING_IO = 0x2,
1051 IRP_MOUNT_COMPLETION = 0x2,
1052 IRP_SYNCHRONOUS_API = 0x4,
1053 IRP_ASSOCIATED_IRP = 0x8,
1054 IRP_BUFFERED_IO = 0x10,
1055 IRP_DEALLOCATE_BUFFER = 0x20,
1056 IRP_INPUT_OPERATION = 0x40,
1057 IRP_SYNCHRONOUS_PAGING_IO = 0x40,
1058 IRP_CREATE_OPERATION = 0x80,
1059 IRP_READ_OPERATION = 0x100,
1060 IRP_WRITE_OPERATION = 0x200,
1061 IRP_CLOSE_OPERATION = 0x400,
1062 IRP_DEFER_IO_COMPLETION = 0x800,
1063 IRP_OB_QUERY_NAME = 0x1000,
1064 IRP_HOLD_DEVICE_QUEUE = 0x2000,
1065 IRP_RETRY_IO_COMPLETION = 0x4000
1069 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
1070 ULONG Signature;
1071 } DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
1073 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
1074 GUID DiskId;
1075 LARGE_INTEGER StartingUsableOffset;
1076 LARGE_INTEGER UsableLength;
1077 ULONG MaxPartitionCount;
1078 } DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
1080 typedef struct _PARTITION_INFORMATION_MBR {
1081 UCHAR PartitionType;
1082 BOOLEAN BootIndicator;
1083 BOOLEAN RecognizedPartition;
1084 ULONG HiddenSectors;
1085 } PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
1088 typedef struct _BOOTDISK_INFORMATION {
1089 LONGLONG BootPartitionOffset;
1090 LONGLONG SystemPartitionOffset;
1091 ULONG BootDeviceSignature;
1092 ULONG SystemDeviceSignature;
1093 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
1095 typedef struct _BOOTDISK_INFORMATION_EX {
1096 LONGLONG BootPartitionOffset;
1097 LONGLONG SystemPartitionOffset;
1098 ULONG BootDeviceSignature;
1099 ULONG SystemDeviceSignature;
1100 GUID BootDeviceGuid;
1101 GUID SystemDeviceGuid;
1102 BOOLEAN BootDeviceIsGpt;
1103 BOOLEAN SystemDeviceIsGpt;
1104 } BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
1106 typedef struct _EISA_MEMORY_TYPE {
1107 UCHAR ReadWrite : 1;
1108 UCHAR Cached : 1;
1109 UCHAR Reserved0 : 1;
1110 UCHAR Type : 2;
1111 UCHAR Shared : 1;
1112 UCHAR Reserved1 : 1;
1113 UCHAR MoreEntries : 1;
1114 } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
1116 #include <pshpack1.h>
1117 typedef struct _EISA_MEMORY_CONFIGURATION {
1118 EISA_MEMORY_TYPE ConfigurationByte;
1119 UCHAR DataSize;
1120 USHORT AddressLowWord;
1121 UCHAR AddressHighByte;
1122 USHORT MemorySize;
1123 } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
1124 #include <poppack.h>
1126 typedef struct _EISA_IRQ_DESCRIPTOR {
1127 UCHAR Interrupt : 4;
1128 UCHAR Reserved : 1;
1129 UCHAR LevelTriggered : 1;
1130 UCHAR Shared : 1;
1131 UCHAR MoreEntries : 1;
1132 } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
1134 typedef struct _EISA_IRQ_CONFIGURATION {
1135 EISA_IRQ_DESCRIPTOR ConfigurationByte;
1136 UCHAR Reserved;
1137 } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
1139 typedef struct _DMA_CONFIGURATION_BYTE0 {
1140 UCHAR Channel : 3;
1141 UCHAR Reserved : 3;
1142 UCHAR Shared : 1;
1143 UCHAR MoreEntries : 1;
1144 } DMA_CONFIGURATION_BYTE0;
1146 typedef struct _DMA_CONFIGURATION_BYTE1 {
1147 UCHAR Reserved0 : 2;
1148 UCHAR TransferSize : 2;
1149 UCHAR Timing : 2;
1150 UCHAR Reserved1 : 2;
1151 } DMA_CONFIGURATION_BYTE1;
1153 typedef struct _EISA_DMA_CONFIGURATION {
1154 DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
1155 DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
1156 } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
1158 #include <pshpack1.h>
1159 typedef struct _EISA_PORT_DESCRIPTOR {
1160 UCHAR NumberPorts : 5;
1161 UCHAR Reserved : 1;
1162 UCHAR Shared : 1;
1163 UCHAR MoreEntries : 1;
1164 } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
1166 typedef struct _EISA_PORT_CONFIGURATION {
1167 EISA_PORT_DESCRIPTOR Configuration;
1168 USHORT PortAddress;
1169 } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
1170 #include <poppack.h>
1172 typedef struct _CM_EISA_FUNCTION_INFORMATION {
1173 ULONG CompressedId;
1174 UCHAR IdSlotFlags1;
1175 UCHAR IdSlotFlags2;
1176 UCHAR MinorRevision;
1177 UCHAR MajorRevision;
1178 UCHAR Selections[26];
1179 UCHAR FunctionFlags;
1180 UCHAR TypeString[80];
1181 EISA_MEMORY_CONFIGURATION EisaMemory[9];
1182 EISA_IRQ_CONFIGURATION EisaIrq[7];
1183 EISA_DMA_CONFIGURATION EisaDma[4];
1184 EISA_PORT_CONFIGURATION EisaPort[20];
1185 UCHAR InitializationData[60];
1186 } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
1188 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
1190 #define EISA_FUNCTION_ENABLED 0x80
1191 #define EISA_FREE_FORM_DATA 0x40
1192 #define EISA_HAS_PORT_INIT_ENTRY 0x20
1193 #define EISA_HAS_PORT_RANGE 0x10
1194 #define EISA_HAS_DMA_ENTRY 0x08
1195 #define EISA_HAS_IRQ_ENTRY 0x04
1196 #define EISA_HAS_MEMORY_ENTRY 0x02
1197 #define EISA_HAS_TYPE_ENTRY 0x01
1198 #define EISA_HAS_INFORMATION \
1199 (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
1200 + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
1202 typedef struct _CM_EISA_SLOT_INFORMATION {
1203 UCHAR ReturnCode;
1204 UCHAR ReturnFlags;
1205 UCHAR MajorRevision;
1206 UCHAR MinorRevision;
1207 USHORT Checksum;
1208 UCHAR NumberFunctions;
1209 UCHAR FunctionInformation;
1210 ULONG CompressedId;
1211 } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
1213 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
1215 #define EISA_INVALID_SLOT 0x80
1216 #define EISA_INVALID_FUNCTION 0x81
1217 #define EISA_INVALID_CONFIGURATION 0x82
1218 #define EISA_EMPTY_SLOT 0x83
1219 #define EISA_INVALID_BIOS_CALL 0x86
1221 typedef struct _CM_FLOPPY_DEVICE_DATA {
1222 USHORT Version;
1223 USHORT Revision;
1224 CHAR Size[8];
1225 ULONG MaxDensity;
1226 ULONG MountDensity;
1227 UCHAR StepRateHeadUnloadTime;
1228 UCHAR HeadLoadTime;
1229 UCHAR MotorOffTime;
1230 UCHAR SectorLengthCode;
1231 UCHAR SectorPerTrack;
1232 UCHAR ReadWriteGapLength;
1233 UCHAR DataTransferLength;
1234 UCHAR FormatGapLength;
1235 UCHAR FormatFillCharacter;
1236 UCHAR HeadSettleTime;
1237 UCHAR MotorSettleTime;
1238 UCHAR MaximumTrackValue;
1239 UCHAR DataTransferRate;
1240 } CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
1242 typedef enum _INTERFACE_TYPE {
1243 InterfaceTypeUndefined = -1,
1244 Internal,
1245 Isa,
1246 Eisa,
1247 MicroChannel,
1248 TurboChannel,
1249 PCIBus,
1250 VMEBus,
1251 NuBus,
1252 PCMCIABus,
1253 CBus,
1254 MPIBus,
1255 MPSABus,
1256 ProcessorInternal,
1257 InternalPowerBus,
1258 PNPISABus,
1259 PNPBus,
1260 MaximumInterfaceType
1261 } INTERFACE_TYPE, *PINTERFACE_TYPE;
1263 typedef struct _PNP_BUS_INFORMATION {
1264 GUID BusTypeGuid;
1265 INTERFACE_TYPE LegacyBusType;
1266 ULONG BusNumber;
1267 } PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
1269 #include <pshpack1.h>
1270 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
1271 UCHAR Type;
1272 UCHAR ShareDisposition;
1273 USHORT Flags;
1274 union {
1275 struct {
1276 PHYSICAL_ADDRESS Start;
1277 ULONG Length;
1278 } Generic;
1279 struct {
1280 PHYSICAL_ADDRESS Start;
1281 ULONG Length;
1282 } Port;
1283 struct {
1284 ULONG Level;
1285 ULONG Vector;
1286 ULONG Affinity;
1287 } Interrupt;
1288 struct {
1289 PHYSICAL_ADDRESS Start;
1290 ULONG Length;
1291 } Memory;
1292 struct {
1293 ULONG Channel;
1294 ULONG Port;
1295 ULONG Reserved1;
1296 } Dma;
1297 struct {
1298 ULONG Data[3];
1299 } DevicePrivate;
1300 struct {
1301 ULONG Start;
1302 ULONG Length;
1303 ULONG Reserved;
1304 } BusNumber;
1305 struct {
1306 ULONG DataSize;
1307 ULONG Reserved1;
1308 ULONG Reserved2;
1309 } DeviceSpecificData;
1310 } u;
1311 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
1313 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
1315 #define CmResourceTypeNull 0
1316 #define CmResourceTypePort 1
1317 #define CmResourceTypeInterrupt 2
1318 #define CmResourceTypeMemory 3
1319 #define CmResourceTypeDma 4
1320 #define CmResourceTypeDeviceSpecific 5
1321 #define CmResourceTypeBusNumber 6
1322 #define CmResourceTypeMaximum 7
1323 #define CmResourceTypeNonArbitrated 128
1324 #define CmResourceTypeConfigData 128
1325 #define CmResourceTypeDevicePrivate 129
1326 #define CmResourceTypePcCardConfig 130
1327 #define CmResourceTypeMfCardConfig 131
1329 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
1331 typedef enum _CM_SHARE_DISPOSITION {
1332 CmResourceShareUndetermined,
1333 CmResourceShareDeviceExclusive,
1334 CmResourceShareDriverExclusive,
1335 CmResourceShareShared
1336 } CM_SHARE_DISPOSITION;
1338 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
1340 #define CM_RESOURCE_PORT_MEMORY 0x0000
1341 #define CM_RESOURCE_PORT_IO 0x0001
1342 #define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
1343 #define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
1344 #define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
1345 #define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
1346 #define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
1347 #define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
1349 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
1351 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
1352 #define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
1354 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
1356 #define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
1357 #define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
1358 #define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
1359 #define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
1360 #define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
1361 #define CM_RESOURCE_MEMORY_24 0x0010
1362 #define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
1364 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
1366 #define CM_RESOURCE_DMA_8 0x0000
1367 #define CM_RESOURCE_DMA_16 0x0001
1368 #define CM_RESOURCE_DMA_32 0x0002
1369 #define CM_RESOURCE_DMA_8_AND_16 0x0004
1370 #define CM_RESOURCE_DMA_BUS_MASTER 0x0008
1371 #define CM_RESOURCE_DMA_TYPE_A 0x0010
1372 #define CM_RESOURCE_DMA_TYPE_B 0x0020
1373 #define CM_RESOURCE_DMA_TYPE_F 0x0040
1375 typedef struct _CM_PARTIAL_RESOURCE_LIST {
1376 USHORT Version;
1377 USHORT Revision;
1378 ULONG Count;
1379 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
1380 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
1382 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
1383 INTERFACE_TYPE InterfaceType;
1384 ULONG BusNumber;
1385 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
1386 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
1388 typedef struct _CM_RESOURCE_LIST {
1389 ULONG Count;
1390 CM_FULL_RESOURCE_DESCRIPTOR List[1];
1391 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
1393 typedef struct _CM_INT13_DRIVE_PARAMETER {
1394 USHORT DriveSelect;
1395 ULONG MaxCylinders;
1396 USHORT SectorsPerTrack;
1397 USHORT MaxHeads;
1398 USHORT NumberDrives;
1399 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
1400 #include <poppack.h>
1402 typedef struct _CM_KEYBOARD_DEVICE_DATA {
1403 USHORT Version;
1404 USHORT Revision;
1405 UCHAR Type;
1406 UCHAR Subtype;
1407 USHORT KeyboardFlags;
1408 } CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
1410 #define KEYBOARD_INSERT_ON 0x80
1411 #define KEYBOARD_CAPS_LOCK_ON 0x40
1412 #define KEYBOARD_NUM_LOCK_ON 0x20
1413 #define KEYBOARD_SCROLL_LOCK_ON 0x10
1414 #define KEYBOARD_ALT_KEY_DOWN 0x08
1415 #define KEYBOARD_CTRL_KEY_DOWN 0x04
1416 #define KEYBOARD_LEFT_SHIFT_DOWN 0x02
1417 #define KEYBOARD_RIGHT_SHIFT_DOWN 0x01
1419 typedef struct _CM_MCA_POS_DATA {
1420 USHORT AdapterId;
1421 UCHAR PosData1;
1422 UCHAR PosData2;
1423 UCHAR PosData3;
1424 UCHAR PosData4;
1425 } CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
1427 typedef struct CM_Power_Data_s {
1428 ULONG PD_Size;
1429 DEVICE_POWER_STATE PD_MostRecentPowerState;
1430 ULONG PD_Capabilities;
1431 ULONG PD_D1Latency;
1432 ULONG PD_D2Latency;
1433 ULONG PD_D3Latency;
1434 DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum];
1435 } CM_POWER_DATA, *PCM_POWER_DATA;
1437 #define PDCAP_D0_SUPPORTED 0x00000001
1438 #define PDCAP_D1_SUPPORTED 0x00000002
1439 #define PDCAP_D2_SUPPORTED 0x00000004
1440 #define PDCAP_D3_SUPPORTED 0x00000008
1441 #define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
1442 #define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
1443 #define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
1444 #define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
1445 #define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
1447 typedef struct _CM_SCSI_DEVICE_DATA {
1448 USHORT Version;
1449 USHORT Revision;
1450 UCHAR HostIdentifier;
1451 } CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
1453 typedef struct _CM_SERIAL_DEVICE_DATA {
1454 USHORT Version;
1455 USHORT Revision;
1456 ULONG BaudClock;
1457 } CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
1459 /* IO_RESOURCE_DESCRIPTOR.Option */
1461 #define IO_RESOURCE_PREFERRED 0x01
1462 #define IO_RESOURCE_DEFAULT 0x02
1463 #define IO_RESOURCE_ALTERNATIVE 0x08
1465 typedef struct _IO_RESOURCE_DESCRIPTOR {
1466 UCHAR Option;
1467 UCHAR Type;
1468 UCHAR ShareDisposition;
1469 UCHAR Spare1;
1470 USHORT Flags;
1471 USHORT Spare2;
1472 union {
1473 struct {
1474 ULONG Length;
1475 ULONG Alignment;
1476 PHYSICAL_ADDRESS MinimumAddress;
1477 PHYSICAL_ADDRESS MaximumAddress;
1478 } Port;
1479 struct {
1480 ULONG Length;
1481 ULONG Alignment;
1482 PHYSICAL_ADDRESS MinimumAddress;
1483 PHYSICAL_ADDRESS MaximumAddress;
1484 } Memory;
1485 struct {
1486 ULONG MinimumVector;
1487 ULONG MaximumVector;
1488 } Interrupt;
1489 struct {
1490 ULONG MinimumChannel;
1491 ULONG MaximumChannel;
1492 } Dma;
1493 struct {
1494 ULONG Length;
1495 ULONG Alignment;
1496 PHYSICAL_ADDRESS MinimumAddress;
1497 PHYSICAL_ADDRESS MaximumAddress;
1498 } Generic;
1499 struct {
1500 ULONG Data[3];
1501 } DevicePrivate;
1502 struct {
1503 ULONG Length;
1504 ULONG MinBusNumber;
1505 ULONG MaxBusNumber;
1506 ULONG Reserved;
1507 } BusNumber;
1508 struct {
1509 ULONG Priority;
1510 ULONG Reserved1;
1511 ULONG Reserved2;
1512 } ConfigData;
1513 } u;
1514 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
1516 typedef struct _IO_RESOURCE_LIST {
1517 USHORT Version;
1518 USHORT Revision;
1519 ULONG Count;
1520 IO_RESOURCE_DESCRIPTOR Descriptors[1];
1521 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
1523 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
1524 ULONG ListSize;
1525 INTERFACE_TYPE InterfaceType;
1526 ULONG BusNumber;
1527 ULONG SlotNumber;
1528 ULONG Reserved[3];
1529 ULONG AlternativeLists;
1530 IO_RESOURCE_LIST List[1];
1531 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
1533 typedef struct _CONTROLLER_OBJECT {
1534 CSHORT Type;
1535 CSHORT Size;
1536 PVOID ControllerExtension;
1537 KDEVICE_QUEUE DeviceWaitQueue;
1538 ULONG Spare1;
1539 LARGE_INTEGER Spare2;
1540 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
1542 typedef enum _DMA_WIDTH {
1543 Width8Bits,
1544 Width16Bits,
1545 Width32Bits,
1546 MaximumDmaWidth
1547 } DMA_WIDTH, *PDMA_WIDTH;
1549 typedef enum _DMA_SPEED {
1550 Compatible,
1551 TypeA,
1552 TypeB,
1553 TypeC,
1554 TypeF,
1555 MaximumDmaSpeed
1556 } DMA_SPEED, *PDMA_SPEED;
1558 /* DEVICE_DESCRIPTION.Version */
1560 #define DEVICE_DESCRIPTION_VERSION 0x0000
1561 #define DEVICE_DESCRIPTION_VERSION1 0x0001
1562 #define DEVICE_DESCRIPTION_VERSION2 0x0002
1564 typedef struct _DEVICE_DESCRIPTION {
1565 ULONG Version;
1566 BOOLEAN Master;
1567 BOOLEAN ScatterGather;
1568 BOOLEAN DemandMode;
1569 BOOLEAN AutoInitialize;
1570 BOOLEAN Dma32BitAddresses;
1571 BOOLEAN IgnoreCount;
1572 BOOLEAN Reserved1;
1573 BOOLEAN Dma64BitAddresses;
1574 ULONG BusNumber;
1575 ULONG DmaChannel;
1576 INTERFACE_TYPE InterfaceType;
1577 DMA_WIDTH DmaWidth;
1578 DMA_SPEED DmaSpeed;
1579 ULONG MaximumLength;
1580 ULONG DmaPort;
1581 } DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
1583 /* VPB.Flags */
1584 #define VPB_MOUNTED 0x0001
1585 #define VPB_LOCKED 0x0002
1586 #define VPB_PERSISTENT 0x0004
1587 #define VPB_REMOVE_PENDING 0x0008
1588 #define VPB_RAW_MOUNT 0x0010
1590 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
1592 typedef struct _VPB {
1593 CSHORT Type;
1594 CSHORT Size;
1595 USHORT Flags;
1596 USHORT VolumeLabelLength;
1597 struct _DEVICE_OBJECT *DeviceObject;
1598 struct _DEVICE_OBJECT *RealDevice;
1599 ULONG SerialNumber;
1600 ULONG ReferenceCount;
1601 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
1602 } VPB, *PVPB;
1604 /* DEVICE_OBJECT.Flags */
1606 #define DO_VERIFY_VOLUME 0x00000002
1607 #define DO_BUFFERED_IO 0x00000004
1608 #define DO_EXCLUSIVE 0x00000008
1609 #define DO_DIRECT_IO 0x00000010
1610 #define DO_MAP_IO_BUFFER 0x00000020
1611 #define DO_DEVICE_HAS_NAME 0x00000040
1612 #define DO_DEVICE_INITIALIZING 0x00000080
1613 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
1614 #define DO_LONG_TERM_REQUESTS 0x00000200
1615 #define DO_NEVER_LAST_DEVICE 0x00000400
1616 #define DO_SHUTDOWN_REGISTERED 0x00000800
1617 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
1618 #define DO_POWER_PAGABLE 0x00002000
1619 #define DO_POWER_INRUSH 0x00004000
1620 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
1622 /* DEVICE_OBJECT.Characteristics */
1624 #define FILE_REMOVABLE_MEDIA 0x00000001
1625 #define FILE_READ_ONLY_DEVICE 0x00000002
1626 #define FILE_FLOPPY_DISKETTE 0x00000004
1627 #define FILE_WRITE_ONCE_MEDIA 0x00000008
1628 #define FILE_REMOTE_DEVICE 0x00000010
1629 #define FILE_DEVICE_IS_MOUNTED 0x00000020
1630 #define FILE_VIRTUAL_VOLUME 0x00000040
1631 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
1632 #define FILE_DEVICE_SECURE_OPEN 0x00000100
1634 /* DEVICE_OBJECT.AlignmentRequirement */
1636 #define FILE_BYTE_ALIGNMENT 0x00000000
1637 #define FILE_WORD_ALIGNMENT 0x00000001
1638 #define FILE_LONG_ALIGNMENT 0x00000003
1639 #define FILE_QUAD_ALIGNMENT 0x00000007
1640 #define FILE_OCTA_ALIGNMENT 0x0000000f
1641 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
1642 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
1643 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
1644 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
1645 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
1647 /* DEVICE_OBJECT.DeviceType */
1649 #define DEVICE_TYPE ULONG
1651 #define FILE_DEVICE_BEEP 0x00000001
1652 #define FILE_DEVICE_CD_ROM 0x00000002
1653 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
1654 #define FILE_DEVICE_CONTROLLER 0x00000004
1655 #define FILE_DEVICE_DATALINK 0x00000005
1656 #define FILE_DEVICE_DFS 0x00000006
1657 #define FILE_DEVICE_DISK 0x00000007
1658 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
1659 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
1660 #define FILE_DEVICE_INPORT_PORT 0x0000000a
1661 #define FILE_DEVICE_KEYBOARD 0x0000000b
1662 #define FILE_DEVICE_MAILSLOT 0x0000000c
1663 #define FILE_DEVICE_MIDI_IN 0x0000000d
1664 #define FILE_DEVICE_MIDI_OUT 0x0000000e
1665 #define FILE_DEVICE_MOUSE 0x0000000f
1666 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
1667 #define FILE_DEVICE_NAMED_PIPE 0x00000011
1668 #define FILE_DEVICE_NETWORK 0x00000012
1669 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
1670 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
1671 #define FILE_DEVICE_NULL 0x00000015
1672 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
1673 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
1674 #define FILE_DEVICE_PRINTER 0x00000018
1675 #define FILE_DEVICE_SCANNER 0x00000019
1676 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
1677 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
1678 #define FILE_DEVICE_SCREEN 0x0000001c
1679 #define FILE_DEVICE_SOUND 0x0000001d
1680 #define FILE_DEVICE_STREAMS 0x0000001e
1681 #define FILE_DEVICE_TAPE 0x0000001f
1682 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
1683 #define FILE_DEVICE_TRANSPORT 0x00000021
1684 #define FILE_DEVICE_UNKNOWN 0x00000022
1685 #define FILE_DEVICE_VIDEO 0x00000023
1686 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
1687 #define FILE_DEVICE_WAVE_IN 0x00000025
1688 #define FILE_DEVICE_WAVE_OUT 0x00000026
1689 #define FILE_DEVICE_8042_PORT 0x00000027
1690 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
1691 #define FILE_DEVICE_BATTERY 0x00000029
1692 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
1693 #define FILE_DEVICE_MODEM 0x0000002b
1694 #define FILE_DEVICE_VDM 0x0000002c
1695 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
1696 #define FILE_DEVICE_SMB 0x0000002e
1697 #define FILE_DEVICE_KS 0x0000002f
1698 #define FILE_DEVICE_CHANGER 0x00000030
1699 #define FILE_DEVICE_SMARTCARD 0x00000031
1700 #define FILE_DEVICE_ACPI 0x00000032
1701 #define FILE_DEVICE_DVD 0x00000033
1702 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
1703 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
1704 #define FILE_DEVICE_DFS_VOLUME 0x00000036
1705 #define FILE_DEVICE_SERENUM 0x00000037
1706 #define FILE_DEVICE_TERMSRV 0x00000038
1707 #define FILE_DEVICE_KSEC 0x00000039
1708 #define FILE_DEVICE_FIPS 0x0000003a
1710 typedef struct _DEVICE_OBJECT {
1711 CSHORT Type;
1712 USHORT Size;
1713 LONG ReferenceCount;
1714 struct _DRIVER_OBJECT *DriverObject;
1715 struct _DEVICE_OBJECT *NextDevice;
1716 struct _DEVICE_OBJECT *AttachedDevice;
1717 struct _IRP *CurrentIrp;
1718 PIO_TIMER Timer;
1719 ULONG Flags;
1720 ULONG Characteristics;
1721 PVPB Vpb;
1722 PVOID DeviceExtension;
1723 DEVICE_TYPE DeviceType;
1724 CCHAR StackSize;
1725 union {
1726 LIST_ENTRY ListEntry;
1727 WAIT_CONTEXT_BLOCK Wcb;
1728 } Queue;
1729 ULONG AlignmentRequirement;
1730 KDEVICE_QUEUE DeviceQueue;
1731 KDPC Dpc;
1732 ULONG ActiveThreadCount;
1733 PSECURITY_DESCRIPTOR SecurityDescriptor;
1734 KEVENT DeviceLock;
1735 USHORT SectorSize;
1736 USHORT Spare1;
1737 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
1738 PVOID Reserved;
1739 } DEVICE_OBJECT;
1740 typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
1742 typedef enum _DEVICE_RELATION_TYPE {
1743 BusRelations,
1744 EjectionRelations,
1745 PowerRelations,
1746 RemovalRelations,
1747 TargetDeviceRelation,
1748 SingleBusRelations
1749 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
1751 typedef struct _DEVICE_RELATIONS {
1752 ULONG Count;
1753 PDEVICE_OBJECT Objects[1];
1754 } DEVICE_RELATIONS, *PDEVICE_RELATIONS;
1756 typedef struct _SCATTER_GATHER_ELEMENT {
1757 PHYSICAL_ADDRESS Address;
1758 ULONG Length;
1759 ULONG_PTR Reserved;
1760 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
1762 typedef struct _SCATTER_GATHER_LIST {
1763 ULONG NumberOfElements;
1764 ULONG_PTR Reserved;
1765 SCATTER_GATHER_ELEMENT Elements[0];
1766 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
1768 typedef struct _MDL {
1769 struct _MDL *Next;
1770 CSHORT Size;
1771 CSHORT MdlFlags;
1772 struct _EPROCESS *Process;
1773 PVOID MappedSystemVa;
1774 PVOID StartVa;
1775 ULONG ByteCount;
1776 ULONG ByteOffset;
1777 } MDL, *PMDL;
1779 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1780 #define MDL_PAGES_LOCKED 0x0002
1781 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1782 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1783 #define MDL_PARTIAL 0x0010
1784 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1785 #define MDL_IO_PAGE_READ 0x0040
1786 #define MDL_WRITE_OPERATION 0x0080
1787 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1788 #define MDL_FREE_EXTRA_PTES 0x0200
1789 #define MDL_IO_SPACE 0x0800
1790 #define MDL_NETWORK_HEADER 0x1000
1791 #define MDL_MAPPING_CAN_FAIL 0x2000
1792 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1794 #define MDL_MAPPING_FLAGS ( \
1795 MDL_MAPPED_TO_SYSTEM_VA | \
1796 MDL_PAGES_LOCKED | \
1797 MDL_SOURCE_IS_NONPAGED_POOL | \
1798 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1799 MDL_PARENT_MAPPED_SYSTEM_VA | \
1800 MDL_SYSTEM_VA | \
1801 MDL_IO_SPACE)
1803 typedef VOID DDKAPI
1804 (*PPUT_DMA_ADAPTER)(
1805 /*IN*/ PDMA_ADAPTER DmaAdapter);
1807 typedef PVOID DDKAPI
1808 (*PALLOCATE_COMMON_BUFFER)(
1809 /*IN*/ PDMA_ADAPTER DmaAdapter,
1810 /*IN*/ ULONG Length,
1811 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress,
1812 /*IN*/ BOOLEAN CacheEnabled);
1814 typedef VOID DDKAPI
1815 (*PFREE_COMMON_BUFFER)(
1816 /*IN*/ PDMA_ADAPTER DmaAdapter,
1817 /*IN*/ ULONG Length,
1818 /*IN*/ PHYSICAL_ADDRESS LogicalAddress,
1819 /*IN*/ PVOID VirtualAddress,
1820 /*IN*/ BOOLEAN CacheEnabled);
1822 typedef NTSTATUS DDKAPI
1823 (*PALLOCATE_ADAPTER_CHANNEL)(
1824 /*IN*/ PDMA_ADAPTER DmaAdapter,
1825 /*IN*/ PDEVICE_OBJECT DeviceObject,
1826 /*IN*/ ULONG NumberOfMapRegisters,
1827 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
1828 /*IN*/ PVOID Context);
1830 typedef BOOLEAN DDKAPI
1831 (*PFLUSH_ADAPTER_BUFFERS)(
1832 /*IN*/ PDMA_ADAPTER DmaAdapter,
1833 /*IN*/ PMDL Mdl,
1834 /*IN*/ PVOID MapRegisterBase,
1835 /*IN*/ PVOID CurrentVa,
1836 /*IN*/ ULONG Length,
1837 /*IN*/ BOOLEAN WriteToDevice);
1839 typedef VOID DDKAPI
1840 (*PFREE_ADAPTER_CHANNEL)(
1841 /*IN*/ PDMA_ADAPTER DmaAdapter);
1843 typedef VOID DDKAPI
1844 (*PFREE_MAP_REGISTERS)(
1845 /*IN*/ PDMA_ADAPTER DmaAdapter,
1846 PVOID MapRegisterBase,
1847 ULONG NumberOfMapRegisters);
1849 typedef PHYSICAL_ADDRESS DDKAPI
1850 (*PMAP_TRANSFER)(
1851 /*IN*/ PDMA_ADAPTER DmaAdapter,
1852 /*IN*/ PMDL Mdl,
1853 /*IN*/ PVOID MapRegisterBase,
1854 /*IN*/ PVOID CurrentVa,
1855 /*IN OUT*/ PULONG Length,
1856 /*IN*/ BOOLEAN WriteToDevice);
1858 typedef ULONG DDKAPI
1859 (*PGET_DMA_ALIGNMENT)(
1860 /*IN*/ PDMA_ADAPTER DmaAdapter);
1862 typedef ULONG DDKAPI
1863 (*PREAD_DMA_COUNTER)(
1864 /*IN*/ PDMA_ADAPTER DmaAdapter);
1866 typedef NTSTATUS DDKAPI
1867 (*PGET_SCATTER_GATHER_LIST)(
1868 /*IN*/ PDMA_ADAPTER DmaAdapter,
1869 /*IN*/ PDEVICE_OBJECT DeviceObject,
1870 /*IN*/ PMDL Mdl,
1871 /*IN*/ PVOID CurrentVa,
1872 /*IN*/ ULONG Length,
1873 /*IN*/ PDRIVER_LIST_CONTROL ExecutionRoutine,
1874 /*IN*/ PVOID Context,
1875 /*IN*/ BOOLEAN WriteToDevice);
1877 typedef VOID DDKAPI
1878 (*PPUT_SCATTER_GATHER_LIST)(
1879 /*IN*/ PDMA_ADAPTER DmaAdapter,
1880 /*IN*/ PSCATTER_GATHER_LIST ScatterGather,
1881 /*IN*/ BOOLEAN WriteToDevice);
1883 typedef NTSTATUS DDKAPI
1884 (*PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
1885 /*IN*/ PDMA_ADAPTER DmaAdapter,
1886 /*IN*/ PMDL Mdl /*OPTIONAL*/,
1887 /*IN*/ PVOID CurrentVa,
1888 /*IN*/ ULONG Length,
1889 /*OUT*/ PULONG ScatterGatherListSize,
1890 /*OUT*/ PULONG pNumberOfMapRegisters /*OPTIONAL*/);
1892 typedef NTSTATUS DDKAPI
1893 (*PBUILD_SCATTER_GATHER_LIST)(
1894 /*IN*/ PDMA_ADAPTER DmaAdapter,
1895 /*IN*/ PDEVICE_OBJECT DeviceObject,
1896 /*IN*/ PMDL Mdl,
1897 /*IN*/ PVOID CurrentVa,
1898 /*IN*/ ULONG Length,
1899 /*IN*/ PDRIVER_LIST_CONTROL ExecutionRoutine,
1900 /*IN*/ PVOID Context,
1901 /*IN*/ BOOLEAN WriteToDevice,
1902 /*IN*/ PVOID ScatterGatherBuffer,
1903 /*IN*/ ULONG ScatterGatherLength);
1905 typedef NTSTATUS DDKAPI
1906 (*PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
1907 /*IN*/ PDMA_ADAPTER DmaAdapter,
1908 /*IN*/ PSCATTER_GATHER_LIST ScatterGather,
1909 /*IN*/ PMDL OriginalMdl,
1910 /*OUT*/ PMDL *TargetMdl);
1912 typedef struct _DMA_OPERATIONS {
1913 ULONG Size;
1914 PPUT_DMA_ADAPTER PutDmaAdapter;
1915 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
1916 PFREE_COMMON_BUFFER FreeCommonBuffer;
1917 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
1918 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
1919 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
1920 PFREE_MAP_REGISTERS FreeMapRegisters;
1921 PMAP_TRANSFER MapTransfer;
1922 PGET_DMA_ALIGNMENT GetDmaAlignment;
1923 PREAD_DMA_COUNTER ReadDmaCounter;
1924 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
1925 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
1926 PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList;
1927 PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList;
1928 PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList;
1929 } DMA_OPERATIONS, *PDMA_OPERATIONS;
1931 typedef struct _DMA_ADAPTER {
1932 USHORT Version;
1933 USHORT Size;
1934 PDMA_OPERATIONS DmaOperations;
1935 } DMA_ADAPTER;
1937 typedef enum _FILE_INFORMATION_CLASS {
1938 FileDirectoryInformation = 1,
1939 FileFullDirectoryInformation,
1940 FileBothDirectoryInformation,
1941 FileBasicInformation,
1942 FileStandardInformation,
1943 FileInternalInformation,
1944 FileEaInformation,
1945 FileAccessInformation,
1946 FileNameInformation,
1947 FileRenameInformation,
1948 FileLinkInformation,
1949 FileNamesInformation,
1950 FileDispositionInformation,
1951 FilePositionInformation,
1952 FileFullEaInformation,
1953 FileModeInformation,
1954 FileAlignmentInformation,
1955 FileAllInformation,
1956 FileAllocationInformation,
1957 FileEndOfFileInformation,
1958 FileAlternateNameInformation,
1959 FileStreamInformation,
1960 FilePipeInformation,
1961 FilePipeLocalInformation,
1962 FilePipeRemoteInformation,
1963 FileMailslotQueryInformation,
1964 FileMailslotSetInformation,
1965 FileCompressionInformation,
1966 FileObjectIdInformation,
1967 FileCompletionInformation,
1968 FileMoveClusterInformation,
1969 FileQuotaInformation,
1970 FileReparsePointInformation,
1971 FileNetworkOpenInformation,
1972 FileAttributeTagInformation,
1973 FileTrackingInformation,
1974 FileIdBothDirectoryInformation,
1975 FileIdFullDirectoryInformation,
1976 FileValidDataLengthInformation,
1977 FileShortNameInformation,
1978 FileMaximumInformation
1979 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
1981 typedef struct _FILE_POSITION_INFORMATION {
1982 LARGE_INTEGER CurrentByteOffset;
1983 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
1985 typedef struct _FILE_ALIGNMENT_INFORMATION {
1986 ULONG AlignmentRequirement;
1987 } FILE_ALIGNMENT_INFORMATION;
1989 typedef struct _FILE_NAME_INFORMATION {
1990 ULONG FileNameLength;
1991 WCHAR FileName[1];
1992 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
1994 typedef struct _FILE_BASIC_INFORMATION {
1995 LARGE_INTEGER CreationTime;
1996 LARGE_INTEGER LastAccessTime;
1997 LARGE_INTEGER LastWriteTime;
1998 LARGE_INTEGER ChangeTime;
1999 ULONG FileAttributes;
2000 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
2002 typedef struct _FILE_STANDARD_INFORMATION {
2003 LARGE_INTEGER AllocationSize;
2004 LARGE_INTEGER EndOfFile;
2005 ULONG NumberOfLinks;
2006 BOOLEAN DeletePending;
2007 BOOLEAN Directory;
2008 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
2010 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
2011 LARGE_INTEGER CreationTime;
2012 LARGE_INTEGER LastAccessTime;
2013 LARGE_INTEGER LastWriteTime;
2014 LARGE_INTEGER ChangeTime;
2015 LARGE_INTEGER AllocationSize;
2016 LARGE_INTEGER EndOfFile;
2017 ULONG FileAttributes;
2018 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
2020 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION {
2021 ULONG FileAttributes;
2022 ULONG ReparseTag;
2023 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
2025 typedef struct _FILE_DISPOSITION_INFORMATION {
2026 BOOLEAN DoDeleteFile;
2027 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
2029 typedef struct _FILE_END_OF_FILE_INFORMATION {
2030 LARGE_INTEGER EndOfFile;
2031 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
2033 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION {
2034 LARGE_INTEGER ValidDataLength;
2035 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
2037 typedef enum _FSINFOCLASS {
2038 FileFsVolumeInformation = 1,
2039 FileFsLabelInformation,
2040 FileFsSizeInformation,
2041 FileFsDeviceInformation,
2042 FileFsAttributeInformation,
2043 FileFsControlInformation,
2044 FileFsFullSizeInformation,
2045 FileFsObjectIdInformation,
2046 FileFsDriverPathInformation,
2047 FileFsMaximumInformation
2048 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
2050 typedef struct _FILE_FS_DEVICE_INFORMATION {
2051 DEVICE_TYPE DeviceType;
2052 ULONG Characteristics;
2053 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
2055 typedef struct _FILE_FULL_EA_INFORMATION {
2056 ULONG NextEntryOffset;
2057 UCHAR Flags;
2058 UCHAR EaNameLength;
2059 USHORT EaValueLength;
2060 CHAR EaName[1];
2061 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
2063 typedef ULONG_PTR ERESOURCE_THREAD;
2064 typedef ERESOURCE_THREAD *PERESOURCE_THREAD;
2066 typedef struct _OWNER_ENTRY {
2067 ERESOURCE_THREAD OwnerThread;
2068 _ANONYMOUS_UNION union {
2069 LONG OwnerCount;
2070 ULONG TableSize;
2071 } DUMMYUNIONNAME;
2072 } OWNER_ENTRY, *POWNER_ENTRY;
2074 /* ERESOURCE.Flag */
2076 #define ResourceNeverExclusive 0x0010
2077 #define ResourceReleaseByOtherThread 0x0020
2078 #define ResourceOwnedExclusive 0x0080
2080 #define RESOURCE_HASH_TABLE_SIZE 64
2082 typedef struct _ERESOURCE {
2083 LIST_ENTRY SystemResourcesList;
2084 POWNER_ENTRY OwnerTable;
2085 SHORT ActiveCount;
2086 USHORT Flag;
2087 PKSEMAPHORE SharedWaiters;
2088 PKEVENT ExclusiveWaiters;
2089 OWNER_ENTRY OwnerThreads[2];
2090 ULONG ContentionCount;
2091 USHORT NumberOfSharedWaiters;
2092 USHORT NumberOfExclusiveWaiters;
2093 _ANONYMOUS_UNION union {
2094 PVOID Address;
2095 ULONG_PTR CreatorBackTraceIndex;
2096 } DUMMYUNIONNAME;
2097 KSPIN_LOCK SpinLock;
2098 } ERESOURCE, *PERESOURCE;
2100 /* NOTE: PVOID for methods to avoid 'assignment from incompatible pointer type' warning */
2101 typedef struct _DRIVER_EXTENSION {
2102 struct _DRIVER_OBJECT *DriverObject;
2103 PVOID AddDevice;
2104 ULONG Count;
2105 UNICODE_STRING ServiceKeyName;
2106 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
2108 typedef BOOLEAN DDKAPI
2109 (*PFAST_IO_CHECK_IF_POSSIBLE)(
2110 /*IN*/ struct _FILE_OBJECT *FileObject,
2111 /*IN*/ PLARGE_INTEGER FileOffset,
2112 /*IN*/ ULONG Length,
2113 /*IN*/ BOOLEAN Wait,
2114 /*IN*/ ULONG LockKey,
2115 /*IN*/ BOOLEAN CheckForReadOperation,
2116 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2117 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2119 typedef BOOLEAN DDKAPI
2120 (*PFAST_IO_READ)(
2121 /*IN*/ struct _FILE_OBJECT *FileObject,
2122 /*IN*/ PLARGE_INTEGER FileOffset,
2123 /*IN*/ ULONG Length,
2124 /*IN*/ BOOLEAN Wait,
2125 /*IN*/ ULONG LockKey,
2126 /*OUT*/ PVOID Buffer,
2127 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2128 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2130 typedef BOOLEAN DDKAPI
2131 (*PFAST_IO_WRITE)(
2132 /*IN*/ struct _FILE_OBJECT *FileObject,
2133 /*IN*/ PLARGE_INTEGER FileOffset,
2134 /*IN*/ ULONG Length,
2135 /*IN*/ BOOLEAN Wait,
2136 /*IN*/ ULONG LockKey,
2137 /*IN*/ PVOID Buffer,
2138 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2139 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2141 typedef BOOLEAN DDKAPI
2142 (*PFAST_IO_QUERY_BASIC_INFO)(
2143 /*IN*/ struct _FILE_OBJECT *FileObject,
2144 /*IN*/ BOOLEAN Wait,
2145 /*OUT*/ PFILE_BASIC_INFORMATION Buffer,
2146 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2147 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2149 typedef BOOLEAN DDKAPI
2150 (*PFAST_IO_QUERY_STANDARD_INFO)(
2151 /*IN*/ struct _FILE_OBJECT *FileObject,
2152 /*IN*/ BOOLEAN Wait,
2153 /*OUT*/ PFILE_STANDARD_INFORMATION Buffer,
2154 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2155 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2157 typedef BOOLEAN DDKAPI
2158 (*PFAST_IO_LOCK)(
2159 /*IN*/ struct _FILE_OBJECT *FileObject,
2160 /*IN*/ PLARGE_INTEGER FileOffset,
2161 /*IN*/ PLARGE_INTEGER Length,
2162 PEPROCESS ProcessId,
2163 ULONG Key,
2164 BOOLEAN FailImmediately,
2165 BOOLEAN ExclusiveLock,
2166 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2167 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2169 typedef BOOLEAN DDKAPI
2170 (*PFAST_IO_UNLOCK_SINGLE)(
2171 /*IN*/ struct _FILE_OBJECT *FileObject,
2172 /*IN*/ PLARGE_INTEGER FileOffset,
2173 /*IN*/ PLARGE_INTEGER Length,
2174 PEPROCESS ProcessId,
2175 ULONG Key,
2176 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2177 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2179 typedef BOOLEAN DDKAPI
2180 (*PFAST_IO_UNLOCK_ALL)(
2181 /*IN*/ struct _FILE_OBJECT *FileObject,
2182 PEPROCESS ProcessId,
2183 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2184 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2186 typedef BOOLEAN DDKAPI
2187 (*PFAST_IO_UNLOCK_ALL_BY_KEY)(
2188 /*IN*/ struct _FILE_OBJECT *FileObject,
2189 PVOID ProcessId,
2190 ULONG Key,
2191 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2192 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2194 typedef BOOLEAN DDKAPI
2195 (*PFAST_IO_DEVICE_CONTROL)(
2196 /*IN*/ struct _FILE_OBJECT *FileObject,
2197 /*IN*/ BOOLEAN Wait,
2198 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
2199 /*IN*/ ULONG InputBufferLength,
2200 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
2201 /*IN*/ ULONG OutputBufferLength,
2202 /*IN*/ ULONG IoControlCode,
2203 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2204 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2206 typedef VOID DDKAPI
2207 (*PFAST_IO_ACQUIRE_FILE)(
2208 /*IN*/ struct _FILE_OBJECT *FileObject);
2210 typedef VOID DDKAPI
2211 (*PFAST_IO_RELEASE_FILE)(
2212 /*IN*/ struct _FILE_OBJECT *FileObject);
2214 typedef VOID DDKAPI
2215 (*PFAST_IO_DETACH_DEVICE)(
2216 /*IN*/ struct _DEVICE_OBJECT *SourceDevice,
2217 /*IN*/ struct _DEVICE_OBJECT *TargetDevice);
2219 typedef BOOLEAN DDKAPI
2220 (*PFAST_IO_QUERY_NETWORK_OPEN_INFO)(
2221 /*IN*/ struct _FILE_OBJECT *FileObject,
2222 /*IN*/ BOOLEAN Wait,
2223 /*OUT*/ struct _FILE_NETWORK_OPEN_INFORMATION *Buffer,
2224 /*OUT*/ struct _IO_STATUS_BLOCK *IoStatus,
2225 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2227 typedef NTSTATUS DDKAPI
2228 (*PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
2229 /*IN*/ struct _FILE_OBJECT *FileObject,
2230 /*IN*/ PLARGE_INTEGER EndingOffset,
2231 /*OUT*/ struct _ERESOURCE **ResourceToRelease,
2232 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2234 typedef BOOLEAN DDKAPI
2235 (*PFAST_IO_MDL_READ)(
2236 /*IN*/ struct _FILE_OBJECT *FileObject,
2237 /*IN*/ PLARGE_INTEGER FileOffset,
2238 /*IN*/ ULONG Length,
2239 /*IN*/ ULONG LockKey,
2240 /*OUT*/ PMDL *MdlChain,
2241 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2242 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2244 typedef BOOLEAN DDKAPI
2245 (*PFAST_IO_MDL_READ_COMPLETE)(
2246 /*IN*/ struct _FILE_OBJECT *FileObject,
2247 /*IN*/ PMDL MdlChain,
2248 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2250 typedef BOOLEAN DDKAPI
2251 (*PFAST_IO_PREPARE_MDL_WRITE)(
2252 /*IN*/ struct _FILE_OBJECT *FileObject,
2253 /*IN*/ PLARGE_INTEGER FileOffset,
2254 /*IN*/ ULONG Length,
2255 /*IN*/ ULONG LockKey,
2256 /*OUT*/ PMDL *MdlChain,
2257 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2258 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2260 typedef BOOLEAN DDKAPI
2261 (*PFAST_IO_MDL_WRITE_COMPLETE)(
2262 /*IN*/ struct _FILE_OBJECT *FileObject,
2263 /*IN*/ PLARGE_INTEGER FileOffset,
2264 /*IN*/ PMDL MdlChain,
2265 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2267 typedef BOOLEAN DDKAPI
2268 (*PFAST_IO_READ_COMPRESSED)(
2269 /*IN*/ struct _FILE_OBJECT *FileObject,
2270 /*IN*/ PLARGE_INTEGER FileOffset,
2271 /*IN*/ ULONG Length,
2272 /*IN*/ ULONG LockKey,
2273 /*OUT*/ PVOID Buffer,
2274 /*OUT*/ PMDL *MdlChain,
2275 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2276 /*OUT*/ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
2277 /*IN*/ ULONG CompressedDataInfoLength,
2278 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2280 typedef BOOLEAN DDKAPI
2281 (*PFAST_IO_WRITE_COMPRESSED)(
2282 /*IN*/ struct _FILE_OBJECT *FileObject,
2283 /*IN*/ PLARGE_INTEGER FileOffset,
2284 /*IN*/ ULONG Length,
2285 /*IN*/ ULONG LockKey,
2286 /*IN*/ PVOID Buffer,
2287 /*OUT*/ PMDL *MdlChain,
2288 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2289 /*IN*/ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
2290 /*IN*/ ULONG CompressedDataInfoLength,
2291 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2293 typedef BOOLEAN DDKAPI
2294 (*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
2295 /*IN*/ struct _FILE_OBJECT *FileObject,
2296 /*IN*/ PMDL MdlChain,
2297 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2299 typedef BOOLEAN DDKAPI
2300 (*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
2301 /*IN*/ struct _FILE_OBJECT *FileObject,
2302 /*IN*/ PLARGE_INTEGER FileOffset,
2303 /*IN*/ PMDL MdlChain,
2304 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2306 typedef BOOLEAN DDKAPI
2307 (*PFAST_IO_QUERY_OPEN)(
2308 /*IN*/ struct _IRP *Irp,
2309 /*OUT*/ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
2310 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2312 typedef NTSTATUS DDKAPI
2313 (*PFAST_IO_RELEASE_FOR_MOD_WRITE)(
2314 /*IN*/ struct _FILE_OBJECT *FileObject,
2315 /*IN*/ struct _ERESOURCE *ResourceToRelease,
2316 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2318 typedef NTSTATUS DDKAPI
2319 (*PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
2320 /*IN*/ struct _FILE_OBJECT *FileObject,
2321 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2323 typedef NTSTATUS DDKAPI
2324 (*PFAST_IO_RELEASE_FOR_CCFLUSH) (
2325 /*IN*/ struct _FILE_OBJECT *FileObject,
2326 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2328 typedef struct _FAST_IO_DISPATCH {
2329 ULONG SizeOfFastIoDispatch;
2330 PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
2331 PFAST_IO_READ FastIoRead;
2332 PFAST_IO_WRITE FastIoWrite;
2333 PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
2334 PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
2335 PFAST_IO_LOCK FastIoLock;
2336 PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
2337 PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
2338 PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
2339 PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
2340 PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
2341 PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
2342 PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
2343 PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
2344 PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
2345 PFAST_IO_MDL_READ MdlRead;
2346 PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
2347 PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
2348 PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
2349 PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
2350 PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
2351 PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
2352 PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
2353 PFAST_IO_QUERY_OPEN FastIoQueryOpen;
2354 PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
2355 PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
2356 PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
2357 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
2359 typedef struct _DRIVER_OBJECT {
2360 CSHORT Type;
2361 CSHORT Size;
2362 PDEVICE_OBJECT DeviceObject;
2363 ULONG Flags;
2364 PVOID DriverStart;
2365 ULONG DriverSize;
2366 PVOID DriverSection;
2367 PDRIVER_EXTENSION DriverExtension;
2368 UNICODE_STRING DriverName;
2369 PUNICODE_STRING HardwareDatabase;
2370 PFAST_IO_DISPATCH FastIoDispatch;
2371 PDRIVER_INITIALIZE DriverInit;
2372 PDRIVER_STARTIO DriverStartIo;
2373 PDRIVER_UNLOAD DriverUnload;
2374 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
2375 } DRIVER_OBJECT;
2376 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
2378 typedef struct _SECTION_OBJECT_POINTERS {
2379 PVOID DataSectionObject;
2380 PVOID SharedCacheMap;
2381 PVOID ImageSectionObject;
2382 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
2384 typedef struct _IO_COMPLETION_CONTEXT {
2385 PVOID Port;
2386 PVOID Key;
2387 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
2389 /* FILE_OBJECT.Flags */
2391 #define FO_FILE_OPEN 0x00000001
2392 #define FO_SYNCHRONOUS_IO 0x00000002
2393 #define FO_ALERTABLE_IO 0x00000004
2394 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
2395 #define FO_WRITE_THROUGH 0x00000010
2396 #define FO_SEQUENTIAL_ONLY 0x00000020
2397 #define FO_CACHE_SUPPORTED 0x00000040
2398 #define FO_NAMED_PIPE 0x00000080
2399 #define FO_STREAM_FILE 0x00000100
2400 #define FO_MAILSLOT 0x00000200
2401 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
2402 #define FO_DIRECT_DEVICE_OPEN 0x00000800
2403 #define FO_FILE_MODIFIED 0x00001000
2404 #define FO_FILE_SIZE_CHANGED 0x00002000
2405 #define FO_CLEANUP_COMPLETE 0x00004000
2406 #define FO_TEMPORARY_FILE 0x00008000
2407 #define FO_DELETE_ON_CLOSE 0x00010000
2408 #define FO_OPENED_CASE_SENSITIVE 0x00020000
2409 #define FO_HANDLE_CREATED 0x00040000
2410 #define FO_FILE_FAST_IO_READ 0x00080000
2411 #define FO_RANDOM_ACCESS 0x00100000
2412 #define FO_FILE_OPEN_CANCELLED 0x00200000
2413 #define FO_VOLUME_OPEN 0x00400000
2414 #define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000
2415 #define FO_REMOTE_ORIGIN 0x01000000
2417 typedef struct _FILE_OBJECT {
2418 CSHORT Type;
2419 CSHORT Size;
2420 PDEVICE_OBJECT DeviceObject;
2421 PVPB Vpb;
2422 PVOID FsContext;
2423 PVOID FsContext2;
2424 PSECTION_OBJECT_POINTERS SectionObjectPointer;
2425 PVOID PrivateCacheMap;
2426 NTSTATUS FinalStatus;
2427 struct _FILE_OBJECT *RelatedFileObject;
2428 BOOLEAN LockOperation;
2429 BOOLEAN DeletePending;
2430 BOOLEAN ReadAccess;
2431 BOOLEAN WriteAccess;
2432 BOOLEAN DeleteAccess;
2433 BOOLEAN SharedRead;
2434 BOOLEAN SharedWrite;
2435 BOOLEAN SharedDelete;
2436 ULONG Flags;
2437 UNICODE_STRING FileName;
2438 LARGE_INTEGER CurrentByteOffset;
2439 ULONG Waiters;
2440 ULONG Busy;
2441 PVOID LastLock;
2442 KEVENT Lock;
2443 KEVENT Event;
2444 PIO_COMPLETION_CONTEXT CompletionContext;
2445 } FILE_OBJECT;
2446 typedef struct _FILE_OBJECT *PFILE_OBJECT;
2448 typedef enum _SECURITY_OPERATION_CODE {
2449 SetSecurityDescriptor,
2450 QuerySecurityDescriptor,
2451 DeleteSecurityDescriptor,
2452 AssignSecurityDescriptor
2453 } SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
2455 #define INITIAL_PRIVILEGE_COUNT 3
2457 typedef struct _INITIAL_PRIVILEGE_SET {
2458 ULONG PrivilegeCount;
2459 ULONG Control;
2460 LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
2461 } INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
2463 typedef struct _SECURITY_SUBJECT_CONTEXT {
2464 PACCESS_TOKEN ClientToken;
2465 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2466 PACCESS_TOKEN PrimaryToken;
2467 PVOID ProcessAuditId;
2468 } SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
2470 #include <pshpack4.h>
2471 typedef struct _ACCESS_STATE {
2472 LUID OperationID;
2473 BOOLEAN SecurityEvaluated;
2474 BOOLEAN GenerateAudit;
2475 BOOLEAN GenerateOnClose;
2476 BOOLEAN PrivilegesAllocated;
2477 ULONG Flags;
2478 ACCESS_MASK RemainingDesiredAccess;
2479 ACCESS_MASK PreviouslyGrantedAccess;
2480 ACCESS_MASK OriginalDesiredAccess;
2481 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
2482 PSECURITY_DESCRIPTOR SecurityDescriptor;
2483 PVOID AuxData;
2484 union {
2485 INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
2486 PRIVILEGE_SET PrivilegeSet;
2487 } Privileges;
2489 BOOLEAN AuditPrivileges;
2490 UNICODE_STRING ObjectName;
2491 UNICODE_STRING ObjectTypeName;
2492 } ACCESS_STATE, *PACCESS_STATE;
2493 #include <poppack.h>
2495 typedef struct _IO_SECURITY_CONTEXT {
2496 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
2497 PACCESS_STATE AccessState;
2498 ACCESS_MASK DesiredAccess;
2499 ULONG FullCreateOptions;
2500 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
2502 struct _IO_CSQ;
2504 typedef struct _IO_CSQ_IRP_CONTEXT {
2505 ULONG Type;
2506 struct _IRP *Irp;
2507 struct _IO_CSQ *Csq;
2508 } IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
2510 typedef VOID DDKAPI
2511 (*PIO_CSQ_INSERT_IRP)(
2512 /*IN*/ struct _IO_CSQ *Csq,
2513 /*IN*/ PIRP Irp);
2515 typedef VOID DDKAPI
2516 (*PIO_CSQ_REMOVE_IRP)(
2517 /*IN*/ struct _IO_CSQ *Csq,
2518 /*IN*/ PIRP Irp);
2520 typedef PIRP DDKAPI
2521 (*PIO_CSQ_PEEK_NEXT_IRP)(
2522 /*IN*/ struct _IO_CSQ *Csq,
2523 /*IN*/ PIRP Irp,
2524 /*IN*/ PVOID PeekContext);
2526 typedef VOID DDKAPI
2527 (*PIO_CSQ_ACQUIRE_LOCK)(
2528 /*IN*/ struct _IO_CSQ *Csq,
2529 /*OUT*/ PKIRQL Irql);
2531 typedef VOID DDKAPI
2532 (*PIO_CSQ_RELEASE_LOCK)(
2533 /*IN*/ struct _IO_CSQ *Csq,
2534 /*IN*/ KIRQL Irql);
2536 typedef VOID DDKAPI
2537 (*PIO_CSQ_COMPLETE_CANCELED_IRP)(
2538 /*IN*/ struct _IO_CSQ *Csq,
2539 /*IN*/ PIRP Irp);
2541 typedef struct _IO_CSQ {
2542 ULONG Type;
2543 PIO_CSQ_INSERT_IRP CsqInsertIrp;
2544 PIO_CSQ_REMOVE_IRP CsqRemoveIrp;
2545 PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;
2546 PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock;
2547 PIO_CSQ_RELEASE_LOCK CsqReleaseLock;
2548 PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp;
2549 PVOID ReservePointer;
2550 } IO_CSQ, *PIO_CSQ;
2552 #include <pshpack4.h>
2553 typedef struct _IO_STACK_LOCATION {
2554 UCHAR MajorFunction;
2555 UCHAR MinorFunction;
2556 UCHAR Flags;
2557 UCHAR Control;
2558 union {
2559 struct {
2560 PIO_SECURITY_CONTEXT SecurityContext;
2561 ULONG Options;
2562 USHORT POINTER_ALIGNMENT FileAttributes;
2563 USHORT ShareAccess;
2564 ULONG POINTER_ALIGNMENT EaLength;
2565 } Create;
2566 struct {
2567 ULONG Length;
2568 ULONG POINTER_ALIGNMENT Key;
2569 LARGE_INTEGER ByteOffset;
2570 } Read;
2571 struct {
2572 ULONG Length;
2573 ULONG POINTER_ALIGNMENT Key;
2574 LARGE_INTEGER ByteOffset;
2575 } Write;
2576 struct {
2577 ULONG Length;
2578 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
2579 } QueryFile;
2580 struct {
2581 ULONG Length;
2582 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
2583 PFILE_OBJECT FileObject;
2584 _ANONYMOUS_UNION union {
2585 _ANONYMOUS_STRUCT struct {
2586 BOOLEAN ReplaceIfExists;
2587 BOOLEAN AdvanceOnly;
2588 } DUMMYSTRUCTNAME;
2589 ULONG ClusterCount;
2590 HANDLE DeleteHandle;
2591 } DUMMYUNIONNAME;
2592 } SetFile;
2593 struct {
2594 ULONG Length;
2595 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
2596 } QueryVolume;
2597 struct {
2598 ULONG OutputBufferLength;
2599 ULONG POINTER_ALIGNMENT InputBufferLength;
2600 ULONG POINTER_ALIGNMENT IoControlCode;
2601 PVOID Type3InputBuffer;
2602 } DeviceIoControl;
2603 struct {
2604 SECURITY_INFORMATION SecurityInformation;
2605 ULONG POINTER_ALIGNMENT Length;
2606 } QuerySecurity;
2607 struct {
2608 SECURITY_INFORMATION SecurityInformation;
2609 PSECURITY_DESCRIPTOR SecurityDescriptor;
2610 } SetSecurity;
2611 struct {
2612 PVPB Vpb;
2613 PDEVICE_OBJECT DeviceObject;
2614 } MountVolume;
2615 struct {
2616 PVPB Vpb;
2617 PDEVICE_OBJECT DeviceObject;
2618 } VerifyVolume;
2619 struct {
2620 struct _SCSI_REQUEST_BLOCK *Srb;
2621 } Scsi;
2622 struct {
2623 DEVICE_RELATION_TYPE Type;
2624 } QueryDeviceRelations;
2625 struct {
2626 CONST GUID *InterfaceType;
2627 USHORT Size;
2628 USHORT Version;
2629 PINTERFACE Interface;
2630 PVOID InterfaceSpecificData;
2631 } QueryInterface;
2632 struct {
2633 PDEVICE_CAPABILITIES Capabilities;
2634 } DeviceCapabilities;
2635 struct {
2636 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
2637 } FilterResourceRequirements;
2638 struct {
2639 ULONG WhichSpace;
2640 PVOID Buffer;
2641 ULONG Offset;
2642 ULONG POINTER_ALIGNMENT Length;
2643 } ReadWriteConfig;
2644 struct {
2645 BOOLEAN Lock;
2646 } SetLock;
2647 struct {
2648 BUS_QUERY_ID_TYPE IdType;
2649 } QueryId;
2650 struct {
2651 DEVICE_TEXT_TYPE DeviceTextType;
2652 LCID POINTER_ALIGNMENT LocaleId;
2653 } QueryDeviceText;
2654 struct {
2655 BOOLEAN InPath;
2656 BOOLEAN Reserved[3];
2657 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
2658 } UsageNotification;
2659 struct {
2660 SYSTEM_POWER_STATE PowerState;
2661 } WaitWake;
2662 struct {
2663 PPOWER_SEQUENCE PowerSequence;
2664 } PowerSequence;
2665 struct {
2666 ULONG SystemContext;
2667 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
2668 POWER_STATE POINTER_ALIGNMENT State;
2669 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
2670 } Power;
2671 struct {
2672 PCM_RESOURCE_LIST AllocatedResources;
2673 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
2674 } StartDevice;
2675 struct {
2676 ULONG_PTR ProviderId;
2677 PVOID DataPath;
2678 ULONG BufferSize;
2679 PVOID Buffer;
2680 } WMI;
2681 struct {
2682 PVOID Argument1;
2683 PVOID Argument2;
2684 PVOID Argument3;
2685 PVOID Argument4;
2686 } Others;
2687 } Parameters;
2688 PDEVICE_OBJECT DeviceObject;
2689 PFILE_OBJECT FileObject;
2690 PIO_COMPLETION_ROUTINE CompletionRoutine;
2691 PVOID Context;
2692 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
2693 #include <poppack.h>
2695 /* IO_STACK_LOCATION.Control */
2697 #define SL_PENDING_RETURNED 0x01
2698 #define SL_INVOKE_ON_CANCEL 0x20
2699 #define SL_INVOKE_ON_SUCCESS 0x40
2700 #define SL_INVOKE_ON_ERROR 0x80
2702 typedef enum _KEY_INFORMATION_CLASS {
2703 KeyBasicInformation,
2704 KeyNodeInformation,
2705 KeyFullInformation,
2706 KeyNameInformation,
2707 KeyCachedInformation,
2708 KeyFlagsInformation
2709 } KEY_INFORMATION_CLASS;
2711 typedef struct _KEY_BASIC_INFORMATION {
2712 LARGE_INTEGER LastWriteTime;
2713 ULONG TitleIndex;
2714 ULONG NameLength;
2715 WCHAR Name[1];
2716 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
2718 typedef struct _KEY_FULL_INFORMATION {
2719 LARGE_INTEGER LastWriteTime;
2720 ULONG TitleIndex;
2721 ULONG ClassOffset;
2722 ULONG ClassLength;
2723 ULONG SubKeys;
2724 ULONG MaxNameLen;
2725 ULONG MaxClassLen;
2726 ULONG Values;
2727 ULONG MaxValueNameLen;
2728 ULONG MaxValueDataLen;
2729 WCHAR Class[1];
2730 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
2732 typedef struct _KEY_NODE_INFORMATION {
2733 LARGE_INTEGER LastWriteTime;
2734 ULONG TitleIndex;
2735 ULONG ClassOffset;
2736 ULONG ClassLength;
2737 ULONG NameLength;
2738 WCHAR Name[1];
2739 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
2741 typedef struct _KEY_VALUE_BASIC_INFORMATION {
2742 ULONG TitleIndex;
2743 ULONG Type;
2744 ULONG NameLength;
2745 WCHAR Name[1];
2746 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
2748 typedef struct _KEY_VALUE_FULL_INFORMATION {
2749 ULONG TitleIndex;
2750 ULONG Type;
2751 ULONG DataOffset;
2752 ULONG DataLength;
2753 ULONG NameLength;
2754 WCHAR Name[1];
2755 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
2757 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
2758 ULONG TitleIndex;
2759 ULONG Type;
2760 ULONG DataLength;
2761 UCHAR Data[1];
2762 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
2764 typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
2765 ULONG Type;
2766 ULONG DataLength;
2767 UCHAR Data[1];
2768 } KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
2770 typedef struct _KEY_VALUE_ENTRY {
2771 PUNICODE_STRING ValueName;
2772 ULONG DataLength;
2773 ULONG DataOffset;
2774 ULONG Type;
2775 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
2777 typedef enum _KEY_VALUE_INFORMATION_CLASS {
2778 KeyValueBasicInformation,
2779 KeyValueFullInformation,
2780 KeyValuePartialInformation,
2781 KeyValueFullInformationAlign64,
2782 KeyValuePartialInformationAlign64
2783 } KEY_VALUE_INFORMATION_CLASS;
2785 /* KEY_VALUE_Xxx.Type */
2787 #define REG_NONE 0
2788 #define REG_SZ 1
2789 #define REG_EXPAND_SZ 2
2790 #define REG_BINARY 3
2791 #define REG_DWORD 4
2792 #define REG_DWORD_LITTLE_ENDIAN 4
2793 #define REG_DWORD_BIG_ENDIAN 5
2794 #define REG_LINK 6
2795 #define REG_MULTI_SZ 7
2796 #define REG_RESOURCE_LIST 8
2797 #define REG_FULL_RESOURCE_DESCRIPTOR 9
2798 #define REG_RESOURCE_REQUIREMENTS_LIST 10
2799 #define REG_QWORD 11
2800 #define REG_QWORD_LITTLE_ENDIAN 11
2802 #define PCI_TYPE0_ADDRESSES 6
2803 #define PCI_TYPE1_ADDRESSES 2
2804 #define PCI_TYPE2_ADDRESSES 5
2806 typedef struct _PCI_COMMON_CONFIG {
2807 USHORT VendorID;
2808 USHORT DeviceID;
2809 USHORT Command;
2810 USHORT Status;
2811 UCHAR RevisionID;
2812 UCHAR ProgIf;
2813 UCHAR SubClass;
2814 UCHAR BaseClass;
2815 UCHAR CacheLineSize;
2816 UCHAR LatencyTimer;
2817 UCHAR HeaderType;
2818 UCHAR BIST;
2819 union {
2820 struct _PCI_HEADER_TYPE_0 {
2821 ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
2822 ULONG CIS;
2823 USHORT SubVendorID;
2824 USHORT SubSystemID;
2825 ULONG ROMBaseAddress;
2826 UCHAR CapabilitiesPtr;
2827 UCHAR Reserved1[3];
2828 ULONG Reserved2;
2829 UCHAR InterruptLine;
2830 UCHAR InterruptPin;
2831 UCHAR MinimumGrant;
2832 UCHAR MaximumLatency;
2833 } type0;
2834 struct _PCI_HEADER_TYPE_1 {
2835 ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
2836 UCHAR PrimaryBus;
2837 UCHAR SecondaryBus;
2838 UCHAR SubordinateBus;
2839 UCHAR SecondaryLatency;
2840 UCHAR IOBase;
2841 UCHAR IOLimit;
2842 USHORT SecondaryStatus;
2843 USHORT MemoryBase;
2844 USHORT MemoryLimit;
2845 USHORT PrefetchBase;
2846 USHORT PrefetchLimit;
2847 ULONG PrefetchBaseUpper32;
2848 ULONG PrefetchLimitUpper32;
2849 USHORT IOBaseUpper16;
2850 USHORT IOLimitUpper16;
2851 UCHAR CapabilitiesPtr;
2852 UCHAR Reserved1[3];
2853 ULONG ROMBaseAddress;
2854 UCHAR InterruptLine;
2855 UCHAR InterruptPin;
2856 USHORT BridgeControl;
2857 } type1;
2858 struct _PCI_HEADER_TYPE_2 {
2859 ULONG SocketRegistersBaseAddress;
2860 UCHAR CapabilitiesPtr;
2861 UCHAR Reserved;
2862 USHORT SecondaryStatus;
2863 UCHAR PrimaryBus;
2864 UCHAR SecondaryBus;
2865 UCHAR SubordinateBus;
2866 UCHAR SecondaryLatency;
2867 struct {
2868 ULONG Base;
2869 ULONG Limit;
2870 } Range[PCI_TYPE2_ADDRESSES - 1];
2871 UCHAR InterruptLine;
2872 UCHAR InterruptPin;
2873 USHORT BridgeControl;
2874 } type2;
2875 } u;
2876 UCHAR DeviceSpecific[192];
2877 } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
2879 /* PCI_COMMON_CONFIG.Command */
2881 #define PCI_ENABLE_IO_SPACE 0x0001
2882 #define PCI_ENABLE_MEMORY_SPACE 0x0002
2883 #define PCI_ENABLE_BUS_MASTER 0x0004
2884 #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
2885 #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
2886 #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
2887 #define PCI_ENABLE_PARITY 0x0040
2888 #define PCI_ENABLE_WAIT_CYCLE 0x0080
2889 #define PCI_ENABLE_SERR 0x0100
2890 #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
2892 /* PCI_COMMON_CONFIG.Status */
2894 #define PCI_STATUS_CAPABILITIES_LIST 0x0010
2895 #define PCI_STATUS_66MHZ_CAPABLE 0x0020
2896 #define PCI_STATUS_UDF_SUPPORTED 0x0040
2897 #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
2898 #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
2899 #define PCI_STATUS_DEVSEL 0x0600
2900 #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
2901 #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
2902 #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
2903 #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
2904 #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
2906 /* PCI_COMMON_CONFIG.HeaderType */
2908 #define PCI_MULTIFUNCTION 0x80
2909 #define PCI_DEVICE_TYPE 0x00
2910 #define PCI_BRIDGE_TYPE 0x01
2911 #define PCI_CARDBUS_BRIDGE_TYPE 0x02
2913 #define PCI_CONFIGURATION_TYPE(PciData) \
2914 (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
2916 #define PCI_MULTIFUNCTION_DEVICE(PciData) \
2917 ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
2919 typedef struct _PCI_SLOT_NUMBER {
2920 union {
2921 struct {
2922 ULONG DeviceNumber : 5;
2923 ULONG FunctionNumber : 3;
2924 ULONG Reserved : 24;
2925 } bits;
2926 ULONG AsULONG;
2927 } u;
2928 } PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
2930 typedef enum _POOL_TYPE {
2931 NonPagedPool,
2932 PagedPool,
2933 NonPagedPoolMustSucceed,
2934 DontUseThisType,
2935 NonPagedPoolCacheAligned,
2936 PagedPoolCacheAligned,
2937 NonPagedPoolCacheAlignedMustS,
2938 MaxPoolType,
2939 NonPagedPoolSession = 32,
2940 PagedPoolSession,
2941 NonPagedPoolMustSucceedSession,
2942 DontUseThisTypeSession,
2943 NonPagedPoolCacheAlignedSession,
2944 PagedPoolCacheAlignedSession,
2945 NonPagedPoolCacheAlignedMustSSession
2946 } POOL_TYPE;
2948 typedef enum _EX_POOL_PRIORITY {
2949 LowPoolPriority,
2950 LowPoolPrioritySpecialPoolOverrun = 8,
2951 LowPoolPrioritySpecialPoolUnderrun = 9,
2952 NormalPoolPriority = 16,
2953 NormalPoolPrioritySpecialPoolOverrun = 24,
2954 NormalPoolPrioritySpecialPoolUnderrun = 25,
2955 HighPoolPriority = 32,
2956 HighPoolPrioritySpecialPoolOverrun = 40,
2957 HighPoolPrioritySpecialPoolUnderrun = 41
2958 } EX_POOL_PRIORITY;
2960 /* PRIVILEGE_SET.Control */
2962 #define PRIVILEGE_SET_ALL_NECESSARY 1
2964 typedef struct _RTL_OSVERSIONINFOW {
2965 ULONG dwOSVersionInfoSize;
2966 ULONG dwMajorVersion;
2967 ULONG dwMinorVersion;
2968 ULONG dwBuildNumber;
2969 ULONG dwPlatformId;
2970 WCHAR szCSDVersion[128];
2971 } RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
2973 typedef struct _RTL_OSVERSIONINFOEXW {
2974 ULONG dwOSVersionInfoSize;
2975 ULONG dwMajorVersion;
2976 ULONG dwMinorVersion;
2977 ULONG dwBuildNumber;
2978 ULONG dwPlatformId;
2979 WCHAR szCSDVersion[128];
2980 USHORT wServicePackMajor;
2981 USHORT wServicePackMinor;
2982 USHORT wSuiteMask;
2983 UCHAR wProductType;
2984 UCHAR wReserved;
2985 } RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
2987 NTOSAPI
2988 ULONGLONG
2989 DDKAPI
2990 VerSetConditionMask(
2991 /*IN*/ ULONGLONG ConditionMask,
2992 /*IN*/ ULONG TypeMask,
2993 /*IN*/ UCHAR Condition);
2995 #define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \
2996 ((ConditionMask) = VerSetConditionMask((ConditionMask), \
2997 (TypeBitMask), (ComparisonType)))
2999 /* RtlVerifyVersionInfo() TypeMask */
3001 #define VER_MINORVERSION 0x0000001
3002 #define VER_MAJORVERSION 0x0000002
3003 #define VER_BUILDNUMBER 0x0000004
3004 #define VER_PLATFORMID 0x0000008
3005 #define VER_SERVICEPACKMINOR 0x0000010
3006 #define VER_SERVICEPACKMAJOR 0x0000020
3007 #define VER_SUITENAME 0x0000040
3008 #define VER_PRODUCT_TYPE 0x0000080
3010 /* RtlVerifyVersionInfo() ComparisonType */
3012 #define VER_EQUAL 1
3013 #define VER_GREATER 2
3014 #define VER_GREATER_EQUAL 3
3015 #define VER_LESS 4
3016 #define VER_LESS_EQUAL 5
3017 #define VER_AND 6
3018 #define VER_OR 7
3020 #define VER_CONDITION_MASK 7
3021 #define VER_NUM_BITS_PER_CONDITION_MASK 3
3023 typedef struct _RTL_BITMAP {
3024 ULONG SizeOfBitMap;
3025 PULONG Buffer;
3026 } RTL_BITMAP, *PRTL_BITMAP;
3028 typedef struct _RTL_BITMAP_RUN {
3029 ULONG StartingIndex;
3030 ULONG NumberOfBits;
3031 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
3033 typedef NTSTATUS DDKAPI
3034 (*PRTL_QUERY_REGISTRY_ROUTINE)(
3035 /*IN*/ PWSTR ValueName,
3036 /*IN*/ ULONG ValueType,
3037 /*IN*/ PVOID ValueData,
3038 /*IN*/ ULONG ValueLength,
3039 /*IN*/ PVOID Context,
3040 /*IN*/ PVOID EntryContext);
3042 #define RTL_REGISTRY_ABSOLUTE 0
3043 #define RTL_REGISTRY_SERVICES 1
3044 #define RTL_REGISTRY_CONTROL 2
3045 #define RTL_REGISTRY_WINDOWS_NT 3
3046 #define RTL_REGISTRY_DEVICEMAP 4
3047 #define RTL_REGISTRY_USER 5
3049 /* RTL_QUERY_REGISTRY_TABLE.Flags */
3050 #define RTL_QUERY_REGISTRY_SUBKEY 0x00000001
3051 #define RTL_QUERY_REGISTRY_TOPKEY 0x00000002
3052 #define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
3053 #define RTL_QUERY_REGISTRY_NOVALUE 0x00000008
3054 #define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
3055 #define RTL_QUERY_REGISTRY_DIRECT 0x00000020
3056 #define RTL_QUERY_REGISTRY_DELETE 0x00000040
3058 typedef struct _RTL_QUERY_REGISTRY_TABLE {
3059 PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
3060 ULONG Flags;
3061 PWSTR Name;
3062 PVOID EntryContext;
3063 ULONG DefaultType;
3064 PVOID DefaultData;
3065 ULONG DefaultLength;
3066 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
3068 typedef struct _TIME_FIELDS {
3069 CSHORT Year;
3070 CSHORT Month;
3071 CSHORT Day;
3072 CSHORT Hour;
3073 CSHORT Minute;
3074 CSHORT Second;
3075 CSHORT Milliseconds;
3076 CSHORT Weekday;
3077 } TIME_FIELDS, *PTIME_FIELDS;
3079 typedef PVOID DDKAPI
3080 (*PALLOCATE_FUNCTION)(
3081 /*IN*/ POOL_TYPE PoolType,
3082 /*IN*/ SIZE_T NumberOfBytes,
3083 /*IN*/ ULONG Tag);
3085 typedef VOID DDKAPI
3086 (*PFREE_FUNCTION)(
3087 /*IN*/ PVOID Buffer);
3089 #define GENERAL_LOOKASIDE_S \
3090 SLIST_HEADER ListHead; \
3091 USHORT Depth; \
3092 USHORT MaximumDepth; \
3093 ULONG TotalAllocates; \
3094 _ANONYMOUS_UNION union { \
3095 ULONG AllocateMisses; \
3096 ULONG AllocateHits; \
3097 } DUMMYUNIONNAME; \
3098 ULONG TotalFrees; \
3099 _ANONYMOUS_UNION union { \
3100 ULONG FreeMisses; \
3101 ULONG FreeHits; \
3102 } DUMMYUNIONNAME2; \
3103 POOL_TYPE Type; \
3104 ULONG Tag; \
3105 ULONG Size; \
3106 PALLOCATE_FUNCTION Allocate; \
3107 PFREE_FUNCTION Free; \
3108 LIST_ENTRY ListEntry; \
3109 ULONG LastTotalAllocates; \
3110 _ANONYMOUS_UNION union { \
3111 ULONG LastAllocateMisses; \
3112 ULONG LastAllocateHits; \
3113 } DUMMYUNIONNAME3; \
3114 ULONG Future[2];
3116 typedef struct _GENERAL_LOOKASIDE {
3117 GENERAL_LOOKASIDE_S
3118 } GENERAL_LOOKASIDE, *PGENERAL_LOOKASIDE;
3120 typedef struct _NPAGED_LOOKASIDE_LIST {
3121 GENERAL_LOOKASIDE_S
3122 KSPIN_LOCK Obsoleted;
3123 } NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
3125 typedef struct _PAGED_LOOKASIDE_LIST {
3126 GENERAL_LOOKASIDE_S
3127 FAST_MUTEX Obsoleted;
3128 } PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
3130 typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
3132 typedef VOID DDKAPI (*PCALLBACK_FUNCTION)(
3133 /*IN*/ PVOID CallbackContext,
3134 /*IN*/ PVOID Argument1,
3135 /*IN*/ PVOID Argument2);
3137 typedef enum _EVENT_TYPE {
3138 NotificationEvent,
3139 SynchronizationEvent
3140 } EVENT_TYPE;
3142 typedef enum _KWAIT_REASON {
3143 Executive,
3144 FreePage,
3145 PageIn,
3146 PoolAllocation,
3147 DelayExecution,
3148 Suspended,
3149 UserRequest,
3150 WrExecutive,
3151 WrFreePage,
3152 WrPageIn,
3153 WrPoolAllocation,
3154 WrDelayExecution,
3155 WrSuspended,
3156 WrUserRequest,
3157 WrEventPair,
3158 WrQueue,
3159 WrLpcReceive,
3160 WrLpcReply,
3161 WrVirtualMemory,
3162 WrPageOut,
3163 WrRendezvous,
3164 Spare2,
3165 Spare3,
3166 Spare4,
3167 Spare5,
3168 Spare6,
3169 WrKernel,
3170 MaximumWaitReason
3171 } KWAIT_REASON;
3173 typedef struct _KWAIT_BLOCK {
3174 LIST_ENTRY WaitListEntry;
3175 struct _KTHREAD * RESTRICTED_POINTER Thread;
3176 PVOID Object;
3177 struct _KWAIT_BLOCK * RESTRICTED_POINTER NextWaitBlock;
3178 USHORT WaitKey;
3179 USHORT WaitType;
3180 } KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
3182 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
3184 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
3185 BOOLEAN Removed;
3186 BOOLEAN Reserved[3];
3187 LONG IoCount;
3188 KEVENT RemoveEvent;
3189 } IO_REMOVE_LOCK_COMMON_BLOCK;
3191 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
3192 LONG Signature;
3193 LONG HighWatermark;
3194 LONGLONG MaxLockedTicks;
3195 LONG AllocateTag;
3196 LIST_ENTRY LockList;
3197 KSPIN_LOCK Spin;
3198 LONG LowMemoryCount;
3199 ULONG Reserved1[4];
3200 PVOID Reserved2;
3201 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
3202 } IO_REMOVE_LOCK_DBG_BLOCK;
3204 typedef struct _IO_REMOVE_LOCK {
3205 IO_REMOVE_LOCK_COMMON_BLOCK Common;
3206 #ifdef DBG
3207 IO_REMOVE_LOCK_DBG_BLOCK Dbg;
3208 #endif
3209 } IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
3211 typedef struct _IO_WORKITEM *PIO_WORKITEM;
3213 typedef VOID DDKAPI
3214 (*PIO_WORKITEM_ROUTINE)(
3215 /*IN*/ PDEVICE_OBJECT DeviceObject,
3216 /*IN*/ PVOID Context);
3218 typedef struct _SHARE_ACCESS {
3219 ULONG OpenCount;
3220 ULONG Readers;
3221 ULONG Writers;
3222 ULONG Deleters;
3223 ULONG SharedRead;
3224 ULONG SharedWrite;
3225 ULONG SharedDelete;
3226 } SHARE_ACCESS, *PSHARE_ACCESS;
3228 typedef enum _KINTERRUPT_MODE {
3229 LevelSensitive,
3230 Latched
3231 } KINTERRUPT_MODE;
3233 typedef VOID DDKAPI
3234 (*PKINTERRUPT_ROUTINE)(
3235 VOID);
3237 typedef enum _KPROFILE_SOURCE {
3238 ProfileTime,
3239 ProfileAlignmentFixup,
3240 ProfileTotalIssues,
3241 ProfilePipelineDry,
3242 ProfileLoadInstructions,
3243 ProfilePipelineFrozen,
3244 ProfileBranchInstructions,
3245 ProfileTotalNonissues,
3246 ProfileDcacheMisses,
3247 ProfileIcacheMisses,
3248 ProfileCacheMisses,
3249 ProfileBranchMispredictions,
3250 ProfileStoreInstructions,
3251 ProfileFpInstructions,
3252 ProfileIntegerInstructions,
3253 Profile2Issue,
3254 Profile3Issue,
3255 Profile4Issue,
3256 ProfileSpecialInstructions,
3257 ProfileTotalCycles,
3258 ProfileIcacheIssues,
3259 ProfileDcacheAccesses,
3260 ProfileMemoryBarrierCycles,
3261 ProfileLoadLinkedIssues,
3262 ProfileMaximum
3263 } KPROFILE_SOURCE;
3265 typedef enum _CREATE_FILE_TYPE {
3266 CreateFileTypeNone,
3267 CreateFileTypeNamedPipe,
3268 CreateFileTypeMailslot
3269 } CREATE_FILE_TYPE;
3271 typedef struct _CONFIGURATION_INFORMATION {
3272 ULONG DiskCount;
3273 ULONG FloppyCount;
3274 ULONG CdRomCount;
3275 ULONG TapeCount;
3276 ULONG ScsiPortCount;
3277 ULONG SerialCount;
3278 ULONG ParallelCount;
3279 BOOLEAN AtDiskPrimaryAddressClaimed;
3280 BOOLEAN AtDiskSecondaryAddressClaimed;
3281 ULONG Version;
3282 ULONG MediumChangerCount;
3283 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
3285 typedef enum _CONFIGURATION_TYPE {
3286 ArcSystem,
3287 CentralProcessor,
3288 FloatingPointProcessor,
3289 PrimaryIcache,
3290 PrimaryDcache,
3291 SecondaryIcache,
3292 SecondaryDcache,
3293 SecondaryCache,
3294 EisaAdapter,
3295 TcAdapter,
3296 ScsiAdapter,
3297 DtiAdapter,
3298 MultiFunctionAdapter,
3299 DiskController,
3300 TapeController,
3301 CdromController,
3302 WormController,
3303 SerialController,
3304 NetworkController,
3305 DisplayController,
3306 ParallelController,
3307 PointerController,
3308 KeyboardController,
3309 AudioController,
3310 OtherController,
3311 DiskPeripheral,
3312 FloppyDiskPeripheral,
3313 TapePeripheral,
3314 ModemPeripheral,
3315 MonitorPeripheral,
3316 PrinterPeripheral,
3317 PointerPeripheral,
3318 KeyboardPeripheral,
3319 TerminalPeripheral,
3320 OtherPeripheral,
3321 LinePeripheral,
3322 NetworkPeripheral,
3323 SystemMemory,
3324 DockingInformation,
3325 RealModeIrqRoutingTable,
3326 MaximumType
3327 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
3329 typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(
3330 /*IN*/ PVOID Context,
3331 /*IN*/ PUNICODE_STRING PathName,
3332 /*IN*/ INTERFACE_TYPE BusType,
3333 /*IN*/ ULONG BusNumber,
3334 /*IN*/ PKEY_VALUE_FULL_INFORMATION *BusInformation,
3335 /*IN*/ CONFIGURATION_TYPE ControllerType,
3336 /*IN*/ ULONG ControllerNumber,
3337 /*IN*/ PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
3338 /*IN*/ CONFIGURATION_TYPE PeripheralType,
3339 /*IN*/ ULONG PeripheralNumber,
3340 /*IN*/ PKEY_VALUE_FULL_INFORMATION *PeripheralInformation);
3342 typedef enum _WORK_QUEUE_TYPE {
3343 CriticalWorkQueue,
3344 DelayedWorkQueue,
3345 HyperCriticalWorkQueue,
3346 MaximumWorkQueue
3347 } WORK_QUEUE_TYPE;
3349 typedef VOID DDKAPI
3350 (*PWORKER_THREAD_ROUTINE)(
3351 /*IN*/ PVOID Parameter);
3353 typedef struct _WORK_QUEUE_ITEM {
3354 LIST_ENTRY List;
3355 PWORKER_THREAD_ROUTINE WorkerRoutine;
3356 PVOID Parameter;
3357 } WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
3359 typedef enum _KBUGCHECK_BUFFER_DUMP_STATE {
3360 BufferEmpty,
3361 BufferInserted,
3362 BufferStarted,
3363 BufferFinished,
3364 BufferIncomplete
3365 } KBUGCHECK_BUFFER_DUMP_STATE;
3367 typedef VOID DDKAPI
3368 (*PKBUGCHECK_CALLBACK_ROUTINE)(
3369 /*IN*/ PVOID Buffer,
3370 /*IN*/ ULONG Length);
3372 typedef struct _KBUGCHECK_CALLBACK_RECORD {
3373 LIST_ENTRY Entry;
3374 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
3375 PVOID Buffer;
3376 ULONG Length;
3377 PUCHAR Component;
3378 ULONG_PTR Checksum;
3379 UCHAR State;
3380 } KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
3383 * VOID
3384 * KeInitializeCallbackRecord(
3385 * IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
3387 #define KeInitializeCallbackRecord(CallbackRecord) \
3388 CallbackRecord->State = BufferEmpty;
3390 typedef enum _KDPC_IMPORTANCE {
3391 LowImportance,
3392 MediumImportance,
3393 HighImportance
3394 } KDPC_IMPORTANCE;
3396 typedef enum _MEMORY_CACHING_TYPE_ORIG {
3397 MmFrameBufferCached = 2
3398 } MEMORY_CACHING_TYPE_ORIG;
3400 typedef enum _MEMORY_CACHING_TYPE {
3401 MmNonCached = FALSE,
3402 MmCached = TRUE,
3403 MmWriteCombined = MmFrameBufferCached,
3404 MmHardwareCoherentCached,
3405 MmNonCachedUnordered,
3406 MmUSWCCached,
3407 MmMaximumCacheType
3408 } MEMORY_CACHING_TYPE;
3410 typedef enum _MM_PAGE_PRIORITY {
3411 LowPagePriority,
3412 NormalPagePriority = 16,
3413 HighPagePriority = 32
3414 } MM_PAGE_PRIORITY;
3416 typedef enum _LOCK_OPERATION {
3417 IoReadAccess,
3418 IoWriteAccess,
3419 IoModifyAccess
3420 } LOCK_OPERATION;
3422 typedef enum _MM_SYSTEM_SIZE {
3423 MmSmallSystem,
3424 MmMediumSystem,
3425 MmLargeSystem
3426 } MM_SYSTEM_SIZE;
3428 typedef struct _OBJECT_HANDLE_INFORMATION {
3429 ULONG HandleAttributes;
3430 ACCESS_MASK GrantedAccess;
3431 } OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
3433 typedef struct _CLIENT_ID {
3434 HANDLE UniqueProcess;
3435 HANDLE UniqueThread;
3436 } CLIENT_ID, *PCLIENT_ID;
3438 typedef VOID DDKAPI
3439 (*PKSTART_ROUTINE)(
3440 /*IN*/ PVOID StartContext);
3442 typedef VOID DDKAPI
3443 (*PCREATE_PROCESS_NOTIFY_ROUTINE)(
3444 /*IN*/ HANDLE ParentId,
3445 /*IN*/ HANDLE ProcessId,
3446 /*IN*/ BOOLEAN Create);
3448 typedef VOID DDKAPI
3449 (*PCREATE_THREAD_NOTIFY_ROUTINE)(
3450 /*IN*/ HANDLE ProcessId,
3451 /*IN*/ HANDLE ThreadId,
3452 /*IN*/ BOOLEAN Create);
3454 typedef struct _IMAGE_INFO {
3455 _ANONYMOUS_UNION union {
3456 ULONG Properties;
3457 _ANONYMOUS_STRUCT struct {
3458 ULONG ImageAddressingMode : 8;
3459 ULONG SystemModeImage : 1;
3460 ULONG ImageMappedToAllPids : 1;
3461 ULONG Reserved : 22;
3462 } DUMMYSTRUCTNAME;
3463 } DUMMYUNIONNAME;
3464 PVOID ImageBase;
3465 ULONG ImageSelector;
3466 SIZE_T ImageSize;
3467 ULONG ImageSectionNumber;
3468 } IMAGE_INFO, *PIMAGE_INFO;
3470 #define IMAGE_ADDRESSING_MODE_32BIT 3
3472 typedef VOID DDKAPI
3473 (*PLOAD_IMAGE_NOTIFY_ROUTINE)(
3474 /*IN*/ PUNICODE_STRING FullImageName,
3475 /*IN*/ HANDLE ProcessId,
3476 /*IN*/ PIMAGE_INFO ImageInfo);
3478 typedef enum _PROCESSINFOCLASS {
3479 ProcessBasicInformation,
3480 ProcessQuotaLimits,
3481 ProcessIoCounters,
3482 ProcessVmCounters,
3483 ProcessTimes,
3484 ProcessBasePriority,
3485 ProcessRaisePriority,
3486 ProcessDebugPort,
3487 ProcessExceptionPort,
3488 ProcessAccessToken,
3489 ProcessLdtInformation,
3490 ProcessLdtSize,
3491 ProcessDefaultHardErrorMode,
3492 ProcessIoPortHandlers,
3493 ProcessPooledUsageAndLimits,
3494 ProcessWorkingSetWatch,
3495 ProcessUserModeIOPL,
3496 ProcessEnableAlignmentFaultFixup,
3497 ProcessPriorityClass,
3498 ProcessWx86Information,
3499 ProcessHandleCount,
3500 ProcessAffinityMask,
3501 ProcessPriorityBoost,
3502 ProcessDeviceMap,
3503 ProcessSessionInformation,
3504 ProcessForegroundInformation,
3505 ProcessWow64Information,
3506 ProcessImageFileName,
3507 ProcessLUIDDeviceMapsEnabled,
3508 ProcessBreakOnTermination,
3509 ProcessDebugObjectHandle,
3510 ProcessDebugFlags,
3511 ProcessHandleTracing,
3512 MaxProcessInfoClass
3513 } PROCESSINFOCLASS;
3515 typedef enum _THREADINFOCLASS {
3516 ThreadBasicInformation,
3517 ThreadTimes,
3518 ThreadPriority,
3519 ThreadBasePriority,
3520 ThreadAffinityMask,
3521 ThreadImpersonationToken,
3522 ThreadDescriptorTableEntry,
3523 ThreadEnableAlignmentFaultFixup,
3524 ThreadEventPair_Reusable,
3525 ThreadQuerySetWin32StartAddress,
3526 ThreadZeroTlsCell,
3527 ThreadPerformanceCount,
3528 ThreadAmILastThread,
3529 ThreadIdealProcessor,
3530 ThreadPriorityBoost,
3531 ThreadSetTlsArrayAddress,
3532 ThreadIsIoPending,
3533 ThreadHideFromDebugger,
3534 ThreadBreakOnTermination,
3535 MaxThreadInfoClass
3536 } THREADINFOCLASS;
3538 #define ES_SYSTEM_REQUIRED 0x00000001
3539 #define ES_DISPLAY_REQUIRED 0x00000002
3540 #define ES_USER_PRESENT 0x00000004
3541 #define ES_CONTINUOUS 0x80000000
3543 typedef ULONG EXECUTION_STATE;
3545 typedef VOID DDKAPI
3546 (*PREQUEST_POWER_COMPLETE)(
3547 /*IN*/ PDEVICE_OBJECT DeviceObject,
3548 /*IN*/ UCHAR MinorFunction,
3549 /*IN*/ POWER_STATE PowerState,
3550 /*IN*/ PVOID Context,
3551 /*IN*/ PIO_STATUS_BLOCK IoStatus);
3553 typedef enum _TRACE_INFORMATION_CLASS {
3554 TraceIdClass,
3555 TraceHandleClass,
3556 TraceEnableFlagsClass,
3557 TraceEnableLevelClass,
3558 GlobalLoggerHandleClass,
3559 EventLoggerHandleClass,
3560 AllLoggerHandlesClass,
3561 TraceHandleByNameClass
3562 } TRACE_INFORMATION_CLASS;
3564 typedef NTSTATUS DDKAPI
3565 (*PEX_CALLBACK_FUNCTION)(
3566 /*IN*/ PVOID CallbackContext,
3567 /*IN*/ PVOID Argument1,
3568 /*IN*/ PVOID Argument2);
3573 ** Storage structures
3575 typedef enum _PARTITION_STYLE {
3576 PARTITION_STYLE_MBR,
3577 PARTITION_STYLE_GPT
3578 } PARTITION_STYLE;
3580 typedef struct _CREATE_DISK_MBR {
3581 ULONG Signature;
3582 } CREATE_DISK_MBR, *PCREATE_DISK_MBR;
3584 typedef struct _CREATE_DISK_GPT {
3585 GUID DiskId;
3586 ULONG MaxPartitionCount;
3587 } CREATE_DISK_GPT, *PCREATE_DISK_GPT;
3589 typedef struct _CREATE_DISK {
3590 PARTITION_STYLE PartitionStyle;
3591 _ANONYMOUS_UNION union {
3592 CREATE_DISK_MBR Mbr;
3593 CREATE_DISK_GPT Gpt;
3594 } DUMMYUNIONNAME;
3595 } CREATE_DISK, *PCREATE_DISK;
3597 typedef struct _DISK_SIGNATURE {
3598 ULONG PartitionStyle;
3599 _ANONYMOUS_UNION union {
3600 struct {
3601 ULONG Signature;
3602 ULONG CheckSum;
3603 } Mbr;
3604 struct {
3605 GUID DiskId;
3606 } Gpt;
3607 } DUMMYUNIONNAME;
3608 } DISK_SIGNATURE, *PDISK_SIGNATURE;
3610 typedef VOID DDKFASTAPI
3611 (*PTIME_UPDATE_NOTIFY_ROUTINE)(
3612 /*IN*/ HANDLE ThreadId,
3613 /*IN*/ KPROCESSOR_MODE Mode);
3615 #define DBG_STATUS_CONTROL_C 1
3616 #define DBG_STATUS_SYSRQ 2
3617 #define DBG_STATUS_BUGCHECK_FIRST 3
3618 #define DBG_STATUS_BUGCHECK_SECOND 4
3619 #define DBG_STATUS_FATAL 5
3620 #define DBG_STATUS_DEBUG_CONTROL 6
3621 #define DBG_STATUS_WORKER 7
3623 typedef struct _PHYSICAL_MEMORY_RANGE {
3624 PHYSICAL_ADDRESS BaseAddress;
3625 LARGE_INTEGER NumberOfBytes;
3626 } PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
3628 typedef ULONG_PTR
3629 (*PDRIVER_VERIFIER_THUNK_ROUTINE)(
3630 /*IN*/ PVOID Context);
3632 typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
3633 PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine;
3634 PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine;
3635 } DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS;
3637 #define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001
3638 #define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002
3639 #define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004
3640 #define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
3641 #define DRIVER_VERIFIER_IO_CHECKING 0x0010
3643 #define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
3644 #define RTL_RANGE_LIST_ADD_SHARED 0x00000002
3646 #define RTL_RANGE_LIST_SHARED_OK 0x00000001
3647 #define RTL_RANGE_LIST_NULL_CONFLICT_OK 0x00000002
3649 #define RTL_RANGE_LIST_SHARED_OK 0x00000001
3650 #define RTL_RANGE_LIST_NULL_CONFLICT_OK 0x00000002
3652 #define RTL_RANGE_LIST_MERGE_IF_CONFLICT RTL_RANGE_LIST_ADD_IF_CONFLICT
3654 typedef struct _RTL_RANGE {
3655 ULONGLONG Start;
3656 ULONGLONG End;
3657 PVOID UserData;
3658 PVOID Owner;
3659 UCHAR Attributes;
3660 UCHAR Flags;
3661 } RTL_RANGE, *PRTL_RANGE;
3663 #define RTL_RANGE_SHARED 0x01
3664 #define RTL_RANGE_CONFLICT 0x02
3666 typedef struct _RTL_RANGE_LIST {
3667 LIST_ENTRY ListHead;
3668 ULONG Flags;
3669 ULONG Count;
3670 ULONG Stamp;
3671 } RTL_RANGE_LIST, *PRTL_RANGE_LIST;
3673 typedef struct _RANGE_LIST_ITERATOR {
3674 PLIST_ENTRY RangeListHead;
3675 PLIST_ENTRY MergedHead;
3676 PVOID Current;
3677 ULONG Stamp;
3678 } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
3680 typedef BOOLEAN
3681 (*PRTL_CONFLICT_RANGE_CALLBACK)(
3682 /*IN*/ PVOID Context,
3683 /*IN*/ PRTL_RANGE Range);
3685 #define HASH_STRING_ALGORITHM_DEFAULT 0
3686 #define HASH_STRING_ALGORITHM_X65599 1
3687 #define HASH_STRING_ALGORITHM_INVALID 0xffffffff
3689 typedef enum _SUITE_TYPE {
3690 SmallBusiness,
3691 Enterprise,
3692 BackOffice,
3693 CommunicationServer,
3694 TerminalServer,
3695 SmallBusinessRestricted,
3696 EmbeddedNT,
3697 DataCenter,
3698 SingleUserTS,
3699 Personal,
3700 Blade,
3701 MaxSuiteType
3702 } SUITE_TYPE;
3704 typedef VOID DDKAPI
3705 (*PTIMER_APC_ROUTINE)(
3706 /*IN*/ PVOID TimerContext,
3707 /*IN*/ ULONG TimerLowValue,
3708 /*IN*/ LONG TimerHighValue);
3713 ** WMI structures
3716 typedef VOID DDKAPI
3717 (*WMI_NOTIFICATION_CALLBACK)(
3718 PVOID Wnode,
3719 PVOID Context);
3723 ** Architecture specific structures
3726 #ifdef _X86_
3728 typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
3730 #define PASSIVE_LEVEL 0
3731 #define LOW_LEVEL 0
3732 #define APC_LEVEL 1
3733 #define DISPATCH_LEVEL 2
3734 #define SYNCH_LEVEL 27
3735 #define PROFILE_LEVEL 27
3736 #define CLOCK1_LEVEL 28
3737 #define CLOCK2_LEVEL 28
3738 #define IPI_LEVEL 29
3739 #define POWER_LEVEL 30
3740 #define HIGH_LEVEL 31
3742 typedef struct _KPCR_TIB {
3743 PVOID ExceptionList; /* 00 */
3744 PVOID StackBase; /* 04 */
3745 PVOID StackLimit; /* 08 */
3746 PVOID SubSystemTib; /* 0C */
3747 _ANONYMOUS_UNION union {
3748 PVOID FiberData; /* 10 */
3749 DWORD Version; /* 10 */
3750 } DUMMYUNIONNAME;
3751 PVOID ArbitraryUserPointer; /* 14 */
3752 struct _NT_TIB *Self; /* 18 */
3753 } KPCR_TIB, *PKPCR_TIB; /* 1C */
3755 #define PCR_MINOR_VERSION 1
3756 #define PCR_MAJOR_VERSION 1
3758 typedef struct _KPCR {
3759 KPCR_TIB Tib; /* 00 */
3760 struct _KPCR *Self; /* 1C */
3761 struct _KPRCB *PCRCB; /* 20 */
3762 KIRQL Irql; /* 24 */
3763 ULONG IRR; /* 28 */
3764 ULONG IrrActive; /* 2C */
3765 ULONG IDR; /* 30 */
3766 PVOID KdVersionBlock; /* 34 */
3767 PUSHORT IDT; /* 38 */
3768 PUSHORT GDT; /* 3C */
3769 struct _KTSS *TSS; /* 40 */
3770 USHORT MajorVersion; /* 44 */
3771 USHORT MinorVersion; /* 46 */
3772 KAFFINITY SetMember; /* 48 */
3773 ULONG StallScaleFactor; /* 4C */
3774 UCHAR SpareUnused; /* 50 */
3775 UCHAR Number; /* 51 */
3776 } KPCR, *PKPCR; /* 54 */
3778 typedef struct _KFLOATING_SAVE {
3779 ULONG ControlWord;
3780 ULONG StatusWord;
3781 ULONG ErrorOffset;
3782 ULONG ErrorSelector;
3783 ULONG DataOffset;
3784 ULONG DataSelector;
3785 ULONG Cr0NpxState;
3786 ULONG Spare1;
3787 } KFLOATING_SAVE, *PKFLOATING_SAVE;
3789 #define PAGE_SIZE 0x1000
3790 #define PAGE_SHIFT 12L
3792 extern NTOSAPI PVOID *MmHighestUserAddress;
3793 extern NTOSAPI PVOID *MmSystemRangeStart;
3794 extern NTOSAPI ULONG *MmUserProbeAddress;
3796 #define MM_HIGHEST_USER_ADDRESS *MmHighestUserAddress
3797 #define MM_SYSTEM_RANGE_START *MmSystemRangeStart
3798 #define MM_USER_PROBE_ADDRESS *MmUserProbeAddress
3799 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
3800 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
3802 #define KI_USER_SHARED_DATA 0xffdf0000
3803 #define SharedUserData ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
3805 #define EFLAG_SIGN 0x8000
3806 #define EFLAG_ZERO 0x4000
3807 #define EFLAG_SELECT (EFLAG_SIGN | EFLAG_ZERO)
3809 #define RESULT_NEGATIVE ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
3810 #define RESULT_ZERO ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
3811 #define RESULT_POSITIVE ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
3813 typedef enum _INTERLOCKED_RESULT {
3814 ResultNegative = RESULT_NEGATIVE,
3815 ResultZero = RESULT_ZERO,
3816 ResultPositive = RESULT_POSITIVE
3817 } INTERLOCKED_RESULT;
3819 NTOSAPI
3820 KIRQL
3821 DDKAPI
3822 KeGetCurrentIrql(
3823 VOID);
3826 * ULONG
3827 * KeGetCurrentProcessorNumber(
3828 * VOID)
3830 #define KeGetCurrentProcessorNumber() \
3831 ((ULONG)KeGetCurrentKPCR()->Number)
3834 #if __USE_NTOSKRNL__
3835 /* CAREFUL: These are exported from ntoskrnl.exe as __fastcall functions,
3836 but are also exported from kernel32.dll and declared in winbase.h as
3837 __stdcall */
3838 #if !defined(__INTERLOCKED_DECLARED)
3839 #define __INTERLOCKED_DECLARED
3841 NTOSAPI
3842 LONG
3843 DDKFASTAPI
3844 InterlockedIncrement(
3845 /*IN*/ LONG VOLATILE *Addend);
3847 NTOSAPI
3848 LONG
3849 DDKFASTAPI
3850 InterlockedDecrement(
3851 /*IN*/ LONG VOLATILE *Addend);
3853 NTOSAPI
3854 LONG
3855 DDKFASTAPI
3856 InterlockedCompareExchange(
3857 /*IN OUT*/ PLONG VOLATILE Destination,
3858 /*IN*/ LONG Exchange,
3859 /*IN*/ LONG Comparand);
3861 NTOSAPI
3862 LONG
3863 DDKFASTAPI
3864 InterlockedExchange(
3865 /*IN OUT*/ PLONG VOLATILE Target,
3866 /*IN*/ LONG Value);
3868 NTOSAPI
3869 LONG
3870 DDKFASTAPI
3871 InterlockedExchangeAdd(
3872 /*IN OUT*/ PLONG VOLATILE Addend,
3873 /*IN*/ LONG Value);
3876 * PVOID
3877 * InterlockedExchangePointer(
3878 * IN OUT PVOID VOLATILE *Target,
3879 * IN PVOID Value)
3881 #define InterlockedExchangePointer(Target, Value) \
3882 ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
3885 * PVOID
3886 * InterlockedCompareExchangePointer(
3887 * IN OUT PVOID *Destination,
3888 * IN PVOID Exchange,
3889 * IN PVOID Comparand)
3891 #define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
3892 ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
3894 #if (_WIN32_WINNT >= 0x0501)
3895 PSLIST_ENTRY
3896 DDKFASTAPI
3897 InterlockedPopEntrySList(
3898 /*IN*/ PSLIST_HEADER ListHead);
3900 NTOSAPI
3901 PSLIST_ENTRY
3902 DDKFASTAPI
3903 InterlockedPushEntrySList(
3904 /*IN*/ PSLIST_HEADER ListHead,
3905 /*IN*/ PSLIST_ENTRY ListEntry);
3906 #endif /* _WIN32_WINNT >= 0x0501 */
3908 #endif /* !__INTERLOCKED_DECLARED */
3909 #endif /* __USE_NTOSKRNL__ */
3911 NTOSAPI
3912 VOID
3913 DDKFASTAPI
3914 KefAcquireSpinLockAtDpcLevel(
3915 /*IN*/ PKSPIN_LOCK SpinLock);
3917 NTOSAPI
3918 VOID
3919 DDKFASTAPI
3920 KefReleaseSpinLockFromDpcLevel(
3921 /*IN*/ PKSPIN_LOCK SpinLock);
3923 #define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
3924 #define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
3926 #define RtlCopyMemoryNonTemporal RtlCopyMemory
3928 #define KeGetDcacheFillSize() 1L
3930 #endif /* _X86_ */
3935 ** Utillity functions
3938 #define ARGUMENT_PRESENT(ArgumentPointer) \
3939 ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL))
3942 * ULONG
3943 * BYTE_OFFSET(
3944 * IN PVOID Va)
3946 #define BYTE_OFFSET(Va) \
3947 ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
3950 * ULONG
3951 * BYTES_TO_PAGES(
3952 * IN ULONG Size)
3954 #define BYTES_TO_PAGES(Size) \
3955 ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0))
3958 * PCHAR
3959 * CONTAINING_RECORD(
3960 * IN PCHAR Address,
3961 * IN TYPE Type,
3962 * IN PCHAR Field);
3964 #ifndef CONTAINING_RECORD
3965 #define CONTAINING_RECORD(Address, Type, Field) \
3966 ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field)))
3967 #endif
3969 /* LONG
3970 * FIELD_OFFSET(
3971 * IN TYPE Type,
3972 * IN PCHAR Field);
3974 #ifndef FIELD_OFFSET
3975 #define FIELD_OFFSET(Type, Field) \
3976 ((LONG) (&(((Type *) 0)->Field)))
3977 #endif
3980 * PVOID
3981 * PAGE_ALIGN(
3982 * IN PVOID Va)
3984 #define PAGE_ALIGN(Va) \
3985 ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
3988 * ULONG_PTR
3989 * ROUND_TO_PAGES(
3990 * IN ULONG_PTR Size)
3992 #define ROUND_TO_PAGES(Size) \
3993 ((ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
3995 NTOSAPI
3996 VOID
3997 DDKAPI
3998 RtlAssert(
3999 /*IN*/ PVOID FailedAssertion,
4000 /*IN*/ PVOID FileName,
4001 /*IN*/ ULONG LineNumber,
4002 /*IN*/ PCHAR Message);
4004 #ifdef DBG
4006 #define ASSERT(exp) \
4007 ((!(exp)) ? \
4008 (RtlAssert( #exp, __FILE__, __LINE__, NULL ), FALSE) : TRUE)
4010 #define ASSERTMSG(msg, exp) \
4011 ((!(exp)) ? \
4012 (RtlAssert( #exp, __FILE__, __LINE__, msg ), FALSE) : TRUE)
4014 #define RTL_SOFT_ASSERT(exp) \
4015 ((!(_exp)) ? \
4016 (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #exp), FALSE) : TRUE)
4018 #define RTL_SOFT_ASSERTMSG(msg, exp) \
4019 ((!(exp)) ? \
4020 (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n Message: %s\n", __FILE__, __LINE__, #exp, (msg)), FALSE) : TRUE)
4022 #define RTL_VERIFY(exp) ASSERT(exp)
4023 #define RTL_VERIFYMSG(msg, exp) ASSERT(msg, exp)
4025 #define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
4026 #define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
4028 #else /* !DBG */
4030 #define ASSERT(exp) ((VOID) 0)
4031 #define ASSERTMSG(msg, exp) ((VOID) 0)
4033 #define RTL_SOFT_ASSERT(exp) ((VOID) 0)
4034 #define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
4036 #define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
4037 #define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
4039 #define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
4040 #define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
4042 #endif /* DBG */
4046 ** Driver support routines
4049 /** Runtime library routines **/
4052 * VOID
4053 * InitializeListHead(
4054 * IN PLIST_ENTRY ListHead)
4056 #define InitializeListHead(_ListHead) \
4058 (_ListHead)->Flink = (_ListHead); \
4059 (_ListHead)->Blink = (_ListHead); \
4063 * VOID
4064 * InsertHeadList(
4065 * IN PLIST_ENTRY ListHead,
4066 * IN PLIST_ENTRY Entry)
4068 #define InsertHeadList(_ListHead, \
4069 _Entry) \
4071 PLIST_ENTRY _OldFlink; \
4072 _OldFlink = (_ListHead)->Flink; \
4073 (_Entry)->Flink = _OldFlink; \
4074 (_Entry)->Blink = (_ListHead); \
4075 _OldFlink->Blink = (_Entry); \
4076 (_ListHead)->Flink = (_Entry); \
4080 * VOID
4081 * InsertTailList(
4082 * IN PLIST_ENTRY ListHead,
4083 * IN PLIST_ENTRY Entry)
4085 #define InsertTailList(_ListHead, \
4086 _Entry) \
4088 PLIST_ENTRY _OldBlink; \
4089 _OldBlink = (_ListHead)->Blink; \
4090 (_Entry)->Flink = (_ListHead); \
4091 (_Entry)->Blink = _OldBlink; \
4092 _OldBlink->Flink = (_Entry); \
4093 (_ListHead)->Blink = (_Entry); \
4097 * BOOLEAN
4098 * IsListEmpty(
4099 * IN PLIST_ENTRY ListHead)
4101 #define IsListEmpty(_ListHead) \
4102 ((_ListHead)->Flink == (_ListHead))
4104 static __inline PSINGLE_LIST_ENTRY
4105 PopEntryList(
4106 /*IN*/ PSINGLE_LIST_ENTRY ListHead)
4108 PSINGLE_LIST_ENTRY Entry;
4110 Entry = ListHead->Next;
4111 if (Entry != NULL)
4113 ListHead->Next = Entry->Next;
4115 return Entry;
4119 * VOID
4120 * PushEntryList(
4121 * IN PSINGLE_LIST_ENTRY ListHead,
4122 * IN PSINGLE_LIST_ENTRY Entry)
4124 #define PushEntryList(_ListHead, \
4125 _Entry) \
4127 (_Entry)->Next = (_ListHead)->Next; \
4128 (_ListHead)->Next = (_Entry); \
4132 * VOID
4133 * RemoveEntryList(
4134 * IN PLIST_ENTRY Entry)
4136 #define RemoveEntryList(_Entry) \
4138 PLIST_ENTRY _OldFlink; \
4139 PLIST_ENTRY _OldBlink; \
4140 _OldFlink = (_Entry)->Flink; \
4141 _OldBlink = (_Entry)->Blink; \
4142 _OldFlink->Blink = _OldBlink; \
4143 _OldBlink->Flink = _OldFlink; \
4144 (_Entry)->Flink = NULL; \
4145 (_Entry)->Blink = NULL; \
4148 static __inline PLIST_ENTRY
4149 RemoveHeadList(
4150 /*IN*/ PLIST_ENTRY ListHead)
4152 PLIST_ENTRY OldFlink;
4153 PLIST_ENTRY OldBlink;
4154 PLIST_ENTRY Entry;
4156 Entry = ListHead->Flink;
4157 OldFlink = ListHead->Flink->Flink;
4158 OldBlink = ListHead->Flink->Blink;
4159 OldFlink->Blink = OldBlink;
4160 OldBlink->Flink = OldFlink;
4162 if (Entry != ListHead)
4164 Entry->Flink = NULL;
4165 Entry->Blink = NULL;
4168 return Entry;
4171 static __inline PLIST_ENTRY
4172 RemoveTailList(
4173 /*IN*/ PLIST_ENTRY ListHead)
4175 PLIST_ENTRY OldFlink;
4176 PLIST_ENTRY OldBlink;
4177 PLIST_ENTRY Entry;
4179 Entry = ListHead->Blink;
4180 OldFlink = ListHead->Blink->Flink;
4181 OldBlink = ListHead->Blink->Blink;
4182 OldFlink->Blink = OldBlink;
4183 OldBlink->Flink = OldFlink;
4185 if (Entry != ListHead)
4187 Entry->Flink = NULL;
4188 Entry->Blink = NULL;
4191 return Entry;
4195 * USHORT
4196 * QueryDepthSList(
4197 * IN PSLIST_HEADER SListHead)
4199 #define QueryDepthSList(_SListHead) \
4200 ((USHORT) ((_SListHead)->Alignment & 0xffff))
4202 #define InterlockedFlushSList(ListHead) ExInterlockedFlushSList(ListHead)
4204 NTOSAPI
4205 ULONG
4206 DDKAPI
4207 RtlAnsiStringToUnicodeSize(
4208 /*IN*/ PANSI_STRING AnsiString);
4210 NTOSAPI
4211 NTSTATUS
4212 DDKAPI
4213 RtlAddRange(
4214 /*IN OUT*/ PRTL_RANGE_LIST RangeList,
4215 /*IN*/ ULONGLONG Start,
4216 /*IN*/ ULONGLONG End,
4217 /*IN*/ UCHAR Attributes,
4218 /*IN*/ ULONG Flags,
4219 /*IN*/ PVOID UserData /*OPTIONAL*/,
4220 /*IN*/ PVOID Owner /*OPTIONAL*/);
4222 NTOSAPI
4223 NTSTATUS
4224 DDKAPI
4225 RtlAnsiStringToUnicodeString(
4226 /*IN OUT*/ PUNICODE_STRING DestinationString,
4227 /*IN*/ PANSI_STRING SourceString,
4228 /*IN*/ BOOLEAN AllocateDestinationString);
4230 NTOSAPI
4231 NTSTATUS
4232 DDKAPI
4233 RtlAppendUnicodeStringToString(
4234 /*IN OUT*/ PUNICODE_STRING Destination,
4235 /*IN*/ PUNICODE_STRING Source);
4237 NTOSAPI
4238 NTSTATUS
4239 DDKAPI
4240 RtlAppendUnicodeToString(
4241 /*IN OUT*/ PUNICODE_STRING Destination,
4242 /*IN*/ PCWSTR Source);
4244 NTOSAPI
4245 BOOLEAN
4246 DDKAPI
4247 RtlAreBitsClear(
4248 /*IN*/ PRTL_BITMAP BitMapHeader,
4249 /*IN*/ ULONG StartingIndex,
4250 /*IN*/ ULONG Length);
4252 NTOSAPI
4253 BOOLEAN
4254 DDKAPI
4255 RtlAreBitsSet(
4256 /*IN*/ PRTL_BITMAP BitMapHeader,
4257 /*IN*/ ULONG StartingIndex,
4258 /*IN*/ ULONG Length);
4260 NTOSAPI
4261 NTSTATUS
4262 DDKAPI
4263 RtlCharToInteger(
4264 /*IN*/ PCSZ String,
4265 /*IN*/ ULONG Base /*OPTIONAL*/,
4266 /*IN OUT*/ PULONG Value);
4268 NTOSAPI
4269 ULONG
4270 DDKAPI
4271 RtlCheckBit(
4272 /*IN*/ PRTL_BITMAP BitMapHeader,
4273 /*IN*/ ULONG BitPosition);
4275 NTOSAPI
4276 NTSTATUS
4277 DDKAPI
4278 RtlCheckRegistryKey(
4279 /*IN*/ ULONG RelativeTo,
4280 /*IN*/ PWSTR Path);
4282 NTOSAPI
4283 VOID
4284 DDKAPI
4285 RtlClearAllBits(
4286 /*IN*/ PRTL_BITMAP BitMapHeader);
4288 NTOSAPI
4289 VOID
4290 DDKAPI
4291 RtlClearBit(
4292 PRTL_BITMAP BitMapHeader,
4293 ULONG BitNumber);
4295 NTOSAPI
4296 VOID
4297 DDKAPI
4298 RtlClearBits(
4299 /*IN*/ PRTL_BITMAP BitMapHeader,
4300 /*IN*/ ULONG StartingIndex,
4301 /*IN*/ ULONG NumberToClear);
4303 NTOSAPI
4304 SIZE_T
4305 DDKAPI
4306 RtlCompareMemory(
4307 /*IN*/ CONST VOID *Source1,
4308 /*IN*/ CONST VOID *Source2,
4309 /*IN*/ SIZE_T Length);
4311 NTOSAPI
4312 LONG
4313 DDKAPI
4314 RtlCompareString(
4315 /*IN*/ PSTRING String1,
4316 /*IN*/ PSTRING String2,
4317 BOOLEAN CaseInSensitive);
4319 NTOSAPI
4320 LONG
4321 DDKAPI
4322 RtlCompareUnicodeString(
4323 /*IN*/ PUNICODE_STRING String1,
4324 /*IN*/ PUNICODE_STRING String2,
4325 /*IN*/ BOOLEAN CaseInSensitive);
4327 NTOSAPI
4328 LARGE_INTEGER
4329 DDKAPI
4330 RtlConvertLongToLargeInteger(
4331 /*IN*/ LONG SignedInteger);
4333 NTOSAPI
4334 LUID
4335 DDKAPI
4336 RtlConvertLongToLuid(
4337 /*IN*/ LONG Long);
4339 NTOSAPI
4340 LARGE_INTEGER
4341 DDKAPI
4342 RtlConvertUlongToLargeInteger(
4343 /*IN*/ ULONG UnsignedInteger);
4345 NTOSAPI
4346 LUID
4347 DDKAPI
4348 RtlConvertUlongToLuid(
4349 ULONG Ulong);
4352 * VOID
4353 * RtlCopyMemory(
4354 * IN VOID UNALIGNED *Destination,
4355 * IN CONST VOID UNALIGNED *Source,
4356 * IN SIZE_T Length)
4358 #ifndef RtlCopyMemory
4359 #define RtlCopyMemory(Destination, Source, Length) \
4360 memcpy(Destination, Source, Length);
4361 #endif
4363 #ifndef RtlCopyBytes
4364 #define RtlCopyBytes RtlCopyMemory
4365 #endif
4367 NTOSAPI
4368 VOID
4369 DDKAPI
4370 RtlCopyMemory32(
4371 /*IN*/ VOID UNALIGNED *Destination,
4372 /*IN*/ CONST VOID UNALIGNED *Source,
4373 /*IN*/ ULONG Length);
4375 NTOSAPI
4376 NTSTATUS
4377 DDKAPI
4378 RtlCopyRangeList(
4379 /*OUT*/ PRTL_RANGE_LIST CopyRangeList,
4380 /*IN*/ PRTL_RANGE_LIST RangeList);
4382 NTOSAPI
4383 VOID
4384 DDKAPI
4385 RtlCopyString(
4386 /*IN OUT*/ PSTRING DestinationString,
4387 /*IN*/ PSTRING SourceString /*OPTIONAL*/);
4389 NTOSAPI
4390 VOID
4391 DDKAPI
4392 RtlCopyUnicodeString(
4393 /*IN OUT*/ PUNICODE_STRING DestinationString,
4394 /*IN*/ PUNICODE_STRING SourceString);
4396 NTOSAPI
4397 NTSTATUS
4398 DDKAPI
4399 RtlCreateRegistryKey(
4400 /*IN*/ ULONG RelativeTo,
4401 /*IN*/ PWSTR Path);
4403 NTOSAPI
4404 NTSTATUS
4405 DDKAPI
4406 RtlCreateSecurityDescriptor(
4407 /*IN OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
4408 /*IN*/ ULONG Revision);
4410 NTOSAPI
4411 NTSTATUS
4412 DDKAPI
4413 RtlDeleteOwnersRanges(
4414 /*IN OUT*/ PRTL_RANGE_LIST RangeList,
4415 /*IN*/ PVOID Owner);
4417 NTOSAPI
4418 NTSTATUS
4419 DDKAPI
4420 RtlDeleteRange(
4421 /*IN OUT*/ PRTL_RANGE_LIST RangeList,
4422 /*IN*/ ULONGLONG Start,
4423 /*IN*/ ULONGLONG End,
4424 /*IN*/ PVOID Owner);
4426 NTOSAPI
4427 NTSTATUS
4428 DDKAPI
4429 RtlDeleteRegistryValue(
4430 /*IN*/ ULONG RelativeTo,
4431 /*IN*/ PCWSTR Path,
4432 /*IN*/ PCWSTR ValueName);
4434 NTOSAPI
4435 BOOL
4436 DDKAPI
4437 RtlDosPathNameToNtPathName_U(
4438 /*IN*/ PCWSTR DosPathName,
4439 /*OUT*/ PUNICODE_STRING NtPathName,
4440 /*OUT*/ PCWSTR *NtFileNamePart,
4441 /*OUT*/ VOID *DirectoryInfo);
4444 * BOOLEAN
4445 * RtlEqualLuid(
4446 * IN LUID Luid1,
4447 * IN LUID Luid2)
4449 #define RtlEqualLuid(_Luid1, \
4450 _Luid2) \
4451 ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart))
4454 * ULONG
4455 * RtlEqualMemory(
4456 * IN VOID UNALIGNED *Destination,
4457 * IN CONST VOID UNALIGNED *Source,
4458 * IN SIZE_T Length)
4460 #define RtlEqualMemory(Destination, Source, Length) (!memcmp(Destination, Source, Length))
4462 NTOSAPI
4463 BOOLEAN
4464 DDKAPI
4465 RtlEqualString(
4466 /*IN*/ PSTRING String1,
4467 /*IN*/ PSTRING String2,
4468 /*IN*/ BOOLEAN CaseInSensitive);
4470 NTOSAPI
4471 BOOLEAN
4472 DDKAPI
4473 RtlEqualUnicodeString(
4474 /*IN*/ CONST UNICODE_STRING *String1,
4475 /*IN*/ CONST UNICODE_STRING *String2,
4476 /*IN*/ BOOLEAN CaseInSensitive);
4479 * VOID
4480 * RtlFillMemory(
4481 * IN VOID UNALIGNED *Destination,
4482 * IN SIZE_T Length,
4483 * IN UCHAR Fill)
4485 #ifndef RtlFillMemory
4486 #define RtlFillMemory(Destination, Length, Fill) \
4487 memset(Destination, Fill, Length)
4488 #endif
4490 #ifndef RtlFillBytes
4491 #define RtlFillBytes RtlFillMemory
4492 #endif
4494 NTOSAPI
4495 ULONG
4496 DDKAPI
4497 RtlFindClearBits(
4498 /*IN*/ PRTL_BITMAP BitMapHeader,
4499 /*IN*/ ULONG NumberToFind,
4500 /*IN*/ ULONG HintIndex);
4502 NTOSAPI
4503 ULONG
4504 DDKAPI
4505 RtlFindClearBitsAndSet(
4506 /*IN*/ PRTL_BITMAP BitMapHeader,
4507 /*IN*/ ULONG NumberToFind,
4508 /*IN*/ ULONG HintIndex);
4510 NTOSAPI
4511 ULONG
4512 DDKAPI
4513 RtlFindClearRuns(
4514 /*IN*/ PRTL_BITMAP BitMapHeader,
4515 /*OUT*/ PRTL_BITMAP_RUN RunArray,
4516 /*IN*/ ULONG SizeOfRunArray,
4517 /*IN*/ BOOLEAN LocateLongestRuns);
4519 NTOSAPI
4520 ULONG
4521 DDKAPI
4522 RtlFindFirstRunClear(
4523 /*IN*/ PRTL_BITMAP BitMapHeader,
4524 /*OUT*/ PULONG StartingIndex);
4526 NTOSAPI
4527 ULONG
4528 DDKAPI
4529 RtlFindLastBackwardRunClear(
4530 /*IN*/ PRTL_BITMAP BitMapHeader,
4531 /*IN*/ ULONG FromIndex,
4532 /*OUT*/ PULONG StartingRunIndex);
4534 NTOSAPI
4535 CCHAR
4536 DDKAPI
4537 RtlFindLeastSignificantBit(
4538 /*IN*/ ULONGLONG Set);
4540 NTOSAPI
4541 ULONG
4542 DDKAPI
4543 RtlFindLongestRunClear(
4544 /*IN*/ PRTL_BITMAP BitMapHeader,
4545 /*OUT*/ PULONG StartingIndex);
4547 NTOSAPI
4548 CCHAR
4549 DDKAPI
4550 RtlFindMostSignificantBit(
4551 /*IN*/ ULONGLONG Set);
4553 NTOSAPI
4554 ULONG
4555 DDKAPI
4556 RtlFindNextForwardRunClear(
4557 /*IN*/ PRTL_BITMAP BitMapHeader,
4558 /*IN*/ ULONG FromIndex,
4559 /*OUT*/ PULONG StartingRunIndex);
4561 NTOSAPI
4562 NTSTATUS
4563 DDKAPI
4564 RtlFindRange(
4565 /*IN*/ PRTL_RANGE_LIST RangeList,
4566 /*IN*/ ULONGLONG Minimum,
4567 /*IN*/ ULONGLONG Maximum,
4568 /*IN*/ ULONG Length,
4569 /*IN*/ ULONG Alignment,
4570 /*IN*/ ULONG Flags,
4571 /*IN*/ UCHAR AttributeAvailableMask,
4572 /*IN*/ PVOID Context /*OPTIONAL*/,
4573 /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK Callback /*OPTIONAL*/,
4574 /*OUT*/ PULONGLONG Start);
4576 NTOSAPI
4577 ULONG
4578 DDKAPI
4579 RtlFindSetBits(
4580 /*IN*/ PRTL_BITMAP BitMapHeader,
4581 /*IN*/ ULONG NumberToFind,
4582 /*IN*/ ULONG HintIndex);
4584 NTOSAPI
4585 ULONG
4586 DDKAPI
4587 RtlFindSetBitsAndClear(
4588 /*IN*/ PRTL_BITMAP BitMapHeader,
4589 /*IN*/ ULONG NumberToFind,
4590 /*IN*/ ULONG HintIndex);
4592 NTOSAPI
4593 VOID
4594 DDKAPI
4595 RtlFreeAnsiString(
4596 /*IN*/ PANSI_STRING AnsiString);
4598 NTOSAPI
4599 VOID
4600 DDKAPI
4601 RtlFreeRangeList(
4602 /*IN*/ PRTL_RANGE_LIST RangeList);
4604 NTOSAPI
4605 VOID
4606 DDKAPI
4607 RtlFreeUnicodeString(
4608 /*IN*/ PUNICODE_STRING UnicodeString);
4610 NTOSAPI
4611 VOID
4612 DDKAPI
4613 RtlGetCallersAddress(
4614 /*OUT*/ PVOID *CallersAddress,
4615 /*OUT*/ PVOID *CallersCaller);
4617 NTOSAPI
4618 NTSTATUS
4619 DDKAPI
4620 RtlGetVersion(
4621 /*IN OUT*/ PRTL_OSVERSIONINFOW lpVersionInformation);
4623 NTOSAPI
4624 NTSTATUS
4625 DDKAPI
4626 RtlGetFirstRange(
4627 /*IN*/ PRTL_RANGE_LIST RangeList,
4628 /*OUT*/ PRTL_RANGE_LIST_ITERATOR Iterator,
4629 /*OUT*/ PRTL_RANGE *Range);
4631 NTOSAPI
4632 NTSTATUS
4633 DDKAPI
4634 RtlGetNextRange(
4635 /*IN OUT*/ PRTL_RANGE_LIST_ITERATOR Iterator,
4636 /*OUT*/ PRTL_RANGE *Range,
4637 /*IN*/ BOOLEAN MoveForwards);
4639 #define FOR_ALL_RANGES(RangeList, Iterator, Current) \
4640 for (RtlGetFirstRange((RangeList), (Iterator), &(Current)); \
4641 (Current) != NULL; \
4642 RtlGetNextRange((Iterator), &(Current), TRUE))
4644 #define FOR_ALL_RANGES_BACKWARDS(RangeList, Iterator, Current) \
4645 for (RtlGetLastRange((RangeList), (Iterator), &(Current)); \
4646 (Current) != NULL; \
4647 RtlGetNextRange((Iterator), &(Current), FALSE))
4649 NTOSAPI
4650 NTSTATUS
4651 DDKAPI
4652 RtlGUIDFromString(
4653 /*IN*/ PUNICODE_STRING GuidString,
4654 /*OUT*/ GUID *Guid);
4656 NTOSAPI
4657 NTSTATUS
4658 DDKAPI
4659 RtlHashUnicodeString(
4660 /*IN*/ CONST UNICODE_STRING *String,
4661 /*IN*/ BOOLEAN CaseInSensitive,
4662 /*IN*/ ULONG HashAlgorithm,
4663 /*OUT*/ PULONG HashValue);
4665 NTOSAPI
4666 VOID
4667 DDKAPI
4668 RtlInitAnsiString(
4669 /*IN OUT*/ PANSI_STRING DestinationString,
4670 /*IN*/ PCSZ SourceString);
4672 NTOSAPI
4673 VOID
4674 DDKAPI
4675 RtlInitializeBitMap(
4676 /*IN*/ PRTL_BITMAP BitMapHeader,
4677 /*IN*/ PULONG BitMapBuffer,
4678 /*IN*/ ULONG SizeOfBitMap);
4680 NTOSAPI
4681 VOID
4682 DDKAPI
4683 RtlInitializeRangeList(
4684 /*IN OUT*/ PRTL_RANGE_LIST RangeList);
4686 NTOSAPI
4687 VOID
4688 DDKAPI
4689 RtlInitString(
4690 /*IN OUT*/ PSTRING DestinationString,
4691 /*IN*/ PCSZ SourceString);
4693 NTOSAPI
4694 VOID
4695 DDKAPI
4696 RtlInitUnicodeString(
4697 /*IN OUT*/ PUNICODE_STRING DestinationString,
4698 /*IN*/ PCWSTR SourceString);
4700 NTOSAPI
4701 NTSTATUS
4702 DDKAPI
4703 RtlInt64ToUnicodeString(
4704 /*IN*/ ULONGLONG Value,
4705 /*IN*/ ULONG Base /*OPTIONAL*/,
4706 /*IN OUT*/ PUNICODE_STRING String);
4708 NTOSAPI
4709 NTSTATUS
4710 DDKAPI
4711 RtlIntegerToUnicodeString(
4712 /*IN*/ ULONG Value,
4713 /*IN*/ ULONG Base /*OPTIONAL*/,
4714 /*IN OUT*/ PUNICODE_STRING String);
4716 NTOSAPI
4717 NTSTATUS
4718 DDKAPI
4719 RtlIntPtrToUnicodeString(
4720 PLONG Value,
4721 ULONG Base /*OPTIONAL*/,
4722 PUNICODE_STRING String);
4724 NTOSAPI
4725 NTSTATUS
4726 DDKAPI
4727 RtlInvertRangeList(
4728 /*OUT*/ PRTL_RANGE_LIST InvertedRangeList,
4729 /*IN*/ PRTL_RANGE_LIST RangeList);
4731 NTOSAPI
4732 NTSTATUS
4733 DDKAPI
4734 RtlIsRangeAvailable(
4735 /*IN*/ PRTL_RANGE_LIST RangeList,
4736 /*IN*/ ULONGLONG Start,
4737 /*IN*/ ULONGLONG End,
4738 /*IN*/ ULONG Flags,
4739 /*IN*/ UCHAR AttributeAvailableMask,
4740 /*IN*/ PVOID Context /*OPTIONAL*/,
4741 /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK Callback /*OPTIONAL*/,
4742 /*OUT*/ PBOOLEAN Available);
4745 * BOOLEAN
4746 * RtlIsZeroLuid(
4747 * IN PLUID L1)
4749 #define RtlIsZeroLuid(_L1) \
4750 ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
4752 NTOSAPI
4753 ULONG
4754 DDKAPI
4755 RtlLengthSecurityDescriptor(
4756 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
4758 NTOSAPI
4759 VOID
4760 DDKAPI
4761 RtlMapGenericMask(
4762 /*IN OUT*/ PACCESS_MASK AccessMask,
4763 /*IN*/ PGENERIC_MAPPING GenericMapping);
4765 NTOSAPI
4766 NTSTATUS
4767 DDKAPI
4768 RtlMergeRangeLists(
4769 /*OUT*/ PRTL_RANGE_LIST MergedRangeList,
4770 /*IN*/ PRTL_RANGE_LIST RangeList1,
4771 /*IN*/ PRTL_RANGE_LIST RangeList2,
4772 /*IN*/ ULONG Flags);
4775 * VOID
4776 * RtlMoveMemory(
4777 * IN VOID UNALIGNED *Destination,
4778 * IN CONST VOID UNALIGNED *Source,
4779 * IN SIZE_T Length)
4781 #define RtlMoveMemory memmove
4783 NTOSAPI
4784 ULONG
4785 DDKAPI
4786 RtlNumberOfClearBits(
4787 /*IN*/ PRTL_BITMAP BitMapHeader);
4789 NTOSAPI
4790 ULONG
4791 DDKAPI
4792 RtlNumberOfSetBits(
4793 /*IN*/ PRTL_BITMAP BitMapHeader);
4795 NTOSAPI
4796 VOID
4797 DDKFASTAPI
4798 RtlPrefetchMemoryNonTemporal(
4799 /*IN*/ PVOID Source,
4800 /*IN*/ SIZE_T Length);
4802 NTOSAPI
4803 BOOLEAN
4804 DDKAPI
4805 RtlPrefixUnicodeString(
4806 /*IN*/ PUNICODE_STRING String1,
4807 /*IN*/ PUNICODE_STRING String2,
4808 /*IN*/ BOOLEAN CaseInSensitive);
4810 NTOSAPI
4811 NTSTATUS
4812 DDKAPI
4813 RtlQueryRegistryValues(
4814 /*IN*/ ULONG RelativeTo,
4815 /*IN*/ PCWSTR Path,
4816 /*IN*/ PRTL_QUERY_REGISTRY_TABLE QueryTable,
4817 /*IN*/ PVOID Context,
4818 /*IN*/ PVOID Environment /*OPTIONAL*/);
4820 NTOSAPI
4821 VOID
4822 DDKAPI
4823 RtlRetrieveUlong(
4824 /*IN OUT*/ PULONG DestinationAddress,
4825 /*IN*/ PULONG SourceAddress);
4827 NTOSAPI
4828 VOID
4829 DDKAPI
4830 RtlRetrieveUshort(
4831 /*IN OUT*/ PUSHORT DestinationAddress,
4832 /*IN*/ PUSHORT SourceAddress);
4834 NTOSAPI
4835 VOID
4836 DDKAPI
4837 RtlSetAllBits(
4838 /*IN*/ PRTL_BITMAP BitMapHeader);
4840 NTOSAPI
4841 VOID
4842 DDKAPI
4843 RtlSetBit(
4844 PRTL_BITMAP BitMapHeader,
4845 ULONG BitNumber);
4847 NTOSAPI
4848 VOID
4849 DDKAPI
4850 RtlSetBits(
4851 /*IN*/ PRTL_BITMAP BitMapHeader,
4852 /*IN*/ ULONG StartingIndex,
4853 /*IN*/ ULONG NumberToSet);
4855 NTOSAPI
4856 NTSTATUS
4857 DDKAPI
4858 RtlSetDaclSecurityDescriptor(
4859 /*IN OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
4860 /*IN*/ BOOLEAN DaclPresent,
4861 /*IN*/ PACL Dacl /*OPTIONAL*/,
4862 /*IN*/ BOOLEAN DaclDefaulted /*OPTIONAL*/);
4864 NTOSAPI
4865 VOID
4866 DDKAPI
4867 RtlStoreUlong(
4868 /*IN*/ PULONG Address,
4869 /*IN*/ ULONG Value);
4871 NTOSAPI
4872 VOID
4873 DDKAPI
4874 RtlStoreUlonglong(
4875 /*IN OUT*/ PULONGLONG Address,
4876 ULONGLONG Value);
4878 NTOSAPI
4879 VOID
4880 DDKAPI
4881 RtlStoreUlongPtr(
4882 /*IN OUT*/ PULONG_PTR Address,
4883 /*IN*/ ULONG_PTR Value);
4885 NTOSAPI
4886 VOID
4887 DDKAPI
4888 RtlStoreUshort(
4889 /*IN*/ PUSHORT Address,
4890 /*IN*/ USHORT Value);
4892 NTOSAPI
4893 NTSTATUS
4894 DDKAPI
4895 RtlStringFromGUID(
4896 /*IN*/ REFGUID Guid,
4897 /*OUT*/ PUNICODE_STRING GuidString);
4899 #define RtlStringCbCopyA(dst, dst_len, src) strncpy(dst, src, dst_len)
4900 #define RtlStringCbPrintfA(args...) snprintf(args)
4901 #define RtlStringCbVPrintfA(args...) vsnprintf(args)
4903 NTOSAPI
4904 BOOLEAN
4905 DDKAPI
4906 RtlTestBit(
4907 /*IN*/ PRTL_BITMAP BitMapHeader,
4908 /*IN*/ ULONG BitNumber);
4910 NTOSAPI
4911 BOOLEAN
4912 DDKAPI
4913 RtlTimeFieldsToTime(
4914 /*IN*/ PTIME_FIELDS TimeFields,
4915 /*IN*/ PLARGE_INTEGER Time);
4917 NTOSAPI
4918 VOID
4919 DDKAPI
4920 RtlTimeToTimeFields(
4921 /*IN*/ PLARGE_INTEGER Time,
4922 /*IN*/ PTIME_FIELDS TimeFields);
4924 NTOSAPI
4925 ULONG
4926 DDKFASTAPI
4927 RtlUlongByteSwap(
4928 /*IN*/ ULONG Source);
4930 NTOSAPI
4931 ULONGLONG
4932 DDKFASTAPI
4933 RtlUlonglongByteSwap(
4934 /*IN*/ ULONGLONG Source);
4936 NTOSAPI
4937 ULONG
4938 DDKAPI
4939 RtlUnicodeStringToAnsiSize(
4940 /*IN*/ PUNICODE_STRING UnicodeString);
4942 NTOSAPI
4943 NTSTATUS
4944 DDKAPI
4945 RtlUnicodeStringToAnsiString(
4946 /*IN OUT*/ PANSI_STRING DestinationString,
4947 /*IN*/ PUNICODE_STRING SourceString,
4948 /*IN*/ BOOLEAN AllocateDestinationString);
4950 NTOSAPI
4951 NTSTATUS
4952 DDKAPI
4953 RtlUnicodeStringToInteger(
4954 /*IN*/ PUNICODE_STRING String,
4955 /*IN*/ ULONG Base /*OPTIONAL*/,
4956 /*OUT*/ PULONG Value);
4958 NTOSAPI
4959 WCHAR
4960 DDKAPI
4961 RtlUpcaseUnicodeChar(
4962 /*IN*/ WCHAR SourceCharacter);
4964 NTOSAPI
4965 NTSTATUS
4966 DDKAPI
4967 RtlUpcaseUnicodeString(
4968 /*IN OUT*/ PUNICODE_STRING DestinationString /*OPTIONAL*/,
4969 /*IN*/ PCUNICODE_STRING SourceString,
4970 /*IN*/ BOOLEAN AllocateDestinationString);
4972 NTOSAPI
4973 CHAR
4974 DDKAPI
4975 RtlUpperChar(
4976 /*IN*/ CHAR Character);
4978 NTOSAPI
4979 VOID
4980 DDKAPI
4981 RtlUpperString(
4982 /*IN OUT*/ PSTRING DestinationString,
4983 /*IN*/ PSTRING SourceString);
4985 NTOSAPI
4986 USHORT
4987 DDKFASTAPI
4988 RtlUshortByteSwap(
4989 /*IN*/ USHORT Source);
4991 NTOSAPI
4992 BOOLEAN
4993 DDKAPI
4994 RtlValidRelativeSecurityDescriptor(
4995 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptorInput,
4996 /*IN*/ ULONG SecurityDescriptorLength,
4997 /*IN*/ SECURITY_INFORMATION RequiredInformation);
4999 NTOSAPI
5000 BOOLEAN
5001 DDKAPI
5002 RtlValidSecurityDescriptor(
5003 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
5005 NTOSAPI
5006 NTSTATUS
5007 DDKAPI
5008 RtlVerifyVersionInfo(
5009 /*IN*/ PRTL_OSVERSIONINFOEXW VersionInfo,
5010 /*IN*/ ULONG TypeMask,
5011 /*IN*/ ULONGLONG ConditionMask);
5013 NTOSAPI
5014 NTSTATUS
5015 DDKAPI
5016 RtlVolumeDeviceToDosName(
5017 /*IN*/ PVOID VolumeDeviceObject,
5018 /*OUT*/ PUNICODE_STRING DosName);
5020 NTOSAPI
5021 ULONG
5022 DDKAPI
5023 RtlWalkFrameChain(
5024 /*OUT*/ PVOID *Callers,
5025 /*IN*/ ULONG Count,
5026 /*IN*/ ULONG Flags);
5028 NTOSAPI
5029 NTSTATUS
5030 DDKAPI
5031 RtlWriteRegistryValue(
5032 /*IN*/ ULONG RelativeTo,
5033 /*IN*/ PCWSTR Path,
5034 /*IN*/ PCWSTR ValueName,
5035 /*IN*/ ULONG ValueType,
5036 /*IN*/ PVOID ValueData,
5037 /*IN*/ ULONG ValueLength);
5039 NTOSAPI
5040 ULONG
5041 DDKAPI
5042 RtlxUnicodeStringToAnsiSize(
5043 /*IN*/ PUNICODE_STRING UnicodeString);
5046 * VOID
5047 * RtlZeroMemory(
5048 * IN VOID UNALIGNED *Destination,
5049 * IN SIZE_T Length)
5051 #ifndef RtlZeroMemory
5052 #define RtlZeroMemory(Destination, Length) \
5053 memset(Destination, 0, Length)
5054 #endif
5056 #ifndef RtlZeroBytes
5057 #define RtlZeroBytes RtlZeroMemory
5058 #endif
5061 /** Executive support routines **/
5063 NTOSAPI
5064 VOID
5065 DDKFASTAPI
5066 ExAcquireFastMutex(
5067 /*IN*/ PFAST_MUTEX FastMutex);
5069 NTOSAPI
5070 VOID
5071 DDKFASTAPI
5072 ExAcquireFastMutexUnsafe(
5073 /*IN*/ PFAST_MUTEX FastMutex);
5075 NTOSAPI
5076 BOOLEAN
5077 DDKAPI
5078 ExAcquireResourceExclusiveLite(
5079 /*IN*/ PERESOURCE Resource,
5080 /*IN*/ BOOLEAN Wait);
5082 NTOSAPI
5083 BOOLEAN
5084 DDKAPI
5085 ExAcquireResourceSharedLite(
5086 /*IN*/ PERESOURCE Resource,
5087 /*IN*/ BOOLEAN Wait);
5089 NTOSAPI
5090 BOOLEAN
5091 DDKAPI
5092 ExAcquireSharedStarveExclusive(
5093 /*IN*/ PERESOURCE Resource,
5094 /*IN*/ BOOLEAN Wait);
5096 NTOSAPI
5097 BOOLEAN
5098 DDKAPI
5099 ExAcquireSharedWaitForExclusive(
5100 /*IN*/ PERESOURCE Resource,
5101 /*IN*/ BOOLEAN Wait);
5104 NTOSAPI
5105 PSINGLE_LIST_ENTRY
5106 DDKFASTAPI
5107 ExInterlockedPopEntrySList(
5108 /*IN*/ PSLIST_HEADER ListHead,
5109 /*IN*/ PKSPIN_LOCK Lock);
5112 NTOSAPI
5113 PSINGLE_LIST_ENTRY
5114 DDKFASTAPI
5115 ExInterlockedPushEntrySList(
5116 /*IN*/ PSLIST_HEADER ListHead,
5117 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5118 /*IN*/ PKSPIN_LOCK Lock);
5121 #if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
5122 #define ExInterlockedPopEntrySList(_ListHead, \
5123 _Lock) \
5124 InterlockedPopEntrySList(_ListHead)
5126 #define ExInterlockedPushEntrySList(_ListHead, \
5127 _ListEntry, \
5128 _Lock) \
5129 InterlockedPushEntrySList(_ListHead, _ListEntry)
5130 #endif /* __USE_NTOSKRNL__ */
5132 #define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
5134 static __inline PVOID
5135 ExAllocateFromNPagedLookasideList(
5136 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside)
5138 PVOID Entry;
5140 Lookaside->TotalAllocates++;
5141 Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
5142 &Lookaside->Obsoleted);
5143 if (Entry == NULL) {
5144 Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
5145 Entry = (Lookaside->Allocate)(Lookaside->Type,
5146 Lookaside->Size,
5147 Lookaside->Tag);
5149 return Entry;
5152 static __inline VOID
5153 ExFreeToNPagedLookasideList(
5154 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside,
5155 /*IN*/ PVOID Entry)
5157 Lookaside->TotalFrees++;
5158 if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
5159 Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
5160 (Lookaside->Free)(Entry);
5161 } else {
5162 ExInterlockedPushEntrySList(&Lookaside->ListHead,
5163 (PSLIST_ENTRY)Entry,
5164 &Lookaside->Obsoleted);
5168 #if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
5170 static __inline PVOID
5171 ExAllocateFromPagedLookasideList(
5172 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside)
5174 PVOID Entry;
5176 Lookaside->TotalAllocates++;
5177 Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
5178 if (Entry == NULL) {
5179 Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
5180 Entry = (Lookaside->Allocate)(Lookaside->Type,
5181 Lookaside->Size,
5182 Lookaside->Tag);
5184 return Entry;
5187 static __inline VOID
5188 ExFreeToPagedLookasideList(
5189 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5190 /*IN*/ PVOID Entry)
5192 Lookaside->TotalFrees++;
5193 if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
5194 Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
5195 (Lookaside->Free)(Entry);
5196 } else {
5197 InterlockedPushEntrySList(&Lookaside->ListHead,
5198 (PSLIST_ENTRY)Entry);
5202 #else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5204 NTOSAPI
5205 PVOID
5206 DDKAPI
5207 ExAllocateFromPagedLookasideList(
5208 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside);
5210 NTOSAPI
5211 VOID
5212 DDKAPI
5213 ExFreeToPagedLookasideList(
5214 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5215 /*IN*/ PVOID Entry);
5217 #endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5219 NTOSAPI
5220 PVOID
5221 DDKAPI
5222 ExAllocatePoolWithQuotaTag(
5223 /*IN*/ POOL_TYPE PoolType,
5224 /*IN*/ SIZE_T NumberOfBytes,
5225 /*IN*/ ULONG Tag);
5227 NTOSAPI
5228 PVOID
5229 DDKAPI
5230 ExAllocatePoolWithTag(
5231 /*IN*/ POOL_TYPE PoolType,
5232 /*IN*/ SIZE_T NumberOfBytes,
5233 /*IN*/ ULONG Tag);
5235 #ifdef POOL_TAGGING
5237 #define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
5238 #define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
5240 #else /* !POOL_TAGGING */
5242 NTOSAPI
5243 PVOID
5244 DDKAPI
5245 ExAllocatePool(
5246 /*IN*/ POOL_TYPE PoolType,
5247 /*IN*/ SIZE_T NumberOfBytes);
5249 NTOSAPI
5250 PVOID
5251 DDKAPI
5252 ExAllocatePoolWithQuota(
5253 /*IN*/ POOL_TYPE PoolType,
5254 /*IN*/ SIZE_T NumberOfBytes);
5256 #endif /* POOL_TAGGING */
5258 NTOSAPI
5259 PVOID
5260 DDKAPI
5261 ExAllocatePoolWithTagPriority(
5262 /*IN*/ POOL_TYPE PoolType,
5263 /*IN*/ SIZE_T NumberOfBytes,
5264 /*IN*/ ULONG Tag,
5265 /*IN*/ EX_POOL_PRIORITY Priority);
5267 NTOSAPI
5268 VOID
5269 DDKAPI
5270 ExConvertExclusiveToSharedLite(
5271 /*IN*/ PERESOURCE Resource);
5273 NTOSAPI
5274 NTSTATUS
5275 DDKAPI
5276 ExCreateCallback(
5277 /*OUT*/ PCALLBACK_OBJECT *CallbackObject,
5278 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
5279 /*IN*/ BOOLEAN Create,
5280 /*IN*/ BOOLEAN AllowMultipleCallbacks);
5282 NTOSAPI
5283 VOID
5284 DDKAPI
5285 ExDeleteNPagedLookasideList(
5286 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside);
5288 NTOSAPI
5289 VOID
5290 DDKAPI
5291 ExDeletePagedLookasideList(
5292 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside);
5294 NTOSAPI
5295 NTSTATUS
5296 DDKAPI
5297 ExDeleteResourceLite(
5298 /*IN*/ PERESOURCE Resource);
5300 NTOSAPI
5301 VOID
5302 DDKAPI
5303 ExFreePool(
5304 /*IN*/ PVOID P);
5306 #define PROTECTED_POOL 0x80000000
5308 #ifdef POOL_TAGGING
5309 #define ExFreePool(P) ExFreePoolWithTag(P, 0)
5310 #endif
5312 NTOSAPI
5313 VOID
5314 DDKAPI
5315 ExFreePoolWithTag(
5316 /*IN*/ PVOID P,
5317 /*IN*/ ULONG Tag);
5320 * ERESOURCE_THREAD
5321 * ExGetCurrentResourceThread(
5322 * VOID);
5324 #define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
5326 NTOSAPI
5327 ULONG
5328 DDKAPI
5329 ExGetExclusiveWaiterCount(
5330 /*IN*/ PERESOURCE Resource);
5332 NTOSAPI
5333 KPROCESSOR_MODE
5334 DDKAPI
5335 ExGetPreviousMode(
5336 VOID);
5338 NTOSAPI
5339 ULONG
5340 DDKAPI
5341 ExGetSharedWaiterCount(
5342 /*IN*/ PERESOURCE Resource);
5344 NTOSAPI
5345 VOID
5346 DDKAPI
5347 KeInitializeEvent(
5348 /*IN*/ PRKEVENT Event,
5349 /*IN*/ EVENT_TYPE Type,
5350 /*IN*/ BOOLEAN State);
5353 * VOID DDKAPI
5354 * ExInitializeFastMutex(
5355 * IN PFAST_MUTEX FastMutex)
5357 #define ExInitializeFastMutex(_FastMutex) \
5359 (_FastMutex)->Count = 1; \
5360 (_FastMutex)->Owner = NULL; \
5361 (_FastMutex)->Contention = 0; \
5362 KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
5365 NTOSAPI
5366 VOID
5367 DDKAPI
5368 ExInitializeNPagedLookasideList(
5369 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside,
5370 /*IN*/ PALLOCATE_FUNCTION Allocate /*OPTIONAL*/,
5371 /*IN*/ PFREE_FUNCTION Free /*OPTIONAL*/,
5372 /*IN*/ ULONG Flags,
5373 /*IN*/ SIZE_T Size,
5374 /*IN*/ ULONG Tag,
5375 /*IN*/ USHORT Depth);
5377 NTOSAPI
5378 VOID
5379 DDKAPI
5380 ExInitializePagedLookasideList(
5381 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5382 /*IN*/ PALLOCATE_FUNCTION Allocate /*OPTIONAL*/,
5383 /*IN*/ PFREE_FUNCTION Free /*OPTIONAL*/,
5384 /*IN*/ ULONG Flags,
5385 /*IN*/ SIZE_T Size,
5386 /*IN*/ ULONG Tag,
5387 /*IN*/ USHORT Depth);
5389 NTOSAPI
5390 NTSTATUS
5391 DDKAPI
5392 ExInitializeResourceLite(
5393 /*IN*/ PERESOURCE Resource);
5396 * VOID
5397 * InitializeSListHead(
5398 * IN PSLIST_HEADER SListHead)
5400 #define InitializeSListHead(_SListHead) \
5401 (_SListHead)->Alignment = 0
5403 #define ExInitializeSListHead InitializeSListHead
5405 NTOSAPI
5406 LARGE_INTEGER
5407 DDKAPI
5408 ExInterlockedAddLargeInteger(
5409 /*IN*/ PLARGE_INTEGER Addend,
5410 /*IN*/ LARGE_INTEGER Increment,
5411 /*IN*/ PKSPIN_LOCK Lock);
5413 NTOSAPI
5414 VOID
5415 DDKFASTAPI
5416 ExInterlockedAddLargeStatistic(
5417 /*IN*/ PLARGE_INTEGER Addend,
5418 /*IN*/ ULONG Increment);
5420 NTOSAPI
5421 ULONG
5422 DDKAPI
5423 ExInterlockedAddUlong(
5424 /*IN*/ PULONG Addend,
5425 /*IN*/ ULONG Increment,
5426 PKSPIN_LOCK Lock);
5428 NTOSAPI
5429 ULONG
5430 DDKFASTAPI
5431 ExfInterlockedAddUlong(
5432 /*IN*/ PULONG Addend,
5433 /*IN*/ ULONG Increment,
5434 PKSPIN_LOCK Lock);
5437 NTOSAPI
5438 LONGLONG
5439 DDKFASTAPI
5440 ExInterlockedCompareExchange64(
5441 /*IN OUT*/ PLONGLONG Destination,
5442 /*IN*/ PLONGLONG Exchange,
5443 /*IN*/ PLONGLONG Comparand,
5444 /*IN*/ PKSPIN_LOCK Lock);
5446 NTOSAPI
5447 PSINGLE_LIST_ENTRY
5448 DDKFASTAPI
5449 ExInterlockedFlushSList(
5450 /*IN*/ PSLIST_HEADER ListHead);
5452 NTOSAPI
5453 PLIST_ENTRY
5454 DDKAPI
5455 ExInterlockedInsertHeadList(
5456 /*IN*/ PLIST_ENTRY ListHead,
5457 /*IN*/ PLIST_ENTRY ListEntry,
5458 /*IN*/ PKSPIN_LOCK Lock);
5460 NTOSAPI
5461 PLIST_ENTRY
5462 DDKFASTAPI
5463 ExfInterlockedInsertHeadList(
5464 /*IN*/ PLIST_ENTRY ListHead,
5465 /*IN*/ PLIST_ENTRY ListEntry,
5466 /*IN*/ PKSPIN_LOCK Lock);
5468 NTOSAPI
5469 PLIST_ENTRY
5470 DDKAPI
5471 ExInterlockedInsertTailList(
5472 /*IN*/ PLIST_ENTRY ListHead,
5473 /*IN*/ PLIST_ENTRY ListEntry,
5474 /*IN*/ PKSPIN_LOCK Lock);
5476 NTOSAPI
5477 PLIST_ENTRY
5478 DDKFASTAPI
5479 ExfInterlockedInsertTailList(
5480 /*IN*/ PLIST_ENTRY ListHead,
5481 /*IN*/ PLIST_ENTRY ListEntry,
5482 /*IN*/ PKSPIN_LOCK Lock);
5484 NTOSAPI
5485 PSINGLE_LIST_ENTRY
5486 DDKAPI
5487 ExInterlockedPopEntryList(
5488 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5489 /*IN*/ PKSPIN_LOCK Lock);
5491 NTOSAPI
5492 PSINGLE_LIST_ENTRY
5493 DDKFASTAPI
5494 ExfInterlockedPopEntryList(
5495 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5496 /*IN*/ PKSPIN_LOCK Lock);
5499 NTOSAPI
5500 PSINGLE_LIST_ENTRY
5501 DDKAPI
5502 ExInterlockedPushEntryList(
5503 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5504 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5505 /*IN*/ PKSPIN_LOCK Lock);
5507 NTOSAPI
5508 PSINGLE_LIST_ENTRY
5509 DDKFASTAPI
5510 ExfInterlockedPushEntryList(
5511 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5512 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5513 /*IN*/ PKSPIN_LOCK Lock);
5516 NTOSAPI
5517 PLIST_ENTRY
5518 DDKAPI
5519 ExInterlockedRemoveHeadList(
5520 /*IN*/ PLIST_ENTRY ListHead,
5521 /*IN*/ PKSPIN_LOCK Lock);
5523 NTOSAPI
5524 PLIST_ENTRY
5525 DDKFASTAPI
5526 ExfInterlockedRemoveHeadList(
5527 /*IN*/ PLIST_ENTRY ListHead,
5528 /*IN*/ PKSPIN_LOCK Lock);
5531 NTOSAPI
5532 BOOLEAN
5533 DDKAPI
5534 ExIsProcessorFeaturePresent(
5535 /*IN*/ ULONG ProcessorFeature);
5537 NTOSAPI
5538 BOOLEAN
5539 DDKAPI
5540 ExIsResourceAcquiredExclusiveLite(
5541 /*IN*/ PERESOURCE Resource);
5543 NTOSAPI
5544 USHORT
5545 DDKAPI
5546 ExIsResourceAcquiredLite(
5547 /*IN*/ PERESOURCE Resource);
5549 NTOSAPI
5550 USHORT
5551 DDKAPI
5552 ExIsResourceAcquiredSharedLite(
5553 /*IN*/ PERESOURCE Resource);
5555 NTOSAPI
5556 VOID
5557 DDKAPI
5558 ExLocalTimeToSystemTime(
5559 /*IN*/ PLARGE_INTEGER LocalTime,
5560 /*OUT*/ PLARGE_INTEGER SystemTime);
5562 NTOSAPI
5563 VOID
5564 DDKAPI
5565 ExNotifyCallback(
5566 /*IN*/ PCALLBACK_OBJECT CallbackObject,
5567 /*IN*/ PVOID Argument1,
5568 /*IN*/ PVOID Argument2);
5570 NTOSAPI
5571 VOID
5572 DDKAPI
5573 ExRaiseAccessViolation(
5574 VOID);
5576 NTOSAPI
5577 VOID
5578 DDKAPI
5579 ExRaiseDatatypeMisalignment(
5580 VOID);
5582 NTOSAPI
5583 VOID
5584 DDKAPI
5585 ExRaiseStatus(
5586 /*IN*/ NTSTATUS Status);
5588 NTOSAPI
5589 PVOID
5590 DDKAPI
5591 ExRegisterCallback(
5592 /*IN*/ PCALLBACK_OBJECT CallbackObject,
5593 /*IN*/ PCALLBACK_FUNCTION CallbackFunction,
5594 /*IN*/ PVOID CallbackContext);
5596 NTOSAPI
5597 VOID
5598 DDKAPI
5599 ExReinitializeResourceLite(
5600 /*IN*/ PERESOURCE Resource);
5602 NTOSAPI
5603 VOID
5604 DDKFASTAPI
5605 ExReleaseFastMutex(
5606 /*IN*/ PFAST_MUTEX FastMutex);
5608 NTOSAPI
5609 VOID
5610 DDKFASTAPI
5611 ExReleaseFastMutexUnsafe(
5612 /*IN*/ PFAST_MUTEX FastMutex);
5614 NTOSAPI
5615 VOID
5616 DDKAPI
5617 ExReleaseResourceForThreadLite(
5618 /*IN*/ PERESOURCE Resource,
5619 /*IN*/ ERESOURCE_THREAD ResourceThreadId);
5621 NTOSAPI
5622 VOID
5623 DDKFASTAPI
5624 ExReleaseResourceLite(
5625 /*IN*/ PERESOURCE Resource);
5627 NTOSAPI
5628 VOID
5629 DDKAPI
5630 ExSetResourceOwnerPointer(
5631 /*IN*/ PERESOURCE Resource,
5632 /*IN*/ PVOID OwnerPointer);
5634 NTOSAPI
5635 ULONG
5636 DDKAPI
5637 ExSetTimerResolution(
5638 /*IN*/ ULONG DesiredTime,
5639 /*IN*/ BOOLEAN SetResolution);
5641 NTOSAPI
5642 VOID
5643 DDKAPI
5644 ExSystemTimeToLocalTime(
5645 /*IN*/ PLARGE_INTEGER SystemTime,
5646 /*OUT*/ PLARGE_INTEGER LocalTime);
5648 NTOSAPI
5649 BOOLEAN
5650 DDKFASTAPI
5651 ExTryToAcquireFastMutex(
5652 /*IN*/ PFAST_MUTEX FastMutex);
5654 NTOSAPI
5655 BOOLEAN
5656 DDKAPI
5657 ExTryToAcquireResourceExclusiveLite(
5658 /*IN*/ PERESOURCE Resource);
5660 NTOSAPI
5661 VOID
5662 DDKAPI
5663 ExUnregisterCallback(
5664 /*IN*/ PVOID CbRegistration);
5666 NTOSAPI
5667 NTSTATUS
5668 DDKAPI
5669 ExUuidCreate(
5670 /*OUT*/ UUID *Uuid);
5672 NTOSAPI
5673 BOOLEAN
5674 DDKAPI
5675 ExVerifySuite(
5676 /*IN*/ SUITE_TYPE SuiteType);
5678 #ifdef DBG
5680 #define PAGED_CODE() { \
5681 if (KeGetCurrentIrql() > APC_LEVEL) { \
5682 KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
5683 ASSERT(FALSE); \
5687 #else
5689 #define PAGED_CODE()
5691 #endif
5693 NTOSAPI
5694 VOID
5695 DDKAPI
5696 ProbeForRead(
5697 /*IN*/ CONST VOID *Address,
5698 /*IN*/ ULONG Length,
5699 /*IN*/ ULONG Alignment);
5701 NTOSAPI
5702 VOID
5703 DDKAPI
5704 ProbeForWrite(
5705 /*IN*/ CONST VOID *Address,
5706 /*IN*/ ULONG Length,
5707 /*IN*/ ULONG Alignment);
5711 /** Configuration manager routines **/
5713 NTOSAPI
5714 NTSTATUS
5715 DDKAPI
5716 CmRegisterCallback(
5717 /*IN*/ PEX_CALLBACK_FUNCTION Function,
5718 /*IN*/ PVOID Context,
5719 /*IN OUT*/ PLARGE_INTEGER Cookie);
5721 NTOSAPI
5722 NTSTATUS
5723 DDKAPI
5724 CmUnRegisterCallback(
5725 /*IN*/ LARGE_INTEGER Cookie);
5729 /** Filesystem runtime library routines **/
5731 NTOSAPI
5732 BOOLEAN
5733 DDKAPI
5734 FsRtlIsTotalDeviceFailure(
5735 /*IN*/ NTSTATUS Status);
5739 /** Hardware abstraction layer routines **/
5741 NTOSAPI
5742 VOID
5743 DDKFASTAPI
5744 HalExamineMBR(
5745 /*IN*/ PDEVICE_OBJECT DeviceObject,
5746 /*IN*/ ULONG SectorSize,
5747 /*IN*/ ULONG MBRTypeIdentifier,
5748 /*OUT*/ PVOID Buffer);
5750 NTOSAPI
5751 VOID
5752 DDKAPI
5753 READ_PORT_BUFFER_UCHAR(
5754 /*IN*/ PUCHAR Port,
5755 /*IN*/ PUCHAR Buffer,
5756 /*IN*/ ULONG Count);
5758 NTOSAPI
5759 VOID
5760 DDKAPI
5761 READ_PORT_BUFFER_ULONG(
5762 /*IN*/ PULONG Port,
5763 /*IN*/ PULONG Buffer,
5764 /*IN*/ ULONG Count);
5766 NTOSAPI
5767 VOID
5768 DDKAPI
5769 READ_PORT_BUFFER_USHORT(
5770 /*IN*/ PUSHORT Port,
5771 /*IN*/ PUSHORT Buffer,
5772 /*IN*/ ULONG Count);
5774 NTOSAPI
5775 UCHAR
5776 DDKAPI
5777 READ_PORT_UCHAR(
5778 /*IN*/ PUCHAR Port);
5780 NTOSAPI
5781 ULONG
5782 DDKAPI
5783 READ_PORT_ULONG(
5784 /*IN*/ PULONG Port);
5786 NTOSAPI
5787 USHORT
5788 DDKAPI
5789 READ_PORT_USHORT(
5790 /*IN*/ PUSHORT Port);
5792 NTOSAPI
5793 VOID
5794 DDKAPI
5795 READ_REGISTER_BUFFER_UCHAR(
5796 /*IN*/ PUCHAR Register,
5797 /*IN*/ PUCHAR Buffer,
5798 /*IN*/ ULONG Count);
5800 NTOSAPI
5801 VOID
5802 DDKAPI
5803 READ_REGISTER_BUFFER_ULONG(
5804 /*IN*/ PULONG Register,
5805 /*IN*/ PULONG Buffer,
5806 /*IN*/ ULONG Count);
5808 NTOSAPI
5809 VOID
5810 DDKAPI
5811 READ_REGISTER_BUFFER_USHORT(
5812 /*IN*/ PUSHORT Register,
5813 /*IN*/ PUSHORT Buffer,
5814 /*IN*/ ULONG Count);
5816 NTOSAPI
5817 UCHAR
5818 DDKAPI
5819 READ_REGISTER_UCHAR(
5820 /*IN*/ PUCHAR Register);
5822 NTOSAPI
5823 ULONG
5824 DDKAPI
5825 READ_REGISTER_ULONG(
5826 /*IN*/ PULONG Register);
5828 NTOSAPI
5829 USHORT
5830 DDKAPI
5831 READ_REGISTER_USHORT(
5832 /*IN*/ PUSHORT Register);
5834 NTOSAPI
5835 VOID
5836 DDKAPI
5837 WRITE_PORT_BUFFER_UCHAR(
5838 /*IN*/ PUCHAR Port,
5839 /*IN*/ PUCHAR Buffer,
5840 /*IN*/ ULONG Count);
5842 NTOSAPI
5843 VOID
5844 DDKAPI
5845 WRITE_PORT_BUFFER_ULONG(
5846 /*IN*/ PULONG Port,
5847 /*IN*/ PULONG Buffer,
5848 /*IN*/ ULONG Count);
5850 NTOSAPI
5851 VOID
5852 DDKAPI
5853 WRITE_PORT_BUFFER_USHORT(
5854 /*IN*/ PUSHORT Port,
5855 /*IN*/ PUSHORT Buffer,
5856 /*IN*/ ULONG Count);
5858 NTOSAPI
5859 VOID
5860 DDKAPI
5861 WRITE_PORT_UCHAR(
5862 /*IN*/ PUCHAR Port,
5863 /*IN*/ UCHAR Value);
5865 NTOSAPI
5866 VOID
5867 DDKAPI
5868 WRITE_PORT_ULONG(
5869 /*IN*/ PULONG Port,
5870 /*IN*/ ULONG Value);
5872 NTOSAPI
5873 VOID
5874 DDKAPI
5875 WRITE_PORT_USHORT(
5876 /*IN*/ PUSHORT Port,
5877 /*IN*/ USHORT Value);
5879 NTOSAPI
5880 VOID
5881 DDKAPI
5882 WRITE_REGISTER_BUFFER_UCHAR(
5883 /*IN*/ PUCHAR Register,
5884 /*IN*/ PUCHAR Buffer,
5885 /*IN*/ ULONG Count);
5887 NTOSAPI
5888 VOID
5889 DDKAPI
5890 WRITE_REGISTER_BUFFER_ULONG(
5891 /*IN*/ PULONG Register,
5892 /*IN*/ PULONG Buffer,
5893 /*IN*/ ULONG Count);
5895 NTOSAPI
5896 VOID
5897 DDKAPI
5898 WRITE_REGISTER_BUFFER_USHORT(
5899 /*IN*/ PUSHORT Register,
5900 /*IN*/ PUSHORT Buffer,
5901 /*IN*/ ULONG Count);
5903 NTOSAPI
5904 VOID
5905 DDKAPI
5906 WRITE_REGISTER_UCHAR(
5907 /*IN*/ PUCHAR Register,
5908 /*IN*/ UCHAR Value);
5910 NTOSAPI
5911 VOID
5912 DDKAPI
5913 WRITE_REGISTER_ULONG(
5914 /*IN*/ PULONG Register,
5915 /*IN*/ ULONG Value);
5917 NTOSAPI
5918 VOID
5919 DDKAPI
5920 WRITE_REGISTER_USHORT(
5921 /*IN*/ PUSHORT Register,
5922 /*IN*/ USHORT Value);
5924 /** I/O manager routines **/
5926 NTOSAPI
5927 VOID
5928 DDKAPI
5929 IoAcquireCancelSpinLock(
5930 /*OUT*/ PKIRQL Irql);
5932 NTOSAPI
5933 NTSTATUS
5934 DDKAPI
5935 IoAcquireRemoveLockEx(
5936 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
5937 /*IN*/ PVOID Tag /*OPTIONAL*/,
5938 /*IN*/ PCSTR File,
5939 /*IN*/ ULONG Line,
5940 /*IN*/ ULONG RemlockSize);
5943 * NTSTATUS
5944 * IoAcquireRemoveLock(
5945 * IN PIO_REMOVE_LOCK RemoveLock,
5946 * IN PVOID Tag OPTIONAL)
5948 #define IoAcquireRemoveLock(_RemoveLock, \
5949 _Tag) \
5950 IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
5953 * VOID
5954 * IoAdjustPagingPathCount(
5955 * IN PLONG Count,
5956 * IN BOOLEAN Increment)
5958 #define IoAdjustPagingPathCount(_Count, \
5959 _Increment) \
5961 if (_Increment) \
5963 InterlockedIncrement(_Count); \
5965 else \
5967 InterlockedDecrement(_Count); \
5971 NTOSAPI
5972 VOID
5973 DDKAPI
5974 IoAllocateController(
5975 /*IN*/ PCONTROLLER_OBJECT ControllerObject,
5976 /*IN*/ PDEVICE_OBJECT DeviceObject,
5977 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
5978 /*IN*/ PVOID Context);
5980 NTOSAPI
5981 NTSTATUS
5982 DDKAPI
5983 IoAllocateDriverObjectExtension(
5984 /*IN*/ PDRIVER_OBJECT DriverObject,
5985 /*IN*/ PVOID ClientIdentificationAddress,
5986 /*IN*/ ULONG DriverObjectExtensionSize,
5987 /*OUT*/ PVOID *DriverObjectExtension);
5989 typedef struct _IO_ERROR_LOG_PACKET {
5990 UCHAR MajorFunctionCode;
5991 UCHAR RetryCount;
5992 USHORT DumpDataSize;
5993 USHORT NumberOfStrings;
5994 USHORT StringOffset;
5995 USHORT EventCategory;
5996 NTSTATUS ErrorCode;
5997 ULONG UniqueErrorValue;
5998 NTSTATUS FinalStatus;
5999 ULONG SequenceNumber;
6000 ULONG IoControlCode;
6001 LARGE_INTEGER DeviceOffset;
6002 ULONG DumpData[1];
6003 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
6005 NTOSAPI
6006 PVOID
6007 DDKAPI
6008 IoAllocateErrorLogEntry(
6009 /*IN*/ PVOID IoObject,
6010 /*IN*/ UCHAR EntrySize);
6012 NTOSAPI
6013 PIRP
6014 DDKAPI
6015 IoAllocateIrp(
6016 /*IN*/ CCHAR StackSize,
6017 /*IN*/ BOOLEAN ChargeQuota);
6019 NTOSAPI
6020 PMDL
6021 DDKAPI
6022 IoAllocateMdl(
6023 /*IN*/ PVOID VirtualAddress,
6024 /*IN*/ ULONG Length,
6025 /*IN*/ BOOLEAN SecondaryBuffer,
6026 /*IN*/ BOOLEAN ChargeQuota,
6027 /*IN OUT*/ PIRP Irp /*OPTIONAL*/);
6029 NTOSAPI
6030 PIO_WORKITEM
6031 DDKAPI
6032 IoAllocateWorkItem(
6033 /*IN*/ PDEVICE_OBJECT DeviceObject);
6036 * VOID IoAssignArcName(
6037 * IN PUNICODE_STRING ArcName,
6038 * IN PUNICODE_STRING DeviceName);
6040 #define IoAssignArcName(_ArcName, _DeviceName) ( \
6041 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
6043 NTOSAPI
6044 NTSTATUS
6045 DDKAPI
6046 IoAttachDevice(
6047 /*IN*/ PDEVICE_OBJECT SourceDevice,
6048 /*IN*/ PUNICODE_STRING TargetDevice,
6049 /*OUT*/ PDEVICE_OBJECT *AttachedDevice);
6051 NTOSAPI
6052 PDEVICE_OBJECT
6053 DDKAPI
6054 IoAttachDeviceToDeviceStack(
6055 /*IN*/ PDEVICE_OBJECT SourceDevice,
6056 /*IN*/ PDEVICE_OBJECT TargetDevice);
6058 NTOSAPI
6059 PIRP
6060 DDKAPI
6061 IoBuildAsynchronousFsdRequest(
6062 /*IN*/ ULONG MajorFunction,
6063 /*IN*/ PDEVICE_OBJECT DeviceObject,
6064 /*IN OUT*/ PVOID Buffer /*OPTIONAL*/,
6065 /*IN*/ ULONG Length /*OPTIONAL*/,
6066 /*IN*/ PLARGE_INTEGER StartingOffset /*OPTIONAL*/,
6067 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock /*OPTIONAL*/);
6069 NTOSAPI
6070 PIRP
6071 DDKAPI
6072 IoBuildDeviceIoControlRequest(
6073 /*IN*/ ULONG IoControlCode,
6074 /*IN*/ PDEVICE_OBJECT DeviceObject,
6075 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
6076 /*IN*/ ULONG InputBufferLength,
6077 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
6078 /*IN*/ ULONG OutputBufferLength,
6079 /*IN*/ BOOLEAN InternalDeviceIoControl,
6080 /*IN*/ PKEVENT Event,
6081 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
6083 NTOSAPI
6084 VOID
6085 DDKAPI
6086 IoBuildPartialMdl(
6087 /*IN*/ PMDL SourceMdl,
6088 /*IN OUT*/ PMDL TargetMdl,
6089 /*IN*/ PVOID VirtualAddress,
6090 /*IN*/ ULONG Length);
6092 NTOSAPI
6093 PIRP
6094 DDKAPI
6095 IoBuildSynchronousFsdRequest(
6096 /*IN*/ ULONG MajorFunction,
6097 /*IN*/ PDEVICE_OBJECT DeviceObject,
6098 /*IN OUT*/ PVOID Buffer /*OPTIONAL*/,
6099 /*IN*/ ULONG Length /*OPTIONAL*/,
6100 /*IN*/ PLARGE_INTEGER StartingOffset /*OPTIONAL*/,
6101 /*IN*/ PKEVENT Event,
6102 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
6104 NTOSAPI
6105 NTSTATUS
6106 DDKFASTAPI
6107 IofCallDriver(
6108 /*IN*/ PDEVICE_OBJECT DeviceObject,
6109 /*IN OUT*/ PIRP Irp);
6112 * NTSTATUS
6113 * IoCallDriver(
6114 * IN PDEVICE_OBJECT DeviceObject,
6115 * IN OUT PIRP Irp)
6117 #define IoCallDriver IofCallDriver
6119 NTOSAPI
6120 VOID
6121 DDKAPI
6122 IoCancelFileOpen(
6123 /*IN*/ PDEVICE_OBJECT DeviceObject,
6124 /*IN*/ PFILE_OBJECT FileObject);
6126 NTOSAPI
6127 BOOLEAN
6128 DDKAPI
6129 IoCancelIrp(
6130 /*IN*/ PIRP Irp);
6132 NTOSAPI
6133 NTSTATUS
6134 DDKAPI
6135 IoCheckShareAccess(
6136 /*IN*/ ACCESS_MASK DesiredAccess,
6137 /*IN*/ ULONG DesiredShareAccess,
6138 /*IN OUT*/ PFILE_OBJECT FileObject,
6139 /*IN OUT*/ PSHARE_ACCESS ShareAccess,
6140 /*IN*/ BOOLEAN Update);
6142 NTOSAPI
6143 VOID
6144 DDKFASTAPI
6145 IofCompleteRequest(
6146 /*IN*/ PIRP Irp,
6147 /*IN*/ CCHAR PriorityBoost);
6150 * VOID
6151 * IoCompleteRequest(
6152 * IN PIRP Irp,
6153 * IN CCHAR PriorityBoost)
6155 #define IoCompleteRequest IofCompleteRequest
6157 NTOSAPI
6158 NTSTATUS
6159 DDKAPI
6160 IoConnectInterrupt(
6161 /*OUT*/ PKINTERRUPT *InterruptObject,
6162 /*IN*/ PKSERVICE_ROUTINE ServiceRoutine,
6163 /*IN*/ PVOID ServiceContext,
6164 /*IN*/ PKSPIN_LOCK SpinLock /*OPTIONAL*/,
6165 /*IN*/ ULONG Vector,
6166 /*IN*/ KIRQL Irql,
6167 /*IN*/ KIRQL SynchronizeIrql,
6168 /*IN*/ KINTERRUPT_MODE InterruptMode,
6169 /*IN*/ BOOLEAN ShareVector,
6170 /*IN*/ KAFFINITY ProcessorEnableMask,
6171 /*IN*/ BOOLEAN FloatingSave);
6174 * PIO_STACK_LOCATION
6175 * IoGetCurrentIrpStackLocation(
6176 * IN PIRP Irp)
6178 #define IoGetCurrentIrpStackLocation(_Irp) \
6179 ((_Irp)->Tail.Overlay.CurrentStackLocation)
6182 * PIO_STACK_LOCATION
6183 * IoGetNextIrpStackLocation(
6184 * IN PIRP Irp)
6186 #define IoGetNextIrpStackLocation(_Irp) \
6187 ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
6190 * VOID
6191 * IoCopyCurrentIrpStackLocationToNext(
6192 * IN PIRP Irp)
6194 #define IoCopyCurrentIrpStackLocationToNext(_Irp) \
6196 PIO_STACK_LOCATION _IrpSp; \
6197 PIO_STACK_LOCATION _NextIrpSp; \
6198 _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
6199 _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
6200 RtlCopyMemory(_NextIrpSp, _IrpSp, \
6201 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
6202 _NextIrpSp->Control = 0; \
6205 NTOSAPI
6206 PCONTROLLER_OBJECT
6207 DDKAPI
6208 IoCreateController(
6209 /*IN*/ ULONG Size);
6211 NTOSAPI
6212 NTSTATUS
6213 DDKAPI
6214 IoCreateDevice(
6215 /*IN*/ PDRIVER_OBJECT DriverObject,
6216 /*IN*/ ULONG DeviceExtensionSize,
6217 /*IN*/ PUNICODE_STRING DeviceName /*OPTIONAL*/,
6218 /*IN*/ DEVICE_TYPE DeviceType,
6219 /*IN*/ ULONG DeviceCharacteristics,
6220 /*IN*/ BOOLEAN Exclusive,
6221 /*OUT*/ PDEVICE_OBJECT *DeviceObject);
6223 NTOSAPI
6224 NTSTATUS
6225 DDKAPI
6226 IoCreateDisk(
6227 /*IN*/ PDEVICE_OBJECT DeviceObject,
6228 /*IN*/ PCREATE_DISK Disk);
6230 NTOSAPI
6231 NTSTATUS
6232 DDKAPI
6233 IoCreateFile(
6234 /*OUT*/ PHANDLE FileHandle,
6235 /*IN*/ ACCESS_MASK DesiredAccess,
6236 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
6237 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
6238 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
6239 /*IN*/ ULONG FileAttributes,
6240 /*IN*/ ULONG ShareAccess,
6241 /*IN*/ ULONG Disposition,
6242 /*IN*/ ULONG CreateOptions,
6243 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
6244 /*IN*/ ULONG EaLength,
6245 /*IN*/ CREATE_FILE_TYPE CreateFileType,
6246 /*IN*/ PVOID ExtraCreateParameters /*OPTIONAL*/,
6247 /*IN*/ ULONG Options);
6249 NTOSAPI
6250 PKEVENT
6251 DDKAPI
6252 IoCreateNotificationEvent(
6253 /*IN*/ PUNICODE_STRING EventName,
6254 /*OUT*/ PHANDLE EventHandle);
6256 NTOSAPI
6257 NTSTATUS
6258 DDKAPI
6259 IoCreateSymbolicLink(
6260 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6261 /*IN*/ PUNICODE_STRING DeviceName);
6263 NTOSAPI
6264 PKEVENT
6265 DDKAPI
6266 IoCreateSynchronizationEvent(
6267 /*IN*/ PUNICODE_STRING EventName,
6268 /*OUT*/ PHANDLE EventHandle);
6270 NTOSAPI
6271 NTSTATUS
6272 DDKAPI
6273 IoCreateUnprotectedSymbolicLink(
6274 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6275 /*IN*/ PUNICODE_STRING DeviceName);
6277 NTOSAPI
6278 VOID
6279 DDKAPI
6280 IoCsqInitialize(
6281 PIO_CSQ Csq,
6282 /*IN*/ PIO_CSQ_INSERT_IRP CsqInsertIrp,
6283 /*IN*/ PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
6284 /*IN*/ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
6285 /*IN*/ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
6286 /*IN*/ PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
6287 /*IN*/ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
6289 NTOSAPI
6290 VOID
6291 DDKAPI
6292 IoCsqInsertIrp(
6293 /*IN*/ PIO_CSQ Csq,
6294 /*IN*/ PIRP Irp,
6295 /*IN*/ PIO_CSQ_IRP_CONTEXT Context);
6297 NTOSAPI
6298 PIRP
6299 DDKAPI
6300 IoCsqRemoveIrp(
6301 /*IN*/ PIO_CSQ Csq,
6302 /*IN*/ PIO_CSQ_IRP_CONTEXT Context);
6304 NTOSAPI
6305 PIRP
6306 DDKAPI
6307 IoCsqRemoveNextIrp(
6308 /*IN*/ PIO_CSQ Csq,
6309 /*IN*/ PVOID PeekContext);
6311 NTOSAPI
6312 VOID
6313 DDKAPI
6314 IoDeleteController(
6315 /*IN*/ PCONTROLLER_OBJECT ControllerObject);
6317 NTOSAPI
6318 VOID
6319 DDKAPI
6320 IoDeleteDevice(
6321 /*IN*/ PDEVICE_OBJECT DeviceObject);
6323 NTOSAPI
6324 NTSTATUS
6325 DDKAPI
6326 IoDeleteSymbolicLink(
6327 /*IN*/ PUNICODE_STRING SymbolicLinkName);
6330 * VOID
6331 * IoDeassignArcName(
6332 * IN PUNICODE_STRING ArcName)
6334 #define IoDeassignArcName IoDeleteSymbolicLink
6336 NTOSAPI
6337 VOID
6338 DDKAPI
6339 IoDetachDevice(
6340 /*IN OUT*/ PDEVICE_OBJECT TargetDevice);
6342 NTOSAPI
6343 VOID
6344 DDKAPI
6345 IoDisconnectInterrupt(
6346 /*IN*/ PKINTERRUPT InterruptObject);
6348 NTOSAPI
6349 BOOLEAN
6350 DDKAPI
6351 IoForwardIrpSynchronously(
6352 /*IN*/ PDEVICE_OBJECT DeviceObject,
6353 /*IN*/ PIRP Irp);
6355 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
6357 NTOSAPI
6358 VOID
6359 DDKAPI
6360 IoFreeController(
6361 /*IN*/ PCONTROLLER_OBJECT ControllerObject);
6363 NTOSAPI
6364 VOID
6365 DDKAPI
6366 IoFreeErrorLogEntry(
6367 PVOID ElEntry);
6369 NTOSAPI
6370 VOID
6371 DDKAPI
6372 IoFreeIrp(
6373 /*IN*/ PIRP Irp);
6375 NTOSAPI
6376 VOID
6377 DDKAPI
6378 IoFreeMdl(
6379 /*IN*/ PMDL Mdl);
6381 NTOSAPI
6382 VOID
6383 DDKAPI
6384 IoFreeWorkItem(
6385 /*IN*/ PIO_WORKITEM pIOWorkItem);
6387 NTOSAPI
6388 PDEVICE_OBJECT
6389 DDKAPI
6390 IoGetAttachedDevice(
6391 /*IN*/ PDEVICE_OBJECT DeviceObject);
6393 NTOSAPI
6394 PDEVICE_OBJECT
6395 DDKAPI
6396 IoGetAttachedDeviceReference(
6397 /*IN*/ PDEVICE_OBJECT DeviceObject);
6399 NTOSAPI
6400 NTSTATUS
6401 DDKAPI
6402 IoGetBootDiskInformation(
6403 /*IN OUT*/ PBOOTDISK_INFORMATION BootDiskInformation,
6404 /*IN*/ ULONG Size);
6406 NTOSAPI
6407 PCONFIGURATION_INFORMATION
6408 DDKAPI
6409 IoGetConfigurationInformation(
6410 VOID);
6412 NTOSAPI
6413 PEPROCESS
6414 DDKAPI
6415 IoGetCurrentProcess(
6416 VOID);
6418 NTOSAPI
6419 NTSTATUS
6420 DDKAPI
6421 IoGetDeviceInterfaceAlias(
6422 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6423 /*IN*/ CONST GUID *AliasInterfaceClassGuid,
6424 /*OUT*/ PUNICODE_STRING AliasSymbolicLinkName);
6426 NTOSAPI
6427 NTSTATUS
6428 DDKAPI
6429 IoGetDeviceInterfaces(
6430 /*IN*/ CONST GUID *InterfaceClassGuid,
6431 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject /*OPTIONAL*/,
6432 /*IN*/ ULONG Flags,
6433 /*OUT*/ PWSTR *SymbolicLinkList);
6435 NTOSAPI
6436 NTSTATUS
6437 DDKAPI
6438 IoGetDeviceObjectPointer(
6439 /*IN*/ PUNICODE_STRING ObjectName,
6440 /*IN*/ ACCESS_MASK DesiredAccess,
6441 /*OUT*/ PFILE_OBJECT *FileObject,
6442 /*OUT*/ PDEVICE_OBJECT *DeviceObject);
6444 NTOSAPI
6445 NTSTATUS
6446 DDKAPI
6447 IoGetDeviceProperty(
6448 /*IN*/ PDEVICE_OBJECT DeviceObject,
6449 /*IN*/ DEVICE_REGISTRY_PROPERTY DeviceProperty,
6450 /*IN*/ ULONG BufferLength,
6451 /*OUT*/ PVOID PropertyBuffer,
6452 /*OUT*/ PULONG ResultLength);
6454 NTOSAPI
6455 PDEVICE_OBJECT
6456 DDKAPI
6457 IoGetDeviceToVerify(
6458 /*IN*/ PETHREAD Thread);
6460 NTOSAPI
6461 PDMA_ADAPTER
6462 DDKAPI
6463 IoGetDmaAdapter(
6464 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6465 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription,
6466 /*IN OUT*/ PULONG NumberOfMapRegisters);
6468 NTOSAPI
6469 PVOID
6470 DDKAPI
6471 IoGetDriverObjectExtension(
6472 /*IN*/ PDRIVER_OBJECT DriverObject,
6473 /*IN*/ PVOID ClientIdentificationAddress);
6475 NTOSAPI
6476 PGENERIC_MAPPING
6477 DDKAPI
6478 IoGetFileObjectGenericMapping(
6479 VOID);
6482 * ULONG
6483 * IoGetFunctionCodeFromCtlCode(
6484 * IN ULONG ControlCode)
6486 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
6487 (((_ControlCode) >> 2) & 0x00000FFF)
6489 NTOSAPI
6490 PVOID
6491 DDKAPI
6492 IoGetInitialStack(
6493 VOID);
6495 NTOSAPI
6496 PDEVICE_OBJECT
6497 DDKAPI
6498 IoGetRelatedDeviceObject(
6499 /*IN*/ PFILE_OBJECT FileObject);
6501 NTOSAPI
6502 ULONG
6503 DDKAPI
6504 IoGetRemainingStackSize(
6505 VOID);
6507 NTOSAPI
6508 VOID
6509 DDKAPI
6510 IoGetStackLimits(
6511 /*OUT*/ PULONG_PTR LowLimit,
6512 /*OUT*/ PULONG_PTR HighLimit);
6514 NTOSAPI
6515 VOID
6516 DDKAPI
6517 KeInitializeDpc(
6518 /*IN*/ PRKDPC Dpc,
6519 /*IN*/ PKDEFERRED_ROUTINE DeferredRoutine,
6520 /*IN*/ PVOID DeferredContext);
6523 * VOID
6524 * IoInitializeDpcRequest(
6525 * IN PDEVICE_OBJECT DeviceObject,
6526 * IN PIO_DPC_ROUTINE DpcRoutine)
6528 #define IoInitializeDpcRequest(_DeviceObject, \
6529 _DpcRoutine) \
6530 KeInitializeDpc(&(_DeviceObject)->Dpc, \
6531 (PKDEFERRED_ROUTINE) (_DpcRoutine), \
6532 _DeviceObject)
6534 NTOSAPI
6535 VOID
6536 DDKAPI
6537 IoInitializeIrp(
6538 /*IN OUT*/ PIRP Irp,
6539 /*IN*/ USHORT PacketSize,
6540 /*IN*/ CCHAR StackSize);
6542 NTOSAPI
6543 VOID
6544 DDKAPI
6545 IoInitializeRemoveLockEx(
6546 /*IN*/ PIO_REMOVE_LOCK Lock,
6547 /*IN*/ ULONG AllocateTag,
6548 /*IN*/ ULONG MaxLockedMinutes,
6549 /*IN*/ ULONG HighWatermark,
6550 /*IN*/ ULONG RemlockSize);
6552 /* VOID
6553 * IoInitializeRemoveLock(
6554 * IN PIO_REMOVE_LOCK Lock,
6555 * IN ULONG AllocateTag,
6556 * IN ULONG MaxLockedMinutes,
6557 * IN ULONG HighWatermark)
6559 #define IoInitializeRemoveLock( \
6560 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
6561 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
6562 HighWatermark, sizeof(IO_REMOVE_LOCK))
6564 NTOSAPI
6565 NTSTATUS
6566 DDKAPI
6567 IoInitializeTimer(
6568 /*IN*/ PDEVICE_OBJECT DeviceObject,
6569 /*IN*/ PIO_TIMER_ROUTINE TimerRoutine,
6570 /*IN*/ PVOID Context);
6572 NTOSAPI
6573 VOID
6574 DDKAPI
6575 IoInvalidateDeviceRelations(
6576 /*IN*/ PDEVICE_OBJECT DeviceObject,
6577 /*IN*/ DEVICE_RELATION_TYPE Type);
6579 NTOSAPI
6580 VOID
6581 DDKAPI
6582 IoInvalidateDeviceState(
6583 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject);
6585 NTOSAPI
6586 BOOLEAN
6587 DDKAPI
6588 IoIs32bitProcess(
6589 /*IN*/ PIRP Irp /*OPTIONAL*/);
6592 * BOOLEAN
6593 * IoIsErrorUserInduced(
6594 * IN NTSTATUS Status);
6596 #define IoIsErrorUserInduced(Status) \
6597 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
6598 ((Status) == STATUS_IO_TIMEOUT) || \
6599 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
6600 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
6601 ((Status) == STATUS_VERIFY_REQUIRED) || \
6602 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
6603 ((Status) == STATUS_WRONG_VOLUME)))
6605 NTOSAPI
6606 BOOLEAN
6607 DDKAPI
6608 IoIsWdmVersionAvailable(
6609 /*IN*/ UCHAR MajorVersion,
6610 /*IN*/ UCHAR MinorVersion);
6612 NTOSAPI
6613 PIRP
6614 DDKAPI
6615 IoMakeAssociatedIrp(
6616 /*IN*/ PIRP Irp,
6617 /*IN*/ CCHAR StackSize);
6620 * VOID
6621 * IoMarkIrpPending(
6622 * IN OUT PIRP Irp)
6624 #define IoMarkIrpPending(_Irp) \
6625 (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
6627 NTOSAPI
6628 NTSTATUS
6629 DDKAPI
6630 IoOpenDeviceInterfaceRegistryKey(
6631 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6632 /*IN*/ ACCESS_MASK DesiredAccess,
6633 /*OUT*/ PHANDLE DeviceInterfaceKey);
6635 NTOSAPI
6636 NTSTATUS
6637 DDKAPI
6638 IoOpenDeviceRegistryKey(
6639 /*IN*/ PDEVICE_OBJECT DeviceObject,
6640 /*IN*/ ULONG DevInstKeyType,
6641 /*IN*/ ACCESS_MASK DesiredAccess,
6642 /*OUT*/ PHANDLE DevInstRegKey);
6644 NTOSAPI
6645 NTSTATUS
6646 DDKAPI
6647 IoQueryDeviceDescription(
6648 /*IN*/ PINTERFACE_TYPE BusType /*OPTIONAL*/,
6649 /*IN*/ PULONG BusNumber /*OPTIONAL*/,
6650 /*IN*/ PCONFIGURATION_TYPE ControllerType /*OPTIONAL*/,
6651 /*IN*/ PULONG ControllerNumber /*OPTIONAL*/,
6652 /*IN*/ PCONFIGURATION_TYPE PeripheralType /*OPTIONAL*/,
6653 /*IN*/ PULONG PeripheralNumber /*OPTIONAL*/,
6654 /*IN*/ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
6655 /*IN*/ PVOID Context);
6657 NTOSAPI
6658 VOID
6659 DDKAPI
6660 IoQueueWorkItem(
6661 /*IN*/ PIO_WORKITEM pIOWorkItem,
6662 /*IN*/ PIO_WORKITEM_ROUTINE Routine,
6663 /*IN*/ WORK_QUEUE_TYPE QueueType,
6664 /*IN*/ PVOID Context);
6666 NTOSAPI
6667 VOID
6668 DDKAPI
6669 IoRaiseHardError(
6670 /*IN*/ PIRP Irp,
6671 /*IN*/ PVPB Vpb /*OPTIONAL*/,
6672 /*IN*/ PDEVICE_OBJECT RealDeviceObject);
6674 NTOSAPI
6675 BOOLEAN
6676 DDKAPI
6677 IoRaiseInformationalHardError(
6678 /*IN*/ NTSTATUS ErrorStatus,
6679 /*IN*/ PUNICODE_STRING String /*OPTIONAL*/,
6680 /*IN*/ PKTHREAD Thread /*OPTIONAL*/);
6682 NTOSAPI
6683 NTSTATUS
6684 DDKAPI
6685 IoReadDiskSignature(
6686 /*IN*/ PDEVICE_OBJECT DeviceObject,
6687 /*IN*/ ULONG BytesPerSector,
6688 /*OUT*/ PDISK_SIGNATURE Signature);
6690 NTOSAPI
6691 NTSTATUS
6692 DDKAPI
6693 IoReadPartitionTableEx(
6694 /*IN*/ PDEVICE_OBJECT DeviceObject,
6695 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer);
6697 NTOSAPI
6698 VOID
6699 DDKAPI
6700 IoRegisterBootDriverReinitialization(
6701 /*IN*/ PDRIVER_OBJECT DriverObject,
6702 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6703 /*IN*/ PVOID Context);
6705 NTOSAPI
6706 VOID
6707 DDKAPI
6708 IoRegisterBootDriverReinitialization(
6709 /*IN*/ PDRIVER_OBJECT DriverObject,
6710 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6711 /*IN*/ PVOID Context);
6713 NTOSAPI
6714 NTSTATUS
6715 DDKAPI
6716 IoRegisterDeviceInterface(
6717 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6718 /*IN*/ CONST GUID *InterfaceClassGuid,
6719 /*IN*/ PUNICODE_STRING ReferenceString /*OPTIONAL*/,
6720 /*OUT*/ PUNICODE_STRING SymbolicLinkName);
6722 NTOSAPI
6723 VOID
6724 DDKAPI
6725 IoRegisterDriverReinitialization(
6726 /*IN*/ PDRIVER_OBJECT DriverObject,
6727 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6728 /*IN*/ PVOID Context);
6730 NTOSAPI
6731 NTSTATUS
6732 DDKAPI
6733 IoRegisterPlugPlayNotification(
6734 /*IN*/ IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
6735 /*IN*/ ULONG EventCategoryFlags,
6736 /*IN*/ PVOID EventCategoryData /*OPTIONAL*/,
6737 /*IN*/ PDRIVER_OBJECT DriverObject,
6738 /*IN*/ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
6739 /*IN*/ PVOID Context,
6740 /*OUT*/ PVOID *NotificationEntry);
6742 NTOSAPI
6743 NTSTATUS
6744 DDKAPI
6745 IoRegisterShutdownNotification(
6746 /*IN*/ PDEVICE_OBJECT DeviceObject);
6748 NTOSAPI
6749 VOID
6750 DDKAPI
6751 IoReleaseCancelSpinLock(
6752 /*IN*/ KIRQL Irql);
6754 NTOSAPI
6755 VOID
6756 DDKAPI
6757 IoReleaseRemoveLockAndWaitEx(
6758 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
6759 /*IN*/ PVOID Tag,
6760 /*IN*/ ULONG RemlockSize);
6763 * VOID
6764 * IoReleaseRemoveLockAndWait(
6765 * IN PIO_REMOVE_LOCK RemoveLock,
6766 * IN PVOID Tag)
6768 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
6769 _Tag) \
6770 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6772 NTOSAPI
6773 VOID
6774 DDKAPI
6775 IoReleaseRemoveLockEx(
6776 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
6777 /*IN*/ PVOID Tag,
6778 /*IN*/ ULONG RemlockSize);
6781 * VOID
6782 * IoReleaseRemoveLock(
6783 * IN PIO_REMOVE_LOCK RemoveLock,
6784 * IN PVOID Tag)
6786 #define IoReleaseRemoveLock(_RemoveLock, \
6787 _Tag) \
6788 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6790 NTOSAPI
6791 VOID
6792 DDKAPI
6793 IoRemoveShareAccess(
6794 /*IN*/ PFILE_OBJECT FileObject,
6795 /*IN OUT*/ PSHARE_ACCESS ShareAccess);
6797 NTOSAPI
6798 NTSTATUS
6799 DDKAPI
6800 IoReportDetectedDevice(
6801 /*IN*/ PDRIVER_OBJECT DriverObject,
6802 /*IN*/ INTERFACE_TYPE LegacyBusType,
6803 /*IN*/ ULONG BusNumber,
6804 /*IN*/ ULONG SlotNumber,
6805 /*IN*/ PCM_RESOURCE_LIST ResourceList,
6806 /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements /*OPTIONAL*/,
6807 /*IN*/ BOOLEAN ResourceAssigned,
6808 /*IN OUT*/ PDEVICE_OBJECT *DeviceObject);
6810 NTOSAPI
6811 NTSTATUS
6812 DDKAPI
6813 IoReportResourceForDetection(
6814 /*IN*/ PDRIVER_OBJECT DriverObject,
6815 /*IN*/ PCM_RESOURCE_LIST DriverList /*OPTIONAL*/,
6816 /*IN*/ ULONG DriverListSize /*OPTIONAL*/,
6817 /*IN*/ PDEVICE_OBJECT DeviceObject /*OPTIONAL*/,
6818 /*IN*/ PCM_RESOURCE_LIST DeviceList /*OPTIONAL*/,
6819 /*IN*/ ULONG DeviceListSize /*OPTIONAL*/,
6820 /*OUT*/ PBOOLEAN ConflictDetected);
6822 NTOSAPI
6823 NTSTATUS
6824 DDKAPI
6825 IoReportResourceUsage(
6826 /*IN*/ PUNICODE_STRING DriverClassName /*OPTIONAL*/,
6827 /*IN*/ PDRIVER_OBJECT DriverObject,
6828 /*IN*/ PCM_RESOURCE_LIST DriverList /*OPTIONAL*/,
6829 /*IN*/ ULONG DriverListSize /*OPTIONAL*/,
6830 /*IN*/ PDEVICE_OBJECT DeviceObject,
6831 /*IN*/ PCM_RESOURCE_LIST DeviceList /*OPTIONAL*/,
6832 /*IN*/ ULONG DeviceListSize /*OPTIONAL*/,
6833 /*IN*/ BOOLEAN OverrideConflict,
6834 /*OUT*/ PBOOLEAN ConflictDetected);
6836 NTOSAPI
6837 NTSTATUS
6838 DDKAPI
6839 IoReportTargetDeviceChange(
6840 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6841 /*IN*/ PVOID NotificationStructure);
6843 NTOSAPI
6844 NTSTATUS
6845 DDKAPI
6846 IoReportTargetDeviceChangeAsynchronous(
6847 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6848 /*IN*/ PVOID NotificationStructure,
6849 /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback /*OPTIONAL*/,
6850 /*IN*/ PVOID Context /*OPTIONAL*/);
6852 NTOSAPI
6853 VOID
6854 DDKAPI
6855 IoRequestDeviceEject(
6856 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject);
6859 * VOID
6860 * IoRequestDpc(
6861 * IN PDEVICE_OBJECT DeviceObject,
6862 * IN PIRP Irp,
6863 * IN PVOID Context);
6865 #define IoRequestDpc(DeviceObject, Irp, Context)( \
6866 KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
6868 NTOSAPI
6869 VOID
6870 DDKAPI
6871 IoReuseIrp(
6872 /*IN OUT*/ PIRP Irp,
6873 /*IN*/ NTSTATUS Status);
6876 * PDRIVER_CANCEL
6877 * IoSetCancelRoutine(
6878 * IN PIRP Irp,
6879 * IN PDRIVER_CANCEL CancelRoutine)
6881 #define IoSetCancelRoutine(_Irp, \
6882 _CancelRoutine) \
6883 ((PDRIVER_CANCEL) InterlockedExchangePointer( \
6884 (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)))
6887 * VOID
6888 * IoSetCompletionRoutine(
6889 * IN PIRP Irp,
6890 * IN PIO_COMPLETION_ROUTINE CompletionRoutine,
6891 * IN PVOID Context,
6892 * IN BOOLEAN InvokeOnSuccess,
6893 * IN BOOLEAN InvokeOnError,
6894 * IN BOOLEAN InvokeOnCancel)
6896 #define IoSetCompletionRoutine(_Irp, \
6897 _CompletionRoutine, \
6898 _Context, \
6899 _InvokeOnSuccess, \
6900 _InvokeOnError, \
6901 _InvokeOnCancel) \
6903 PIO_STACK_LOCATION _IrpSp; \
6904 ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
6905 _CompletionRoutine != NULL : TRUE); \
6906 _IrpSp = IoGetNextIrpStackLocation(_Irp); \
6907 _IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
6908 _IrpSp->Context = (_Context); \
6909 _IrpSp->Control = 0; \
6910 if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
6911 if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
6912 if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
6915 NTOSAPI
6916 VOID
6917 DDKAPI
6918 IoSetCompletionRoutineEx(
6919 /*IN*/ PDEVICE_OBJECT DeviceObject,
6920 /*IN*/ PIRP Irp,
6921 /*IN*/ PIO_COMPLETION_ROUTINE CompletionRoutine,
6922 /*IN*/ PVOID Context,
6923 /*IN*/ BOOLEAN InvokeOnSuccess,
6924 /*IN*/ BOOLEAN InvokeOnError,
6925 /*IN*/ BOOLEAN InvokeOnCancel);
6927 NTOSAPI
6928 NTSTATUS
6929 DDKAPI
6930 IoSetDeviceInterfaceState(
6931 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6932 /*IN*/ BOOLEAN Enable);
6934 NTOSAPI
6935 VOID
6936 DDKAPI
6937 IoSetHardErrorOrVerifyDevice(
6938 /*IN*/ PIRP Irp,
6939 /*IN*/ PDEVICE_OBJECT DeviceObject);
6942 * VOID
6943 * IoSetNextIrpStackLocation(
6944 * IN OUT PIRP Irp)
6946 #define IoSetNextIrpStackLocation(_Irp) \
6948 (_Irp)->CurrentLocation--; \
6949 (_Irp)->Tail.Overlay.CurrentStackLocation--; \
6952 NTOSAPI
6953 NTSTATUS
6954 DDKAPI
6955 IoSetPartitionInformationEx(
6956 /*IN*/ PDEVICE_OBJECT DeviceObject,
6957 /*IN*/ ULONG PartitionNumber,
6958 /*IN*/ struct _SET_PARTITION_INFORMATION_EX *PartitionInfo);
6960 NTOSAPI
6961 VOID
6962 DDKAPI
6963 IoSetShareAccess(
6964 /*IN*/ ACCESS_MASK DesiredAccess,
6965 /*IN*/ ULONG DesiredShareAccess,
6966 /*IN OUT*/ PFILE_OBJECT FileObject,
6967 /*OUT*/ PSHARE_ACCESS ShareAccess);
6969 NTOSAPI
6970 VOID
6971 DDKAPI
6972 IoSetStartIoAttributes(
6973 /*IN*/ PDEVICE_OBJECT DeviceObject,
6974 /*IN*/ BOOLEAN DeferredStartIo,
6975 /*IN*/ BOOLEAN NonCancelable);
6977 NTOSAPI
6978 NTSTATUS
6979 DDKAPI
6980 IoSetSystemPartition(
6981 /*IN*/ PUNICODE_STRING VolumeNameString);
6983 NTOSAPI
6984 BOOLEAN
6985 DDKAPI
6986 IoSetThreadHardErrorMode(
6987 /*IN*/ BOOLEAN EnableHardErrors);
6990 * USHORT
6991 * IoSizeOfIrp(
6992 * IN CCHAR StackSize)
6994 #define IoSizeOfIrp(_StackSize) \
6995 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
6998 * VOID
6999 * IoSkipCurrentIrpStackLocation(
7000 * IN PIRP Irp)
7002 #define IoSkipCurrentIrpStackLocation(_Irp) \
7004 (_Irp)->CurrentLocation++; \
7005 (_Irp)->Tail.Overlay.CurrentStackLocation++; \
7008 NTOSAPI
7009 VOID
7010 DDKAPI
7011 IoStartNextPacket(
7012 /*IN*/ PDEVICE_OBJECT DeviceObject,
7013 /*IN*/ BOOLEAN Cancelable);
7015 NTOSAPI
7016 VOID
7017 DDKAPI
7018 IoStartNextPacketByKey(
7019 /*IN*/ PDEVICE_OBJECT DeviceObject,
7020 /*IN*/ BOOLEAN Cancelable,
7021 /*IN*/ ULONG Key);
7023 NTOSAPI
7024 VOID
7025 DDKAPI
7026 IoStartPacket(
7027 /*IN*/ PDEVICE_OBJECT DeviceObject,
7028 /*IN*/ PIRP Irp,
7029 /*IN*/ PULONG Key /*OPTIONAL*/,
7030 /*IN*/ PDRIVER_CANCEL CancelFunction /*OPTIONAL*/);
7032 NTOSAPI
7033 VOID
7034 DDKAPI
7035 IoStartTimer(
7036 /*IN*/ PDEVICE_OBJECT DeviceObject);
7038 NTOSAPI
7039 VOID
7040 DDKAPI
7041 IoStopTimer(
7042 /*IN*/ PDEVICE_OBJECT DeviceObject);
7044 NTOSAPI
7045 NTSTATUS
7046 DDKAPI
7047 IoUnregisterPlugPlayNotification(
7048 /*IN*/ PVOID NotificationEntry);
7050 NTOSAPI
7051 VOID
7052 DDKAPI
7053 IoUnregisterShutdownNotification(
7054 /*IN*/ PDEVICE_OBJECT DeviceObject);
7056 NTOSAPI
7057 VOID
7058 DDKAPI
7059 IoUpdateShareAccess(
7060 /*IN*/ PFILE_OBJECT FileObject,
7061 /*IN OUT*/ PSHARE_ACCESS ShareAccess);
7063 NTOSAPI
7064 NTSTATUS
7065 DDKAPI
7066 IoVerifyPartitionTable(
7067 /*IN*/ PDEVICE_OBJECT DeviceObject,
7068 /*IN*/ BOOLEAN FixErrors);
7070 NTOSAPI
7071 NTSTATUS
7072 DDKAPI
7073 IoVolumeDeviceToDosName(
7074 /*IN*/ PVOID VolumeDeviceObject,
7075 /*OUT*/ PUNICODE_STRING DosName);
7077 NTOSAPI
7078 NTSTATUS
7079 DDKAPI
7080 IoWMIAllocateInstanceIds(
7081 /*IN*/ GUID *Guid,
7082 /*IN*/ ULONG InstanceCount,
7083 /*OUT*/ ULONG *FirstInstanceId);
7085 NTOSAPI
7086 ULONG
7087 DDKAPI
7088 IoWMIDeviceObjectToProviderId(
7089 /*IN*/ PDEVICE_OBJECT DeviceObject);
7091 NTOSAPI
7092 NTSTATUS
7093 DDKAPI
7094 IoWMIDeviceObjectToInstanceName(
7095 /*IN*/ PVOID DataBlockObject,
7096 /*IN*/ PDEVICE_OBJECT DeviceObject,
7097 /*OUT*/ PUNICODE_STRING InstanceName);
7099 NTOSAPI
7100 NTSTATUS
7101 DDKAPI
7102 IoWMIExecuteMethod(
7103 /*IN*/ PVOID DataBlockObject,
7104 /*IN*/ PUNICODE_STRING InstanceName,
7105 /*IN*/ ULONG MethodId,
7106 /*IN*/ ULONG InBufferSize,
7107 /*IN OUT*/ PULONG OutBufferSize,
7108 /*IN OUT*/ PUCHAR InOutBuffer);
7110 NTOSAPI
7111 NTSTATUS
7112 DDKAPI
7113 IoWMIHandleToInstanceName(
7114 /*IN*/ PVOID DataBlockObject,
7115 /*IN*/ HANDLE FileHandle,
7116 /*OUT*/ PUNICODE_STRING InstanceName);
7118 NTOSAPI
7119 NTSTATUS
7120 DDKAPI
7121 IoWMIOpenBlock(
7122 /*IN*/ GUID *DataBlockGuid,
7123 /*IN*/ ULONG DesiredAccess,
7124 /*OUT*/ PVOID *DataBlockObject);
7126 NTOSAPI
7127 NTSTATUS
7128 DDKAPI
7129 IoWMIQueryAllData(
7130 /*IN*/ PVOID DataBlockObject,
7131 /*IN OUT*/ ULONG *InOutBufferSize,
7132 /*OUT*/ PVOID OutBuffer);
7134 NTOSAPI
7135 NTSTATUS
7136 DDKAPI
7137 IoWMIQueryAllDataMultiple(
7138 /*IN*/ PVOID *DataBlockObjectList,
7139 /*IN*/ ULONG ObjectCount,
7140 /*IN OUT*/ ULONG *InOutBufferSize,
7141 /*OUT*/ PVOID OutBuffer);
7143 NTOSAPI
7144 NTSTATUS
7145 DDKAPI
7146 IoWMIQuerySingleInstance(
7147 /*IN*/ PVOID DataBlockObject,
7148 /*IN*/ PUNICODE_STRING InstanceName,
7149 /*IN OUT*/ ULONG *InOutBufferSize,
7150 /*OUT*/ PVOID OutBuffer);
7152 NTOSAPI
7153 NTSTATUS
7154 DDKAPI
7155 IoWMIQuerySingleInstanceMultiple(
7156 /*IN*/ PVOID *DataBlockObjectList,
7157 /*IN*/ PUNICODE_STRING InstanceNames,
7158 /*IN*/ ULONG ObjectCount,
7159 /*IN OUT*/ ULONG *InOutBufferSize,
7160 /*OUT*/ PVOID OutBuffer);
7162 NTOSAPI
7163 NTSTATUS
7164 DDKAPI
7165 IoWMIRegistrationControl(
7166 /*IN*/ PDEVICE_OBJECT DeviceObject,
7167 /*IN*/ ULONG Action);
7169 NTOSAPI
7170 NTSTATUS
7171 DDKAPI
7172 IoWMISetNotificationCallback(
7173 /*IN*/ PVOID Object,
7174 /*IN*/ WMI_NOTIFICATION_CALLBACK Callback,
7175 /*IN*/ PVOID Context);
7177 NTOSAPI
7178 NTSTATUS
7179 DDKAPI
7180 IoWMISetSingleInstance(
7181 /*IN*/ PVOID DataBlockObject,
7182 /*IN*/ PUNICODE_STRING InstanceName,
7183 /*IN*/ ULONG Version,
7184 /*IN*/ ULONG ValueBufferSize,
7185 /*IN*/ PVOID ValueBuffer);
7187 NTOSAPI
7188 NTSTATUS
7189 DDKAPI
7190 IoWMISetSingleItem(
7191 /*IN*/ PVOID DataBlockObject,
7192 /*IN*/ PUNICODE_STRING InstanceName,
7193 /*IN*/ ULONG DataItemId,
7194 /*IN*/ ULONG Version,
7195 /*IN*/ ULONG ValueBufferSize,
7196 /*IN*/ PVOID ValueBuffer);
7198 NTOSAPI
7199 NTSTATUS
7200 DDKAPI
7201 IoWMISuggestInstanceName(
7202 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject /*OPTIONAL*/,
7203 /*IN*/ PUNICODE_STRING SymbolicLinkName /*OPTIONAL*/,
7204 /*IN*/ BOOLEAN CombineNames,
7205 /*OUT*/ PUNICODE_STRING SuggestedInstanceName);
7207 NTOSAPI
7208 NTSTATUS
7209 DDKAPI
7210 IoWMIWriteEvent(
7211 /*IN*/ PVOID WnodeEventItem);
7213 NTOSAPI
7214 VOID
7215 DDKAPI
7216 IoWriteErrorLogEntry(
7217 /*IN*/ PVOID ElEntry);
7219 NTOSAPI
7220 NTSTATUS
7221 DDKAPI
7222 IoWritePartitionTableEx(
7223 /*IN*/ PDEVICE_OBJECT DeviceObject,
7224 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX *PartitionBuffer);
7228 /** Kernel routines **/
7230 NTOSAPI
7231 VOID
7232 DDKFASTAPI
7233 KeAcquireInStackQueuedSpinLock(
7234 /*IN*/ PKSPIN_LOCK SpinLock,
7235 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7237 NTOSAPI
7238 VOID
7239 DDKFASTAPI
7240 KeAcquireInStackQueuedSpinLockAtDpcLevel(
7241 /*IN*/ PKSPIN_LOCK SpinLock,
7242 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7244 NTOSAPI
7245 KIRQL
7246 DDKAPI
7247 KeAcquireInterruptSpinLock(
7248 /*IN*/ PKINTERRUPT Interrupt);
7250 NTOSAPI
7251 VOID
7252 DDKAPI
7253 KeAcquireSpinLock(
7254 /*IN*/ PKSPIN_LOCK SpinLock,
7255 /*OUT*/ PKIRQL OldIrql);
7257 /* System Service Dispatch Table */
7258 typedef PVOID (NTAPI * SSDT)(VOID);
7259 typedef SSDT * PSSDT;
7261 /* System Service Parameters Table */
7262 typedef UCHAR SSPT, * PSSPT;
7264 typedef struct _SSDT_ENTRY {
7265 PSSDT SSDT;
7266 PULONG ServiceCounterTable;
7267 ULONG NumberOfServices;
7268 PSSPT SSPT;
7269 } SSDT_ENTRY, *PSSDT_ENTRY;
7271 NTOSAPI
7272 BOOLEAN
7273 DDKAPI
7274 KeAddSystemServiceTable(
7275 /*IN*/ PSSDT SSDT,
7276 /*IN*/ PULONG ServiceCounterTable,
7277 /*IN*/ ULONG NumberOfServices,
7278 /*IN*/ PSSPT SSPT,
7279 /*IN*/ ULONG TableIndex);
7281 NTOSAPI
7282 BOOLEAN
7283 DDKAPI
7284 KeAreApcsDisabled(
7285 VOID);
7287 NTOSAPI
7288 VOID
7289 DDKAPI
7290 KeAttachProcess(
7291 /*IN*/ PEPROCESS Process);
7293 NTOSAPI
7294 VOID
7295 DDKAPI
7296 KeBugCheck(
7297 /*IN*/ ULONG BugCheckCode);
7299 NTOSAPI
7300 VOID
7301 DDKAPI
7302 KeBugCheckEx(
7303 /*IN*/ ULONG BugCheckCode,
7304 /*IN*/ ULONG_PTR BugCheckParameter1,
7305 /*IN*/ ULONG_PTR BugCheckParameter2,
7306 /*IN*/ ULONG_PTR BugCheckParameter3,
7307 /*IN*/ ULONG_PTR BugCheckParameter4);
7309 NTOSAPI
7310 BOOLEAN
7311 DDKAPI
7312 KeCancelTimer(
7313 /*IN*/ PKTIMER Timer);
7315 NTOSAPI
7316 VOID
7317 DDKAPI
7318 KeClearEvent(
7319 /*IN*/ PRKEVENT Event);
7321 NTOSAPI
7322 NTSTATUS
7323 DDKAPI
7324 KeDelayExecutionThread(
7325 /*IN*/ KPROCESSOR_MODE WaitMode,
7326 /*IN*/ BOOLEAN Alertable,
7327 /*IN*/ PLARGE_INTEGER Interval);
7329 NTOSAPI
7330 BOOLEAN
7331 DDKAPI
7332 KeDeregisterBugCheckCallback(
7333 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
7335 NTOSAPI
7336 VOID
7337 DDKAPI
7338 KeDetachProcess(
7339 VOID);
7341 NTOSAPI
7342 VOID
7343 DDKAPI
7344 KeEnterCriticalRegion(
7345 VOID);
7348 * VOID
7349 * KeFlushIoBuffers(
7350 * IN PMDL Mdl,
7351 * IN BOOLEAN ReadOperation,
7352 * IN BOOLEAN DmaOperation)
7354 #define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
7356 NTOSAPI
7357 VOID
7358 DDKAPI
7359 KeFlushQueuedDpcs(VOID);
7361 NTOSAPI
7362 PRKTHREAD
7363 DDKAPI
7364 KeGetCurrentThread(
7365 VOID);
7367 NTOSAPI
7368 KPROCESSOR_MODE
7369 DDKAPI
7370 KeGetPreviousMode(
7371 VOID);
7373 NTOSAPI
7374 ULONG
7375 DDKAPI
7376 KeGetRecommendedSharedDataAlignment(
7377 VOID);
7379 NTOSAPI
7380 VOID
7381 DDKAPI
7382 KeInitializeApc(
7383 /*IN*/ PKAPC Apc,
7384 /*IN*/ PKTHREAD Thread,
7385 /*IN*/ UCHAR StateIndex,
7386 /*IN*/ PKKERNEL_ROUTINE KernelRoutine,
7387 /*IN*/ PKRUNDOWN_ROUTINE RundownRoutine,
7388 /*IN*/ PKNORMAL_ROUTINE NormalRoutine,
7389 /*IN*/ UCHAR Mode,
7390 /*IN*/ PVOID Context);
7392 NTOSAPI
7393 VOID
7394 DDKAPI
7395 KeInitializeDeviceQueue(
7396 /*IN*/ PKDEVICE_QUEUE DeviceQueue);
7398 NTOSAPI
7399 VOID
7400 DDKAPI
7401 KeInitializeMutex(
7402 /*IN*/ PRKMUTEX Mutex,
7403 /*IN*/ ULONG Level);
7405 NTOSAPI
7406 VOID
7407 DDKAPI
7408 KeInitializeSemaphore(
7409 /*IN*/ PRKSEMAPHORE Semaphore,
7410 /*IN*/ LONG Count,
7411 /*IN*/ LONG Limit);
7413 NTOSAPI
7414 VOID
7415 DDKAPI
7416 KeInitializeSpinLock(
7417 /*IN*/ PKSPIN_LOCK SpinLock);
7419 NTOSAPI
7420 VOID
7421 DDKAPI
7422 KeInitializeTimer(
7423 /*IN*/ PKTIMER Timer);
7425 NTOSAPI
7426 VOID
7427 DDKAPI
7428 KeInitializeTimerEx(
7429 /*IN*/ PKTIMER Timer,
7430 /*IN*/ TIMER_TYPE Type);
7432 NTOSAPI
7433 BOOLEAN
7434 DDKAPI
7435 KeInsertByKeyDeviceQueue(
7436 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7437 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry,
7438 /*IN*/ ULONG SortKey);
7440 NTOSAPI
7441 BOOLEAN
7442 DDKAPI
7443 KeInsertDeviceQueue(
7444 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7445 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
7447 NTOSAPI
7448 BOOLEAN
7449 DDKAPI
7450 KeInsertQueueDpc(
7451 /*IN*/ PRKDPC Dpc,
7452 /*IN*/ PVOID SystemArgument1,
7453 /*IN*/ PVOID SystemArgument2);
7455 NTOSAPI
7456 VOID
7457 DDKAPI
7458 KeLeaveCriticalRegion(
7459 VOID);
7461 #define KeMemoryBarrier() asm("mfence;")
7463 NTOSAPI
7464 NTSTATUS
7465 DDKAPI
7466 KePulseEvent(
7467 /*IN*/ PRKEVENT Event,
7468 /*IN*/ KPRIORITY Increment,
7469 /*IN*/ BOOLEAN Wait);
7471 NTOSAPI
7472 ULONGLONG
7473 DDKAPI
7474 KeQueryInterruptTime(
7475 VOID);
7477 NTOSAPI
7478 LARGE_INTEGER
7479 DDKAPI
7480 KeQueryPerformanceCounter(
7481 /*OUT*/ PLARGE_INTEGER PerformanceFrequency /*OPTIONAL*/);
7483 NTOSAPI
7484 KPRIORITY
7485 DDKAPI
7486 KeQueryPriorityThread(
7487 /*IN*/ PRKTHREAD Thread);
7489 NTOSAPI
7490 VOID
7491 DDKAPI
7492 KeQuerySystemTime(
7493 /*OUT*/ PLARGE_INTEGER CurrentTime);
7495 NTOSAPI
7496 VOID
7497 DDKAPI
7498 KeQueryTickCount(
7499 /*OUT*/ PLARGE_INTEGER TickCount);
7501 NTOSAPI
7502 ULONG
7503 DDKAPI
7504 KeQueryTimeIncrement(
7505 VOID);
7507 NTOSAPI
7508 LONG
7509 DDKAPI
7510 KeReadStateEvent(
7511 /*IN*/ PRKEVENT Event);
7513 NTOSAPI
7514 LONG
7515 DDKAPI
7516 KeReadStateMutex(
7517 /*IN*/ PRKMUTEX Mutex);
7519 NTOSAPI
7520 LONG
7521 DDKAPI
7522 KeReadStateSemaphore(
7523 /*IN*/ PRKSEMAPHORE Semaphore);
7525 NTOSAPI
7526 BOOLEAN
7527 DDKAPI
7528 KeReadStateTimer(
7529 /*IN*/ PKTIMER Timer);
7531 NTOSAPI
7532 BOOLEAN
7533 DDKAPI
7534 KeRegisterBugCheckCallback(
7535 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
7536 /*IN*/ PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
7537 /*IN*/ PVOID Buffer,
7538 /*IN*/ ULONG Length,
7539 /*IN*/ PUCHAR Component);
7541 NTOSAPI
7542 VOID
7543 DDKFASTAPI
7544 KeReleaseInStackQueuedSpinLock(
7545 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7547 NTOSAPI
7548 VOID
7549 DDKFASTAPI
7550 KeReleaseInStackQueuedSpinLockFromDpcLevel(
7551 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7553 NTOSAPI
7554 VOID
7555 DDKAPI
7556 KeReleaseInterruptSpinLock(
7557 /*IN*/ PKINTERRUPT Interrupt,
7558 /*IN*/ KIRQL OldIrql);
7560 NTOSAPI
7561 LONG
7562 DDKAPI
7563 KeReleaseMutex(
7564 /*IN*/ PRKMUTEX Mutex,
7565 /*IN*/ BOOLEAN Wait);
7567 NTOSAPI
7568 LONG
7569 DDKAPI
7570 KeReleaseSemaphore(
7571 /*IN*/ PRKSEMAPHORE Semaphore,
7572 /*IN*/ KPRIORITY Increment,
7573 /*IN*/ LONG Adjustment,
7574 /*IN*/ BOOLEAN Wait);
7576 NTOSAPI
7577 VOID
7578 DDKAPI
7579 KeReleaseSpinLock(
7580 /*IN*/ PKSPIN_LOCK SpinLock,
7581 /*IN*/ KIRQL NewIrql);
7583 NTOSAPI
7584 PKDEVICE_QUEUE_ENTRY
7585 DDKAPI
7586 KeRemoveByKeyDeviceQueue(
7587 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7588 /*IN*/ ULONG SortKey);
7590 NTOSAPI
7591 PKDEVICE_QUEUE_ENTRY
7592 DDKAPI
7593 KeRemoveDeviceQueue(
7594 /*IN*/ PKDEVICE_QUEUE DeviceQueue);
7596 NTOSAPI
7597 BOOLEAN
7598 DDKAPI
7599 KeRemoveEntryDeviceQueue(
7600 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7601 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
7603 NTOSAPI
7604 BOOLEAN
7605 DDKAPI
7606 KeRemoveQueueDpc(
7607 /*IN*/ PRKDPC Dpc);
7609 NTOSAPI
7610 LONG
7611 DDKAPI
7612 KeResetEvent(
7613 /*IN*/ PRKEVENT Event);
7615 NTOSAPI
7616 NTSTATUS
7617 DDKAPI
7618 KeRestoreFloatingPointState(
7619 /*IN*/ PKFLOATING_SAVE FloatSave);
7621 NTOSAPI
7622 NTSTATUS
7623 DDKAPI
7624 KeSaveFloatingPointState(
7625 /*OUT*/ PKFLOATING_SAVE FloatSave);
7627 NTOSAPI
7628 LONG
7629 DDKAPI
7630 KeSetBasePriorityThread(
7631 /*IN*/ PRKTHREAD Thread,
7632 /*IN*/ LONG Increment);
7634 NTOSAPI
7635 LONG
7636 DDKAPI
7637 KeSetEvent(
7638 /*IN*/ PRKEVENT Event,
7639 /*IN*/ KPRIORITY Increment,
7640 /*IN*/ BOOLEAN Wait);
7642 NTOSAPI
7643 VOID
7644 DDKAPI
7645 KeSetImportanceDpc(
7646 /*IN*/ PRKDPC Dpc,
7647 /*IN*/ KDPC_IMPORTANCE Importance);
7649 NTOSAPI
7650 KPRIORITY
7651 DDKAPI
7652 KeSetPriorityThread(
7653 /*IN*/ PKTHREAD Thread,
7654 /*IN*/ KPRIORITY Priority);
7656 NTOSAPI
7657 VOID
7658 DDKAPI
7659 KeSetTargetProcessorDpc(
7660 /*IN*/ PRKDPC Dpc,
7661 /*IN*/ CCHAR Number);
7663 NTOSAPI
7664 BOOLEAN
7665 DDKAPI
7666 KeSetTimer(
7667 /*IN*/ PKTIMER Timer,
7668 /*IN*/ LARGE_INTEGER DueTime,
7669 /*IN*/ PKDPC Dpc /*OPTIONAL*/);
7671 NTOSAPI
7672 BOOLEAN
7673 DDKAPI
7674 KeSetTimerEx(
7675 /*IN*/ PKTIMER Timer,
7676 /*IN*/ LARGE_INTEGER DueTime,
7677 /*IN*/ LONG Period /*OPTIONAL*/,
7678 /*IN*/ PKDPC Dpc /*OPTIONAL*/);
7680 NTOSAPI
7681 VOID
7682 DDKFASTAPI
7683 KeSetTimeUpdateNotifyRoutine(
7684 /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine);
7686 NTOSAPI
7687 VOID
7688 DDKAPI
7689 KeStallExecutionProcessor(
7690 /*IN*/ ULONG MicroSeconds);
7692 NTOSAPI
7693 BOOLEAN
7694 DDKAPI
7695 KeSynchronizeExecution(
7696 /*IN*/ PKINTERRUPT Interrupt,
7697 /*IN*/ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
7698 /*IN*/ PVOID SynchronizeContext);
7700 NTOSAPI
7701 NTSTATUS
7702 DDKAPI
7703 KeWaitForMultipleObjects(
7704 /*IN*/ ULONG Count,
7705 /*IN*/ PVOID Object[],
7706 /*IN*/ WAIT_TYPE WaitType,
7707 /*IN*/ KWAIT_REASON WaitReason,
7708 /*IN*/ KPROCESSOR_MODE WaitMode,
7709 /*IN*/ BOOLEAN Alertable,
7710 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL */,
7711 /*IN*/ PKWAIT_BLOCK WaitBlockArray /*OPTIONAL*/);
7713 NTOSAPI
7714 NTSTATUS
7715 DDKAPI
7716 KeWaitForMutexObject(
7717 /*IN*/ PRKMUTEX Mutex,
7718 /*IN*/ KWAIT_REASON WaitReason,
7719 /*IN*/ KPROCESSOR_MODE WaitMode,
7720 /*IN*/ BOOLEAN Alertable,
7721 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL*/);
7723 NTOSAPI
7724 NTSTATUS
7725 DDKAPI
7726 KeWaitForSingleObject(
7727 /*IN*/ PVOID Object,
7728 /*IN*/ KWAIT_REASON WaitReason,
7729 /*IN*/ KPROCESSOR_MODE WaitMode,
7730 /*IN*/ BOOLEAN Alertable,
7731 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL*/);
7733 NTOSAPI
7734 VOID
7735 DDKAPI
7736 KeRaiseIrql(
7737 /*IN*/ KIRQL new_irql,
7738 /*OUT*/ PKIRQL old_irql);
7740 NTOSAPI
7741 VOID
7742 DDKAPI
7743 KeLowerIrql(
7744 /*IN*/ KIRQL irql);
7746 NTOSAPI
7747 KIRQL
7748 DDKAPI
7749 KeRaiseIrqlToDpcLevel(
7750 VOID);
7752 /** Memory manager routines **/
7754 NTOSAPI
7755 NTSTATUS
7756 DDKAPI
7757 MmAdvanceMdl(
7758 /*IN*/ PMDL Mdl,
7759 /*IN*/ ULONG NumberOfBytes);
7761 NTOSAPI
7762 PVOID
7763 DDKAPI
7764 MmAllocateContiguousMemory(
7765 /*IN*/ ULONG NumberOfBytes,
7766 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress);
7768 NTOSAPI
7769 PVOID
7770 DDKAPI
7771 MmAllocateContiguousMemorySpecifyCache(
7772 /*IN*/ SIZE_T NumberOfBytes,
7773 /*IN*/ PHYSICAL_ADDRESS LowestAcceptableAddress,
7774 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress,
7775 /*IN*/ PHYSICAL_ADDRESS BoundaryAddressMultiple /*OPTIONAL*/,
7776 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7778 NTOSAPI
7779 PVOID
7780 DDKAPI
7781 MmAllocateMappingAddress(
7782 /*IN*/ SIZE_T NumberOfBytes,
7783 /*IN*/ ULONG PoolTag);
7785 NTOSAPI
7786 PVOID
7787 DDKAPI
7788 MmAllocateNonCachedMemory(
7789 /*IN*/ ULONG NumberOfBytes);
7791 NTOSAPI
7792 PMDL
7793 DDKAPI
7794 MmAllocatePagesForMdl(
7795 /*IN*/ PHYSICAL_ADDRESS LowAddress,
7796 /*IN*/ PHYSICAL_ADDRESS HighAddress,
7797 /*IN*/ PHYSICAL_ADDRESS SkipBytes,
7798 /*IN*/ SIZE_T TotalBytes);
7800 NTOSAPI
7801 VOID
7802 DDKAPI
7803 MmBuildMdlForNonPagedPool(
7804 /*IN OUT*/ PMDL MemoryDescriptorList);
7806 NTOSAPI
7807 NTSTATUS
7808 DDKAPI
7809 MmCreateSection(
7810 /*OUT*/ PSECTION_OBJECT *SectionObject,
7811 /*IN*/ ACCESS_MASK DesiredAccess,
7812 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
7813 /*IN*/ PLARGE_INTEGER MaximumSize,
7814 /*IN*/ ULONG SectionPageProtection,
7815 /*IN*/ ULONG AllocationAttributes,
7816 /*IN*/ HANDLE FileHandle /*OPTIONAL*/,
7817 /*IN*/ PFILE_OBJECT File /*OPTIONAL*/);
7819 typedef enum _MMFLUSH_TYPE {
7820 MmFlushForDelete,
7821 MmFlushForWrite
7822 } MMFLUSH_TYPE;
7824 NTOSAPI
7825 BOOLEAN
7826 DDKAPI
7827 MmFlushImageSection(
7828 /*IN*/ PSECTION_OBJECT_POINTERS SectionObjectPointer,
7829 /*IN*/ MMFLUSH_TYPE FlushType);
7831 NTOSAPI
7832 VOID
7833 DDKAPI
7834 MmFreeContiguousMemory(
7835 /*IN*/ PVOID BaseAddress);
7837 NTOSAPI
7838 VOID
7839 DDKAPI
7840 MmFreeContiguousMemorySpecifyCache(
7841 /*IN*/ PVOID BaseAddress,
7842 /*IN*/ SIZE_T NumberOfBytes,
7843 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7845 NTOSAPI
7846 VOID
7847 DDKAPI
7848 MmFreeMappingAddress(
7849 /*IN*/ PVOID BaseAddress,
7850 /*IN*/ ULONG PoolTag);
7852 NTOSAPI
7853 VOID
7854 DDKAPI
7855 MmFreeNonCachedMemory(
7856 /*IN*/ PVOID BaseAddress,
7857 /*IN*/ SIZE_T NumberOfBytes);
7859 NTOSAPI
7860 VOID
7861 DDKAPI
7862 MmFreePagesFromMdl(
7863 /*IN*/ PMDL MemoryDescriptorList);
7866 * ULONG
7867 * MmGetMdlByteCount(
7868 * IN PMDL Mdl)
7870 #define MmGetMdlByteCount(_Mdl) \
7871 ((_Mdl)->ByteCount)
7874 * ULONG
7875 * MmGetMdlByteOffset(
7876 * IN PMDL Mdl)
7878 #define MmGetMdlByteOffset(_Mdl) \
7879 ((_Mdl)->ByteOffset)
7882 * PPFN_NUMBER
7883 * MmGetMdlPfnArray(
7884 * IN PMDL Mdl)
7886 #define MmGetMdlPfnArray(_Mdl) \
7887 ((PPFN_NUMBER) ((_Mdl) + 1))
7890 * PVOID
7891 * MmGetMdlVirtualAddress(
7892 * IN PMDL Mdl)
7894 #define MmGetMdlVirtualAddress(_Mdl) \
7895 ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
7897 NTOSAPI
7898 PHYSICAL_ADDRESS
7899 DDKAPI
7900 MmGetPhysicalAddress(
7901 /*IN*/ PVOID BaseAddress);
7903 NTOSAPI
7904 PPHYSICAL_MEMORY_RANGE
7905 DDKAPI
7906 MmGetPhysicalMemoryRanges(
7907 VOID);
7909 NTOSAPI
7910 PVOID
7911 DDKAPI
7912 MmGetVirtualForPhysical(
7913 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress);
7915 NTOSAPI
7916 PVOID
7917 DDKAPI
7918 MmMapLockedPagesSpecifyCache(
7919 /*IN*/ PMDL MemoryDescriptorList,
7920 /*IN*/ KPROCESSOR_MODE AccessMode,
7921 /*IN*/ MEMORY_CACHING_TYPE CacheType,
7922 /*IN*/ PVOID BaseAddress,
7923 /*IN*/ ULONG BugCheckOnFailure,
7924 /*IN*/ MM_PAGE_PRIORITY Priority);
7926 NTOSAPI
7927 PVOID
7928 DDKAPI
7929 MmMapLockedPagesWithReservedMapping(
7930 /*IN*/ PVOID MappingAddress,
7931 /*IN*/ ULONG PoolTag,
7932 /*IN*/ PMDL MemoryDescriptorList,
7933 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7935 NTOSAPI
7936 NTSTATUS
7937 DDKAPI
7938 MmMapUserAddressesToPage(
7939 /*IN*/ PVOID BaseAddress,
7940 /*IN*/ SIZE_T NumberOfBytes,
7941 /*IN*/ PVOID PageAddress);
7943 NTOSAPI
7944 PVOID
7945 DDKAPI
7946 MmMapVideoDisplay(
7947 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress,
7948 /*IN*/ SIZE_T NumberOfBytes,
7949 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7951 NTOSAPI
7952 NTSTATUS
7953 DDKAPI
7954 MmMapViewInSessionSpace(
7955 /*IN*/ PVOID Section,
7956 /*OUT*/ PVOID *MappedBase,
7957 /*IN OUT*/ PSIZE_T ViewSize);
7959 NTOSAPI
7960 NTSTATUS
7961 DDKAPI
7962 MmMapViewInSystemSpace(
7963 /*IN*/ PVOID Section,
7964 /*OUT*/ PVOID *MappedBase,
7965 /*IN*/ PSIZE_T ViewSize);
7967 NTOSAPI
7968 NTSTATUS
7969 DDKAPI
7970 MmMarkPhysicalMemoryAsBad(
7971 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7972 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes);
7974 NTOSAPI
7975 NTSTATUS
7976 DDKAPI
7977 MmMarkPhysicalMemoryAsGood(
7978 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7979 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes);
7982 * PVOID
7983 * MmGetSystemAddressForMdlSafe(
7984 * IN PMDL Mdl,
7985 * IN MM_PAGE_PRIORITY Priority)
7987 #define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
7988 ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
7989 | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
7990 (_Mdl)->MappedSystemVa : \
7991 (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
7992 KernelMode, MmCached, NULL, FALSE, _Priority)
7994 NTOSAPI
7995 PVOID
7996 DDKAPI
7997 MmGetSystemRoutineAddress(
7998 /*IN*/ PUNICODE_STRING SystemRoutineName);
8001 * ULONG
8002 * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
8003 * IN PVOID Va,
8004 * IN ULONG Size)
8006 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
8007 _Size) \
8008 ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
8009 + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
8012 * VOID
8013 * MmInitializeMdl(
8014 * IN PMDL MemoryDescriptorList,
8015 * IN PVOID BaseVa,
8016 * IN SIZE_T Length)
8018 #define MmInitializeMdl(_MemoryDescriptorList, \
8019 _BaseVa, \
8020 _Length) \
8022 (_MemoryDescriptorList)->Next = (PMDL) NULL; \
8023 (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
8024 (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
8025 (_MemoryDescriptorList)->MdlFlags = 0; \
8026 (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
8027 (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
8028 (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
8031 NTOSAPI
8032 BOOLEAN
8033 DDKAPI
8034 MmIsAddressValid(
8035 /*IN*/ PVOID VirtualAddress);
8037 NTOSAPI
8038 LOGICAL
8039 DDKAPI
8040 MmIsDriverVerifying(
8041 /*IN*/ PDRIVER_OBJECT DriverObject);
8043 NTOSAPI
8044 BOOLEAN
8045 DDKAPI
8046 MmIsThisAnNtAsSystem(
8047 VOID);
8049 NTOSAPI
8050 NTSTATUS
8051 DDKAPI
8052 MmIsVerifierEnabled(
8053 /*OUT*/ PULONG VerifierFlags);
8055 NTOSAPI
8056 PVOID
8057 DDKAPI
8058 MmLockPagableDataSection(
8059 /*IN*/ PVOID AddressWithinSection);
8061 NTOSAPI
8062 PVOID
8063 DDKAPI
8064 MmLockPagableImageSection(
8065 /*IN*/ PVOID AddressWithinSection);
8068 * PVOID
8069 * MmLockPagableCodeSection(
8070 * IN PVOID AddressWithinSection)
8072 #define MmLockPagableCodeSection MmLockPagableDataSection
8074 NTOSAPI
8075 VOID
8076 DDKAPI
8077 MmLockPagableSectionByHandle(
8078 /*IN*/ PVOID ImageSectionHandle);
8080 NTOSAPI
8081 PVOID
8082 DDKAPI
8083 MmMapIoSpace(
8084 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress,
8085 /*IN*/ ULONG NumberOfBytes,
8086 /*IN*/ MEMORY_CACHING_TYPE CacheEnable);
8088 NTOSAPI
8089 PVOID
8090 DDKAPI
8091 MmMapLockedPages(
8092 /*IN*/ PMDL MemoryDescriptorList,
8093 /*IN*/ KPROCESSOR_MODE AccessMode);
8095 NTOSAPI
8096 VOID
8097 DDKAPI
8098 MmPageEntireDriver(
8099 /*IN*/ PVOID AddressWithinSection);
8101 NTOSAPI
8102 VOID
8103 DDKAPI
8104 MmProbeAndLockProcessPages(
8105 /*IN OUT*/ PMDL MemoryDescriptorList,
8106 /*IN*/ PEPROCESS Process,
8107 /*IN*/ KPROCESSOR_MODE AccessMode,
8108 /*IN*/ LOCK_OPERATION Operation);
8110 NTOSAPI
8111 NTSTATUS
8112 DDKAPI
8113 MmProtectMdlSystemAddress(
8114 /*IN*/ PMDL MemoryDescriptorList,
8115 /*IN*/ ULONG NewProtect);
8117 NTOSAPI
8118 VOID
8119 DDKAPI
8120 MmUnmapLockedPages(
8121 /*IN*/ PVOID BaseAddress,
8122 /*IN*/ PMDL MemoryDescriptorList);
8124 NTOSAPI
8125 NTSTATUS
8126 DDKAPI
8127 MmUnmapViewInSessionSpace(
8128 /*IN*/ PVOID MappedBase);
8130 NTOSAPI
8131 NTSTATUS
8132 DDKAPI
8133 MmUnmapViewInSystemSpace(
8134 /*IN*/ PVOID MappedBase);
8136 NTOSAPI
8137 VOID
8138 DDKAPI
8139 MmUnsecureVirtualMemory(
8140 /*IN*/ HANDLE SecureHandle);
8143 * VOID
8144 * MmPrepareMdlForReuse(
8145 * IN PMDL Mdl)
8147 #define MmPrepareMdlForReuse(_Mdl) \
8149 if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
8150 ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
8151 MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
8152 } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
8153 ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
8157 NTOSAPI
8158 VOID
8159 DDKAPI
8160 MmProbeAndLockPages(
8161 /*IN OUT*/ PMDL MemoryDescriptorList,
8162 /*IN*/ KPROCESSOR_MODE AccessMode,
8163 /*IN*/ LOCK_OPERATION Operation);
8165 NTOSAPI
8166 MM_SYSTEM_SIZE
8167 DDKAPI
8168 MmQuerySystemSize(
8169 VOID);
8171 NTOSAPI
8172 NTSTATUS
8173 DDKAPI
8174 MmRemovePhysicalMemory(
8175 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
8176 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes);
8178 NTOSAPI
8179 VOID
8180 DDKAPI
8181 MmResetDriverPaging(
8182 /*IN*/ PVOID AddressWithinSection);
8184 NTOSAPI
8185 HANDLE
8186 DDKAPI
8187 MmSecureVirtualMemory(
8188 /*IN*/ PVOID Address,
8189 /*IN*/ SIZE_T Size,
8190 /*IN*/ ULONG ProbeMode);
8192 NTOSAPI
8193 ULONG
8194 DDKAPI
8195 MmSizeOfMdl(
8196 /*IN*/ PVOID Base,
8197 /*IN*/ SIZE_T Length);
8199 NTOSAPI
8200 VOID
8201 DDKAPI
8202 MmUnlockPagableImageSection(
8203 /*IN*/ PVOID ImageSectionHandle);
8205 NTOSAPI
8206 VOID
8207 DDKAPI
8208 MmUnlockPages(
8209 /*IN*/ PMDL MemoryDescriptorList);
8211 NTOSAPI
8212 VOID
8213 DDKAPI
8214 MmUnmapIoSpace(
8215 /*IN*/ PVOID BaseAddress,
8216 /*IN*/ SIZE_T NumberOfBytes);
8218 NTOSAPI
8219 VOID
8220 DDKAPI
8221 MmUnmapReservedMapping(
8222 /*IN*/ PVOID BaseAddress,
8223 /*IN*/ ULONG PoolTag,
8224 /*IN*/ PMDL MemoryDescriptorList);
8226 NTOSAPI
8227 VOID
8228 DDKAPI
8229 MmUnmapVideoDisplay(
8230 /*IN*/ PVOID BaseAddress,
8231 /*IN*/ SIZE_T NumberOfBytes);
8235 /** Object manager routines **/
8237 NTOSAPI
8238 NTSTATUS
8239 DDKAPI
8240 ObAssignSecurity(
8241 /*IN*/ PACCESS_STATE AccessState,
8242 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8243 /*IN*/ PVOID Object,
8244 /*IN*/ POBJECT_TYPE Type);
8246 NTOSAPI
8247 VOID
8248 DDKAPI
8249 ObDereferenceSecurityDescriptor(
8250 PSECURITY_DESCRIPTOR SecurityDescriptor,
8251 ULONG Count);
8253 NTOSAPI
8254 VOID
8255 DDKFASTAPI
8256 ObfDereferenceObject(
8257 /*IN*/ PVOID Object);
8260 * VOID
8261 * ObDereferenceObject(
8262 * IN PVOID Object)
8264 #define ObDereferenceObject ObfDereferenceObject
8266 NTOSAPI
8267 NTSTATUS
8268 DDKAPI
8269 ObGetObjectSecurity(
8270 /*IN*/ PVOID Object,
8271 /*OUT*/ PSECURITY_DESCRIPTOR *SecurityDescriptor,
8272 /*OUT*/ PBOOLEAN MemoryAllocated);
8274 NTOSAPI
8275 NTSTATUS
8276 DDKAPI
8277 ObInsertObject(
8278 /*IN*/ PVOID Object,
8279 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
8280 /*IN*/ ACCESS_MASK DesiredAccess,
8281 /*IN*/ ULONG AdditionalReferences,
8282 /*OUT*/ PVOID* ReferencedObject /*OPTIONAL*/,
8283 /*OUT*/ PHANDLE Handle);
8285 NTOSAPI
8286 VOID
8287 DDKFASTAPI
8288 ObfReferenceObject(
8289 /*IN*/ PVOID Object);
8291 NTOSAPI
8292 NTSTATUS
8293 DDKAPI
8294 ObLogSecurityDescriptor(
8295 /*IN*/ PSECURITY_DESCRIPTOR InputSecurityDescriptor,
8296 /*OUT*/ PSECURITY_DESCRIPTOR *OutputSecurityDescriptor,
8297 /*IN*/ ULONG RefBias);
8299 * VOID
8300 * ObReferenceObject(
8301 * IN PVOID Object)
8303 #define ObReferenceObject ObfReferenceObject
8305 NTOSAPI
8306 VOID
8307 DDKAPI
8308 ObMakeTemporaryObject(
8309 /*IN*/ PVOID Object);
8311 NTOSAPI
8312 NTSTATUS
8313 DDKAPI
8314 ObOpenObjectByName(
8315 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8316 /*IN*/ POBJECT_TYPE ObjectType,
8317 /*IN OUT*/ PVOID ParseContext /*OPTIONAL*/,
8318 /*IN*/ KPROCESSOR_MODE AccessMode,
8319 /*IN*/ ACCESS_MASK DesiredAccess,
8320 /*IN*/ PACCESS_STATE PassedAccessState,
8321 /*OUT*/ PHANDLE Handle);
8323 NTOSAPI
8324 NTSTATUS
8325 DDKAPI
8326 ObOpenObjectByPointer(
8327 /*IN*/ PVOID Object,
8328 /*IN*/ ULONG HandleAttributes,
8329 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
8330 /*IN*/ ACCESS_MASK DesiredAccess /*OPTIONAL*/,
8331 /*IN*/ POBJECT_TYPE ObjectType /*OPTIONAL*/,
8332 /*IN*/ KPROCESSOR_MODE AccessMode,
8333 /*OUT*/ PHANDLE Handle);
8335 NTOSAPI
8336 NTSTATUS
8337 DDKAPI
8338 ObQueryObjectAuditingByHandle(
8339 /*IN*/ HANDLE Handle,
8340 /*OUT*/ PBOOLEAN GenerateOnClose);
8342 NTOSAPI
8343 NTSTATUS
8344 DDKAPI
8345 ObReferenceObjectByHandle(
8346 /*IN*/ HANDLE Handle,
8347 /*IN*/ ACCESS_MASK DesiredAccess,
8348 /*IN*/ POBJECT_TYPE ObjectType /*OPTIONAL*/,
8349 /*IN*/ KPROCESSOR_MODE AccessMode,
8350 /*OUT*/ PVOID *Object,
8351 /*OUT*/ POBJECT_HANDLE_INFORMATION HandleInformation /*OPTIONAL*/);
8353 NTOSAPI
8354 NTSTATUS
8355 DDKAPI
8356 ObReferenceObjectByName(
8357 /*IN*/ PUNICODE_STRING ObjectPath,
8358 /*IN*/ ULONG Attributes,
8359 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
8360 /*IN*/ ACCESS_MASK DesiredAccess /*OPTIONAL*/,
8361 /*IN*/ POBJECT_TYPE ObjectType,
8362 /*IN*/ KPROCESSOR_MODE AccessMode,
8363 /*IN OUT*/ PVOID ParseContext /*OPTIONAL*/,
8364 /*OUT*/ PVOID *Object);
8366 NTOSAPI
8367 NTSTATUS
8368 DDKAPI
8369 ObReferenceObjectByPointer(
8370 /*IN*/ PVOID Object,
8371 /*IN*/ ACCESS_MASK DesiredAccess,
8372 /*IN*/ POBJECT_TYPE ObjectType,
8373 /*IN*/ KPROCESSOR_MODE AccessMode);
8375 NTOSAPI
8376 VOID
8377 DDKAPI
8378 ObReferenceSecurityDescriptor(
8379 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8380 /*IN*/ ULONG Count);
8382 NTOSAPI
8383 VOID
8384 DDKAPI
8385 ObReleaseObjectSecurity(
8386 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8387 /*IN*/ BOOLEAN MemoryAllocated);
8391 /** Process manager routines **/
8393 NTOSAPI
8394 NTSTATUS
8395 DDKAPI
8396 PsCreateSystemProcess(
8397 /*IN*/ PHANDLE ProcessHandle,
8398 /*IN*/ ACCESS_MASK DesiredAccess,
8399 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8401 NTOSAPI
8402 NTSTATUS
8403 DDKAPI
8404 PsCreateSystemThread(
8405 /*OUT*/ PHANDLE ThreadHandle,
8406 /*IN*/ ULONG DesiredAccess,
8407 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
8408 /*IN*/ HANDLE ProcessHandle /*OPTIONAL*/,
8409 /*OUT*/ PCLIENT_ID ClientId /*OPTIONAL*/,
8410 /*IN*/ PKSTART_ROUTINE StartRoutine,
8411 /*IN*/ PVOID StartContext);
8414 * PEPROCESS
8415 * PsGetCurrentProcess(VOID)
8417 #define PsGetCurrentProcess IoGetCurrentProcess
8419 NTOSAPI
8420 HANDLE
8421 DDKAPI
8422 PsGetCurrentProcessId(
8423 VOID);
8426 * PETHREAD
8427 * PsGetCurrentThread(VOID)
8429 #define PsGetCurrentThread() \
8430 ((PETHREAD) KeGetCurrentThread())
8432 NTOSAPI
8433 HANDLE
8434 DDKAPI
8435 PsGetCurrentThreadId(
8436 VOID);
8438 NTOSAPI
8439 BOOLEAN
8440 DDKAPI
8441 PsGetVersion(
8442 PULONG MajorVersion /*OPTIONAL*/,
8443 PULONG MinorVersion /*OPTIONAL*/,
8444 PULONG BuildNumber /*OPTIONAL*/,
8445 PUNICODE_STRING CSDVersion /*OPTIONAL*/);
8447 NTOSAPI
8448 NTSTATUS
8449 DDKAPI
8450 PsRemoveCreateThreadNotifyRoutine(
8451 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
8453 NTOSAPI
8454 NTSTATUS
8455 DDKAPI
8456 PsRemoveLoadImageNotifyRoutine(
8457 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
8459 NTOSAPI
8460 NTSTATUS
8461 DDKAPI
8462 PsSetCreateProcessNotifyRoutine(
8463 /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine,
8464 /*IN*/ BOOLEAN Remove);
8466 NTOSAPI
8467 NTSTATUS
8468 DDKAPI
8469 PsSetCreateThreadNotifyRoutine(
8470 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
8472 NTOSAPI
8473 NTSTATUS
8474 DDKAPI
8475 PsSetLoadImageNotifyRoutine(
8476 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
8478 NTOSAPI
8479 NTSTATUS
8480 DDKAPI
8481 PsTerminateSystemThread(
8482 /*IN*/ NTSTATUS ExitStatus);
8486 /** Security reference monitor routines **/
8488 NTOSAPI
8489 BOOLEAN
8490 DDKAPI
8491 SeAccessCheck(
8492 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8493 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext,
8494 /*IN*/ BOOLEAN SubjectContextLocked,
8495 /*IN*/ ACCESS_MASK DesiredAccess,
8496 /*IN*/ ACCESS_MASK PreviouslyGrantedAccess,
8497 /*OUT*/ PPRIVILEGE_SET *Privileges /*OPTIONAL*/,
8498 /*IN*/ PGENERIC_MAPPING GenericMapping,
8499 /*IN*/ KPROCESSOR_MODE AccessMode,
8500 /*OUT*/ PACCESS_MASK GrantedAccess,
8501 /*OUT*/ PNTSTATUS AccessStatus);
8503 NTOSAPI
8504 NTSTATUS
8505 DDKAPI
8506 SeAssignSecurity(
8507 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor /*OPTIONAL*/,
8508 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor /*OPTIONAL*/,
8509 /*OUT*/ PSECURITY_DESCRIPTOR *NewDescriptor,
8510 /*IN*/ BOOLEAN IsDirectoryObject,
8511 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext,
8512 /*IN*/ PGENERIC_MAPPING GenericMapping,
8513 /*IN*/ POOL_TYPE PoolType);
8515 NTOSAPI
8516 NTSTATUS
8517 DDKAPI
8518 SeAssignSecurityEx(
8519 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor /*OPTIONAL*/,
8520 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor /*OPTIONAL*/,
8521 /*OUT*/ PSECURITY_DESCRIPTOR *NewDescriptor,
8522 /*IN*/ GUID *ObjectType /*OPTIONAL*/,
8523 /*IN*/ BOOLEAN IsDirectoryObject,
8524 /*IN*/ ULONG AutoInheritFlags,
8525 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext,
8526 /*IN*/ PGENERIC_MAPPING GenericMapping,
8527 /*IN*/ POOL_TYPE PoolType);
8529 NTOSAPI
8530 NTSTATUS
8531 DDKAPI
8532 SeDeassignSecurity(
8533 /*IN OUT*/ PSECURITY_DESCRIPTOR *SecurityDescriptor);
8535 NTOSAPI
8536 BOOLEAN
8537 DDKAPI
8538 SeSinglePrivilegeCheck(
8539 LUID PrivilegeValue,
8540 KPROCESSOR_MODE PreviousMode);
8542 NTOSAPI
8543 BOOLEAN
8544 DDKAPI
8545 SeValidSecurityDescriptor(
8546 /*IN*/ ULONG Length,
8547 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
8551 /** NtXxx routines **/
8553 NTOSAPI
8554 NTSTATUS
8555 DDKAPI
8556 NtOpenProcess(
8557 /*OUT*/ PHANDLE ProcessHandle,
8558 /*IN*/ ACCESS_MASK DesiredAccess,
8559 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8560 /*IN*/ PCLIENT_ID ClientId /*OPTIONAL*/);
8562 NTOSAPI
8563 NTSTATUS
8564 DDKAPI
8565 NtQueryInformationProcess(
8566 /*IN*/ HANDLE ProcessHandle,
8567 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
8568 /*OUT*/ PVOID ProcessInformation,
8569 /*IN*/ ULONG ProcessInformationLength,
8570 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
8574 /** NtXxx and ZwXxx routines **/
8576 NTOSAPI
8577 NTSTATUS
8578 DDKAPI
8579 ZwCancelTimer(
8580 /*IN*/ HANDLE TimerHandle,
8581 /*OUT*/ PBOOLEAN CurrentState /*OPTIONAL*/);
8583 NTOSAPI
8584 NTSTATUS
8585 DDKAPI
8586 NtClose(
8587 /*IN*/ HANDLE Handle);
8589 NTOSAPI
8590 NTSTATUS
8591 DDKAPI
8592 ZwClose(
8593 /*IN*/ HANDLE Handle);
8595 NTOSAPI
8596 NTSTATUS
8597 DDKAPI
8598 ZwCreateDirectoryObject(
8599 /*OUT*/ PHANDLE DirectoryHandle,
8600 /*IN*/ ACCESS_MASK DesiredAccess,
8601 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8603 NTOSAPI
8604 NTSTATUS
8605 DDKAPI
8606 NtCreateEvent(
8607 /*OUT*/ PHANDLE EventHandle,
8608 /*IN*/ ACCESS_MASK DesiredAccess,
8609 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8610 /*IN*/ BOOLEAN ManualReset,
8611 /*IN*/ BOOLEAN InitialState);
8613 NTOSAPI
8614 NTSTATUS
8615 DDKAPI
8616 ZwCreateEvent(
8617 /*OUT*/ PHANDLE EventHandle,
8618 /*IN*/ ACCESS_MASK DesiredAccess,
8619 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8620 /*IN*/ BOOLEAN ManualReset,
8621 /*IN*/ BOOLEAN InitialState);
8623 NTOSAPI
8624 NTSTATUS
8625 DDKAPI
8626 ZwCreateFile(
8627 /*OUT*/ PHANDLE FileHandle,
8628 /*IN*/ ACCESS_MASK DesiredAccess,
8629 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8630 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8631 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
8632 /*IN*/ ULONG FileAttributes,
8633 /*IN*/ ULONG ShareAccess,
8634 /*IN*/ ULONG CreateDisposition,
8635 /*IN*/ ULONG CreateOptions,
8636 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
8637 /*IN*/ ULONG EaLength);
8639 NTOSAPI
8640 NTSTATUS
8641 DDKAPI
8642 ZwCreateKey(
8643 /*OUT*/ PHANDLE KeyHandle,
8644 /*IN*/ ACCESS_MASK DesiredAccess,
8645 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8646 /*IN*/ ULONG TitleIndex,
8647 /*IN*/ PUNICODE_STRING Class /*OPTIONAL*/,
8648 /*IN*/ ULONG CreateOptions,
8649 /*OUT*/ PULONG Disposition /*OPTIONAL*/);
8651 NTOSAPI
8652 NTSTATUS
8653 DDKAPI
8654 ZwCreateTimer(
8655 /*OUT*/ PHANDLE TimerHandle,
8656 /*IN*/ ACCESS_MASK DesiredAccess,
8657 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
8658 /*IN*/ TIMER_TYPE TimerType);
8660 NTOSAPI
8661 NTSTATUS
8662 DDKAPI
8663 ZwDeleteKey(
8664 /*IN*/ HANDLE KeyHandle);
8666 NTOSAPI
8667 NTSTATUS
8668 DDKAPI
8669 ZwDeleteValueKey(
8670 /*IN*/ HANDLE KeyHandle,
8671 /*IN*/ PUNICODE_STRING ValueName);
8673 NTOSAPI
8674 NTSTATUS
8675 DDKAPI
8676 NtDeviceIoControlFile(
8677 /*IN*/ HANDLE DeviceHandle,
8678 /*IN*/ HANDLE Event /*OPTIONAL*/,
8679 /*IN*/ PIO_APC_ROUTINE UserApcRoutine /*OPTIONAL*/,
8680 /*IN*/ PVOID UserApcContext /*OPTIONAL*/,
8681 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8682 /*IN*/ ULONG IoControlCode,
8683 /*IN*/ PVOID InputBuffer,
8684 /*IN*/ ULONG InputBufferSize,
8685 /*OUT*/ PVOID OutputBuffer,
8686 /*IN*/ ULONG OutputBufferSize);
8688 NTOSAPI
8689 NTSTATUS
8690 DDKAPI
8691 ZwDeviceIoControlFile(
8692 /*IN*/ HANDLE DeviceHandle,
8693 /*IN*/ HANDLE Event /*OPTIONAL*/,
8694 /*IN*/ PIO_APC_ROUTINE UserApcRoutine /*OPTIONAL*/,
8695 /*IN*/ PVOID UserApcContext /*OPTIONAL*/,
8696 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8697 /*IN*/ ULONG IoControlCode,
8698 /*IN*/ PVOID InputBuffer,
8699 /*IN*/ ULONG InputBufferSize,
8700 /*OUT*/ PVOID OutputBuffer,
8701 /*IN*/ ULONG OutputBufferSize);
8703 NTOSAPI
8704 NTSTATUS
8705 DDKAPI
8706 ZwEnumerateKey(
8707 /*IN*/ HANDLE KeyHandle,
8708 /*IN*/ ULONG Index,
8709 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
8710 /*OUT*/ PVOID KeyInformation,
8711 /*IN*/ ULONG Length,
8712 /*OUT*/ PULONG ResultLength);
8714 NTOSAPI
8715 NTSTATUS
8716 DDKAPI
8717 ZwEnumerateValueKey(
8718 /*IN*/ HANDLE KeyHandle,
8719 /*IN*/ ULONG Index,
8720 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
8721 /*OUT*/ PVOID KeyValueInformation,
8722 /*IN*/ ULONG Length,
8723 /*OUT*/ PULONG ResultLength);
8725 NTOSAPI
8726 NTSTATUS
8727 DDKAPI
8728 ZwFlushKey(
8729 /*IN*/ HANDLE KeyHandle);
8731 NTOSAPI
8732 NTSTATUS
8733 DDKAPI
8734 ZwMakeTemporaryObject(
8735 /*IN*/ HANDLE Handle);
8737 NTOSAPI
8738 NTSTATUS
8739 DDKAPI
8740 NtMapViewOfSection(
8741 /*IN*/ HANDLE SectionHandle,
8742 /*IN*/ HANDLE ProcessHandle,
8743 /*IN OUT*/ PVOID *BaseAddress,
8744 /*IN*/ ULONG ZeroBits,
8745 /*IN*/ ULONG CommitSize,
8746 /*IN OUT*/ PLARGE_INTEGER SectionOffset /*OPTIONAL*/,
8747 /*IN OUT*/ PSIZE_T ViewSize,
8748 /*IN*/ SECTION_INHERIT InheritDisposition,
8749 /*IN*/ ULONG AllocationType,
8750 /*IN*/ ULONG Protect);
8752 NTOSAPI
8753 NTSTATUS
8754 DDKAPI
8755 ZwMapViewOfSection(
8756 /*IN*/ HANDLE SectionHandle,
8757 /*IN*/ HANDLE ProcessHandle,
8758 /*IN OUT*/ PVOID *BaseAddress,
8759 /*IN*/ ULONG ZeroBits,
8760 /*IN*/ ULONG CommitSize,
8761 /*IN OUT*/ PLARGE_INTEGER SectionOffset /*OPTIONAL*/,
8762 /*IN OUT*/ PSIZE_T ViewSize,
8763 /*IN*/ SECTION_INHERIT InheritDisposition,
8764 /*IN*/ ULONG AllocationType,
8765 /*IN*/ ULONG Protect);
8767 NTOSAPI
8768 NTSTATUS
8769 DDKAPI
8770 NtOpenFile(
8771 /*OUT*/ PHANDLE FileHandle,
8772 /*IN*/ ACCESS_MASK DesiredAccess,
8773 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8774 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8775 /*IN*/ ULONG ShareAccess,
8776 /*IN*/ ULONG OpenOptions);
8778 NTOSAPI
8779 NTSTATUS
8780 DDKAPI
8781 ZwOpenFile(
8782 /*OUT*/ PHANDLE FileHandle,
8783 /*IN*/ ACCESS_MASK DesiredAccess,
8784 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8785 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8786 /*IN*/ ULONG ShareAccess,
8787 /*IN*/ ULONG OpenOptions);
8789 NTOSAPI
8790 NTSTATUS
8791 DDKAPI
8792 ZwOpenKey(
8793 /*OUT*/ PHANDLE KeyHandle,
8794 /*IN*/ ACCESS_MASK DesiredAccess,
8795 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8797 NTOSAPI
8798 NTSTATUS
8799 DDKAPI
8800 ZwOpenSection(
8801 /*OUT*/ PHANDLE SectionHandle,
8802 /*IN*/ ACCESS_MASK DesiredAccess,
8803 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8805 NTOSAPI
8806 NTSTATUS
8807 DDKAPI
8808 ZwOpenSymbolicLinkObject(
8809 /*OUT*/ PHANDLE LinkHandle,
8810 /*IN*/ ACCESS_MASK DesiredAccess,
8811 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8813 NTOSAPI
8814 NTSTATUS
8815 DDKAPI
8816 ZwOpenTimer(
8817 /*OUT*/ PHANDLE TimerHandle,
8818 /*IN*/ ACCESS_MASK DesiredAccess,
8819 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8821 NTOSAPI
8822 NTSTATUS
8823 DDKAPI
8824 ZwQueryInformationFile(
8825 /*IN*/ HANDLE FileHandle,
8826 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8827 /*OUT*/ PVOID FileInformation,
8828 /*IN*/ ULONG Length,
8829 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass);
8831 NTOSAPI
8832 NTSTATUS
8833 DDKAPI
8834 ZwQueryKey(
8835 /*IN*/ HANDLE KeyHandle,
8836 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
8837 /*OUT*/ PVOID KeyInformation,
8838 /*IN*/ ULONG Length,
8839 /*OUT*/ PULONG ResultLength);
8841 NTOSAPI
8842 NTSTATUS
8843 DDKAPI
8844 ZwQuerySymbolicLinkObject(
8845 /*IN*/ HANDLE LinkHandle,
8846 /*IN OUT*/ PUNICODE_STRING LinkTarget,
8847 /*OUT*/ PULONG ReturnedLength /*OPTIONAL*/);
8849 NTOSAPI
8850 NTSTATUS
8851 DDKAPI
8852 ZwQueryValueKey(
8853 /*IN*/ HANDLE KeyHandle,
8854 /*IN*/ PUNICODE_STRING ValueName,
8855 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
8856 /*OUT*/ PVOID KeyValueInformation,
8857 /*IN*/ ULONG Length,
8858 /*OUT*/ PULONG ResultLength);
8860 NTOSAPI
8861 NTSTATUS
8862 DDKAPI
8863 NtReadFile(
8864 /*IN*/ HANDLE FileHandle,
8865 /*IN*/ HANDLE Event /*OPTIONAL*/,
8866 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8867 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8868 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8869 /*OUT*/ PVOID Buffer,
8870 /*IN*/ ULONG Length,
8871 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8872 /*IN*/ PULONG Key /*OPTIONAL*/);
8874 NTOSAPI
8875 NTSTATUS
8876 DDKAPI
8877 ZwReadFile(
8878 /*IN*/ HANDLE FileHandle,
8879 /*IN*/ HANDLE Event /*OPTIONAL*/,
8880 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8881 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8882 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8883 /*OUT*/ PVOID Buffer,
8884 /*IN*/ ULONG Length,
8885 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8886 /*IN*/ PULONG Key /*OPTIONAL*/);
8888 NTOSAPI
8889 NTSTATUS
8890 DDKAPI
8891 NtSetEvent(
8892 /*IN*/ HANDLE EventHandle,
8893 /*IN*/ PULONG NumberOfThreadsReleased);
8895 NTOSAPI
8896 NTSTATUS
8897 DDKAPI
8898 ZwSetEvent(
8899 /*IN*/ HANDLE EventHandle,
8900 /*IN*/ PULONG NumberOfThreadsReleased);
8902 NTOSAPI
8903 NTSTATUS
8904 DDKAPI
8905 ZwSetInformationFile(
8906 /*IN*/ HANDLE FileHandle,
8907 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8908 /*IN*/ PVOID FileInformation,
8909 /*IN*/ ULONG Length,
8910 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass);
8912 NTOSAPI
8913 NTSTATUS
8914 DDKAPI
8915 ZwSetInformationThread(
8916 /*IN*/ HANDLE ThreadHandle,
8917 /*IN*/ THREADINFOCLASS ThreadInformationClass,
8918 /*IN*/ PVOID ThreadInformation,
8919 /*IN*/ ULONG ThreadInformationLength);
8921 NTOSAPI
8922 NTSTATUS
8923 DDKAPI
8924 ZwSetTimer(
8925 /*IN*/ HANDLE TimerHandle,
8926 /*IN*/ PLARGE_INTEGER DueTime,
8927 /*IN*/ PTIMER_APC_ROUTINE TimerApcRoutine /*OPTIONAL*/,
8928 /*IN*/ PVOID TimerContext /*OPTIONAL*/,
8929 /*IN*/ BOOLEAN WakeTimer,
8930 /*IN*/ LONG Period /*OPTIONAL*/,
8931 /*OUT*/ PBOOLEAN PreviousState /*OPTIONAL*/);
8933 NTOSAPI
8934 NTSTATUS
8935 DDKAPI
8936 ZwSetValueKey(
8937 /*IN*/ HANDLE KeyHandle,
8938 /*IN*/ PUNICODE_STRING ValueName,
8939 /*IN*/ ULONG TitleIndex /*OPTIONAL*/,
8940 /*IN*/ ULONG Type,
8941 /*IN*/ PVOID Data,
8942 /*IN*/ ULONG DataSize);
8944 /* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
8945 #define AT_EXTENDABLE_FILE 0x00002000
8946 #define SEC_NO_CHANGE 0x00400000
8947 #define AT_RESERVED 0x20000000
8948 #define AT_ROUND_TO_PAGE 0x40000000
8950 NTOSAPI
8951 NTSTATUS
8952 DDKAPI
8953 NtUnmapViewOfSection(
8954 /*IN*/ HANDLE ProcessHandle,
8955 /*IN*/ PVOID BaseAddress);
8957 NTOSAPI
8958 NTSTATUS
8959 DDKAPI
8960 ZwUnmapViewOfSection(
8961 /*IN*/ HANDLE ProcessHandle,
8962 /*IN*/ PVOID BaseAddress);
8964 NTOSAPI
8965 NTSTATUS
8966 DDKAPI
8967 NtWaitForSingleObject(
8968 /*IN*/ HANDLE Object,
8969 /*IN*/ BOOLEAN Alertable,
8970 /*IN*/ PLARGE_INTEGER Time);
8972 NTOSAPI
8973 NTSTATUS
8974 DDKAPI
8975 ZwWaitForSingleObject(
8976 /*IN*/ HANDLE Object,
8977 /*IN*/ BOOLEAN Alertable,
8978 /*IN*/ PLARGE_INTEGER Time);
8980 NTOSAPI
8981 NTSTATUS
8982 DDKAPI
8983 NtWriteFile(
8984 /*IN*/ HANDLE FileHandle,
8985 /*IN*/ HANDLE Event /*OPTIONAL*/,
8986 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8987 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8988 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8989 /*IN*/ PVOID Buffer,
8990 /*IN*/ ULONG Length,
8991 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8992 /*IN*/ PULONG Key /*OPTIONAL*/);
8994 NTOSAPI
8995 NTSTATUS
8996 DDKAPI
8997 ZwWriteFile(
8998 /*IN*/ HANDLE FileHandle,
8999 /*IN*/ HANDLE Event /*OPTIONAL*/,
9000 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
9001 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
9002 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
9003 /*IN*/ PVOID Buffer,
9004 /*IN*/ ULONG Length,
9005 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
9006 /*IN*/ PULONG Key /*OPTIONAL*/);
9010 /** Power management support routines **/
9012 NTOSAPI
9013 NTSTATUS
9014 DDKAPI
9015 PoCallDriver(
9016 /*IN*/ PDEVICE_OBJECT DeviceObject,
9017 /*IN OUT*/ PIRP Irp);
9019 NTOSAPI
9020 PULONG
9021 DDKAPI
9022 PoRegisterDeviceForIdleDetection(
9023 /*IN*/ PDEVICE_OBJECT DeviceObject,
9024 /*IN*/ ULONG ConservationIdleTime,
9025 /*IN*/ ULONG PerformanceIdleTime,
9026 /*IN*/ DEVICE_POWER_STATE State);
9028 NTOSAPI
9029 PVOID
9030 DDKAPI
9031 PoRegisterSystemState(
9032 /*IN*/ PVOID StateHandle,
9033 /*IN*/ EXECUTION_STATE Flags);
9035 NTOSAPI
9036 NTSTATUS
9037 DDKAPI
9038 PoRequestPowerIrp(
9039 /*IN*/ PDEVICE_OBJECT DeviceObject,
9040 /*IN*/ UCHAR MinorFunction,
9041 /*IN*/ POWER_STATE PowerState,
9042 /*IN*/ PREQUEST_POWER_COMPLETE CompletionFunction,
9043 /*IN*/ PVOID Context,
9044 /*OUT*/ PIRP *Irp /*OPTIONAL*/);
9046 NTOSAPI
9047 NTSTATUS
9048 DDKAPI
9049 PoRequestShutdownEvent(
9050 /*OUT*/ PVOID *Event);
9052 NTOSAPI
9053 VOID
9054 DDKAPI
9055 PoSetDeviceBusy(
9056 PULONG IdlePointer);
9058 NTOSAPI
9059 POWER_STATE
9060 DDKAPI
9061 PoSetPowerState(
9062 /*IN*/ PDEVICE_OBJECT DeviceObject,
9063 /*IN*/ POWER_STATE_TYPE Type,
9064 /*IN*/ POWER_STATE State);
9066 NTOSAPI
9067 VOID
9068 DDKAPI
9069 PoSetSystemState(
9070 /*IN*/ EXECUTION_STATE Flags);
9072 NTOSAPI
9073 VOID
9074 DDKAPI
9075 PoStartNextPowerIrp(
9076 /*IN*/ PIRP Irp);
9078 NTOSAPI
9079 VOID
9080 DDKAPI
9081 PoUnregisterSystemState(
9082 /*IN*/ PVOID StateHandle);
9086 /** WMI library support routines **/
9088 NTOSAPI
9089 NTSTATUS
9090 DDKAPI
9091 WmiCompleteRequest(
9092 /*IN*/ PDEVICE_OBJECT DeviceObject,
9093 /*IN*/ PIRP Irp,
9094 /*IN*/ NTSTATUS Status,
9095 /*IN*/ ULONG BufferUsed,
9096 /*IN*/ CCHAR PriorityBoost);
9098 NTOSAPI
9099 NTSTATUS
9100 DDKAPI
9101 WmiFireEvent(
9102 /*IN*/ PDEVICE_OBJECT DeviceObject,
9103 /*IN*/ LPGUID Guid,
9104 /*IN*/ ULONG InstanceIndex,
9105 /*IN*/ ULONG EventDataSize,
9106 /*IN*/ PVOID EventData);
9108 NTOSAPI
9109 NTSTATUS
9110 DDKAPI
9111 WmiQueryTraceInformation(
9112 /*IN*/ TRACE_INFORMATION_CLASS TraceInformationClass,
9113 /*OUT*/ PVOID TraceInformation,
9114 /*IN*/ ULONG TraceInformationLength,
9115 /*OUT*/ PULONG RequiredLength /*OPTIONAL*/,
9116 /*IN*/ PVOID Buffer /*OPTIONAL*/);
9118 NTOSAPI
9119 NTSTATUS
9120 DDKAPI
9121 WmiSystemControl(
9122 /*IN*/ PWMILIB_CONTEXT WmiLibInfo,
9123 /*IN*/ PDEVICE_OBJECT DeviceObject,
9124 /*IN*/ PIRP Irp,
9125 /*OUT*/ PSYSCTL_IRP_DISPOSITION IrpDisposition);
9127 NTOSAPI
9128 NTSTATUS
9129 DDKCDECLAPI
9130 WmiTraceMessage(
9131 /*IN*/ TRACEHANDLE LoggerHandle,
9132 /*IN*/ ULONG MessageFlags,
9133 /*IN*/ LPGUID MessageGuid,
9134 /*IN*/ USHORT MessageNumber,
9135 /*IN*/ ...);
9137 #if 0
9138 /* FIXME: Get va_list from where? */
9139 NTOSAPI
9140 NTSTATUS
9141 DDKCDECLAPI
9142 WmiTraceMessageVa(
9143 /*IN*/ TRACEHANDLE LoggerHandle,
9144 /*IN*/ ULONG MessageFlags,
9145 /*IN*/ LPGUID MessageGuid,
9146 /*IN*/ USHORT MessageNumber,
9147 /*IN*/ va_list MessageArgList);
9148 #endif
9151 /** Kernel debugger routines **/
9153 NTOSAPI
9154 VOID
9155 DDKAPI
9156 KdDisableDebugger(
9157 VOID);
9159 NTOSAPI
9160 VOID
9161 DDKAPI
9162 KdEnableDebugger(
9163 VOID);
9165 NTOSAPI
9166 VOID
9167 DDKAPI
9168 DbgBreakPoint(
9169 VOID);
9171 NTOSAPI
9172 VOID
9173 DDKAPI
9174 DbgBreakPointWithStatus(
9175 /*IN*/ ULONG Status);
9177 NTOSAPI
9178 ULONG
9179 DDKCDECLAPI
9180 DbgPrint(
9181 /*IN*/ PCH Format,
9182 /*IN*/ ...);
9184 NTOSAPI
9185 ULONG
9186 DDKCDECLAPI
9187 DbgPrintEx(
9188 /*IN*/ ULONG ComponentId,
9189 /*IN*/ ULONG Level,
9190 /*IN*/ PCH Format,
9191 /*IN*/ ...);
9193 NTOSAPI
9194 ULONG
9195 DDKCDECLAPI
9196 DbgPrintReturnControlC(
9197 /*IN*/ PCH Format,
9198 /*IN*/ ...);
9200 NTOSAPI
9201 NTSTATUS
9202 DDKAPI
9203 DbgQueryDebugFilterState(
9204 /*IN*/ ULONG ComponentId,
9205 /*IN*/ ULONG Level);
9207 NTOSAPI
9208 NTSTATUS
9209 DDKAPI
9210 DbgSetDebugFilterState(
9211 /*IN*/ ULONG ComponentId,
9212 /*IN*/ ULONG Level,
9213 /*IN*/ BOOLEAN State);
9215 #ifdef DBG
9217 #define KdPrint(_x_) DbgPrint _x_
9218 #define KdPrintEx(_x_) DbgPrintEx _x_
9219 #define KdBreakPoint() DbgBreakPoint()
9220 #define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
9222 #else /* !DBG */
9224 #define KdPrint(_x_)
9225 #define KdPrintEx(_x_)
9226 #define KdBreakPoint()
9227 #define KdBreakPointWithStatus(s)
9229 #endif /* !DBG */
9231 extern NTOSAPI PBOOLEAN KdDebuggerNotPresent;
9232 extern NTOSAPI PBOOLEAN KdDebuggerEnabled;
9233 #define KD_DEBUGGER_ENABLED *KdDebuggerEnabled
9234 #define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
9236 #ifdef __cplusplus
9238 #endif
9240 #endif /* __WINDDK_H */