4 * Windows Device Driver Kit
6 * This file is part of the w32api package.
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.
27 #pragma GCC system_header
35 ** Definitions specific to this Device Driver Kit
37 #define DDKAPI __stdcall
38 #define DDKFASTAPI __fastcall
39 #define DDKCDECLAPI __cdecl
41 #if defined(_NTOSKRNL_)
43 #define NTOSAPI DECL_EXPORT
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;
49 #define NTOSAPI DECL_IMPORT
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;
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
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
76 # define _DDK_DUMMYUNION_MEMBER(name) name
77 # define _DDK_DUMMYUNION_N_MEMBER(n, name) name
81 ** Forward declarations
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
)
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
;
116 ** Routines specific to this DDK
119 #define TAG(_a, _b, _c, _d) (ULONG) \
120 (((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24))
123 static __inline
struct _KPCR
* KeGetCurrentKPCR(
128 __asm__
__volatile__ (
130 /* support -masm=intel */
131 "mov{l} {%%fs:0x18, %0|%0, %%fs:0x18}\n\t"
133 "movl %%fs:0x18, %0\n\t"
138 return (struct _KPCR
*) Value
;
141 #elif defined( __WATCOMC__ )
143 extern struct _KPCR
* KeGetCurrentKPCR( void );
144 #pragma aux KeGetCurrentKPCR = \
145 "mov eax, fs:[0x18]" \
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
;
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
;
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 | \
288 #define FILE_GENERIC_EXECUTE \
289 (STANDARD_RIGHTS_EXECUTE | \
290 FILE_READ_ATTRIBUTES | \
294 #define FILE_GENERIC_READ \
295 (STANDARD_RIGHTS_READ | \
297 FILE_READ_ATTRIBUTES | \
301 #define FILE_GENERIC_WRITE \
302 (STANDARD_RIGHTS_WRITE | \
304 FILE_WRITE_ATTRIBUTES | \
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
{
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
);
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
);
465 (DDKAPI
*PDRIVER_ADD_DEVICE
)(
466 /*IN*/ struct _DRIVER_OBJECT
*DriverObject
,
467 /*IN*/ struct _DEVICE_OBJECT
*PhysicalDeviceObject
);
470 (DDKAPI
*PIO_COMPLETION_ROUTINE
)(
471 /*IN*/ struct _DEVICE_OBJECT
*DeviceObject
,
472 /*IN*/ struct _IRP
*Irp
,
473 /*IN*/ PVOID Context
);
476 (DDKAPI
*PDRIVER_CANCEL
)(
477 /*IN*/ struct _DEVICE_OBJECT
*DeviceObject
,
478 /*IN*/ struct _IRP
*Irp
);
481 (DDKAPI
*PKDEFERRED_ROUTINE
)(
482 /*IN*/ struct _KDPC
*Dpc
,
483 /*IN*/ PVOID DeferredContext
,
484 /*IN*/ PVOID SystemArgument1
,
485 /*IN*/ PVOID SystemArgument2
);
488 (DDKAPI
*PDRIVER_DISPATCH
)(
489 /*IN*/ struct _DEVICE_OBJECT
*DeviceObject
,
490 /*IN*/ struct _IRP
*Irp
);
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
);
500 (DDKAPI
*PMM_DLL_INITIALIZE
)(
501 /*IN*/ PUNICODE_STRING RegistryPath
);
504 (DDKAPI
*PMM_DLL_UNLOAD
)(
508 (DDKAPI
*PDRIVER_ENTRY
)(
509 /*IN*/ struct _DRIVER_OBJECT
*DriverObject
,
510 /*IN*/ PUNICODE_STRING RegistryPath
);
513 (DDKAPI
*PDRIVER_INITIALIZE
)(
514 /*IN*/ struct _DRIVER_OBJECT
*DriverObject
,
515 /*IN*/ PUNICODE_STRING RegistryPath
);
518 (DDKAPI
*PKSERVICE_ROUTINE
)(
519 /*IN*/ struct _KINTERRUPT
*Interrupt
,
520 /*IN*/ PVOID ServiceContext
);
523 (DDKAPI
*PIO_TIMER_ROUTINE
)(
524 /*IN*/ struct _DEVICE_OBJECT
*DeviceObject
,
525 /*IN*/ PVOID Context
);
528 (DDKAPI
*PDRIVER_REINITIALIZE
)(
529 /*IN*/ struct _DRIVER_OBJECT
*DriverObject
,
530 /*IN*/ PVOID Context
,
534 (DDKAPI
*PDRIVER_STARTIO
)(
535 /*IN*/ struct _DEVICE_OBJECT
*DeviceObject
,
536 /*IN*/ struct _IRP
*Irp
);
539 (DDKAPI
*PKSYNCHRONIZE_ROUTINE
)(
540 /*IN*/ PVOID SynchronizeContext
);
543 (DDKAPI
*PDRIVER_UNLOAD
)(
544 /*IN*/ struct _DRIVER_OBJECT
*DriverObject
);
549 ** Plug and Play structures
553 (*PINTERFACE_REFERENCE
)(
557 (*PINTERFACE_DEREFERENCE
)(
560 typedef BOOLEAN DDKAPI
561 (*PTRANSLATE_BUS_ADDRESS
)(
562 /*IN*/ PVOID Context
,
563 /*IN*/ PHYSICAL_ADDRESS BusAddress
,
565 /*IN OUT*/ PULONG AddressSpace
,
566 /*OUT*/ PPHYSICAL_ADDRESS TranslatedAddress
);
568 typedef struct _DMA_ADAPTER
* DDKAPI
570 /*IN*/ PVOID Context
,
571 /*IN*/ struct _DEVICE_DESCRIPTION
*DeviceDescriptor
,
572 /*OUT*/ PULONG NumberOfMapRegisters
);
575 (*PGET_SET_DEVICE_DATA
)(
576 /*IN*/ PVOID Context
,
577 /*IN*/ ULONG DataType
,
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
{
590 } POWER_STATE_TYPE
, *PPOWER_STATE_TYPE
;
592 typedef struct _BUS_INTERFACE_STANDARD
{
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
{
609 ULONG LockSupported
: 1;
610 ULONG EjectSupported
: 1;
612 ULONG DockDevice
: 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;
628 DEVICE_POWER_STATE DeviceState
[PowerSystemMaximum
];
629 SYSTEM_POWER_STATE SystemWake
;
630 DEVICE_POWER_STATE DeviceWake
;
634 } DEVICE_CAPABILITIES
, *PDEVICE_CAPABILITIES
;
636 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
{
640 GUID InterfaceClassGuid
;
641 PUNICODE_STRING SymbolicLinkName
;
642 } DEVICE_INTERFACE_CHANGE_NOTIFICATION
, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION
;
644 typedef struct _HWPROFILE_CHANGE_NOTIFICATION
{
648 } HWPROFILE_CHANGE_NOTIFICATION
, *PHWPROFILE_CHANGE_NOTIFICATION
;
652 typedef struct _INTERFACE
{
656 PINTERFACE_REFERENCE InterfaceReference
;
657 PINTERFACE_DEREFERENCE InterfaceDereference
;
658 } INTERFACE
, *PINTERFACE
;
660 typedef struct _PLUGPLAY_NOTIFICATION_HEADER
{
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
{
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
{
690 struct _FILE_OBJECT
*FileObject
;
691 } TARGET_DEVICE_REMOVAL_NOTIFICATION
, *PTARGET_DEVICE_REMOVAL_NOTIFICATION
;
693 typedef enum _BUS_QUERY_ID_TYPE
{
696 BusQueryCompatibleIDs
,
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
{
717 } POWER_SEQUENCE
, *PPOWER_SEQUENCE
;
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
);
757 (*PDEVICE_CHANGE_COMPLETE_CALLBACK
)(
758 /*IN*/ PVOID Context
);
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
775 typedef struct _OBJECT_NAME_INFORMATION
{
777 } OBJECT_NAME_INFORMATION
, *POBJECT_NAME_INFORMATION
;
781 /*IN*/ PVOID ApcContext
,
782 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock
,
783 /*IN*/ ULONG Reserved
);
785 typedef struct _IO_STATUS_BLOCK
{
786 _ANONYMOUS_UNION
union {
790 ULONG_PTR Information
;
795 /*IN*/ PVOID NormalContext
,
796 /*IN*/ PVOID SystemArgument1
,
797 /*IN*/ PVOID SystemArgument2
);
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
);
808 (*PKRUNDOWN_ROUTINE
)(
809 /*IN*/ struct _KAPC
*Apc
);
811 typedef BOOLEAN DDKAPI
812 (*PKTRANSFER_ROUTINE
)(
815 typedef struct _KAPC
{
819 struct _KTHREAD
*Thread
;
820 LIST_ENTRY ApcListEntry
;
821 PKKERNEL_ROUTINE KernelRoutine
;
822 PKRUNDOWN_ROUTINE RundownRoutine
;
823 PKNORMAL_ROUTINE NormalRoutine
;
825 PVOID SystemArgument1
;
826 PVOID SystemArgument2
;
828 KPROCESSOR_MODE ApcMode
;
830 } KAPC
, *PKAPC
, *RESTRICTED_POINTER PRKAPC
;
832 typedef struct _KDEVICE_QUEUE
{
835 LIST_ENTRY DeviceListHead
;
838 } KDEVICE_QUEUE
, *PKDEVICE_QUEUE
, *RESTRICTED_POINTER PRKDEVICE_QUEUE
;
840 typedef struct _KDEVICE_QUEUE_ENTRY
{
841 LIST_ENTRY DeviceListEntry
;
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
,
854 LockQueueSystemSpaceLock
,
857 LockQueueNonPagedPoolLock
,
858 LockQueueIoCancelLock
,
859 LockQueueWorkQueueLock
,
861 LockQueueIoDatabaseLock
,
862 LockQueueIoCompletionLock
,
863 LockQueueNtfsStructLock
,
864 LockQueueAfdWorkQueueLock
,
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
;
877 } KLOCK_QUEUE_HANDLE
, *PKLOCK_QUEUE_HANDLE
;
879 typedef struct _KDPC
{
883 LIST_ENTRY DpcListEntry
;
884 PKDEFERRED_ROUTINE DeferredRoutine
;
885 PVOID DeferredContext
;
886 PVOID SystemArgument1
;
887 PVOID SystemArgument2
;
889 } KDPC
, *PKDPC
, *RESTRICTED_POINTER PRKDPC
;
891 typedef struct _WAIT_CONTEXT_BLOCK
{
892 KDEVICE_QUEUE_ENTRY WaitQueueEntry
;
893 struct _DRIVER_CONTROL
*DeviceRoutine
;
895 ULONG NumberOfMapRegisters
;
898 PKDPC BufferChainingDpc
;
899 } WAIT_CONTEXT_BLOCK
, *PWAIT_CONTEXT_BLOCK
;
901 typedef struct _DISPATCHER_HEADER
{
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
;
917 } KSEMAPHORE
, *PKSEMAPHORE
, *RESTRICTED_POINTER PRKSEMAPHORE
;
919 typedef struct _FAST_MUTEX
{
921 struct _KTHREAD
*Owner
;
925 } FAST_MUTEX
, *PFAST_MUTEX
;
927 typedef struct _KTIMER
{
928 DISPATCHER_HEADER Header
;
929 ULARGE_INTEGER DueTime
;
930 LIST_ENTRY TimerListEntry
;
933 } KTIMER
, *PKTIMER
, *RESTRICTED_POINTER PRKTIMER
;
935 typedef struct _KMUTANT
{
936 DISPATCHER_HEADER Header
;
937 LIST_ENTRY MutantListEntry
;
938 struct _KTHREAD
*RESTRICTED_POINTER OwnerThread
;
941 } KMUTANT
, *PKMUTANT
, *RESTRICTED_POINTER PRKMUTANT
, KMUTEX
, *PKMUTEX
, *RESTRICTED_POINTER PRKMUTEX
;
943 typedef enum _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
{
966 struct _MDL
*MdlAddress
;
969 struct _IRP
*MasterIrp
;
973 LIST_ENTRY ThreadListEntry
;
974 IO_STATUS_BLOCK IoStatus
;
975 KPROCESSOR_MODE RequestorMode
;
976 BOOLEAN PendingReturned
;
978 CHAR CurrentLocation
;
981 CCHAR ApcEnvironment
;
982 UCHAR AllocationFlags
;
983 PIO_STATUS_BLOCK UserIosb
;
987 PIO_APC_ROUTINE UserApcRoutine
;
988 PVOID UserApcContext
;
989 } AsynchronousParameters
;
990 LARGE_INTEGER AllocationSize
;
992 PDRIVER_CANCEL CancelRoutine
;
996 _ANONYMOUS_UNION
union {
997 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
998 _ANONYMOUS_STRUCT
struct {
999 PVOID DriverContext
[4];
1003 PCHAR AuxiliaryBuffer
;
1004 _ANONYMOUS_STRUCT
struct {
1005 LIST_ENTRY ListEntry
;
1006 _ANONYMOUS_UNION
union {
1007 struct _IO_STACK_LOCATION
*CurrentStackLocation
;
1011 struct _FILE_OBJECT
*OriginalFileObject
;
1014 PVOID CompletionKey
;
1017 typedef struct _IRP
*PIRP
;
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)
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
{
1071 } DRIVE_LAYOUT_INFORMATION_MBR
, *PDRIVE_LAYOUT_INFORMATION_MBR
;
1073 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT
{
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;
1109 UCHAR Reserved0
: 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
;
1120 USHORT AddressLowWord
;
1121 UCHAR AddressHighByte
;
1123 } EISA_MEMORY_CONFIGURATION
, *PEISA_MEMORY_CONFIGURATION
;
1124 #include <poppack.h>
1126 typedef struct _EISA_IRQ_DESCRIPTOR
{
1127 UCHAR Interrupt
: 4;
1129 UCHAR LevelTriggered
: 1;
1131 UCHAR MoreEntries
: 1;
1132 } EISA_IRQ_DESCRIPTOR
, *PEISA_IRQ_DESCRIPTOR
;
1134 typedef struct _EISA_IRQ_CONFIGURATION
{
1135 EISA_IRQ_DESCRIPTOR ConfigurationByte
;
1137 } EISA_IRQ_CONFIGURATION
, *PEISA_IRQ_CONFIGURATION
;
1139 typedef struct _DMA_CONFIGURATION_BYTE0
{
1143 UCHAR MoreEntries
: 1;
1144 } DMA_CONFIGURATION_BYTE0
;
1146 typedef struct _DMA_CONFIGURATION_BYTE1
{
1147 UCHAR Reserved0
: 2;
1148 UCHAR TransferSize
: 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;
1163 UCHAR MoreEntries
: 1;
1164 } EISA_PORT_DESCRIPTOR
, *PEISA_PORT_DESCRIPTOR
;
1166 typedef struct _EISA_PORT_CONFIGURATION
{
1167 EISA_PORT_DESCRIPTOR Configuration
;
1169 } EISA_PORT_CONFIGURATION
, *PEISA_PORT_CONFIGURATION
;
1170 #include <poppack.h>
1172 typedef struct _CM_EISA_FUNCTION_INFORMATION
{
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
{
1205 UCHAR MajorRevision
;
1206 UCHAR MinorRevision
;
1208 UCHAR NumberFunctions
;
1209 UCHAR FunctionInformation
;
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
{
1227 UCHAR StepRateHeadUnloadTime
;
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,
1260 MaximumInterfaceType
1261 } INTERFACE_TYPE
, *PINTERFACE_TYPE
;
1263 typedef struct _PNP_BUS_INFORMATION
{
1265 INTERFACE_TYPE LegacyBusType
;
1267 } PNP_BUS_INFORMATION
, *PPNP_BUS_INFORMATION
;
1269 #include <pshpack1.h>
1270 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
1272 UCHAR ShareDisposition
;
1276 PHYSICAL_ADDRESS Start
;
1280 PHYSICAL_ADDRESS Start
;
1289 PHYSICAL_ADDRESS Start
;
1309 } DeviceSpecificData
;
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
{
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
;
1385 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
1386 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
1388 typedef struct _CM_RESOURCE_LIST
{
1390 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
1391 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
1393 typedef struct _CM_INT13_DRIVE_PARAMETER
{
1396 USHORT SectorsPerTrack
;
1398 USHORT NumberDrives
;
1399 } CM_INT13_DRIVE_PARAMETER
, *PCM_INT13_DRIVE_PARAMETER
;
1400 #include <poppack.h>
1402 typedef struct _CM_KEYBOARD_DEVICE_DATA
{
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
{
1425 } CM_MCA_POS_DATA
, *PCM_MCA_POS_DATA
;
1427 typedef struct CM_Power_Data_s
{
1429 DEVICE_POWER_STATE PD_MostRecentPowerState
;
1430 ULONG PD_Capabilities
;
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
{
1450 UCHAR HostIdentifier
;
1451 } CM_SCSI_DEVICE_DATA
, *PCM_SCSI_DEVICE_DATA
;
1453 typedef struct _CM_SERIAL_DEVICE_DATA
{
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
{
1468 UCHAR ShareDisposition
;
1476 PHYSICAL_ADDRESS MinimumAddress
;
1477 PHYSICAL_ADDRESS MaximumAddress
;
1482 PHYSICAL_ADDRESS MinimumAddress
;
1483 PHYSICAL_ADDRESS MaximumAddress
;
1486 ULONG MinimumVector
;
1487 ULONG MaximumVector
;
1490 ULONG MinimumChannel
;
1491 ULONG MaximumChannel
;
1496 PHYSICAL_ADDRESS MinimumAddress
;
1497 PHYSICAL_ADDRESS MaximumAddress
;
1514 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
1516 typedef struct _IO_RESOURCE_LIST
{
1520 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
1521 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
1523 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
1525 INTERFACE_TYPE InterfaceType
;
1529 ULONG AlternativeLists
;
1530 IO_RESOURCE_LIST List
[1];
1531 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
1533 typedef struct _CONTROLLER_OBJECT
{
1536 PVOID ControllerExtension
;
1537 KDEVICE_QUEUE DeviceWaitQueue
;
1539 LARGE_INTEGER Spare2
;
1540 } CONTROLLER_OBJECT
, *PCONTROLLER_OBJECT
;
1542 typedef enum _DMA_WIDTH
{
1547 } DMA_WIDTH
, *PDMA_WIDTH
;
1549 typedef enum _DMA_SPEED
{
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
{
1567 BOOLEAN ScatterGather
;
1569 BOOLEAN AutoInitialize
;
1570 BOOLEAN Dma32BitAddresses
;
1571 BOOLEAN IgnoreCount
;
1573 BOOLEAN Dma64BitAddresses
;
1576 INTERFACE_TYPE InterfaceType
;
1579 ULONG MaximumLength
;
1581 } DEVICE_DESCRIPTION
, *PDEVICE_DESCRIPTION
;
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
{
1596 USHORT VolumeLabelLength
;
1597 struct _DEVICE_OBJECT
*DeviceObject
;
1598 struct _DEVICE_OBJECT
*RealDevice
;
1600 ULONG ReferenceCount
;
1601 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
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
{
1713 LONG ReferenceCount
;
1714 struct _DRIVER_OBJECT
*DriverObject
;
1715 struct _DEVICE_OBJECT
*NextDevice
;
1716 struct _DEVICE_OBJECT
*AttachedDevice
;
1717 struct _IRP
*CurrentIrp
;
1720 ULONG Characteristics
;
1722 PVOID DeviceExtension
;
1723 DEVICE_TYPE DeviceType
;
1726 LIST_ENTRY ListEntry
;
1727 WAIT_CONTEXT_BLOCK Wcb
;
1729 ULONG AlignmentRequirement
;
1730 KDEVICE_QUEUE DeviceQueue
;
1732 ULONG ActiveThreadCount
;
1733 PSECURITY_DESCRIPTOR SecurityDescriptor
;
1737 struct _DEVOBJ_EXTENSION
*DeviceObjectExtension
;
1740 typedef struct _DEVICE_OBJECT
*PDEVICE_OBJECT
;
1742 typedef enum _DEVICE_RELATION_TYPE
{
1747 TargetDeviceRelation
,
1749 } DEVICE_RELATION_TYPE
, *PDEVICE_RELATION_TYPE
;
1751 typedef struct _DEVICE_RELATIONS
{
1753 PDEVICE_OBJECT Objects
[1];
1754 } DEVICE_RELATIONS
, *PDEVICE_RELATIONS
;
1756 typedef struct _SCATTER_GATHER_ELEMENT
{
1757 PHYSICAL_ADDRESS Address
;
1760 } SCATTER_GATHER_ELEMENT
, *PSCATTER_GATHER_ELEMENT
;
1762 typedef struct _SCATTER_GATHER_LIST
{
1763 ULONG NumberOfElements
;
1765 SCATTER_GATHER_ELEMENT Elements
[0];
1766 } SCATTER_GATHER_LIST
, *PSCATTER_GATHER_LIST
;
1768 typedef struct _MDL
{
1772 struct _EPROCESS
*Process
;
1773 PVOID MappedSystemVa
;
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 | \
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
);
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
,
1834 /*IN*/ PVOID MapRegisterBase
,
1835 /*IN*/ PVOID CurrentVa
,
1836 /*IN*/ ULONG Length
,
1837 /*IN*/ BOOLEAN WriteToDevice
);
1840 (*PFREE_ADAPTER_CHANNEL
)(
1841 /*IN*/ PDMA_ADAPTER DmaAdapter
);
1844 (*PFREE_MAP_REGISTERS
)(
1845 /*IN*/ PDMA_ADAPTER DmaAdapter
,
1846 PVOID MapRegisterBase
,
1847 ULONG NumberOfMapRegisters
);
1849 typedef PHYSICAL_ADDRESS DDKAPI
1851 /*IN*/ PDMA_ADAPTER DmaAdapter
,
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
,
1871 /*IN*/ PVOID CurrentVa
,
1872 /*IN*/ ULONG Length
,
1873 /*IN*/ PDRIVER_LIST_CONTROL ExecutionRoutine
,
1874 /*IN*/ PVOID Context
,
1875 /*IN*/ BOOLEAN WriteToDevice
);
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
,
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
{
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
{
1934 PDMA_OPERATIONS DmaOperations
;
1937 typedef enum _FILE_INFORMATION_CLASS
{
1938 FileDirectoryInformation
= 1,
1939 FileFullDirectoryInformation
,
1940 FileBothDirectoryInformation
,
1941 FileBasicInformation
,
1942 FileStandardInformation
,
1943 FileInternalInformation
,
1945 FileAccessInformation
,
1946 FileNameInformation
,
1947 FileRenameInformation
,
1948 FileLinkInformation
,
1949 FileNamesInformation
,
1950 FileDispositionInformation
,
1951 FilePositionInformation
,
1952 FileFullEaInformation
,
1953 FileModeInformation
,
1954 FileAlignmentInformation
,
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
;
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
;
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
;
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
;
2059 USHORT EaValueLength
;
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 {
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
;
2087 PKSEMAPHORE SharedWaiters
;
2088 PKEVENT ExclusiveWaiters
;
2089 OWNER_ENTRY OwnerThreads
[2];
2090 ULONG ContentionCount
;
2091 USHORT NumberOfSharedWaiters
;
2092 USHORT NumberOfExclusiveWaiters
;
2093 _ANONYMOUS_UNION
union {
2095 ULONG_PTR CreatorBackTraceIndex
;
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
;
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
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
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
2159 /*IN*/ struct _FILE_OBJECT
*FileObject
,
2160 /*IN*/ PLARGE_INTEGER FileOffset
,
2161 /*IN*/ PLARGE_INTEGER Length
,
2162 PEPROCESS ProcessId
,
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
,
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
,
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
);
2207 (*PFAST_IO_ACQUIRE_FILE
)(
2208 /*IN*/ struct _FILE_OBJECT
*FileObject
);
2211 (*PFAST_IO_RELEASE_FILE
)(
2212 /*IN*/ struct _FILE_OBJECT
*FileObject
);
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
{
2362 PDEVICE_OBJECT DeviceObject
;
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];
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
{
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
{
2420 PDEVICE_OBJECT DeviceObject
;
2424 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
2425 PVOID PrivateCacheMap
;
2426 NTSTATUS FinalStatus
;
2427 struct _FILE_OBJECT
*RelatedFileObject
;
2428 BOOLEAN LockOperation
;
2429 BOOLEAN DeletePending
;
2431 BOOLEAN WriteAccess
;
2432 BOOLEAN DeleteAccess
;
2434 BOOLEAN SharedWrite
;
2435 BOOLEAN SharedDelete
;
2437 UNICODE_STRING FileName
;
2438 LARGE_INTEGER CurrentByteOffset
;
2444 PIO_COMPLETION_CONTEXT CompletionContext
;
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
;
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
{
2473 BOOLEAN SecurityEvaluated
;
2474 BOOLEAN GenerateAudit
;
2475 BOOLEAN GenerateOnClose
;
2476 BOOLEAN PrivilegesAllocated
;
2478 ACCESS_MASK RemainingDesiredAccess
;
2479 ACCESS_MASK PreviouslyGrantedAccess
;
2480 ACCESS_MASK OriginalDesiredAccess
;
2481 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext
;
2482 PSECURITY_DESCRIPTOR SecurityDescriptor
;
2485 INITIAL_PRIVILEGE_SET InitialPrivilegeSet
;
2486 PRIVILEGE_SET PrivilegeSet
;
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
;
2504 typedef struct _IO_CSQ_IRP_CONTEXT
{
2507 struct _IO_CSQ
*Csq
;
2508 } IO_CSQ_IRP_CONTEXT
, *PIO_CSQ_IRP_CONTEXT
;
2511 (*PIO_CSQ_INSERT_IRP
)(
2512 /*IN*/ struct _IO_CSQ
*Csq
,
2516 (*PIO_CSQ_REMOVE_IRP
)(
2517 /*IN*/ struct _IO_CSQ
*Csq
,
2521 (*PIO_CSQ_PEEK_NEXT_IRP
)(
2522 /*IN*/ struct _IO_CSQ
*Csq
,
2524 /*IN*/ PVOID PeekContext
);
2527 (*PIO_CSQ_ACQUIRE_LOCK
)(
2528 /*IN*/ struct _IO_CSQ
*Csq
,
2529 /*OUT*/ PKIRQL Irql
);
2532 (*PIO_CSQ_RELEASE_LOCK
)(
2533 /*IN*/ struct _IO_CSQ
*Csq
,
2537 (*PIO_CSQ_COMPLETE_CANCELED_IRP
)(
2538 /*IN*/ struct _IO_CSQ
*Csq
,
2541 typedef struct _IO_CSQ
{
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
;
2552 #include <pshpack4.h>
2553 typedef struct _IO_STACK_LOCATION
{
2554 UCHAR MajorFunction
;
2555 UCHAR MinorFunction
;
2560 PIO_SECURITY_CONTEXT SecurityContext
;
2562 USHORT POINTER_ALIGNMENT FileAttributes
;
2564 ULONG POINTER_ALIGNMENT EaLength
;
2568 ULONG POINTER_ALIGNMENT Key
;
2569 LARGE_INTEGER ByteOffset
;
2573 ULONG POINTER_ALIGNMENT Key
;
2574 LARGE_INTEGER ByteOffset
;
2578 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
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
;
2590 HANDLE DeleteHandle
;
2595 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
2598 ULONG OutputBufferLength
;
2599 ULONG POINTER_ALIGNMENT InputBufferLength
;
2600 ULONG POINTER_ALIGNMENT IoControlCode
;
2601 PVOID Type3InputBuffer
;
2604 SECURITY_INFORMATION SecurityInformation
;
2605 ULONG POINTER_ALIGNMENT Length
;
2608 SECURITY_INFORMATION SecurityInformation
;
2609 PSECURITY_DESCRIPTOR SecurityDescriptor
;
2613 PDEVICE_OBJECT DeviceObject
;
2617 PDEVICE_OBJECT DeviceObject
;
2620 struct _SCSI_REQUEST_BLOCK
*Srb
;
2623 DEVICE_RELATION_TYPE Type
;
2624 } QueryDeviceRelations
;
2626 CONST GUID
*InterfaceType
;
2629 PINTERFACE Interface
;
2630 PVOID InterfaceSpecificData
;
2633 PDEVICE_CAPABILITIES Capabilities
;
2634 } DeviceCapabilities
;
2636 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
2637 } FilterResourceRequirements
;
2642 ULONG POINTER_ALIGNMENT Length
;
2648 BUS_QUERY_ID_TYPE IdType
;
2651 DEVICE_TEXT_TYPE DeviceTextType
;
2652 LCID POINTER_ALIGNMENT LocaleId
;
2656 BOOLEAN Reserved
[3];
2657 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
2658 } UsageNotification
;
2660 SYSTEM_POWER_STATE PowerState
;
2663 PPOWER_SEQUENCE PowerSequence
;
2666 ULONG SystemContext
;
2667 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
2668 POWER_STATE POINTER_ALIGNMENT State
;
2669 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
2672 PCM_RESOURCE_LIST AllocatedResources
;
2673 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
2676 ULONG_PTR ProviderId
;
2688 PDEVICE_OBJECT DeviceObject
;
2689 PFILE_OBJECT FileObject
;
2690 PIO_COMPLETION_ROUTINE CompletionRoutine
;
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
,
2707 KeyCachedInformation
,
2709 } KEY_INFORMATION_CLASS
;
2711 typedef struct _KEY_BASIC_INFORMATION
{
2712 LARGE_INTEGER LastWriteTime
;
2716 } KEY_BASIC_INFORMATION
, *PKEY_BASIC_INFORMATION
;
2718 typedef struct _KEY_FULL_INFORMATION
{
2719 LARGE_INTEGER LastWriteTime
;
2727 ULONG MaxValueNameLen
;
2728 ULONG MaxValueDataLen
;
2730 } KEY_FULL_INFORMATION
, *PKEY_FULL_INFORMATION
;
2732 typedef struct _KEY_NODE_INFORMATION
{
2733 LARGE_INTEGER LastWriteTime
;
2739 } KEY_NODE_INFORMATION
, *PKEY_NODE_INFORMATION
;
2741 typedef struct _KEY_VALUE_BASIC_INFORMATION
{
2746 } KEY_VALUE_BASIC_INFORMATION
, *PKEY_VALUE_BASIC_INFORMATION
;
2748 typedef struct _KEY_VALUE_FULL_INFORMATION
{
2755 } KEY_VALUE_FULL_INFORMATION
, *PKEY_VALUE_FULL_INFORMATION
;
2757 typedef struct _KEY_VALUE_PARTIAL_INFORMATION
{
2762 } KEY_VALUE_PARTIAL_INFORMATION
, *PKEY_VALUE_PARTIAL_INFORMATION
;
2764 typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
{
2768 } KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64
;
2770 typedef struct _KEY_VALUE_ENTRY
{
2771 PUNICODE_STRING ValueName
;
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 */
2789 #define REG_EXPAND_SZ 2
2790 #define REG_BINARY 3
2792 #define REG_DWORD_LITTLE_ENDIAN 4
2793 #define REG_DWORD_BIG_ENDIAN 5
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
{
2815 UCHAR CacheLineSize
;
2820 struct _PCI_HEADER_TYPE_0
{
2821 ULONG BaseAddresses
[PCI_TYPE0_ADDRESSES
];
2825 ULONG ROMBaseAddress
;
2826 UCHAR CapabilitiesPtr
;
2829 UCHAR InterruptLine
;
2832 UCHAR MaximumLatency
;
2834 struct _PCI_HEADER_TYPE_1
{
2835 ULONG BaseAddresses
[PCI_TYPE1_ADDRESSES
];
2838 UCHAR SubordinateBus
;
2839 UCHAR SecondaryLatency
;
2842 USHORT SecondaryStatus
;
2845 USHORT PrefetchBase
;
2846 USHORT PrefetchLimit
;
2847 ULONG PrefetchBaseUpper32
;
2848 ULONG PrefetchLimitUpper32
;
2849 USHORT IOBaseUpper16
;
2850 USHORT IOLimitUpper16
;
2851 UCHAR CapabilitiesPtr
;
2853 ULONG ROMBaseAddress
;
2854 UCHAR InterruptLine
;
2856 USHORT BridgeControl
;
2858 struct _PCI_HEADER_TYPE_2
{
2859 ULONG SocketRegistersBaseAddress
;
2860 UCHAR CapabilitiesPtr
;
2862 USHORT SecondaryStatus
;
2865 UCHAR SubordinateBus
;
2866 UCHAR SecondaryLatency
;
2870 } Range
[PCI_TYPE2_ADDRESSES
- 1];
2871 UCHAR InterruptLine
;
2873 USHORT BridgeControl
;
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
{
2922 ULONG DeviceNumber
: 5;
2923 ULONG FunctionNumber
: 3;
2924 ULONG Reserved
: 24;
2928 } PCI_SLOT_NUMBER
, *PPCI_SLOT_NUMBER
;
2930 typedef enum _POOL_TYPE
{
2933 NonPagedPoolMustSucceed
,
2935 NonPagedPoolCacheAligned
,
2936 PagedPoolCacheAligned
,
2937 NonPagedPoolCacheAlignedMustS
,
2939 NonPagedPoolSession
= 32,
2941 NonPagedPoolMustSucceedSession
,
2942 DontUseThisTypeSession
,
2943 NonPagedPoolCacheAlignedSession
,
2944 PagedPoolCacheAlignedSession
,
2945 NonPagedPoolCacheAlignedMustSSession
2948 typedef enum _EX_POOL_PRIORITY
{
2950 LowPoolPrioritySpecialPoolOverrun
= 8,
2951 LowPoolPrioritySpecialPoolUnderrun
= 9,
2952 NormalPoolPriority
= 16,
2953 NormalPoolPrioritySpecialPoolOverrun
= 24,
2954 NormalPoolPrioritySpecialPoolUnderrun
= 25,
2955 HighPoolPriority
= 32,
2956 HighPoolPrioritySpecialPoolOverrun
= 40,
2957 HighPoolPrioritySpecialPoolUnderrun
= 41
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
;
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
;
2979 WCHAR szCSDVersion
[128];
2980 USHORT wServicePackMajor
;
2981 USHORT wServicePackMinor
;
2985 } RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
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 */
3013 #define VER_GREATER 2
3014 #define VER_GREATER_EQUAL 3
3016 #define VER_LESS_EQUAL 5
3020 #define VER_CONDITION_MASK 7
3021 #define VER_NUM_BITS_PER_CONDITION_MASK 3
3023 typedef struct _RTL_BITMAP
{
3026 } RTL_BITMAP
, *PRTL_BITMAP
;
3028 typedef struct _RTL_BITMAP_RUN
{
3029 ULONG StartingIndex
;
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
;
3065 ULONG DefaultLength
;
3066 } RTL_QUERY_REGISTRY_TABLE
, *PRTL_QUERY_REGISTRY_TABLE
;
3068 typedef struct _TIME_FIELDS
{
3075 CSHORT Milliseconds
;
3077 } TIME_FIELDS
, *PTIME_FIELDS
;
3079 typedef PVOID DDKAPI
3080 (*PALLOCATE_FUNCTION
)(
3081 /*IN*/ POOL_TYPE PoolType
,
3082 /*IN*/ SIZE_T NumberOfBytes
,
3087 /*IN*/ PVOID Buffer
);
3089 #define GENERAL_LOOKASIDE_S \
3090 SLIST_HEADER ListHead; \
3092 USHORT MaximumDepth; \
3093 ULONG TotalAllocates; \
3094 _ANONYMOUS_UNION union { \
3095 ULONG AllocateMisses; \
3096 ULONG AllocateHits; \
3099 _ANONYMOUS_UNION union { \
3102 } DUMMYUNIONNAME2; \
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; \
3116 typedef struct _GENERAL_LOOKASIDE
{
3118 } GENERAL_LOOKASIDE
, *PGENERAL_LOOKASIDE
;
3120 typedef struct _NPAGED_LOOKASIDE_LIST
{
3122 KSPIN_LOCK Obsoleted
;
3123 } NPAGED_LOOKASIDE_LIST
, *PNPAGED_LOOKASIDE_LIST
;
3125 typedef struct _PAGED_LOOKASIDE_LIST
{
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
{
3139 SynchronizationEvent
3142 typedef enum _KWAIT_REASON
{
3173 typedef struct _KWAIT_BLOCK
{
3174 LIST_ENTRY WaitListEntry
;
3175 struct _KTHREAD
* RESTRICTED_POINTER Thread
;
3177 struct _KWAIT_BLOCK
* RESTRICTED_POINTER NextWaitBlock
;
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
{
3186 BOOLEAN Reserved
[3];
3189 } IO_REMOVE_LOCK_COMMON_BLOCK
;
3191 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK
{
3194 LONGLONG MaxLockedTicks
;
3196 LIST_ENTRY LockList
;
3198 LONG LowMemoryCount
;
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
;
3207 IO_REMOVE_LOCK_DBG_BLOCK Dbg
;
3209 } IO_REMOVE_LOCK
, *PIO_REMOVE_LOCK
;
3211 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
3214 (*PIO_WORKITEM_ROUTINE
)(
3215 /*IN*/ PDEVICE_OBJECT DeviceObject
,
3216 /*IN*/ PVOID Context
);
3218 typedef struct _SHARE_ACCESS
{
3226 } SHARE_ACCESS
, *PSHARE_ACCESS
;
3228 typedef enum _KINTERRUPT_MODE
{
3234 (*PKINTERRUPT_ROUTINE
)(
3237 typedef enum _KPROFILE_SOURCE
{
3239 ProfileAlignmentFixup
,
3242 ProfileLoadInstructions
,
3243 ProfilePipelineFrozen
,
3244 ProfileBranchInstructions
,
3245 ProfileTotalNonissues
,
3246 ProfileDcacheMisses
,
3247 ProfileIcacheMisses
,
3249 ProfileBranchMispredictions
,
3250 ProfileStoreInstructions
,
3251 ProfileFpInstructions
,
3252 ProfileIntegerInstructions
,
3256 ProfileSpecialInstructions
,
3258 ProfileIcacheIssues
,
3259 ProfileDcacheAccesses
,
3260 ProfileMemoryBarrierCycles
,
3261 ProfileLoadLinkedIssues
,
3265 typedef enum _CREATE_FILE_TYPE
{
3267 CreateFileTypeNamedPipe
,
3268 CreateFileTypeMailslot
3271 typedef struct _CONFIGURATION_INFORMATION
{
3276 ULONG ScsiPortCount
;
3278 ULONG ParallelCount
;
3279 BOOLEAN AtDiskPrimaryAddressClaimed
;
3280 BOOLEAN AtDiskSecondaryAddressClaimed
;
3282 ULONG MediumChangerCount
;
3283 } CONFIGURATION_INFORMATION
, *PCONFIGURATION_INFORMATION
;
3285 typedef enum _CONFIGURATION_TYPE
{
3288 FloatingPointProcessor
,
3298 MultiFunctionAdapter
,
3312 FloppyDiskPeripheral
,
3325 RealModeIrqRoutingTable
,
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
{
3345 HyperCriticalWorkQueue
,
3350 (*PWORKER_THREAD_ROUTINE
)(
3351 /*IN*/ PVOID Parameter
);
3353 typedef struct _WORK_QUEUE_ITEM
{
3355 PWORKER_THREAD_ROUTINE WorkerRoutine
;
3357 } WORK_QUEUE_ITEM
, *PWORK_QUEUE_ITEM
;
3359 typedef enum _KBUGCHECK_BUFFER_DUMP_STATE
{
3365 } KBUGCHECK_BUFFER_DUMP_STATE
;
3368 (*PKBUGCHECK_CALLBACK_ROUTINE
)(
3369 /*IN*/ PVOID Buffer
,
3370 /*IN*/ ULONG Length
);
3372 typedef struct _KBUGCHECK_CALLBACK_RECORD
{
3374 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine
;
3380 } KBUGCHECK_CALLBACK_RECORD
, *PKBUGCHECK_CALLBACK_RECORD
;
3384 * KeInitializeCallbackRecord(
3385 * IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
3387 #define KeInitializeCallbackRecord(CallbackRecord) \
3388 CallbackRecord->State = BufferEmpty;
3390 typedef enum _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
,
3403 MmWriteCombined
= MmFrameBufferCached
,
3404 MmHardwareCoherentCached
,
3405 MmNonCachedUnordered
,
3408 } MEMORY_CACHING_TYPE
;
3410 typedef enum _MM_PAGE_PRIORITY
{
3412 NormalPagePriority
= 16,
3413 HighPagePriority
= 32
3416 typedef enum _LOCK_OPERATION
{
3422 typedef enum _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
;
3440 /*IN*/ PVOID StartContext
);
3443 (*PCREATE_PROCESS_NOTIFY_ROUTINE
)(
3444 /*IN*/ HANDLE ParentId
,
3445 /*IN*/ HANDLE ProcessId
,
3446 /*IN*/ BOOLEAN Create
);
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 {
3457 _ANONYMOUS_STRUCT
struct {
3458 ULONG ImageAddressingMode
: 8;
3459 ULONG SystemModeImage
: 1;
3460 ULONG ImageMappedToAllPids
: 1;
3461 ULONG Reserved
: 22;
3465 ULONG ImageSelector
;
3467 ULONG ImageSectionNumber
;
3468 } IMAGE_INFO
, *PIMAGE_INFO
;
3470 #define IMAGE_ADDRESSING_MODE_32BIT 3
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
,
3484 ProcessBasePriority
,
3485 ProcessRaisePriority
,
3487 ProcessExceptionPort
,
3489 ProcessLdtInformation
,
3491 ProcessDefaultHardErrorMode
,
3492 ProcessIoPortHandlers
,
3493 ProcessPooledUsageAndLimits
,
3494 ProcessWorkingSetWatch
,
3495 ProcessUserModeIOPL
,
3496 ProcessEnableAlignmentFaultFixup
,
3497 ProcessPriorityClass
,
3498 ProcessWx86Information
,
3500 ProcessAffinityMask
,
3501 ProcessPriorityBoost
,
3503 ProcessSessionInformation
,
3504 ProcessForegroundInformation
,
3505 ProcessWow64Information
,
3506 ProcessImageFileName
,
3507 ProcessLUIDDeviceMapsEnabled
,
3508 ProcessBreakOnTermination
,
3509 ProcessDebugObjectHandle
,
3511 ProcessHandleTracing
,
3515 typedef enum _THREADINFOCLASS
{
3516 ThreadBasicInformation
,
3521 ThreadImpersonationToken
,
3522 ThreadDescriptorTableEntry
,
3523 ThreadEnableAlignmentFaultFixup
,
3524 ThreadEventPair_Reusable
,
3525 ThreadQuerySetWin32StartAddress
,
3527 ThreadPerformanceCount
,
3528 ThreadAmILastThread
,
3529 ThreadIdealProcessor
,
3530 ThreadPriorityBoost
,
3531 ThreadSetTlsArrayAddress
,
3533 ThreadHideFromDebugger
,
3534 ThreadBreakOnTermination
,
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
;
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
{
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
,
3580 typedef struct _CREATE_DISK_MBR
{
3582 } CREATE_DISK_MBR
, *PCREATE_DISK_MBR
;
3584 typedef struct _CREATE_DISK_GPT
{
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
;
3595 } CREATE_DISK
, *PCREATE_DISK
;
3597 typedef struct _DISK_SIGNATURE
{
3598 ULONG PartitionStyle
;
3599 _ANONYMOUS_UNION
union {
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
;
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
{
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
;
3671 } RTL_RANGE_LIST
, *PRTL_RANGE_LIST
;
3673 typedef struct _RANGE_LIST_ITERATOR
{
3674 PLIST_ENTRY RangeListHead
;
3675 PLIST_ENTRY MergedHead
;
3678 } RTL_RANGE_LIST_ITERATOR
, *PRTL_RANGE_LIST_ITERATOR
;
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
{
3693 CommunicationServer
,
3695 SmallBusinessRestricted
,
3705 (*PTIMER_APC_ROUTINE
)(
3706 /*IN*/ PVOID TimerContext
,
3707 /*IN*/ ULONG TimerLowValue
,
3708 /*IN*/ LONG TimerHighValue
);
3717 (*WMI_NOTIFICATION_CALLBACK
)(
3723 ** Architecture specific structures
3728 typedef ULONG PFN_NUMBER
, *PPFN_NUMBER
;
3730 #define PASSIVE_LEVEL 0
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 */
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 */
3764 ULONG IrrActive
; /* 2C */
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
{
3782 ULONG ErrorSelector
;
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
;
3827 * KeGetCurrentProcessorNumber(
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
3838 #if !defined(__INTERLOCKED_DECLARED)
3839 #define __INTERLOCKED_DECLARED
3844 InterlockedIncrement(
3845 /*IN*/ PLONG VOLATILE Addend
);
3850 InterlockedDecrement(
3851 /*IN*/ PLONG VOLATILE Addend
);
3856 InterlockedCompareExchange(
3857 /*IN OUT*/ PLONG VOLATILE Destination
,
3858 /*IN*/ LONG Exchange
,
3859 /*IN*/ LONG Comparand
);
3864 InterlockedExchange(
3865 /*IN OUT*/ PLONG VOLATILE Target
,
3871 InterlockedExchangeAdd(
3872 /*IN OUT*/ PLONG VOLATILE Addend
,
3877 * InterlockedExchangePointer(
3878 * IN OUT PVOID VOLATILE *Target,
3881 #define InterlockedExchangePointer(Target, Value) \
3882 ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
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)
3897 InterlockedPopEntrySList(
3898 /*IN*/ PSLIST_HEADER ListHead
);
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__ */
3914 KefAcquireSpinLockAtDpcLevel(
3915 /*IN*/ PKSPIN_LOCK SpinLock
);
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
3935 ** Utillity functions
3938 #define ARGUMENT_PRESENT(ArgumentPointer) \
3939 ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL))
3946 #define BYTE_OFFSET(Va) \
3947 ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
3954 #define BYTES_TO_PAGES(Size) \
3955 ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0))
3959 * CONTAINING_RECORD(
3964 #ifndef CONTAINING_RECORD
3965 #define CONTAINING_RECORD(Address, Type, Field) \
3966 ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field)))
3974 #ifndef FIELD_OFFSET
3975 #define FIELD_OFFSET(Type, Field) \
3976 ((LONG) (&(((Type *) 0)->Field)))
3984 #define PAGE_ALIGN(Va) \
3985 ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
3990 * IN ULONG_PTR Size)
3992 #define ROUND_TO_PAGES(Size) \
3993 ((ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
3999 /*IN*/ PVOID FailedAssertion
,
4000 /*IN*/ PVOID FileName
,
4001 /*IN*/ ULONG LineNumber
,
4002 /*IN*/ PCHAR Message
);
4006 #define ASSERT(exp) \
4008 (RtlAssert( #exp, __FILE__, __LINE__, NULL ), FALSE) : TRUE)
4010 #define ASSERTMSG(msg, exp) \
4012 (RtlAssert( #exp, __FILE__, __LINE__, msg ), FALSE) : TRUE)
4014 #define RTL_SOFT_ASSERT(exp) \
4016 (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #exp), FALSE) : TRUE)
4018 #define RTL_SOFT_ASSERTMSG(msg, 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)
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)
4046 ** Driver support routines
4049 /** Runtime library routines **/
4053 * InitializeListHead(
4054 * IN PLIST_ENTRY ListHead)
4056 #define InitializeListHead(_ListHead) \
4058 (_ListHead)->Flink = (_ListHead); \
4059 (_ListHead)->Blink = (_ListHead); \
4065 * IN PLIST_ENTRY ListHead,
4066 * IN PLIST_ENTRY Entry)
4068 #define InsertHeadList(_ListHead, \
4071 PLIST_ENTRY _OldFlink; \
4072 _OldFlink = (_ListHead)->Flink; \
4073 (_Entry)->Flink = _OldFlink; \
4074 (_Entry)->Blink = (_ListHead); \
4075 _OldFlink->Blink = (_Entry); \
4076 (_ListHead)->Flink = (_Entry); \
4082 * IN PLIST_ENTRY ListHead,
4083 * IN PLIST_ENTRY Entry)
4085 #define InsertTailList(_ListHead, \
4088 PLIST_ENTRY _OldBlink; \
4089 _OldBlink = (_ListHead)->Blink; \
4090 (_Entry)->Flink = (_ListHead); \
4091 (_Entry)->Blink = _OldBlink; \
4092 _OldBlink->Flink = (_Entry); \
4093 (_ListHead)->Blink = (_Entry); \
4099 * IN PLIST_ENTRY ListHead)
4101 #define IsListEmpty(_ListHead) \
4102 ((_ListHead)->Flink == (_ListHead))
4104 static __inline PSINGLE_LIST_ENTRY
4106 /*IN*/ PSINGLE_LIST_ENTRY ListHead
)
4108 PSINGLE_LIST_ENTRY Entry
;
4110 Entry
= ListHead
->Next
;
4113 ListHead
->Next
= Entry
->Next
;
4121 * IN PSINGLE_LIST_ENTRY ListHead,
4122 * IN PSINGLE_LIST_ENTRY Entry)
4124 #define PushEntryList(_ListHead, \
4127 (_Entry)->Next = (_ListHead)->Next; \
4128 (_ListHead)->Next = (_Entry); \
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
4150 /*IN*/ PLIST_ENTRY ListHead
)
4152 PLIST_ENTRY OldFlink
;
4153 PLIST_ENTRY OldBlink
;
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
;
4171 static __inline PLIST_ENTRY
4173 /*IN*/ PLIST_ENTRY ListHead
)
4175 PLIST_ENTRY OldFlink
;
4176 PLIST_ENTRY OldBlink
;
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
;
4197 * IN PSLIST_HEADER SListHead)
4199 #define QueryDepthSList(_SListHead) \
4200 ((USHORT) ((_SListHead)->Alignment & 0xffff))
4202 #define InterlockedFlushSList(ListHead) ExInterlockedFlushSList(ListHead)
4207 RtlAnsiStringToUnicodeSize(
4208 /*IN*/ PANSI_STRING AnsiString
);
4214 /*IN OUT*/ PRTL_RANGE_LIST RangeList
,
4215 /*IN*/ ULONGLONG Start
,
4216 /*IN*/ ULONGLONG End
,
4217 /*IN*/ UCHAR Attributes
,
4219 /*IN*/ PVOID UserData
/*OPTIONAL*/,
4220 /*IN*/ PVOID Owner
/*OPTIONAL*/);
4225 RtlAnsiStringToUnicodeString(
4226 /*IN OUT*/ PUNICODE_STRING DestinationString
,
4227 /*IN*/ PANSI_STRING SourceString
,
4228 /*IN*/ BOOLEAN AllocateDestinationString
);
4233 RtlAppendUnicodeStringToString(
4234 /*IN OUT*/ PUNICODE_STRING Destination
,
4235 /*IN*/ PUNICODE_STRING Source
);
4240 RtlAppendUnicodeToString(
4241 /*IN OUT*/ PUNICODE_STRING Destination
,
4242 /*IN*/ PCWSTR Source
);
4248 /*IN*/ PRTL_BITMAP BitMapHeader
,
4249 /*IN*/ ULONG StartingIndex
,
4250 /*IN*/ ULONG Length
);
4256 /*IN*/ PRTL_BITMAP BitMapHeader
,
4257 /*IN*/ ULONG StartingIndex
,
4258 /*IN*/ ULONG Length
);
4265 /*IN*/ ULONG Base
/*OPTIONAL*/,
4266 /*IN OUT*/ PULONG Value
);
4272 /*IN*/ PRTL_BITMAP BitMapHeader
,
4273 /*IN*/ ULONG BitPosition
);
4278 RtlCheckRegistryKey(
4279 /*IN*/ ULONG RelativeTo
,
4286 /*IN*/ PRTL_BITMAP BitMapHeader
);
4292 PRTL_BITMAP BitMapHeader
,
4299 /*IN*/ PRTL_BITMAP BitMapHeader
,
4300 /*IN*/ ULONG StartingIndex
,
4301 /*IN*/ ULONG NumberToClear
);
4307 /*IN*/ CONST VOID
*Source1
,
4308 /*IN*/ CONST VOID
*Source2
,
4309 /*IN*/ SIZE_T Length
);
4315 /*IN*/ PSTRING String1
,
4316 /*IN*/ PSTRING String2
,
4317 BOOLEAN CaseInSensitive
);
4322 RtlCompareUnicodeString(
4323 /*IN*/ PUNICODE_STRING String1
,
4324 /*IN*/ PUNICODE_STRING String2
,
4325 /*IN*/ BOOLEAN CaseInSensitive
);
4330 RtlConvertLongToLargeInteger(
4331 /*IN*/ LONG SignedInteger
);
4336 RtlConvertLongToLuid(
4342 RtlConvertUlongToLargeInteger(
4343 /*IN*/ ULONG UnsignedInteger
);
4348 RtlConvertUlongToLuid(
4354 * IN VOID UNALIGNED *Destination,
4355 * IN CONST VOID UNALIGNED *Source,
4358 #ifndef RtlCopyMemory
4359 #define RtlCopyMemory(Destination, Source, Length) \
4360 memcpy(Destination, Source, Length);
4363 #ifndef RtlCopyBytes
4364 #define RtlCopyBytes RtlCopyMemory
4371 /*IN*/ VOID UNALIGNED
*Destination
,
4372 /*IN*/ CONST VOID UNALIGNED
*Source
,
4373 /*IN*/ ULONG Length
);
4379 /*OUT*/ PRTL_RANGE_LIST CopyRangeList
,
4380 /*IN*/ PRTL_RANGE_LIST RangeList
);
4386 /*IN OUT*/ PSTRING DestinationString
,
4387 /*IN*/ PSTRING SourceString
/*OPTIONAL*/);
4392 RtlCopyUnicodeString(
4393 /*IN OUT*/ PUNICODE_STRING DestinationString
,
4394 /*IN*/ PUNICODE_STRING SourceString
);
4399 RtlCreateRegistryKey(
4400 /*IN*/ ULONG RelativeTo
,
4406 RtlCreateSecurityDescriptor(
4407 /*IN OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
4408 /*IN*/ ULONG Revision
);
4413 RtlDeleteOwnersRanges(
4414 /*IN OUT*/ PRTL_RANGE_LIST RangeList
,
4415 /*IN*/ PVOID Owner
);
4421 /*IN OUT*/ PRTL_RANGE_LIST RangeList
,
4422 /*IN*/ ULONGLONG Start
,
4423 /*IN*/ ULONGLONG End
,
4424 /*IN*/ PVOID Owner
);
4429 RtlDeleteRegistryValue(
4430 /*IN*/ ULONG RelativeTo
,
4432 /*IN*/ PCWSTR ValueName
);
4437 RtlDosPathNameToNtPathName_U(
4438 /*IN*/ PCWSTR DosPathName
,
4439 /*OUT*/ PUNICODE_STRING NtPathName
,
4440 /*OUT*/ PCWSTR
*NtFileNamePart
,
4441 /*OUT*/ VOID
*DirectoryInfo
);
4449 #define RtlEqualLuid(_Luid1, \
4451 ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart))
4456 * IN VOID UNALIGNED *Destination,
4457 * IN CONST VOID UNALIGNED *Source,
4460 #define RtlEqualMemory(Destination, Source, Length) (!memcmp(Destination, Source, Length))
4466 /*IN*/ PSTRING String1
,
4467 /*IN*/ PSTRING String2
,
4468 /*IN*/ BOOLEAN CaseInSensitive
);
4473 RtlEqualUnicodeString(
4474 /*IN*/ CONST UNICODE_STRING
*String1
,
4475 /*IN*/ CONST UNICODE_STRING
*String2
,
4476 /*IN*/ BOOLEAN CaseInSensitive
);
4481 * IN VOID UNALIGNED *Destination,
4485 #ifndef RtlFillMemory
4486 #define RtlFillMemory(Destination, Length, Fill) \
4487 memset(Destination, Fill, Length)
4490 #ifndef RtlFillBytes
4491 #define RtlFillBytes RtlFillMemory
4498 /*IN*/ PRTL_BITMAP BitMapHeader
,
4499 /*IN*/ ULONG NumberToFind
,
4500 /*IN*/ ULONG HintIndex
);
4505 RtlFindClearBitsAndSet(
4506 /*IN*/ PRTL_BITMAP BitMapHeader
,
4507 /*IN*/ ULONG NumberToFind
,
4508 /*IN*/ ULONG HintIndex
);
4514 /*IN*/ PRTL_BITMAP BitMapHeader
,
4515 /*OUT*/ PRTL_BITMAP_RUN RunArray
,
4516 /*IN*/ ULONG SizeOfRunArray
,
4517 /*IN*/ BOOLEAN LocateLongestRuns
);
4522 RtlFindFirstRunClear(
4523 /*IN*/ PRTL_BITMAP BitMapHeader
,
4524 /*OUT*/ PULONG StartingIndex
);
4529 RtlFindLastBackwardRunClear(
4530 /*IN*/ PRTL_BITMAP BitMapHeader
,
4531 /*IN*/ ULONG FromIndex
,
4532 /*OUT*/ PULONG StartingRunIndex
);
4537 RtlFindLeastSignificantBit(
4538 /*IN*/ ULONGLONG Set
);
4543 RtlFindLongestRunClear(
4544 /*IN*/ PRTL_BITMAP BitMapHeader
,
4545 /*OUT*/ PULONG StartingIndex
);
4550 RtlFindMostSignificantBit(
4551 /*IN*/ ULONGLONG Set
);
4556 RtlFindNextForwardRunClear(
4557 /*IN*/ PRTL_BITMAP BitMapHeader
,
4558 /*IN*/ ULONG FromIndex
,
4559 /*OUT*/ PULONG StartingRunIndex
);
4565 /*IN*/ PRTL_RANGE_LIST RangeList
,
4566 /*IN*/ ULONGLONG Minimum
,
4567 /*IN*/ ULONGLONG Maximum
,
4568 /*IN*/ ULONG Length
,
4569 /*IN*/ ULONG Alignment
,
4571 /*IN*/ UCHAR AttributeAvailableMask
,
4572 /*IN*/ PVOID Context
/*OPTIONAL*/,
4573 /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK Callback
/*OPTIONAL*/,
4574 /*OUT*/ PULONGLONG Start
);
4580 /*IN*/ PRTL_BITMAP BitMapHeader
,
4581 /*IN*/ ULONG NumberToFind
,
4582 /*IN*/ ULONG HintIndex
);
4587 RtlFindSetBitsAndClear(
4588 /*IN*/ PRTL_BITMAP BitMapHeader
,
4589 /*IN*/ ULONG NumberToFind
,
4590 /*IN*/ ULONG HintIndex
);
4596 /*IN*/ PANSI_STRING AnsiString
);
4602 /*IN*/ PRTL_RANGE_LIST RangeList
);
4607 RtlFreeUnicodeString(
4608 /*IN*/ PUNICODE_STRING UnicodeString
);
4613 RtlGetCallersAddress(
4614 /*OUT*/ PVOID
*CallersAddress
,
4615 /*OUT*/ PVOID
*CallersCaller
);
4621 /*IN OUT*/ PRTL_OSVERSIONINFOW lpVersionInformation
);
4627 /*IN*/ PRTL_RANGE_LIST RangeList
,
4628 /*OUT*/ PRTL_RANGE_LIST_ITERATOR Iterator
,
4629 /*OUT*/ PRTL_RANGE
*Range
);
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))
4653 /*IN*/ PUNICODE_STRING GuidString
,
4654 /*OUT*/ GUID
*Guid
);
4659 RtlHashUnicodeString(
4660 /*IN*/ CONST UNICODE_STRING
*String
,
4661 /*IN*/ BOOLEAN CaseInSensitive
,
4662 /*IN*/ ULONG HashAlgorithm
,
4663 /*OUT*/ PULONG HashValue
);
4669 /*IN OUT*/ PANSI_STRING DestinationString
,
4670 /*IN*/ PCSZ SourceString
);
4675 RtlInitializeBitMap(
4676 /*IN*/ PRTL_BITMAP BitMapHeader
,
4677 /*IN*/ PULONG BitMapBuffer
,
4678 /*IN*/ ULONG SizeOfBitMap
);
4683 RtlInitializeRangeList(
4684 /*IN OUT*/ PRTL_RANGE_LIST RangeList
);
4690 /*IN OUT*/ PSTRING DestinationString
,
4691 /*IN*/ PCSZ SourceString
);
4696 RtlInitUnicodeString(
4697 /*IN OUT*/ PUNICODE_STRING DestinationString
,
4698 /*IN*/ PCWSTR SourceString
);
4703 RtlInt64ToUnicodeString(
4704 /*IN*/ ULONGLONG Value
,
4705 /*IN*/ ULONG Base
/*OPTIONAL*/,
4706 /*IN OUT*/ PUNICODE_STRING String
);
4711 RtlIntegerToUnicodeString(
4713 /*IN*/ ULONG Base
/*OPTIONAL*/,
4714 /*IN OUT*/ PUNICODE_STRING String
);
4719 RtlIntPtrToUnicodeString(
4721 ULONG Base
/*OPTIONAL*/,
4722 PUNICODE_STRING String
);
4728 /*OUT*/ PRTL_RANGE_LIST InvertedRangeList
,
4729 /*IN*/ PRTL_RANGE_LIST RangeList
);
4734 RtlIsRangeAvailable(
4735 /*IN*/ PRTL_RANGE_LIST RangeList
,
4736 /*IN*/ ULONGLONG Start
,
4737 /*IN*/ ULONGLONG End
,
4739 /*IN*/ UCHAR AttributeAvailableMask
,
4740 /*IN*/ PVOID Context
/*OPTIONAL*/,
4741 /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK Callback
/*OPTIONAL*/,
4742 /*OUT*/ PBOOLEAN Available
);
4749 #define RtlIsZeroLuid(_L1) \
4750 ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
4755 RtlLengthSecurityDescriptor(
4756 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
);
4762 /*IN OUT*/ PACCESS_MASK AccessMask
,
4763 /*IN*/ PGENERIC_MAPPING GenericMapping
);
4769 /*OUT*/ PRTL_RANGE_LIST MergedRangeList
,
4770 /*IN*/ PRTL_RANGE_LIST RangeList1
,
4771 /*IN*/ PRTL_RANGE_LIST RangeList2
,
4772 /*IN*/ ULONG Flags
);
4777 * IN VOID UNALIGNED *Destination,
4778 * IN CONST VOID UNALIGNED *Source,
4781 #define RtlMoveMemory memmove
4786 RtlNumberOfClearBits(
4787 /*IN*/ PRTL_BITMAP BitMapHeader
);
4793 /*IN*/ PRTL_BITMAP BitMapHeader
);
4798 RtlPrefetchMemoryNonTemporal(
4799 /*IN*/ PVOID Source
,
4800 /*IN*/ SIZE_T Length
);
4805 RtlPrefixUnicodeString(
4806 /*IN*/ PUNICODE_STRING String1
,
4807 /*IN*/ PUNICODE_STRING String2
,
4808 /*IN*/ BOOLEAN CaseInSensitive
);
4813 RtlQueryRegistryValues(
4814 /*IN*/ ULONG RelativeTo
,
4816 /*IN*/ PRTL_QUERY_REGISTRY_TABLE QueryTable
,
4817 /*IN*/ PVOID Context
,
4818 /*IN*/ PVOID Environment
/*OPTIONAL*/);
4824 /*IN OUT*/ PULONG DestinationAddress
,
4825 /*IN*/ PULONG SourceAddress
);
4831 /*IN OUT*/ PUSHORT DestinationAddress
,
4832 /*IN*/ PUSHORT SourceAddress
);
4838 /*IN*/ PRTL_BITMAP BitMapHeader
);
4844 PRTL_BITMAP BitMapHeader
,
4851 /*IN*/ PRTL_BITMAP BitMapHeader
,
4852 /*IN*/ ULONG StartingIndex
,
4853 /*IN*/ ULONG NumberToSet
);
4858 RtlSetDaclSecurityDescriptor(
4859 /*IN OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
4860 /*IN*/ BOOLEAN DaclPresent
,
4861 /*IN*/ PACL Dacl
/*OPTIONAL*/,
4862 /*IN*/ BOOLEAN DaclDefaulted
/*OPTIONAL*/);
4868 /*IN*/ PULONG Address
,
4869 /*IN*/ ULONG Value
);
4875 /*IN OUT*/ PULONGLONG Address
,
4882 /*IN OUT*/ PULONG_PTR Address
,
4883 /*IN*/ ULONG_PTR Value
);
4889 /*IN*/ PUSHORT Address
,
4890 /*IN*/ USHORT Value
);
4896 /*IN*/ REFGUID Guid
,
4897 /*OUT*/ PUNICODE_STRING GuidString
);
4903 /*IN*/ PRTL_BITMAP BitMapHeader
,
4904 /*IN*/ ULONG BitNumber
);
4909 RtlTimeFieldsToTime(
4910 /*IN*/ PTIME_FIELDS TimeFields
,
4911 /*IN*/ PLARGE_INTEGER Time
);
4916 RtlTimeToTimeFields(
4917 /*IN*/ PLARGE_INTEGER Time
,
4918 /*IN*/ PTIME_FIELDS TimeFields
);
4924 /*IN*/ ULONG Source
);
4929 RtlUlonglongByteSwap(
4930 /*IN*/ ULONGLONG Source
);
4935 RtlUnicodeStringToAnsiSize(
4936 /*IN*/ PUNICODE_STRING UnicodeString
);
4941 RtlUnicodeStringToAnsiString(
4942 /*IN OUT*/ PANSI_STRING DestinationString
,
4943 /*IN*/ PUNICODE_STRING SourceString
,
4944 /*IN*/ BOOLEAN AllocateDestinationString
);
4949 RtlUnicodeStringToInteger(
4950 /*IN*/ PUNICODE_STRING String
,
4951 /*IN*/ ULONG Base
/*OPTIONAL*/,
4952 /*OUT*/ PULONG Value
);
4957 RtlUpcaseUnicodeChar(
4958 /*IN*/ WCHAR SourceCharacter
);
4963 RtlUpcaseUnicodeString(
4964 /*IN OUT*/ PUNICODE_STRING DestinationString
/*OPTIONAL*/,
4965 /*IN*/ PCUNICODE_STRING SourceString
,
4966 /*IN*/ BOOLEAN AllocateDestinationString
);
4972 /*IN*/ CHAR Character
);
4978 /*IN OUT*/ PSTRING DestinationString
,
4979 /*IN*/ PSTRING SourceString
);
4985 /*IN*/ USHORT Source
);
4990 RtlValidRelativeSecurityDescriptor(
4991 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
4992 /*IN*/ ULONG SecurityDescriptorLength
,
4993 /*IN*/ SECURITY_INFORMATION RequiredInformation
);
4998 RtlValidSecurityDescriptor(
4999 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
);
5004 RtlVerifyVersionInfo(
5005 /*IN*/ PRTL_OSVERSIONINFOEXW VersionInfo
,
5006 /*IN*/ ULONG TypeMask
,
5007 /*IN*/ ULONGLONG ConditionMask
);
5012 RtlVolumeDeviceToDosName(
5013 /*IN*/ PVOID VolumeDeviceObject
,
5014 /*OUT*/ PUNICODE_STRING DosName
);
5020 /*OUT*/ PVOID
*Callers
,
5022 /*IN*/ ULONG Flags
);
5027 RtlWriteRegistryValue(
5028 /*IN*/ ULONG RelativeTo
,
5030 /*IN*/ PCWSTR ValueName
,
5031 /*IN*/ ULONG ValueType
,
5032 /*IN*/ PVOID ValueData
,
5033 /*IN*/ ULONG ValueLength
);
5038 RtlxUnicodeStringToAnsiSize(
5039 /*IN*/ PUNICODE_STRING UnicodeString
);
5044 * IN VOID UNALIGNED *Destination,
5047 #ifndef RtlZeroMemory
5048 #define RtlZeroMemory(Destination, Length) \
5049 memset(Destination, 0, Length)
5052 #ifndef RtlZeroBytes
5053 #define RtlZeroBytes RtlZeroMemory
5057 /** Executive support routines **/
5063 /*IN*/ PFAST_MUTEX FastMutex
);
5068 ExAcquireFastMutexUnsafe(
5069 /*IN*/ PFAST_MUTEX FastMutex
);
5074 ExAcquireResourceExclusiveLite(
5075 /*IN*/ PERESOURCE Resource
,
5076 /*IN*/ BOOLEAN Wait
);
5081 ExAcquireResourceSharedLite(
5082 /*IN*/ PERESOURCE Resource
,
5083 /*IN*/ BOOLEAN Wait
);
5088 ExAcquireSharedStarveExclusive(
5089 /*IN*/ PERESOURCE Resource
,
5090 /*IN*/ BOOLEAN Wait
);
5095 ExAcquireSharedWaitForExclusive(
5096 /*IN*/ PERESOURCE Resource
,
5097 /*IN*/ BOOLEAN Wait
);
5103 ExInterlockedPopEntrySList(
5104 /*IN*/ PSLIST_HEADER ListHead
,
5105 /*IN*/ PKSPIN_LOCK Lock
);
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, \
5120 InterlockedPopEntrySList(_ListHead)
5122 #define ExInterlockedPushEntrySList(_ListHead, \
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
)
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
,
5148 static __inline VOID
5149 ExFreeToNPagedLookasideList(
5150 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
,
5153 Lookaside
->TotalFrees
++;
5154 if (ExQueryDepthSList(&Lookaside
->ListHead
) >= Lookaside
->Depth
) {
5155 Lookaside
->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses
)++;
5156 (Lookaside
->Free
)(Entry
);
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
)
5172 Lookaside
->TotalAllocates
++;
5173 Entry
= InterlockedPopEntrySList(&Lookaside
->ListHead
);
5174 if (Entry
== NULL
) {
5175 Lookaside
->_DDK_DUMMYUNION_MEMBER(AllocateMisses
)++;
5176 Entry
= (Lookaside
->Allocate
)(Lookaside
->Type
,
5183 static __inline VOID
5184 ExFreeToPagedLookasideList(
5185 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
,
5188 Lookaside
->TotalFrees
++;
5189 if (ExQueryDepthSList(&Lookaside
->ListHead
) >= Lookaside
->Depth
) {
5190 Lookaside
->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses
)++;
5191 (Lookaside
->Free
)(Entry
);
5193 InterlockedPushEntrySList(&Lookaside
->ListHead
,
5194 (PSLIST_ENTRY
)Entry
);
5198 #else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5203 ExAllocateFromPagedLookasideList(
5204 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
);
5209 ExFreeToPagedLookasideList(
5210 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
,
5211 /*IN*/ PVOID Entry
);
5213 #endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5218 ExAllocatePoolWithQuotaTag(
5219 /*IN*/ POOL_TYPE PoolType
,
5220 /*IN*/ SIZE_T NumberOfBytes
,
5226 ExAllocatePoolWithTag(
5227 /*IN*/ POOL_TYPE PoolType
,
5228 /*IN*/ SIZE_T NumberOfBytes
,
5233 #define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
5234 #define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
5236 #else /* !POOL_TAGGING */
5242 /*IN*/ POOL_TYPE PoolType
,
5243 /*IN*/ SIZE_T NumberOfBytes
);
5248 ExAllocatePoolWithQuota(
5249 /*IN*/ POOL_TYPE PoolType
,
5250 /*IN*/ SIZE_T NumberOfBytes
);
5252 #endif /* POOL_TAGGING */
5257 ExAllocatePoolWithTagPriority(
5258 /*IN*/ POOL_TYPE PoolType
,
5259 /*IN*/ SIZE_T NumberOfBytes
,
5261 /*IN*/ EX_POOL_PRIORITY Priority
);
5266 ExConvertExclusiveToSharedLite(
5267 /*IN*/ PERESOURCE Resource
);
5273 /*OUT*/ PCALLBACK_OBJECT
*CallbackObject
,
5274 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
5275 /*IN*/ BOOLEAN Create
,
5276 /*IN*/ BOOLEAN AllowMultipleCallbacks
);
5281 ExDeleteNPagedLookasideList(
5282 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
);
5287 ExDeletePagedLookasideList(
5288 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
);
5293 ExDeleteResourceLite(
5294 /*IN*/ PERESOURCE Resource
);
5302 #define PROTECTED_POOL 0x80000000
5305 #define ExFreePool(P) ExFreePoolWithTag(P, 0)
5317 * ExGetCurrentResourceThread(
5320 #define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
5325 ExGetExclusiveWaiterCount(
5326 /*IN*/ PERESOURCE Resource
);
5337 ExGetSharedWaiterCount(
5338 /*IN*/ PERESOURCE Resource
);
5344 /*IN*/ PRKEVENT Event
,
5345 /*IN*/ EVENT_TYPE Type
,
5346 /*IN*/ BOOLEAN State
);
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); \
5364 ExInitializeNPagedLookasideList(
5365 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
,
5366 /*IN*/ PALLOCATE_FUNCTION Allocate
/*OPTIONAL*/,
5367 /*IN*/ PFREE_FUNCTION Free
/*OPTIONAL*/,
5371 /*IN*/ USHORT Depth
);
5376 ExInitializePagedLookasideList(
5377 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
,
5378 /*IN*/ PALLOCATE_FUNCTION Allocate
/*OPTIONAL*/,
5379 /*IN*/ PFREE_FUNCTION Free
/*OPTIONAL*/,
5383 /*IN*/ USHORT Depth
);
5388 ExInitializeResourceLite(
5389 /*IN*/ PERESOURCE Resource
);
5393 * InitializeSListHead(
5394 * IN PSLIST_HEADER SListHead)
5396 #define InitializeSListHead(_SListHead) \
5397 (_SListHead)->Alignment = 0
5399 #define ExInitializeSListHead InitializeSListHead
5404 ExInterlockedAddLargeInteger(
5405 /*IN*/ PLARGE_INTEGER Addend
,
5406 /*IN*/ LARGE_INTEGER Increment
,
5407 /*IN*/ PKSPIN_LOCK Lock
);
5412 ExInterlockedAddLargeStatistic(
5413 /*IN*/ PLARGE_INTEGER Addend
,
5414 /*IN*/ ULONG Increment
);
5419 ExInterlockedAddUlong(
5420 /*IN*/ PULONG Addend
,
5421 /*IN*/ ULONG Increment
,
5427 ExfInterlockedAddUlong(
5428 /*IN*/ PULONG Addend
,
5429 /*IN*/ ULONG Increment
,
5436 ExInterlockedCompareExchange64(
5437 /*IN OUT*/ PLONGLONG Destination
,
5438 /*IN*/ PLONGLONG Exchange
,
5439 /*IN*/ PLONGLONG Comparand
,
5440 /*IN*/ PKSPIN_LOCK Lock
);
5445 ExInterlockedFlushSList(
5446 /*IN*/ PSLIST_HEADER ListHead
);
5451 ExInterlockedInsertHeadList(
5452 /*IN*/ PLIST_ENTRY ListHead
,
5453 /*IN*/ PLIST_ENTRY ListEntry
,
5454 /*IN*/ PKSPIN_LOCK Lock
);
5459 ExfInterlockedInsertHeadList(
5460 /*IN*/ PLIST_ENTRY ListHead
,
5461 /*IN*/ PLIST_ENTRY ListEntry
,
5462 /*IN*/ PKSPIN_LOCK Lock
);
5467 ExInterlockedInsertTailList(
5468 /*IN*/ PLIST_ENTRY ListHead
,
5469 /*IN*/ PLIST_ENTRY ListEntry
,
5470 /*IN*/ PKSPIN_LOCK Lock
);
5475 ExfInterlockedInsertTailList(
5476 /*IN*/ PLIST_ENTRY ListHead
,
5477 /*IN*/ PLIST_ENTRY ListEntry
,
5478 /*IN*/ PKSPIN_LOCK Lock
);
5483 ExInterlockedPopEntryList(
5484 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5485 /*IN*/ PKSPIN_LOCK Lock
);
5490 ExfInterlockedPopEntryList(
5491 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5492 /*IN*/ PKSPIN_LOCK Lock
);
5498 ExInterlockedPushEntryList(
5499 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5500 /*IN*/ PSINGLE_LIST_ENTRY ListEntry
,
5501 /*IN*/ PKSPIN_LOCK Lock
);
5506 ExfInterlockedPushEntryList(
5507 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5508 /*IN*/ PSINGLE_LIST_ENTRY ListEntry
,
5509 /*IN*/ PKSPIN_LOCK Lock
);
5515 ExInterlockedRemoveHeadList(
5516 /*IN*/ PLIST_ENTRY ListHead
,
5517 /*IN*/ PKSPIN_LOCK Lock
);
5522 ExfInterlockedRemoveHeadList(
5523 /*IN*/ PLIST_ENTRY ListHead
,
5524 /*IN*/ PKSPIN_LOCK Lock
);
5530 ExIsProcessorFeaturePresent(
5531 /*IN*/ ULONG ProcessorFeature
);
5536 ExIsResourceAcquiredExclusiveLite(
5537 /*IN*/ PERESOURCE Resource
);
5542 ExIsResourceAcquiredLite(
5543 /*IN*/ PERESOURCE Resource
);
5548 ExIsResourceAcquiredSharedLite(
5549 /*IN*/ PERESOURCE Resource
);
5554 ExLocalTimeToSystemTime(
5555 /*IN*/ PLARGE_INTEGER LocalTime
,
5556 /*OUT*/ PLARGE_INTEGER SystemTime
);
5562 /*IN*/ PCALLBACK_OBJECT CallbackObject
,
5563 /*IN*/ PVOID Argument1
,
5564 /*IN*/ PVOID Argument2
);
5569 ExRaiseAccessViolation(
5575 ExRaiseDatatypeMisalignment(
5582 /*IN*/ NTSTATUS Status
);
5588 /*IN*/ PCALLBACK_OBJECT CallbackObject
,
5589 /*IN*/ PCALLBACK_FUNCTION CallbackFunction
,
5590 /*IN*/ PVOID CallbackContext
);
5595 ExReinitializeResourceLite(
5596 /*IN*/ PERESOURCE Resource
);
5602 /*IN*/ PFAST_MUTEX FastMutex
);
5607 ExReleaseFastMutexUnsafe(
5608 /*IN*/ PFAST_MUTEX FastMutex
);
5613 ExReleaseResourceForThreadLite(
5614 /*IN*/ PERESOURCE Resource
,
5615 /*IN*/ ERESOURCE_THREAD ResourceThreadId
);
5620 ExReleaseResourceLite(
5621 /*IN*/ PERESOURCE Resource
);
5626 ExSetResourceOwnerPointer(
5627 /*IN*/ PERESOURCE Resource
,
5628 /*IN*/ PVOID OwnerPointer
);
5633 ExSetTimerResolution(
5634 /*IN*/ ULONG DesiredTime
,
5635 /*IN*/ BOOLEAN SetResolution
);
5640 ExSystemTimeToLocalTime(
5641 /*IN*/ PLARGE_INTEGER SystemTime
,
5642 /*OUT*/ PLARGE_INTEGER LocalTime
);
5647 ExTryToAcquireFastMutex(
5648 /*IN*/ PFAST_MUTEX FastMutex
);
5653 ExTryToAcquireResourceExclusiveLite(
5654 /*IN*/ PERESOURCE Resource
);
5659 ExUnregisterCallback(
5660 /*IN*/ PVOID CbRegistration
);
5666 /*OUT*/ UUID
*Uuid
);
5672 /*IN*/ SUITE_TYPE SuiteType
);
5676 #define PAGED_CODE() { \
5677 if (KeGetCurrentIrql() > APC_LEVEL) { \
5678 KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
5685 #define PAGED_CODE()
5693 /*IN*/ CONST VOID
*Address
,
5694 /*IN*/ ULONG Length
,
5695 /*IN*/ ULONG Alignment
);
5701 /*IN*/ CONST VOID
*Address
,
5702 /*IN*/ ULONG Length
,
5703 /*IN*/ ULONG Alignment
);
5707 /** Configuration manager routines **/
5713 /*IN*/ PEX_CALLBACK_FUNCTION Function
,
5714 /*IN*/ PVOID Context
,
5715 /*IN OUT*/ PLARGE_INTEGER Cookie
);
5720 CmUnRegisterCallback(
5721 /*IN*/ LARGE_INTEGER Cookie
);
5725 /** Filesystem runtime library routines **/
5730 FsRtlIsTotalDeviceFailure(
5731 /*IN*/ NTSTATUS Status
);
5735 /** Hardware abstraction layer routines **/
5741 /*IN*/ PDEVICE_OBJECT DeviceObject
,
5742 /*IN*/ ULONG SectorSize
,
5743 /*IN*/ ULONG MBRTypeIdentifier
,
5744 /*OUT*/ PVOID Buffer
);
5749 READ_PORT_BUFFER_UCHAR(
5751 /*IN*/ PUCHAR Buffer
,
5752 /*IN*/ ULONG Count
);
5757 READ_PORT_BUFFER_ULONG(
5759 /*IN*/ PULONG Buffer
,
5760 /*IN*/ ULONG Count
);
5765 READ_PORT_BUFFER_USHORT(
5766 /*IN*/ PUSHORT Port
,
5767 /*IN*/ PUSHORT Buffer
,
5768 /*IN*/ ULONG Count
);
5774 /*IN*/ PUCHAR Port
);
5780 /*IN*/ PULONG Port
);
5786 /*IN*/ PUSHORT Port
);
5791 READ_REGISTER_BUFFER_UCHAR(
5792 /*IN*/ PUCHAR Register
,
5793 /*IN*/ PUCHAR Buffer
,
5794 /*IN*/ ULONG Count
);
5799 READ_REGISTER_BUFFER_ULONG(
5800 /*IN*/ PULONG Register
,
5801 /*IN*/ PULONG Buffer
,
5802 /*IN*/ ULONG Count
);
5807 READ_REGISTER_BUFFER_USHORT(
5808 /*IN*/ PUSHORT Register
,
5809 /*IN*/ PUSHORT Buffer
,
5810 /*IN*/ ULONG Count
);
5815 READ_REGISTER_UCHAR(
5816 /*IN*/ PUCHAR Register
);
5821 READ_REGISTER_ULONG(
5822 /*IN*/ PULONG Register
);
5827 READ_REGISTER_USHORT(
5828 /*IN*/ PUSHORT Register
);
5833 WRITE_PORT_BUFFER_UCHAR(
5835 /*IN*/ PUCHAR Buffer
,
5836 /*IN*/ ULONG Count
);
5841 WRITE_PORT_BUFFER_ULONG(
5843 /*IN*/ PULONG Buffer
,
5844 /*IN*/ ULONG Count
);
5849 WRITE_PORT_BUFFER_USHORT(
5850 /*IN*/ PUSHORT Port
,
5851 /*IN*/ PUSHORT Buffer
,
5852 /*IN*/ ULONG Count
);
5859 /*IN*/ UCHAR Value
);
5866 /*IN*/ ULONG Value
);
5872 /*IN*/ PUSHORT Port
,
5873 /*IN*/ USHORT Value
);
5878 WRITE_REGISTER_BUFFER_UCHAR(
5879 /*IN*/ PUCHAR Register
,
5880 /*IN*/ PUCHAR Buffer
,
5881 /*IN*/ ULONG Count
);
5886 WRITE_REGISTER_BUFFER_ULONG(
5887 /*IN*/ PULONG Register
,
5888 /*IN*/ PULONG Buffer
,
5889 /*IN*/ ULONG Count
);
5894 WRITE_REGISTER_BUFFER_USHORT(
5895 /*IN*/ PUSHORT Register
,
5896 /*IN*/ PUSHORT Buffer
,
5897 /*IN*/ ULONG Count
);
5902 WRITE_REGISTER_UCHAR(
5903 /*IN*/ PUCHAR Register
,
5904 /*IN*/ UCHAR Value
);
5909 WRITE_REGISTER_ULONG(
5910 /*IN*/ PULONG Register
,
5911 /*IN*/ ULONG Value
);
5916 WRITE_REGISTER_USHORT(
5917 /*IN*/ PUSHORT Register
,
5918 /*IN*/ USHORT Value
);
5920 /** I/O manager routines **/
5925 IoAcquireCancelSpinLock(
5926 /*OUT*/ PKIRQL Irql
);
5931 IoAcquireRemoveLockEx(
5932 /*IN*/ PIO_REMOVE_LOCK RemoveLock
,
5933 /*IN*/ PVOID Tag
/*OPTIONAL*/,
5936 /*IN*/ ULONG RemlockSize
);
5940 * IoAcquireRemoveLock(
5941 * IN PIO_REMOVE_LOCK RemoveLock,
5942 * IN PVOID Tag OPTIONAL)
5944 #define IoAcquireRemoveLock(_RemoveLock, \
5946 IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
5950 * IoAdjustPagingPathCount(
5952 * IN BOOLEAN Increment)
5954 #define IoAdjustPagingPathCount(_Count, \
5959 InterlockedIncrement(_Count); \
5963 InterlockedDecrement(_Count); \
5970 IoAllocateController(
5971 /*IN*/ PCONTROLLER_OBJECT ControllerObject
,
5972 /*IN*/ PDEVICE_OBJECT DeviceObject
,
5973 /*IN*/ PDRIVER_CONTROL ExecutionRoutine
,
5974 /*IN*/ PVOID Context
);
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
;
5988 USHORT DumpDataSize
;
5989 USHORT NumberOfStrings
;
5990 USHORT StringOffset
;
5991 USHORT EventCategory
;
5993 ULONG UniqueErrorValue
;
5994 NTSTATUS FinalStatus
;
5995 ULONG SequenceNumber
;
5996 ULONG IoControlCode
;
5997 LARGE_INTEGER DeviceOffset
;
5999 } IO_ERROR_LOG_PACKET
, *PIO_ERROR_LOG_PACKET
;
6004 IoAllocateErrorLogEntry(
6005 /*IN*/ PVOID IoObject
,
6006 /*IN*/ UCHAR EntrySize
);
6012 /*IN*/ CCHAR StackSize
,
6013 /*IN*/ BOOLEAN ChargeQuota
);
6019 /*IN*/ PVOID VirtualAddress
,
6020 /*IN*/ ULONG Length
,
6021 /*IN*/ BOOLEAN SecondaryBuffer
,
6022 /*IN*/ BOOLEAN ChargeQuota
,
6023 /*IN OUT*/ PIRP Irp
/*OPTIONAL*/);
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)))
6043 /*IN*/ PDEVICE_OBJECT SourceDevice
,
6044 /*IN*/ PUNICODE_STRING TargetDevice
,
6045 /*OUT*/ PDEVICE_OBJECT
*AttachedDevice
);
6050 IoAttachDeviceToDeviceStack(
6051 /*IN*/ PDEVICE_OBJECT SourceDevice
,
6052 /*IN*/ PDEVICE_OBJECT TargetDevice
);
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*/);
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
);
6083 /*IN*/ PMDL SourceMdl
,
6084 /*IN OUT*/ PMDL TargetMdl
,
6085 /*IN*/ PVOID VirtualAddress
,
6086 /*IN*/ ULONG Length
);
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
);
6104 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6105 /*IN OUT*/ PIRP Irp
);
6110 * IN PDEVICE_OBJECT DeviceObject,
6113 #define IoCallDriver IofCallDriver
6119 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6120 /*IN*/ PFILE_OBJECT FileObject
);
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
);
6143 /*IN*/ CCHAR PriorityBoost
);
6147 * IoCompleteRequest(
6149 * IN CCHAR PriorityBoost)
6151 #define IoCompleteRequest IofCompleteRequest
6157 /*OUT*/ PKINTERRUPT
*InterruptObject
,
6158 /*IN*/ PKSERVICE_ROUTINE ServiceRoutine
,
6159 /*IN*/ PVOID ServiceContext
,
6160 /*IN*/ PKSPIN_LOCK SpinLock
/*OPTIONAL*/,
6161 /*IN*/ ULONG Vector
,
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(
6174 #define IoGetCurrentIrpStackLocation(_Irp) \
6175 ((_Irp)->Tail.Overlay.CurrentStackLocation)
6178 * PIO_STACK_LOCATION
6179 * IoGetNextIrpStackLocation(
6182 #define IoGetNextIrpStackLocation(_Irp) \
6183 ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
6187 * IoCopyCurrentIrpStackLocationToNext(
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; \
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
);
6223 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6224 /*IN*/ PCREATE_DISK Disk
);
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
);
6248 IoCreateNotificationEvent(
6249 /*IN*/ PUNICODE_STRING EventName
,
6250 /*OUT*/ PHANDLE EventHandle
);
6255 IoCreateSymbolicLink(
6256 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6257 /*IN*/ PUNICODE_STRING DeviceName
);
6262 IoCreateSynchronizationEvent(
6263 /*IN*/ PUNICODE_STRING EventName
,
6264 /*OUT*/ PHANDLE EventHandle
);
6269 IoCreateUnprotectedSymbolicLink(
6270 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6271 /*IN*/ PUNICODE_STRING DeviceName
);
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
);
6291 /*IN*/ PIO_CSQ_IRP_CONTEXT Context
);
6298 /*IN*/ PIO_CSQ_IRP_CONTEXT Context
);
6305 /*IN*/ PVOID PeekContext
);
6311 /*IN*/ PCONTROLLER_OBJECT ControllerObject
);
6317 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6322 IoDeleteSymbolicLink(
6323 /*IN*/ PUNICODE_STRING SymbolicLinkName
);
6327 * IoDeassignArcName(
6328 * IN PUNICODE_STRING ArcName)
6330 #define IoDeassignArcName IoDeleteSymbolicLink
6336 /*IN OUT*/ PDEVICE_OBJECT TargetDevice
);
6341 IoDisconnectInterrupt(
6342 /*IN*/ PKINTERRUPT InterruptObject
);
6347 IoForwardIrpSynchronously(
6348 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6351 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
6357 /*IN*/ PCONTROLLER_OBJECT ControllerObject
);
6362 IoFreeErrorLogEntry(
6381 /*IN*/ PIO_WORKITEM pIOWorkItem
);
6386 IoGetAttachedDevice(
6387 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6392 IoGetAttachedDeviceReference(
6393 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6398 IoGetBootDiskInformation(
6399 /*IN OUT*/ PBOOTDISK_INFORMATION BootDiskInformation
,
6403 PCONFIGURATION_INFORMATION
6405 IoGetConfigurationInformation(
6411 IoGetCurrentProcess(
6417 IoGetDeviceInterfaceAlias(
6418 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6419 /*IN*/ CONST GUID
*AliasInterfaceClassGuid
,
6420 /*OUT*/ PUNICODE_STRING AliasSymbolicLinkName
);
6425 IoGetDeviceInterfaces(
6426 /*IN*/ CONST GUID
*InterfaceClassGuid
,
6427 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
/*OPTIONAL*/,
6429 /*OUT*/ PWSTR
*SymbolicLinkList
);
6434 IoGetDeviceObjectPointer(
6435 /*IN*/ PUNICODE_STRING ObjectName
,
6436 /*IN*/ ACCESS_MASK DesiredAccess
,
6437 /*OUT*/ PFILE_OBJECT
*FileObject
,
6438 /*OUT*/ PDEVICE_OBJECT
*DeviceObject
);
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
);
6453 IoGetDeviceToVerify(
6454 /*IN*/ PETHREAD Thread
);
6460 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6461 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription
,
6462 /*IN OUT*/ PULONG NumberOfMapRegisters
);
6467 IoGetDriverObjectExtension(
6468 /*IN*/ PDRIVER_OBJECT DriverObject
,
6469 /*IN*/ PVOID ClientIdentificationAddress
);
6474 IoGetFileObjectGenericMapping(
6479 * IoGetFunctionCodeFromCtlCode(
6480 * IN ULONG ControlCode)
6482 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
6483 (((_ControlCode) >> 2) & 0x00000FFF)
6494 IoGetRelatedDeviceObject(
6495 /*IN*/ PFILE_OBJECT FileObject
);
6500 IoGetRemainingStackSize(
6507 /*OUT*/ PULONG_PTR LowLimit
,
6508 /*OUT*/ PULONG_PTR HighLimit
);
6515 /*IN*/ PKDEFERRED_ROUTINE DeferredRoutine
,
6516 /*IN*/ PVOID DeferredContext
);
6520 * IoInitializeDpcRequest(
6521 * IN PDEVICE_OBJECT DeviceObject,
6522 * IN PIO_DPC_ROUTINE DpcRoutine)
6524 #define IoInitializeDpcRequest(_DeviceObject, \
6526 KeInitializeDpc(&(_DeviceObject)->Dpc, \
6527 (PKDEFERRED_ROUTINE) (_DpcRoutine), \
6534 /*IN OUT*/ PIRP Irp
,
6535 /*IN*/ USHORT PacketSize
,
6536 /*IN*/ CCHAR StackSize
);
6541 IoInitializeRemoveLockEx(
6542 /*IN*/ PIO_REMOVE_LOCK Lock
,
6543 /*IN*/ ULONG AllocateTag
,
6544 /*IN*/ ULONG MaxLockedMinutes
,
6545 /*IN*/ ULONG HighWatermark
,
6546 /*IN*/ ULONG RemlockSize
);
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))
6564 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6565 /*IN*/ PIO_TIMER_ROUTINE TimerRoutine
,
6566 /*IN*/ PVOID Context
);
6571 IoInvalidateDeviceRelations(
6572 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6573 /*IN*/ DEVICE_RELATION_TYPE Type
);
6578 IoInvalidateDeviceState(
6579 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
);
6585 /*IN*/ PIRP Irp
/*OPTIONAL*/);
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)))
6604 IoIsWdmVersionAvailable(
6605 /*IN*/ UCHAR MajorVersion
,
6606 /*IN*/ UCHAR MinorVersion
);
6611 IoMakeAssociatedIrp(
6613 /*IN*/ CCHAR StackSize
);
6620 #define IoMarkIrpPending(_Irp) \
6621 (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
6626 IoOpenDeviceInterfaceRegistryKey(
6627 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6628 /*IN*/ ACCESS_MASK DesiredAccess
,
6629 /*OUT*/ PHANDLE DeviceInterfaceKey
);
6634 IoOpenDeviceRegistryKey(
6635 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6636 /*IN*/ ULONG DevInstKeyType
,
6637 /*IN*/ ACCESS_MASK DesiredAccess
,
6638 /*OUT*/ PHANDLE DevInstRegKey
);
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
);
6657 /*IN*/ PIO_WORKITEM pIOWorkItem
,
6658 /*IN*/ PIO_WORKITEM_ROUTINE Routine
,
6659 /*IN*/ WORK_QUEUE_TYPE QueueType
,
6660 /*IN*/ PVOID Context
);
6667 /*IN*/ PVPB Vpb
/*OPTIONAL*/,
6668 /*IN*/ PDEVICE_OBJECT RealDeviceObject
);
6673 IoRaiseInformationalHardError(
6674 /*IN*/ NTSTATUS ErrorStatus
,
6675 /*IN*/ PUNICODE_STRING String
/*OPTIONAL*/,
6676 /*IN*/ PKTHREAD Thread
/*OPTIONAL*/);
6681 IoReadDiskSignature(
6682 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6683 /*IN*/ ULONG BytesPerSector
,
6684 /*OUT*/ PDISK_SIGNATURE Signature
);
6689 IoReadPartitionTableEx(
6690 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6691 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX
**PartitionBuffer
);
6696 IoRegisterBootDriverReinitialization(
6697 /*IN*/ PDRIVER_OBJECT DriverObject
,
6698 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine
,
6699 /*IN*/ PVOID Context
);
6704 IoRegisterBootDriverReinitialization(
6705 /*IN*/ PDRIVER_OBJECT DriverObject
,
6706 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine
,
6707 /*IN*/ PVOID Context
);
6712 IoRegisterDeviceInterface(
6713 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6714 /*IN*/ CONST GUID
*InterfaceClassGuid
,
6715 /*IN*/ PUNICODE_STRING ReferenceString
/*OPTIONAL*/,
6716 /*OUT*/ PUNICODE_STRING SymbolicLinkName
);
6721 IoRegisterDriverReinitialization(
6722 /*IN*/ PDRIVER_OBJECT DriverObject
,
6723 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine
,
6724 /*IN*/ PVOID Context
);
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
);
6741 IoRegisterShutdownNotification(
6742 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6747 IoReleaseCancelSpinLock(
6753 IoReleaseRemoveLockAndWaitEx(
6754 /*IN*/ PIO_REMOVE_LOCK RemoveLock
,
6756 /*IN*/ ULONG RemlockSize
);
6760 * IoReleaseRemoveLockAndWait(
6761 * IN PIO_REMOVE_LOCK RemoveLock,
6764 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
6766 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6771 IoReleaseRemoveLockEx(
6772 /*IN*/ PIO_REMOVE_LOCK RemoveLock
,
6774 /*IN*/ ULONG RemlockSize
);
6778 * IoReleaseRemoveLock(
6779 * IN PIO_REMOVE_LOCK RemoveLock,
6782 #define IoReleaseRemoveLock(_RemoveLock, \
6784 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6789 IoRemoveShareAccess(
6790 /*IN*/ PFILE_OBJECT FileObject
,
6791 /*IN OUT*/ PSHARE_ACCESS ShareAccess
);
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
);
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
);
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
);
6835 IoReportTargetDeviceChange(
6836 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6837 /*IN*/ PVOID NotificationStructure
);
6842 IoReportTargetDeviceChangeAsynchronous(
6843 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6844 /*IN*/ PVOID NotificationStructure
,
6845 /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback
/*OPTIONAL*/,
6846 /*IN*/ PVOID Context
/*OPTIONAL*/);
6851 IoRequestDeviceEject(
6852 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
);
6857 * IN PDEVICE_OBJECT DeviceObject,
6859 * IN PVOID Context);
6861 #define IoRequestDpc(DeviceObject, Irp, Context)( \
6862 KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
6868 /*IN OUT*/ PIRP Irp
,
6869 /*IN*/ NTSTATUS Status
);
6873 * IoSetCancelRoutine(
6875 * IN PDRIVER_CANCEL CancelRoutine)
6877 #define IoSetCancelRoutine(_Irp, \
6879 ((PDRIVER_CANCEL) InterlockedExchangePointer( \
6880 (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)))
6884 * IoSetCompletionRoutine(
6886 * IN PIO_COMPLETION_ROUTINE CompletionRoutine,
6888 * IN BOOLEAN InvokeOnSuccess,
6889 * IN BOOLEAN InvokeOnError,
6890 * IN BOOLEAN InvokeOnCancel)
6892 #define IoSetCompletionRoutine(_Irp, \
6893 _CompletionRoutine, \
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; \
6914 IoSetCompletionRoutineEx(
6915 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6917 /*IN*/ PIO_COMPLETION_ROUTINE CompletionRoutine
,
6918 /*IN*/ PVOID Context
,
6919 /*IN*/ BOOLEAN InvokeOnSuccess
,
6920 /*IN*/ BOOLEAN InvokeOnError
,
6921 /*IN*/ BOOLEAN InvokeOnCancel
);
6926 IoSetDeviceInterfaceState(
6927 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6928 /*IN*/ BOOLEAN Enable
);
6933 IoSetHardErrorOrVerifyDevice(
6935 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6939 * IoSetNextIrpStackLocation(
6942 #define IoSetNextIrpStackLocation(_Irp) \
6944 (_Irp)->CurrentLocation--; \
6945 (_Irp)->Tail.Overlay.CurrentStackLocation--; \
6951 IoSetPartitionInformationEx(
6952 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6953 /*IN*/ ULONG PartitionNumber
,
6954 /*IN*/ struct _SET_PARTITION_INFORMATION_EX
*PartitionInfo
);
6960 /*IN*/ ACCESS_MASK DesiredAccess
,
6961 /*IN*/ ULONG DesiredShareAccess
,
6962 /*IN OUT*/ PFILE_OBJECT FileObject
,
6963 /*OUT*/ PSHARE_ACCESS ShareAccess
);
6968 IoSetStartIoAttributes(
6969 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6970 /*IN*/ BOOLEAN DeferredStartIo
,
6971 /*IN*/ BOOLEAN NonCancelable
);
6976 IoSetSystemPartition(
6977 /*IN*/ PUNICODE_STRING VolumeNameString
);
6982 IoSetThreadHardErrorMode(
6983 /*IN*/ BOOLEAN EnableHardErrors
);
6988 * IN CCHAR StackSize)
6990 #define IoSizeOfIrp(_StackSize) \
6991 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
6995 * IoSkipCurrentIrpStackLocation(
6998 #define IoSkipCurrentIrpStackLocation(_Irp) \
7000 (_Irp)->CurrentLocation++; \
7001 (_Irp)->Tail.Overlay.CurrentStackLocation++; \
7008 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7009 /*IN*/ BOOLEAN Cancelable
);
7014 IoStartNextPacketByKey(
7015 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7016 /*IN*/ BOOLEAN Cancelable
,
7023 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7025 /*IN*/ PULONG Key
/*OPTIONAL*/,
7026 /*IN*/ PDRIVER_CANCEL CancelFunction
/*OPTIONAL*/);
7032 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7038 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7043 IoUnregisterPlugPlayNotification(
7044 /*IN*/ PVOID NotificationEntry
);
7049 IoUnregisterShutdownNotification(
7050 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7055 IoUpdateShareAccess(
7056 /*IN*/ PFILE_OBJECT FileObject
,
7057 /*IN OUT*/ PSHARE_ACCESS ShareAccess
);
7062 IoVerifyPartitionTable(
7063 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7064 /*IN*/ BOOLEAN FixErrors
);
7069 IoVolumeDeviceToDosName(
7070 /*IN*/ PVOID VolumeDeviceObject
,
7071 /*OUT*/ PUNICODE_STRING DosName
);
7076 IoWMIAllocateInstanceIds(
7078 /*IN*/ ULONG InstanceCount
,
7079 /*OUT*/ ULONG
*FirstInstanceId
);
7084 IoWMIDeviceObjectToProviderId(
7085 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7090 IoWMIDeviceObjectToInstanceName(
7091 /*IN*/ PVOID DataBlockObject
,
7092 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7093 /*OUT*/ PUNICODE_STRING InstanceName
);
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
);
7109 IoWMIHandleToInstanceName(
7110 /*IN*/ PVOID DataBlockObject
,
7111 /*IN*/ HANDLE FileHandle
,
7112 /*OUT*/ PUNICODE_STRING InstanceName
);
7118 /*IN*/ GUID
*DataBlockGuid
,
7119 /*IN*/ ULONG DesiredAccess
,
7120 /*OUT*/ PVOID
*DataBlockObject
);
7126 /*IN*/ PVOID DataBlockObject
,
7127 /*IN OUT*/ ULONG
*InOutBufferSize
,
7128 /*OUT*/ PVOID OutBuffer
);
7133 IoWMIQueryAllDataMultiple(
7134 /*IN*/ PVOID
*DataBlockObjectList
,
7135 /*IN*/ ULONG ObjectCount
,
7136 /*IN OUT*/ ULONG
*InOutBufferSize
,
7137 /*OUT*/ PVOID OutBuffer
);
7142 IoWMIQuerySingleInstance(
7143 /*IN*/ PVOID DataBlockObject
,
7144 /*IN*/ PUNICODE_STRING InstanceName
,
7145 /*IN OUT*/ ULONG
*InOutBufferSize
,
7146 /*OUT*/ PVOID OutBuffer
);
7151 IoWMIQuerySingleInstanceMultiple(
7152 /*IN*/ PVOID
*DataBlockObjectList
,
7153 /*IN*/ PUNICODE_STRING InstanceNames
,
7154 /*IN*/ ULONG ObjectCount
,
7155 /*IN OUT*/ ULONG
*InOutBufferSize
,
7156 /*OUT*/ PVOID OutBuffer
);
7161 IoWMIRegistrationControl(
7162 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7163 /*IN*/ ULONG Action
);
7168 IoWMISetNotificationCallback(
7169 /*IN*/ PVOID Object
,
7170 /*IN*/ WMI_NOTIFICATION_CALLBACK Callback
,
7171 /*IN*/ PVOID Context
);
7176 IoWMISetSingleInstance(
7177 /*IN*/ PVOID DataBlockObject
,
7178 /*IN*/ PUNICODE_STRING InstanceName
,
7179 /*IN*/ ULONG Version
,
7180 /*IN*/ ULONG ValueBufferSize
,
7181 /*IN*/ PVOID ValueBuffer
);
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
);
7197 IoWMISuggestInstanceName(
7198 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
/*OPTIONAL*/,
7199 /*IN*/ PUNICODE_STRING SymbolicLinkName
/*OPTIONAL*/,
7200 /*IN*/ BOOLEAN CombineNames
,
7201 /*OUT*/ PUNICODE_STRING SuggestedInstanceName
);
7207 /*IN*/ PVOID WnodeEventItem
);
7212 IoWriteErrorLogEntry(
7213 /*IN*/ PVOID ElEntry
);
7218 IoWritePartitionTableEx(
7219 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7220 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX
*PartitionBuffer
);
7224 /** Kernel routines **/
7229 KeAcquireInStackQueuedSpinLock(
7230 /*IN*/ PKSPIN_LOCK SpinLock
,
7231 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7236 KeAcquireInStackQueuedSpinLockAtDpcLevel(
7237 /*IN*/ PKSPIN_LOCK SpinLock
,
7238 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7243 KeAcquireInterruptSpinLock(
7244 /*IN*/ PKINTERRUPT Interrupt
);
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
{
7262 PULONG ServiceCounterTable
;
7263 ULONG NumberOfServices
;
7265 } SSDT_ENTRY
, *PSSDT_ENTRY
;
7270 KeAddSystemServiceTable(
7272 /*IN*/ PULONG ServiceCounterTable
,
7273 /*IN*/ ULONG NumberOfServices
,
7275 /*IN*/ ULONG TableIndex
);
7287 /*IN*/ PEPROCESS Process
);
7293 /*IN*/ ULONG BugCheckCode
);
7299 /*IN*/ ULONG BugCheckCode
,
7300 /*IN*/ ULONG_PTR BugCheckParameter1
,
7301 /*IN*/ ULONG_PTR BugCheckParameter2
,
7302 /*IN*/ ULONG_PTR BugCheckParameter3
,
7303 /*IN*/ ULONG_PTR BugCheckParameter4
);
7309 /*IN*/ PKTIMER Timer
);
7315 /*IN*/ PRKEVENT Event
);
7320 KeDelayExecutionThread(
7321 /*IN*/ KPROCESSOR_MODE WaitMode
,
7322 /*IN*/ BOOLEAN Alertable
,
7323 /*IN*/ PLARGE_INTEGER Interval
);
7328 KeDeregisterBugCheckCallback(
7329 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord
);
7340 KeEnterCriticalRegion(
7347 * IN BOOLEAN ReadOperation,
7348 * IN BOOLEAN DmaOperation)
7350 #define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
7367 KeGetRecommendedSharedDataAlignment(
7375 /*IN*/ PKTHREAD Thread
,
7376 /*IN*/ UCHAR StateIndex
,
7377 /*IN*/ PKKERNEL_ROUTINE KernelRoutine
,
7378 /*IN*/ PKRUNDOWN_ROUTINE RundownRoutine
,
7379 /*IN*/ PKNORMAL_ROUTINE NormalRoutine
,
7381 /*IN*/ PVOID Context
);
7386 KeInitializeDeviceQueue(
7387 /*IN*/ PKDEVICE_QUEUE DeviceQueue
);
7393 /*IN*/ PRKMUTEX Mutex
,
7394 /*IN*/ ULONG Level
);
7399 KeInitializeSemaphore(
7400 /*IN*/ PRKSEMAPHORE Semaphore
,
7407 KeInitializeSpinLock(
7408 /*IN*/ PKSPIN_LOCK SpinLock
);
7414 /*IN*/ PKTIMER Timer
);
7419 KeInitializeTimerEx(
7420 /*IN*/ PKTIMER Timer
,
7421 /*IN*/ TIMER_TYPE Type
);
7426 KeInsertByKeyDeviceQueue(
7427 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7428 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
,
7429 /*IN*/ ULONG SortKey
);
7434 KeInsertDeviceQueue(
7435 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7436 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
);
7443 /*IN*/ PVOID SystemArgument1
,
7444 /*IN*/ PVOID SystemArgument2
);
7449 KeLeaveCriticalRegion(
7456 /*IN*/ PRKEVENT Event
,
7457 /*IN*/ KPRIORITY Increment
,
7458 /*IN*/ BOOLEAN Wait
);
7463 KeQueryInterruptTime(
7469 KeQueryPerformanceCounter(
7470 /*OUT*/ PLARGE_INTEGER PerformanceFrequency
/*OPTIONAL*/);
7475 KeQueryPriorityThread(
7476 /*IN*/ PRKTHREAD Thread
);
7482 /*OUT*/ PLARGE_INTEGER CurrentTime
);
7488 /*OUT*/ PLARGE_INTEGER TickCount
);
7493 KeQueryTimeIncrement(
7500 /*IN*/ PRKEVENT Event
);
7506 /*IN*/ PRKMUTEX Mutex
);
7511 KeReadStateSemaphore(
7512 /*IN*/ PRKSEMAPHORE Semaphore
);
7518 /*IN*/ PKTIMER Timer
);
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
);
7533 KeReleaseInStackQueuedSpinLock(
7534 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7539 KeReleaseInStackQueuedSpinLockFromDpcLevel(
7540 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7545 KeReleaseInterruptSpinLock(
7546 /*IN*/ PKINTERRUPT Interrupt
,
7547 /*IN*/ KIRQL OldIrql
);
7553 /*IN*/ PRKMUTEX Mutex
,
7554 /*IN*/ BOOLEAN Wait
);
7560 /*IN*/ PRKSEMAPHORE Semaphore
,
7561 /*IN*/ KPRIORITY Increment
,
7562 /*IN*/ LONG Adjustment
,
7563 /*IN*/ BOOLEAN Wait
);
7569 /*IN*/ PKSPIN_LOCK SpinLock
,
7570 /*IN*/ KIRQL NewIrql
);
7573 PKDEVICE_QUEUE_ENTRY
7575 KeRemoveByKeyDeviceQueue(
7576 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7577 /*IN*/ ULONG SortKey
);
7580 PKDEVICE_QUEUE_ENTRY
7582 KeRemoveDeviceQueue(
7583 /*IN*/ PKDEVICE_QUEUE DeviceQueue
);
7588 KeRemoveEntryDeviceQueue(
7589 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7590 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
);
7602 /*IN*/ PRKEVENT Event
);
7607 KeRestoreFloatingPointState(
7608 /*IN*/ PKFLOATING_SAVE FloatSave
);
7613 KeSaveFloatingPointState(
7614 /*OUT*/ PKFLOATING_SAVE FloatSave
);
7619 KeSetBasePriorityThread(
7620 /*IN*/ PRKTHREAD Thread
,
7621 /*IN*/ LONG Increment
);
7627 /*IN*/ PRKEVENT Event
,
7628 /*IN*/ KPRIORITY Increment
,
7629 /*IN*/ BOOLEAN Wait
);
7636 /*IN*/ KDPC_IMPORTANCE Importance
);
7641 KeSetPriorityThread(
7642 /*IN*/ PKTHREAD Thread
,
7643 /*IN*/ KPRIORITY Priority
);
7648 KeSetTargetProcessorDpc(
7650 /*IN*/ CCHAR Number
);
7656 /*IN*/ PKTIMER Timer
,
7657 /*IN*/ LARGE_INTEGER DueTime
,
7658 /*IN*/ PKDPC Dpc
/*OPTIONAL*/);
7664 /*IN*/ PKTIMER Timer
,
7665 /*IN*/ LARGE_INTEGER DueTime
,
7666 /*IN*/ LONG Period
/*OPTIONAL*/,
7667 /*IN*/ PKDPC Dpc
/*OPTIONAL*/);
7672 KeSetTimeUpdateNotifyRoutine(
7673 /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine
);
7678 KeStallExecutionProcessor(
7679 /*IN*/ ULONG MicroSeconds
);
7684 KeSynchronizeExecution(
7685 /*IN*/ PKINTERRUPT Interrupt
,
7686 /*IN*/ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine
,
7687 /*IN*/ PVOID SynchronizeContext
);
7692 KeWaitForMultipleObjects(
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*/);
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*/);
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*/);
7728 /*IN*/ KIRQL NewIrql
);
7734 /*IN*/ KIRQL NewIrql
);
7736 #define KeLowerIrql(a) KfLowerIrql(a)
7737 #define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
7745 /*IN*/ KIRQL NewIrql
);
7751 /*IN*/ KIRQL NewIrql
);
7758 KeRaiseIrqlToDpcLevel(
7761 /** Memory manager routines **/
7768 /*IN*/ ULONG NumberOfBytes
);
7773 MmAllocateContiguousMemory(
7774 /*IN*/ ULONG NumberOfBytes
,
7775 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress
);
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
);
7790 MmAllocateMappingAddress(
7791 /*IN*/ SIZE_T NumberOfBytes
,
7792 /*IN*/ ULONG PoolTag
);
7797 MmAllocateNonCachedMemory(
7798 /*IN*/ ULONG NumberOfBytes
);
7803 MmAllocatePagesForMdl(
7804 /*IN*/ PHYSICAL_ADDRESS LowAddress
,
7805 /*IN*/ PHYSICAL_ADDRESS HighAddress
,
7806 /*IN*/ PHYSICAL_ADDRESS SkipBytes
,
7807 /*IN*/ SIZE_T TotalBytes
);
7812 MmBuildMdlForNonPagedPool(
7813 /*IN OUT*/ PMDL MemoryDescriptorList
);
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
{
7836 MmFlushImageSection(
7837 /*IN*/ PSECTION_OBJECT_POINTERS SectionObjectPointer
,
7838 /*IN*/ MMFLUSH_TYPE FlushType
);
7843 MmFreeContiguousMemory(
7844 /*IN*/ PVOID BaseAddress
);
7849 MmFreeContiguousMemorySpecifyCache(
7850 /*IN*/ PVOID BaseAddress
,
7851 /*IN*/ SIZE_T NumberOfBytes
,
7852 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7857 MmFreeMappingAddress(
7858 /*IN*/ PVOID BaseAddress
,
7859 /*IN*/ ULONG PoolTag
);
7864 MmFreeNonCachedMemory(
7865 /*IN*/ PVOID BaseAddress
,
7866 /*IN*/ SIZE_T NumberOfBytes
);
7872 /*IN*/ PMDL MemoryDescriptorList
);
7876 * MmGetMdlByteCount(
7879 #define MmGetMdlByteCount(_Mdl) \
7884 * MmGetMdlByteOffset(
7887 #define MmGetMdlByteOffset(_Mdl) \
7888 ((_Mdl)->ByteOffset)
7895 #define MmGetMdlPfnArray(_Mdl) \
7896 ((PPFN_NUMBER) ((_Mdl) + 1))
7900 * MmGetMdlVirtualAddress(
7903 #define MmGetMdlVirtualAddress(_Mdl) \
7904 ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
7909 MmGetPhysicalAddress(
7910 /*IN*/ PVOID BaseAddress
);
7913 PPHYSICAL_MEMORY_RANGE
7915 MmGetPhysicalMemoryRanges(
7921 MmGetVirtualForPhysical(
7922 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
);
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
);
7938 MmMapLockedPagesWithReservedMapping(
7939 /*IN*/ PVOID MappingAddress
,
7940 /*IN*/ ULONG PoolTag
,
7941 /*IN*/ PMDL MemoryDescriptorList
,
7942 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7947 MmMapUserAddressesToPage(
7948 /*IN*/ PVOID BaseAddress
,
7949 /*IN*/ SIZE_T NumberOfBytes
,
7950 /*IN*/ PVOID PageAddress
);
7956 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
,
7957 /*IN*/ SIZE_T NumberOfBytes
,
7958 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7963 MmMapViewInSessionSpace(
7964 /*IN*/ PVOID Section
,
7965 /*OUT*/ PVOID
*MappedBase
,
7966 /*IN OUT*/ PSIZE_T ViewSize
);
7971 MmMapViewInSystemSpace(
7972 /*IN*/ PVOID Section
,
7973 /*OUT*/ PVOID
*MappedBase
,
7974 /*IN*/ PSIZE_T ViewSize
);
7979 MmMarkPhysicalMemoryAsBad(
7980 /*IN*/ PPHYSICAL_ADDRESS StartAddress
,
7981 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
);
7986 MmMarkPhysicalMemoryAsGood(
7987 /*IN*/ PPHYSICAL_ADDRESS StartAddress
,
7988 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
);
7992 * MmGetSystemAddressForMdlSafe(
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)
8006 MmGetSystemRoutineAddress(
8007 /*IN*/ PUNICODE_STRING SystemRoutineName
);
8011 * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
8015 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
8017 ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
8018 + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
8023 * IN PMDL MemoryDescriptorList,
8027 #define MmInitializeMdl(_MemoryDescriptorList, \
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; \
8044 /*IN*/ PVOID VirtualAddress
);
8049 MmIsDriverVerifying(
8050 /*IN*/ PDRIVER_OBJECT DriverObject
);
8055 MmIsThisAnNtAsSystem(
8061 MmIsVerifierEnabled(
8062 /*OUT*/ PULONG VerifierFlags
);
8067 MmLockPagableDataSection(
8068 /*IN*/ PVOID AddressWithinSection
);
8073 MmLockPagableImageSection(
8074 /*IN*/ PVOID AddressWithinSection
);
8078 * MmLockPagableCodeSection(
8079 * IN PVOID AddressWithinSection)
8081 #define MmLockPagableCodeSection MmLockPagableDataSection
8086 MmLockPagableSectionByHandle(
8087 /*IN*/ PVOID ImageSectionHandle
);
8093 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
,
8094 /*IN*/ ULONG NumberOfBytes
,
8095 /*IN*/ MEMORY_CACHING_TYPE CacheEnable
);
8101 /*IN*/ PMDL MemoryDescriptorList
,
8102 /*IN*/ KPROCESSOR_MODE AccessMode
);
8108 /*IN*/ PVOID AddressWithinSection
);
8113 MmProbeAndLockProcessPages(
8114 /*IN OUT*/ PMDL MemoryDescriptorList
,
8115 /*IN*/ PEPROCESS Process
,
8116 /*IN*/ KPROCESSOR_MODE AccessMode
,
8117 /*IN*/ LOCK_OPERATION Operation
);
8122 MmProtectMdlSystemAddress(
8123 /*IN*/ PMDL MemoryDescriptorList
,
8124 /*IN*/ ULONG NewProtect
);
8130 /*IN*/ PVOID BaseAddress
,
8131 /*IN*/ PMDL MemoryDescriptorList
);
8136 MmUnmapViewInSessionSpace(
8137 /*IN*/ PVOID MappedBase
);
8142 MmUnmapViewInSystemSpace(
8143 /*IN*/ PVOID MappedBase
);
8148 MmUnsecureVirtualMemory(
8149 /*IN*/ HANDLE SecureHandle
);
8153 * MmPrepareMdlForReuse(
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); \
8169 MmProbeAndLockPages(
8170 /*IN OUT*/ PMDL MemoryDescriptorList
,
8171 /*IN*/ KPROCESSOR_MODE AccessMode
,
8172 /*IN*/ LOCK_OPERATION Operation
);
8183 MmRemovePhysicalMemory(
8184 /*IN*/ PPHYSICAL_ADDRESS StartAddress
,
8185 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
);
8190 MmResetDriverPaging(
8191 /*IN*/ PVOID AddressWithinSection
);
8196 MmSecureVirtualMemory(
8197 /*IN*/ PVOID Address
,
8199 /*IN*/ ULONG ProbeMode
);
8206 /*IN*/ SIZE_T Length
);
8211 MmUnlockPagableImageSection(
8212 /*IN*/ PVOID ImageSectionHandle
);
8218 /*IN*/ PMDL MemoryDescriptorList
);
8224 /*IN*/ PVOID BaseAddress
,
8225 /*IN*/ SIZE_T NumberOfBytes
);
8230 MmUnmapReservedMapping(
8231 /*IN*/ PVOID BaseAddress
,
8232 /*IN*/ ULONG PoolTag
,
8233 /*IN*/ PMDL MemoryDescriptorList
);
8238 MmUnmapVideoDisplay(
8239 /*IN*/ PVOID BaseAddress
,
8240 /*IN*/ SIZE_T NumberOfBytes
);
8244 /** Object manager routines **/
8250 /*IN*/ PACCESS_STATE AccessState
,
8251 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8252 /*IN*/ PVOID Object
,
8253 /*IN*/ POBJECT_TYPE Type
);
8258 ObDereferenceSecurityDescriptor(
8259 PSECURITY_DESCRIPTOR SecurityDescriptor
,
8265 ObfDereferenceObject(
8266 /*IN*/ PVOID Object
);
8270 * ObDereferenceObject(
8273 #define ObDereferenceObject ObfDereferenceObject
8278 ObGetObjectSecurity(
8279 /*IN*/ PVOID Object
,
8280 /*OUT*/ PSECURITY_DESCRIPTOR
*SecurityDescriptor
,
8281 /*OUT*/ PBOOLEAN MemoryAllocated
);
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
);
8298 /*IN*/ PVOID Object
);
8303 ObLogSecurityDescriptor(
8304 /*IN*/ PSECURITY_DESCRIPTOR InputSecurityDescriptor
,
8305 /*OUT*/ PSECURITY_DESCRIPTOR
*OutputSecurityDescriptor
,
8306 /*IN*/ ULONG RefBias
);
8309 * ObReferenceObject(
8312 #define ObReferenceObject ObfReferenceObject
8317 ObMakeTemporaryObject(
8318 /*IN*/ PVOID Object
);
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
);
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
);
8347 ObQueryObjectAuditingByHandle(
8348 /*IN*/ HANDLE Handle
,
8349 /*OUT*/ PBOOLEAN GenerateOnClose
);
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*/);
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
);
8378 ObReferenceObjectByPointer(
8379 /*IN*/ PVOID Object
,
8380 /*IN*/ ACCESS_MASK DesiredAccess
,
8381 /*IN*/ POBJECT_TYPE ObjectType
,
8382 /*IN*/ KPROCESSOR_MODE AccessMode
);
8387 ObReferenceSecurityDescriptor(
8388 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8389 /*IN*/ ULONG Count
);
8394 ObReleaseObjectSecurity(
8395 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8396 /*IN*/ BOOLEAN MemoryAllocated
);
8400 /** Process manager routines **/
8405 PsCreateSystemProcess(
8406 /*IN*/ PHANDLE ProcessHandle
,
8407 /*IN*/ ACCESS_MASK DesiredAccess
,
8408 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
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
);
8424 * PsGetCurrentProcess(VOID)
8426 #define PsGetCurrentProcess IoGetCurrentProcess
8431 PsGetCurrentProcessId(
8436 * PsGetCurrentThread(VOID)
8438 #define PsGetCurrentThread() \
8439 ((PETHREAD) KeGetCurrentThread())
8444 PsGetCurrentThreadId(
8451 PULONG MajorVersion
/*OPTIONAL*/,
8452 PULONG MinorVersion
/*OPTIONAL*/,
8453 PULONG BuildNumber
/*OPTIONAL*/,
8454 PUNICODE_STRING CSDVersion
/*OPTIONAL*/);
8459 PsRemoveCreateThreadNotifyRoutine(
8460 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
);
8465 PsRemoveLoadImageNotifyRoutine(
8466 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine
);
8471 PsSetCreateProcessNotifyRoutine(
8472 /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine
,
8473 /*IN*/ BOOLEAN Remove
);
8478 PsSetCreateThreadNotifyRoutine(
8479 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
);
8484 PsSetLoadImageNotifyRoutine(
8485 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine
);
8490 PsTerminateSystemThread(
8491 /*IN*/ NTSTATUS ExitStatus
);
8495 /** Security reference monitor routines **/
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
);
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
);
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
);
8542 /*IN OUT*/ PSECURITY_DESCRIPTOR
*SecurityDescriptor
);
8547 SeSinglePrivilegeCheck(
8548 LUID PrivilegeValue
,
8549 KPROCESSOR_MODE PreviousMode
);
8554 SeValidSecurityDescriptor(
8555 /*IN*/ ULONG Length
,
8556 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
);
8560 /** NtXxx routines **/
8566 /*OUT*/ PHANDLE ProcessHandle
,
8567 /*IN*/ ACCESS_MASK DesiredAccess
,
8568 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8569 /*IN*/ PCLIENT_ID ClientId
/*OPTIONAL*/);
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 **/
8589 /*IN*/ HANDLE TimerHandle
,
8590 /*OUT*/ PBOOLEAN CurrentState
/*OPTIONAL*/);
8596 /*IN*/ HANDLE Handle
);
8602 /*IN*/ HANDLE Handle
);
8607 ZwCreateDirectoryObject(
8608 /*OUT*/ PHANDLE DirectoryHandle
,
8609 /*IN*/ ACCESS_MASK DesiredAccess
,
8610 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8616 /*OUT*/ PHANDLE EventHandle
,
8617 /*IN*/ ACCESS_MASK DesiredAccess
,
8618 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8619 /*IN*/ BOOLEAN ManualReset
,
8620 /*IN*/ BOOLEAN InitialState
);
8626 /*OUT*/ PHANDLE EventHandle
,
8627 /*IN*/ ACCESS_MASK DesiredAccess
,
8628 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8629 /*IN*/ BOOLEAN ManualReset
,
8630 /*IN*/ BOOLEAN InitialState
);
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
);
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*/);
8664 /*OUT*/ PHANDLE TimerHandle
,
8665 /*IN*/ ACCESS_MASK DesiredAccess
,
8666 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
/*OPTIONAL*/,
8667 /*IN*/ TIMER_TYPE TimerType
);
8673 /*IN*/ HANDLE KeyHandle
);
8679 /*IN*/ HANDLE KeyHandle
,
8680 /*IN*/ PUNICODE_STRING ValueName
);
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
);
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
);
8716 /*IN*/ HANDLE KeyHandle
,
8718 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass
,
8719 /*OUT*/ PVOID KeyInformation
,
8720 /*IN*/ ULONG Length
,
8721 /*OUT*/ PULONG ResultLength
);
8726 ZwEnumerateValueKey(
8727 /*IN*/ HANDLE KeyHandle
,
8729 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass
,
8730 /*OUT*/ PVOID KeyValueInformation
,
8731 /*IN*/ ULONG Length
,
8732 /*OUT*/ PULONG ResultLength
);
8738 /*IN*/ HANDLE KeyHandle
);
8743 ZwMakeTemporaryObject(
8744 /*IN*/ HANDLE Handle
);
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
);
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
);
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
);
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
);
8802 /*OUT*/ PHANDLE KeyHandle
,
8803 /*IN*/ ACCESS_MASK DesiredAccess
,
8804 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8810 /*OUT*/ PHANDLE SectionHandle
,
8811 /*IN*/ ACCESS_MASK DesiredAccess
,
8812 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8817 ZwOpenSymbolicLinkObject(
8818 /*OUT*/ PHANDLE LinkHandle
,
8819 /*IN*/ ACCESS_MASK DesiredAccess
,
8820 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8826 /*OUT*/ PHANDLE TimerHandle
,
8827 /*IN*/ ACCESS_MASK DesiredAccess
,
8828 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
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
);
8844 /*IN*/ HANDLE KeyHandle
,
8845 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass
,
8846 /*OUT*/ PVOID KeyInformation
,
8847 /*IN*/ ULONG Length
,
8848 /*OUT*/ PULONG ResultLength
);
8853 ZwQuerySymbolicLinkObject(
8854 /*IN*/ HANDLE LinkHandle
,
8855 /*IN OUT*/ PUNICODE_STRING LinkTarget
,
8856 /*OUT*/ PULONG ReturnedLength
/*OPTIONAL*/);
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
);
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*/);
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*/);
8901 /*IN*/ HANDLE EventHandle
,
8902 /*IN*/ PULONG NumberOfThreadsReleased
);
8908 /*IN*/ HANDLE EventHandle
,
8909 /*IN*/ PULONG NumberOfThreadsReleased
);
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
);
8924 ZwSetInformationThread(
8925 /*IN*/ HANDLE ThreadHandle
,
8926 /*IN*/ THREADINFOCLASS ThreadInformationClass
,
8927 /*IN*/ PVOID ThreadInformation
,
8928 /*IN*/ ULONG ThreadInformationLength
);
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*/);
8946 /*IN*/ HANDLE KeyHandle
,
8947 /*IN*/ PUNICODE_STRING ValueName
,
8948 /*IN*/ ULONG TitleIndex
/*OPTIONAL*/,
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
8962 NtUnmapViewOfSection(
8963 /*IN*/ HANDLE ProcessHandle
,
8964 /*IN*/ PVOID BaseAddress
);
8969 ZwUnmapViewOfSection(
8970 /*IN*/ HANDLE ProcessHandle
,
8971 /*IN*/ PVOID BaseAddress
);
8976 NtWaitForSingleObject(
8977 /*IN*/ HANDLE Object
,
8978 /*IN*/ BOOLEAN Alertable
,
8979 /*IN*/ PLARGE_INTEGER Time
);
8984 ZwWaitForSingleObject(
8985 /*IN*/ HANDLE Object
,
8986 /*IN*/ BOOLEAN Alertable
,
8987 /*IN*/ PLARGE_INTEGER Time
);
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*/);
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 **/
9025 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9026 /*IN OUT*/ PIRP Irp
);
9031 PoRegisterDeviceForIdleDetection(
9032 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9033 /*IN*/ ULONG ConservationIdleTime
,
9034 /*IN*/ ULONG PerformanceIdleTime
,
9035 /*IN*/ DEVICE_POWER_STATE State
);
9040 PoRegisterSystemState(
9041 /*IN*/ PVOID StateHandle
,
9042 /*IN*/ EXECUTION_STATE Flags
);
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*/);
9058 PoRequestShutdownEvent(
9059 /*OUT*/ PVOID
*Event
);
9065 PULONG IdlePointer
);
9071 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9072 /*IN*/ POWER_STATE_TYPE Type
,
9073 /*IN*/ POWER_STATE State
);
9079 /*IN*/ EXECUTION_STATE Flags
);
9084 PoStartNextPowerIrp(
9090 PoUnregisterSystemState(
9091 /*IN*/ PVOID StateHandle
);
9095 /** WMI library support routines **/
9101 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9103 /*IN*/ NTSTATUS Status
,
9104 /*IN*/ ULONG BufferUsed
,
9105 /*IN*/ CCHAR PriorityBoost
);
9111 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9113 /*IN*/ ULONG InstanceIndex
,
9114 /*IN*/ ULONG EventDataSize
,
9115 /*IN*/ PVOID EventData
);
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*/);
9131 /*IN*/ PWMILIB_CONTEXT WmiLibInfo
,
9132 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9134 /*OUT*/ PSYSCTL_IRP_DISPOSITION IrpDisposition
);
9140 /*IN*/ TRACEHANDLE LoggerHandle
,
9141 /*IN*/ ULONG MessageFlags
,
9142 /*IN*/ LPGUID MessageGuid
,
9143 /*IN*/ USHORT MessageNumber
,
9147 /* FIXME: Get va_list from where? */
9152 /*IN*/ TRACEHANDLE LoggerHandle
,
9153 /*IN*/ ULONG MessageFlags
,
9154 /*IN*/ LPGUID MessageGuid
,
9155 /*IN*/ USHORT MessageNumber
,
9156 /*IN*/ va_list MessageArgList
);
9160 /** Kernel debugger routines **/
9183 DbgBreakPointWithStatus(
9184 /*IN*/ ULONG Status
);
9197 /*IN*/ ULONG ComponentId
,
9205 DbgPrintReturnControlC(
9212 DbgQueryDebugFilterState(
9213 /*IN*/ ULONG ComponentId
,
9214 /*IN*/ ULONG Level
);
9219 DbgSetDebugFilterState(
9220 /*IN*/ ULONG ComponentId
,
9222 /*IN*/ BOOLEAN State
);
9226 #define KdPrint(_x_) DbgPrint _x_
9227 #define KdPrintEx(_x_) DbgPrintEx _x_
9228 #define KdBreakPoint() DbgBreakPoint()
9229 #define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
9233 #define KdPrint(_x_)
9234 #define KdPrintEx(_x_)
9235 #define KdBreakPoint()
9236 #define KdBreakPointWithStatus(s)
9240 extern NTOSAPI PBOOLEAN KdDebuggerNotPresent
;
9241 extern NTOSAPI PBOOLEAN KdDebuggerEnabled
;
9242 #define KD_DEBUGGER_ENABLED *KdDebuggerEnabled
9243 #define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
9249 #endif /* __WINDDK_H */