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()->Number)
3834 #if __USE_NTOSKRNL__
3835 /* CAREFUL: These are exported from ntoskrnl.exe as __fastcall functions,
3836 but are also exported from kernel32.dll and declared in winbase.h as
3838 #if !defined(__INTERLOCKED_DECLARED)
3839 #define __INTERLOCKED_DECLARED
3844 InterlockedIncrement(
3845 /*IN*/ LONG VOLATILE
*Addend
);
3850 InterlockedDecrement(
3851 /*IN*/ LONG 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
);
4899 #define RtlStringCbCopyA(dst, dst_len, src) strncpy(dst, src, dst_len)
4900 #define RtlStringCbPrintfA(args...) snprintf(args)
4901 #define RtlStringCbVPrintfA(args...) vsnprintf(args)
4907 /*IN*/ PRTL_BITMAP BitMapHeader
,
4908 /*IN*/ ULONG BitNumber
);
4913 RtlTimeFieldsToTime(
4914 /*IN*/ PTIME_FIELDS TimeFields
,
4915 /*IN*/ PLARGE_INTEGER Time
);
4920 RtlTimeToTimeFields(
4921 /*IN*/ PLARGE_INTEGER Time
,
4922 /*IN*/ PTIME_FIELDS TimeFields
);
4928 /*IN*/ ULONG Source
);
4933 RtlUlonglongByteSwap(
4934 /*IN*/ ULONGLONG Source
);
4939 RtlUnicodeStringToAnsiSize(
4940 /*IN*/ PUNICODE_STRING UnicodeString
);
4945 RtlUnicodeStringToAnsiString(
4946 /*IN OUT*/ PANSI_STRING DestinationString
,
4947 /*IN*/ PUNICODE_STRING SourceString
,
4948 /*IN*/ BOOLEAN AllocateDestinationString
);
4953 RtlUnicodeStringToInteger(
4954 /*IN*/ PUNICODE_STRING String
,
4955 /*IN*/ ULONG Base
/*OPTIONAL*/,
4956 /*OUT*/ PULONG Value
);
4961 RtlUpcaseUnicodeChar(
4962 /*IN*/ WCHAR SourceCharacter
);
4967 RtlUpcaseUnicodeString(
4968 /*IN OUT*/ PUNICODE_STRING DestinationString
/*OPTIONAL*/,
4969 /*IN*/ PCUNICODE_STRING SourceString
,
4970 /*IN*/ BOOLEAN AllocateDestinationString
);
4976 /*IN*/ CHAR Character
);
4982 /*IN OUT*/ PSTRING DestinationString
,
4983 /*IN*/ PSTRING SourceString
);
4989 /*IN*/ USHORT Source
);
4994 RtlValidRelativeSecurityDescriptor(
4995 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
4996 /*IN*/ ULONG SecurityDescriptorLength
,
4997 /*IN*/ SECURITY_INFORMATION RequiredInformation
);
5002 RtlValidSecurityDescriptor(
5003 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
);
5008 RtlVerifyVersionInfo(
5009 /*IN*/ PRTL_OSVERSIONINFOEXW VersionInfo
,
5010 /*IN*/ ULONG TypeMask
,
5011 /*IN*/ ULONGLONG ConditionMask
);
5016 RtlVolumeDeviceToDosName(
5017 /*IN*/ PVOID VolumeDeviceObject
,
5018 /*OUT*/ PUNICODE_STRING DosName
);
5024 /*OUT*/ PVOID
*Callers
,
5026 /*IN*/ ULONG Flags
);
5031 RtlWriteRegistryValue(
5032 /*IN*/ ULONG RelativeTo
,
5034 /*IN*/ PCWSTR ValueName
,
5035 /*IN*/ ULONG ValueType
,
5036 /*IN*/ PVOID ValueData
,
5037 /*IN*/ ULONG ValueLength
);
5042 RtlxUnicodeStringToAnsiSize(
5043 /*IN*/ PUNICODE_STRING UnicodeString
);
5048 * IN VOID UNALIGNED *Destination,
5051 #ifndef RtlZeroMemory
5052 #define RtlZeroMemory(Destination, Length) \
5053 memset(Destination, 0, Length)
5056 #ifndef RtlZeroBytes
5057 #define RtlZeroBytes RtlZeroMemory
5061 /** Executive support routines **/
5067 /*IN*/ PFAST_MUTEX FastMutex
);
5072 ExAcquireFastMutexUnsafe(
5073 /*IN*/ PFAST_MUTEX FastMutex
);
5078 ExAcquireResourceExclusiveLite(
5079 /*IN*/ PERESOURCE Resource
,
5080 /*IN*/ BOOLEAN Wait
);
5085 ExAcquireResourceSharedLite(
5086 /*IN*/ PERESOURCE Resource
,
5087 /*IN*/ BOOLEAN Wait
);
5092 ExAcquireSharedStarveExclusive(
5093 /*IN*/ PERESOURCE Resource
,
5094 /*IN*/ BOOLEAN Wait
);
5099 ExAcquireSharedWaitForExclusive(
5100 /*IN*/ PERESOURCE Resource
,
5101 /*IN*/ BOOLEAN Wait
);
5107 ExInterlockedPopEntrySList(
5108 /*IN*/ PSLIST_HEADER ListHead
,
5109 /*IN*/ PKSPIN_LOCK Lock
);
5115 ExInterlockedPushEntrySList(
5116 /*IN*/ PSLIST_HEADER ListHead
,
5117 /*IN*/ PSINGLE_LIST_ENTRY ListEntry
,
5118 /*IN*/ PKSPIN_LOCK Lock
);
5121 #if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
5122 #define ExInterlockedPopEntrySList(_ListHead, \
5124 InterlockedPopEntrySList(_ListHead)
5126 #define ExInterlockedPushEntrySList(_ListHead, \
5129 InterlockedPushEntrySList(_ListHead, _ListEntry)
5130 #endif /* __USE_NTOSKRNL__ */
5132 #define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
5134 static __inline PVOID
5135 ExAllocateFromNPagedLookasideList(
5136 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
)
5140 Lookaside
->TotalAllocates
++;
5141 Entry
= ExInterlockedPopEntrySList(&Lookaside
->ListHead
,
5142 &Lookaside
->Obsoleted
);
5143 if (Entry
== NULL
) {
5144 Lookaside
->_DDK_DUMMYUNION_MEMBER(AllocateMisses
)++;
5145 Entry
= (Lookaside
->Allocate
)(Lookaside
->Type
,
5152 static __inline VOID
5153 ExFreeToNPagedLookasideList(
5154 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
,
5157 Lookaside
->TotalFrees
++;
5158 if (ExQueryDepthSList(&Lookaside
->ListHead
) >= Lookaside
->Depth
) {
5159 Lookaside
->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses
)++;
5160 (Lookaside
->Free
)(Entry
);
5162 ExInterlockedPushEntrySList(&Lookaside
->ListHead
,
5163 (PSLIST_ENTRY
)Entry
,
5164 &Lookaside
->Obsoleted
);
5168 #if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
5170 static __inline PVOID
5171 ExAllocateFromPagedLookasideList(
5172 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
)
5176 Lookaside
->TotalAllocates
++;
5177 Entry
= InterlockedPopEntrySList(&Lookaside
->ListHead
);
5178 if (Entry
== NULL
) {
5179 Lookaside
->_DDK_DUMMYUNION_MEMBER(AllocateMisses
)++;
5180 Entry
= (Lookaside
->Allocate
)(Lookaside
->Type
,
5187 static __inline VOID
5188 ExFreeToPagedLookasideList(
5189 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
,
5192 Lookaside
->TotalFrees
++;
5193 if (ExQueryDepthSList(&Lookaside
->ListHead
) >= Lookaside
->Depth
) {
5194 Lookaside
->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses
)++;
5195 (Lookaside
->Free
)(Entry
);
5197 InterlockedPushEntrySList(&Lookaside
->ListHead
,
5198 (PSLIST_ENTRY
)Entry
);
5202 #else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5207 ExAllocateFromPagedLookasideList(
5208 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
);
5213 ExFreeToPagedLookasideList(
5214 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
,
5215 /*IN*/ PVOID Entry
);
5217 #endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501) */
5222 ExAllocatePoolWithQuotaTag(
5223 /*IN*/ POOL_TYPE PoolType
,
5224 /*IN*/ SIZE_T NumberOfBytes
,
5230 ExAllocatePoolWithTag(
5231 /*IN*/ POOL_TYPE PoolType
,
5232 /*IN*/ SIZE_T NumberOfBytes
,
5237 #define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
5238 #define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
5240 #else /* !POOL_TAGGING */
5246 /*IN*/ POOL_TYPE PoolType
,
5247 /*IN*/ SIZE_T NumberOfBytes
);
5252 ExAllocatePoolWithQuota(
5253 /*IN*/ POOL_TYPE PoolType
,
5254 /*IN*/ SIZE_T NumberOfBytes
);
5256 #endif /* POOL_TAGGING */
5261 ExAllocatePoolWithTagPriority(
5262 /*IN*/ POOL_TYPE PoolType
,
5263 /*IN*/ SIZE_T NumberOfBytes
,
5265 /*IN*/ EX_POOL_PRIORITY Priority
);
5270 ExConvertExclusiveToSharedLite(
5271 /*IN*/ PERESOURCE Resource
);
5277 /*OUT*/ PCALLBACK_OBJECT
*CallbackObject
,
5278 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
5279 /*IN*/ BOOLEAN Create
,
5280 /*IN*/ BOOLEAN AllowMultipleCallbacks
);
5285 ExDeleteNPagedLookasideList(
5286 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
);
5291 ExDeletePagedLookasideList(
5292 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
);
5297 ExDeleteResourceLite(
5298 /*IN*/ PERESOURCE Resource
);
5306 #define PROTECTED_POOL 0x80000000
5309 #define ExFreePool(P) ExFreePoolWithTag(P, 0)
5321 * ExGetCurrentResourceThread(
5324 #define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
5329 ExGetExclusiveWaiterCount(
5330 /*IN*/ PERESOURCE Resource
);
5341 ExGetSharedWaiterCount(
5342 /*IN*/ PERESOURCE Resource
);
5348 /*IN*/ PRKEVENT Event
,
5349 /*IN*/ EVENT_TYPE Type
,
5350 /*IN*/ BOOLEAN State
);
5354 * ExInitializeFastMutex(
5355 * IN PFAST_MUTEX FastMutex)
5357 #define ExInitializeFastMutex(_FastMutex) \
5359 (_FastMutex)->Count = 1; \
5360 (_FastMutex)->Owner = NULL; \
5361 (_FastMutex)->Contention = 0; \
5362 KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
5368 ExInitializeNPagedLookasideList(
5369 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside
,
5370 /*IN*/ PALLOCATE_FUNCTION Allocate
/*OPTIONAL*/,
5371 /*IN*/ PFREE_FUNCTION Free
/*OPTIONAL*/,
5375 /*IN*/ USHORT Depth
);
5380 ExInitializePagedLookasideList(
5381 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside
,
5382 /*IN*/ PALLOCATE_FUNCTION Allocate
/*OPTIONAL*/,
5383 /*IN*/ PFREE_FUNCTION Free
/*OPTIONAL*/,
5387 /*IN*/ USHORT Depth
);
5392 ExInitializeResourceLite(
5393 /*IN*/ PERESOURCE Resource
);
5397 * InitializeSListHead(
5398 * IN PSLIST_HEADER SListHead)
5400 #define InitializeSListHead(_SListHead) \
5401 (_SListHead)->Alignment = 0
5403 #define ExInitializeSListHead InitializeSListHead
5408 ExInterlockedAddLargeInteger(
5409 /*IN*/ PLARGE_INTEGER Addend
,
5410 /*IN*/ LARGE_INTEGER Increment
,
5411 /*IN*/ PKSPIN_LOCK Lock
);
5416 ExInterlockedAddLargeStatistic(
5417 /*IN*/ PLARGE_INTEGER Addend
,
5418 /*IN*/ ULONG Increment
);
5423 ExInterlockedAddUlong(
5424 /*IN*/ PULONG Addend
,
5425 /*IN*/ ULONG Increment
,
5431 ExfInterlockedAddUlong(
5432 /*IN*/ PULONG Addend
,
5433 /*IN*/ ULONG Increment
,
5440 ExInterlockedCompareExchange64(
5441 /*IN OUT*/ PLONGLONG Destination
,
5442 /*IN*/ PLONGLONG Exchange
,
5443 /*IN*/ PLONGLONG Comparand
,
5444 /*IN*/ PKSPIN_LOCK Lock
);
5449 ExInterlockedFlushSList(
5450 /*IN*/ PSLIST_HEADER ListHead
);
5455 ExInterlockedInsertHeadList(
5456 /*IN*/ PLIST_ENTRY ListHead
,
5457 /*IN*/ PLIST_ENTRY ListEntry
,
5458 /*IN*/ PKSPIN_LOCK Lock
);
5463 ExfInterlockedInsertHeadList(
5464 /*IN*/ PLIST_ENTRY ListHead
,
5465 /*IN*/ PLIST_ENTRY ListEntry
,
5466 /*IN*/ PKSPIN_LOCK Lock
);
5471 ExInterlockedInsertTailList(
5472 /*IN*/ PLIST_ENTRY ListHead
,
5473 /*IN*/ PLIST_ENTRY ListEntry
,
5474 /*IN*/ PKSPIN_LOCK Lock
);
5479 ExfInterlockedInsertTailList(
5480 /*IN*/ PLIST_ENTRY ListHead
,
5481 /*IN*/ PLIST_ENTRY ListEntry
,
5482 /*IN*/ PKSPIN_LOCK Lock
);
5487 ExInterlockedPopEntryList(
5488 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5489 /*IN*/ PKSPIN_LOCK Lock
);
5494 ExfInterlockedPopEntryList(
5495 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5496 /*IN*/ PKSPIN_LOCK Lock
);
5502 ExInterlockedPushEntryList(
5503 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5504 /*IN*/ PSINGLE_LIST_ENTRY ListEntry
,
5505 /*IN*/ PKSPIN_LOCK Lock
);
5510 ExfInterlockedPushEntryList(
5511 /*IN*/ PSINGLE_LIST_ENTRY ListHead
,
5512 /*IN*/ PSINGLE_LIST_ENTRY ListEntry
,
5513 /*IN*/ PKSPIN_LOCK Lock
);
5519 ExInterlockedRemoveHeadList(
5520 /*IN*/ PLIST_ENTRY ListHead
,
5521 /*IN*/ PKSPIN_LOCK Lock
);
5526 ExfInterlockedRemoveHeadList(
5527 /*IN*/ PLIST_ENTRY ListHead
,
5528 /*IN*/ PKSPIN_LOCK Lock
);
5534 ExIsProcessorFeaturePresent(
5535 /*IN*/ ULONG ProcessorFeature
);
5540 ExIsResourceAcquiredExclusiveLite(
5541 /*IN*/ PERESOURCE Resource
);
5546 ExIsResourceAcquiredLite(
5547 /*IN*/ PERESOURCE Resource
);
5552 ExIsResourceAcquiredSharedLite(
5553 /*IN*/ PERESOURCE Resource
);
5558 ExLocalTimeToSystemTime(
5559 /*IN*/ PLARGE_INTEGER LocalTime
,
5560 /*OUT*/ PLARGE_INTEGER SystemTime
);
5566 /*IN*/ PCALLBACK_OBJECT CallbackObject
,
5567 /*IN*/ PVOID Argument1
,
5568 /*IN*/ PVOID Argument2
);
5573 ExRaiseAccessViolation(
5579 ExRaiseDatatypeMisalignment(
5586 /*IN*/ NTSTATUS Status
);
5592 /*IN*/ PCALLBACK_OBJECT CallbackObject
,
5593 /*IN*/ PCALLBACK_FUNCTION CallbackFunction
,
5594 /*IN*/ PVOID CallbackContext
);
5599 ExReinitializeResourceLite(
5600 /*IN*/ PERESOURCE Resource
);
5606 /*IN*/ PFAST_MUTEX FastMutex
);
5611 ExReleaseFastMutexUnsafe(
5612 /*IN*/ PFAST_MUTEX FastMutex
);
5617 ExReleaseResourceForThreadLite(
5618 /*IN*/ PERESOURCE Resource
,
5619 /*IN*/ ERESOURCE_THREAD ResourceThreadId
);
5624 ExReleaseResourceLite(
5625 /*IN*/ PERESOURCE Resource
);
5630 ExSetResourceOwnerPointer(
5631 /*IN*/ PERESOURCE Resource
,
5632 /*IN*/ PVOID OwnerPointer
);
5637 ExSetTimerResolution(
5638 /*IN*/ ULONG DesiredTime
,
5639 /*IN*/ BOOLEAN SetResolution
);
5644 ExSystemTimeToLocalTime(
5645 /*IN*/ PLARGE_INTEGER SystemTime
,
5646 /*OUT*/ PLARGE_INTEGER LocalTime
);
5651 ExTryToAcquireFastMutex(
5652 /*IN*/ PFAST_MUTEX FastMutex
);
5657 ExTryToAcquireResourceExclusiveLite(
5658 /*IN*/ PERESOURCE Resource
);
5663 ExUnregisterCallback(
5664 /*IN*/ PVOID CbRegistration
);
5670 /*OUT*/ UUID
*Uuid
);
5676 /*IN*/ SUITE_TYPE SuiteType
);
5680 #define PAGED_CODE() { \
5681 if (KeGetCurrentIrql() > APC_LEVEL) { \
5682 KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
5689 #define PAGED_CODE()
5697 /*IN*/ CONST VOID
*Address
,
5698 /*IN*/ ULONG Length
,
5699 /*IN*/ ULONG Alignment
);
5705 /*IN*/ CONST VOID
*Address
,
5706 /*IN*/ ULONG Length
,
5707 /*IN*/ ULONG Alignment
);
5711 /** Configuration manager routines **/
5717 /*IN*/ PEX_CALLBACK_FUNCTION Function
,
5718 /*IN*/ PVOID Context
,
5719 /*IN OUT*/ PLARGE_INTEGER Cookie
);
5724 CmUnRegisterCallback(
5725 /*IN*/ LARGE_INTEGER Cookie
);
5729 /** Filesystem runtime library routines **/
5734 FsRtlIsTotalDeviceFailure(
5735 /*IN*/ NTSTATUS Status
);
5739 /** Hardware abstraction layer routines **/
5745 /*IN*/ PDEVICE_OBJECT DeviceObject
,
5746 /*IN*/ ULONG SectorSize
,
5747 /*IN*/ ULONG MBRTypeIdentifier
,
5748 /*OUT*/ PVOID Buffer
);
5753 READ_PORT_BUFFER_UCHAR(
5755 /*IN*/ PUCHAR Buffer
,
5756 /*IN*/ ULONG Count
);
5761 READ_PORT_BUFFER_ULONG(
5763 /*IN*/ PULONG Buffer
,
5764 /*IN*/ ULONG Count
);
5769 READ_PORT_BUFFER_USHORT(
5770 /*IN*/ PUSHORT Port
,
5771 /*IN*/ PUSHORT Buffer
,
5772 /*IN*/ ULONG Count
);
5778 /*IN*/ PUCHAR Port
);
5784 /*IN*/ PULONG Port
);
5790 /*IN*/ PUSHORT Port
);
5795 READ_REGISTER_BUFFER_UCHAR(
5796 /*IN*/ PUCHAR Register
,
5797 /*IN*/ PUCHAR Buffer
,
5798 /*IN*/ ULONG Count
);
5803 READ_REGISTER_BUFFER_ULONG(
5804 /*IN*/ PULONG Register
,
5805 /*IN*/ PULONG Buffer
,
5806 /*IN*/ ULONG Count
);
5811 READ_REGISTER_BUFFER_USHORT(
5812 /*IN*/ PUSHORT Register
,
5813 /*IN*/ PUSHORT Buffer
,
5814 /*IN*/ ULONG Count
);
5819 READ_REGISTER_UCHAR(
5820 /*IN*/ PUCHAR Register
);
5825 READ_REGISTER_ULONG(
5826 /*IN*/ PULONG Register
);
5831 READ_REGISTER_USHORT(
5832 /*IN*/ PUSHORT Register
);
5837 WRITE_PORT_BUFFER_UCHAR(
5839 /*IN*/ PUCHAR Buffer
,
5840 /*IN*/ ULONG Count
);
5845 WRITE_PORT_BUFFER_ULONG(
5847 /*IN*/ PULONG Buffer
,
5848 /*IN*/ ULONG Count
);
5853 WRITE_PORT_BUFFER_USHORT(
5854 /*IN*/ PUSHORT Port
,
5855 /*IN*/ PUSHORT Buffer
,
5856 /*IN*/ ULONG Count
);
5863 /*IN*/ UCHAR Value
);
5870 /*IN*/ ULONG Value
);
5876 /*IN*/ PUSHORT Port
,
5877 /*IN*/ USHORT Value
);
5882 WRITE_REGISTER_BUFFER_UCHAR(
5883 /*IN*/ PUCHAR Register
,
5884 /*IN*/ PUCHAR Buffer
,
5885 /*IN*/ ULONG Count
);
5890 WRITE_REGISTER_BUFFER_ULONG(
5891 /*IN*/ PULONG Register
,
5892 /*IN*/ PULONG Buffer
,
5893 /*IN*/ ULONG Count
);
5898 WRITE_REGISTER_BUFFER_USHORT(
5899 /*IN*/ PUSHORT Register
,
5900 /*IN*/ PUSHORT Buffer
,
5901 /*IN*/ ULONG Count
);
5906 WRITE_REGISTER_UCHAR(
5907 /*IN*/ PUCHAR Register
,
5908 /*IN*/ UCHAR Value
);
5913 WRITE_REGISTER_ULONG(
5914 /*IN*/ PULONG Register
,
5915 /*IN*/ ULONG Value
);
5920 WRITE_REGISTER_USHORT(
5921 /*IN*/ PUSHORT Register
,
5922 /*IN*/ USHORT Value
);
5924 /** I/O manager routines **/
5929 IoAcquireCancelSpinLock(
5930 /*OUT*/ PKIRQL Irql
);
5935 IoAcquireRemoveLockEx(
5936 /*IN*/ PIO_REMOVE_LOCK RemoveLock
,
5937 /*IN*/ PVOID Tag
/*OPTIONAL*/,
5940 /*IN*/ ULONG RemlockSize
);
5944 * IoAcquireRemoveLock(
5945 * IN PIO_REMOVE_LOCK RemoveLock,
5946 * IN PVOID Tag OPTIONAL)
5948 #define IoAcquireRemoveLock(_RemoveLock, \
5950 IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
5954 * IoAdjustPagingPathCount(
5956 * IN BOOLEAN Increment)
5958 #define IoAdjustPagingPathCount(_Count, \
5963 InterlockedIncrement(_Count); \
5967 InterlockedDecrement(_Count); \
5974 IoAllocateController(
5975 /*IN*/ PCONTROLLER_OBJECT ControllerObject
,
5976 /*IN*/ PDEVICE_OBJECT DeviceObject
,
5977 /*IN*/ PDRIVER_CONTROL ExecutionRoutine
,
5978 /*IN*/ PVOID Context
);
5983 IoAllocateDriverObjectExtension(
5984 /*IN*/ PDRIVER_OBJECT DriverObject
,
5985 /*IN*/ PVOID ClientIdentificationAddress
,
5986 /*IN*/ ULONG DriverObjectExtensionSize
,
5987 /*OUT*/ PVOID
*DriverObjectExtension
);
5989 typedef struct _IO_ERROR_LOG_PACKET
{
5990 UCHAR MajorFunctionCode
;
5992 USHORT DumpDataSize
;
5993 USHORT NumberOfStrings
;
5994 USHORT StringOffset
;
5995 USHORT EventCategory
;
5997 ULONG UniqueErrorValue
;
5998 NTSTATUS FinalStatus
;
5999 ULONG SequenceNumber
;
6000 ULONG IoControlCode
;
6001 LARGE_INTEGER DeviceOffset
;
6003 } IO_ERROR_LOG_PACKET
, *PIO_ERROR_LOG_PACKET
;
6008 IoAllocateErrorLogEntry(
6009 /*IN*/ PVOID IoObject
,
6010 /*IN*/ UCHAR EntrySize
);
6016 /*IN*/ CCHAR StackSize
,
6017 /*IN*/ BOOLEAN ChargeQuota
);
6023 /*IN*/ PVOID VirtualAddress
,
6024 /*IN*/ ULONG Length
,
6025 /*IN*/ BOOLEAN SecondaryBuffer
,
6026 /*IN*/ BOOLEAN ChargeQuota
,
6027 /*IN OUT*/ PIRP Irp
/*OPTIONAL*/);
6033 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6036 * VOID IoAssignArcName(
6037 * IN PUNICODE_STRING ArcName,
6038 * IN PUNICODE_STRING DeviceName);
6040 #define IoAssignArcName(_ArcName, _DeviceName) ( \
6041 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
6047 /*IN*/ PDEVICE_OBJECT SourceDevice
,
6048 /*IN*/ PUNICODE_STRING TargetDevice
,
6049 /*OUT*/ PDEVICE_OBJECT
*AttachedDevice
);
6054 IoAttachDeviceToDeviceStack(
6055 /*IN*/ PDEVICE_OBJECT SourceDevice
,
6056 /*IN*/ PDEVICE_OBJECT TargetDevice
);
6061 IoBuildAsynchronousFsdRequest(
6062 /*IN*/ ULONG MajorFunction
,
6063 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6064 /*IN OUT*/ PVOID Buffer
/*OPTIONAL*/,
6065 /*IN*/ ULONG Length
/*OPTIONAL*/,
6066 /*IN*/ PLARGE_INTEGER StartingOffset
/*OPTIONAL*/,
6067 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock
/*OPTIONAL*/);
6072 IoBuildDeviceIoControlRequest(
6073 /*IN*/ ULONG IoControlCode
,
6074 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6075 /*IN*/ PVOID InputBuffer
/*OPTIONAL*/,
6076 /*IN*/ ULONG InputBufferLength
,
6077 /*OUT*/ PVOID OutputBuffer
/*OPTIONAL*/,
6078 /*IN*/ ULONG OutputBufferLength
,
6079 /*IN*/ BOOLEAN InternalDeviceIoControl
,
6080 /*IN*/ PKEVENT Event
,
6081 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
);
6087 /*IN*/ PMDL SourceMdl
,
6088 /*IN OUT*/ PMDL TargetMdl
,
6089 /*IN*/ PVOID VirtualAddress
,
6090 /*IN*/ ULONG Length
);
6095 IoBuildSynchronousFsdRequest(
6096 /*IN*/ ULONG MajorFunction
,
6097 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6098 /*IN OUT*/ PVOID Buffer
/*OPTIONAL*/,
6099 /*IN*/ ULONG Length
/*OPTIONAL*/,
6100 /*IN*/ PLARGE_INTEGER StartingOffset
/*OPTIONAL*/,
6101 /*IN*/ PKEVENT Event
,
6102 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
);
6108 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6109 /*IN OUT*/ PIRP Irp
);
6114 * IN PDEVICE_OBJECT DeviceObject,
6117 #define IoCallDriver IofCallDriver
6123 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6124 /*IN*/ PFILE_OBJECT FileObject
);
6136 /*IN*/ ACCESS_MASK DesiredAccess
,
6137 /*IN*/ ULONG DesiredShareAccess
,
6138 /*IN OUT*/ PFILE_OBJECT FileObject
,
6139 /*IN OUT*/ PSHARE_ACCESS ShareAccess
,
6140 /*IN*/ BOOLEAN Update
);
6147 /*IN*/ CCHAR PriorityBoost
);
6151 * IoCompleteRequest(
6153 * IN CCHAR PriorityBoost)
6155 #define IoCompleteRequest IofCompleteRequest
6161 /*OUT*/ PKINTERRUPT
*InterruptObject
,
6162 /*IN*/ PKSERVICE_ROUTINE ServiceRoutine
,
6163 /*IN*/ PVOID ServiceContext
,
6164 /*IN*/ PKSPIN_LOCK SpinLock
/*OPTIONAL*/,
6165 /*IN*/ ULONG Vector
,
6167 /*IN*/ KIRQL SynchronizeIrql
,
6168 /*IN*/ KINTERRUPT_MODE InterruptMode
,
6169 /*IN*/ BOOLEAN ShareVector
,
6170 /*IN*/ KAFFINITY ProcessorEnableMask
,
6171 /*IN*/ BOOLEAN FloatingSave
);
6174 * PIO_STACK_LOCATION
6175 * IoGetCurrentIrpStackLocation(
6178 #define IoGetCurrentIrpStackLocation(_Irp) \
6179 ((_Irp)->Tail.Overlay.CurrentStackLocation)
6182 * PIO_STACK_LOCATION
6183 * IoGetNextIrpStackLocation(
6186 #define IoGetNextIrpStackLocation(_Irp) \
6187 ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
6191 * IoCopyCurrentIrpStackLocationToNext(
6194 #define IoCopyCurrentIrpStackLocationToNext(_Irp) \
6196 PIO_STACK_LOCATION _IrpSp; \
6197 PIO_STACK_LOCATION _NextIrpSp; \
6198 _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
6199 _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
6200 RtlCopyMemory(_NextIrpSp, _IrpSp, \
6201 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
6202 _NextIrpSp->Control = 0; \
6215 /*IN*/ PDRIVER_OBJECT DriverObject
,
6216 /*IN*/ ULONG DeviceExtensionSize
,
6217 /*IN*/ PUNICODE_STRING DeviceName
/*OPTIONAL*/,
6218 /*IN*/ DEVICE_TYPE DeviceType
,
6219 /*IN*/ ULONG DeviceCharacteristics
,
6220 /*IN*/ BOOLEAN Exclusive
,
6221 /*OUT*/ PDEVICE_OBJECT
*DeviceObject
);
6227 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6228 /*IN*/ PCREATE_DISK Disk
);
6234 /*OUT*/ PHANDLE FileHandle
,
6235 /*IN*/ ACCESS_MASK DesiredAccess
,
6236 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
6237 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
6238 /*IN*/ PLARGE_INTEGER AllocationSize
/*OPTIONAL*/,
6239 /*IN*/ ULONG FileAttributes
,
6240 /*IN*/ ULONG ShareAccess
,
6241 /*IN*/ ULONG Disposition
,
6242 /*IN*/ ULONG CreateOptions
,
6243 /*IN*/ PVOID EaBuffer
/*OPTIONAL*/,
6244 /*IN*/ ULONG EaLength
,
6245 /*IN*/ CREATE_FILE_TYPE CreateFileType
,
6246 /*IN*/ PVOID ExtraCreateParameters
/*OPTIONAL*/,
6247 /*IN*/ ULONG Options
);
6252 IoCreateNotificationEvent(
6253 /*IN*/ PUNICODE_STRING EventName
,
6254 /*OUT*/ PHANDLE EventHandle
);
6259 IoCreateSymbolicLink(
6260 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6261 /*IN*/ PUNICODE_STRING DeviceName
);
6266 IoCreateSynchronizationEvent(
6267 /*IN*/ PUNICODE_STRING EventName
,
6268 /*OUT*/ PHANDLE EventHandle
);
6273 IoCreateUnprotectedSymbolicLink(
6274 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6275 /*IN*/ PUNICODE_STRING DeviceName
);
6282 /*IN*/ PIO_CSQ_INSERT_IRP CsqInsertIrp
,
6283 /*IN*/ PIO_CSQ_REMOVE_IRP CsqRemoveIrp
,
6284 /*IN*/ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp
,
6285 /*IN*/ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock
,
6286 /*IN*/ PIO_CSQ_RELEASE_LOCK CsqReleaseLock
,
6287 /*IN*/ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp
);
6295 /*IN*/ PIO_CSQ_IRP_CONTEXT Context
);
6302 /*IN*/ PIO_CSQ_IRP_CONTEXT Context
);
6309 /*IN*/ PVOID PeekContext
);
6315 /*IN*/ PCONTROLLER_OBJECT ControllerObject
);
6321 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6326 IoDeleteSymbolicLink(
6327 /*IN*/ PUNICODE_STRING SymbolicLinkName
);
6331 * IoDeassignArcName(
6332 * IN PUNICODE_STRING ArcName)
6334 #define IoDeassignArcName IoDeleteSymbolicLink
6340 /*IN OUT*/ PDEVICE_OBJECT TargetDevice
);
6345 IoDisconnectInterrupt(
6346 /*IN*/ PKINTERRUPT InterruptObject
);
6351 IoForwardIrpSynchronously(
6352 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6355 #define IoForwardAndCatchIrp IoForwardIrpSynchronously
6361 /*IN*/ PCONTROLLER_OBJECT ControllerObject
);
6366 IoFreeErrorLogEntry(
6385 /*IN*/ PIO_WORKITEM pIOWorkItem
);
6390 IoGetAttachedDevice(
6391 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6396 IoGetAttachedDeviceReference(
6397 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6402 IoGetBootDiskInformation(
6403 /*IN OUT*/ PBOOTDISK_INFORMATION BootDiskInformation
,
6407 PCONFIGURATION_INFORMATION
6409 IoGetConfigurationInformation(
6415 IoGetCurrentProcess(
6421 IoGetDeviceInterfaceAlias(
6422 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6423 /*IN*/ CONST GUID
*AliasInterfaceClassGuid
,
6424 /*OUT*/ PUNICODE_STRING AliasSymbolicLinkName
);
6429 IoGetDeviceInterfaces(
6430 /*IN*/ CONST GUID
*InterfaceClassGuid
,
6431 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
/*OPTIONAL*/,
6433 /*OUT*/ PWSTR
*SymbolicLinkList
);
6438 IoGetDeviceObjectPointer(
6439 /*IN*/ PUNICODE_STRING ObjectName
,
6440 /*IN*/ ACCESS_MASK DesiredAccess
,
6441 /*OUT*/ PFILE_OBJECT
*FileObject
,
6442 /*OUT*/ PDEVICE_OBJECT
*DeviceObject
);
6447 IoGetDeviceProperty(
6448 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6449 /*IN*/ DEVICE_REGISTRY_PROPERTY DeviceProperty
,
6450 /*IN*/ ULONG BufferLength
,
6451 /*OUT*/ PVOID PropertyBuffer
,
6452 /*OUT*/ PULONG ResultLength
);
6457 IoGetDeviceToVerify(
6458 /*IN*/ PETHREAD Thread
);
6464 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6465 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription
,
6466 /*IN OUT*/ PULONG NumberOfMapRegisters
);
6471 IoGetDriverObjectExtension(
6472 /*IN*/ PDRIVER_OBJECT DriverObject
,
6473 /*IN*/ PVOID ClientIdentificationAddress
);
6478 IoGetFileObjectGenericMapping(
6483 * IoGetFunctionCodeFromCtlCode(
6484 * IN ULONG ControlCode)
6486 #define IoGetFunctionCodeFromCtlCode(_ControlCode) \
6487 (((_ControlCode) >> 2) & 0x00000FFF)
6498 IoGetRelatedDeviceObject(
6499 /*IN*/ PFILE_OBJECT FileObject
);
6504 IoGetRemainingStackSize(
6511 /*OUT*/ PULONG_PTR LowLimit
,
6512 /*OUT*/ PULONG_PTR HighLimit
);
6519 /*IN*/ PKDEFERRED_ROUTINE DeferredRoutine
,
6520 /*IN*/ PVOID DeferredContext
);
6524 * IoInitializeDpcRequest(
6525 * IN PDEVICE_OBJECT DeviceObject,
6526 * IN PIO_DPC_ROUTINE DpcRoutine)
6528 #define IoInitializeDpcRequest(_DeviceObject, \
6530 KeInitializeDpc(&(_DeviceObject)->Dpc, \
6531 (PKDEFERRED_ROUTINE) (_DpcRoutine), \
6538 /*IN OUT*/ PIRP Irp
,
6539 /*IN*/ USHORT PacketSize
,
6540 /*IN*/ CCHAR StackSize
);
6545 IoInitializeRemoveLockEx(
6546 /*IN*/ PIO_REMOVE_LOCK Lock
,
6547 /*IN*/ ULONG AllocateTag
,
6548 /*IN*/ ULONG MaxLockedMinutes
,
6549 /*IN*/ ULONG HighWatermark
,
6550 /*IN*/ ULONG RemlockSize
);
6553 * IoInitializeRemoveLock(
6554 * IN PIO_REMOVE_LOCK Lock,
6555 * IN ULONG AllocateTag,
6556 * IN ULONG MaxLockedMinutes,
6557 * IN ULONG HighWatermark)
6559 #define IoInitializeRemoveLock( \
6560 Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
6561 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
6562 HighWatermark, sizeof(IO_REMOVE_LOCK))
6568 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6569 /*IN*/ PIO_TIMER_ROUTINE TimerRoutine
,
6570 /*IN*/ PVOID Context
);
6575 IoInvalidateDeviceRelations(
6576 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6577 /*IN*/ DEVICE_RELATION_TYPE Type
);
6582 IoInvalidateDeviceState(
6583 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
);
6589 /*IN*/ PIRP Irp
/*OPTIONAL*/);
6593 * IoIsErrorUserInduced(
6594 * IN NTSTATUS Status);
6596 #define IoIsErrorUserInduced(Status) \
6597 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
6598 ((Status) == STATUS_IO_TIMEOUT) || \
6599 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
6600 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
6601 ((Status) == STATUS_VERIFY_REQUIRED) || \
6602 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
6603 ((Status) == STATUS_WRONG_VOLUME)))
6608 IoIsWdmVersionAvailable(
6609 /*IN*/ UCHAR MajorVersion
,
6610 /*IN*/ UCHAR MinorVersion
);
6615 IoMakeAssociatedIrp(
6617 /*IN*/ CCHAR StackSize
);
6624 #define IoMarkIrpPending(_Irp) \
6625 (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
6630 IoOpenDeviceInterfaceRegistryKey(
6631 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6632 /*IN*/ ACCESS_MASK DesiredAccess
,
6633 /*OUT*/ PHANDLE DeviceInterfaceKey
);
6638 IoOpenDeviceRegistryKey(
6639 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6640 /*IN*/ ULONG DevInstKeyType
,
6641 /*IN*/ ACCESS_MASK DesiredAccess
,
6642 /*OUT*/ PHANDLE DevInstRegKey
);
6647 IoQueryDeviceDescription(
6648 /*IN*/ PINTERFACE_TYPE BusType
/*OPTIONAL*/,
6649 /*IN*/ PULONG BusNumber
/*OPTIONAL*/,
6650 /*IN*/ PCONFIGURATION_TYPE ControllerType
/*OPTIONAL*/,
6651 /*IN*/ PULONG ControllerNumber
/*OPTIONAL*/,
6652 /*IN*/ PCONFIGURATION_TYPE PeripheralType
/*OPTIONAL*/,
6653 /*IN*/ PULONG PeripheralNumber
/*OPTIONAL*/,
6654 /*IN*/ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine
,
6655 /*IN*/ PVOID Context
);
6661 /*IN*/ PIO_WORKITEM pIOWorkItem
,
6662 /*IN*/ PIO_WORKITEM_ROUTINE Routine
,
6663 /*IN*/ WORK_QUEUE_TYPE QueueType
,
6664 /*IN*/ PVOID Context
);
6671 /*IN*/ PVPB Vpb
/*OPTIONAL*/,
6672 /*IN*/ PDEVICE_OBJECT RealDeviceObject
);
6677 IoRaiseInformationalHardError(
6678 /*IN*/ NTSTATUS ErrorStatus
,
6679 /*IN*/ PUNICODE_STRING String
/*OPTIONAL*/,
6680 /*IN*/ PKTHREAD Thread
/*OPTIONAL*/);
6685 IoReadDiskSignature(
6686 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6687 /*IN*/ ULONG BytesPerSector
,
6688 /*OUT*/ PDISK_SIGNATURE Signature
);
6693 IoReadPartitionTableEx(
6694 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6695 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX
**PartitionBuffer
);
6700 IoRegisterBootDriverReinitialization(
6701 /*IN*/ PDRIVER_OBJECT DriverObject
,
6702 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine
,
6703 /*IN*/ PVOID Context
);
6708 IoRegisterBootDriverReinitialization(
6709 /*IN*/ PDRIVER_OBJECT DriverObject
,
6710 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine
,
6711 /*IN*/ PVOID Context
);
6716 IoRegisterDeviceInterface(
6717 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6718 /*IN*/ CONST GUID
*InterfaceClassGuid
,
6719 /*IN*/ PUNICODE_STRING ReferenceString
/*OPTIONAL*/,
6720 /*OUT*/ PUNICODE_STRING SymbolicLinkName
);
6725 IoRegisterDriverReinitialization(
6726 /*IN*/ PDRIVER_OBJECT DriverObject
,
6727 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine
,
6728 /*IN*/ PVOID Context
);
6733 IoRegisterPlugPlayNotification(
6734 /*IN*/ IO_NOTIFICATION_EVENT_CATEGORY EventCategory
,
6735 /*IN*/ ULONG EventCategoryFlags
,
6736 /*IN*/ PVOID EventCategoryData
/*OPTIONAL*/,
6737 /*IN*/ PDRIVER_OBJECT DriverObject
,
6738 /*IN*/ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine
,
6739 /*IN*/ PVOID Context
,
6740 /*OUT*/ PVOID
*NotificationEntry
);
6745 IoRegisterShutdownNotification(
6746 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6751 IoReleaseCancelSpinLock(
6757 IoReleaseRemoveLockAndWaitEx(
6758 /*IN*/ PIO_REMOVE_LOCK RemoveLock
,
6760 /*IN*/ ULONG RemlockSize
);
6764 * IoReleaseRemoveLockAndWait(
6765 * IN PIO_REMOVE_LOCK RemoveLock,
6768 #define IoReleaseRemoveLockAndWait(_RemoveLock, \
6770 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6775 IoReleaseRemoveLockEx(
6776 /*IN*/ PIO_REMOVE_LOCK RemoveLock
,
6778 /*IN*/ ULONG RemlockSize
);
6782 * IoReleaseRemoveLock(
6783 * IN PIO_REMOVE_LOCK RemoveLock,
6786 #define IoReleaseRemoveLock(_RemoveLock, \
6788 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6793 IoRemoveShareAccess(
6794 /*IN*/ PFILE_OBJECT FileObject
,
6795 /*IN OUT*/ PSHARE_ACCESS ShareAccess
);
6800 IoReportDetectedDevice(
6801 /*IN*/ PDRIVER_OBJECT DriverObject
,
6802 /*IN*/ INTERFACE_TYPE LegacyBusType
,
6803 /*IN*/ ULONG BusNumber
,
6804 /*IN*/ ULONG SlotNumber
,
6805 /*IN*/ PCM_RESOURCE_LIST ResourceList
,
6806 /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements
/*OPTIONAL*/,
6807 /*IN*/ BOOLEAN ResourceAssigned
,
6808 /*IN OUT*/ PDEVICE_OBJECT
*DeviceObject
);
6813 IoReportResourceForDetection(
6814 /*IN*/ PDRIVER_OBJECT DriverObject
,
6815 /*IN*/ PCM_RESOURCE_LIST DriverList
/*OPTIONAL*/,
6816 /*IN*/ ULONG DriverListSize
/*OPTIONAL*/,
6817 /*IN*/ PDEVICE_OBJECT DeviceObject
/*OPTIONAL*/,
6818 /*IN*/ PCM_RESOURCE_LIST DeviceList
/*OPTIONAL*/,
6819 /*IN*/ ULONG DeviceListSize
/*OPTIONAL*/,
6820 /*OUT*/ PBOOLEAN ConflictDetected
);
6825 IoReportResourceUsage(
6826 /*IN*/ PUNICODE_STRING DriverClassName
/*OPTIONAL*/,
6827 /*IN*/ PDRIVER_OBJECT DriverObject
,
6828 /*IN*/ PCM_RESOURCE_LIST DriverList
/*OPTIONAL*/,
6829 /*IN*/ ULONG DriverListSize
/*OPTIONAL*/,
6830 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6831 /*IN*/ PCM_RESOURCE_LIST DeviceList
/*OPTIONAL*/,
6832 /*IN*/ ULONG DeviceListSize
/*OPTIONAL*/,
6833 /*IN*/ BOOLEAN OverrideConflict
,
6834 /*OUT*/ PBOOLEAN ConflictDetected
);
6839 IoReportTargetDeviceChange(
6840 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6841 /*IN*/ PVOID NotificationStructure
);
6846 IoReportTargetDeviceChangeAsynchronous(
6847 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
,
6848 /*IN*/ PVOID NotificationStructure
,
6849 /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback
/*OPTIONAL*/,
6850 /*IN*/ PVOID Context
/*OPTIONAL*/);
6855 IoRequestDeviceEject(
6856 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
);
6861 * IN PDEVICE_OBJECT DeviceObject,
6863 * IN PVOID Context);
6865 #define IoRequestDpc(DeviceObject, Irp, Context)( \
6866 KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
6872 /*IN OUT*/ PIRP Irp
,
6873 /*IN*/ NTSTATUS Status
);
6877 * IoSetCancelRoutine(
6879 * IN PDRIVER_CANCEL CancelRoutine)
6881 #define IoSetCancelRoutine(_Irp, \
6883 ((PDRIVER_CANCEL) InterlockedExchangePointer( \
6884 (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine)))
6888 * IoSetCompletionRoutine(
6890 * IN PIO_COMPLETION_ROUTINE CompletionRoutine,
6892 * IN BOOLEAN InvokeOnSuccess,
6893 * IN BOOLEAN InvokeOnError,
6894 * IN BOOLEAN InvokeOnCancel)
6896 #define IoSetCompletionRoutine(_Irp, \
6897 _CompletionRoutine, \
6903 PIO_STACK_LOCATION _IrpSp; \
6904 ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
6905 _CompletionRoutine != NULL : TRUE); \
6906 _IrpSp = IoGetNextIrpStackLocation(_Irp); \
6907 _IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
6908 _IrpSp->Context = (_Context); \
6909 _IrpSp->Control = 0; \
6910 if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
6911 if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
6912 if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
6918 IoSetCompletionRoutineEx(
6919 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6921 /*IN*/ PIO_COMPLETION_ROUTINE CompletionRoutine
,
6922 /*IN*/ PVOID Context
,
6923 /*IN*/ BOOLEAN InvokeOnSuccess
,
6924 /*IN*/ BOOLEAN InvokeOnError
,
6925 /*IN*/ BOOLEAN InvokeOnCancel
);
6930 IoSetDeviceInterfaceState(
6931 /*IN*/ PUNICODE_STRING SymbolicLinkName
,
6932 /*IN*/ BOOLEAN Enable
);
6937 IoSetHardErrorOrVerifyDevice(
6939 /*IN*/ PDEVICE_OBJECT DeviceObject
);
6943 * IoSetNextIrpStackLocation(
6946 #define IoSetNextIrpStackLocation(_Irp) \
6948 (_Irp)->CurrentLocation--; \
6949 (_Irp)->Tail.Overlay.CurrentStackLocation--; \
6955 IoSetPartitionInformationEx(
6956 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6957 /*IN*/ ULONG PartitionNumber
,
6958 /*IN*/ struct _SET_PARTITION_INFORMATION_EX
*PartitionInfo
);
6964 /*IN*/ ACCESS_MASK DesiredAccess
,
6965 /*IN*/ ULONG DesiredShareAccess
,
6966 /*IN OUT*/ PFILE_OBJECT FileObject
,
6967 /*OUT*/ PSHARE_ACCESS ShareAccess
);
6972 IoSetStartIoAttributes(
6973 /*IN*/ PDEVICE_OBJECT DeviceObject
,
6974 /*IN*/ BOOLEAN DeferredStartIo
,
6975 /*IN*/ BOOLEAN NonCancelable
);
6980 IoSetSystemPartition(
6981 /*IN*/ PUNICODE_STRING VolumeNameString
);
6986 IoSetThreadHardErrorMode(
6987 /*IN*/ BOOLEAN EnableHardErrors
);
6992 * IN CCHAR StackSize)
6994 #define IoSizeOfIrp(_StackSize) \
6995 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
6999 * IoSkipCurrentIrpStackLocation(
7002 #define IoSkipCurrentIrpStackLocation(_Irp) \
7004 (_Irp)->CurrentLocation++; \
7005 (_Irp)->Tail.Overlay.CurrentStackLocation++; \
7012 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7013 /*IN*/ BOOLEAN Cancelable
);
7018 IoStartNextPacketByKey(
7019 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7020 /*IN*/ BOOLEAN Cancelable
,
7027 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7029 /*IN*/ PULONG Key
/*OPTIONAL*/,
7030 /*IN*/ PDRIVER_CANCEL CancelFunction
/*OPTIONAL*/);
7036 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7042 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7047 IoUnregisterPlugPlayNotification(
7048 /*IN*/ PVOID NotificationEntry
);
7053 IoUnregisterShutdownNotification(
7054 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7059 IoUpdateShareAccess(
7060 /*IN*/ PFILE_OBJECT FileObject
,
7061 /*IN OUT*/ PSHARE_ACCESS ShareAccess
);
7066 IoVerifyPartitionTable(
7067 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7068 /*IN*/ BOOLEAN FixErrors
);
7073 IoVolumeDeviceToDosName(
7074 /*IN*/ PVOID VolumeDeviceObject
,
7075 /*OUT*/ PUNICODE_STRING DosName
);
7080 IoWMIAllocateInstanceIds(
7082 /*IN*/ ULONG InstanceCount
,
7083 /*OUT*/ ULONG
*FirstInstanceId
);
7088 IoWMIDeviceObjectToProviderId(
7089 /*IN*/ PDEVICE_OBJECT DeviceObject
);
7094 IoWMIDeviceObjectToInstanceName(
7095 /*IN*/ PVOID DataBlockObject
,
7096 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7097 /*OUT*/ PUNICODE_STRING InstanceName
);
7103 /*IN*/ PVOID DataBlockObject
,
7104 /*IN*/ PUNICODE_STRING InstanceName
,
7105 /*IN*/ ULONG MethodId
,
7106 /*IN*/ ULONG InBufferSize
,
7107 /*IN OUT*/ PULONG OutBufferSize
,
7108 /*IN OUT*/ PUCHAR InOutBuffer
);
7113 IoWMIHandleToInstanceName(
7114 /*IN*/ PVOID DataBlockObject
,
7115 /*IN*/ HANDLE FileHandle
,
7116 /*OUT*/ PUNICODE_STRING InstanceName
);
7122 /*IN*/ GUID
*DataBlockGuid
,
7123 /*IN*/ ULONG DesiredAccess
,
7124 /*OUT*/ PVOID
*DataBlockObject
);
7130 /*IN*/ PVOID DataBlockObject
,
7131 /*IN OUT*/ ULONG
*InOutBufferSize
,
7132 /*OUT*/ PVOID OutBuffer
);
7137 IoWMIQueryAllDataMultiple(
7138 /*IN*/ PVOID
*DataBlockObjectList
,
7139 /*IN*/ ULONG ObjectCount
,
7140 /*IN OUT*/ ULONG
*InOutBufferSize
,
7141 /*OUT*/ PVOID OutBuffer
);
7146 IoWMIQuerySingleInstance(
7147 /*IN*/ PVOID DataBlockObject
,
7148 /*IN*/ PUNICODE_STRING InstanceName
,
7149 /*IN OUT*/ ULONG
*InOutBufferSize
,
7150 /*OUT*/ PVOID OutBuffer
);
7155 IoWMIQuerySingleInstanceMultiple(
7156 /*IN*/ PVOID
*DataBlockObjectList
,
7157 /*IN*/ PUNICODE_STRING InstanceNames
,
7158 /*IN*/ ULONG ObjectCount
,
7159 /*IN OUT*/ ULONG
*InOutBufferSize
,
7160 /*OUT*/ PVOID OutBuffer
);
7165 IoWMIRegistrationControl(
7166 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7167 /*IN*/ ULONG Action
);
7172 IoWMISetNotificationCallback(
7173 /*IN*/ PVOID Object
,
7174 /*IN*/ WMI_NOTIFICATION_CALLBACK Callback
,
7175 /*IN*/ PVOID Context
);
7180 IoWMISetSingleInstance(
7181 /*IN*/ PVOID DataBlockObject
,
7182 /*IN*/ PUNICODE_STRING InstanceName
,
7183 /*IN*/ ULONG Version
,
7184 /*IN*/ ULONG ValueBufferSize
,
7185 /*IN*/ PVOID ValueBuffer
);
7191 /*IN*/ PVOID DataBlockObject
,
7192 /*IN*/ PUNICODE_STRING InstanceName
,
7193 /*IN*/ ULONG DataItemId
,
7194 /*IN*/ ULONG Version
,
7195 /*IN*/ ULONG ValueBufferSize
,
7196 /*IN*/ PVOID ValueBuffer
);
7201 IoWMISuggestInstanceName(
7202 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject
/*OPTIONAL*/,
7203 /*IN*/ PUNICODE_STRING SymbolicLinkName
/*OPTIONAL*/,
7204 /*IN*/ BOOLEAN CombineNames
,
7205 /*OUT*/ PUNICODE_STRING SuggestedInstanceName
);
7211 /*IN*/ PVOID WnodeEventItem
);
7216 IoWriteErrorLogEntry(
7217 /*IN*/ PVOID ElEntry
);
7222 IoWritePartitionTableEx(
7223 /*IN*/ PDEVICE_OBJECT DeviceObject
,
7224 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX
*PartitionBuffer
);
7228 /** Kernel routines **/
7233 KeAcquireInStackQueuedSpinLock(
7234 /*IN*/ PKSPIN_LOCK SpinLock
,
7235 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7240 KeAcquireInStackQueuedSpinLockAtDpcLevel(
7241 /*IN*/ PKSPIN_LOCK SpinLock
,
7242 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7247 KeAcquireInterruptSpinLock(
7248 /*IN*/ PKINTERRUPT Interrupt
);
7254 /*IN*/ PKSPIN_LOCK SpinLock
,
7255 /*OUT*/ PKIRQL OldIrql
);
7257 /* System Service Dispatch Table */
7258 typedef PVOID (NTAPI
* SSDT
)(VOID
);
7259 typedef SSDT
* PSSDT
;
7261 /* System Service Parameters Table */
7262 typedef UCHAR SSPT
, * PSSPT
;
7264 typedef struct _SSDT_ENTRY
{
7266 PULONG ServiceCounterTable
;
7267 ULONG NumberOfServices
;
7269 } SSDT_ENTRY
, *PSSDT_ENTRY
;
7274 KeAddSystemServiceTable(
7276 /*IN*/ PULONG ServiceCounterTable
,
7277 /*IN*/ ULONG NumberOfServices
,
7279 /*IN*/ ULONG TableIndex
);
7291 /*IN*/ PEPROCESS Process
);
7297 /*IN*/ ULONG BugCheckCode
);
7303 /*IN*/ ULONG BugCheckCode
,
7304 /*IN*/ ULONG_PTR BugCheckParameter1
,
7305 /*IN*/ ULONG_PTR BugCheckParameter2
,
7306 /*IN*/ ULONG_PTR BugCheckParameter3
,
7307 /*IN*/ ULONG_PTR BugCheckParameter4
);
7313 /*IN*/ PKTIMER Timer
);
7319 /*IN*/ PRKEVENT Event
);
7324 KeDelayExecutionThread(
7325 /*IN*/ KPROCESSOR_MODE WaitMode
,
7326 /*IN*/ BOOLEAN Alertable
,
7327 /*IN*/ PLARGE_INTEGER Interval
);
7332 KeDeregisterBugCheckCallback(
7333 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord
);
7344 KeEnterCriticalRegion(
7351 * IN BOOLEAN ReadOperation,
7352 * IN BOOLEAN DmaOperation)
7354 #define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
7359 KeFlushQueuedDpcs(VOID
);
7376 KeGetRecommendedSharedDataAlignment(
7384 /*IN*/ PKTHREAD Thread
,
7385 /*IN*/ UCHAR StateIndex
,
7386 /*IN*/ PKKERNEL_ROUTINE KernelRoutine
,
7387 /*IN*/ PKRUNDOWN_ROUTINE RundownRoutine
,
7388 /*IN*/ PKNORMAL_ROUTINE NormalRoutine
,
7390 /*IN*/ PVOID Context
);
7395 KeInitializeDeviceQueue(
7396 /*IN*/ PKDEVICE_QUEUE DeviceQueue
);
7402 /*IN*/ PRKMUTEX Mutex
,
7403 /*IN*/ ULONG Level
);
7408 KeInitializeSemaphore(
7409 /*IN*/ PRKSEMAPHORE Semaphore
,
7416 KeInitializeSpinLock(
7417 /*IN*/ PKSPIN_LOCK SpinLock
);
7423 /*IN*/ PKTIMER Timer
);
7428 KeInitializeTimerEx(
7429 /*IN*/ PKTIMER Timer
,
7430 /*IN*/ TIMER_TYPE Type
);
7435 KeInsertByKeyDeviceQueue(
7436 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7437 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
,
7438 /*IN*/ ULONG SortKey
);
7443 KeInsertDeviceQueue(
7444 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7445 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
);
7452 /*IN*/ PVOID SystemArgument1
,
7453 /*IN*/ PVOID SystemArgument2
);
7458 KeLeaveCriticalRegion(
7461 #define KeMemoryBarrier() asm("mfence;")
7467 /*IN*/ PRKEVENT Event
,
7468 /*IN*/ KPRIORITY Increment
,
7469 /*IN*/ BOOLEAN Wait
);
7474 KeQueryInterruptTime(
7480 KeQueryPerformanceCounter(
7481 /*OUT*/ PLARGE_INTEGER PerformanceFrequency
/*OPTIONAL*/);
7486 KeQueryPriorityThread(
7487 /*IN*/ PRKTHREAD Thread
);
7493 /*OUT*/ PLARGE_INTEGER CurrentTime
);
7499 /*OUT*/ PLARGE_INTEGER TickCount
);
7504 KeQueryTimeIncrement(
7511 /*IN*/ PRKEVENT Event
);
7517 /*IN*/ PRKMUTEX Mutex
);
7522 KeReadStateSemaphore(
7523 /*IN*/ PRKSEMAPHORE Semaphore
);
7529 /*IN*/ PKTIMER Timer
);
7534 KeRegisterBugCheckCallback(
7535 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord
,
7536 /*IN*/ PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine
,
7537 /*IN*/ PVOID Buffer
,
7538 /*IN*/ ULONG Length
,
7539 /*IN*/ PUCHAR Component
);
7544 KeReleaseInStackQueuedSpinLock(
7545 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7550 KeReleaseInStackQueuedSpinLockFromDpcLevel(
7551 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
);
7556 KeReleaseInterruptSpinLock(
7557 /*IN*/ PKINTERRUPT Interrupt
,
7558 /*IN*/ KIRQL OldIrql
);
7564 /*IN*/ PRKMUTEX Mutex
,
7565 /*IN*/ BOOLEAN Wait
);
7571 /*IN*/ PRKSEMAPHORE Semaphore
,
7572 /*IN*/ KPRIORITY Increment
,
7573 /*IN*/ LONG Adjustment
,
7574 /*IN*/ BOOLEAN Wait
);
7580 /*IN*/ PKSPIN_LOCK SpinLock
,
7581 /*IN*/ KIRQL NewIrql
);
7584 PKDEVICE_QUEUE_ENTRY
7586 KeRemoveByKeyDeviceQueue(
7587 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7588 /*IN*/ ULONG SortKey
);
7591 PKDEVICE_QUEUE_ENTRY
7593 KeRemoveDeviceQueue(
7594 /*IN*/ PKDEVICE_QUEUE DeviceQueue
);
7599 KeRemoveEntryDeviceQueue(
7600 /*IN*/ PKDEVICE_QUEUE DeviceQueue
,
7601 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
);
7613 /*IN*/ PRKEVENT Event
);
7618 KeRestoreFloatingPointState(
7619 /*IN*/ PKFLOATING_SAVE FloatSave
);
7624 KeSaveFloatingPointState(
7625 /*OUT*/ PKFLOATING_SAVE FloatSave
);
7630 KeSetBasePriorityThread(
7631 /*IN*/ PRKTHREAD Thread
,
7632 /*IN*/ LONG Increment
);
7638 /*IN*/ PRKEVENT Event
,
7639 /*IN*/ KPRIORITY Increment
,
7640 /*IN*/ BOOLEAN Wait
);
7647 /*IN*/ KDPC_IMPORTANCE Importance
);
7652 KeSetPriorityThread(
7653 /*IN*/ PKTHREAD Thread
,
7654 /*IN*/ KPRIORITY Priority
);
7659 KeSetTargetProcessorDpc(
7661 /*IN*/ CCHAR Number
);
7667 /*IN*/ PKTIMER Timer
,
7668 /*IN*/ LARGE_INTEGER DueTime
,
7669 /*IN*/ PKDPC Dpc
/*OPTIONAL*/);
7675 /*IN*/ PKTIMER Timer
,
7676 /*IN*/ LARGE_INTEGER DueTime
,
7677 /*IN*/ LONG Period
/*OPTIONAL*/,
7678 /*IN*/ PKDPC Dpc
/*OPTIONAL*/);
7683 KeSetTimeUpdateNotifyRoutine(
7684 /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine
);
7689 KeStallExecutionProcessor(
7690 /*IN*/ ULONG MicroSeconds
);
7695 KeSynchronizeExecution(
7696 /*IN*/ PKINTERRUPT Interrupt
,
7697 /*IN*/ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine
,
7698 /*IN*/ PVOID SynchronizeContext
);
7703 KeWaitForMultipleObjects(
7705 /*IN*/ PVOID Object
[],
7706 /*IN*/ WAIT_TYPE WaitType
,
7707 /*IN*/ KWAIT_REASON WaitReason
,
7708 /*IN*/ KPROCESSOR_MODE WaitMode
,
7709 /*IN*/ BOOLEAN Alertable
,
7710 /*IN*/ PLARGE_INTEGER Timeout
/*OPTIONAL */,
7711 /*IN*/ PKWAIT_BLOCK WaitBlockArray
/*OPTIONAL*/);
7716 KeWaitForMutexObject(
7717 /*IN*/ PRKMUTEX Mutex
,
7718 /*IN*/ KWAIT_REASON WaitReason
,
7719 /*IN*/ KPROCESSOR_MODE WaitMode
,
7720 /*IN*/ BOOLEAN Alertable
,
7721 /*IN*/ PLARGE_INTEGER Timeout
/*OPTIONAL*/);
7726 KeWaitForSingleObject(
7727 /*IN*/ PVOID Object
,
7728 /*IN*/ KWAIT_REASON WaitReason
,
7729 /*IN*/ KPROCESSOR_MODE WaitMode
,
7730 /*IN*/ BOOLEAN Alertable
,
7731 /*IN*/ PLARGE_INTEGER Timeout
/*OPTIONAL*/);
7737 /*IN*/ KIRQL new_irql
,
7738 /*OUT*/ PKIRQL old_irql
);
7749 KeRaiseIrqlToDpcLevel(
7752 /** Memory manager routines **/
7759 /*IN*/ ULONG NumberOfBytes
);
7764 MmAllocateContiguousMemory(
7765 /*IN*/ ULONG NumberOfBytes
,
7766 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress
);
7771 MmAllocateContiguousMemorySpecifyCache(
7772 /*IN*/ SIZE_T NumberOfBytes
,
7773 /*IN*/ PHYSICAL_ADDRESS LowestAcceptableAddress
,
7774 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress
,
7775 /*IN*/ PHYSICAL_ADDRESS BoundaryAddressMultiple
/*OPTIONAL*/,
7776 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7781 MmAllocateMappingAddress(
7782 /*IN*/ SIZE_T NumberOfBytes
,
7783 /*IN*/ ULONG PoolTag
);
7788 MmAllocateNonCachedMemory(
7789 /*IN*/ ULONG NumberOfBytes
);
7794 MmAllocatePagesForMdl(
7795 /*IN*/ PHYSICAL_ADDRESS LowAddress
,
7796 /*IN*/ PHYSICAL_ADDRESS HighAddress
,
7797 /*IN*/ PHYSICAL_ADDRESS SkipBytes
,
7798 /*IN*/ SIZE_T TotalBytes
);
7803 MmBuildMdlForNonPagedPool(
7804 /*IN OUT*/ PMDL MemoryDescriptorList
);
7810 /*OUT*/ PSECTION_OBJECT
*SectionObject
,
7811 /*IN*/ ACCESS_MASK DesiredAccess
,
7812 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
/*OPTIONAL*/,
7813 /*IN*/ PLARGE_INTEGER MaximumSize
,
7814 /*IN*/ ULONG SectionPageProtection
,
7815 /*IN*/ ULONG AllocationAttributes
,
7816 /*IN*/ HANDLE FileHandle
/*OPTIONAL*/,
7817 /*IN*/ PFILE_OBJECT File
/*OPTIONAL*/);
7819 typedef enum _MMFLUSH_TYPE
{
7827 MmFlushImageSection(
7828 /*IN*/ PSECTION_OBJECT_POINTERS SectionObjectPointer
,
7829 /*IN*/ MMFLUSH_TYPE FlushType
);
7834 MmFreeContiguousMemory(
7835 /*IN*/ PVOID BaseAddress
);
7840 MmFreeContiguousMemorySpecifyCache(
7841 /*IN*/ PVOID BaseAddress
,
7842 /*IN*/ SIZE_T NumberOfBytes
,
7843 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7848 MmFreeMappingAddress(
7849 /*IN*/ PVOID BaseAddress
,
7850 /*IN*/ ULONG PoolTag
);
7855 MmFreeNonCachedMemory(
7856 /*IN*/ PVOID BaseAddress
,
7857 /*IN*/ SIZE_T NumberOfBytes
);
7863 /*IN*/ PMDL MemoryDescriptorList
);
7867 * MmGetMdlByteCount(
7870 #define MmGetMdlByteCount(_Mdl) \
7875 * MmGetMdlByteOffset(
7878 #define MmGetMdlByteOffset(_Mdl) \
7879 ((_Mdl)->ByteOffset)
7886 #define MmGetMdlPfnArray(_Mdl) \
7887 ((PPFN_NUMBER) ((_Mdl) + 1))
7891 * MmGetMdlVirtualAddress(
7894 #define MmGetMdlVirtualAddress(_Mdl) \
7895 ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
7900 MmGetPhysicalAddress(
7901 /*IN*/ PVOID BaseAddress
);
7904 PPHYSICAL_MEMORY_RANGE
7906 MmGetPhysicalMemoryRanges(
7912 MmGetVirtualForPhysical(
7913 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
);
7918 MmMapLockedPagesSpecifyCache(
7919 /*IN*/ PMDL MemoryDescriptorList
,
7920 /*IN*/ KPROCESSOR_MODE AccessMode
,
7921 /*IN*/ MEMORY_CACHING_TYPE CacheType
,
7922 /*IN*/ PVOID BaseAddress
,
7923 /*IN*/ ULONG BugCheckOnFailure
,
7924 /*IN*/ MM_PAGE_PRIORITY Priority
);
7929 MmMapLockedPagesWithReservedMapping(
7930 /*IN*/ PVOID MappingAddress
,
7931 /*IN*/ ULONG PoolTag
,
7932 /*IN*/ PMDL MemoryDescriptorList
,
7933 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7938 MmMapUserAddressesToPage(
7939 /*IN*/ PVOID BaseAddress
,
7940 /*IN*/ SIZE_T NumberOfBytes
,
7941 /*IN*/ PVOID PageAddress
);
7947 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
,
7948 /*IN*/ SIZE_T NumberOfBytes
,
7949 /*IN*/ MEMORY_CACHING_TYPE CacheType
);
7954 MmMapViewInSessionSpace(
7955 /*IN*/ PVOID Section
,
7956 /*OUT*/ PVOID
*MappedBase
,
7957 /*IN OUT*/ PSIZE_T ViewSize
);
7962 MmMapViewInSystemSpace(
7963 /*IN*/ PVOID Section
,
7964 /*OUT*/ PVOID
*MappedBase
,
7965 /*IN*/ PSIZE_T ViewSize
);
7970 MmMarkPhysicalMemoryAsBad(
7971 /*IN*/ PPHYSICAL_ADDRESS StartAddress
,
7972 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
);
7977 MmMarkPhysicalMemoryAsGood(
7978 /*IN*/ PPHYSICAL_ADDRESS StartAddress
,
7979 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
);
7983 * MmGetSystemAddressForMdlSafe(
7985 * IN MM_PAGE_PRIORITY Priority)
7987 #define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
7988 ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
7989 | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
7990 (_Mdl)->MappedSystemVa : \
7991 (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
7992 KernelMode, MmCached, NULL, FALSE, _Priority)
7997 MmGetSystemRoutineAddress(
7998 /*IN*/ PUNICODE_STRING SystemRoutineName
);
8002 * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
8006 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
8008 ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
8009 + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
8014 * IN PMDL MemoryDescriptorList,
8018 #define MmInitializeMdl(_MemoryDescriptorList, \
8022 (_MemoryDescriptorList)->Next = (PMDL) NULL; \
8023 (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
8024 (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
8025 (_MemoryDescriptorList)->MdlFlags = 0; \
8026 (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
8027 (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
8028 (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
8035 /*IN*/ PVOID VirtualAddress
);
8040 MmIsDriverVerifying(
8041 /*IN*/ PDRIVER_OBJECT DriverObject
);
8046 MmIsThisAnNtAsSystem(
8052 MmIsVerifierEnabled(
8053 /*OUT*/ PULONG VerifierFlags
);
8058 MmLockPagableDataSection(
8059 /*IN*/ PVOID AddressWithinSection
);
8064 MmLockPagableImageSection(
8065 /*IN*/ PVOID AddressWithinSection
);
8069 * MmLockPagableCodeSection(
8070 * IN PVOID AddressWithinSection)
8072 #define MmLockPagableCodeSection MmLockPagableDataSection
8077 MmLockPagableSectionByHandle(
8078 /*IN*/ PVOID ImageSectionHandle
);
8084 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
,
8085 /*IN*/ ULONG NumberOfBytes
,
8086 /*IN*/ MEMORY_CACHING_TYPE CacheEnable
);
8092 /*IN*/ PMDL MemoryDescriptorList
,
8093 /*IN*/ KPROCESSOR_MODE AccessMode
);
8099 /*IN*/ PVOID AddressWithinSection
);
8104 MmProbeAndLockProcessPages(
8105 /*IN OUT*/ PMDL MemoryDescriptorList
,
8106 /*IN*/ PEPROCESS Process
,
8107 /*IN*/ KPROCESSOR_MODE AccessMode
,
8108 /*IN*/ LOCK_OPERATION Operation
);
8113 MmProtectMdlSystemAddress(
8114 /*IN*/ PMDL MemoryDescriptorList
,
8115 /*IN*/ ULONG NewProtect
);
8121 /*IN*/ PVOID BaseAddress
,
8122 /*IN*/ PMDL MemoryDescriptorList
);
8127 MmUnmapViewInSessionSpace(
8128 /*IN*/ PVOID MappedBase
);
8133 MmUnmapViewInSystemSpace(
8134 /*IN*/ PVOID MappedBase
);
8139 MmUnsecureVirtualMemory(
8140 /*IN*/ HANDLE SecureHandle
);
8144 * MmPrepareMdlForReuse(
8147 #define MmPrepareMdlForReuse(_Mdl) \
8149 if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
8150 ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
8151 MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
8152 } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
8153 ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
8160 MmProbeAndLockPages(
8161 /*IN OUT*/ PMDL MemoryDescriptorList
,
8162 /*IN*/ KPROCESSOR_MODE AccessMode
,
8163 /*IN*/ LOCK_OPERATION Operation
);
8174 MmRemovePhysicalMemory(
8175 /*IN*/ PPHYSICAL_ADDRESS StartAddress
,
8176 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
);
8181 MmResetDriverPaging(
8182 /*IN*/ PVOID AddressWithinSection
);
8187 MmSecureVirtualMemory(
8188 /*IN*/ PVOID Address
,
8190 /*IN*/ ULONG ProbeMode
);
8197 /*IN*/ SIZE_T Length
);
8202 MmUnlockPagableImageSection(
8203 /*IN*/ PVOID ImageSectionHandle
);
8209 /*IN*/ PMDL MemoryDescriptorList
);
8215 /*IN*/ PVOID BaseAddress
,
8216 /*IN*/ SIZE_T NumberOfBytes
);
8221 MmUnmapReservedMapping(
8222 /*IN*/ PVOID BaseAddress
,
8223 /*IN*/ ULONG PoolTag
,
8224 /*IN*/ PMDL MemoryDescriptorList
);
8229 MmUnmapVideoDisplay(
8230 /*IN*/ PVOID BaseAddress
,
8231 /*IN*/ SIZE_T NumberOfBytes
);
8235 /** Object manager routines **/
8241 /*IN*/ PACCESS_STATE AccessState
,
8242 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8243 /*IN*/ PVOID Object
,
8244 /*IN*/ POBJECT_TYPE Type
);
8249 ObDereferenceSecurityDescriptor(
8250 PSECURITY_DESCRIPTOR SecurityDescriptor
,
8256 ObfDereferenceObject(
8257 /*IN*/ PVOID Object
);
8261 * ObDereferenceObject(
8264 #define ObDereferenceObject ObfDereferenceObject
8269 ObGetObjectSecurity(
8270 /*IN*/ PVOID Object
,
8271 /*OUT*/ PSECURITY_DESCRIPTOR
*SecurityDescriptor
,
8272 /*OUT*/ PBOOLEAN MemoryAllocated
);
8278 /*IN*/ PVOID Object
,
8279 /*IN*/ PACCESS_STATE PassedAccessState
/*OPTIONAL*/,
8280 /*IN*/ ACCESS_MASK DesiredAccess
,
8281 /*IN*/ ULONG AdditionalReferences
,
8282 /*OUT*/ PVOID
* ReferencedObject
/*OPTIONAL*/,
8283 /*OUT*/ PHANDLE Handle
);
8289 /*IN*/ PVOID Object
);
8294 ObLogSecurityDescriptor(
8295 /*IN*/ PSECURITY_DESCRIPTOR InputSecurityDescriptor
,
8296 /*OUT*/ PSECURITY_DESCRIPTOR
*OutputSecurityDescriptor
,
8297 /*IN*/ ULONG RefBias
);
8300 * ObReferenceObject(
8303 #define ObReferenceObject ObfReferenceObject
8308 ObMakeTemporaryObject(
8309 /*IN*/ PVOID Object
);
8315 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8316 /*IN*/ POBJECT_TYPE ObjectType
,
8317 /*IN OUT*/ PVOID ParseContext
/*OPTIONAL*/,
8318 /*IN*/ KPROCESSOR_MODE AccessMode
,
8319 /*IN*/ ACCESS_MASK DesiredAccess
,
8320 /*IN*/ PACCESS_STATE PassedAccessState
,
8321 /*OUT*/ PHANDLE Handle
);
8326 ObOpenObjectByPointer(
8327 /*IN*/ PVOID Object
,
8328 /*IN*/ ULONG HandleAttributes
,
8329 /*IN*/ PACCESS_STATE PassedAccessState
/*OPTIONAL*/,
8330 /*IN*/ ACCESS_MASK DesiredAccess
/*OPTIONAL*/,
8331 /*IN*/ POBJECT_TYPE ObjectType
/*OPTIONAL*/,
8332 /*IN*/ KPROCESSOR_MODE AccessMode
,
8333 /*OUT*/ PHANDLE Handle
);
8338 ObQueryObjectAuditingByHandle(
8339 /*IN*/ HANDLE Handle
,
8340 /*OUT*/ PBOOLEAN GenerateOnClose
);
8345 ObReferenceObjectByHandle(
8346 /*IN*/ HANDLE Handle
,
8347 /*IN*/ ACCESS_MASK DesiredAccess
,
8348 /*IN*/ POBJECT_TYPE ObjectType
/*OPTIONAL*/,
8349 /*IN*/ KPROCESSOR_MODE AccessMode
,
8350 /*OUT*/ PVOID
*Object
,
8351 /*OUT*/ POBJECT_HANDLE_INFORMATION HandleInformation
/*OPTIONAL*/);
8356 ObReferenceObjectByName(
8357 /*IN*/ PUNICODE_STRING ObjectPath
,
8358 /*IN*/ ULONG Attributes
,
8359 /*IN*/ PACCESS_STATE PassedAccessState
/*OPTIONAL*/,
8360 /*IN*/ ACCESS_MASK DesiredAccess
/*OPTIONAL*/,
8361 /*IN*/ POBJECT_TYPE ObjectType
,
8362 /*IN*/ KPROCESSOR_MODE AccessMode
,
8363 /*IN OUT*/ PVOID ParseContext
/*OPTIONAL*/,
8364 /*OUT*/ PVOID
*Object
);
8369 ObReferenceObjectByPointer(
8370 /*IN*/ PVOID Object
,
8371 /*IN*/ ACCESS_MASK DesiredAccess
,
8372 /*IN*/ POBJECT_TYPE ObjectType
,
8373 /*IN*/ KPROCESSOR_MODE AccessMode
);
8378 ObReferenceSecurityDescriptor(
8379 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8380 /*IN*/ ULONG Count
);
8385 ObReleaseObjectSecurity(
8386 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8387 /*IN*/ BOOLEAN MemoryAllocated
);
8391 /** Process manager routines **/
8396 PsCreateSystemProcess(
8397 /*IN*/ PHANDLE ProcessHandle
,
8398 /*IN*/ ACCESS_MASK DesiredAccess
,
8399 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8404 PsCreateSystemThread(
8405 /*OUT*/ PHANDLE ThreadHandle
,
8406 /*IN*/ ULONG DesiredAccess
,
8407 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
/*OPTIONAL*/,
8408 /*IN*/ HANDLE ProcessHandle
/*OPTIONAL*/,
8409 /*OUT*/ PCLIENT_ID ClientId
/*OPTIONAL*/,
8410 /*IN*/ PKSTART_ROUTINE StartRoutine
,
8411 /*IN*/ PVOID StartContext
);
8415 * PsGetCurrentProcess(VOID)
8417 #define PsGetCurrentProcess IoGetCurrentProcess
8422 PsGetCurrentProcessId(
8427 * PsGetCurrentThread(VOID)
8429 #define PsGetCurrentThread() \
8430 ((PETHREAD) KeGetCurrentThread())
8435 PsGetCurrentThreadId(
8442 PULONG MajorVersion
/*OPTIONAL*/,
8443 PULONG MinorVersion
/*OPTIONAL*/,
8444 PULONG BuildNumber
/*OPTIONAL*/,
8445 PUNICODE_STRING CSDVersion
/*OPTIONAL*/);
8450 PsRemoveCreateThreadNotifyRoutine(
8451 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
);
8456 PsRemoveLoadImageNotifyRoutine(
8457 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine
);
8462 PsSetCreateProcessNotifyRoutine(
8463 /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine
,
8464 /*IN*/ BOOLEAN Remove
);
8469 PsSetCreateThreadNotifyRoutine(
8470 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
);
8475 PsSetLoadImageNotifyRoutine(
8476 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine
);
8481 PsTerminateSystemThread(
8482 /*IN*/ NTSTATUS ExitStatus
);
8486 /** Security reference monitor routines **/
8492 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
,
8493 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext
,
8494 /*IN*/ BOOLEAN SubjectContextLocked
,
8495 /*IN*/ ACCESS_MASK DesiredAccess
,
8496 /*IN*/ ACCESS_MASK PreviouslyGrantedAccess
,
8497 /*OUT*/ PPRIVILEGE_SET
*Privileges
/*OPTIONAL*/,
8498 /*IN*/ PGENERIC_MAPPING GenericMapping
,
8499 /*IN*/ KPROCESSOR_MODE AccessMode
,
8500 /*OUT*/ PACCESS_MASK GrantedAccess
,
8501 /*OUT*/ PNTSTATUS AccessStatus
);
8507 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor
/*OPTIONAL*/,
8508 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor
/*OPTIONAL*/,
8509 /*OUT*/ PSECURITY_DESCRIPTOR
*NewDescriptor
,
8510 /*IN*/ BOOLEAN IsDirectoryObject
,
8511 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext
,
8512 /*IN*/ PGENERIC_MAPPING GenericMapping
,
8513 /*IN*/ POOL_TYPE PoolType
);
8519 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor
/*OPTIONAL*/,
8520 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor
/*OPTIONAL*/,
8521 /*OUT*/ PSECURITY_DESCRIPTOR
*NewDescriptor
,
8522 /*IN*/ GUID
*ObjectType
/*OPTIONAL*/,
8523 /*IN*/ BOOLEAN IsDirectoryObject
,
8524 /*IN*/ ULONG AutoInheritFlags
,
8525 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext
,
8526 /*IN*/ PGENERIC_MAPPING GenericMapping
,
8527 /*IN*/ POOL_TYPE PoolType
);
8533 /*IN OUT*/ PSECURITY_DESCRIPTOR
*SecurityDescriptor
);
8538 SeSinglePrivilegeCheck(
8539 LUID PrivilegeValue
,
8540 KPROCESSOR_MODE PreviousMode
);
8545 SeValidSecurityDescriptor(
8546 /*IN*/ ULONG Length
,
8547 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
);
8551 /** NtXxx routines **/
8557 /*OUT*/ PHANDLE ProcessHandle
,
8558 /*IN*/ ACCESS_MASK DesiredAccess
,
8559 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8560 /*IN*/ PCLIENT_ID ClientId
/*OPTIONAL*/);
8565 NtQueryInformationProcess(
8566 /*IN*/ HANDLE ProcessHandle
,
8567 /*IN*/ PROCESSINFOCLASS ProcessInformationClass
,
8568 /*OUT*/ PVOID ProcessInformation
,
8569 /*IN*/ ULONG ProcessInformationLength
,
8570 /*OUT*/ PULONG ReturnLength
/*OPTIONAL*/);
8574 /** NtXxx and ZwXxx routines **/
8580 /*IN*/ HANDLE TimerHandle
,
8581 /*OUT*/ PBOOLEAN CurrentState
/*OPTIONAL*/);
8587 /*IN*/ HANDLE Handle
);
8593 /*IN*/ HANDLE Handle
);
8598 ZwCreateDirectoryObject(
8599 /*OUT*/ PHANDLE DirectoryHandle
,
8600 /*IN*/ ACCESS_MASK DesiredAccess
,
8601 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8607 /*OUT*/ PHANDLE EventHandle
,
8608 /*IN*/ ACCESS_MASK DesiredAccess
,
8609 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8610 /*IN*/ BOOLEAN ManualReset
,
8611 /*IN*/ BOOLEAN InitialState
);
8617 /*OUT*/ PHANDLE EventHandle
,
8618 /*IN*/ ACCESS_MASK DesiredAccess
,
8619 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8620 /*IN*/ BOOLEAN ManualReset
,
8621 /*IN*/ BOOLEAN InitialState
);
8627 /*OUT*/ PHANDLE FileHandle
,
8628 /*IN*/ ACCESS_MASK DesiredAccess
,
8629 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8630 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8631 /*IN*/ PLARGE_INTEGER AllocationSize
/*OPTIONAL*/,
8632 /*IN*/ ULONG FileAttributes
,
8633 /*IN*/ ULONG ShareAccess
,
8634 /*IN*/ ULONG CreateDisposition
,
8635 /*IN*/ ULONG CreateOptions
,
8636 /*IN*/ PVOID EaBuffer
/*OPTIONAL*/,
8637 /*IN*/ ULONG EaLength
);
8643 /*OUT*/ PHANDLE KeyHandle
,
8644 /*IN*/ ACCESS_MASK DesiredAccess
,
8645 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8646 /*IN*/ ULONG TitleIndex
,
8647 /*IN*/ PUNICODE_STRING Class
/*OPTIONAL*/,
8648 /*IN*/ ULONG CreateOptions
,
8649 /*OUT*/ PULONG Disposition
/*OPTIONAL*/);
8655 /*OUT*/ PHANDLE TimerHandle
,
8656 /*IN*/ ACCESS_MASK DesiredAccess
,
8657 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
/*OPTIONAL*/,
8658 /*IN*/ TIMER_TYPE TimerType
);
8664 /*IN*/ HANDLE KeyHandle
);
8670 /*IN*/ HANDLE KeyHandle
,
8671 /*IN*/ PUNICODE_STRING ValueName
);
8676 NtDeviceIoControlFile(
8677 /*IN*/ HANDLE DeviceHandle
,
8678 /*IN*/ HANDLE Event
/*OPTIONAL*/,
8679 /*IN*/ PIO_APC_ROUTINE UserApcRoutine
/*OPTIONAL*/,
8680 /*IN*/ PVOID UserApcContext
/*OPTIONAL*/,
8681 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8682 /*IN*/ ULONG IoControlCode
,
8683 /*IN*/ PVOID InputBuffer
,
8684 /*IN*/ ULONG InputBufferSize
,
8685 /*OUT*/ PVOID OutputBuffer
,
8686 /*IN*/ ULONG OutputBufferSize
);
8691 ZwDeviceIoControlFile(
8692 /*IN*/ HANDLE DeviceHandle
,
8693 /*IN*/ HANDLE Event
/*OPTIONAL*/,
8694 /*IN*/ PIO_APC_ROUTINE UserApcRoutine
/*OPTIONAL*/,
8695 /*IN*/ PVOID UserApcContext
/*OPTIONAL*/,
8696 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8697 /*IN*/ ULONG IoControlCode
,
8698 /*IN*/ PVOID InputBuffer
,
8699 /*IN*/ ULONG InputBufferSize
,
8700 /*OUT*/ PVOID OutputBuffer
,
8701 /*IN*/ ULONG OutputBufferSize
);
8707 /*IN*/ HANDLE KeyHandle
,
8709 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass
,
8710 /*OUT*/ PVOID KeyInformation
,
8711 /*IN*/ ULONG Length
,
8712 /*OUT*/ PULONG ResultLength
);
8717 ZwEnumerateValueKey(
8718 /*IN*/ HANDLE KeyHandle
,
8720 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass
,
8721 /*OUT*/ PVOID KeyValueInformation
,
8722 /*IN*/ ULONG Length
,
8723 /*OUT*/ PULONG ResultLength
);
8729 /*IN*/ HANDLE KeyHandle
);
8734 ZwMakeTemporaryObject(
8735 /*IN*/ HANDLE Handle
);
8741 /*IN*/ HANDLE SectionHandle
,
8742 /*IN*/ HANDLE ProcessHandle
,
8743 /*IN OUT*/ PVOID
*BaseAddress
,
8744 /*IN*/ ULONG ZeroBits
,
8745 /*IN*/ ULONG CommitSize
,
8746 /*IN OUT*/ PLARGE_INTEGER SectionOffset
/*OPTIONAL*/,
8747 /*IN OUT*/ PSIZE_T ViewSize
,
8748 /*IN*/ SECTION_INHERIT InheritDisposition
,
8749 /*IN*/ ULONG AllocationType
,
8750 /*IN*/ ULONG Protect
);
8756 /*IN*/ HANDLE SectionHandle
,
8757 /*IN*/ HANDLE ProcessHandle
,
8758 /*IN OUT*/ PVOID
*BaseAddress
,
8759 /*IN*/ ULONG ZeroBits
,
8760 /*IN*/ ULONG CommitSize
,
8761 /*IN OUT*/ PLARGE_INTEGER SectionOffset
/*OPTIONAL*/,
8762 /*IN OUT*/ PSIZE_T ViewSize
,
8763 /*IN*/ SECTION_INHERIT InheritDisposition
,
8764 /*IN*/ ULONG AllocationType
,
8765 /*IN*/ ULONG Protect
);
8771 /*OUT*/ PHANDLE FileHandle
,
8772 /*IN*/ ACCESS_MASK DesiredAccess
,
8773 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8774 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8775 /*IN*/ ULONG ShareAccess
,
8776 /*IN*/ ULONG OpenOptions
);
8782 /*OUT*/ PHANDLE FileHandle
,
8783 /*IN*/ ACCESS_MASK DesiredAccess
,
8784 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
,
8785 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8786 /*IN*/ ULONG ShareAccess
,
8787 /*IN*/ ULONG OpenOptions
);
8793 /*OUT*/ PHANDLE KeyHandle
,
8794 /*IN*/ ACCESS_MASK DesiredAccess
,
8795 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8801 /*OUT*/ PHANDLE SectionHandle
,
8802 /*IN*/ ACCESS_MASK DesiredAccess
,
8803 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8808 ZwOpenSymbolicLinkObject(
8809 /*OUT*/ PHANDLE LinkHandle
,
8810 /*IN*/ ACCESS_MASK DesiredAccess
,
8811 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8817 /*OUT*/ PHANDLE TimerHandle
,
8818 /*IN*/ ACCESS_MASK DesiredAccess
,
8819 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
);
8824 ZwQueryInformationFile(
8825 /*IN*/ HANDLE FileHandle
,
8826 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8827 /*OUT*/ PVOID FileInformation
,
8828 /*IN*/ ULONG Length
,
8829 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass
);
8835 /*IN*/ HANDLE KeyHandle
,
8836 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass
,
8837 /*OUT*/ PVOID KeyInformation
,
8838 /*IN*/ ULONG Length
,
8839 /*OUT*/ PULONG ResultLength
);
8844 ZwQuerySymbolicLinkObject(
8845 /*IN*/ HANDLE LinkHandle
,
8846 /*IN OUT*/ PUNICODE_STRING LinkTarget
,
8847 /*OUT*/ PULONG ReturnedLength
/*OPTIONAL*/);
8853 /*IN*/ HANDLE KeyHandle
,
8854 /*IN*/ PUNICODE_STRING ValueName
,
8855 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass
,
8856 /*OUT*/ PVOID KeyValueInformation
,
8857 /*IN*/ ULONG Length
,
8858 /*OUT*/ PULONG ResultLength
);
8864 /*IN*/ HANDLE FileHandle
,
8865 /*IN*/ HANDLE Event
/*OPTIONAL*/,
8866 /*IN*/ PIO_APC_ROUTINE ApcRoutine
/*OPTIONAL*/,
8867 /*IN*/ PVOID ApcContext
/*OPTIONAL*/,
8868 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8869 /*OUT*/ PVOID Buffer
,
8870 /*IN*/ ULONG Length
,
8871 /*IN*/ PLARGE_INTEGER ByteOffset
/*OPTIONAL*/,
8872 /*IN*/ PULONG Key
/*OPTIONAL*/);
8878 /*IN*/ HANDLE FileHandle
,
8879 /*IN*/ HANDLE Event
/*OPTIONAL*/,
8880 /*IN*/ PIO_APC_ROUTINE ApcRoutine
/*OPTIONAL*/,
8881 /*IN*/ PVOID ApcContext
/*OPTIONAL*/,
8882 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8883 /*OUT*/ PVOID Buffer
,
8884 /*IN*/ ULONG Length
,
8885 /*IN*/ PLARGE_INTEGER ByteOffset
/*OPTIONAL*/,
8886 /*IN*/ PULONG Key
/*OPTIONAL*/);
8892 /*IN*/ HANDLE EventHandle
,
8893 /*IN*/ PULONG NumberOfThreadsReleased
);
8899 /*IN*/ HANDLE EventHandle
,
8900 /*IN*/ PULONG NumberOfThreadsReleased
);
8905 ZwSetInformationFile(
8906 /*IN*/ HANDLE FileHandle
,
8907 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8908 /*IN*/ PVOID FileInformation
,
8909 /*IN*/ ULONG Length
,
8910 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass
);
8915 ZwSetInformationThread(
8916 /*IN*/ HANDLE ThreadHandle
,
8917 /*IN*/ THREADINFOCLASS ThreadInformationClass
,
8918 /*IN*/ PVOID ThreadInformation
,
8919 /*IN*/ ULONG ThreadInformationLength
);
8925 /*IN*/ HANDLE TimerHandle
,
8926 /*IN*/ PLARGE_INTEGER DueTime
,
8927 /*IN*/ PTIMER_APC_ROUTINE TimerApcRoutine
/*OPTIONAL*/,
8928 /*IN*/ PVOID TimerContext
/*OPTIONAL*/,
8929 /*IN*/ BOOLEAN WakeTimer
,
8930 /*IN*/ LONG Period
/*OPTIONAL*/,
8931 /*OUT*/ PBOOLEAN PreviousState
/*OPTIONAL*/);
8937 /*IN*/ HANDLE KeyHandle
,
8938 /*IN*/ PUNICODE_STRING ValueName
,
8939 /*IN*/ ULONG TitleIndex
/*OPTIONAL*/,
8942 /*IN*/ ULONG DataSize
);
8944 /* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
8945 #define AT_EXTENDABLE_FILE 0x00002000
8946 #define SEC_NO_CHANGE 0x00400000
8947 #define AT_RESERVED 0x20000000
8948 #define AT_ROUND_TO_PAGE 0x40000000
8953 NtUnmapViewOfSection(
8954 /*IN*/ HANDLE ProcessHandle
,
8955 /*IN*/ PVOID BaseAddress
);
8960 ZwUnmapViewOfSection(
8961 /*IN*/ HANDLE ProcessHandle
,
8962 /*IN*/ PVOID BaseAddress
);
8967 NtWaitForSingleObject(
8968 /*IN*/ HANDLE Object
,
8969 /*IN*/ BOOLEAN Alertable
,
8970 /*IN*/ PLARGE_INTEGER Time
);
8975 ZwWaitForSingleObject(
8976 /*IN*/ HANDLE Object
,
8977 /*IN*/ BOOLEAN Alertable
,
8978 /*IN*/ PLARGE_INTEGER Time
);
8984 /*IN*/ HANDLE FileHandle
,
8985 /*IN*/ HANDLE Event
/*OPTIONAL*/,
8986 /*IN*/ PIO_APC_ROUTINE ApcRoutine
/*OPTIONAL*/,
8987 /*IN*/ PVOID ApcContext
/*OPTIONAL*/,
8988 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
8989 /*IN*/ PVOID Buffer
,
8990 /*IN*/ ULONG Length
,
8991 /*IN*/ PLARGE_INTEGER ByteOffset
/*OPTIONAL*/,
8992 /*IN*/ PULONG Key
/*OPTIONAL*/);
8998 /*IN*/ HANDLE FileHandle
,
8999 /*IN*/ HANDLE Event
/*OPTIONAL*/,
9000 /*IN*/ PIO_APC_ROUTINE ApcRoutine
/*OPTIONAL*/,
9001 /*IN*/ PVOID ApcContext
/*OPTIONAL*/,
9002 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
,
9003 /*IN*/ PVOID Buffer
,
9004 /*IN*/ ULONG Length
,
9005 /*IN*/ PLARGE_INTEGER ByteOffset
/*OPTIONAL*/,
9006 /*IN*/ PULONG Key
/*OPTIONAL*/);
9010 /** Power management support routines **/
9016 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9017 /*IN OUT*/ PIRP Irp
);
9022 PoRegisterDeviceForIdleDetection(
9023 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9024 /*IN*/ ULONG ConservationIdleTime
,
9025 /*IN*/ ULONG PerformanceIdleTime
,
9026 /*IN*/ DEVICE_POWER_STATE State
);
9031 PoRegisterSystemState(
9032 /*IN*/ PVOID StateHandle
,
9033 /*IN*/ EXECUTION_STATE Flags
);
9039 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9040 /*IN*/ UCHAR MinorFunction
,
9041 /*IN*/ POWER_STATE PowerState
,
9042 /*IN*/ PREQUEST_POWER_COMPLETE CompletionFunction
,
9043 /*IN*/ PVOID Context
,
9044 /*OUT*/ PIRP
*Irp
/*OPTIONAL*/);
9049 PoRequestShutdownEvent(
9050 /*OUT*/ PVOID
*Event
);
9056 PULONG IdlePointer
);
9062 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9063 /*IN*/ POWER_STATE_TYPE Type
,
9064 /*IN*/ POWER_STATE State
);
9070 /*IN*/ EXECUTION_STATE Flags
);
9075 PoStartNextPowerIrp(
9081 PoUnregisterSystemState(
9082 /*IN*/ PVOID StateHandle
);
9086 /** WMI library support routines **/
9092 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9094 /*IN*/ NTSTATUS Status
,
9095 /*IN*/ ULONG BufferUsed
,
9096 /*IN*/ CCHAR PriorityBoost
);
9102 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9104 /*IN*/ ULONG InstanceIndex
,
9105 /*IN*/ ULONG EventDataSize
,
9106 /*IN*/ PVOID EventData
);
9111 WmiQueryTraceInformation(
9112 /*IN*/ TRACE_INFORMATION_CLASS TraceInformationClass
,
9113 /*OUT*/ PVOID TraceInformation
,
9114 /*IN*/ ULONG TraceInformationLength
,
9115 /*OUT*/ PULONG RequiredLength
/*OPTIONAL*/,
9116 /*IN*/ PVOID Buffer
/*OPTIONAL*/);
9122 /*IN*/ PWMILIB_CONTEXT WmiLibInfo
,
9123 /*IN*/ PDEVICE_OBJECT DeviceObject
,
9125 /*OUT*/ PSYSCTL_IRP_DISPOSITION IrpDisposition
);
9131 /*IN*/ TRACEHANDLE LoggerHandle
,
9132 /*IN*/ ULONG MessageFlags
,
9133 /*IN*/ LPGUID MessageGuid
,
9134 /*IN*/ USHORT MessageNumber
,
9138 /* FIXME: Get va_list from where? */
9143 /*IN*/ TRACEHANDLE LoggerHandle
,
9144 /*IN*/ ULONG MessageFlags
,
9145 /*IN*/ LPGUID MessageGuid
,
9146 /*IN*/ USHORT MessageNumber
,
9147 /*IN*/ va_list MessageArgList
);
9151 /** Kernel debugger routines **/
9174 DbgBreakPointWithStatus(
9175 /*IN*/ ULONG Status
);
9188 /*IN*/ ULONG ComponentId
,
9196 DbgPrintReturnControlC(
9203 DbgQueryDebugFilterState(
9204 /*IN*/ ULONG ComponentId
,
9205 /*IN*/ ULONG Level
);
9210 DbgSetDebugFilterState(
9211 /*IN*/ ULONG ComponentId
,
9213 /*IN*/ BOOLEAN State
);
9217 #define KdPrint(_x_) DbgPrint _x_
9218 #define KdPrintEx(_x_) DbgPrintEx _x_
9219 #define KdBreakPoint() DbgBreakPoint()
9220 #define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
9224 #define KdPrint(_x_)
9225 #define KdPrintEx(_x_)
9226 #define KdBreakPoint()
9227 #define KdBreakPointWithStatus(s)
9231 extern NTOSAPI PBOOLEAN KdDebuggerNotPresent
;
9232 extern NTOSAPI PBOOLEAN KdDebuggerEnabled
;
9233 #define KD_DEBUGGER_ENABLED *KdDebuggerEnabled
9234 #define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
9240 #endif /* __WINDDK_H */