2 * Copyright 2004-2005 Ivan Leo Puoti
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <devpropdef.h>
27 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
29 #define POINTER_ALIGNMENT
32 /* FIXME: We suppose that page size is 4096 */
35 #define PAGE_SIZE 0x1000
38 #define BYTE_OFFSET(va) ((ULONG)((ULONG_PTR)(va) & (PAGE_SIZE - 1)))
39 #define PAGE_ALIGN(va) ((PVOID)((ULONG_PTR)(va) & ~(PAGE_SIZE - 1)))
40 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(va, length) \
41 ((BYTE_OFFSET(va) + ((SIZE_T)(length)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)
43 typedef LONG KPRIORITY
;
45 typedef ULONG_PTR KSPIN_LOCK
, *PKSPIN_LOCK
;
47 typedef ULONG_PTR ERESOURCE_THREAD
;
48 typedef ERESOURCE_THREAD
*PERESOURCE_THREAD
;
49 typedef struct _FILE_GET_QUOTA_INFORMATION
*PFILE_GET_QUOTA_INFORMATION
;
54 struct _DEVICE_OBJECT
;
55 struct _DRIVER_OBJECT
;
58 typedef VOID (WINAPI
*PKDEFERRED_ROUTINE
)(struct _KDPC
*, PVOID
, PVOID
, PVOID
);
59 typedef VOID (WINAPI
*PKSTART_ROUTINE
)(PVOID
);
61 typedef NTSTATUS (WINAPI
*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
*, PUNICODE_STRING
);
62 typedef NTSTATUS (WINAPI
*PDRIVER_DISPATCH
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
63 typedef void (WINAPI
*PDRIVER_STARTIO
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
64 typedef void (WINAPI
*PDRIVER_UNLOAD
)(struct _DRIVER_OBJECT
*);
65 typedef NTSTATUS (WINAPI
*PDRIVER_ADD_DEVICE
)(struct _DRIVER_OBJECT
*, struct _DEVICE_OBJECT
*);
67 typedef struct _DISPATCHER_HEADER
{
73 LIST_ENTRY WaitListHead
;
74 } DISPATCHER_HEADER
, *PDISPATCHER_HEADER
;
76 typedef struct _KEVENT
{
77 DISPATCHER_HEADER Header
;
78 } KEVENT
, *PKEVENT
, *RESTRICTED_POINTER PRKEVENT
;
80 typedef struct _KSEMAPHORE
{
81 DISPATCHER_HEADER Header
;
83 } KSEMAPHORE
, *PKSEMAPHORE
, *PRKSEMAPHORE
;
85 typedef struct _KDPC
{
89 LIST_ENTRY DpcListEntry
;
90 PKDEFERRED_ROUTINE DeferredRoutine
;
91 PVOID DeferredContext
;
92 PVOID SystemArgument1
;
93 PVOID SystemArgument2
;
95 } KDPC
, *PKDPC
, *RESTRICTED_POINTER PRKDPC
;
97 typedef enum _KDPC_IMPORTANCE
{
104 typedef struct _KDEVICE_QUEUE_ENTRY
{
105 LIST_ENTRY DeviceListEntry
;
108 } KDEVICE_QUEUE_ENTRY
, *PKDEVICE_QUEUE_ENTRY
,
109 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY
;
111 typedef struct _KDEVICE_QUEUE
{
114 LIST_ENTRY DeviceListHead
;
117 } KDEVICE_QUEUE
, *PKDEVICE_QUEUE
, *RESTRICTED_POINTER PRKDEVICE_QUEUE
;
119 typedef struct _KMUTANT
{
120 DISPATCHER_HEADER Header
;
121 LIST_ENTRY MutantListEntry
;
122 struct _KTHREAD
*RESTRICTED_POINTER OwnerThread
;
125 } KMUTANT
, *PKMUTANT
, *RESTRICTED_POINTER PRKMUTANT
, KMUTEX
, *PKMUTEX
, *RESTRICTED_POINTER PRKMUTEX
;
127 typedef struct _DEFERRED_REVERSE_BARRIER
130 ULONG TotalProcessors
;
131 } DEFERRED_REVERSE_BARRIER
;
133 typedef enum _KWAIT_REASON
163 typedef struct _KWAIT_BLOCK
{
164 LIST_ENTRY WaitListEntry
;
165 struct _KTHREAD
*RESTRICTED_POINTER Thread
;
167 struct _KWAIT_BLOCK
*RESTRICTED_POINTER NextWaitBlock
;
170 } KWAIT_BLOCK
, *PKWAIT_BLOCK
, *RESTRICTED_POINTER PRKWAIT_BLOCK
;
172 typedef struct _OWNER_ENTRY
174 ERESOURCE_THREAD OwnerThread
;
179 ULONG IoPriorityBoosted
: 1;
180 ULONG OwnerReferenced
: 1;
181 ULONG IoQoSPriorityBoosted
: 1;
182 ULONG OwnerCount
: 29;
186 } OWNER_ENTRY
, *POWNER_ENTRY
;
188 #define ResourceNeverExclusive 0x0010
189 #define ResourceReleaseByOtherThread 0x0020
190 #define ResourceOwnedExclusive 0x0080
192 typedef struct _ERESOURCE
194 LIST_ENTRY SystemResourcesList
;
195 OWNER_ENTRY
*OwnerTable
;
202 UCHAR ReservedLowFlags
;
203 UCHAR WaiterPriority
;
206 KSEMAPHORE
*SharedWaiters
;
207 KEVENT
*ExclusiveWaiters
;
208 OWNER_ENTRY OwnerEntry
;
210 ULONG ContentionCount
;
211 ULONG NumberOfSharedWaiters
;
212 ULONG NumberOfExclusiveWaiters
;
219 ULONG_PTR CreatorBackTraceIndex
;
222 } ERESOURCE
, *PERESOURCE
;
224 typedef struct _IO_TIMER
*PIO_TIMER
;
225 typedef struct _IO_TIMER_ROUTINE
*PIO_TIMER_ROUTINE
;
226 typedef struct _ETHREAD
*PETHREAD
;
227 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
228 typedef struct _EPROCESS
*PEPROCESS
;
229 typedef struct _KPROCESS KPROCESS
, *PKPROCESS
, *PRKPROCESS
;
230 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
231 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
232 typedef struct _OBJECT_HANDLE_INFORMATION
*POBJECT_HANDLE_INFORMATION
;
233 typedef struct _ZONE_HEADER
*PZONE_HEADER
;
234 typedef struct _LOOKASIDE_LIST_EX
*PLOOKASIDE_LIST_EX
;
236 typedef struct _KAPC_STATE
238 LIST_ENTRY ApcListHead
[2];
240 UCHAR KernelApcInProgress
;
241 UCHAR KernelApcPending
;
242 UCHAR UserApcPending
;
243 } KAPC_STATE
, *PKAPC_STATE
;
245 #define FM_LOCK_BIT 0x1
247 typedef struct _FAST_MUTEX
254 } FAST_MUTEX
, *PFAST_MUTEX
;
256 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
258 typedef struct _VPB
{
262 USHORT VolumeLabelLength
;
263 struct _DEVICE_OBJECT
*DeviceObject
;
264 struct _DEVICE_OBJECT
*RealDevice
;
266 ULONG ReferenceCount
;
267 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
270 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 0x0008
271 #define POOL_RAISE_IF_ALLOCATION_FAILURE 0x0010
272 #define POOL_COLD_ALLOCATION 0x0100
273 #define POOL_NX_ALLOCATION 0x0200
275 typedef enum _POOL_TYPE
{
278 NonPagedPoolMustSucceed
,
280 NonPagedPoolCacheAligned
,
281 PagedPoolCacheAligned
,
282 NonPagedPoolCacheAlignedMustS
,
286 typedef struct _WAIT_CONTEXT_BLOCK
{
287 KDEVICE_QUEUE_ENTRY WaitQueueEntry
;
288 struct _DRIVER_CONTROL
*DeviceRoutine
;
290 ULONG NumberOfMapRegisters
;
293 PKDPC BufferChainingDpc
;
294 } WAIT_CONTEXT_BLOCK
, *PWAIT_CONTEXT_BLOCK
;
296 #define DO_BUFFERED_IO 0x00000004
297 #define DO_EXCLUSIVE 0x00000008
298 #define DO_DIRECT_IO 0x00000010
299 #define DO_MAP_IO_BUFFER 0x00000020
300 #define DO_DEVICE_INITIALIZING 0x00000080
301 #define DO_SHUTDOWN_REGISTERED 0x00000800
302 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
303 #define DO_POWER_PAGABLE 0x00002000
304 #define DO_POWER_INRUSH 0x00004000
306 #define IO_NO_INCREMENT 0
307 #define IO_CD_ROM_INCREMENT 1
308 #define IO_DISK_INCREMENT 1
309 #define IO_KEYBOARD_INCREMENT 6
310 #define IO_MAILSLOT_INCREMENT 2
311 #define IO_MOUSE_INCREMENT 6
312 #define IO_NAMED_PIPE_INCREMENT 2
313 #define IO_NETWORK_INCREMENT 2
314 #define IO_PARALLEL_INCREMENT 1
315 #define IO_SERIAL_INCREMENT 2
316 #define IO_SOUND_INCREMENT 8
317 #define IO_VIDEO_INCREMENT 1
320 #define DEVICE_TYPE ULONG
322 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
323 #define IRP_MJ_CREATE 0x00
324 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
325 #define IRP_MJ_CLOSE 0x02
326 #define IRP_MJ_READ 0x03
327 #define IRP_MJ_WRITE 0x04
328 #define IRP_MJ_QUERY_INFORMATION 0x05
329 #define IRP_MJ_SET_INFORMATION 0x06
330 #define IRP_MJ_QUERY_EA 0x07
331 #define IRP_MJ_SET_EA 0x08
332 #define IRP_MJ_FLUSH_BUFFERS 0x09
333 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
334 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
335 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
336 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
337 #define IRP_MJ_DEVICE_CONTROL 0x0e
338 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
339 #define IRP_MJ_SHUTDOWN 0x10
340 #define IRP_MJ_LOCK_CONTROL 0x11
341 #define IRP_MJ_CLEANUP 0x12
342 #define IRP_MJ_CREATE_MAILSLOT 0x13
343 #define IRP_MJ_QUERY_SECURITY 0x14
344 #define IRP_MJ_SET_SECURITY 0x15
345 #define IRP_MJ_POWER 0x16
346 #define IRP_MJ_SYSTEM_CONTROL 0x17
347 #define IRP_MJ_DEVICE_CHANGE 0x18
348 #define IRP_MJ_QUERY_QUOTA 0x19
349 #define IRP_MJ_SET_QUOTA 0x1a
350 #define IRP_MJ_PNP 0x1b
352 #define IRP_MN_START_DEVICE 0x00
353 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
354 #define IRP_MN_REMOVE_DEVICE 0x02
355 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
356 #define IRP_MN_STOP_DEVICE 0x04
357 #define IRP_MN_QUERY_STOP_DEVICE 0x05
358 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
359 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
360 #define IRP_MN_QUERY_INTERFACE 0x08
361 #define IRP_MN_QUERY_CAPABILITIES 0x09
362 #define IRP_MN_QUERY_RESOURCES 0x0A
363 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
364 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
365 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
366 #define IRP_MN_READ_CONFIG 0x0F
367 #define IRP_MN_WRITE_CONFIG 0x10
368 #define IRP_MN_EJECT 0x11
369 #define IRP_MN_SET_LOCK 0x12
370 #define IRP_MN_QUERY_ID 0x13
371 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
372 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
373 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
374 #define IRP_MN_SURPRISE_REMOVAL 0x17
375 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
377 #define IRP_MN_WAIT_WAKE 0x00
378 #define IRP_MN_POWER_SEQUENCE 0x01
379 #define IRP_MN_SET_POWER 0x02
380 #define IRP_MN_QUERY_POWER 0x03
382 #define IRP_QUOTA_CHARGED 0x01
383 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
384 #define IRP_ALLOCATED_FIXED_SIZE 0x04
385 #define IRP_LOOKASIDE_ALLOCATION 0x08
387 #define IO_TYPE_ADAPTER 0x01
388 #define IO_TYPE_CONTROLLER 0x02
389 #define IO_TYPE_DEVICE 0x03
390 #define IO_TYPE_DRIVER 0x04
391 #define IO_TYPE_FILE 0x05
392 #define IO_TYPE_IRP 0x06
393 #define IO_TYPE_MASTER_ADAPTER 0x07
394 #define IO_TYPE_OPEN_PACKET 0x08
395 #define IO_TYPE_TIMER 0x09
396 #define IO_TYPE_VPB 0x0a
397 #define IO_TYPE_ERROR_LOG 0x0b
398 #define IO_TYPE_ERROR_MESSAGE 0x0c
399 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
401 typedef struct _DEVICE_OBJECT
{
405 struct _DRIVER_OBJECT
*DriverObject
;
406 struct _DEVICE_OBJECT
*NextDevice
;
407 struct _DEVICE_OBJECT
*AttachedDevice
;
408 struct _IRP
*CurrentIrp
;
411 ULONG Characteristics
;
413 PVOID DeviceExtension
;
414 DEVICE_TYPE DeviceType
;
417 LIST_ENTRY ListEntry
;
418 WAIT_CONTEXT_BLOCK Wcb
;
420 ULONG AlignmentRequirement
;
421 KDEVICE_QUEUE DeviceQueue
;
423 ULONG ActiveThreadCount
;
424 PSECURITY_DESCRIPTOR SecurityDescriptor
;
428 struct _DEVOBJ_EXTENSION
*DeviceObjectExtension
;
431 typedef struct _DEVICE_OBJECT
*PDEVICE_OBJECT
;
433 typedef struct _DEVICE_RELATIONS
{
435 PDEVICE_OBJECT Objects
[1];
437 typedef struct _DEVICE_RELATIONS
*PDEVICE_RELATIONS
;
439 typedef struct _DRIVER_EXTENSION
{
440 struct _DRIVER_OBJECT
*DriverObject
;
441 PDRIVER_ADD_DEVICE AddDevice
;
443 UNICODE_STRING ServiceKeyName
;
444 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
446 typedef struct _DRIVER_OBJECT
{
449 PDEVICE_OBJECT DeviceObject
;
454 PDRIVER_EXTENSION DriverExtension
;
455 UNICODE_STRING DriverName
;
456 PUNICODE_STRING HardwareDatabase
;
457 PVOID FastIoDispatch
;
458 PDRIVER_INITIALIZE DriverInit
;
459 PDRIVER_STARTIO DriverStartIo
;
460 PDRIVER_UNLOAD DriverUnload
;
461 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
463 typedef struct _DRIVER_OBJECT
*PDRIVER_OBJECT
;
465 /* Irp definitions */
466 typedef UCHAR KIRQL
, *PKIRQL
;
467 typedef CCHAR KPROCESSOR_MODE
;
468 typedef enum _KAPC_ENVIRONMENT
470 OriginalApcEnvironment
,
471 AttachedApcEnvironment
,
472 CurrentApcEnvironment
,
474 } KAPC_ENVIRONMENT
, *PKAPC_ENVIRONMENT
;
476 typedef VOID (WINAPI
*PDRIVER_CANCEL
)(
477 IN
struct _DEVICE_OBJECT
*DeviceObject
,
478 IN
struct _IRP
*Irp
);
480 typedef VOID (WINAPI
*PKNORMAL_ROUTINE
)(
481 IN PVOID NormalContext
,
482 IN PVOID SystemArgument1
,
483 IN PVOID SystemArgument2
);
485 typedef VOID (WINAPI
*PKKERNEL_ROUTINE
)(
486 IN
struct _KAPC
*Apc
,
487 IN OUT PKNORMAL_ROUTINE
*NormalRoutine
,
488 IN OUT PVOID
*NormalContext
,
489 IN OUT PVOID
*SystemArgument1
,
490 IN OUT PVOID
*SystemArgument2
);
492 typedef VOID (WINAPI
*PKRUNDOWN_ROUTINE
)(
493 IN
struct _KAPC
*Apc
);
495 typedef struct _KAPC
{
499 struct _KTHREAD
*Thread
;
500 LIST_ENTRY ApcListEntry
;
501 PKKERNEL_ROUTINE KernelRoutine
;
502 PKRUNDOWN_ROUTINE RundownRoutine
;
503 PKNORMAL_ROUTINE NormalRoutine
;
505 PVOID SystemArgument1
;
506 PVOID SystemArgument2
;
508 KPROCESSOR_MODE ApcMode
;
510 } KAPC
, *PKAPC
, *RESTRICTED_POINTER PRKAPC
;
512 typedef struct _IRP
{
515 struct _MDL
*MdlAddress
;
518 struct _IRP
*MasterIrp
;
522 LIST_ENTRY ThreadListEntry
;
523 IO_STATUS_BLOCK IoStatus
;
524 KPROCESSOR_MODE RequestorMode
;
525 BOOLEAN PendingReturned
;
527 CHAR CurrentLocation
;
530 CCHAR ApcEnvironment
;
531 UCHAR AllocationFlags
;
532 PIO_STATUS_BLOCK UserIosb
;
536 PIO_APC_ROUTINE UserApcRoutine
;
537 PVOID UserApcContext
;
538 } AsynchronousParameters
;
539 LARGE_INTEGER AllocationSize
;
541 PDRIVER_CANCEL CancelRoutine
;
546 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
548 PVOID DriverContext
[4];
552 PCHAR AuxiliaryBuffer
;
554 LIST_ENTRY ListEntry
;
556 struct _IO_STACK_LOCATION
*CurrentStackLocation
;
560 struct _FILE_OBJECT
*OriginalFileObject
;
566 typedef struct _IRP
*PIRP
;
568 #define IRP_NOCACHE 0x0001
569 #define IRP_PAGING_IO 0x0002
570 #define IRP_MOUNT_COMPLETION 0x0002
571 #define IRP_SYNCHRONOUS_API 0x0004
572 #define IRP_ASSOCIATED_IRP 0x0008
573 #define IRP_BUFFERED_IO 0x0010
574 #define IRP_DEALLOCATE_BUFFER 0x0020
575 #define IRP_INPUT_OPERATION 0x0040
576 #define IRP_SYNCHRONOUS_PAGING_IO 0x0040
577 #define IRP_CREATE_OPERATION 0x0080
578 #define IRP_READ_OPERATION 0x0100
579 #define IRP_WRITE_OPERATION 0x0200
580 #define IRP_CLOSE_OPERATION 0x0400
581 #define IRP_DEFER_IO_COMPLETION 0x0800
582 #define IRP_OB_QUERY_NAME 0x1000
583 #define IRP_HOLD_DEVICE_QUEUE 0x2000
585 typedef VOID (WINAPI
*PINTERFACE_REFERENCE
)(
588 typedef VOID (WINAPI
*PINTERFACE_DEREFERENCE
)(
591 typedef struct _INTERFACE
{
595 PINTERFACE_REFERENCE InterfaceReference
;
596 PINTERFACE_DEREFERENCE InterfaceDereference
;
597 } INTERFACE
, *PINTERFACE
;
599 typedef struct _SECTION_OBJECT_POINTERS
{
600 PVOID DataSectionObject
;
601 PVOID SharedCacheMap
;
602 PVOID ImageSectionObject
;
603 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
605 typedef struct _IO_COMPLETION_CONTEXT
{
608 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
610 typedef enum _DEVICE_RELATION_TYPE
{
615 TargetDeviceRelation
,
617 } DEVICE_RELATION_TYPE
, *PDEVICE_RELATION_TYPE
;
619 typedef struct _FILE_OBJECT
{
622 PDEVICE_OBJECT DeviceObject
;
626 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
627 PVOID PrivateCacheMap
;
628 NTSTATUS FinalStatus
;
629 struct _FILE_OBJECT
*RelatedFileObject
;
630 BOOLEAN LockOperation
;
631 BOOLEAN DeletePending
;
634 BOOLEAN DeleteAccess
;
637 BOOLEAN SharedDelete
;
639 UNICODE_STRING FileName
;
640 LARGE_INTEGER CurrentByteOffset
;
646 PIO_COMPLETION_CONTEXT CompletionContext
;
648 typedef struct _FILE_OBJECT
*PFILE_OBJECT
;
650 #define INITIAL_PRIVILEGE_COUNT 3
652 typedef struct _INITIAL_PRIVILEGE_SET
{
653 ULONG PrivilegeCount
;
655 LUID_AND_ATTRIBUTES Privilege
[INITIAL_PRIVILEGE_COUNT
];
656 } INITIAL_PRIVILEGE_SET
, * PINITIAL_PRIVILEGE_SET
;
658 typedef struct _SECURITY_SUBJECT_CONTEXT
{
659 PACCESS_TOKEN ClientToken
;
660 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
661 PACCESS_TOKEN PrimaryToken
;
662 PVOID ProcessAuditId
;
663 } SECURITY_SUBJECT_CONTEXT
, *PSECURITY_SUBJECT_CONTEXT
;
665 typedef struct _ACCESS_STATE
{
667 BOOLEAN SecurityEvaluated
;
668 BOOLEAN GenerateAudit
;
669 BOOLEAN GenerateOnClose
;
670 BOOLEAN PrivilegesAllocated
;
672 ACCESS_MASK RemainingDesiredAccess
;
673 ACCESS_MASK PreviouslyGrantedAccess
;
674 ACCESS_MASK OriginalDesiredAccess
;
675 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext
;
676 PSECURITY_DESCRIPTOR SecurityDescriptor
;
679 INITIAL_PRIVILEGE_SET InitialPrivilegeSet
;
680 PRIVILEGE_SET PrivilegeSet
;
683 BOOLEAN AuditPrivileges
;
684 UNICODE_STRING ObjectName
;
685 UNICODE_STRING ObjectTypeName
;
686 } ACCESS_STATE
, *PACCESS_STATE
;
688 typedef struct _IO_SECURITY_CONTEXT
{
689 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
690 PACCESS_STATE AccessState
;
691 ACCESS_MASK DesiredAccess
;
692 ULONG FullCreateOptions
;
693 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
695 typedef struct _DEVICE_CAPABILITIES
{
700 ULONG LockSupported
: 1;
701 ULONG EjectSupported
: 1;
703 ULONG DockDevice
: 1;
705 ULONG SilentInstall
: 1;
706 ULONG RawDeviceOK
: 1;
707 ULONG SurpriseRemovalOK
: 1;
708 ULONG WakeFromD0
: 1;
709 ULONG WakeFromD1
: 1;
710 ULONG WakeFromD2
: 1;
711 ULONG WakeFromD3
: 1;
712 ULONG HardwareDisabled
: 1;
713 ULONG NonDynamic
: 1;
714 ULONG WarmEjectSupported
: 1;
715 ULONG NoDisplayInUI
: 1;
719 DEVICE_POWER_STATE DeviceState
[PowerSystemMaximum
];
720 SYSTEM_POWER_STATE SystemWake
;
721 DEVICE_POWER_STATE DeviceWake
;
725 } DEVICE_CAPABILITIES
, *PDEVICE_CAPABILITIES
;
727 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
{
731 GUID InterfaceClassGuid
;
732 PUNICODE_STRING SymbolicLinkName
;
733 } DEVICE_INTERFACE_CHANGE_NOTIFICATION
, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION
;
735 typedef enum _INTERFACE_TYPE
{
736 InterfaceTypeUndefined
= -1,
754 } INTERFACE_TYPE
, *PINTERFACE_TYPE
;
756 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
758 #define IO_RESOURCE_PREFERRED 0x01
759 #define IO_RESOURCE_DEFAULT 0x02
760 #define IO_RESOURCE_ALTERNATIVE 0x08
762 typedef struct _IO_RESOURCE_DESCRIPTOR
{
765 UCHAR ShareDisposition
;
773 PHYSICAL_ADDRESS MinimumAddress
;
774 PHYSICAL_ADDRESS MaximumAddress
;
779 PHYSICAL_ADDRESS MinimumAddress
;
780 PHYSICAL_ADDRESS MaximumAddress
;
787 ULONG MinimumChannel
;
788 ULONG MaximumChannel
;
793 PHYSICAL_ADDRESS MinimumAddress
;
794 PHYSICAL_ADDRESS MaximumAddress
;
811 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
813 typedef struct _IO_RESOURCE_LIST
{
817 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
818 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
820 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
822 INTERFACE_TYPE InterfaceType
;
826 ULONG AlternativeLists
;
827 IO_RESOURCE_LIST List
[1];
828 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
830 typedef enum _BUS_QUERY_ID_TYPE
{
833 BusQueryCompatibleIDs
,
835 BusQueryDeviceSerialNumber
,
837 } BUS_QUERY_ID_TYPE
, *PBUS_QUERY_ID_TYPE
;
839 typedef enum _CREATE_FILE_TYPE
{
841 CreateFileTypeNamedPipe
,
842 CreateFileTypeMailslot
846 DevicePropertyDeviceDescription
,
847 DevicePropertyHardwareID
,
848 DevicePropertyCompatibleIDs
,
849 DevicePropertyBootConfiguration
,
850 DevicePropertyBootConfigurationTranslated
,
851 DevicePropertyClassName
,
852 DevicePropertyClassGuid
,
853 DevicePropertyDriverKeyName
,
854 DevicePropertyManufacturer
,
855 DevicePropertyFriendlyName
,
856 DevicePropertyLocationInformation
,
857 DevicePropertyPhysicalDeviceObjectName
,
858 DevicePropertyBusTypeGuid
,
859 DevicePropertyLegacyBusType
,
860 DevicePropertyBusNumber
,
861 DevicePropertyEnumeratorName
,
862 DevicePropertyAddress
,
863 DevicePropertyUINumber
,
864 DevicePropertyInstallState
,
865 DevicePropertyRemovalPolicy
866 } DEVICE_REGISTRY_PROPERTY
;
868 typedef enum _DEVICE_TEXT_TYPE
{
869 DeviceTextDescription
,
870 DeviceTextLocationInformation
871 } DEVICE_TEXT_TYPE
, *PDEVICE_TEXT_TYPE
;
873 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE
{
874 DeviceUsageTypeUndefined
,
875 DeviceUsageTypePaging
,
876 DeviceUsageTypeHibernation
,
877 DeviceUsageTypeDumpFile
878 } DEVICE_USAGE_NOTIFICATION_TYPE
;
880 typedef struct _POWER_SEQUENCE
{
884 } POWER_SEQUENCE
, *PPOWER_SEQUENCE
;
886 typedef enum _POWER_STATE_TYPE
{
889 } POWER_STATE_TYPE
, *PPOWER_STATE_TYPE
;
891 typedef union _POWER_STATE
{
892 SYSTEM_POWER_STATE SystemState
;
893 DEVICE_POWER_STATE DeviceState
;
894 } POWER_STATE
, *PPOWER_STATE
;
896 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
898 UCHAR ShareDisposition
;
902 PHYSICAL_ADDRESS Start
;
906 PHYSICAL_ADDRESS Start
;
915 PHYSICAL_ADDRESS Start
;
935 } DeviceSpecificData
;
937 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
939 typedef struct _CM_PARTIAL_RESOURCE_LIST
{
943 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
944 } CM_PARTIAL_RESOURCE_LIST
, *PCM_PARTIAL_RESOURCE_LIST
;
946 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
947 INTERFACE_TYPE InterfaceType
;
949 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
950 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
952 typedef struct _CM_RESOURCE_LIST
{
954 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
955 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
957 typedef NTSTATUS (WINAPI
*PIO_COMPLETION_ROUTINE
)(
958 IN
struct _DEVICE_OBJECT
*DeviceObject
,
962 #define SL_PENDING_RETURNED 0x01
963 #define SL_INVOKE_ON_CANCEL 0x20
964 #define SL_INVOKE_ON_SUCCESS 0x40
965 #define SL_INVOKE_ON_ERROR 0x80
968 #include <pshpack4.h>
970 typedef struct _IO_STACK_LOCATION
{
977 PIO_SECURITY_CONTEXT SecurityContext
;
979 USHORT POINTER_ALIGNMENT FileAttributes
;
981 ULONG POINTER_ALIGNMENT EaLength
;
985 ULONG POINTER_ALIGNMENT Key
;
986 LARGE_INTEGER ByteOffset
;
990 ULONG POINTER_ALIGNMENT Key
;
991 LARGE_INTEGER ByteOffset
;
995 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
999 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
1000 PFILE_OBJECT FileObject
;
1003 BOOLEAN ReplaceIfExists
;
1004 BOOLEAN AdvanceOnly
;
1007 HANDLE DeleteHandle
;
1012 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
1015 ULONG OutputBufferLength
;
1016 ULONG POINTER_ALIGNMENT InputBufferLength
;
1017 ULONG POINTER_ALIGNMENT IoControlCode
;
1018 PVOID Type3InputBuffer
;
1021 SECURITY_INFORMATION SecurityInformation
;
1022 ULONG POINTER_ALIGNMENT Length
;
1025 SECURITY_INFORMATION SecurityInformation
;
1026 PSECURITY_DESCRIPTOR SecurityDescriptor
;
1030 PDEVICE_OBJECT DeviceObject
;
1034 PDEVICE_OBJECT DeviceObject
;
1037 struct _SCSI_REQUEST_BLOCK
*Srb
;
1040 DEVICE_RELATION_TYPE Type
;
1041 } QueryDeviceRelations
;
1043 const GUID
*InterfaceType
;
1046 PINTERFACE Interface
;
1047 PVOID InterfaceSpecificData
;
1050 PDEVICE_CAPABILITIES Capabilities
;
1051 } DeviceCapabilities
;
1053 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
1054 } FilterResourceRequirements
;
1059 ULONG POINTER_ALIGNMENT Length
;
1065 BUS_QUERY_ID_TYPE IdType
;
1068 DEVICE_TEXT_TYPE DeviceTextType
;
1069 LCID POINTER_ALIGNMENT LocaleId
;
1073 BOOLEAN Reserved
[3];
1074 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
1075 } UsageNotification
;
1077 SYSTEM_POWER_STATE PowerState
;
1080 PPOWER_SEQUENCE PowerSequence
;
1083 ULONG SystemContext
;
1084 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
1085 POWER_STATE POINTER_ALIGNMENT State
;
1086 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
1089 PCM_RESOURCE_LIST AllocatedResources
;
1090 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
1093 ULONG_PTR ProviderId
;
1105 PDEVICE_OBJECT DeviceObject
;
1106 PFILE_OBJECT FileObject
;
1107 PIO_COMPLETION_ROUTINE CompletionRoutine
;
1109 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
1110 #if !defined(_WIN64)
1111 #include <poppack.h>
1114 /* MDL definitions */
1116 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1117 #define MDL_PAGES_LOCKED 0x0002
1118 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1119 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1120 #define MDL_PARTIAL 0x0010
1121 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1122 #define MDL_IO_PAGE_READ 0x0040
1123 #define MDL_WRITE_OPERATION 0x0080
1124 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1125 #define MDL_FREE_EXTRA_PTES 0x0200
1126 #define MDL_DESCRIBES_AWE 0x0400
1127 #define MDL_IO_SPACE 0x0800
1128 #define MDL_NETWORK_HEADER 0x1000
1129 #define MDL_MAPPING_CAN_FAIL 0x2000
1130 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1131 #define MDL_INTERNAL 0x8000
1133 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
1134 MDL_PAGES_LOCKED | \
1135 MDL_SOURCE_IS_NONPAGED_POOL | \
1136 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1137 MDL_PARENT_MAPPED_SYSTEM_VA | \
1141 typedef struct _MDL
{
1145 struct _EPROCESS
*Process
;
1146 PVOID MappedSystemVa
;
1153 typedef ULONG PFN_NUMBER
, *PPFN_NUMBER
;
1155 static inline void MmInitializeMdl(MDL
*mdl
, void *va
, SIZE_T length
)
1158 mdl
->Size
= sizeof(MDL
) + sizeof(PFN_NUMBER
) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(va
, length
);
1160 mdl
->StartVa
= (void *)PAGE_ALIGN(va
);
1161 mdl
->ByteOffset
= BYTE_OFFSET(va
);
1162 mdl
->ByteCount
= length
;
1165 typedef struct _KTIMER
{
1166 DISPATCHER_HEADER Header
;
1167 ULARGE_INTEGER DueTime
;
1168 LIST_ENTRY TimerListEntry
;
1173 typedef struct _KSYSTEM_TIME
{
1177 } KSYSTEM_TIME
, *PKSYSTEM_TIME
;
1179 typedef enum _NT_PRODUCT_TYPE
{
1183 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
1185 #define PROCESSOR_FEATURE_MAX 64
1187 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
1192 } ALTERNATIVE_ARCHITECTURE_TYPE
;
1194 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1195 #define NX_SUPPORT_POLICY_ALWAYSON 1
1196 #define NX_SUPPORT_POLICY_OPTIN 2
1197 #define NX_SUPPORT_POLICY_OPTOUT 3
1199 typedef struct _KUSER_SHARED_DATA
{
1200 ULONG TickCountLowDeprecated
; /* 0x000 */
1201 ULONG TickCountMultiplier
; /* 0x004 */
1202 volatile KSYSTEM_TIME InterruptTime
; /* 0x008 */
1203 volatile KSYSTEM_TIME SystemTime
; /* 0x014 */
1204 volatile KSYSTEM_TIME TimeZoneBias
; /* 0x020 */
1205 USHORT ImageNumberLow
; /* 0x02c */
1206 USHORT ImageNumberHigh
; /* 0x02e */
1207 WCHAR NtSystemRoot
[260]; /* 0x030 */
1208 ULONG MaxStackTraceDepth
; /* 0x238 */
1209 ULONG CryptoExponent
; /* 0x23c */
1210 ULONG TimeZoneId
; /* 0x240 */
1211 ULONG LargePageMinimum
; /* 0x244 */
1212 ULONG AitSamplingValue
; /* 0x248 */
1213 ULONG AppCompatFlag
; /* 0x24c */
1214 ULONGLONG RNGSeedVersion
; /* 0x250 */
1215 ULONG GlobalValidationRunLevel
; /* 0x258 */
1216 volatile ULONG TimeZoneBiasStamp
; /* 0x25c */
1217 ULONG NtBuildNumber
; /* 0x260 */
1218 NT_PRODUCT_TYPE NtProductType
; /* 0x264 */
1219 BOOLEAN ProductTypeIsValid
; /* 0x268 */
1220 USHORT NativeProcessorArchitecture
; /* 0x26a */
1221 ULONG NtMajorVersion
; /* 0x26c */
1222 ULONG NtMinorVersion
; /* 0x270 */
1223 BOOLEAN ProcessorFeatures
[PROCESSOR_FEATURE_MAX
]; /* 0x274 */
1224 ULONG Reserved1
; /* 0x2b4 */
1225 ULONG Reserved3
; /* 0x2b8 */
1226 volatile ULONG TimeSlip
; /* 0x2bc */
1227 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture
; /* 0x2c0 */
1228 ULONG BootId
; /* 0x2c4 */
1229 LARGE_INTEGER SystemExpirationDate
; /* 0x2c8 */
1230 ULONG SuiteMask
; /* 0x2d0 */
1231 BOOLEAN KdDebuggerEnabled
; /* 0x2d4 */
1232 UCHAR NXSupportPolicy
; /* 0x2d5 */
1233 USHORT CyclesPerYield
; /* 0x2d6 */
1234 volatile ULONG ActiveConsoleId
; /* 0x2d8 */
1235 volatile ULONG DismountCount
; /* 0x2dc */
1236 ULONG ComPlusPackage
; /* 0x2e0 */
1237 ULONG LastSystemRITEventTickCount
; /* 0x2e4 */
1238 ULONG NumberOfPhysicalPages
; /* 0x2e8 */
1239 BOOLEAN SafeBootMode
; /* 0x2ec */
1240 UCHAR VirtualizationFlags
; /* 0x2ed */
1242 ULONG SharedDataFlags
; /* 0x2f0 */
1244 ULONG DbgErrorPortPresent
: 1;
1245 ULONG DbgElevationEnabed
: 1;
1246 ULONG DbgVirtEnabled
: 1;
1247 ULONG DbgInstallerDetectEnabled
: 1;
1248 ULONG DbgLkgEnabled
: 1;
1249 ULONG DbgDynProcessorEnabled
: 1;
1250 ULONG DbgConsoleBrokerEnabled
: 1;
1251 ULONG DbgSecureBootEnabled
: 1;
1252 ULONG DbgMultiSessionSku
: 1;
1253 ULONG DbgMultiUsersInSessionSku
: 1;
1254 ULONG DbgStateSeparationEnabled
: 1;
1255 ULONG SpareBits
: 21;
1258 ULONG DataFlagsPad
[1]; /* 0x2f4 */
1259 ULONGLONG TestRetInstruction
; /* 0x2f8 */
1260 LONGLONG QpcFrequency
; /* 0x300 */
1261 ULONG SystemCall
; /* 0x308 */
1263 ULONG AllFlags
; /* 0x30c */
1265 ULONG Win32Process
: 1;
1266 ULONG Sgx2Enclave
: 1;
1267 ULONG VbsBasicEnclave
: 1;
1268 ULONG SpareBits
: 29;
1270 } UserCetAvailableEnvironments
;
1271 ULONGLONG SystemCallPad
[2]; /* 0x310 */
1273 volatile KSYSTEM_TIME TickCount
; /* 0x320 */
1274 volatile ULONG64 TickCountQuad
;
1276 ULONG Cookie
; /* 0x330 */
1277 ULONG CookiePad
[1]; /* 0x334 */
1278 LONGLONG ConsoleSessionForegroundProcessId
; /* 0x338 */
1279 ULONGLONG TimeUpdateLock
; /* 0x340 */
1280 ULONGLONG BaselineSystemTimeQpc
; /* 0x348 */
1281 ULONGLONG BaselineInterruptTimeQpc
; /* 0x350 */
1282 ULONGLONG QpcSystemTimeIncrement
; /* 0x358 */
1283 ULONGLONG QpcInterruptTimeIncrement
; /* 0x360 */
1284 UCHAR QpcSystemTimeIncrementShift
; /* 0x368 */
1285 UCHAR QpcInterruptTimeIncrementShift
; /* 0x369 */
1286 USHORT UnparkedProcessorCount
; /* 0x36a */
1287 ULONG EnclaveFeatureMask
[4]; /* 0x36c */
1288 ULONG TelemetryCoverageRound
; /* 0x37c */
1289 USHORT UserModeGlobalLogger
[16]; /* 0x380 */
1290 ULONG ImageFileExecutionOptions
; /* 0x3a0 */
1291 ULONG LangGenerationCount
; /* 0x3a4 */
1292 ULONG ActiveProcessorAffinity
; /* 0x3a8 */
1293 volatile ULONGLONG InterruptTimeBias
; /* 0x3b0 */
1294 volatile ULONGLONG QpcBias
; /* 0x3b8 */
1295 ULONG ActiveProcessorCount
; /* 0x3c0 */
1296 volatile UCHAR ActiveGroupCount
; /* 0x3c4 */
1298 USHORT QpcData
; /* 0x3c6 */
1300 UCHAR
volatile QpcBypassEnabled
;
1304 LARGE_INTEGER TimeZoneBiasEffectiveStart
; /* 0x3c8 */
1305 LARGE_INTEGER TimeZoneBiasEffectiveEnd
; /* 0x3d0 */
1306 XSTATE_CONFIGURATION XState
; /* 0x3d8 */
1307 } KSHARED_USER_DATA
, *PKSHARED_USER_DATA
;
1309 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED 0x01
1310 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE 0x02
1311 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_DISABLE_32BIT 0x04
1312 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_MFENCE 0x10
1313 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_LFENCE 0x20
1314 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_A73_ERRATA 0x40
1315 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_RDTSCP 0x80
1317 typedef enum _MEMORY_CACHING_TYPE
{
1320 MmWriteCombined
= 2,
1321 MmHardwareCoherentCached
= 3,
1322 MmNonCachedUnordered
= 4,
1324 MmMaximumCacheType
= 6
1325 } MEMORY_CACHING_TYPE
;
1327 typedef enum _MM_PAGE_PRIORITY
{
1329 NormalPagePriority
= 16,
1330 HighPagePriority
= 32
1333 typedef enum _MM_SYSTEM_SIZE
1340 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK
{
1342 BOOLEAN Reserved
[3];
1345 } IO_REMOVE_LOCK_COMMON_BLOCK
;
1347 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK
*PIO_REMOVE_LOCK_TRACKING_BLOCK
;
1349 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK
{
1352 LONGLONG MaxLockedTicks
;
1354 LIST_ENTRY LockList
;
1356 LONG LowMemoryCount
;
1359 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks
;
1360 } IO_REMOVE_LOCK_DBG_BLOCK
;
1362 typedef struct _IO_REMOVE_LOCK
{
1363 IO_REMOVE_LOCK_COMMON_BLOCK Common
;
1364 IO_REMOVE_LOCK_DBG_BLOCK Dbg
;
1365 } IO_REMOVE_LOCK
, *PIO_REMOVE_LOCK
;
1373 typedef struct _CALLBACK_OBJECT
1377 LIST_ENTRY RegisteredCallbacks
;
1378 BOOLEAN AllowMultipleCallbacks
;
1380 } CALLBACK_OBJECT
, *PCALLBACK_OBJECT
;
1382 typedef struct _KSPIN_LOCK_QUEUE
{
1383 struct _KSPIN_LOCK_QUEUE
* volatile Next
;
1384 volatile PKSPIN_LOCK Lock
;
1385 } KSPIN_LOCK_QUEUE
, *PKSPIN_LOCK_QUEUE
;
1387 typedef struct _KLOCK_QUEUE_HANDLE
{
1388 KSPIN_LOCK_QUEUE LockQueue
;
1390 } KLOCK_QUEUE_HANDLE
, *PKLOCK_QUEUE_HANDLE
;
1392 typedef void * (NTAPI
*PALLOCATE_FUNCTION
)(POOL_TYPE
, SIZE_T
, ULONG
);
1393 typedef void * (NTAPI
*PALLOCATE_FUNCTION_EX
)(POOL_TYPE
, SIZE_T
, ULONG
, PLOOKASIDE_LIST_EX
);
1394 typedef void (NTAPI
*PFREE_FUNCTION
)(void *);
1395 typedef void (NTAPI
*PFREE_FUNCTION_EX
)(void *, PLOOKASIDE_LIST_EX
);
1396 typedef void (NTAPI
*PCALLBACK_FUNCTION
)(void *, void *, void *);
1399 #define LOOKASIDE_ALIGN DECLSPEC_CACHEALIGN
1401 #define LOOKASIDE_ALIGN
1404 #define LOOKASIDE_MINIMUM_BLOCK_SIZE (RTL_SIZEOF_THROUGH_FIELD(SLIST_ENTRY, Next))
1406 #define GENERAL_LOOKASIDE_LAYOUT \
1409 SLIST_HEADER ListHead; \
1410 SINGLE_LIST_ENTRY SingleListHead; \
1413 USHORT MaximumDepth; \
1414 ULONG TotalAllocates; \
1417 ULONG AllocateMisses; \
1418 ULONG AllocateHits; \
1419 } DUMMYUNIONNAME2; \
1425 } DUMMYUNIONNAME3; \
1431 PALLOCATE_FUNCTION_EX AllocateEx; \
1432 PALLOCATE_FUNCTION Allocate; \
1433 } DUMMYUNIONNAME4; \
1436 PFREE_FUNCTION_EX FreeEx; \
1437 PFREE_FUNCTION Free; \
1438 } DUMMYUNIONNAME5; \
1439 LIST_ENTRY ListEntry; \
1440 ULONG LastTotalAllocates; \
1443 ULONG LastAllocateMisses; \
1444 ULONG LastAllocateHits; \
1445 } DUMMYUNIONNAME6; \
1448 typedef struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE
1450 GENERAL_LOOKASIDE_LAYOUT
1451 } GENERAL_LOOKASIDE
;
1453 typedef struct _GENERAL_LOOKASIDE_POOL
1455 GENERAL_LOOKASIDE_LAYOUT
1456 } GENERAL_LOOKASIDE_POOL
, *PGENERAL_LOOKASIDE_POOL
;
1458 typedef struct _LOOKASIDE_LIST_EX
1460 GENERAL_LOOKASIDE_POOL L
;
1461 } LOOKASIDE_LIST_EX
;
1463 typedef struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST
1465 GENERAL_LOOKASIDE L
;
1466 #if defined(__i386__)
1467 KSPIN_LOCK Lock__ObsoleteButDoNotDelete
;
1469 } NPAGED_LOOKASIDE_LIST
, *PNPAGED_LOOKASIDE_LIST
;
1471 typedef struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST
1473 GENERAL_LOOKASIDE L
;
1474 #if defined(__i386__)
1475 FAST_MUTEX Lock__ObsoleteButDoNotDelete
;
1477 } PAGED_LOOKASIDE_LIST
, *PPAGED_LOOKASIDE_LIST
;
1479 typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION
)(void *CallbackContext
, void *Argument1
, void *Argument2
);
1480 typedef EX_CALLBACK_FUNCTION
*PEX_CALLBACK_FUNCTION
;
1482 typedef ULONG OB_OPERATION
;
1484 typedef struct _OB_PRE_CREATE_HANDLE_INFORMATION
{
1485 ACCESS_MASK DesiredAccess
;
1486 ACCESS_MASK OriginalDesiredAccess
;
1487 } OB_PRE_CREATE_HANDLE_INFORMATION
, *POB_PRE_CREATE_HANDLE_INFORMATION
;
1489 typedef struct _OB_PRE_DUPLICATE_HANDLE_INFORMATION
{
1490 ACCESS_MASK DesiredAccess
;
1491 ACCESS_MASK OriginalDesiredAccess
;
1492 PVOID SourceProcess
;
1493 PVOID TargetProcess
;
1494 } OB_PRE_DUPLICATE_HANDLE_INFORMATION
, *POB_PRE_DUPLICATE_HANDLE_INFORMATION
;
1496 typedef union _OB_PRE_OPERATION_PARAMETERS
{
1497 OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1498 OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1499 } OB_PRE_OPERATION_PARAMETERS
, *POB_PRE_OPERATION_PARAMETERS
;
1501 typedef struct _OB_PRE_OPERATION_INFORMATION
{
1502 OB_OPERATION Operation
;
1506 ULONG KernelHandle
:1;
1511 POBJECT_TYPE ObjectType
;
1513 POB_PRE_OPERATION_PARAMETERS Parameters
;
1514 } OB_PRE_OPERATION_INFORMATION
, *POB_PRE_OPERATION_INFORMATION
;
1516 typedef struct _OB_POST_CREATE_HANDLE_INFORMATION
{
1517 ACCESS_MASK GrantedAccess
;
1518 } OB_POST_CREATE_HANDLE_INFORMATION
, *POB_POST_CREATE_HANDLE_INFORMATION
;
1520 typedef struct _OB_POST_DUPLICATE_HANDLE_INFORMATION
{
1521 ACCESS_MASK GrantedAccess
;
1522 } OB_POST_DUPLICATE_HANDLE_INFORMATION
, *POB_POST_DUPLICATE_HANDLE_INFORMATION
;
1524 typedef union _OB_POST_OPERATION_PARAMETERS
{
1525 OB_POST_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1526 OB_POST_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1527 } OB_POST_OPERATION_PARAMETERS
, *POB_POST_OPERATION_PARAMETERS
;
1529 typedef struct _OB_POST_OPERATION_INFORMATION
{
1530 OB_OPERATION Operation
;
1534 ULONG KernelHandle
:1;
1539 POBJECT_TYPE ObjectType
;
1541 NTSTATUS ReturnStatus
;
1542 POB_POST_OPERATION_PARAMETERS Parameters
;
1543 } OB_POST_OPERATION_INFORMATION
,*POB_POST_OPERATION_INFORMATION
;
1545 typedef enum _OB_PREOP_CALLBACK_STATUS
{
1547 } OB_PREOP_CALLBACK_STATUS
, *POB_PREOP_CALLBACK_STATUS
;
1549 typedef OB_PREOP_CALLBACK_STATUS (WINAPI
*POB_PRE_OPERATION_CALLBACK
)(void *context
, POB_PRE_OPERATION_INFORMATION information
);
1550 typedef void (WINAPI
*POB_POST_OPERATION_CALLBACK
)(void *context
, POB_POST_OPERATION_INFORMATION information
);
1552 typedef struct _OB_OPERATION_REGISTRATION
{
1553 POBJECT_TYPE
*ObjectType
;
1554 OB_OPERATION Operations
;
1555 POB_PRE_OPERATION_CALLBACK PreOperation
;
1556 POB_POST_OPERATION_CALLBACK PostOperation
;
1557 } OB_OPERATION_REGISTRATION
, *POB_OPERATION_REGISTRATION
;
1559 typedef struct _OB_CALLBACK_REGISTRATION
{
1561 USHORT OperationRegistrationCount
;
1562 UNICODE_STRING Altitude
;
1563 PVOID RegistrationContext
;
1564 OB_OPERATION_REGISTRATION
*OperationRegistration
;
1565 } OB_CALLBACK_REGISTRATION
, *POB_CALLBACK_REGISTRATION
;
1567 #define OB_FLT_REGISTRATION_VERSION_0100 0x0100
1568 #define OB_FLT_REGISTRATION_VERSION OB_FLT_REGISTRATION_VERSION_0100
1570 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS
{
1571 DirectoryNotifyInformation
= 1,
1572 DirectoryNotifyExtendedInformation
1573 } DIRECTORY_NOTIFY_INFORMATION_CLASS
, *PDIRECTORY_NOTIFY_INFORMATION_CLASS
;
1575 typedef enum _WORK_QUEUE_TYPE
{
1578 HyperCriticalWorkQueue
,
1582 typedef void (WINAPI
*PIO_WORKITEM_ROUTINE
)(PDEVICE_OBJECT
,void*);
1584 NTSTATUS WINAPI
ObCloseHandle(IN HANDLE handle
);
1586 #ifdef NONAMELESSUNION
1587 # ifdef NONAMELESSSTRUCT
1588 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1589 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1590 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1592 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1593 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1594 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1597 # ifdef NONAMELESSSTRUCT
1598 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1599 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1600 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1602 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1603 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1604 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1608 #define IoSetCancelRoutine(irp, routine) \
1609 ((PDRIVER_CANCEL)InterlockedExchangePointer((void **)&(irp)->CancelRoutine, routine))
1611 static inline void IoSetCompletionRoutine(IRP
*irp
, PIO_COMPLETION_ROUTINE routine
, void *context
,
1612 BOOLEAN on_success
, BOOLEAN on_error
, BOOLEAN on_cancel
)
1614 IO_STACK_LOCATION
*irpsp
= IoGetNextIrpStackLocation(irp
);
1615 irpsp
->CompletionRoutine
= routine
;
1616 irpsp
->Context
= context
;
1618 if (on_success
) irpsp
->Control
|= SL_INVOKE_ON_SUCCESS
;
1619 if (on_error
) irpsp
->Control
|= SL_INVOKE_ON_ERROR
;
1620 if (on_cancel
) irpsp
->Control
|= SL_INVOKE_ON_CANCEL
;
1623 static inline void IoMarkIrpPending(IRP
*irp
)
1625 IoGetCurrentIrpStackLocation(irp
)->Control
|= SL_PENDING_RETURNED
;
1628 static inline void IoCopyCurrentIrpStackLocationToNext(IRP
*irp
)
1630 IO_STACK_LOCATION
*current
= IoGetCurrentIrpStackLocation(irp
);
1631 IO_STACK_LOCATION
*next
= IoGetNextIrpStackLocation(irp
);
1632 memcpy(next
, current
, FIELD_OFFSET(IO_STACK_LOCATION
, CompletionRoutine
));
1636 #define KernelMode 0
1639 /* directory object access rights */
1640 #define DIRECTORY_QUERY 0x0001
1641 #define DIRECTORY_TRAVERSE 0x0002
1642 #define DIRECTORY_CREATE_OBJECT 0x0004
1643 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1644 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1646 /* symbolic link access rights */
1647 #define SYMBOLIC_LINK_QUERY 0x0001
1648 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1650 NTSTATUS WINAPI
DbgQueryDebugFilterState(ULONG
, ULONG
);
1652 void FASTCALL
ExAcquireFastMutex(FAST_MUTEX
*);
1653 void FASTCALL
ExAcquireFastMutexUnsafe(PFAST_MUTEX
);
1654 BOOLEAN WINAPI
ExAcquireResourceExclusiveLite(ERESOURCE
*,BOOLEAN
);
1655 BOOLEAN WINAPI
ExAcquireResourceSharedLite(ERESOURCE
*,BOOLEAN
);
1656 BOOLEAN WINAPI
ExAcquireSharedStarveExclusive(ERESOURCE
*,BOOLEAN
);
1657 BOOLEAN WINAPI
ExAcquireSharedWaitForExclusive(ERESOURCE
*,BOOLEAN
);
1658 PVOID WINAPI
ExAllocatePool(POOL_TYPE
,SIZE_T
);
1659 PVOID WINAPI
ExAllocatePoolWithQuota(POOL_TYPE
,SIZE_T
);
1660 PVOID WINAPI
ExAllocatePoolWithTag(POOL_TYPE
,SIZE_T
,ULONG
);
1661 PVOID WINAPI
ExAllocatePoolWithQuotaTag(POOL_TYPE
,SIZE_T
,ULONG
);
1662 void WINAPI
ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
);
1663 void WINAPI
ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST
);
1664 NTSTATUS WINAPI
ExDeleteResourceLite(ERESOURCE
*);
1665 void WINAPI
ExFreePool(PVOID
);
1666 void WINAPI
ExFreePoolWithTag(PVOID
,ULONG
);
1667 ULONG WINAPI
ExGetExclusiveWaiterCount(ERESOURCE
*);
1668 ULONG WINAPI
ExGetSharedWaiterCount(ERESOURCE
*);
1669 void WINAPI
ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1670 void WINAPI
ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1671 NTSTATUS WINAPI
ExInitializeResourceLite(ERESOURCE
*);
1672 PSLIST_ENTRY WINAPI
ExInterlockedFlushSList(PSLIST_HEADER
);
1673 PSLIST_ENTRY WINAPI
ExInterlockedPopEntrySList(PSLIST_HEADER
,PKSPIN_LOCK
);
1674 PSLIST_ENTRY WINAPI
ExInterlockedPushEntrySList(PSLIST_HEADER
,PSLIST_ENTRY
,PKSPIN_LOCK
);
1675 LIST_ENTRY
* WINAPI
ExInterlockedRemoveHeadList(LIST_ENTRY
*,KSPIN_LOCK
*);
1676 BOOLEAN WINAPI
ExIsResourceAcquiredExclusiveLite(ERESOURCE
*);
1677 ULONG WINAPI
ExIsResourceAcquiredSharedLite(ERESOURCE
*);
1678 void * WINAPI
ExRegisterCallback(PCALLBACK_OBJECT
,PCALLBACK_FUNCTION
,void*);
1679 void FASTCALL
ExReleaseFastMutex(FAST_MUTEX
*);
1680 void FASTCALL
ExReleaseFastMutexUnsafe(PFAST_MUTEX
);
1681 void WINAPI
ExReleaseResourceForThreadLite(ERESOURCE
*,ERESOURCE_THREAD
);
1682 ULONG WINAPI
ExSetTimerResolution(ULONG
,BOOLEAN
);
1683 void WINAPI
ExUnregisterCallback(void*);
1685 #define PLUGPLAY_PROPERTY_PERSISTENT 0x0001
1687 void WINAPI
IoAcquireCancelSpinLock(KIRQL
*);
1688 NTSTATUS WINAPI
IoAcquireRemoveLockEx(IO_REMOVE_LOCK
*,void*,const char*,ULONG
, ULONG
);
1689 NTSTATUS WINAPI
IoAllocateDriverObjectExtension(PDRIVER_OBJECT
,PVOID
,ULONG
,PVOID
*);
1690 PVOID WINAPI
IoAllocateErrorLogEntry(PVOID
,UCHAR
);
1691 PIRP WINAPI
IoAllocateIrp(CCHAR
,BOOLEAN
);
1692 PMDL WINAPI
IoAllocateMdl(PVOID
,ULONG
,BOOLEAN
,BOOLEAN
,IRP
*);
1693 PIO_WORKITEM WINAPI
IoAllocateWorkItem(PDEVICE_OBJECT
);
1694 void WINAPI
IoDetachDevice(PDEVICE_OBJECT
);
1695 PDEVICE_OBJECT WINAPI
IoAttachDeviceToDeviceStack(PDEVICE_OBJECT
,PDEVICE_OBJECT
);
1696 PIRP WINAPI
IoBuildAsynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,void*,ULONG
,LARGE_INTEGER
*,IO_STATUS_BLOCK
*);
1697 PIRP WINAPI
IoBuildDeviceIoControlRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PVOID
,ULONG
,BOOLEAN
,PKEVENT
,IO_STATUS_BLOCK
*);
1698 PIRP WINAPI
IoBuildSynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PLARGE_INTEGER
,PKEVENT
,IO_STATUS_BLOCK
*);
1699 NTSTATUS WINAPI
IoCallDriver(DEVICE_OBJECT
*,IRP
*);
1700 BOOLEAN WINAPI
IoCancelIrp(IRP
*);
1701 VOID WINAPI
IoCompleteRequest(IRP
*,UCHAR
);
1702 NTSTATUS WINAPI
IoCreateDevice(DRIVER_OBJECT
*,ULONG
,UNICODE_STRING
*,DEVICE_TYPE
,ULONG
,BOOLEAN
,DEVICE_OBJECT
**);
1703 NTSTATUS WINAPI
IoCreateDriver(UNICODE_STRING
*,PDRIVER_INITIALIZE
);
1704 NTSTATUS WINAPI
IoCreateSymbolicLink(UNICODE_STRING
*,UNICODE_STRING
*);
1705 PKEVENT WINAPI
IoCreateSynchronizationEvent(UNICODE_STRING
*,HANDLE
*);
1706 void WINAPI
IoDeleteDevice(DEVICE_OBJECT
*);
1707 void WINAPI
IoDeleteDriver(DRIVER_OBJECT
*);
1708 NTSTATUS WINAPI
IoDeleteSymbolicLink(UNICODE_STRING
*);
1709 void WINAPI
IoFreeIrp(IRP
*);
1710 void WINAPI
IoFreeMdl(MDL
*);
1711 void WINAPI
IoFreeWorkItem(PIO_WORKITEM
);
1712 DEVICE_OBJECT
* WINAPI
IoGetAttachedDeviceReference(DEVICE_OBJECT
*);
1713 PEPROCESS WINAPI
IoGetCurrentProcess(void);
1714 NTSTATUS WINAPI
IoGetDeviceInterfaces(const GUID
*,PDEVICE_OBJECT
,ULONG
,PWSTR
*);
1715 NTSTATUS WINAPI
IoGetDeviceObjectPointer(UNICODE_STRING
*,ACCESS_MASK
,PFILE_OBJECT
*,PDEVICE_OBJECT
*);
1716 NTSTATUS WINAPI
IoGetDeviceProperty(PDEVICE_OBJECT
,DEVICE_REGISTRY_PROPERTY
,ULONG
,PVOID
,PULONG
);
1717 PVOID WINAPI
IoGetDriverObjectExtension(PDRIVER_OBJECT
,PVOID
);
1718 PDEVICE_OBJECT WINAPI
IoGetRelatedDeviceObject(PFILE_OBJECT
);
1719 void WINAPI
IoGetStackLimits(ULONG_PTR
*,ULONG_PTR
*);
1720 void WINAPI
IoInitializeIrp(IRP
*,USHORT
,CCHAR
);
1721 VOID WINAPI
IoInitializeRemoveLockEx(PIO_REMOVE_LOCK
,ULONG
,ULONG
,ULONG
,ULONG
);
1722 void WINAPI
IoInvalidateDeviceRelations(PDEVICE_OBJECT
,DEVICE_RELATION_TYPE
);
1724 BOOLEAN WINAPI
IoIs32bitProcess(IRP
*);
1726 NTSTATUS WINAPI
IoOpenDeviceRegistryKey(DEVICE_OBJECT
*,ULONG
,ACCESS_MASK
,HANDLE
*);
1727 void WINAPI
IoQueueWorkItem(PIO_WORKITEM
,PIO_WORKITEM_ROUTINE
,WORK_QUEUE_TYPE
,void*);
1728 NTSTATUS WINAPI
IoRegisterDeviceInterface(PDEVICE_OBJECT
,const GUID
*,PUNICODE_STRING
,PUNICODE_STRING
);
1729 void WINAPI
IoReleaseCancelSpinLock(KIRQL
);
1730 void WINAPI
IoReleaseRemoveLockAndWaitEx(IO_REMOVE_LOCK
*,void*,ULONG
);
1731 void WINAPI
IoReleaseRemoveLockEx(IO_REMOVE_LOCK
*,void*,ULONG
);
1732 void WINAPI
IoReuseIrp(IRP
*,NTSTATUS
);
1733 NTSTATUS WINAPI
IoSetDeviceInterfaceState(UNICODE_STRING
*,BOOLEAN
);
1734 NTSTATUS WINAPI
IoSetDevicePropertyData(DEVICE_OBJECT
*,const DEVPROPKEY
*,LCID
,ULONG
,DEVPROPTYPE
,ULONG
,void*);
1735 NTSTATUS WINAPI
IoWMIRegistrationControl(PDEVICE_OBJECT
,ULONG
);
1737 void FASTCALL
KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK
*,KLOCK_QUEUE_HANDLE
*);
1739 void WINAPI
KeAcquireSpinLock(KSPIN_LOCK
*,KIRQL
*);
1741 #define KeAcquireSpinLock( lock, irql ) *(irql) = KeAcquireSpinLockRaiseToDpc( lock )
1742 KIRQL WINAPI
KeAcquireSpinLockRaiseToDpc(KSPIN_LOCK
*);
1744 void WINAPI
KeAcquireSpinLockAtDpcLevel(KSPIN_LOCK
*);
1745 void WINAPI DECLSPEC_NORETURN
KeBugCheckEx(ULONG
,ULONG_PTR
,ULONG_PTR
,ULONG_PTR
,ULONG_PTR
);
1746 BOOLEAN WINAPI
KeCancelTimer(KTIMER
*);
1747 void WINAPI
KeClearEvent(PRKEVENT
);
1748 NTSTATUS WINAPI
KeDelayExecutionThread(KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1749 void WINAPI
KeEnterCriticalRegion(void);
1750 void WINAPI
KeGenericCallDpc(PKDEFERRED_ROUTINE
,PVOID
);
1751 ULONG WINAPI
KeGetCurrentProcessorNumber(void);
1752 PKTHREAD WINAPI
KeGetCurrentThread(void);
1753 void WINAPI
KeInitializeDpc(KDPC
*,PKDEFERRED_ROUTINE
,void*);
1754 void WINAPI
KeInitializeEvent(PRKEVENT
,EVENT_TYPE
,BOOLEAN
);
1755 void WINAPI
KeInitializeMutex(PRKMUTEX
,ULONG
);
1756 void WINAPI
KeInitializeSemaphore(PRKSEMAPHORE
,LONG
,LONG
);
1757 void WINAPI
KeInitializeSpinLock(KSPIN_LOCK
*);
1758 void WINAPI
KeInitializeTimerEx(PKTIMER
,TIMER_TYPE
);
1759 void WINAPI
KeInitializeTimer(KTIMER
*);
1760 void WINAPI
KeLeaveCriticalRegion(void);
1761 ULONG WINAPI
KeQueryActiveProcessorCountEx(USHORT
);
1762 KAFFINITY WINAPI
KeQueryActiveProcessors(void);
1763 void WINAPI
KeQuerySystemTime(LARGE_INTEGER
*);
1764 void WINAPI
KeQueryTickCount(LARGE_INTEGER
*);
1765 ULONG WINAPI
KeQueryTimeIncrement(void);
1766 LONG WINAPI
KeReadStateEvent(PRKEVENT
);
1767 void FASTCALL
KeReleaseInStackQueuedSpinLockFromDpcLevel(KLOCK_QUEUE_HANDLE
*);
1768 LONG WINAPI
KeReleaseMutex(PRKMUTEX
,BOOLEAN
);
1769 LONG WINAPI
KeReleaseSemaphore(PRKSEMAPHORE
,KPRIORITY
,LONG
,BOOLEAN
);
1770 void WINAPI
KeReleaseSpinLock(KSPIN_LOCK
*,KIRQL
);
1771 void WINAPI
KeReleaseSpinLockFromDpcLevel(KSPIN_LOCK
*);
1772 LONG WINAPI
KeResetEvent(PRKEVENT
);
1773 void WINAPI
KeRevertToUserAffinityThread(void);
1774 void WINAPI
KeRevertToUserAffinityThreadEx(KAFFINITY affinity
);
1775 LONG WINAPI
KeSetEvent(PRKEVENT
,KPRIORITY
,BOOLEAN
);
1776 KPRIORITY WINAPI
KeSetPriorityThread(PKTHREAD
,KPRIORITY
);
1777 void WINAPI
KeSetSystemAffinityThread(KAFFINITY
);
1778 KAFFINITY WINAPI
KeSetSystemAffinityThreadEx(KAFFINITY affinity
);
1779 BOOLEAN WINAPI
KeSetTimer(KTIMER
*,LARGE_INTEGER
,KDPC
*);
1780 BOOLEAN WINAPI
KeSetTimerEx(KTIMER
*,LARGE_INTEGER
,LONG
,KDPC
*);
1781 void WINAPI
KeSignalCallDpcDone(void*);
1782 BOOLEAN WINAPI
KeSignalCallDpcSynchronize(void*);
1783 NTSTATUS WINAPI
KeWaitForMultipleObjects(ULONG
,void*[],WAIT_TYPE
,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*,KWAIT_BLOCK
*);
1784 NTSTATUS WINAPI
KeWaitForSingleObject(void*,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1786 PVOID WINAPI
MmAllocateContiguousMemory(SIZE_T
,PHYSICAL_ADDRESS
);
1787 PVOID WINAPI
MmAllocateNonCachedMemory(SIZE_T
);
1788 PMDL WINAPI
MmAllocatePagesForMdl(PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,SIZE_T
);
1789 void WINAPI
MmBuildMdlForNonPagedPool(MDL
*);
1790 NTSTATUS WINAPI
MmCopyVirtualMemory(PEPROCESS
,void*,PEPROCESS
,void*,SIZE_T
,KPROCESSOR_MODE
,SIZE_T
*);
1791 void WINAPI
MmFreeNonCachedMemory(PVOID
,SIZE_T
);
1792 void * WINAPI
MmGetSystemRoutineAddress(UNICODE_STRING
*);
1793 PVOID WINAPI
MmMapLockedPagesSpecifyCache(PMDLX
,KPROCESSOR_MODE
,MEMORY_CACHING_TYPE
,PVOID
,ULONG
,MM_PAGE_PRIORITY
);
1794 MM_SYSTEMSIZE WINAPI
MmQuerySystemSize(void);
1795 void WINAPI
MmProbeAndLockPages(PMDLX
, KPROCESSOR_MODE
, LOCK_OPERATION
);
1796 void WINAPI
MmUnmapLockedPages(void*, PMDL
);
1798 static inline void *MmGetSystemAddressForMdlSafe(MDL
*mdl
, ULONG priority
)
1800 if (mdl
->MdlFlags
& (MDL_MAPPED_TO_SYSTEM_VA
| MDL_SOURCE_IS_NONPAGED_POOL
))
1801 return mdl
->MappedSystemVa
;
1803 return MmMapLockedPagesSpecifyCache(mdl
, KernelMode
, MmCached
, NULL
, FALSE
, priority
);
1806 void FASTCALL
ObfReferenceObject(void*);
1807 void WINAPI
ObDereferenceObject(void*);
1808 USHORT WINAPI
ObGetFilterVersion(void);
1809 NTSTATUS WINAPI
ObRegisterCallbacks(POB_CALLBACK_REGISTRATION
, void**);
1810 NTSTATUS WINAPI
ObReferenceObjectByHandle(HANDLE
,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,PVOID
*,POBJECT_HANDLE_INFORMATION
);
1811 NTSTATUS WINAPI
ObReferenceObjectByName(UNICODE_STRING
*,ULONG
,ACCESS_STATE
*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,void*,void**);
1812 NTSTATUS WINAPI
ObReferenceObjectByPointer(void*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
);
1813 void WINAPI
ObUnRegisterCallbacks(void*);
1815 NTSTATUS WINAPI
PoCallDriver(DEVICE_OBJECT
*,IRP
*);
1816 POWER_STATE WINAPI
PoSetPowerState(PDEVICE_OBJECT
,POWER_STATE_TYPE
,POWER_STATE
);
1817 void WINAPI
PoStartNextPowerIrp(IRP
*);
1819 NTSTATUS WINAPI
PsCreateSystemThread(PHANDLE
,ULONG
,POBJECT_ATTRIBUTES
,HANDLE
,PCLIENT_ID
,PKSTART_ROUTINE
,PVOID
);
1820 #define PsGetCurrentProcess() IoGetCurrentProcess()
1821 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1822 HANDLE WINAPI
PsGetCurrentProcessId(void);
1823 HANDLE WINAPI
PsGetCurrentThreadId(void);
1824 HANDLE WINAPI
PsGetProcessInheritedFromUniqueProcessId(PEPROCESS
);
1825 BOOLEAN WINAPI
PsGetVersion(ULONG
*,ULONG
*,ULONG
*,UNICODE_STRING
*);
1826 NTSTATUS WINAPI
PsTerminateSystemThread(NTSTATUS
);
1829 void WINAPI
RtlCopyMemoryNonTemporal(void*,const void*,SIZE_T
);
1831 #define RtlCopyMemoryNonTemporal RtlCopyMemory
1833 BOOLEAN WINAPI
RtlIsNtDdiVersionAvailable(ULONG
);
1835 NTSTATUS WINAPI
ZwAddBootEntry(PUNICODE_STRING
,PUNICODE_STRING
);
1836 NTSTATUS WINAPI
ZwAccessCheckAndAuditAlarm(PUNICODE_STRING
,HANDLE
,PUNICODE_STRING
,PUNICODE_STRING
,PSECURITY_DESCRIPTOR
,ACCESS_MASK
,PGENERIC_MAPPING
,BOOLEAN
,PACCESS_MASK
,PBOOLEAN
,PBOOLEAN
);
1837 NTSTATUS WINAPI
ZwAdjustPrivilegesToken(HANDLE
,BOOLEAN
,PTOKEN_PRIVILEGES
,DWORD
,PTOKEN_PRIVILEGES
,PDWORD
);
1838 NTSTATUS WINAPI
ZwAlertThread(HANDLE ThreadHandle
);
1839 NTSTATUS WINAPI
ZwAllocateVirtualMemory(HANDLE
,PVOID
*,ULONG
,SIZE_T
*,ULONG
,ULONG
);
1840 NTSTATUS WINAPI
ZwCancelIoFile(HANDLE
,PIO_STATUS_BLOCK
);
1841 NTSTATUS WINAPI
ZwCancelTimer(HANDLE
, BOOLEAN
*);
1842 NTSTATUS WINAPI
ZwClearEvent(HANDLE
);
1843 NTSTATUS WINAPI
ZwClose(HANDLE
);
1844 NTSTATUS WINAPI
ZwCloseObjectAuditAlarm(PUNICODE_STRING
,HANDLE
,BOOLEAN
);
1845 NTSTATUS WINAPI
ZwConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1846 NTSTATUS WINAPI
ZwCreateDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1847 NTSTATUS WINAPI
ZwCreateEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,BOOLEAN
,BOOLEAN
);
1848 NTSTATUS WINAPI
ZwCreateFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,PLARGE_INTEGER
,ULONG
,ULONG
,ULONG
,ULONG
,PVOID
,ULONG
);
1849 NTSTATUS WINAPI
ZwCreateKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,const UNICODE_STRING
*,ULONG
,PULONG
);
1850 NTSTATUS WINAPI
ZwCreateSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const LARGE_INTEGER
*,ULONG
,ULONG
,HANDLE
);
1851 NTSTATUS WINAPI
ZwCreateSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PUNICODE_STRING
);
1852 NTSTATUS WINAPI
ZwCreateTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*, TIMER_TYPE
);
1853 NTSTATUS WINAPI
ZwDeleteAtom(RTL_ATOM
);
1854 NTSTATUS WINAPI
ZwDeleteFile(POBJECT_ATTRIBUTES
);
1855 NTSTATUS WINAPI
ZwDeleteKey(HANDLE
);
1856 NTSTATUS WINAPI
ZwDeleteValueKey(HANDLE
,const UNICODE_STRING
*);
1857 NTSTATUS WINAPI
ZwDeviceIoControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1858 NTSTATUS WINAPI
ZwDisplayString(PUNICODE_STRING
);
1859 NTSTATUS WINAPI
ZwDuplicateObject(HANDLE
,HANDLE
,HANDLE
,PHANDLE
,ACCESS_MASK
,ULONG
,ULONG
);
1860 NTSTATUS WINAPI
ZwDuplicateToken(HANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,SECURITY_IMPERSONATION_LEVEL
,TOKEN_TYPE
,PHANDLE
);
1861 NTSTATUS WINAPI
ZwEnumerateKey(HANDLE
,ULONG
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1862 NTSTATUS WINAPI
ZwEnumerateValueKey(HANDLE
,ULONG
,KEY_VALUE_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1863 NTSTATUS WINAPI
ZwFlushInstructionCache(HANDLE
,LPCVOID
,SIZE_T
);
1864 NTSTATUS WINAPI
ZwFlushKey(HANDLE
);
1865 NTSTATUS WINAPI
ZwFlushVirtualMemory(HANDLE
,LPCVOID
*,SIZE_T
*,ULONG
);
1866 NTSTATUS WINAPI
ZwFreeVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1867 NTSTATUS WINAPI
ZwFsControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1868 NTSTATUS WINAPI
ZwInitiatePowerAction(POWER_ACTION
,SYSTEM_POWER_STATE
,ULONG
,BOOLEAN
);
1869 NTSTATUS WINAPI
ZwLoadDriver(const UNICODE_STRING
*);
1870 NTSTATUS WINAPI
ZwLoadKey(const OBJECT_ATTRIBUTES
*,OBJECT_ATTRIBUTES
*);
1871 NTSTATUS WINAPI
ZwLockVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1872 NTSTATUS WINAPI
ZwMakeTemporaryObject(HANDLE
);
1873 NTSTATUS WINAPI
ZwMapViewOfSection(HANDLE
,HANDLE
,PVOID
*,ULONG
,SIZE_T
,const LARGE_INTEGER
*,SIZE_T
*,SECTION_INHERIT
,ULONG
,ULONG
);
1874 NTSTATUS WINAPI
ZwNotifyChangeKey(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,BOOLEAN
,PVOID
,ULONG
,BOOLEAN
);
1875 NTSTATUS WINAPI
ZwOpenDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1876 NTSTATUS WINAPI
ZwOpenEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1877 NTSTATUS WINAPI
ZwOpenFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,ULONG
,ULONG
);
1878 NTSTATUS WINAPI
ZwOpenKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1879 NTSTATUS WINAPI
ZwOpenProcess(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1880 NTSTATUS WINAPI
ZwOpenProcessToken(HANDLE
,DWORD
,HANDLE
*);
1881 NTSTATUS WINAPI
ZwOpenSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1882 NTSTATUS WINAPI
ZwOpenSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1883 NTSTATUS WINAPI
ZwOpenThread(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1884 NTSTATUS WINAPI
ZwOpenThreadToken(HANDLE
,DWORD
,BOOLEAN
,HANDLE
*);
1885 NTSTATUS WINAPI
ZwOpenTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*);
1886 NTSTATUS WINAPI
ZwPowerInformation(POWER_INFORMATION_LEVEL
,PVOID
,ULONG
,PVOID
,ULONG
);
1887 NTSTATUS WINAPI
ZwPulseEvent(HANDLE
,PULONG
);
1888 NTSTATUS WINAPI
ZwQueryDefaultLocale(BOOLEAN
,LCID
*);
1889 NTSTATUS WINAPI
ZwQueryDefaultUILanguage(LANGID
*);
1890 NTSTATUS WINAPI
ZwQueryDirectoryFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
,BOOLEAN
,PUNICODE_STRING
,BOOLEAN
);
1891 NTSTATUS WINAPI
ZwQueryDirectoryObject(HANDLE
,PDIRECTORY_BASIC_INFORMATION
,ULONG
,BOOLEAN
,BOOLEAN
,PULONG
,PULONG
);
1892 NTSTATUS WINAPI
ZwQueryEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,BOOLEAN
,PVOID
,ULONG
,PVOID
,BOOLEAN
);
1893 NTSTATUS WINAPI
ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES
*,FILE_NETWORK_OPEN_INFORMATION
*);
1894 NTSTATUS WINAPI
ZwQueryInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,LONG
,FILE_INFORMATION_CLASS
);
1895 NTSTATUS WINAPI
ZwQueryInformationThread(HANDLE
,THREADINFOCLASS
,PVOID
,ULONG
,PULONG
);
1896 NTSTATUS WINAPI
ZwQueryInformationToken(HANDLE
,DWORD
,PVOID
,DWORD
,LPDWORD
);
1897 NTSTATUS WINAPI
ZwQueryInstallUILanguage(LANGID
*);
1898 NTSTATUS WINAPI
ZwQueryKey(HANDLE
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1899 NTSTATUS WINAPI
ZwQueryObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
, PULONG
);
1900 NTSTATUS WINAPI
ZwQuerySecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
,ULONG
,PULONG
);
1901 NTSTATUS WINAPI
ZwQuerySection(HANDLE
,SECTION_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1902 NTSTATUS WINAPI
ZwQuerySymbolicLinkObject(HANDLE
,PUNICODE_STRING
,PULONG
);
1903 NTSTATUS WINAPI
ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1904 NTSTATUS WINAPI
ZwQueryTimerResolution(PULONG
,PULONG
,PULONG
);
1905 NTSTATUS WINAPI
ZwQueryValueKey(HANDLE
,const UNICODE_STRING
*,KEY_VALUE_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1906 NTSTATUS WINAPI
ZwQueryVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1907 NTSTATUS WINAPI
ZwReadFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,PLARGE_INTEGER
,PULONG
);
1908 NTSTATUS WINAPI
ZwReplaceKey(POBJECT_ATTRIBUTES
,HANDLE
,POBJECT_ATTRIBUTES
);
1909 NTSTATUS WINAPI
ZwRequestWaitReplyPort(HANDLE
,PLPC_MESSAGE
,PLPC_MESSAGE
);
1910 NTSTATUS WINAPI
ZwResetEvent(HANDLE
,PULONG
);
1911 NTSTATUS WINAPI
ZwRestoreKey(HANDLE
,HANDLE
,ULONG
);
1912 NTSTATUS WINAPI
ZwSaveKey(HANDLE
,HANDLE
);
1913 NTSTATUS WINAPI
ZwSecureConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PSID
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1914 NTSTATUS WINAPI
ZwSetDefaultLocale(BOOLEAN
,LCID
);
1915 NTSTATUS WINAPI
ZwSetDefaultUILanguage(LANGID
);
1916 NTSTATUS WINAPI
ZwSetEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
);
1917 NTSTATUS WINAPI
ZwSetEvent(HANDLE
,PULONG
);
1918 NTSTATUS WINAPI
ZwSetInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
);
1919 NTSTATUS WINAPI
ZwSetInformationKey(HANDLE
,const int,PVOID
,ULONG
);
1920 NTSTATUS WINAPI
ZwSetInformationObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
);
1921 NTSTATUS WINAPI
ZwSetInformationProcess(HANDLE
,PROCESS_INFORMATION_CLASS
,PVOID
,ULONG
);
1922 NTSTATUS WINAPI
ZwSetInformationThread(HANDLE
,THREADINFOCLASS
,LPCVOID
,ULONG
);
1923 NTSTATUS WINAPI
ZwSetIoCompletion(HANDLE
,ULONG
,ULONG
,NTSTATUS
,ULONG
);
1924 NTSTATUS WINAPI
ZwSetLdtEntries(ULONG
,ULONG
,ULONG
,ULONG
,ULONG
,ULONG
);
1925 NTSTATUS WINAPI
ZwSetSecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
);
1926 NTSTATUS WINAPI
ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
);
1927 NTSTATUS WINAPI
ZwSetSystemTime(const LARGE_INTEGER
*,LARGE_INTEGER
*);
1928 NTSTATUS WINAPI
ZwSetTimer(HANDLE
, const LARGE_INTEGER
*, PTIMER_APC_ROUTINE
, PVOID
, BOOLEAN
, ULONG
, BOOLEAN
*);
1929 NTSTATUS WINAPI
ZwSetValueKey(HANDLE
,const UNICODE_STRING
*,ULONG
,ULONG
,const void *,ULONG
);
1930 NTSTATUS WINAPI
ZwSetVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1931 NTSTATUS WINAPI
ZwSuspendThread(HANDLE
,PULONG
);
1932 NTSTATUS WINAPI
ZwTerminateProcess(HANDLE
,LONG
);
1933 NTSTATUS WINAPI
ZwUnloadDriver(const UNICODE_STRING
*);
1934 NTSTATUS WINAPI
ZwUnloadKey(HANDLE
);
1935 NTSTATUS WINAPI
ZwUnmapViewOfSection(HANDLE
,PVOID
);
1936 NTSTATUS WINAPI
ZwWaitForSingleObject(HANDLE
,BOOLEAN
,const LARGE_INTEGER
*);
1937 NTSTATUS WINAPI
ZwWaitForMultipleObjects(ULONG
,const HANDLE
*,BOOLEAN
,BOOLEAN
,const LARGE_INTEGER
*);
1938 NTSTATUS WINAPI
ZwWriteFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,const void*,ULONG
,PLARGE_INTEGER
,PULONG
);
1939 NTSTATUS WINAPI
ZwYieldExecution(void);
1941 static inline void ExInitializeFastMutex( FAST_MUTEX
*mutex
)
1943 mutex
->Count
= FM_LOCK_BIT
;
1944 mutex
->Owner
= NULL
;
1945 mutex
->Contention
= 0;
1946 KeInitializeEvent( &mutex
->Event
, SynchronizationEvent
, FALSE
);