Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / ddk / winddk.h
blob6f151f224bd1c18c43936ede639ba3246b8f9970
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()->ProcessorNumber)
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*/ PLONG VOLATILE Addend);
3847 NTOSAPI
3848 LONG
3849 DDKFASTAPI
3850 InterlockedDecrement(
3851 /*IN*/ PLONG 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 NTOSAPI
4900 BOOLEAN
4901 DDKAPI
4902 RtlTestBit(
4903 /*IN*/ PRTL_BITMAP BitMapHeader,
4904 /*IN*/ ULONG BitNumber);
4906 NTOSAPI
4907 BOOLEAN
4908 DDKAPI
4909 RtlTimeFieldsToTime(
4910 /*IN*/ PTIME_FIELDS TimeFields,
4911 /*IN*/ PLARGE_INTEGER Time);
4913 NTOSAPI
4914 VOID
4915 DDKAPI
4916 RtlTimeToTimeFields(
4917 /*IN*/ PLARGE_INTEGER Time,
4918 /*IN*/ PTIME_FIELDS TimeFields);
4920 NTOSAPI
4921 ULONG
4922 DDKFASTAPI
4923 RtlUlongByteSwap(
4924 /*IN*/ ULONG Source);
4926 NTOSAPI
4927 ULONGLONG
4928 DDKFASTAPI
4929 RtlUlonglongByteSwap(
4930 /*IN*/ ULONGLONG Source);
4932 NTOSAPI
4933 ULONG
4934 DDKAPI
4935 RtlUnicodeStringToAnsiSize(
4936 /*IN*/ PUNICODE_STRING UnicodeString);
4938 NTOSAPI
4939 NTSTATUS
4940 DDKAPI
4941 RtlUnicodeStringToAnsiString(
4942 /*IN OUT*/ PANSI_STRING DestinationString,
4943 /*IN*/ PUNICODE_STRING SourceString,
4944 /*IN*/ BOOLEAN AllocateDestinationString);
4946 NTOSAPI
4947 NTSTATUS
4948 DDKAPI
4949 RtlUnicodeStringToInteger(
4950 /*IN*/ PUNICODE_STRING String,
4951 /*IN*/ ULONG Base /*OPTIONAL*/,
4952 /*OUT*/ PULONG Value);
4954 NTOSAPI
4955 WCHAR
4956 DDKAPI
4957 RtlUpcaseUnicodeChar(
4958 /*IN*/ WCHAR SourceCharacter);
4960 NTOSAPI
4961 NTSTATUS
4962 DDKAPI
4963 RtlUpcaseUnicodeString(
4964 /*IN OUT*/ PUNICODE_STRING DestinationString /*OPTIONAL*/,
4965 /*IN*/ PCUNICODE_STRING SourceString,
4966 /*IN*/ BOOLEAN AllocateDestinationString);
4968 NTOSAPI
4969 CHAR
4970 DDKAPI
4971 RtlUpperChar(
4972 /*IN*/ CHAR Character);
4974 NTOSAPI
4975 VOID
4976 DDKAPI
4977 RtlUpperString(
4978 /*IN OUT*/ PSTRING DestinationString,
4979 /*IN*/ PSTRING SourceString);
4981 NTOSAPI
4982 USHORT
4983 DDKFASTAPI
4984 RtlUshortByteSwap(
4985 /*IN*/ USHORT Source);
4987 NTOSAPI
4988 BOOLEAN
4989 DDKAPI
4990 RtlValidRelativeSecurityDescriptor(
4991 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptorInput,
4992 /*IN*/ ULONG SecurityDescriptorLength,
4993 /*IN*/ SECURITY_INFORMATION RequiredInformation);
4995 NTOSAPI
4996 BOOLEAN
4997 DDKAPI
4998 RtlValidSecurityDescriptor(
4999 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
5001 NTOSAPI
5002 NTSTATUS
5003 DDKAPI
5004 RtlVerifyVersionInfo(
5005 /*IN*/ PRTL_OSVERSIONINFOEXW VersionInfo,
5006 /*IN*/ ULONG TypeMask,
5007 /*IN*/ ULONGLONG ConditionMask);
5009 NTOSAPI
5010 NTSTATUS
5011 DDKAPI
5012 RtlVolumeDeviceToDosName(
5013 /*IN*/ PVOID VolumeDeviceObject,
5014 /*OUT*/ PUNICODE_STRING DosName);
5016 NTOSAPI
5017 ULONG
5018 DDKAPI
5019 RtlWalkFrameChain(
5020 /*OUT*/ PVOID *Callers,
5021 /*IN*/ ULONG Count,
5022 /*IN*/ ULONG Flags);
5024 NTOSAPI
5025 NTSTATUS
5026 DDKAPI
5027 RtlWriteRegistryValue(
5028 /*IN*/ ULONG RelativeTo,
5029 /*IN*/ PCWSTR Path,
5030 /*IN*/ PCWSTR ValueName,
5031 /*IN*/ ULONG ValueType,
5032 /*IN*/ PVOID ValueData,
5033 /*IN*/ ULONG ValueLength);
5035 NTOSAPI
5036 ULONG
5037 DDKAPI
5038 RtlxUnicodeStringToAnsiSize(
5039 /*IN*/ PUNICODE_STRING UnicodeString);
5042 * VOID
5043 * RtlZeroMemory(
5044 * IN VOID UNALIGNED *Destination,
5045 * IN SIZE_T Length)
5047 #ifndef RtlZeroMemory
5048 #define RtlZeroMemory(Destination, Length) \
5049 memset(Destination, 0, Length)
5050 #endif
5052 #ifndef RtlZeroBytes
5053 #define RtlZeroBytes RtlZeroMemory
5054 #endif
5057 /** Executive support routines **/
5059 NTOSAPI
5060 VOID
5061 DDKFASTAPI
5062 ExAcquireFastMutex(
5063 /*IN*/ PFAST_MUTEX FastMutex);
5065 NTOSAPI
5066 VOID
5067 DDKFASTAPI
5068 ExAcquireFastMutexUnsafe(
5069 /*IN*/ PFAST_MUTEX FastMutex);
5071 NTOSAPI
5072 BOOLEAN
5073 DDKAPI
5074 ExAcquireResourceExclusiveLite(
5075 /*IN*/ PERESOURCE Resource,
5076 /*IN*/ BOOLEAN Wait);
5078 NTOSAPI
5079 BOOLEAN
5080 DDKAPI
5081 ExAcquireResourceSharedLite(
5082 /*IN*/ PERESOURCE Resource,
5083 /*IN*/ BOOLEAN Wait);
5085 NTOSAPI
5086 BOOLEAN
5087 DDKAPI
5088 ExAcquireSharedStarveExclusive(
5089 /*IN*/ PERESOURCE Resource,
5090 /*IN*/ BOOLEAN Wait);
5092 NTOSAPI
5093 BOOLEAN
5094 DDKAPI
5095 ExAcquireSharedWaitForExclusive(
5096 /*IN*/ PERESOURCE Resource,
5097 /*IN*/ BOOLEAN Wait);
5100 NTOSAPI
5101 PSINGLE_LIST_ENTRY
5102 DDKFASTAPI
5103 ExInterlockedPopEntrySList(
5104 /*IN*/ PSLIST_HEADER ListHead,
5105 /*IN*/ PKSPIN_LOCK Lock);
5108 NTOSAPI
5109 PSINGLE_LIST_ENTRY
5110 DDKFASTAPI
5111 ExInterlockedPushEntrySList(
5112 /*IN*/ PSLIST_HEADER ListHead,
5113 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5114 /*IN*/ PKSPIN_LOCK Lock);
5117 #if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
5118 #define ExInterlockedPopEntrySList(_ListHead, \
5119 _Lock) \
5120 InterlockedPopEntrySList(_ListHead)
5122 #define ExInterlockedPushEntrySList(_ListHead, \
5123 _ListEntry, \
5124 _Lock) \
5125 InterlockedPushEntrySList(_ListHead, _ListEntry)
5126 #endif /* __USE_NTOSKRNL__ */
5128 #define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
5130 static __inline PVOID
5131 ExAllocateFromNPagedLookasideList(
5132 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside)
5134 PVOID Entry;
5136 Lookaside->TotalAllocates++;
5137 Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
5138 &Lookaside->Obsoleted);
5139 if (Entry == NULL) {
5140 Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
5141 Entry = (Lookaside->Allocate)(Lookaside->Type,
5142 Lookaside->Size,
5143 Lookaside->Tag);
5145 return Entry;
5148 static __inline VOID
5149 ExFreeToNPagedLookasideList(
5150 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside,
5151 /*IN*/ PVOID Entry)
5153 Lookaside->TotalFrees++;
5154 if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
5155 Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
5156 (Lookaside->Free)(Entry);
5157 } else {
5158 ExInterlockedPushEntrySList(&Lookaside->ListHead,
5159 (PSLIST_ENTRY)Entry,
5160 &Lookaside->Obsoleted);
5164 #if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
5166 static __inline PVOID
5167 ExAllocateFromPagedLookasideList(
5168 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside)
5170 PVOID Entry;
5172 Lookaside->TotalAllocates++;
5173 Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
5174 if (Entry == NULL) {
5175 Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
5176 Entry = (Lookaside->Allocate)(Lookaside->Type,
5177 Lookaside->Size,
5178 Lookaside->Tag);
5180 return Entry;
5183 static __inline VOID
5184 ExFreeToPagedLookasideList(
5185 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5186 /*IN*/ PVOID Entry)
5188 Lookaside->TotalFrees++;
5189 if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
5190 Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
5191 (Lookaside->Free)(Entry);
5192 } else {
5193 InterlockedPushEntrySList(&Lookaside->ListHead,
5194 (PSLIST_ENTRY)Entry);
5198 #else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5200 NTOSAPI
5201 PVOID
5202 DDKAPI
5203 ExAllocateFromPagedLookasideList(
5204 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside);
5206 NTOSAPI
5207 VOID
5208 DDKAPI
5209 ExFreeToPagedLookasideList(
5210 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5211 /*IN*/ PVOID Entry);
5213 #endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5215 NTOSAPI
5216 PVOID
5217 DDKAPI
5218 ExAllocatePoolWithQuotaTag(
5219 /*IN*/ POOL_TYPE PoolType,
5220 /*IN*/ SIZE_T NumberOfBytes,
5221 /*IN*/ ULONG Tag);
5223 NTOSAPI
5224 PVOID
5225 DDKAPI
5226 ExAllocatePoolWithTag(
5227 /*IN*/ POOL_TYPE PoolType,
5228 /*IN*/ SIZE_T NumberOfBytes,
5229 /*IN*/ ULONG Tag);
5231 #ifdef POOL_TAGGING
5233 #define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
5234 #define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
5236 #else /* !POOL_TAGGING */
5238 NTOSAPI
5239 PVOID
5240 DDKAPI
5241 ExAllocatePool(
5242 /*IN*/ POOL_TYPE PoolType,
5243 /*IN*/ SIZE_T NumberOfBytes);
5245 NTOSAPI
5246 PVOID
5247 DDKAPI
5248 ExAllocatePoolWithQuota(
5249 /*IN*/ POOL_TYPE PoolType,
5250 /*IN*/ SIZE_T NumberOfBytes);
5252 #endif /* POOL_TAGGING */
5254 NTOSAPI
5255 PVOID
5256 DDKAPI
5257 ExAllocatePoolWithTagPriority(
5258 /*IN*/ POOL_TYPE PoolType,
5259 /*IN*/ SIZE_T NumberOfBytes,
5260 /*IN*/ ULONG Tag,
5261 /*IN*/ EX_POOL_PRIORITY Priority);
5263 NTOSAPI
5264 VOID
5265 DDKAPI
5266 ExConvertExclusiveToSharedLite(
5267 /*IN*/ PERESOURCE Resource);
5269 NTOSAPI
5270 NTSTATUS
5271 DDKAPI
5272 ExCreateCallback(
5273 /*OUT*/ PCALLBACK_OBJECT *CallbackObject,
5274 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
5275 /*IN*/ BOOLEAN Create,
5276 /*IN*/ BOOLEAN AllowMultipleCallbacks);
5278 NTOSAPI
5279 VOID
5280 DDKAPI
5281 ExDeleteNPagedLookasideList(
5282 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside);
5284 NTOSAPI
5285 VOID
5286 DDKAPI
5287 ExDeletePagedLookasideList(
5288 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside);
5290 NTOSAPI
5291 NTSTATUS
5292 DDKAPI
5293 ExDeleteResourceLite(
5294 /*IN*/ PERESOURCE Resource);
5296 NTOSAPI
5297 VOID
5298 DDKAPI
5299 ExFreePool(
5300 /*IN*/ PVOID P);
5302 #define PROTECTED_POOL 0x80000000
5304 #ifdef POOL_TAGGING
5305 #define ExFreePool(P) ExFreePoolWithTag(P, 0)
5306 #endif
5308 NTOSAPI
5309 VOID
5310 DDKAPI
5311 ExFreePoolWithTag(
5312 /*IN*/ PVOID P,
5313 /*IN*/ ULONG Tag);
5316 * ERESOURCE_THREAD
5317 * ExGetCurrentResourceThread(
5318 * VOID);
5320 #define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
5322 NTOSAPI
5323 ULONG
5324 DDKAPI
5325 ExGetExclusiveWaiterCount(
5326 /*IN*/ PERESOURCE Resource);
5328 NTOSAPI
5329 KPROCESSOR_MODE
5330 DDKAPI
5331 ExGetPreviousMode(
5332 VOID);
5334 NTOSAPI
5335 ULONG
5336 DDKAPI
5337 ExGetSharedWaiterCount(
5338 /*IN*/ PERESOURCE Resource);
5340 NTOSAPI
5341 VOID
5342 DDKAPI
5343 KeInitializeEvent(
5344 /*IN*/ PRKEVENT Event,
5345 /*IN*/ EVENT_TYPE Type,
5346 /*IN*/ BOOLEAN State);
5349 * VOID DDKAPI
5350 * ExInitializeFastMutex(
5351 * IN PFAST_MUTEX FastMutex)
5353 #define ExInitializeFastMutex(_FastMutex) \
5355 (_FastMutex)->Count = 1; \
5356 (_FastMutex)->Owner = NULL; \
5357 (_FastMutex)->Contention = 0; \
5358 KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
5361 NTOSAPI
5362 VOID
5363 DDKAPI
5364 ExInitializeNPagedLookasideList(
5365 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside,
5366 /*IN*/ PALLOCATE_FUNCTION Allocate /*OPTIONAL*/,
5367 /*IN*/ PFREE_FUNCTION Free /*OPTIONAL*/,
5368 /*IN*/ ULONG Flags,
5369 /*IN*/ SIZE_T Size,
5370 /*IN*/ ULONG Tag,
5371 /*IN*/ USHORT Depth);
5373 NTOSAPI
5374 VOID
5375 DDKAPI
5376 ExInitializePagedLookasideList(
5377 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5378 /*IN*/ PALLOCATE_FUNCTION Allocate /*OPTIONAL*/,
5379 /*IN*/ PFREE_FUNCTION Free /*OPTIONAL*/,
5380 /*IN*/ ULONG Flags,
5381 /*IN*/ SIZE_T Size,
5382 /*IN*/ ULONG Tag,
5383 /*IN*/ USHORT Depth);
5385 NTOSAPI
5386 NTSTATUS
5387 DDKAPI
5388 ExInitializeResourceLite(
5389 /*IN*/ PERESOURCE Resource);
5392 * VOID
5393 * InitializeSListHead(
5394 * IN PSLIST_HEADER SListHead)
5396 #define InitializeSListHead(_SListHead) \
5397 (_SListHead)->Alignment = 0
5399 #define ExInitializeSListHead InitializeSListHead
5401 NTOSAPI
5402 LARGE_INTEGER
5403 DDKAPI
5404 ExInterlockedAddLargeInteger(
5405 /*IN*/ PLARGE_INTEGER Addend,
5406 /*IN*/ LARGE_INTEGER Increment,
5407 /*IN*/ PKSPIN_LOCK Lock);
5409 NTOSAPI
5410 VOID
5411 DDKFASTAPI
5412 ExInterlockedAddLargeStatistic(
5413 /*IN*/ PLARGE_INTEGER Addend,
5414 /*IN*/ ULONG Increment);
5416 NTOSAPI
5417 ULONG
5418 DDKAPI
5419 ExInterlockedAddUlong(
5420 /*IN*/ PULONG Addend,
5421 /*IN*/ ULONG Increment,
5422 PKSPIN_LOCK Lock);
5424 NTOSAPI
5425 ULONG
5426 DDKFASTAPI
5427 ExfInterlockedAddUlong(
5428 /*IN*/ PULONG Addend,
5429 /*IN*/ ULONG Increment,
5430 PKSPIN_LOCK Lock);
5433 NTOSAPI
5434 LONGLONG
5435 DDKFASTAPI
5436 ExInterlockedCompareExchange64(
5437 /*IN OUT*/ PLONGLONG Destination,
5438 /*IN*/ PLONGLONG Exchange,
5439 /*IN*/ PLONGLONG Comparand,
5440 /*IN*/ PKSPIN_LOCK Lock);
5442 NTOSAPI
5443 PSINGLE_LIST_ENTRY
5444 DDKFASTAPI
5445 ExInterlockedFlushSList(
5446 /*IN*/ PSLIST_HEADER ListHead);
5448 NTOSAPI
5449 PLIST_ENTRY
5450 DDKAPI
5451 ExInterlockedInsertHeadList(
5452 /*IN*/ PLIST_ENTRY ListHead,
5453 /*IN*/ PLIST_ENTRY ListEntry,
5454 /*IN*/ PKSPIN_LOCK Lock);
5456 NTOSAPI
5457 PLIST_ENTRY
5458 DDKFASTAPI
5459 ExfInterlockedInsertHeadList(
5460 /*IN*/ PLIST_ENTRY ListHead,
5461 /*IN*/ PLIST_ENTRY ListEntry,
5462 /*IN*/ PKSPIN_LOCK Lock);
5464 NTOSAPI
5465 PLIST_ENTRY
5466 DDKAPI
5467 ExInterlockedInsertTailList(
5468 /*IN*/ PLIST_ENTRY ListHead,
5469 /*IN*/ PLIST_ENTRY ListEntry,
5470 /*IN*/ PKSPIN_LOCK Lock);
5472 NTOSAPI
5473 PLIST_ENTRY
5474 DDKFASTAPI
5475 ExfInterlockedInsertTailList(
5476 /*IN*/ PLIST_ENTRY ListHead,
5477 /*IN*/ PLIST_ENTRY ListEntry,
5478 /*IN*/ PKSPIN_LOCK Lock);
5480 NTOSAPI
5481 PSINGLE_LIST_ENTRY
5482 DDKAPI
5483 ExInterlockedPopEntryList(
5484 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5485 /*IN*/ PKSPIN_LOCK Lock);
5487 NTOSAPI
5488 PSINGLE_LIST_ENTRY
5489 DDKFASTAPI
5490 ExfInterlockedPopEntryList(
5491 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5492 /*IN*/ PKSPIN_LOCK Lock);
5495 NTOSAPI
5496 PSINGLE_LIST_ENTRY
5497 DDKAPI
5498 ExInterlockedPushEntryList(
5499 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5500 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5501 /*IN*/ PKSPIN_LOCK Lock);
5503 NTOSAPI
5504 PSINGLE_LIST_ENTRY
5505 DDKFASTAPI
5506 ExfInterlockedPushEntryList(
5507 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5508 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5509 /*IN*/ PKSPIN_LOCK Lock);
5512 NTOSAPI
5513 PLIST_ENTRY
5514 DDKAPI
5515 ExInterlockedRemoveHeadList(
5516 /*IN*/ PLIST_ENTRY ListHead,
5517 /*IN*/ PKSPIN_LOCK Lock);
5519 NTOSAPI
5520 PLIST_ENTRY
5521 DDKFASTAPI
5522 ExfInterlockedRemoveHeadList(
5523 /*IN*/ PLIST_ENTRY ListHead,
5524 /*IN*/ PKSPIN_LOCK Lock);
5527 NTOSAPI
5528 BOOLEAN
5529 DDKAPI
5530 ExIsProcessorFeaturePresent(
5531 /*IN*/ ULONG ProcessorFeature);
5533 NTOSAPI
5534 BOOLEAN
5535 DDKAPI
5536 ExIsResourceAcquiredExclusiveLite(
5537 /*IN*/ PERESOURCE Resource);
5539 NTOSAPI
5540 USHORT
5541 DDKAPI
5542 ExIsResourceAcquiredLite(
5543 /*IN*/ PERESOURCE Resource);
5545 NTOSAPI
5546 USHORT
5547 DDKAPI
5548 ExIsResourceAcquiredSharedLite(
5549 /*IN*/ PERESOURCE Resource);
5551 NTOSAPI
5552 VOID
5553 DDKAPI
5554 ExLocalTimeToSystemTime(
5555 /*IN*/ PLARGE_INTEGER LocalTime,
5556 /*OUT*/ PLARGE_INTEGER SystemTime);
5558 NTOSAPI
5559 VOID
5560 DDKAPI
5561 ExNotifyCallback(
5562 /*IN*/ PCALLBACK_OBJECT CallbackObject,
5563 /*IN*/ PVOID Argument1,
5564 /*IN*/ PVOID Argument2);
5566 NTOSAPI
5567 VOID
5568 DDKAPI
5569 ExRaiseAccessViolation(
5570 VOID);
5572 NTOSAPI
5573 VOID
5574 DDKAPI
5575 ExRaiseDatatypeMisalignment(
5576 VOID);
5578 NTOSAPI
5579 VOID
5580 DDKAPI
5581 ExRaiseStatus(
5582 /*IN*/ NTSTATUS Status);
5584 NTOSAPI
5585 PVOID
5586 DDKAPI
5587 ExRegisterCallback(
5588 /*IN*/ PCALLBACK_OBJECT CallbackObject,
5589 /*IN*/ PCALLBACK_FUNCTION CallbackFunction,
5590 /*IN*/ PVOID CallbackContext);
5592 NTOSAPI
5593 VOID
5594 DDKAPI
5595 ExReinitializeResourceLite(
5596 /*IN*/ PERESOURCE Resource);
5598 NTOSAPI
5599 VOID
5600 DDKFASTAPI
5601 ExReleaseFastMutex(
5602 /*IN*/ PFAST_MUTEX FastMutex);
5604 NTOSAPI
5605 VOID
5606 DDKFASTAPI
5607 ExReleaseFastMutexUnsafe(
5608 /*IN*/ PFAST_MUTEX FastMutex);
5610 NTOSAPI
5611 VOID
5612 DDKAPI
5613 ExReleaseResourceForThreadLite(
5614 /*IN*/ PERESOURCE Resource,
5615 /*IN*/ ERESOURCE_THREAD ResourceThreadId);
5617 NTOSAPI
5618 VOID
5619 DDKFASTAPI
5620 ExReleaseResourceLite(
5621 /*IN*/ PERESOURCE Resource);
5623 NTOSAPI
5624 VOID
5625 DDKAPI
5626 ExSetResourceOwnerPointer(
5627 /*IN*/ PERESOURCE Resource,
5628 /*IN*/ PVOID OwnerPointer);
5630 NTOSAPI
5631 ULONG
5632 DDKAPI
5633 ExSetTimerResolution(
5634 /*IN*/ ULONG DesiredTime,
5635 /*IN*/ BOOLEAN SetResolution);
5637 NTOSAPI
5638 VOID
5639 DDKAPI
5640 ExSystemTimeToLocalTime(
5641 /*IN*/ PLARGE_INTEGER SystemTime,
5642 /*OUT*/ PLARGE_INTEGER LocalTime);
5644 NTOSAPI
5645 BOOLEAN
5646 DDKFASTAPI
5647 ExTryToAcquireFastMutex(
5648 /*IN*/ PFAST_MUTEX FastMutex);
5650 NTOSAPI
5651 BOOLEAN
5652 DDKAPI
5653 ExTryToAcquireResourceExclusiveLite(
5654 /*IN*/ PERESOURCE Resource);
5656 NTOSAPI
5657 VOID
5658 DDKAPI
5659 ExUnregisterCallback(
5660 /*IN*/ PVOID CbRegistration);
5662 NTOSAPI
5663 NTSTATUS
5664 DDKAPI
5665 ExUuidCreate(
5666 /*OUT*/ UUID *Uuid);
5668 NTOSAPI
5669 BOOLEAN
5670 DDKAPI
5671 ExVerifySuite(
5672 /*IN*/ SUITE_TYPE SuiteType);
5674 #ifdef DBG
5676 #define PAGED_CODE() { \
5677 if (KeGetCurrentIrql() > APC_LEVEL) { \
5678 KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
5679 ASSERT(FALSE); \
5683 #else
5685 #define PAGED_CODE()
5687 #endif
5689 NTOSAPI
5690 VOID
5691 DDKAPI
5692 ProbeForRead(
5693 /*IN*/ CONST VOID *Address,
5694 /*IN*/ ULONG Length,
5695 /*IN*/ ULONG Alignment);
5697 NTOSAPI
5698 VOID
5699 DDKAPI
5700 ProbeForWrite(
5701 /*IN*/ CONST VOID *Address,
5702 /*IN*/ ULONG Length,
5703 /*IN*/ ULONG Alignment);
5707 /** Configuration manager routines **/
5709 NTOSAPI
5710 NTSTATUS
5711 DDKAPI
5712 CmRegisterCallback(
5713 /*IN*/ PEX_CALLBACK_FUNCTION Function,
5714 /*IN*/ PVOID Context,
5715 /*IN OUT*/ PLARGE_INTEGER Cookie);
5717 NTOSAPI
5718 NTSTATUS
5719 DDKAPI
5720 CmUnRegisterCallback(
5721 /*IN*/ LARGE_INTEGER Cookie);
5725 /** Filesystem runtime library routines **/
5727 NTOSAPI
5728 BOOLEAN
5729 DDKAPI
5730 FsRtlIsTotalDeviceFailure(
5731 /*IN*/ NTSTATUS Status);
5735 /** Hardware abstraction layer routines **/
5737 NTOSAPI
5738 VOID
5739 DDKFASTAPI
5740 HalExamineMBR(
5741 /*IN*/ PDEVICE_OBJECT DeviceObject,
5742 /*IN*/ ULONG SectorSize,
5743 /*IN*/ ULONG MBRTypeIdentifier,
5744 /*OUT*/ PVOID Buffer);
5746 NTOSAPI
5747 VOID
5748 DDKAPI
5749 READ_PORT_BUFFER_UCHAR(
5750 /*IN*/ PUCHAR Port,
5751 /*IN*/ PUCHAR Buffer,
5752 /*IN*/ ULONG Count);
5754 NTOSAPI
5755 VOID
5756 DDKAPI
5757 READ_PORT_BUFFER_ULONG(
5758 /*IN*/ PULONG Port,
5759 /*IN*/ PULONG Buffer,
5760 /*IN*/ ULONG Count);
5762 NTOSAPI
5763 VOID
5764 DDKAPI
5765 READ_PORT_BUFFER_USHORT(
5766 /*IN*/ PUSHORT Port,
5767 /*IN*/ PUSHORT Buffer,
5768 /*IN*/ ULONG Count);
5770 NTOSAPI
5771 UCHAR
5772 DDKAPI
5773 READ_PORT_UCHAR(
5774 /*IN*/ PUCHAR Port);
5776 NTOSAPI
5777 ULONG
5778 DDKAPI
5779 READ_PORT_ULONG(
5780 /*IN*/ PULONG Port);
5782 NTOSAPI
5783 USHORT
5784 DDKAPI
5785 READ_PORT_USHORT(
5786 /*IN*/ PUSHORT Port);
5788 NTOSAPI
5789 VOID
5790 DDKAPI
5791 READ_REGISTER_BUFFER_UCHAR(
5792 /*IN*/ PUCHAR Register,
5793 /*IN*/ PUCHAR Buffer,
5794 /*IN*/ ULONG Count);
5796 NTOSAPI
5797 VOID
5798 DDKAPI
5799 READ_REGISTER_BUFFER_ULONG(
5800 /*IN*/ PULONG Register,
5801 /*IN*/ PULONG Buffer,
5802 /*IN*/ ULONG Count);
5804 NTOSAPI
5805 VOID
5806 DDKAPI
5807 READ_REGISTER_BUFFER_USHORT(
5808 /*IN*/ PUSHORT Register,
5809 /*IN*/ PUSHORT Buffer,
5810 /*IN*/ ULONG Count);
5812 NTOSAPI
5813 UCHAR
5814 DDKAPI
5815 READ_REGISTER_UCHAR(
5816 /*IN*/ PUCHAR Register);
5818 NTOSAPI
5819 ULONG
5820 DDKAPI
5821 READ_REGISTER_ULONG(
5822 /*IN*/ PULONG Register);
5824 NTOSAPI
5825 USHORT
5826 DDKAPI
5827 READ_REGISTER_USHORT(
5828 /*IN*/ PUSHORT Register);
5830 NTOSAPI
5831 VOID
5832 DDKAPI
5833 WRITE_PORT_BUFFER_UCHAR(
5834 /*IN*/ PUCHAR Port,
5835 /*IN*/ PUCHAR Buffer,
5836 /*IN*/ ULONG Count);
5838 NTOSAPI
5839 VOID
5840 DDKAPI
5841 WRITE_PORT_BUFFER_ULONG(
5842 /*IN*/ PULONG Port,
5843 /*IN*/ PULONG Buffer,
5844 /*IN*/ ULONG Count);
5846 NTOSAPI
5847 VOID
5848 DDKAPI
5849 WRITE_PORT_BUFFER_USHORT(
5850 /*IN*/ PUSHORT Port,
5851 /*IN*/ PUSHORT Buffer,
5852 /*IN*/ ULONG Count);
5854 NTOSAPI
5855 VOID
5856 DDKAPI
5857 WRITE_PORT_UCHAR(
5858 /*IN*/ PUCHAR Port,
5859 /*IN*/ UCHAR Value);
5861 NTOSAPI
5862 VOID
5863 DDKAPI
5864 WRITE_PORT_ULONG(
5865 /*IN*/ PULONG Port,
5866 /*IN*/ ULONG Value);
5868 NTOSAPI
5869 VOID
5870 DDKAPI
5871 WRITE_PORT_USHORT(
5872 /*IN*/ PUSHORT Port,
5873 /*IN*/ USHORT Value);
5875 NTOSAPI
5876 VOID
5877 DDKAPI
5878 WRITE_REGISTER_BUFFER_UCHAR(
5879 /*IN*/ PUCHAR Register,
5880 /*IN*/ PUCHAR Buffer,
5881 /*IN*/ ULONG Count);
5883 NTOSAPI
5884 VOID
5885 DDKAPI
5886 WRITE_REGISTER_BUFFER_ULONG(
5887 /*IN*/ PULONG Register,
5888 /*IN*/ PULONG Buffer,
5889 /*IN*/ ULONG Count);
5891 NTOSAPI
5892 VOID
5893 DDKAPI
5894 WRITE_REGISTER_BUFFER_USHORT(
5895 /*IN*/ PUSHORT Register,
5896 /*IN*/ PUSHORT Buffer,
5897 /*IN*/ ULONG Count);
5899 NTOSAPI
5900 VOID
5901 DDKAPI
5902 WRITE_REGISTER_UCHAR(
5903 /*IN*/ PUCHAR Register,
5904 /*IN*/ UCHAR Value);
5906 NTOSAPI
5907 VOID
5908 DDKAPI
5909 WRITE_REGISTER_ULONG(
5910 /*IN*/ PULONG Register,
5911 /*IN*/ ULONG Value);
5913 NTOSAPI
5914 VOID
5915 DDKAPI
5916 WRITE_REGISTER_USHORT(
5917 /*IN*/ PUSHORT Register,
5918 /*IN*/ USHORT Value);
5920 /** I/O manager routines **/
5922 NTOSAPI
5923 VOID
5924 DDKAPI
5925 IoAcquireCancelSpinLock(
5926 /*OUT*/ PKIRQL Irql);
5928 NTOSAPI
5929 NTSTATUS
5930 DDKAPI
5931 IoAcquireRemoveLockEx(
5932 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
5933 /*IN*/ PVOID Tag /*OPTIONAL*/,
5934 /*IN*/ PCSTR File,
5935 /*IN*/ ULONG Line,
5936 /*IN*/ ULONG RemlockSize);
5939 * NTSTATUS
5940 * IoAcquireRemoveLock(
5941 * IN PIO_REMOVE_LOCK RemoveLock,
5942 * IN PVOID Tag OPTIONAL)
5944 #define IoAcquireRemoveLock(_RemoveLock, \
5945 _Tag) \
5946 IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
5949 * VOID
5950 * IoAdjustPagingPathCount(
5951 * IN PLONG Count,
5952 * IN BOOLEAN Increment)
5954 #define IoAdjustPagingPathCount(_Count, \
5955 _Increment) \
5957 if (_Increment) \
5959 InterlockedIncrement(_Count); \
5961 else \
5963 InterlockedDecrement(_Count); \
5967 NTOSAPI
5968 VOID
5969 DDKAPI
5970 IoAllocateController(
5971 /*IN*/ PCONTROLLER_OBJECT ControllerObject,
5972 /*IN*/ PDEVICE_OBJECT DeviceObject,
5973 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
5974 /*IN*/ PVOID Context);
5976 NTOSAPI
5977 NTSTATUS
5978 DDKAPI
5979 IoAllocateDriverObjectExtension(
5980 /*IN*/ PDRIVER_OBJECT DriverObject,
5981 /*IN*/ PVOID ClientIdentificationAddress,
5982 /*IN*/ ULONG DriverObjectExtensionSize,
5983 /*OUT*/ PVOID *DriverObjectExtension);
5985 typedef struct _IO_ERROR_LOG_PACKET {
5986 UCHAR MajorFunctionCode;
5987 UCHAR RetryCount;
5988 USHORT DumpDataSize;
5989 USHORT NumberOfStrings;
5990 USHORT StringOffset;
5991 USHORT EventCategory;
5992 NTSTATUS ErrorCode;
5993 ULONG UniqueErrorValue;
5994 NTSTATUS FinalStatus;
5995 ULONG SequenceNumber;
5996 ULONG IoControlCode;
5997 LARGE_INTEGER DeviceOffset;
5998 ULONG DumpData[1];
5999 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
6001 NTOSAPI
6002 PVOID
6003 DDKAPI
6004 IoAllocateErrorLogEntry(
6005 /*IN*/ PVOID IoObject,
6006 /*IN*/ UCHAR EntrySize);
6008 NTOSAPI
6009 PIRP
6010 DDKAPI
6011 IoAllocateIrp(
6012 /*IN*/ CCHAR StackSize,
6013 /*IN*/ BOOLEAN ChargeQuota);
6015 NTOSAPI
6016 PMDL
6017 DDKAPI
6018 IoAllocateMdl(
6019 /*IN*/ PVOID VirtualAddress,
6020 /*IN*/ ULONG Length,
6021 /*IN*/ BOOLEAN SecondaryBuffer,
6022 /*IN*/ BOOLEAN ChargeQuota,
6023 /*IN OUT*/ PIRP Irp /*OPTIONAL*/);
6025 NTOSAPI
6026 PIO_WORKITEM
6027 DDKAPI
6028 IoAllocateWorkItem(
6029 /*IN*/ PDEVICE_OBJECT DeviceObject);
6032 * VOID IoAssignArcName(
6033 * IN PUNICODE_STRING ArcName,
6034 * IN PUNICODE_STRING DeviceName);
6036 #define IoAssignArcName(_ArcName, _DeviceName) ( \
6037 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
6039 NTOSAPI
6040 NTSTATUS
6041 DDKAPI
6042 IoAttachDevice(
6043 /*IN*/ PDEVICE_OBJECT SourceDevice,
6044 /*IN*/ PUNICODE_STRING TargetDevice,
6045 /*OUT*/ PDEVICE_OBJECT *AttachedDevice);
6047 NTOSAPI
6048 PDEVICE_OBJECT
6049 DDKAPI
6050 IoAttachDeviceToDeviceStack(
6051 /*IN*/ PDEVICE_OBJECT SourceDevice,
6052 /*IN*/ PDEVICE_OBJECT TargetDevice);
6054 NTOSAPI
6055 PIRP
6056 DDKAPI
6057 IoBuildAsynchronousFsdRequest(
6058 /*IN*/ ULONG MajorFunction,
6059 /*IN*/ PDEVICE_OBJECT DeviceObject,
6060 /*IN OUT*/ PVOID Buffer /*OPTIONAL*/,
6061 /*IN*/ ULONG Length /*OPTIONAL*/,
6062 /*IN*/ PLARGE_INTEGER StartingOffset /*OPTIONAL*/,
6063 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock /*OPTIONAL*/);
6065 NTOSAPI
6066 PIRP
6067 DDKAPI
6068 IoBuildDeviceIoControlRequest(
6069 /*IN*/ ULONG IoControlCode,
6070 /*IN*/ PDEVICE_OBJECT DeviceObject,
6071 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
6072 /*IN*/ ULONG InputBufferLength,
6073 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
6074 /*IN*/ ULONG OutputBufferLength,
6075 /*IN*/ BOOLEAN InternalDeviceIoControl,
6076 /*IN*/ PKEVENT Event,
6077 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
6079 NTOSAPI
6080 VOID
6081 DDKAPI
6082 IoBuildPartialMdl(
6083 /*IN*/ PMDL SourceMdl,
6084 /*IN OUT*/ PMDL TargetMdl,
6085 /*IN*/ PVOID VirtualAddress,
6086 /*IN*/ ULONG Length);
6088 NTOSAPI
6089 PIRP
6090 DDKAPI
6091 IoBuildSynchronousFsdRequest(
6092 /*IN*/ ULONG MajorFunction,
6093 /*IN*/ PDEVICE_OBJECT DeviceObject,
6094 /*IN OUT*/ PVOID Buffer /*OPTIONAL*/,
6095 /*IN*/ ULONG Length /*OPTIONAL*/,
6096 /*IN*/ PLARGE_INTEGER StartingOffset /*OPTIONAL*/,
6097 /*IN*/ PKEVENT Event,
6098 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
6100 NTOSAPI
6101 NTSTATUS
6102 DDKFASTAPI
6103 IofCallDriver(
6104 /*IN*/ PDEVICE_OBJECT DeviceObject,
6105 /*IN OUT*/ PIRP Irp);
6108 * NTSTATUS
6109 * IoCallDriver(
6110 * IN PDEVICE_OBJECT DeviceObject,
6111 * IN OUT PIRP Irp)
6113 #define IoCallDriver IofCallDriver
6115 NTOSAPI
6116 VOID
6117 DDKAPI
6118 IoCancelFileOpen(
6119 /*IN*/ PDEVICE_OBJECT DeviceObject,
6120 /*IN*/ PFILE_OBJECT FileObject);
6122 NTOSAPI
6123 BOOLEAN
6124 DDKAPI
6125 IoCancelIrp(
6126 /*IN*/ PIRP Irp);
6128 NTOSAPI
6129 NTSTATUS
6130 DDKAPI
6131 IoCheckShareAccess(
6132 /*IN*/ ACCESS_MASK DesiredAccess,
6133 /*IN*/ ULONG DesiredShareAccess,
6134 /*IN OUT*/ PFILE_OBJECT FileObject,
6135 /*IN OUT*/ PSHARE_ACCESS ShareAccess,
6136 /*IN*/ BOOLEAN Update);
6138 NTOSAPI
6139 VOID
6140 DDKFASTAPI
6141 IofCompleteRequest(
6142 /*IN*/ PIRP Irp,
6143 /*IN*/ CCHAR PriorityBoost);
6146 * VOID
6147 * IoCompleteRequest(
6148 * IN PIRP Irp,
6149 * IN CCHAR PriorityBoost)
6151 #define IoCompleteRequest IofCompleteRequest
6153 NTOSAPI
6154 NTSTATUS
6155 DDKAPI
6156 IoConnectInterrupt(
6157 /*OUT*/ PKINTERRUPT *InterruptObject,
6158 /*IN*/ PKSERVICE_ROUTINE ServiceRoutine,
6159 /*IN*/ PVOID ServiceContext,
6160 /*IN*/ PKSPIN_LOCK SpinLock /*OPTIONAL*/,
6161 /*IN*/ ULONG Vector,
6162 /*IN*/ KIRQL Irql,
6163 /*IN*/ KIRQL SynchronizeIrql,
6164 /*IN*/ KINTERRUPT_MODE InterruptMode,
6165 /*IN*/ BOOLEAN ShareVector,
6166 /*IN*/ KAFFINITY ProcessorEnableMask,
6167 /*IN*/ BOOLEAN FloatingSave);
6170 * PIO_STACK_LOCATION
6171 * IoGetCurrentIrpStackLocation(
6172 * IN PIRP Irp)
6174 #define IoGetCurrentIrpStackLocation(_Irp) \
6175 ((_Irp)->Tail.Overlay.CurrentStackLocation)
6178 * PIO_STACK_LOCATION
6179 * IoGetNextIrpStackLocation(
6180 * IN PIRP Irp)
6182 #define IoGetNextIrpStackLocation(_Irp) \
6183 ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
6186 * VOID
6187 * IoCopyCurrentIrpStackLocationToNext(
6188 * IN PIRP Irp)
6190 #define IoCopyCurrentIrpStackLocationToNext(_Irp) \
6192 PIO_STACK_LOCATION _IrpSp; \
6193 PIO_STACK_LOCATION _NextIrpSp; \
6194 _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
6195 _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
6196 RtlCopyMemory(_NextIrpSp, _IrpSp, \
6197 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
6198 _NextIrpSp->Control = 0; \
6201 NTOSAPI
6202 PCONTROLLER_OBJECT
6203 DDKAPI
6204 IoCreateController(
6205 /*IN*/ ULONG Size);
6207 NTOSAPI
6208 NTSTATUS
6209 DDKAPI
6210 IoCreateDevice(
6211 /*IN*/ PDRIVER_OBJECT DriverObject,
6212 /*IN*/ ULONG DeviceExtensionSize,
6213 /*IN*/ PUNICODE_STRING DeviceName /*OPTIONAL*/,
6214 /*IN*/ DEVICE_TYPE DeviceType,
6215 /*IN*/ ULONG DeviceCharacteristics,
6216 /*IN*/ BOOLEAN Exclusive,
6217 /*OUT*/ PDEVICE_OBJECT *DeviceObject);
6219 NTOSAPI
6220 NTSTATUS
6221 DDKAPI
6222 IoCreateDisk(
6223 /*IN*/ PDEVICE_OBJECT DeviceObject,
6224 /*IN*/ PCREATE_DISK Disk);
6226 NTOSAPI
6227 NTSTATUS
6228 DDKAPI
6229 IoCreateFile(
6230 /*OUT*/ PHANDLE FileHandle,
6231 /*IN*/ ACCESS_MASK DesiredAccess,
6232 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
6233 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
6234 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
6235 /*IN*/ ULONG FileAttributes,
6236 /*IN*/ ULONG ShareAccess,
6237 /*IN*/ ULONG Disposition,
6238 /*IN*/ ULONG CreateOptions,
6239 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
6240 /*IN*/ ULONG EaLength,
6241 /*IN*/ CREATE_FILE_TYPE CreateFileType,
6242 /*IN*/ PVOID ExtraCreateParameters /*OPTIONAL*/,
6243 /*IN*/ ULONG Options);
6245 NTOSAPI
6246 PKEVENT
6247 DDKAPI
6248 IoCreateNotificationEvent(
6249 /*IN*/ PUNICODE_STRING EventName,
6250 /*OUT*/ PHANDLE EventHandle);
6252 NTOSAPI
6253 NTSTATUS
6254 DDKAPI
6255 IoCreateSymbolicLink(
6256 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6257 /*IN*/ PUNICODE_STRING DeviceName);
6259 NTOSAPI
6260 PKEVENT
6261 DDKAPI
6262 IoCreateSynchronizationEvent(
6263 /*IN*/ PUNICODE_STRING EventName,
6264 /*OUT*/ PHANDLE EventHandle);
6266 NTOSAPI
6267 NTSTATUS
6268 DDKAPI
6269 IoCreateUnprotectedSymbolicLink(
6270 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6271 /*IN*/ PUNICODE_STRING DeviceName);
6273 NTOSAPI
6274 VOID
6275 DDKAPI
6276 IoCsqInitialize(
6277 PIO_CSQ Csq,
6278 /*IN*/ PIO_CSQ_INSERT_IRP CsqInsertIrp,
6279 /*IN*/ PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
6280 /*IN*/ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
6281 /*IN*/ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
6282 /*IN*/ PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
6283 /*IN*/ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
6285 NTOSAPI
6286 VOID
6287 DDKAPI
6288 IoCsqInsertIrp(
6289 /*IN*/ PIO_CSQ Csq,
6290 /*IN*/ PIRP Irp,
6291 /*IN*/ PIO_CSQ_IRP_CONTEXT Context);
6293 NTOSAPI
6294 PIRP
6295 DDKAPI
6296 IoCsqRemoveIrp(
6297 /*IN*/ PIO_CSQ Csq,
6298 /*IN*/ PIO_CSQ_IRP_CONTEXT Context);
6300 NTOSAPI
6301 PIRP
6302 DDKAPI
6303 IoCsqRemoveNextIrp(
6304 /*IN*/ PIO_CSQ Csq,
6305 /*IN*/ PVOID PeekContext);
6307 NTOSAPI
6308 VOID
6309 DDKAPI
6310 IoDeleteController(
6311 /*IN*/ PCONTROLLER_OBJECT ControllerObject);
6313 NTOSAPI
6314 VOID
6315 DDKAPI
6316 IoDeleteDevice(
6317 /*IN*/ PDEVICE_OBJECT DeviceObject);
6319 NTOSAPI
6320 NTSTATUS
6321 DDKAPI
6322 IoDeleteSymbolicLink(
6323 /*IN*/ PUNICODE_STRING SymbolicLinkName);
6326 * VOID
6327 * IoDeassignArcName(
6328 * IN PUNICODE_STRING ArcName)
6330 #define IoDeassignArcName IoDeleteSymbolicLink
6332 NTOSAPI
6333 VOID
6334 DDKAPI
6335 IoDetachDevice(
6336 /*IN OUT*/ PDEVICE_OBJECT TargetDevice);
6338 NTOSAPI
6339 VOID
6340 DDKAPI
6341 IoDisconnectInterrupt(
6342 /*IN*/ PKINTERRUPT InterruptObject);
6344 NTOSAPI
6345 BOOLEAN
6346 DDKAPI
6347 IoForwardIrpSynchronously(
6348 /*IN*/ PDEVICE_OBJECT DeviceObject,
6349 /*IN*/ PIRP Irp);
6351 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
6353 NTOSAPI
6354 VOID
6355 DDKAPI
6356 IoFreeController(
6357 /*IN*/ PCONTROLLER_OBJECT ControllerObject);
6359 NTOSAPI
6360 VOID
6361 DDKAPI
6362 IoFreeErrorLogEntry(
6363 PVOID ElEntry);
6365 NTOSAPI
6366 VOID
6367 DDKAPI
6368 IoFreeIrp(
6369 /*IN*/ PIRP Irp);
6371 NTOSAPI
6372 VOID
6373 DDKAPI
6374 IoFreeMdl(
6375 /*IN*/ PMDL Mdl);
6377 NTOSAPI
6378 VOID
6379 DDKAPI
6380 IoFreeWorkItem(
6381 /*IN*/ PIO_WORKITEM pIOWorkItem);
6383 NTOSAPI
6384 PDEVICE_OBJECT
6385 DDKAPI
6386 IoGetAttachedDevice(
6387 /*IN*/ PDEVICE_OBJECT DeviceObject);
6389 NTOSAPI
6390 PDEVICE_OBJECT
6391 DDKAPI
6392 IoGetAttachedDeviceReference(
6393 /*IN*/ PDEVICE_OBJECT DeviceObject);
6395 NTOSAPI
6396 NTSTATUS
6397 DDKAPI
6398 IoGetBootDiskInformation(
6399 /*IN OUT*/ PBOOTDISK_INFORMATION BootDiskInformation,
6400 /*IN*/ ULONG Size);
6402 NTOSAPI
6403 PCONFIGURATION_INFORMATION
6404 DDKAPI
6405 IoGetConfigurationInformation(
6406 VOID);
6408 NTOSAPI
6409 PEPROCESS
6410 DDKAPI
6411 IoGetCurrentProcess(
6412 VOID);
6414 NTOSAPI
6415 NTSTATUS
6416 DDKAPI
6417 IoGetDeviceInterfaceAlias(
6418 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6419 /*IN*/ CONST GUID *AliasInterfaceClassGuid,
6420 /*OUT*/ PUNICODE_STRING AliasSymbolicLinkName);
6422 NTOSAPI
6423 NTSTATUS
6424 DDKAPI
6425 IoGetDeviceInterfaces(
6426 /*IN*/ CONST GUID *InterfaceClassGuid,
6427 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject /*OPTIONAL*/,
6428 /*IN*/ ULONG Flags,
6429 /*OUT*/ PWSTR *SymbolicLinkList);
6431 NTOSAPI
6432 NTSTATUS
6433 DDKAPI
6434 IoGetDeviceObjectPointer(
6435 /*IN*/ PUNICODE_STRING ObjectName,
6436 /*IN*/ ACCESS_MASK DesiredAccess,
6437 /*OUT*/ PFILE_OBJECT *FileObject,
6438 /*OUT*/ PDEVICE_OBJECT *DeviceObject);
6440 NTOSAPI
6441 NTSTATUS
6442 DDKAPI
6443 IoGetDeviceProperty(
6444 /*IN*/ PDEVICE_OBJECT DeviceObject,
6445 /*IN*/ DEVICE_REGISTRY_PROPERTY DeviceProperty,
6446 /*IN*/ ULONG BufferLength,
6447 /*OUT*/ PVOID PropertyBuffer,
6448 /*OUT*/ PULONG ResultLength);
6450 NTOSAPI
6451 PDEVICE_OBJECT
6452 DDKAPI
6453 IoGetDeviceToVerify(
6454 /*IN*/ PETHREAD Thread);
6456 NTOSAPI
6457 PDMA_ADAPTER
6458 DDKAPI
6459 IoGetDmaAdapter(
6460 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6461 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription,
6462 /*IN OUT*/ PULONG NumberOfMapRegisters);
6464 NTOSAPI
6465 PVOID
6466 DDKAPI
6467 IoGetDriverObjectExtension(
6468 /*IN*/ PDRIVER_OBJECT DriverObject,
6469 /*IN*/ PVOID ClientIdentificationAddress);
6471 NTOSAPI
6472 PGENERIC_MAPPING
6473 DDKAPI
6474 IoGetFileObjectGenericMapping(
6475 VOID);
6478 * ULONG
6479 * IoGetFunctionCodeFromCtlCode(
6480 * IN ULONG ControlCode)
6482 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
6483 (((_ControlCode) >> 2) & 0x00000FFF)
6485 NTOSAPI
6486 PVOID
6487 DDKAPI
6488 IoGetInitialStack(
6489 VOID);
6491 NTOSAPI
6492 PDEVICE_OBJECT
6493 DDKAPI
6494 IoGetRelatedDeviceObject(
6495 /*IN*/ PFILE_OBJECT FileObject);
6497 NTOSAPI
6498 ULONG
6499 DDKAPI
6500 IoGetRemainingStackSize(
6501 VOID);
6503 NTOSAPI
6504 VOID
6505 DDKAPI
6506 IoGetStackLimits(
6507 /*OUT*/ PULONG_PTR LowLimit,
6508 /*OUT*/ PULONG_PTR HighLimit);
6510 NTOSAPI
6511 VOID
6512 DDKAPI
6513 KeInitializeDpc(
6514 /*IN*/ PRKDPC Dpc,
6515 /*IN*/ PKDEFERRED_ROUTINE DeferredRoutine,
6516 /*IN*/ PVOID DeferredContext);
6519 * VOID
6520 * IoInitializeDpcRequest(
6521 * IN PDEVICE_OBJECT DeviceObject,
6522 * IN PIO_DPC_ROUTINE DpcRoutine)
6524 #define IoInitializeDpcRequest(_DeviceObject, \
6525 _DpcRoutine) \
6526 KeInitializeDpc(&(_DeviceObject)->Dpc, \
6527 (PKDEFERRED_ROUTINE) (_DpcRoutine), \
6528 _DeviceObject)
6530 NTOSAPI
6531 VOID
6532 DDKAPI
6533 IoInitializeIrp(
6534 /*IN OUT*/ PIRP Irp,
6535 /*IN*/ USHORT PacketSize,
6536 /*IN*/ CCHAR StackSize);
6538 NTOSAPI
6539 VOID
6540 DDKAPI
6541 IoInitializeRemoveLockEx(
6542 /*IN*/ PIO_REMOVE_LOCK Lock,
6543 /*IN*/ ULONG AllocateTag,
6544 /*IN*/ ULONG MaxLockedMinutes,
6545 /*IN*/ ULONG HighWatermark,
6546 /*IN*/ ULONG RemlockSize);
6548 /* VOID
6549 * IoInitializeRemoveLock(
6550 * IN PIO_REMOVE_LOCK Lock,
6551 * IN ULONG AllocateTag,
6552 * IN ULONG MaxLockedMinutes,
6553 * IN ULONG HighWatermark)
6555 #define IoInitializeRemoveLock( \
6556 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
6557 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
6558 HighWatermark, sizeof(IO_REMOVE_LOCK))
6560 NTOSAPI
6561 NTSTATUS
6562 DDKAPI
6563 IoInitializeTimer(
6564 /*IN*/ PDEVICE_OBJECT DeviceObject,
6565 /*IN*/ PIO_TIMER_ROUTINE TimerRoutine,
6566 /*IN*/ PVOID Context);
6568 NTOSAPI
6569 VOID
6570 DDKAPI
6571 IoInvalidateDeviceRelations(
6572 /*IN*/ PDEVICE_OBJECT DeviceObject,
6573 /*IN*/ DEVICE_RELATION_TYPE Type);
6575 NTOSAPI
6576 VOID
6577 DDKAPI
6578 IoInvalidateDeviceState(
6579 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject);
6581 NTOSAPI
6582 BOOLEAN
6583 DDKAPI
6584 IoIs32bitProcess(
6585 /*IN*/ PIRP Irp /*OPTIONAL*/);
6588 * BOOLEAN
6589 * IoIsErrorUserInduced(
6590 * IN NTSTATUS Status);
6592 #define IoIsErrorUserInduced(Status) \
6593 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
6594 ((Status) == STATUS_IO_TIMEOUT) || \
6595 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
6596 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
6597 ((Status) == STATUS_VERIFY_REQUIRED) || \
6598 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
6599 ((Status) == STATUS_WRONG_VOLUME)))
6601 NTOSAPI
6602 BOOLEAN
6603 DDKAPI
6604 IoIsWdmVersionAvailable(
6605 /*IN*/ UCHAR MajorVersion,
6606 /*IN*/ UCHAR MinorVersion);
6608 NTOSAPI
6609 PIRP
6610 DDKAPI
6611 IoMakeAssociatedIrp(
6612 /*IN*/ PIRP Irp,
6613 /*IN*/ CCHAR StackSize);
6616 * VOID
6617 * IoMarkIrpPending(
6618 * IN OUT PIRP Irp)
6620 #define IoMarkIrpPending(_Irp) \
6621 (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
6623 NTOSAPI
6624 NTSTATUS
6625 DDKAPI
6626 IoOpenDeviceInterfaceRegistryKey(
6627 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6628 /*IN*/ ACCESS_MASK DesiredAccess,
6629 /*OUT*/ PHANDLE DeviceInterfaceKey);
6631 NTOSAPI
6632 NTSTATUS
6633 DDKAPI
6634 IoOpenDeviceRegistryKey(
6635 /*IN*/ PDEVICE_OBJECT DeviceObject,
6636 /*IN*/ ULONG DevInstKeyType,
6637 /*IN*/ ACCESS_MASK DesiredAccess,
6638 /*OUT*/ PHANDLE DevInstRegKey);
6640 NTOSAPI
6641 NTSTATUS
6642 DDKAPI
6643 IoQueryDeviceDescription(
6644 /*IN*/ PINTERFACE_TYPE BusType /*OPTIONAL*/,
6645 /*IN*/ PULONG BusNumber /*OPTIONAL*/,
6646 /*IN*/ PCONFIGURATION_TYPE ControllerType /*OPTIONAL*/,
6647 /*IN*/ PULONG ControllerNumber /*OPTIONAL*/,
6648 /*IN*/ PCONFIGURATION_TYPE PeripheralType /*OPTIONAL*/,
6649 /*IN*/ PULONG PeripheralNumber /*OPTIONAL*/,
6650 /*IN*/ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
6651 /*IN*/ PVOID Context);
6653 NTOSAPI
6654 VOID
6655 DDKAPI
6656 IoQueueWorkItem(
6657 /*IN*/ PIO_WORKITEM pIOWorkItem,
6658 /*IN*/ PIO_WORKITEM_ROUTINE Routine,
6659 /*IN*/ WORK_QUEUE_TYPE QueueType,
6660 /*IN*/ PVOID Context);
6662 NTOSAPI
6663 VOID
6664 DDKAPI
6665 IoRaiseHardError(
6666 /*IN*/ PIRP Irp,
6667 /*IN*/ PVPB Vpb /*OPTIONAL*/,
6668 /*IN*/ PDEVICE_OBJECT RealDeviceObject);
6670 NTOSAPI
6671 BOOLEAN
6672 DDKAPI
6673 IoRaiseInformationalHardError(
6674 /*IN*/ NTSTATUS ErrorStatus,
6675 /*IN*/ PUNICODE_STRING String /*OPTIONAL*/,
6676 /*IN*/ PKTHREAD Thread /*OPTIONAL*/);
6678 NTOSAPI
6679 NTSTATUS
6680 DDKAPI
6681 IoReadDiskSignature(
6682 /*IN*/ PDEVICE_OBJECT DeviceObject,
6683 /*IN*/ ULONG BytesPerSector,
6684 /*OUT*/ PDISK_SIGNATURE Signature);
6686 NTOSAPI
6687 NTSTATUS
6688 DDKAPI
6689 IoReadPartitionTableEx(
6690 /*IN*/ PDEVICE_OBJECT DeviceObject,
6691 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer);
6693 NTOSAPI
6694 VOID
6695 DDKAPI
6696 IoRegisterBootDriverReinitialization(
6697 /*IN*/ PDRIVER_OBJECT DriverObject,
6698 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6699 /*IN*/ PVOID Context);
6701 NTOSAPI
6702 VOID
6703 DDKAPI
6704 IoRegisterBootDriverReinitialization(
6705 /*IN*/ PDRIVER_OBJECT DriverObject,
6706 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6707 /*IN*/ PVOID Context);
6709 NTOSAPI
6710 NTSTATUS
6711 DDKAPI
6712 IoRegisterDeviceInterface(
6713 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6714 /*IN*/ CONST GUID *InterfaceClassGuid,
6715 /*IN*/ PUNICODE_STRING ReferenceString /*OPTIONAL*/,
6716 /*OUT*/ PUNICODE_STRING SymbolicLinkName);
6718 NTOSAPI
6719 VOID
6720 DDKAPI
6721 IoRegisterDriverReinitialization(
6722 /*IN*/ PDRIVER_OBJECT DriverObject,
6723 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6724 /*IN*/ PVOID Context);
6726 NTOSAPI
6727 NTSTATUS
6728 DDKAPI
6729 IoRegisterPlugPlayNotification(
6730 /*IN*/ IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
6731 /*IN*/ ULONG EventCategoryFlags,
6732 /*IN*/ PVOID EventCategoryData /*OPTIONAL*/,
6733 /*IN*/ PDRIVER_OBJECT DriverObject,
6734 /*IN*/ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
6735 /*IN*/ PVOID Context,
6736 /*OUT*/ PVOID *NotificationEntry);
6738 NTOSAPI
6739 NTSTATUS
6740 DDKAPI
6741 IoRegisterShutdownNotification(
6742 /*IN*/ PDEVICE_OBJECT DeviceObject);
6744 NTOSAPI
6745 VOID
6746 DDKAPI
6747 IoReleaseCancelSpinLock(
6748 /*IN*/ KIRQL Irql);
6750 NTOSAPI
6751 VOID
6752 DDKAPI
6753 IoReleaseRemoveLockAndWaitEx(
6754 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
6755 /*IN*/ PVOID Tag,
6756 /*IN*/ ULONG RemlockSize);
6759 * VOID
6760 * IoReleaseRemoveLockAndWait(
6761 * IN PIO_REMOVE_LOCK RemoveLock,
6762 * IN PVOID Tag)
6764 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
6765 _Tag) \
6766 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6768 NTOSAPI
6769 VOID
6770 DDKAPI
6771 IoReleaseRemoveLockEx(
6772 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
6773 /*IN*/ PVOID Tag,
6774 /*IN*/ ULONG RemlockSize);
6777 * VOID
6778 * IoReleaseRemoveLock(
6779 * IN PIO_REMOVE_LOCK RemoveLock,
6780 * IN PVOID Tag)
6782 #define IoReleaseRemoveLock(_RemoveLock, \
6783 _Tag) \
6784 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6786 NTOSAPI
6787 VOID
6788 DDKAPI
6789 IoRemoveShareAccess(
6790 /*IN*/ PFILE_OBJECT FileObject,
6791 /*IN OUT*/ PSHARE_ACCESS ShareAccess);
6793 NTOSAPI
6794 NTSTATUS
6795 DDKAPI
6796 IoReportDetectedDevice(
6797 /*IN*/ PDRIVER_OBJECT DriverObject,
6798 /*IN*/ INTERFACE_TYPE LegacyBusType,
6799 /*IN*/ ULONG BusNumber,
6800 /*IN*/ ULONG SlotNumber,
6801 /*IN*/ PCM_RESOURCE_LIST ResourceList,
6802 /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements /*OPTIONAL*/,
6803 /*IN*/ BOOLEAN ResourceAssigned,
6804 /*IN OUT*/ PDEVICE_OBJECT *DeviceObject);
6806 NTOSAPI
6807 NTSTATUS
6808 DDKAPI
6809 IoReportResourceForDetection(
6810 /*IN*/ PDRIVER_OBJECT DriverObject,
6811 /*IN*/ PCM_RESOURCE_LIST DriverList /*OPTIONAL*/,
6812 /*IN*/ ULONG DriverListSize /*OPTIONAL*/,
6813 /*IN*/ PDEVICE_OBJECT DeviceObject /*OPTIONAL*/,
6814 /*IN*/ PCM_RESOURCE_LIST DeviceList /*OPTIONAL*/,
6815 /*IN*/ ULONG DeviceListSize /*OPTIONAL*/,
6816 /*OUT*/ PBOOLEAN ConflictDetected);
6818 NTOSAPI
6819 NTSTATUS
6820 DDKAPI
6821 IoReportResourceUsage(
6822 /*IN*/ PUNICODE_STRING DriverClassName /*OPTIONAL*/,
6823 /*IN*/ PDRIVER_OBJECT DriverObject,
6824 /*IN*/ PCM_RESOURCE_LIST DriverList /*OPTIONAL*/,
6825 /*IN*/ ULONG DriverListSize /*OPTIONAL*/,
6826 /*IN*/ PDEVICE_OBJECT DeviceObject,
6827 /*IN*/ PCM_RESOURCE_LIST DeviceList /*OPTIONAL*/,
6828 /*IN*/ ULONG DeviceListSize /*OPTIONAL*/,
6829 /*IN*/ BOOLEAN OverrideConflict,
6830 /*OUT*/ PBOOLEAN ConflictDetected);
6832 NTOSAPI
6833 NTSTATUS
6834 DDKAPI
6835 IoReportTargetDeviceChange(
6836 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6837 /*IN*/ PVOID NotificationStructure);
6839 NTOSAPI
6840 NTSTATUS
6841 DDKAPI
6842 IoReportTargetDeviceChangeAsynchronous(
6843 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6844 /*IN*/ PVOID NotificationStructure,
6845 /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback /*OPTIONAL*/,
6846 /*IN*/ PVOID Context /*OPTIONAL*/);
6848 NTOSAPI
6849 VOID
6850 DDKAPI
6851 IoRequestDeviceEject(
6852 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject);
6855 * VOID
6856 * IoRequestDpc(
6857 * IN PDEVICE_OBJECT DeviceObject,
6858 * IN PIRP Irp,
6859 * IN PVOID Context);
6861 #define IoRequestDpc(DeviceObject, Irp, Context)( \
6862 KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
6864 NTOSAPI
6865 VOID
6866 DDKAPI
6867 IoReuseIrp(
6868 /*IN OUT*/ PIRP Irp,
6869 /*IN*/ NTSTATUS Status);
6872 * PDRIVER_CANCEL
6873 * IoSetCancelRoutine(
6874 * IN PIRP Irp,
6875 * IN PDRIVER_CANCEL CancelRoutine)
6877 #define IoSetCancelRoutine(_Irp, \
6878 _CancelRoutine) \
6879 ((PDRIVER_CANCEL) InterlockedExchangePointer( \
6880 (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)))
6883 * VOID
6884 * IoSetCompletionRoutine(
6885 * IN PIRP Irp,
6886 * IN PIO_COMPLETION_ROUTINE CompletionRoutine,
6887 * IN PVOID Context,
6888 * IN BOOLEAN InvokeOnSuccess,
6889 * IN BOOLEAN InvokeOnError,
6890 * IN BOOLEAN InvokeOnCancel)
6892 #define IoSetCompletionRoutine(_Irp, \
6893 _CompletionRoutine, \
6894 _Context, \
6895 _InvokeOnSuccess, \
6896 _InvokeOnError, \
6897 _InvokeOnCancel) \
6899 PIO_STACK_LOCATION _IrpSp; \
6900 ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
6901 _CompletionRoutine != NULL : TRUE); \
6902 _IrpSp = IoGetNextIrpStackLocation(_Irp); \
6903 _IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
6904 _IrpSp->Context = (_Context); \
6905 _IrpSp->Control = 0; \
6906 if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
6907 if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
6908 if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
6911 NTOSAPI
6912 VOID
6913 DDKAPI
6914 IoSetCompletionRoutineEx(
6915 /*IN*/ PDEVICE_OBJECT DeviceObject,
6916 /*IN*/ PIRP Irp,
6917 /*IN*/ PIO_COMPLETION_ROUTINE CompletionRoutine,
6918 /*IN*/ PVOID Context,
6919 /*IN*/ BOOLEAN InvokeOnSuccess,
6920 /*IN*/ BOOLEAN InvokeOnError,
6921 /*IN*/ BOOLEAN InvokeOnCancel);
6923 NTOSAPI
6924 NTSTATUS
6925 DDKAPI
6926 IoSetDeviceInterfaceState(
6927 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6928 /*IN*/ BOOLEAN Enable);
6930 NTOSAPI
6931 VOID
6932 DDKAPI
6933 IoSetHardErrorOrVerifyDevice(
6934 /*IN*/ PIRP Irp,
6935 /*IN*/ PDEVICE_OBJECT DeviceObject);
6938 * VOID
6939 * IoSetNextIrpStackLocation(
6940 * IN OUT PIRP Irp)
6942 #define IoSetNextIrpStackLocation(_Irp) \
6944 (_Irp)->CurrentLocation--; \
6945 (_Irp)->Tail.Overlay.CurrentStackLocation--; \
6948 NTOSAPI
6949 NTSTATUS
6950 DDKAPI
6951 IoSetPartitionInformationEx(
6952 /*IN*/ PDEVICE_OBJECT DeviceObject,
6953 /*IN*/ ULONG PartitionNumber,
6954 /*IN*/ struct _SET_PARTITION_INFORMATION_EX *PartitionInfo);
6956 NTOSAPI
6957 VOID
6958 DDKAPI
6959 IoSetShareAccess(
6960 /*IN*/ ACCESS_MASK DesiredAccess,
6961 /*IN*/ ULONG DesiredShareAccess,
6962 /*IN OUT*/ PFILE_OBJECT FileObject,
6963 /*OUT*/ PSHARE_ACCESS ShareAccess);
6965 NTOSAPI
6966 VOID
6967 DDKAPI
6968 IoSetStartIoAttributes(
6969 /*IN*/ PDEVICE_OBJECT DeviceObject,
6970 /*IN*/ BOOLEAN DeferredStartIo,
6971 /*IN*/ BOOLEAN NonCancelable);
6973 NTOSAPI
6974 NTSTATUS
6975 DDKAPI
6976 IoSetSystemPartition(
6977 /*IN*/ PUNICODE_STRING VolumeNameString);
6979 NTOSAPI
6980 BOOLEAN
6981 DDKAPI
6982 IoSetThreadHardErrorMode(
6983 /*IN*/ BOOLEAN EnableHardErrors);
6986 * USHORT
6987 * IoSizeOfIrp(
6988 * IN CCHAR StackSize)
6990 #define IoSizeOfIrp(_StackSize) \
6991 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
6994 * VOID
6995 * IoSkipCurrentIrpStackLocation(
6996 * IN PIRP Irp)
6998 #define IoSkipCurrentIrpStackLocation(_Irp) \
7000 (_Irp)->CurrentLocation++; \
7001 (_Irp)->Tail.Overlay.CurrentStackLocation++; \
7004 NTOSAPI
7005 VOID
7006 DDKAPI
7007 IoStartNextPacket(
7008 /*IN*/ PDEVICE_OBJECT DeviceObject,
7009 /*IN*/ BOOLEAN Cancelable);
7011 NTOSAPI
7012 VOID
7013 DDKAPI
7014 IoStartNextPacketByKey(
7015 /*IN*/ PDEVICE_OBJECT DeviceObject,
7016 /*IN*/ BOOLEAN Cancelable,
7017 /*IN*/ ULONG Key);
7019 NTOSAPI
7020 VOID
7021 DDKAPI
7022 IoStartPacket(
7023 /*IN*/ PDEVICE_OBJECT DeviceObject,
7024 /*IN*/ PIRP Irp,
7025 /*IN*/ PULONG Key /*OPTIONAL*/,
7026 /*IN*/ PDRIVER_CANCEL CancelFunction /*OPTIONAL*/);
7028 NTOSAPI
7029 VOID
7030 DDKAPI
7031 IoStartTimer(
7032 /*IN*/ PDEVICE_OBJECT DeviceObject);
7034 NTOSAPI
7035 VOID
7036 DDKAPI
7037 IoStopTimer(
7038 /*IN*/ PDEVICE_OBJECT DeviceObject);
7040 NTOSAPI
7041 NTSTATUS
7042 DDKAPI
7043 IoUnregisterPlugPlayNotification(
7044 /*IN*/ PVOID NotificationEntry);
7046 NTOSAPI
7047 VOID
7048 DDKAPI
7049 IoUnregisterShutdownNotification(
7050 /*IN*/ PDEVICE_OBJECT DeviceObject);
7052 NTOSAPI
7053 VOID
7054 DDKAPI
7055 IoUpdateShareAccess(
7056 /*IN*/ PFILE_OBJECT FileObject,
7057 /*IN OUT*/ PSHARE_ACCESS ShareAccess);
7059 NTOSAPI
7060 NTSTATUS
7061 DDKAPI
7062 IoVerifyPartitionTable(
7063 /*IN*/ PDEVICE_OBJECT DeviceObject,
7064 /*IN*/ BOOLEAN FixErrors);
7066 NTOSAPI
7067 NTSTATUS
7068 DDKAPI
7069 IoVolumeDeviceToDosName(
7070 /*IN*/ PVOID VolumeDeviceObject,
7071 /*OUT*/ PUNICODE_STRING DosName);
7073 NTOSAPI
7074 NTSTATUS
7075 DDKAPI
7076 IoWMIAllocateInstanceIds(
7077 /*IN*/ GUID *Guid,
7078 /*IN*/ ULONG InstanceCount,
7079 /*OUT*/ ULONG *FirstInstanceId);
7081 NTOSAPI
7082 ULONG
7083 DDKAPI
7084 IoWMIDeviceObjectToProviderId(
7085 /*IN*/ PDEVICE_OBJECT DeviceObject);
7087 NTOSAPI
7088 NTSTATUS
7089 DDKAPI
7090 IoWMIDeviceObjectToInstanceName(
7091 /*IN*/ PVOID DataBlockObject,
7092 /*IN*/ PDEVICE_OBJECT DeviceObject,
7093 /*OUT*/ PUNICODE_STRING InstanceName);
7095 NTOSAPI
7096 NTSTATUS
7097 DDKAPI
7098 IoWMIExecuteMethod(
7099 /*IN*/ PVOID DataBlockObject,
7100 /*IN*/ PUNICODE_STRING InstanceName,
7101 /*IN*/ ULONG MethodId,
7102 /*IN*/ ULONG InBufferSize,
7103 /*IN OUT*/ PULONG OutBufferSize,
7104 /*IN OUT*/ PUCHAR InOutBuffer);
7106 NTOSAPI
7107 NTSTATUS
7108 DDKAPI
7109 IoWMIHandleToInstanceName(
7110 /*IN*/ PVOID DataBlockObject,
7111 /*IN*/ HANDLE FileHandle,
7112 /*OUT*/ PUNICODE_STRING InstanceName);
7114 NTOSAPI
7115 NTSTATUS
7116 DDKAPI
7117 IoWMIOpenBlock(
7118 /*IN*/ GUID *DataBlockGuid,
7119 /*IN*/ ULONG DesiredAccess,
7120 /*OUT*/ PVOID *DataBlockObject);
7122 NTOSAPI
7123 NTSTATUS
7124 DDKAPI
7125 IoWMIQueryAllData(
7126 /*IN*/ PVOID DataBlockObject,
7127 /*IN OUT*/ ULONG *InOutBufferSize,
7128 /*OUT*/ PVOID OutBuffer);
7130 NTOSAPI
7131 NTSTATUS
7132 DDKAPI
7133 IoWMIQueryAllDataMultiple(
7134 /*IN*/ PVOID *DataBlockObjectList,
7135 /*IN*/ ULONG ObjectCount,
7136 /*IN OUT*/ ULONG *InOutBufferSize,
7137 /*OUT*/ PVOID OutBuffer);
7139 NTOSAPI
7140 NTSTATUS
7141 DDKAPI
7142 IoWMIQuerySingleInstance(
7143 /*IN*/ PVOID DataBlockObject,
7144 /*IN*/ PUNICODE_STRING InstanceName,
7145 /*IN OUT*/ ULONG *InOutBufferSize,
7146 /*OUT*/ PVOID OutBuffer);
7148 NTOSAPI
7149 NTSTATUS
7150 DDKAPI
7151 IoWMIQuerySingleInstanceMultiple(
7152 /*IN*/ PVOID *DataBlockObjectList,
7153 /*IN*/ PUNICODE_STRING InstanceNames,
7154 /*IN*/ ULONG ObjectCount,
7155 /*IN OUT*/ ULONG *InOutBufferSize,
7156 /*OUT*/ PVOID OutBuffer);
7158 NTOSAPI
7159 NTSTATUS
7160 DDKAPI
7161 IoWMIRegistrationControl(
7162 /*IN*/ PDEVICE_OBJECT DeviceObject,
7163 /*IN*/ ULONG Action);
7165 NTOSAPI
7166 NTSTATUS
7167 DDKAPI
7168 IoWMISetNotificationCallback(
7169 /*IN*/ PVOID Object,
7170 /*IN*/ WMI_NOTIFICATION_CALLBACK Callback,
7171 /*IN*/ PVOID Context);
7173 NTOSAPI
7174 NTSTATUS
7175 DDKAPI
7176 IoWMISetSingleInstance(
7177 /*IN*/ PVOID DataBlockObject,
7178 /*IN*/ PUNICODE_STRING InstanceName,
7179 /*IN*/ ULONG Version,
7180 /*IN*/ ULONG ValueBufferSize,
7181 /*IN*/ PVOID ValueBuffer);
7183 NTOSAPI
7184 NTSTATUS
7185 DDKAPI
7186 IoWMISetSingleItem(
7187 /*IN*/ PVOID DataBlockObject,
7188 /*IN*/ PUNICODE_STRING InstanceName,
7189 /*IN*/ ULONG DataItemId,
7190 /*IN*/ ULONG Version,
7191 /*IN*/ ULONG ValueBufferSize,
7192 /*IN*/ PVOID ValueBuffer);
7194 NTOSAPI
7195 NTSTATUS
7196 DDKAPI
7197 IoWMISuggestInstanceName(
7198 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject /*OPTIONAL*/,
7199 /*IN*/ PUNICODE_STRING SymbolicLinkName /*OPTIONAL*/,
7200 /*IN*/ BOOLEAN CombineNames,
7201 /*OUT*/ PUNICODE_STRING SuggestedInstanceName);
7203 NTOSAPI
7204 NTSTATUS
7205 DDKAPI
7206 IoWMIWriteEvent(
7207 /*IN*/ PVOID WnodeEventItem);
7209 NTOSAPI
7210 VOID
7211 DDKAPI
7212 IoWriteErrorLogEntry(
7213 /*IN*/ PVOID ElEntry);
7215 NTOSAPI
7216 NTSTATUS
7217 DDKAPI
7218 IoWritePartitionTableEx(
7219 /*IN*/ PDEVICE_OBJECT DeviceObject,
7220 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX *PartitionBuffer);
7224 /** Kernel routines **/
7226 NTOSAPI
7227 VOID
7228 DDKFASTAPI
7229 KeAcquireInStackQueuedSpinLock(
7230 /*IN*/ PKSPIN_LOCK SpinLock,
7231 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7233 NTOSAPI
7234 VOID
7235 DDKFASTAPI
7236 KeAcquireInStackQueuedSpinLockAtDpcLevel(
7237 /*IN*/ PKSPIN_LOCK SpinLock,
7238 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7240 NTOSAPI
7241 KIRQL
7242 DDKAPI
7243 KeAcquireInterruptSpinLock(
7244 /*IN*/ PKINTERRUPT Interrupt);
7246 NTOSAPI
7247 VOID
7248 DDKAPI
7249 KeAcquireSpinLock(
7250 /*IN*/ PKSPIN_LOCK SpinLock,
7251 /*OUT*/ PKIRQL OldIrql);
7253 /* System Service Dispatch Table */
7254 typedef PVOID (NTAPI * SSDT)(VOID);
7255 typedef SSDT * PSSDT;
7257 /* System Service Parameters Table */
7258 typedef UCHAR SSPT, * PSSPT;
7260 typedef struct _SSDT_ENTRY {
7261 PSSDT SSDT;
7262 PULONG ServiceCounterTable;
7263 ULONG NumberOfServices;
7264 PSSPT SSPT;
7265 } SSDT_ENTRY, *PSSDT_ENTRY;
7267 NTOSAPI
7268 BOOLEAN
7269 DDKAPI
7270 KeAddSystemServiceTable(
7271 /*IN*/ PSSDT SSDT,
7272 /*IN*/ PULONG ServiceCounterTable,
7273 /*IN*/ ULONG NumberOfServices,
7274 /*IN*/ PSSPT SSPT,
7275 /*IN*/ ULONG TableIndex);
7277 NTOSAPI
7278 BOOLEAN
7279 DDKAPI
7280 KeAreApcsDisabled(
7281 VOID);
7283 NTOSAPI
7284 VOID
7285 DDKAPI
7286 KeAttachProcess(
7287 /*IN*/ PEPROCESS Process);
7289 NTOSAPI
7290 VOID
7291 DDKAPI
7292 KeBugCheck(
7293 /*IN*/ ULONG BugCheckCode);
7295 NTOSAPI
7296 VOID
7297 DDKAPI
7298 KeBugCheckEx(
7299 /*IN*/ ULONG BugCheckCode,
7300 /*IN*/ ULONG_PTR BugCheckParameter1,
7301 /*IN*/ ULONG_PTR BugCheckParameter2,
7302 /*IN*/ ULONG_PTR BugCheckParameter3,
7303 /*IN*/ ULONG_PTR BugCheckParameter4);
7305 NTOSAPI
7306 BOOLEAN
7307 DDKAPI
7308 KeCancelTimer(
7309 /*IN*/ PKTIMER Timer);
7311 NTOSAPI
7312 VOID
7313 DDKAPI
7314 KeClearEvent(
7315 /*IN*/ PRKEVENT Event);
7317 NTOSAPI
7318 NTSTATUS
7319 DDKAPI
7320 KeDelayExecutionThread(
7321 /*IN*/ KPROCESSOR_MODE WaitMode,
7322 /*IN*/ BOOLEAN Alertable,
7323 /*IN*/ PLARGE_INTEGER Interval);
7325 NTOSAPI
7326 BOOLEAN
7327 DDKAPI
7328 KeDeregisterBugCheckCallback(
7329 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
7331 NTOSAPI
7332 VOID
7333 DDKAPI
7334 KeDetachProcess(
7335 VOID);
7337 NTOSAPI
7338 VOID
7339 DDKAPI
7340 KeEnterCriticalRegion(
7341 VOID);
7344 * VOID
7345 * KeFlushIoBuffers(
7346 * IN PMDL Mdl,
7347 * IN BOOLEAN ReadOperation,
7348 * IN BOOLEAN DmaOperation)
7350 #define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
7352 NTOSAPI
7353 PRKTHREAD
7354 DDKAPI
7355 KeGetCurrentThread(
7356 VOID);
7358 NTOSAPI
7359 KPROCESSOR_MODE
7360 DDKAPI
7361 KeGetPreviousMode(
7362 VOID);
7364 NTOSAPI
7365 ULONG
7366 DDKAPI
7367 KeGetRecommendedSharedDataAlignment(
7368 VOID);
7370 NTOSAPI
7371 VOID
7372 DDKAPI
7373 KeInitializeApc(
7374 /*IN*/ PKAPC Apc,
7375 /*IN*/ PKTHREAD Thread,
7376 /*IN*/ UCHAR StateIndex,
7377 /*IN*/ PKKERNEL_ROUTINE KernelRoutine,
7378 /*IN*/ PKRUNDOWN_ROUTINE RundownRoutine,
7379 /*IN*/ PKNORMAL_ROUTINE NormalRoutine,
7380 /*IN*/ UCHAR Mode,
7381 /*IN*/ PVOID Context);
7383 NTOSAPI
7384 VOID
7385 DDKAPI
7386 KeInitializeDeviceQueue(
7387 /*IN*/ PKDEVICE_QUEUE DeviceQueue);
7389 NTOSAPI
7390 VOID
7391 DDKAPI
7392 KeInitializeMutex(
7393 /*IN*/ PRKMUTEX Mutex,
7394 /*IN*/ ULONG Level);
7396 NTOSAPI
7397 VOID
7398 DDKAPI
7399 KeInitializeSemaphore(
7400 /*IN*/ PRKSEMAPHORE Semaphore,
7401 /*IN*/ LONG Count,
7402 /*IN*/ LONG Limit);
7404 NTOSAPI
7405 VOID
7406 DDKAPI
7407 KeInitializeSpinLock(
7408 /*IN*/ PKSPIN_LOCK SpinLock);
7410 NTOSAPI
7411 VOID
7412 DDKAPI
7413 KeInitializeTimer(
7414 /*IN*/ PKTIMER Timer);
7416 NTOSAPI
7417 VOID
7418 DDKAPI
7419 KeInitializeTimerEx(
7420 /*IN*/ PKTIMER Timer,
7421 /*IN*/ TIMER_TYPE Type);
7423 NTOSAPI
7424 BOOLEAN
7425 DDKAPI
7426 KeInsertByKeyDeviceQueue(
7427 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7428 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry,
7429 /*IN*/ ULONG SortKey);
7431 NTOSAPI
7432 BOOLEAN
7433 DDKAPI
7434 KeInsertDeviceQueue(
7435 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7436 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
7438 NTOSAPI
7439 BOOLEAN
7440 DDKAPI
7441 KeInsertQueueDpc(
7442 /*IN*/ PRKDPC Dpc,
7443 /*IN*/ PVOID SystemArgument1,
7444 /*IN*/ PVOID SystemArgument2);
7446 NTOSAPI
7447 VOID
7448 DDKAPI
7449 KeLeaveCriticalRegion(
7450 VOID);
7452 NTOSAPI
7453 NTSTATUS
7454 DDKAPI
7455 KePulseEvent(
7456 /*IN*/ PRKEVENT Event,
7457 /*IN*/ KPRIORITY Increment,
7458 /*IN*/ BOOLEAN Wait);
7460 NTOSAPI
7461 ULONGLONG
7462 DDKAPI
7463 KeQueryInterruptTime(
7464 VOID);
7466 NTOSAPI
7467 LARGE_INTEGER
7468 DDKAPI
7469 KeQueryPerformanceCounter(
7470 /*OUT*/ PLARGE_INTEGER PerformanceFrequency /*OPTIONAL*/);
7472 NTOSAPI
7473 KPRIORITY
7474 DDKAPI
7475 KeQueryPriorityThread(
7476 /*IN*/ PRKTHREAD Thread);
7478 NTOSAPI
7479 VOID
7480 DDKAPI
7481 KeQuerySystemTime(
7482 /*OUT*/ PLARGE_INTEGER CurrentTime);
7484 NTOSAPI
7485 VOID
7486 DDKAPI
7487 KeQueryTickCount(
7488 /*OUT*/ PLARGE_INTEGER TickCount);
7490 NTOSAPI
7491 ULONG
7492 DDKAPI
7493 KeQueryTimeIncrement(
7494 VOID);
7496 NTOSAPI
7497 LONG
7498 DDKAPI
7499 KeReadStateEvent(
7500 /*IN*/ PRKEVENT Event);
7502 NTOSAPI
7503 LONG
7504 DDKAPI
7505 KeReadStateMutex(
7506 /*IN*/ PRKMUTEX Mutex);
7508 NTOSAPI
7509 LONG
7510 DDKAPI
7511 KeReadStateSemaphore(
7512 /*IN*/ PRKSEMAPHORE Semaphore);
7514 NTOSAPI
7515 BOOLEAN
7516 DDKAPI
7517 KeReadStateTimer(
7518 /*IN*/ PKTIMER Timer);
7520 NTOSAPI
7521 BOOLEAN
7522 DDKAPI
7523 KeRegisterBugCheckCallback(
7524 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
7525 /*IN*/ PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
7526 /*IN*/ PVOID Buffer,
7527 /*IN*/ ULONG Length,
7528 /*IN*/ PUCHAR Component);
7530 NTOSAPI
7531 VOID
7532 DDKFASTAPI
7533 KeReleaseInStackQueuedSpinLock(
7534 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7536 NTOSAPI
7537 VOID
7538 DDKFASTAPI
7539 KeReleaseInStackQueuedSpinLockFromDpcLevel(
7540 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle);
7542 NTOSAPI
7543 VOID
7544 DDKAPI
7545 KeReleaseInterruptSpinLock(
7546 /*IN*/ PKINTERRUPT Interrupt,
7547 /*IN*/ KIRQL OldIrql);
7549 NTOSAPI
7550 LONG
7551 DDKAPI
7552 KeReleaseMutex(
7553 /*IN*/ PRKMUTEX Mutex,
7554 /*IN*/ BOOLEAN Wait);
7556 NTOSAPI
7557 LONG
7558 DDKAPI
7559 KeReleaseSemaphore(
7560 /*IN*/ PRKSEMAPHORE Semaphore,
7561 /*IN*/ KPRIORITY Increment,
7562 /*IN*/ LONG Adjustment,
7563 /*IN*/ BOOLEAN Wait);
7565 NTOSAPI
7566 VOID
7567 DDKAPI
7568 KeReleaseSpinLock(
7569 /*IN*/ PKSPIN_LOCK SpinLock,
7570 /*IN*/ KIRQL NewIrql);
7572 NTOSAPI
7573 PKDEVICE_QUEUE_ENTRY
7574 DDKAPI
7575 KeRemoveByKeyDeviceQueue(
7576 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7577 /*IN*/ ULONG SortKey);
7579 NTOSAPI
7580 PKDEVICE_QUEUE_ENTRY
7581 DDKAPI
7582 KeRemoveDeviceQueue(
7583 /*IN*/ PKDEVICE_QUEUE DeviceQueue);
7585 NTOSAPI
7586 BOOLEAN
7587 DDKAPI
7588 KeRemoveEntryDeviceQueue(
7589 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
7590 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
7592 NTOSAPI
7593 BOOLEAN
7594 DDKAPI
7595 KeRemoveQueueDpc(
7596 /*IN*/ PRKDPC Dpc);
7598 NTOSAPI
7599 LONG
7600 DDKAPI
7601 KeResetEvent(
7602 /*IN*/ PRKEVENT Event);
7604 NTOSAPI
7605 NTSTATUS
7606 DDKAPI
7607 KeRestoreFloatingPointState(
7608 /*IN*/ PKFLOATING_SAVE FloatSave);
7610 NTOSAPI
7611 NTSTATUS
7612 DDKAPI
7613 KeSaveFloatingPointState(
7614 /*OUT*/ PKFLOATING_SAVE FloatSave);
7616 NTOSAPI
7617 LONG
7618 DDKAPI
7619 KeSetBasePriorityThread(
7620 /*IN*/ PRKTHREAD Thread,
7621 /*IN*/ LONG Increment);
7623 NTOSAPI
7624 LONG
7625 DDKAPI
7626 KeSetEvent(
7627 /*IN*/ PRKEVENT Event,
7628 /*IN*/ KPRIORITY Increment,
7629 /*IN*/ BOOLEAN Wait);
7631 NTOSAPI
7632 VOID
7633 DDKAPI
7634 KeSetImportanceDpc(
7635 /*IN*/ PRKDPC Dpc,
7636 /*IN*/ KDPC_IMPORTANCE Importance);
7638 NTOSAPI
7639 KPRIORITY
7640 DDKAPI
7641 KeSetPriorityThread(
7642 /*IN*/ PKTHREAD Thread,
7643 /*IN*/ KPRIORITY Priority);
7645 NTOSAPI
7646 VOID
7647 DDKAPI
7648 KeSetTargetProcessorDpc(
7649 /*IN*/ PRKDPC Dpc,
7650 /*IN*/ CCHAR Number);
7652 NTOSAPI
7653 BOOLEAN
7654 DDKAPI
7655 KeSetTimer(
7656 /*IN*/ PKTIMER Timer,
7657 /*IN*/ LARGE_INTEGER DueTime,
7658 /*IN*/ PKDPC Dpc /*OPTIONAL*/);
7660 NTOSAPI
7661 BOOLEAN
7662 DDKAPI
7663 KeSetTimerEx(
7664 /*IN*/ PKTIMER Timer,
7665 /*IN*/ LARGE_INTEGER DueTime,
7666 /*IN*/ LONG Period /*OPTIONAL*/,
7667 /*IN*/ PKDPC Dpc /*OPTIONAL*/);
7669 NTOSAPI
7670 VOID
7671 DDKFASTAPI
7672 KeSetTimeUpdateNotifyRoutine(
7673 /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine);
7675 NTOSAPI
7676 VOID
7677 DDKAPI
7678 KeStallExecutionProcessor(
7679 /*IN*/ ULONG MicroSeconds);
7681 NTOSAPI
7682 BOOLEAN
7683 DDKAPI
7684 KeSynchronizeExecution(
7685 /*IN*/ PKINTERRUPT Interrupt,
7686 /*IN*/ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
7687 /*IN*/ PVOID SynchronizeContext);
7689 NTOSAPI
7690 NTSTATUS
7691 DDKAPI
7692 KeWaitForMultipleObjects(
7693 /*IN*/ ULONG Count,
7694 /*IN*/ PVOID Object[],
7695 /*IN*/ WAIT_TYPE WaitType,
7696 /*IN*/ KWAIT_REASON WaitReason,
7697 /*IN*/ KPROCESSOR_MODE WaitMode,
7698 /*IN*/ BOOLEAN Alertable,
7699 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL */,
7700 /*IN*/ PKWAIT_BLOCK WaitBlockArray /*OPTIONAL*/);
7702 NTOSAPI
7703 NTSTATUS
7704 DDKAPI
7705 KeWaitForMutexObject(
7706 /*IN*/ PRKMUTEX Mutex,
7707 /*IN*/ KWAIT_REASON WaitReason,
7708 /*IN*/ KPROCESSOR_MODE WaitMode,
7709 /*IN*/ BOOLEAN Alertable,
7710 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL*/);
7712 NTOSAPI
7713 NTSTATUS
7714 DDKAPI
7715 KeWaitForSingleObject(
7716 /*IN*/ PVOID Object,
7717 /*IN*/ KWAIT_REASON WaitReason,
7718 /*IN*/ KPROCESSOR_MODE WaitMode,
7719 /*IN*/ BOOLEAN Alertable,
7720 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL*/);
7722 #if defined(_X86_)
7724 NTOSAPI
7725 VOID
7726 FASTCALL
7727 KfLowerIrql(
7728 /*IN*/ KIRQL NewIrql);
7730 NTOSAPI
7731 KIRQL
7732 FASTCALL
7733 KfRaiseIrql(
7734 /*IN*/ KIRQL NewIrql);
7736 #define KeLowerIrql(a) KfLowerIrql(a)
7737 #define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
7739 #else
7741 NTOSAPI
7742 VOID
7743 DDKAPI
7744 KeLowerIrql(
7745 /*IN*/ KIRQL NewIrql);
7747 NTOSAPI
7748 KIRQL
7749 DDKAPI
7750 KeRaiseIrql(
7751 /*IN*/ KIRQL NewIrql);
7753 #endif
7755 NTOSAPI
7756 KIRQL
7757 DDKAPI
7758 KeRaiseIrqlToDpcLevel(
7759 VOID);
7761 /** Memory manager routines **/
7763 NTOSAPI
7764 NTSTATUS
7765 DDKAPI
7766 MmAdvanceMdl(
7767 /*IN*/ PMDL Mdl,
7768 /*IN*/ ULONG NumberOfBytes);
7770 NTOSAPI
7771 PVOID
7772 DDKAPI
7773 MmAllocateContiguousMemory(
7774 /*IN*/ ULONG NumberOfBytes,
7775 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress);
7777 NTOSAPI
7778 PVOID
7779 DDKAPI
7780 MmAllocateContiguousMemorySpecifyCache(
7781 /*IN*/ SIZE_T NumberOfBytes,
7782 /*IN*/ PHYSICAL_ADDRESS LowestAcceptableAddress,
7783 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress,
7784 /*IN*/ PHYSICAL_ADDRESS BoundaryAddressMultiple /*OPTIONAL*/,
7785 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7787 NTOSAPI
7788 PVOID
7789 DDKAPI
7790 MmAllocateMappingAddress(
7791 /*IN*/ SIZE_T NumberOfBytes,
7792 /*IN*/ ULONG PoolTag);
7794 NTOSAPI
7795 PVOID
7796 DDKAPI
7797 MmAllocateNonCachedMemory(
7798 /*IN*/ ULONG NumberOfBytes);
7800 NTOSAPI
7801 PMDL
7802 DDKAPI
7803 MmAllocatePagesForMdl(
7804 /*IN*/ PHYSICAL_ADDRESS LowAddress,
7805 /*IN*/ PHYSICAL_ADDRESS HighAddress,
7806 /*IN*/ PHYSICAL_ADDRESS SkipBytes,
7807 /*IN*/ SIZE_T TotalBytes);
7809 NTOSAPI
7810 VOID
7811 DDKAPI
7812 MmBuildMdlForNonPagedPool(
7813 /*IN OUT*/ PMDL MemoryDescriptorList);
7815 NTOSAPI
7816 NTSTATUS
7817 DDKAPI
7818 MmCreateSection(
7819 /*OUT*/ PSECTION_OBJECT *SectionObject,
7820 /*IN*/ ACCESS_MASK DesiredAccess,
7821 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
7822 /*IN*/ PLARGE_INTEGER MaximumSize,
7823 /*IN*/ ULONG SectionPageProtection,
7824 /*IN*/ ULONG AllocationAttributes,
7825 /*IN*/ HANDLE FileHandle /*OPTIONAL*/,
7826 /*IN*/ PFILE_OBJECT File /*OPTIONAL*/);
7828 typedef enum _MMFLUSH_TYPE {
7829 MmFlushForDelete,
7830 MmFlushForWrite
7831 } MMFLUSH_TYPE;
7833 NTOSAPI
7834 BOOLEAN
7835 DDKAPI
7836 MmFlushImageSection(
7837 /*IN*/ PSECTION_OBJECT_POINTERS SectionObjectPointer,
7838 /*IN*/ MMFLUSH_TYPE FlushType);
7840 NTOSAPI
7841 VOID
7842 DDKAPI
7843 MmFreeContiguousMemory(
7844 /*IN*/ PVOID BaseAddress);
7846 NTOSAPI
7847 VOID
7848 DDKAPI
7849 MmFreeContiguousMemorySpecifyCache(
7850 /*IN*/ PVOID BaseAddress,
7851 /*IN*/ SIZE_T NumberOfBytes,
7852 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7854 NTOSAPI
7855 VOID
7856 DDKAPI
7857 MmFreeMappingAddress(
7858 /*IN*/ PVOID BaseAddress,
7859 /*IN*/ ULONG PoolTag);
7861 NTOSAPI
7862 VOID
7863 DDKAPI
7864 MmFreeNonCachedMemory(
7865 /*IN*/ PVOID BaseAddress,
7866 /*IN*/ SIZE_T NumberOfBytes);
7868 NTOSAPI
7869 VOID
7870 DDKAPI
7871 MmFreePagesFromMdl(
7872 /*IN*/ PMDL MemoryDescriptorList);
7875 * ULONG
7876 * MmGetMdlByteCount(
7877 * IN PMDL Mdl)
7879 #define MmGetMdlByteCount(_Mdl) \
7880 ((_Mdl)->ByteCount)
7883 * ULONG
7884 * MmGetMdlByteOffset(
7885 * IN PMDL Mdl)
7887 #define MmGetMdlByteOffset(_Mdl) \
7888 ((_Mdl)->ByteOffset)
7891 * PPFN_NUMBER
7892 * MmGetMdlPfnArray(
7893 * IN PMDL Mdl)
7895 #define MmGetMdlPfnArray(_Mdl) \
7896 ((PPFN_NUMBER) ((_Mdl) + 1))
7899 * PVOID
7900 * MmGetMdlVirtualAddress(
7901 * IN PMDL Mdl)
7903 #define MmGetMdlVirtualAddress(_Mdl) \
7904 ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
7906 NTOSAPI
7907 PHYSICAL_ADDRESS
7908 DDKAPI
7909 MmGetPhysicalAddress(
7910 /*IN*/ PVOID BaseAddress);
7912 NTOSAPI
7913 PPHYSICAL_MEMORY_RANGE
7914 DDKAPI
7915 MmGetPhysicalMemoryRanges(
7916 VOID);
7918 NTOSAPI
7919 PVOID
7920 DDKAPI
7921 MmGetVirtualForPhysical(
7922 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress);
7924 NTOSAPI
7925 PVOID
7926 DDKAPI
7927 MmMapLockedPagesSpecifyCache(
7928 /*IN*/ PMDL MemoryDescriptorList,
7929 /*IN*/ KPROCESSOR_MODE AccessMode,
7930 /*IN*/ MEMORY_CACHING_TYPE CacheType,
7931 /*IN*/ PVOID BaseAddress,
7932 /*IN*/ ULONG BugCheckOnFailure,
7933 /*IN*/ MM_PAGE_PRIORITY Priority);
7935 NTOSAPI
7936 PVOID
7937 DDKAPI
7938 MmMapLockedPagesWithReservedMapping(
7939 /*IN*/ PVOID MappingAddress,
7940 /*IN*/ ULONG PoolTag,
7941 /*IN*/ PMDL MemoryDescriptorList,
7942 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7944 NTOSAPI
7945 NTSTATUS
7946 DDKAPI
7947 MmMapUserAddressesToPage(
7948 /*IN*/ PVOID BaseAddress,
7949 /*IN*/ SIZE_T NumberOfBytes,
7950 /*IN*/ PVOID PageAddress);
7952 NTOSAPI
7953 PVOID
7954 DDKAPI
7955 MmMapVideoDisplay(
7956 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress,
7957 /*IN*/ SIZE_T NumberOfBytes,
7958 /*IN*/ MEMORY_CACHING_TYPE CacheType);
7960 NTOSAPI
7961 NTSTATUS
7962 DDKAPI
7963 MmMapViewInSessionSpace(
7964 /*IN*/ PVOID Section,
7965 /*OUT*/ PVOID *MappedBase,
7966 /*IN OUT*/ PSIZE_T ViewSize);
7968 NTOSAPI
7969 NTSTATUS
7970 DDKAPI
7971 MmMapViewInSystemSpace(
7972 /*IN*/ PVOID Section,
7973 /*OUT*/ PVOID *MappedBase,
7974 /*IN*/ PSIZE_T ViewSize);
7976 NTOSAPI
7977 NTSTATUS
7978 DDKAPI
7979 MmMarkPhysicalMemoryAsBad(
7980 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7981 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes);
7983 NTOSAPI
7984 NTSTATUS
7985 DDKAPI
7986 MmMarkPhysicalMemoryAsGood(
7987 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7988 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes);
7991 * PVOID
7992 * MmGetSystemAddressForMdlSafe(
7993 * IN PMDL Mdl,
7994 * IN MM_PAGE_PRIORITY Priority)
7996 #define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
7997 ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
7998 | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
7999 (_Mdl)->MappedSystemVa : \
8000 (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
8001 KernelMode, MmCached, NULL, FALSE, _Priority)
8003 NTOSAPI
8004 PVOID
8005 DDKAPI
8006 MmGetSystemRoutineAddress(
8007 /*IN*/ PUNICODE_STRING SystemRoutineName);
8010 * ULONG
8011 * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
8012 * IN PVOID Va,
8013 * IN ULONG Size)
8015 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
8016 _Size) \
8017 ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
8018 + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
8021 * VOID
8022 * MmInitializeMdl(
8023 * IN PMDL MemoryDescriptorList,
8024 * IN PVOID BaseVa,
8025 * IN SIZE_T Length)
8027 #define MmInitializeMdl(_MemoryDescriptorList, \
8028 _BaseVa, \
8029 _Length) \
8031 (_MemoryDescriptorList)->Next = (PMDL) NULL; \
8032 (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
8033 (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
8034 (_MemoryDescriptorList)->MdlFlags = 0; \
8035 (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
8036 (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
8037 (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
8040 NTOSAPI
8041 BOOLEAN
8042 DDKAPI
8043 MmIsAddressValid(
8044 /*IN*/ PVOID VirtualAddress);
8046 NTOSAPI
8047 LOGICAL
8048 DDKAPI
8049 MmIsDriverVerifying(
8050 /*IN*/ PDRIVER_OBJECT DriverObject);
8052 NTOSAPI
8053 BOOLEAN
8054 DDKAPI
8055 MmIsThisAnNtAsSystem(
8056 VOID);
8058 NTOSAPI
8059 NTSTATUS
8060 DDKAPI
8061 MmIsVerifierEnabled(
8062 /*OUT*/ PULONG VerifierFlags);
8064 NTOSAPI
8065 PVOID
8066 DDKAPI
8067 MmLockPagableDataSection(
8068 /*IN*/ PVOID AddressWithinSection);
8070 NTOSAPI
8071 PVOID
8072 DDKAPI
8073 MmLockPagableImageSection(
8074 /*IN*/ PVOID AddressWithinSection);
8077 * PVOID
8078 * MmLockPagableCodeSection(
8079 * IN PVOID AddressWithinSection)
8081 #define MmLockPagableCodeSection MmLockPagableDataSection
8083 NTOSAPI
8084 VOID
8085 DDKAPI
8086 MmLockPagableSectionByHandle(
8087 /*IN*/ PVOID ImageSectionHandle);
8089 NTOSAPI
8090 PVOID
8091 DDKAPI
8092 MmMapIoSpace(
8093 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress,
8094 /*IN*/ ULONG NumberOfBytes,
8095 /*IN*/ MEMORY_CACHING_TYPE CacheEnable);
8097 NTOSAPI
8098 PVOID
8099 DDKAPI
8100 MmMapLockedPages(
8101 /*IN*/ PMDL MemoryDescriptorList,
8102 /*IN*/ KPROCESSOR_MODE AccessMode);
8104 NTOSAPI
8105 VOID
8106 DDKAPI
8107 MmPageEntireDriver(
8108 /*IN*/ PVOID AddressWithinSection);
8110 NTOSAPI
8111 VOID
8112 DDKAPI
8113 MmProbeAndLockProcessPages(
8114 /*IN OUT*/ PMDL MemoryDescriptorList,
8115 /*IN*/ PEPROCESS Process,
8116 /*IN*/ KPROCESSOR_MODE AccessMode,
8117 /*IN*/ LOCK_OPERATION Operation);
8119 NTOSAPI
8120 NTSTATUS
8121 DDKAPI
8122 MmProtectMdlSystemAddress(
8123 /*IN*/ PMDL MemoryDescriptorList,
8124 /*IN*/ ULONG NewProtect);
8126 NTOSAPI
8127 VOID
8128 DDKAPI
8129 MmUnmapLockedPages(
8130 /*IN*/ PVOID BaseAddress,
8131 /*IN*/ PMDL MemoryDescriptorList);
8133 NTOSAPI
8134 NTSTATUS
8135 DDKAPI
8136 MmUnmapViewInSessionSpace(
8137 /*IN*/ PVOID MappedBase);
8139 NTOSAPI
8140 NTSTATUS
8141 DDKAPI
8142 MmUnmapViewInSystemSpace(
8143 /*IN*/ PVOID MappedBase);
8145 NTOSAPI
8146 VOID
8147 DDKAPI
8148 MmUnsecureVirtualMemory(
8149 /*IN*/ HANDLE SecureHandle);
8152 * VOID
8153 * MmPrepareMdlForReuse(
8154 * IN PMDL Mdl)
8156 #define MmPrepareMdlForReuse(_Mdl) \
8158 if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
8159 ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
8160 MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
8161 } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
8162 ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
8166 NTOSAPI
8167 VOID
8168 DDKAPI
8169 MmProbeAndLockPages(
8170 /*IN OUT*/ PMDL MemoryDescriptorList,
8171 /*IN*/ KPROCESSOR_MODE AccessMode,
8172 /*IN*/ LOCK_OPERATION Operation);
8174 NTOSAPI
8175 MM_SYSTEM_SIZE
8176 DDKAPI
8177 MmQuerySystemSize(
8178 VOID);
8180 NTOSAPI
8181 NTSTATUS
8182 DDKAPI
8183 MmRemovePhysicalMemory(
8184 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
8185 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes);
8187 NTOSAPI
8188 VOID
8189 DDKAPI
8190 MmResetDriverPaging(
8191 /*IN*/ PVOID AddressWithinSection);
8193 NTOSAPI
8194 HANDLE
8195 DDKAPI
8196 MmSecureVirtualMemory(
8197 /*IN*/ PVOID Address,
8198 /*IN*/ SIZE_T Size,
8199 /*IN*/ ULONG ProbeMode);
8201 NTOSAPI
8202 ULONG
8203 DDKAPI
8204 MmSizeOfMdl(
8205 /*IN*/ PVOID Base,
8206 /*IN*/ SIZE_T Length);
8208 NTOSAPI
8209 VOID
8210 DDKAPI
8211 MmUnlockPagableImageSection(
8212 /*IN*/ PVOID ImageSectionHandle);
8214 NTOSAPI
8215 VOID
8216 DDKAPI
8217 MmUnlockPages(
8218 /*IN*/ PMDL MemoryDescriptorList);
8220 NTOSAPI
8221 VOID
8222 DDKAPI
8223 MmUnmapIoSpace(
8224 /*IN*/ PVOID BaseAddress,
8225 /*IN*/ SIZE_T NumberOfBytes);
8227 NTOSAPI
8228 VOID
8229 DDKAPI
8230 MmUnmapReservedMapping(
8231 /*IN*/ PVOID BaseAddress,
8232 /*IN*/ ULONG PoolTag,
8233 /*IN*/ PMDL MemoryDescriptorList);
8235 NTOSAPI
8236 VOID
8237 DDKAPI
8238 MmUnmapVideoDisplay(
8239 /*IN*/ PVOID BaseAddress,
8240 /*IN*/ SIZE_T NumberOfBytes);
8244 /** Object manager routines **/
8246 NTOSAPI
8247 NTSTATUS
8248 DDKAPI
8249 ObAssignSecurity(
8250 /*IN*/ PACCESS_STATE AccessState,
8251 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8252 /*IN*/ PVOID Object,
8253 /*IN*/ POBJECT_TYPE Type);
8255 NTOSAPI
8256 VOID
8257 DDKAPI
8258 ObDereferenceSecurityDescriptor(
8259 PSECURITY_DESCRIPTOR SecurityDescriptor,
8260 ULONG Count);
8262 NTOSAPI
8263 VOID
8264 DDKFASTAPI
8265 ObfDereferenceObject(
8266 /*IN*/ PVOID Object);
8269 * VOID
8270 * ObDereferenceObject(
8271 * IN PVOID Object)
8273 #define ObDereferenceObject ObfDereferenceObject
8275 NTOSAPI
8276 NTSTATUS
8277 DDKAPI
8278 ObGetObjectSecurity(
8279 /*IN*/ PVOID Object,
8280 /*OUT*/ PSECURITY_DESCRIPTOR *SecurityDescriptor,
8281 /*OUT*/ PBOOLEAN MemoryAllocated);
8283 NTOSAPI
8284 NTSTATUS
8285 DDKAPI
8286 ObInsertObject(
8287 /*IN*/ PVOID Object,
8288 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
8289 /*IN*/ ACCESS_MASK DesiredAccess,
8290 /*IN*/ ULONG AdditionalReferences,
8291 /*OUT*/ PVOID* ReferencedObject /*OPTIONAL*/,
8292 /*OUT*/ PHANDLE Handle);
8294 NTOSAPI
8295 VOID
8296 DDKFASTAPI
8297 ObfReferenceObject(
8298 /*IN*/ PVOID Object);
8300 NTOSAPI
8301 NTSTATUS
8302 DDKAPI
8303 ObLogSecurityDescriptor(
8304 /*IN*/ PSECURITY_DESCRIPTOR InputSecurityDescriptor,
8305 /*OUT*/ PSECURITY_DESCRIPTOR *OutputSecurityDescriptor,
8306 /*IN*/ ULONG RefBias);
8308 * VOID
8309 * ObReferenceObject(
8310 * IN PVOID Object)
8312 #define ObReferenceObject ObfReferenceObject
8314 NTOSAPI
8315 VOID
8316 DDKAPI
8317 ObMakeTemporaryObject(
8318 /*IN*/ PVOID Object);
8320 NTOSAPI
8321 NTSTATUS
8322 DDKAPI
8323 ObOpenObjectByName(
8324 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8325 /*IN*/ POBJECT_TYPE ObjectType,
8326 /*IN OUT*/ PVOID ParseContext /*OPTIONAL*/,
8327 /*IN*/ KPROCESSOR_MODE AccessMode,
8328 /*IN*/ ACCESS_MASK DesiredAccess,
8329 /*IN*/ PACCESS_STATE PassedAccessState,
8330 /*OUT*/ PHANDLE Handle);
8332 NTOSAPI
8333 NTSTATUS
8334 DDKAPI
8335 ObOpenObjectByPointer(
8336 /*IN*/ PVOID Object,
8337 /*IN*/ ULONG HandleAttributes,
8338 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
8339 /*IN*/ ACCESS_MASK DesiredAccess /*OPTIONAL*/,
8340 /*IN*/ POBJECT_TYPE ObjectType /*OPTIONAL*/,
8341 /*IN*/ KPROCESSOR_MODE AccessMode,
8342 /*OUT*/ PHANDLE Handle);
8344 NTOSAPI
8345 NTSTATUS
8346 DDKAPI
8347 ObQueryObjectAuditingByHandle(
8348 /*IN*/ HANDLE Handle,
8349 /*OUT*/ PBOOLEAN GenerateOnClose);
8351 NTOSAPI
8352 NTSTATUS
8353 DDKAPI
8354 ObReferenceObjectByHandle(
8355 /*IN*/ HANDLE Handle,
8356 /*IN*/ ACCESS_MASK DesiredAccess,
8357 /*IN*/ POBJECT_TYPE ObjectType /*OPTIONAL*/,
8358 /*IN*/ KPROCESSOR_MODE AccessMode,
8359 /*OUT*/ PVOID *Object,
8360 /*OUT*/ POBJECT_HANDLE_INFORMATION HandleInformation /*OPTIONAL*/);
8362 NTOSAPI
8363 NTSTATUS
8364 DDKAPI
8365 ObReferenceObjectByName(
8366 /*IN*/ PUNICODE_STRING ObjectPath,
8367 /*IN*/ ULONG Attributes,
8368 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
8369 /*IN*/ ACCESS_MASK DesiredAccess /*OPTIONAL*/,
8370 /*IN*/ POBJECT_TYPE ObjectType,
8371 /*IN*/ KPROCESSOR_MODE AccessMode,
8372 /*IN OUT*/ PVOID ParseContext /*OPTIONAL*/,
8373 /*OUT*/ PVOID *Object);
8375 NTOSAPI
8376 NTSTATUS
8377 DDKAPI
8378 ObReferenceObjectByPointer(
8379 /*IN*/ PVOID Object,
8380 /*IN*/ ACCESS_MASK DesiredAccess,
8381 /*IN*/ POBJECT_TYPE ObjectType,
8382 /*IN*/ KPROCESSOR_MODE AccessMode);
8384 NTOSAPI
8385 VOID
8386 DDKAPI
8387 ObReferenceSecurityDescriptor(
8388 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8389 /*IN*/ ULONG Count);
8391 NTOSAPI
8392 VOID
8393 DDKAPI
8394 ObReleaseObjectSecurity(
8395 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8396 /*IN*/ BOOLEAN MemoryAllocated);
8400 /** Process manager routines **/
8402 NTOSAPI
8403 NTSTATUS
8404 DDKAPI
8405 PsCreateSystemProcess(
8406 /*IN*/ PHANDLE ProcessHandle,
8407 /*IN*/ ACCESS_MASK DesiredAccess,
8408 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8410 NTOSAPI
8411 NTSTATUS
8412 DDKAPI
8413 PsCreateSystemThread(
8414 /*OUT*/ PHANDLE ThreadHandle,
8415 /*IN*/ ULONG DesiredAccess,
8416 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
8417 /*IN*/ HANDLE ProcessHandle /*OPTIONAL*/,
8418 /*OUT*/ PCLIENT_ID ClientId /*OPTIONAL*/,
8419 /*IN*/ PKSTART_ROUTINE StartRoutine,
8420 /*IN*/ PVOID StartContext);
8423 * PEPROCESS
8424 * PsGetCurrentProcess(VOID)
8426 #define PsGetCurrentProcess IoGetCurrentProcess
8428 NTOSAPI
8429 HANDLE
8430 DDKAPI
8431 PsGetCurrentProcessId(
8432 VOID);
8435 * PETHREAD
8436 * PsGetCurrentThread(VOID)
8438 #define PsGetCurrentThread() \
8439 ((PETHREAD) KeGetCurrentThread())
8441 NTOSAPI
8442 HANDLE
8443 DDKAPI
8444 PsGetCurrentThreadId(
8445 VOID);
8447 NTOSAPI
8448 BOOLEAN
8449 DDKAPI
8450 PsGetVersion(
8451 PULONG MajorVersion /*OPTIONAL*/,
8452 PULONG MinorVersion /*OPTIONAL*/,
8453 PULONG BuildNumber /*OPTIONAL*/,
8454 PUNICODE_STRING CSDVersion /*OPTIONAL*/);
8456 NTOSAPI
8457 NTSTATUS
8458 DDKAPI
8459 PsRemoveCreateThreadNotifyRoutine(
8460 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
8462 NTOSAPI
8463 NTSTATUS
8464 DDKAPI
8465 PsRemoveLoadImageNotifyRoutine(
8466 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
8468 NTOSAPI
8469 NTSTATUS
8470 DDKAPI
8471 PsSetCreateProcessNotifyRoutine(
8472 /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine,
8473 /*IN*/ BOOLEAN Remove);
8475 NTOSAPI
8476 NTSTATUS
8477 DDKAPI
8478 PsSetCreateThreadNotifyRoutine(
8479 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
8481 NTOSAPI
8482 NTSTATUS
8483 DDKAPI
8484 PsSetLoadImageNotifyRoutine(
8485 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
8487 NTOSAPI
8488 NTSTATUS
8489 DDKAPI
8490 PsTerminateSystemThread(
8491 /*IN*/ NTSTATUS ExitStatus);
8495 /** Security reference monitor routines **/
8497 NTOSAPI
8498 BOOLEAN
8499 DDKAPI
8500 SeAccessCheck(
8501 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
8502 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext,
8503 /*IN*/ BOOLEAN SubjectContextLocked,
8504 /*IN*/ ACCESS_MASK DesiredAccess,
8505 /*IN*/ ACCESS_MASK PreviouslyGrantedAccess,
8506 /*OUT*/ PPRIVILEGE_SET *Privileges /*OPTIONAL*/,
8507 /*IN*/ PGENERIC_MAPPING GenericMapping,
8508 /*IN*/ KPROCESSOR_MODE AccessMode,
8509 /*OUT*/ PACCESS_MASK GrantedAccess,
8510 /*OUT*/ PNTSTATUS AccessStatus);
8512 NTOSAPI
8513 NTSTATUS
8514 DDKAPI
8515 SeAssignSecurity(
8516 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor /*OPTIONAL*/,
8517 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor /*OPTIONAL*/,
8518 /*OUT*/ PSECURITY_DESCRIPTOR *NewDescriptor,
8519 /*IN*/ BOOLEAN IsDirectoryObject,
8520 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext,
8521 /*IN*/ PGENERIC_MAPPING GenericMapping,
8522 /*IN*/ POOL_TYPE PoolType);
8524 NTOSAPI
8525 NTSTATUS
8526 DDKAPI
8527 SeAssignSecurityEx(
8528 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor /*OPTIONAL*/,
8529 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor /*OPTIONAL*/,
8530 /*OUT*/ PSECURITY_DESCRIPTOR *NewDescriptor,
8531 /*IN*/ GUID *ObjectType /*OPTIONAL*/,
8532 /*IN*/ BOOLEAN IsDirectoryObject,
8533 /*IN*/ ULONG AutoInheritFlags,
8534 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext,
8535 /*IN*/ PGENERIC_MAPPING GenericMapping,
8536 /*IN*/ POOL_TYPE PoolType);
8538 NTOSAPI
8539 NTSTATUS
8540 DDKAPI
8541 SeDeassignSecurity(
8542 /*IN OUT*/ PSECURITY_DESCRIPTOR *SecurityDescriptor);
8544 NTOSAPI
8545 BOOLEAN
8546 DDKAPI
8547 SeSinglePrivilegeCheck(
8548 LUID PrivilegeValue,
8549 KPROCESSOR_MODE PreviousMode);
8551 NTOSAPI
8552 BOOLEAN
8553 DDKAPI
8554 SeValidSecurityDescriptor(
8555 /*IN*/ ULONG Length,
8556 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
8560 /** NtXxx routines **/
8562 NTOSAPI
8563 NTSTATUS
8564 DDKAPI
8565 NtOpenProcess(
8566 /*OUT*/ PHANDLE ProcessHandle,
8567 /*IN*/ ACCESS_MASK DesiredAccess,
8568 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8569 /*IN*/ PCLIENT_ID ClientId /*OPTIONAL*/);
8571 NTOSAPI
8572 NTSTATUS
8573 DDKAPI
8574 NtQueryInformationProcess(
8575 /*IN*/ HANDLE ProcessHandle,
8576 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
8577 /*OUT*/ PVOID ProcessInformation,
8578 /*IN*/ ULONG ProcessInformationLength,
8579 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
8583 /** NtXxx and ZwXxx routines **/
8585 NTOSAPI
8586 NTSTATUS
8587 DDKAPI
8588 ZwCancelTimer(
8589 /*IN*/ HANDLE TimerHandle,
8590 /*OUT*/ PBOOLEAN CurrentState /*OPTIONAL*/);
8592 NTOSAPI
8593 NTSTATUS
8594 DDKAPI
8595 NtClose(
8596 /*IN*/ HANDLE Handle);
8598 NTOSAPI
8599 NTSTATUS
8600 DDKAPI
8601 ZwClose(
8602 /*IN*/ HANDLE Handle);
8604 NTOSAPI
8605 NTSTATUS
8606 DDKAPI
8607 ZwCreateDirectoryObject(
8608 /*OUT*/ PHANDLE DirectoryHandle,
8609 /*IN*/ ACCESS_MASK DesiredAccess,
8610 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8612 NTOSAPI
8613 NTSTATUS
8614 DDKAPI
8615 NtCreateEvent(
8616 /*OUT*/ PHANDLE EventHandle,
8617 /*IN*/ ACCESS_MASK DesiredAccess,
8618 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8619 /*IN*/ BOOLEAN ManualReset,
8620 /*IN*/ BOOLEAN InitialState);
8622 NTOSAPI
8623 NTSTATUS
8624 DDKAPI
8625 ZwCreateEvent(
8626 /*OUT*/ PHANDLE EventHandle,
8627 /*IN*/ ACCESS_MASK DesiredAccess,
8628 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8629 /*IN*/ BOOLEAN ManualReset,
8630 /*IN*/ BOOLEAN InitialState);
8632 NTOSAPI
8633 NTSTATUS
8634 DDKAPI
8635 ZwCreateFile(
8636 /*OUT*/ PHANDLE FileHandle,
8637 /*IN*/ ACCESS_MASK DesiredAccess,
8638 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8639 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8640 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
8641 /*IN*/ ULONG FileAttributes,
8642 /*IN*/ ULONG ShareAccess,
8643 /*IN*/ ULONG CreateDisposition,
8644 /*IN*/ ULONG CreateOptions,
8645 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
8646 /*IN*/ ULONG EaLength);
8648 NTOSAPI
8649 NTSTATUS
8650 DDKAPI
8651 ZwCreateKey(
8652 /*OUT*/ PHANDLE KeyHandle,
8653 /*IN*/ ACCESS_MASK DesiredAccess,
8654 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8655 /*IN*/ ULONG TitleIndex,
8656 /*IN*/ PUNICODE_STRING Class /*OPTIONAL*/,
8657 /*IN*/ ULONG CreateOptions,
8658 /*OUT*/ PULONG Disposition /*OPTIONAL*/);
8660 NTOSAPI
8661 NTSTATUS
8662 DDKAPI
8663 ZwCreateTimer(
8664 /*OUT*/ PHANDLE TimerHandle,
8665 /*IN*/ ACCESS_MASK DesiredAccess,
8666 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
8667 /*IN*/ TIMER_TYPE TimerType);
8669 NTOSAPI
8670 NTSTATUS
8671 DDKAPI
8672 ZwDeleteKey(
8673 /*IN*/ HANDLE KeyHandle);
8675 NTOSAPI
8676 NTSTATUS
8677 DDKAPI
8678 ZwDeleteValueKey(
8679 /*IN*/ HANDLE KeyHandle,
8680 /*IN*/ PUNICODE_STRING ValueName);
8682 NTOSAPI
8683 NTSTATUS
8684 DDKAPI
8685 NtDeviceIoControlFile(
8686 /*IN*/ HANDLE DeviceHandle,
8687 /*IN*/ HANDLE Event /*OPTIONAL*/,
8688 /*IN*/ PIO_APC_ROUTINE UserApcRoutine /*OPTIONAL*/,
8689 /*IN*/ PVOID UserApcContext /*OPTIONAL*/,
8690 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8691 /*IN*/ ULONG IoControlCode,
8692 /*IN*/ PVOID InputBuffer,
8693 /*IN*/ ULONG InputBufferSize,
8694 /*OUT*/ PVOID OutputBuffer,
8695 /*IN*/ ULONG OutputBufferSize);
8697 NTOSAPI
8698 NTSTATUS
8699 DDKAPI
8700 ZwDeviceIoControlFile(
8701 /*IN*/ HANDLE DeviceHandle,
8702 /*IN*/ HANDLE Event /*OPTIONAL*/,
8703 /*IN*/ PIO_APC_ROUTINE UserApcRoutine /*OPTIONAL*/,
8704 /*IN*/ PVOID UserApcContext /*OPTIONAL*/,
8705 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8706 /*IN*/ ULONG IoControlCode,
8707 /*IN*/ PVOID InputBuffer,
8708 /*IN*/ ULONG InputBufferSize,
8709 /*OUT*/ PVOID OutputBuffer,
8710 /*IN*/ ULONG OutputBufferSize);
8712 NTOSAPI
8713 NTSTATUS
8714 DDKAPI
8715 ZwEnumerateKey(
8716 /*IN*/ HANDLE KeyHandle,
8717 /*IN*/ ULONG Index,
8718 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
8719 /*OUT*/ PVOID KeyInformation,
8720 /*IN*/ ULONG Length,
8721 /*OUT*/ PULONG ResultLength);
8723 NTOSAPI
8724 NTSTATUS
8725 DDKAPI
8726 ZwEnumerateValueKey(
8727 /*IN*/ HANDLE KeyHandle,
8728 /*IN*/ ULONG Index,
8729 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
8730 /*OUT*/ PVOID KeyValueInformation,
8731 /*IN*/ ULONG Length,
8732 /*OUT*/ PULONG ResultLength);
8734 NTOSAPI
8735 NTSTATUS
8736 DDKAPI
8737 ZwFlushKey(
8738 /*IN*/ HANDLE KeyHandle);
8740 NTOSAPI
8741 NTSTATUS
8742 DDKAPI
8743 ZwMakeTemporaryObject(
8744 /*IN*/ HANDLE Handle);
8746 NTOSAPI
8747 NTSTATUS
8748 DDKAPI
8749 NtMapViewOfSection(
8750 /*IN*/ HANDLE SectionHandle,
8751 /*IN*/ HANDLE ProcessHandle,
8752 /*IN OUT*/ PVOID *BaseAddress,
8753 /*IN*/ ULONG ZeroBits,
8754 /*IN*/ ULONG CommitSize,
8755 /*IN OUT*/ PLARGE_INTEGER SectionOffset /*OPTIONAL*/,
8756 /*IN OUT*/ PSIZE_T ViewSize,
8757 /*IN*/ SECTION_INHERIT InheritDisposition,
8758 /*IN*/ ULONG AllocationType,
8759 /*IN*/ ULONG Protect);
8761 NTOSAPI
8762 NTSTATUS
8763 DDKAPI
8764 ZwMapViewOfSection(
8765 /*IN*/ HANDLE SectionHandle,
8766 /*IN*/ HANDLE ProcessHandle,
8767 /*IN OUT*/ PVOID *BaseAddress,
8768 /*IN*/ ULONG ZeroBits,
8769 /*IN*/ ULONG CommitSize,
8770 /*IN OUT*/ PLARGE_INTEGER SectionOffset /*OPTIONAL*/,
8771 /*IN OUT*/ PSIZE_T ViewSize,
8772 /*IN*/ SECTION_INHERIT InheritDisposition,
8773 /*IN*/ ULONG AllocationType,
8774 /*IN*/ ULONG Protect);
8776 NTOSAPI
8777 NTSTATUS
8778 DDKAPI
8779 NtOpenFile(
8780 /*OUT*/ PHANDLE FileHandle,
8781 /*IN*/ ACCESS_MASK DesiredAccess,
8782 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8783 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8784 /*IN*/ ULONG ShareAccess,
8785 /*IN*/ ULONG OpenOptions);
8787 NTOSAPI
8788 NTSTATUS
8789 DDKAPI
8790 ZwOpenFile(
8791 /*OUT*/ PHANDLE FileHandle,
8792 /*IN*/ ACCESS_MASK DesiredAccess,
8793 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
8794 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8795 /*IN*/ ULONG ShareAccess,
8796 /*IN*/ ULONG OpenOptions);
8798 NTOSAPI
8799 NTSTATUS
8800 DDKAPI
8801 ZwOpenKey(
8802 /*OUT*/ PHANDLE KeyHandle,
8803 /*IN*/ ACCESS_MASK DesiredAccess,
8804 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8806 NTOSAPI
8807 NTSTATUS
8808 DDKAPI
8809 ZwOpenSection(
8810 /*OUT*/ PHANDLE SectionHandle,
8811 /*IN*/ ACCESS_MASK DesiredAccess,
8812 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8814 NTOSAPI
8815 NTSTATUS
8816 DDKAPI
8817 ZwOpenSymbolicLinkObject(
8818 /*OUT*/ PHANDLE LinkHandle,
8819 /*IN*/ ACCESS_MASK DesiredAccess,
8820 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8822 NTOSAPI
8823 NTSTATUS
8824 DDKAPI
8825 ZwOpenTimer(
8826 /*OUT*/ PHANDLE TimerHandle,
8827 /*IN*/ ACCESS_MASK DesiredAccess,
8828 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
8830 NTOSAPI
8831 NTSTATUS
8832 DDKAPI
8833 ZwQueryInformationFile(
8834 /*IN*/ HANDLE FileHandle,
8835 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8836 /*OUT*/ PVOID FileInformation,
8837 /*IN*/ ULONG Length,
8838 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass);
8840 NTOSAPI
8841 NTSTATUS
8842 DDKAPI
8843 ZwQueryKey(
8844 /*IN*/ HANDLE KeyHandle,
8845 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
8846 /*OUT*/ PVOID KeyInformation,
8847 /*IN*/ ULONG Length,
8848 /*OUT*/ PULONG ResultLength);
8850 NTOSAPI
8851 NTSTATUS
8852 DDKAPI
8853 ZwQuerySymbolicLinkObject(
8854 /*IN*/ HANDLE LinkHandle,
8855 /*IN OUT*/ PUNICODE_STRING LinkTarget,
8856 /*OUT*/ PULONG ReturnedLength /*OPTIONAL*/);
8858 NTOSAPI
8859 NTSTATUS
8860 DDKAPI
8861 ZwQueryValueKey(
8862 /*IN*/ HANDLE KeyHandle,
8863 /*IN*/ PUNICODE_STRING ValueName,
8864 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
8865 /*OUT*/ PVOID KeyValueInformation,
8866 /*IN*/ ULONG Length,
8867 /*OUT*/ PULONG ResultLength);
8869 NTOSAPI
8870 NTSTATUS
8871 DDKAPI
8872 NtReadFile(
8873 /*IN*/ HANDLE FileHandle,
8874 /*IN*/ HANDLE Event /*OPTIONAL*/,
8875 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8876 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8877 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8878 /*OUT*/ PVOID Buffer,
8879 /*IN*/ ULONG Length,
8880 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8881 /*IN*/ PULONG Key /*OPTIONAL*/);
8883 NTOSAPI
8884 NTSTATUS
8885 DDKAPI
8886 ZwReadFile(
8887 /*IN*/ HANDLE FileHandle,
8888 /*IN*/ HANDLE Event /*OPTIONAL*/,
8889 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8890 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8891 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8892 /*OUT*/ PVOID Buffer,
8893 /*IN*/ ULONG Length,
8894 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8895 /*IN*/ PULONG Key /*OPTIONAL*/);
8897 NTOSAPI
8898 NTSTATUS
8899 DDKAPI
8900 NtSetEvent(
8901 /*IN*/ HANDLE EventHandle,
8902 /*IN*/ PULONG NumberOfThreadsReleased);
8904 NTOSAPI
8905 NTSTATUS
8906 DDKAPI
8907 ZwSetEvent(
8908 /*IN*/ HANDLE EventHandle,
8909 /*IN*/ PULONG NumberOfThreadsReleased);
8911 NTOSAPI
8912 NTSTATUS
8913 DDKAPI
8914 ZwSetInformationFile(
8915 /*IN*/ HANDLE FileHandle,
8916 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8917 /*IN*/ PVOID FileInformation,
8918 /*IN*/ ULONG Length,
8919 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass);
8921 NTOSAPI
8922 NTSTATUS
8923 DDKAPI
8924 ZwSetInformationThread(
8925 /*IN*/ HANDLE ThreadHandle,
8926 /*IN*/ THREADINFOCLASS ThreadInformationClass,
8927 /*IN*/ PVOID ThreadInformation,
8928 /*IN*/ ULONG ThreadInformationLength);
8930 NTOSAPI
8931 NTSTATUS
8932 DDKAPI
8933 ZwSetTimer(
8934 /*IN*/ HANDLE TimerHandle,
8935 /*IN*/ PLARGE_INTEGER DueTime,
8936 /*IN*/ PTIMER_APC_ROUTINE TimerApcRoutine /*OPTIONAL*/,
8937 /*IN*/ PVOID TimerContext /*OPTIONAL*/,
8938 /*IN*/ BOOLEAN WakeTimer,
8939 /*IN*/ LONG Period /*OPTIONAL*/,
8940 /*OUT*/ PBOOLEAN PreviousState /*OPTIONAL*/);
8942 NTOSAPI
8943 NTSTATUS
8944 DDKAPI
8945 ZwSetValueKey(
8946 /*IN*/ HANDLE KeyHandle,
8947 /*IN*/ PUNICODE_STRING ValueName,
8948 /*IN*/ ULONG TitleIndex /*OPTIONAL*/,
8949 /*IN*/ ULONG Type,
8950 /*IN*/ PVOID Data,
8951 /*IN*/ ULONG DataSize);
8953 /* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
8954 #define AT_EXTENDABLE_FILE 0x00002000
8955 #define SEC_NO_CHANGE 0x00400000
8956 #define AT_RESERVED 0x20000000
8957 #define AT_ROUND_TO_PAGE 0x40000000
8959 NTOSAPI
8960 NTSTATUS
8961 DDKAPI
8962 NtUnmapViewOfSection(
8963 /*IN*/ HANDLE ProcessHandle,
8964 /*IN*/ PVOID BaseAddress);
8966 NTOSAPI
8967 NTSTATUS
8968 DDKAPI
8969 ZwUnmapViewOfSection(
8970 /*IN*/ HANDLE ProcessHandle,
8971 /*IN*/ PVOID BaseAddress);
8973 NTOSAPI
8974 NTSTATUS
8975 DDKAPI
8976 NtWaitForSingleObject(
8977 /*IN*/ HANDLE Object,
8978 /*IN*/ BOOLEAN Alertable,
8979 /*IN*/ PLARGE_INTEGER Time);
8981 NTOSAPI
8982 NTSTATUS
8983 DDKAPI
8984 ZwWaitForSingleObject(
8985 /*IN*/ HANDLE Object,
8986 /*IN*/ BOOLEAN Alertable,
8987 /*IN*/ PLARGE_INTEGER Time);
8989 NTOSAPI
8990 NTSTATUS
8991 DDKAPI
8992 NtWriteFile(
8993 /*IN*/ HANDLE FileHandle,
8994 /*IN*/ HANDLE Event /*OPTIONAL*/,
8995 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8996 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8997 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8998 /*IN*/ PVOID Buffer,
8999 /*IN*/ ULONG Length,
9000 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
9001 /*IN*/ PULONG Key /*OPTIONAL*/);
9003 NTOSAPI
9004 NTSTATUS
9005 DDKAPI
9006 ZwWriteFile(
9007 /*IN*/ HANDLE FileHandle,
9008 /*IN*/ HANDLE Event /*OPTIONAL*/,
9009 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
9010 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
9011 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
9012 /*IN*/ PVOID Buffer,
9013 /*IN*/ ULONG Length,
9014 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
9015 /*IN*/ PULONG Key /*OPTIONAL*/);
9019 /** Power management support routines **/
9021 NTOSAPI
9022 NTSTATUS
9023 DDKAPI
9024 PoCallDriver(
9025 /*IN*/ PDEVICE_OBJECT DeviceObject,
9026 /*IN OUT*/ PIRP Irp);
9028 NTOSAPI
9029 PULONG
9030 DDKAPI
9031 PoRegisterDeviceForIdleDetection(
9032 /*IN*/ PDEVICE_OBJECT DeviceObject,
9033 /*IN*/ ULONG ConservationIdleTime,
9034 /*IN*/ ULONG PerformanceIdleTime,
9035 /*IN*/ DEVICE_POWER_STATE State);
9037 NTOSAPI
9038 PVOID
9039 DDKAPI
9040 PoRegisterSystemState(
9041 /*IN*/ PVOID StateHandle,
9042 /*IN*/ EXECUTION_STATE Flags);
9044 NTOSAPI
9045 NTSTATUS
9046 DDKAPI
9047 PoRequestPowerIrp(
9048 /*IN*/ PDEVICE_OBJECT DeviceObject,
9049 /*IN*/ UCHAR MinorFunction,
9050 /*IN*/ POWER_STATE PowerState,
9051 /*IN*/ PREQUEST_POWER_COMPLETE CompletionFunction,
9052 /*IN*/ PVOID Context,
9053 /*OUT*/ PIRP *Irp /*OPTIONAL*/);
9055 NTOSAPI
9056 NTSTATUS
9057 DDKAPI
9058 PoRequestShutdownEvent(
9059 /*OUT*/ PVOID *Event);
9061 NTOSAPI
9062 VOID
9063 DDKAPI
9064 PoSetDeviceBusy(
9065 PULONG IdlePointer);
9067 NTOSAPI
9068 POWER_STATE
9069 DDKAPI
9070 PoSetPowerState(
9071 /*IN*/ PDEVICE_OBJECT DeviceObject,
9072 /*IN*/ POWER_STATE_TYPE Type,
9073 /*IN*/ POWER_STATE State);
9075 NTOSAPI
9076 VOID
9077 DDKAPI
9078 PoSetSystemState(
9079 /*IN*/ EXECUTION_STATE Flags);
9081 NTOSAPI
9082 VOID
9083 DDKAPI
9084 PoStartNextPowerIrp(
9085 /*IN*/ PIRP Irp);
9087 NTOSAPI
9088 VOID
9089 DDKAPI
9090 PoUnregisterSystemState(
9091 /*IN*/ PVOID StateHandle);
9095 /** WMI library support routines **/
9097 NTOSAPI
9098 NTSTATUS
9099 DDKAPI
9100 WmiCompleteRequest(
9101 /*IN*/ PDEVICE_OBJECT DeviceObject,
9102 /*IN*/ PIRP Irp,
9103 /*IN*/ NTSTATUS Status,
9104 /*IN*/ ULONG BufferUsed,
9105 /*IN*/ CCHAR PriorityBoost);
9107 NTOSAPI
9108 NTSTATUS
9109 DDKAPI
9110 WmiFireEvent(
9111 /*IN*/ PDEVICE_OBJECT DeviceObject,
9112 /*IN*/ LPGUID Guid,
9113 /*IN*/ ULONG InstanceIndex,
9114 /*IN*/ ULONG EventDataSize,
9115 /*IN*/ PVOID EventData);
9117 NTOSAPI
9118 NTSTATUS
9119 DDKAPI
9120 WmiQueryTraceInformation(
9121 /*IN*/ TRACE_INFORMATION_CLASS TraceInformationClass,
9122 /*OUT*/ PVOID TraceInformation,
9123 /*IN*/ ULONG TraceInformationLength,
9124 /*OUT*/ PULONG RequiredLength /*OPTIONAL*/,
9125 /*IN*/ PVOID Buffer /*OPTIONAL*/);
9127 NTOSAPI
9128 NTSTATUS
9129 DDKAPI
9130 WmiSystemControl(
9131 /*IN*/ PWMILIB_CONTEXT WmiLibInfo,
9132 /*IN*/ PDEVICE_OBJECT DeviceObject,
9133 /*IN*/ PIRP Irp,
9134 /*OUT*/ PSYSCTL_IRP_DISPOSITION IrpDisposition);
9136 NTOSAPI
9137 NTSTATUS
9138 DDKCDECLAPI
9139 WmiTraceMessage(
9140 /*IN*/ TRACEHANDLE LoggerHandle,
9141 /*IN*/ ULONG MessageFlags,
9142 /*IN*/ LPGUID MessageGuid,
9143 /*IN*/ USHORT MessageNumber,
9144 /*IN*/ ...);
9146 #if 0
9147 /* FIXME: Get va_list from where? */
9148 NTOSAPI
9149 NTSTATUS
9150 DDKCDECLAPI
9151 WmiTraceMessageVa(
9152 /*IN*/ TRACEHANDLE LoggerHandle,
9153 /*IN*/ ULONG MessageFlags,
9154 /*IN*/ LPGUID MessageGuid,
9155 /*IN*/ USHORT MessageNumber,
9156 /*IN*/ va_list MessageArgList);
9157 #endif
9160 /** Kernel debugger routines **/
9162 NTOSAPI
9163 VOID
9164 DDKAPI
9165 KdDisableDebugger(
9166 VOID);
9168 NTOSAPI
9169 VOID
9170 DDKAPI
9171 KdEnableDebugger(
9172 VOID);
9174 NTOSAPI
9175 VOID
9176 DDKAPI
9177 DbgBreakPoint(
9178 VOID);
9180 NTOSAPI
9181 VOID
9182 DDKAPI
9183 DbgBreakPointWithStatus(
9184 /*IN*/ ULONG Status);
9186 NTOSAPI
9187 ULONG
9188 DDKCDECLAPI
9189 DbgPrint(
9190 /*IN*/ PCH Format,
9191 /*IN*/ ...);
9193 NTOSAPI
9194 ULONG
9195 DDKCDECLAPI
9196 DbgPrintEx(
9197 /*IN*/ ULONG ComponentId,
9198 /*IN*/ ULONG Level,
9199 /*IN*/ PCH Format,
9200 /*IN*/ ...);
9202 NTOSAPI
9203 ULONG
9204 DDKCDECLAPI
9205 DbgPrintReturnControlC(
9206 /*IN*/ PCH Format,
9207 /*IN*/ ...);
9209 NTOSAPI
9210 NTSTATUS
9211 DDKAPI
9212 DbgQueryDebugFilterState(
9213 /*IN*/ ULONG ComponentId,
9214 /*IN*/ ULONG Level);
9216 NTOSAPI
9217 NTSTATUS
9218 DDKAPI
9219 DbgSetDebugFilterState(
9220 /*IN*/ ULONG ComponentId,
9221 /*IN*/ ULONG Level,
9222 /*IN*/ BOOLEAN State);
9224 #ifdef DBG
9226 #define KdPrint(_x_) DbgPrint _x_
9227 #define KdPrintEx(_x_) DbgPrintEx _x_
9228 #define KdBreakPoint() DbgBreakPoint()
9229 #define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
9231 #else /* !DBG */
9233 #define KdPrint(_x_)
9234 #define KdPrintEx(_x_)
9235 #define KdBreakPoint()
9236 #define KdBreakPointWithStatus(s)
9238 #endif /* !DBG */
9240 extern NTOSAPI PBOOLEAN KdDebuggerNotPresent;
9241 extern NTOSAPI PBOOLEAN KdDebuggerEnabled;
9242 #define KD_DEBUGGER_ENABLED *KdDebuggerEnabled
9243 #define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
9245 #ifdef __cplusplus
9247 #endif
9249 #endif /* __WINDDK_H */