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
26 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
28 #define POINTER_ALIGNMENT
31 /* FIXME: We suppose that page size is 4096 */
34 #define PAGE_SIZE 0x1000
37 #define BYTE_OFFSET(va) ((ULONG)((ULONG_PTR)(va) & (PAGE_SIZE - 1)))
38 #define PAGE_ALIGN(va) ((PVOID)((ULONG_PTR)(va) & ~(PAGE_SIZE - 1)))
39 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(va, length) \
40 ((BYTE_OFFSET(va) + ((SIZE_T)(length)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)
42 typedef LONG KPRIORITY
;
44 typedef ULONG_PTR KSPIN_LOCK
, *PKSPIN_LOCK
;
46 typedef ULONG_PTR ERESOURCE_THREAD
;
47 typedef ERESOURCE_THREAD
*PERESOURCE_THREAD
;
48 typedef struct _FILE_GET_QUOTA_INFORMATION
*PFILE_GET_QUOTA_INFORMATION
;
53 struct _DEVICE_OBJECT
;
54 struct _DRIVER_OBJECT
;
57 typedef VOID (WINAPI
*PKDEFERRED_ROUTINE
)(struct _KDPC
*, PVOID
, PVOID
, PVOID
);
58 typedef VOID (WINAPI
*PKSTART_ROUTINE
)(PVOID
);
60 typedef NTSTATUS (WINAPI
*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
*, PUNICODE_STRING
);
61 typedef NTSTATUS (WINAPI
*PDRIVER_DISPATCH
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
62 typedef void (WINAPI
*PDRIVER_STARTIO
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
63 typedef void (WINAPI
*PDRIVER_UNLOAD
)(struct _DRIVER_OBJECT
*);
64 typedef NTSTATUS (WINAPI
*PDRIVER_ADD_DEVICE
)(struct _DRIVER_OBJECT
*, struct _DEVICE_OBJECT
*);
66 typedef struct _DISPATCHER_HEADER
{
72 LIST_ENTRY WaitListHead
;
73 } DISPATCHER_HEADER
, *PDISPATCHER_HEADER
;
75 typedef struct _KEVENT
{
76 DISPATCHER_HEADER Header
;
77 } KEVENT
, *PKEVENT
, *RESTRICTED_POINTER PRKEVENT
;
79 typedef struct _KSEMAPHORE
{
80 DISPATCHER_HEADER Header
;
82 } KSEMAPHORE
, *PKSEMAPHORE
, *PRKSEMAPHORE
;
84 typedef struct _KDPC
{
88 LIST_ENTRY DpcListEntry
;
89 PKDEFERRED_ROUTINE DeferredRoutine
;
90 PVOID DeferredContext
;
91 PVOID SystemArgument1
;
92 PVOID SystemArgument2
;
94 } KDPC
, *PKDPC
, *RESTRICTED_POINTER PRKDPC
;
96 typedef enum _KDPC_IMPORTANCE
{
103 typedef struct _KDEVICE_QUEUE_ENTRY
{
104 LIST_ENTRY DeviceListEntry
;
107 } KDEVICE_QUEUE_ENTRY
, *PKDEVICE_QUEUE_ENTRY
,
108 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY
;
110 typedef struct _KDEVICE_QUEUE
{
113 LIST_ENTRY DeviceListHead
;
116 } KDEVICE_QUEUE
, *PKDEVICE_QUEUE
, *RESTRICTED_POINTER PRKDEVICE_QUEUE
;
118 typedef struct _KMUTANT
{
119 DISPATCHER_HEADER Header
;
120 LIST_ENTRY MutantListEntry
;
121 struct _KTHREAD
*RESTRICTED_POINTER OwnerThread
;
124 } KMUTANT
, *PKMUTANT
, *RESTRICTED_POINTER PRKMUTANT
, KMUTEX
, *PKMUTEX
, *RESTRICTED_POINTER PRKMUTEX
;
126 typedef struct _DEFERRED_REVERSE_BARRIER
129 ULONG TotalProcessors
;
130 } DEFERRED_REVERSE_BARRIER
;
132 typedef enum _KWAIT_REASON
162 typedef struct _KWAIT_BLOCK
{
163 LIST_ENTRY WaitListEntry
;
164 struct _KTHREAD
*RESTRICTED_POINTER Thread
;
166 struct _KWAIT_BLOCK
*RESTRICTED_POINTER NextWaitBlock
;
169 } KWAIT_BLOCK
, *PKWAIT_BLOCK
, *RESTRICTED_POINTER PRKWAIT_BLOCK
;
171 typedef struct _OWNER_ENTRY
173 ERESOURCE_THREAD OwnerThread
;
178 ULONG IoPriorityBoosted
: 1;
179 ULONG OwnerReferenced
: 1;
180 ULONG IoQoSPriorityBoosted
: 1;
181 ULONG OwnerCount
: 29;
185 } OWNER_ENTRY
, *POWNER_ENTRY
;
187 #define ResourceNeverExclusive 0x0010
188 #define ResourceReleaseByOtherThread 0x0020
189 #define ResourceOwnedExclusive 0x0080
191 typedef struct _ERESOURCE
193 LIST_ENTRY SystemResourcesList
;
194 OWNER_ENTRY
*OwnerTable
;
201 UCHAR ReservedLowFlags
;
202 UCHAR WaiterPriority
;
205 KSEMAPHORE
*SharedWaiters
;
206 KEVENT
*ExclusiveWaiters
;
207 OWNER_ENTRY OwnerEntry
;
209 ULONG ContentionCount
;
210 ULONG NumberOfSharedWaiters
;
211 ULONG NumberOfExclusiveWaiters
;
218 ULONG_PTR CreatorBackTraceIndex
;
221 } ERESOURCE
, *PERESOURCE
;
223 typedef struct _IO_TIMER
*PIO_TIMER
;
224 typedef struct _IO_TIMER_ROUTINE
*PIO_TIMER_ROUTINE
;
225 typedef struct _ETHREAD
*PETHREAD
;
226 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
227 typedef struct _EPROCESS
*PEPROCESS
;
228 typedef struct _KPROCESS KPROCESS
, *PKPROCESS
, *PRKPROCESS
;
229 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
230 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
231 typedef struct _OBJECT_HANDLE_INFORMATION
*POBJECT_HANDLE_INFORMATION
;
232 typedef struct _ZONE_HEADER
*PZONE_HEADER
;
233 typedef struct _LOOKASIDE_LIST_EX
*PLOOKASIDE_LIST_EX
;
235 typedef struct _KAPC_STATE
237 LIST_ENTRY ApcListHead
[2];
239 UCHAR KernelApcInProgress
;
240 UCHAR KernelApcPending
;
241 UCHAR UserApcPending
;
242 } KAPC_STATE
, *PKAPC_STATE
;
244 #define FM_LOCK_BIT 0x1
246 typedef struct _FAST_MUTEX
253 } FAST_MUTEX
, *PFAST_MUTEX
;
255 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
257 typedef struct _VPB
{
261 USHORT VolumeLabelLength
;
262 struct _DEVICE_OBJECT
*DeviceObject
;
263 struct _DEVICE_OBJECT
*RealDevice
;
265 ULONG ReferenceCount
;
266 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
269 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 0x0008
270 #define POOL_RAISE_IF_ALLOCATION_FAILURE 0x0010
271 #define POOL_COLD_ALLOCATION 0x0100
272 #define POOL_NX_ALLOCATION 0x0200
274 typedef enum _POOL_TYPE
{
277 NonPagedPoolMustSucceed
,
279 NonPagedPoolCacheAligned
,
280 PagedPoolCacheAligned
,
281 NonPagedPoolCacheAlignedMustS
,
285 typedef struct _WAIT_CONTEXT_BLOCK
{
286 KDEVICE_QUEUE_ENTRY WaitQueueEntry
;
287 struct _DRIVER_CONTROL
*DeviceRoutine
;
289 ULONG NumberOfMapRegisters
;
292 PKDPC BufferChainingDpc
;
293 } WAIT_CONTEXT_BLOCK
, *PWAIT_CONTEXT_BLOCK
;
295 #define DO_BUFFERED_IO 0x00000004
296 #define DO_EXCLUSIVE 0x00000008
297 #define DO_DIRECT_IO 0x00000010
298 #define DO_MAP_IO_BUFFER 0x00000020
299 #define DO_DEVICE_INITIALIZING 0x00000080
300 #define DO_SHUTDOWN_REGISTERED 0x00000800
301 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
302 #define DO_POWER_PAGABLE 0x00002000
303 #define DO_POWER_INRUSH 0x00004000
305 #define IO_NO_INCREMENT 0
306 #define IO_CD_ROM_INCREMENT 1
307 #define IO_DISK_INCREMENT 1
308 #define IO_KEYBOARD_INCREMENT 6
309 #define IO_MAILSLOT_INCREMENT 2
310 #define IO_MOUSE_INCREMENT 6
311 #define IO_NAMED_PIPE_INCREMENT 2
312 #define IO_NETWORK_INCREMENT 2
313 #define IO_PARALLEL_INCREMENT 1
314 #define IO_SERIAL_INCREMENT 2
315 #define IO_SOUND_INCREMENT 8
316 #define IO_VIDEO_INCREMENT 1
319 #define DEVICE_TYPE ULONG
321 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
322 #define IRP_MJ_CREATE 0x00
323 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
324 #define IRP_MJ_CLOSE 0x02
325 #define IRP_MJ_READ 0x03
326 #define IRP_MJ_WRITE 0x04
327 #define IRP_MJ_QUERY_INFORMATION 0x05
328 #define IRP_MJ_SET_INFORMATION 0x06
329 #define IRP_MJ_QUERY_EA 0x07
330 #define IRP_MJ_SET_EA 0x08
331 #define IRP_MJ_FLUSH_BUFFERS 0x09
332 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
333 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
334 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
335 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
336 #define IRP_MJ_DEVICE_CONTROL 0x0e
337 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
338 #define IRP_MJ_SHUTDOWN 0x10
339 #define IRP_MJ_LOCK_CONTROL 0x11
340 #define IRP_MJ_CLEANUP 0x12
341 #define IRP_MJ_CREATE_MAILSLOT 0x13
342 #define IRP_MJ_QUERY_SECURITY 0x14
343 #define IRP_MJ_SET_SECURITY 0x15
344 #define IRP_MJ_POWER 0x16
345 #define IRP_MJ_SYSTEM_CONTROL 0x17
346 #define IRP_MJ_DEVICE_CHANGE 0x18
347 #define IRP_MJ_QUERY_QUOTA 0x19
348 #define IRP_MJ_SET_QUOTA 0x1a
349 #define IRP_MJ_PNP 0x1b
351 #define IRP_MN_START_DEVICE 0x00
352 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
353 #define IRP_MN_REMOVE_DEVICE 0x02
354 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
355 #define IRP_MN_STOP_DEVICE 0x04
356 #define IRP_MN_QUERY_STOP_DEVICE 0x05
357 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
358 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
359 #define IRP_MN_QUERY_INTERFACE 0x08
360 #define IRP_MN_QUERY_CAPABILITIES 0x09
361 #define IRP_MN_QUERY_RESOURCES 0x0A
362 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
363 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
364 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
365 #define IRP_MN_READ_CONFIG 0x0F
366 #define IRP_MN_WRITE_CONFIG 0x10
367 #define IRP_MN_EJECT 0x11
368 #define IRP_MN_SET_LOCK 0x12
369 #define IRP_MN_QUERY_ID 0x13
370 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
371 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
372 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
373 #define IRP_MN_SURPRISE_REMOVAL 0x17
374 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
376 #define IRP_MN_WAIT_WAKE 0x00
377 #define IRP_MN_POWER_SEQUENCE 0x01
378 #define IRP_MN_SET_POWER 0x02
379 #define IRP_MN_QUERY_POWER 0x03
381 #define IRP_QUOTA_CHARGED 0x01
382 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
383 #define IRP_ALLOCATED_FIXED_SIZE 0x04
384 #define IRP_LOOKASIDE_ALLOCATION 0x08
386 #define IO_TYPE_ADAPTER 0x01
387 #define IO_TYPE_CONTROLLER 0x02
388 #define IO_TYPE_DEVICE 0x03
389 #define IO_TYPE_DRIVER 0x04
390 #define IO_TYPE_FILE 0x05
391 #define IO_TYPE_IRP 0x06
392 #define IO_TYPE_MASTER_ADAPTER 0x07
393 #define IO_TYPE_OPEN_PACKET 0x08
394 #define IO_TYPE_TIMER 0x09
395 #define IO_TYPE_VPB 0x0a
396 #define IO_TYPE_ERROR_LOG 0x0b
397 #define IO_TYPE_ERROR_MESSAGE 0x0c
398 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
400 typedef struct _DEVICE_OBJECT
{
404 struct _DRIVER_OBJECT
*DriverObject
;
405 struct _DEVICE_OBJECT
*NextDevice
;
406 struct _DEVICE_OBJECT
*AttachedDevice
;
407 struct _IRP
*CurrentIrp
;
410 ULONG Characteristics
;
412 PVOID DeviceExtension
;
413 DEVICE_TYPE DeviceType
;
416 LIST_ENTRY ListEntry
;
417 WAIT_CONTEXT_BLOCK Wcb
;
419 ULONG AlignmentRequirement
;
420 KDEVICE_QUEUE DeviceQueue
;
422 ULONG ActiveThreadCount
;
423 PSECURITY_DESCRIPTOR SecurityDescriptor
;
427 struct _DEVOBJ_EXTENSION
*DeviceObjectExtension
;
430 typedef struct _DEVICE_OBJECT
*PDEVICE_OBJECT
;
432 typedef struct _DEVICE_RELATIONS
{
434 PDEVICE_OBJECT Objects
[1];
436 typedef struct _DEVICE_RELATIONS
*PDEVICE_RELATIONS
;
438 typedef struct _DRIVER_EXTENSION
{
439 struct _DRIVER_OBJECT
*DriverObject
;
440 PDRIVER_ADD_DEVICE AddDevice
;
442 UNICODE_STRING ServiceKeyName
;
443 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
445 typedef struct _DRIVER_OBJECT
{
448 PDEVICE_OBJECT DeviceObject
;
453 PDRIVER_EXTENSION DriverExtension
;
454 UNICODE_STRING DriverName
;
455 PUNICODE_STRING HardwareDatabase
;
456 PVOID FastIoDispatch
;
457 PDRIVER_INITIALIZE DriverInit
;
458 PDRIVER_STARTIO DriverStartIo
;
459 PDRIVER_UNLOAD DriverUnload
;
460 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
462 typedef struct _DRIVER_OBJECT
*PDRIVER_OBJECT
;
464 /* Irp definitions */
465 typedef UCHAR KIRQL
, *PKIRQL
;
466 typedef CCHAR KPROCESSOR_MODE
;
467 typedef enum _KAPC_ENVIRONMENT
469 OriginalApcEnvironment
,
470 AttachedApcEnvironment
,
471 CurrentApcEnvironment
,
473 } KAPC_ENVIRONMENT
, *PKAPC_ENVIRONMENT
;
475 typedef VOID (WINAPI
*PDRIVER_CANCEL
)(
476 IN
struct _DEVICE_OBJECT
*DeviceObject
,
477 IN
struct _IRP
*Irp
);
479 typedef VOID (WINAPI
*PKNORMAL_ROUTINE
)(
480 IN PVOID NormalContext
,
481 IN PVOID SystemArgument1
,
482 IN PVOID SystemArgument2
);
484 typedef VOID (WINAPI
*PKKERNEL_ROUTINE
)(
485 IN
struct _KAPC
*Apc
,
486 IN OUT PKNORMAL_ROUTINE
*NormalRoutine
,
487 IN OUT PVOID
*NormalContext
,
488 IN OUT PVOID
*SystemArgument1
,
489 IN OUT PVOID
*SystemArgument2
);
491 typedef VOID (WINAPI
*PKRUNDOWN_ROUTINE
)(
492 IN
struct _KAPC
*Apc
);
494 typedef struct _KAPC
{
498 struct _KTHREAD
*Thread
;
499 LIST_ENTRY ApcListEntry
;
500 PKKERNEL_ROUTINE KernelRoutine
;
501 PKRUNDOWN_ROUTINE RundownRoutine
;
502 PKNORMAL_ROUTINE NormalRoutine
;
504 PVOID SystemArgument1
;
505 PVOID SystemArgument2
;
507 KPROCESSOR_MODE ApcMode
;
509 } KAPC
, *PKAPC
, *RESTRICTED_POINTER PRKAPC
;
511 typedef struct _IRP
{
514 struct _MDL
*MdlAddress
;
517 struct _IRP
*MasterIrp
;
521 LIST_ENTRY ThreadListEntry
;
522 IO_STATUS_BLOCK IoStatus
;
523 KPROCESSOR_MODE RequestorMode
;
524 BOOLEAN PendingReturned
;
526 CHAR CurrentLocation
;
529 CCHAR ApcEnvironment
;
530 UCHAR AllocationFlags
;
531 PIO_STATUS_BLOCK UserIosb
;
535 PIO_APC_ROUTINE UserApcRoutine
;
536 PVOID UserApcContext
;
537 } AsynchronousParameters
;
538 LARGE_INTEGER AllocationSize
;
540 PDRIVER_CANCEL CancelRoutine
;
545 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
547 PVOID DriverContext
[4];
551 PCHAR AuxiliaryBuffer
;
553 LIST_ENTRY ListEntry
;
555 struct _IO_STACK_LOCATION
*CurrentStackLocation
;
559 struct _FILE_OBJECT
*OriginalFileObject
;
565 typedef struct _IRP
*PIRP
;
567 #define IRP_NOCACHE 0x0001
568 #define IRP_PAGING_IO 0x0002
569 #define IRP_MOUNT_COMPLETION 0x0002
570 #define IRP_SYNCHRONOUS_API 0x0004
571 #define IRP_ASSOCIATED_IRP 0x0008
572 #define IRP_BUFFERED_IO 0x0010
573 #define IRP_DEALLOCATE_BUFFER 0x0020
574 #define IRP_INPUT_OPERATION 0x0040
575 #define IRP_SYNCHRONOUS_PAGING_IO 0x0040
576 #define IRP_CREATE_OPERATION 0x0080
577 #define IRP_READ_OPERATION 0x0100
578 #define IRP_WRITE_OPERATION 0x0200
579 #define IRP_CLOSE_OPERATION 0x0400
580 #define IRP_DEFER_IO_COMPLETION 0x0800
581 #define IRP_OB_QUERY_NAME 0x1000
582 #define IRP_HOLD_DEVICE_QUEUE 0x2000
584 typedef VOID (WINAPI
*PINTERFACE_REFERENCE
)(
587 typedef VOID (WINAPI
*PINTERFACE_DEREFERENCE
)(
590 typedef struct _INTERFACE
{
594 PINTERFACE_REFERENCE InterfaceReference
;
595 PINTERFACE_DEREFERENCE InterfaceDereference
;
596 } INTERFACE
, *PINTERFACE
;
598 typedef struct _SECTION_OBJECT_POINTERS
{
599 PVOID DataSectionObject
;
600 PVOID SharedCacheMap
;
601 PVOID ImageSectionObject
;
602 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
604 typedef struct _IO_COMPLETION_CONTEXT
{
607 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
609 typedef enum _DEVICE_RELATION_TYPE
{
614 TargetDeviceRelation
,
616 } DEVICE_RELATION_TYPE
, *PDEVICE_RELATION_TYPE
;
618 typedef struct _FILE_OBJECT
{
621 PDEVICE_OBJECT DeviceObject
;
625 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
626 PVOID PrivateCacheMap
;
627 NTSTATUS FinalStatus
;
628 struct _FILE_OBJECT
*RelatedFileObject
;
629 BOOLEAN LockOperation
;
630 BOOLEAN DeletePending
;
633 BOOLEAN DeleteAccess
;
636 BOOLEAN SharedDelete
;
638 UNICODE_STRING FileName
;
639 LARGE_INTEGER CurrentByteOffset
;
645 PIO_COMPLETION_CONTEXT CompletionContext
;
647 typedef struct _FILE_OBJECT
*PFILE_OBJECT
;
649 #define INITIAL_PRIVILEGE_COUNT 3
651 typedef struct _INITIAL_PRIVILEGE_SET
{
652 ULONG PrivilegeCount
;
654 LUID_AND_ATTRIBUTES Privilege
[INITIAL_PRIVILEGE_COUNT
];
655 } INITIAL_PRIVILEGE_SET
, * PINITIAL_PRIVILEGE_SET
;
657 typedef struct _SECURITY_SUBJECT_CONTEXT
{
658 PACCESS_TOKEN ClientToken
;
659 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
660 PACCESS_TOKEN PrimaryToken
;
661 PVOID ProcessAuditId
;
662 } SECURITY_SUBJECT_CONTEXT
, *PSECURITY_SUBJECT_CONTEXT
;
664 typedef struct _ACCESS_STATE
{
666 BOOLEAN SecurityEvaluated
;
667 BOOLEAN GenerateAudit
;
668 BOOLEAN GenerateOnClose
;
669 BOOLEAN PrivilegesAllocated
;
671 ACCESS_MASK RemainingDesiredAccess
;
672 ACCESS_MASK PreviouslyGrantedAccess
;
673 ACCESS_MASK OriginalDesiredAccess
;
674 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext
;
675 PSECURITY_DESCRIPTOR SecurityDescriptor
;
678 INITIAL_PRIVILEGE_SET InitialPrivilegeSet
;
679 PRIVILEGE_SET PrivilegeSet
;
682 BOOLEAN AuditPrivileges
;
683 UNICODE_STRING ObjectName
;
684 UNICODE_STRING ObjectTypeName
;
685 } ACCESS_STATE
, *PACCESS_STATE
;
687 typedef struct _IO_SECURITY_CONTEXT
{
688 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
689 PACCESS_STATE AccessState
;
690 ACCESS_MASK DesiredAccess
;
691 ULONG FullCreateOptions
;
692 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
694 typedef struct _DEVICE_CAPABILITIES
{
699 ULONG LockSupported
: 1;
700 ULONG EjectSupported
: 1;
702 ULONG DockDevice
: 1;
704 ULONG SilentInstall
: 1;
705 ULONG RawDeviceOK
: 1;
706 ULONG SurpriseRemovalOK
: 1;
707 ULONG WakeFromD0
: 1;
708 ULONG WakeFromD1
: 1;
709 ULONG WakeFromD2
: 1;
710 ULONG WakeFromD3
: 1;
711 ULONG HardwareDisabled
: 1;
712 ULONG NonDynamic
: 1;
713 ULONG WarmEjectSupported
: 1;
714 ULONG NoDisplayInUI
: 1;
718 DEVICE_POWER_STATE DeviceState
[PowerSystemMaximum
];
719 SYSTEM_POWER_STATE SystemWake
;
720 DEVICE_POWER_STATE DeviceWake
;
724 } DEVICE_CAPABILITIES
, *PDEVICE_CAPABILITIES
;
726 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
{
730 GUID InterfaceClassGuid
;
731 PUNICODE_STRING SymbolicLinkName
;
732 } DEVICE_INTERFACE_CHANGE_NOTIFICATION
, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION
;
734 typedef enum _INTERFACE_TYPE
{
735 InterfaceTypeUndefined
= -1,
753 } INTERFACE_TYPE
, *PINTERFACE_TYPE
;
755 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
757 #define IO_RESOURCE_PREFERRED 0x01
758 #define IO_RESOURCE_DEFAULT 0x02
759 #define IO_RESOURCE_ALTERNATIVE 0x08
761 typedef struct _IO_RESOURCE_DESCRIPTOR
{
764 UCHAR ShareDisposition
;
772 PHYSICAL_ADDRESS MinimumAddress
;
773 PHYSICAL_ADDRESS MaximumAddress
;
778 PHYSICAL_ADDRESS MinimumAddress
;
779 PHYSICAL_ADDRESS MaximumAddress
;
786 ULONG MinimumChannel
;
787 ULONG MaximumChannel
;
792 PHYSICAL_ADDRESS MinimumAddress
;
793 PHYSICAL_ADDRESS MaximumAddress
;
810 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
812 typedef struct _IO_RESOURCE_LIST
{
816 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
817 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
819 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
821 INTERFACE_TYPE InterfaceType
;
825 ULONG AlternativeLists
;
826 IO_RESOURCE_LIST List
[1];
827 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
829 typedef enum _BUS_QUERY_ID_TYPE
{
832 BusQueryCompatibleIDs
,
834 BusQueryDeviceSerialNumber
,
836 } BUS_QUERY_ID_TYPE
, *PBUS_QUERY_ID_TYPE
;
838 typedef enum _CREATE_FILE_TYPE
{
840 CreateFileTypeNamedPipe
,
841 CreateFileTypeMailslot
845 DevicePropertyDeviceDescription
,
846 DevicePropertyHardwareID
,
847 DevicePropertyCompatibleIDs
,
848 DevicePropertyBootConfiguration
,
849 DevicePropertyBootConfigurationTranslated
,
850 DevicePropertyClassName
,
851 DevicePropertyClassGuid
,
852 DevicePropertyDriverKeyName
,
853 DevicePropertyManufacturer
,
854 DevicePropertyFriendlyName
,
855 DevicePropertyLocationInformation
,
856 DevicePropertyPhysicalDeviceObjectName
,
857 DevicePropertyBusTypeGuid
,
858 DevicePropertyLegacyBusType
,
859 DevicePropertyBusNumber
,
860 DevicePropertyEnumeratorName
,
861 DevicePropertyAddress
,
862 DevicePropertyUINumber
,
863 DevicePropertyInstallState
,
864 DevicePropertyRemovalPolicy
865 } DEVICE_REGISTRY_PROPERTY
;
867 typedef enum _DEVICE_TEXT_TYPE
{
868 DeviceTextDescription
,
869 DeviceTextLocationInformation
870 } DEVICE_TEXT_TYPE
, *PDEVICE_TEXT_TYPE
;
872 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE
{
873 DeviceUsageTypeUndefined
,
874 DeviceUsageTypePaging
,
875 DeviceUsageTypeHibernation
,
876 DeviceUsageTypeDumpFile
877 } DEVICE_USAGE_NOTIFICATION_TYPE
;
879 typedef struct _POWER_SEQUENCE
{
883 } POWER_SEQUENCE
, *PPOWER_SEQUENCE
;
885 typedef enum _POWER_STATE_TYPE
{
888 } POWER_STATE_TYPE
, *PPOWER_STATE_TYPE
;
890 typedef union _POWER_STATE
{
891 SYSTEM_POWER_STATE SystemState
;
892 DEVICE_POWER_STATE DeviceState
;
893 } POWER_STATE
, *PPOWER_STATE
;
895 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
897 UCHAR ShareDisposition
;
901 PHYSICAL_ADDRESS Start
;
905 PHYSICAL_ADDRESS Start
;
914 PHYSICAL_ADDRESS Start
;
934 } DeviceSpecificData
;
936 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
938 typedef struct _CM_PARTIAL_RESOURCE_LIST
{
942 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
943 } CM_PARTIAL_RESOURCE_LIST
, *PCM_PARTIAL_RESOURCE_LIST
;
945 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
946 INTERFACE_TYPE InterfaceType
;
948 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
949 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
951 typedef struct _CM_RESOURCE_LIST
{
953 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
954 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
956 typedef NTSTATUS (WINAPI
*PIO_COMPLETION_ROUTINE
)(
957 IN
struct _DEVICE_OBJECT
*DeviceObject
,
961 #define SL_PENDING_RETURNED 0x01
962 #define SL_INVOKE_ON_CANCEL 0x20
963 #define SL_INVOKE_ON_SUCCESS 0x40
964 #define SL_INVOKE_ON_ERROR 0x80
967 #include <pshpack4.h>
969 typedef struct _IO_STACK_LOCATION
{
976 PIO_SECURITY_CONTEXT SecurityContext
;
978 USHORT POINTER_ALIGNMENT FileAttributes
;
980 ULONG POINTER_ALIGNMENT EaLength
;
984 ULONG POINTER_ALIGNMENT Key
;
985 LARGE_INTEGER ByteOffset
;
989 ULONG POINTER_ALIGNMENT Key
;
990 LARGE_INTEGER ByteOffset
;
994 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
998 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
999 PFILE_OBJECT FileObject
;
1002 BOOLEAN ReplaceIfExists
;
1003 BOOLEAN AdvanceOnly
;
1006 HANDLE DeleteHandle
;
1011 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
1014 ULONG OutputBufferLength
;
1015 ULONG POINTER_ALIGNMENT InputBufferLength
;
1016 ULONG POINTER_ALIGNMENT IoControlCode
;
1017 PVOID Type3InputBuffer
;
1020 SECURITY_INFORMATION SecurityInformation
;
1021 ULONG POINTER_ALIGNMENT Length
;
1024 SECURITY_INFORMATION SecurityInformation
;
1025 PSECURITY_DESCRIPTOR SecurityDescriptor
;
1029 PDEVICE_OBJECT DeviceObject
;
1033 PDEVICE_OBJECT DeviceObject
;
1036 struct _SCSI_REQUEST_BLOCK
*Srb
;
1039 DEVICE_RELATION_TYPE Type
;
1040 } QueryDeviceRelations
;
1042 const GUID
*InterfaceType
;
1045 PINTERFACE Interface
;
1046 PVOID InterfaceSpecificData
;
1049 PDEVICE_CAPABILITIES Capabilities
;
1050 } DeviceCapabilities
;
1052 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
1053 } FilterResourceRequirements
;
1058 ULONG POINTER_ALIGNMENT Length
;
1064 BUS_QUERY_ID_TYPE IdType
;
1067 DEVICE_TEXT_TYPE DeviceTextType
;
1068 LCID POINTER_ALIGNMENT LocaleId
;
1072 BOOLEAN Reserved
[3];
1073 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
1074 } UsageNotification
;
1076 SYSTEM_POWER_STATE PowerState
;
1079 PPOWER_SEQUENCE PowerSequence
;
1082 ULONG SystemContext
;
1083 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
1084 POWER_STATE POINTER_ALIGNMENT State
;
1085 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
1088 PCM_RESOURCE_LIST AllocatedResources
;
1089 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
1092 ULONG_PTR ProviderId
;
1104 PDEVICE_OBJECT DeviceObject
;
1105 PFILE_OBJECT FileObject
;
1106 PIO_COMPLETION_ROUTINE CompletionRoutine
;
1108 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
1109 #if !defined(_WIN64)
1110 #include <poppack.h>
1113 /* MDL definitions */
1115 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1116 #define MDL_PAGES_LOCKED 0x0002
1117 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1118 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1119 #define MDL_PARTIAL 0x0010
1120 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1121 #define MDL_IO_PAGE_READ 0x0040
1122 #define MDL_WRITE_OPERATION 0x0080
1123 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1124 #define MDL_FREE_EXTRA_PTES 0x0200
1125 #define MDL_DESCRIBES_AWE 0x0400
1126 #define MDL_IO_SPACE 0x0800
1127 #define MDL_NETWORK_HEADER 0x1000
1128 #define MDL_MAPPING_CAN_FAIL 0x2000
1129 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1130 #define MDL_INTERNAL 0x8000
1132 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
1133 MDL_PAGES_LOCKED | \
1134 MDL_SOURCE_IS_NONPAGED_POOL | \
1135 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1136 MDL_PARENT_MAPPED_SYSTEM_VA | \
1140 typedef struct _MDL
{
1144 struct _EPROCESS
*Process
;
1145 PVOID MappedSystemVa
;
1152 typedef ULONG PFN_NUMBER
, *PPFN_NUMBER
;
1154 static inline void MmInitializeMdl(MDL
*mdl
, void *va
, SIZE_T length
)
1157 mdl
->Size
= sizeof(MDL
) + sizeof(PFN_NUMBER
) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(va
, length
);
1159 mdl
->StartVa
= (void *)PAGE_ALIGN(va
);
1160 mdl
->ByteOffset
= BYTE_OFFSET(va
);
1161 mdl
->ByteCount
= length
;
1164 typedef struct _KTIMER
{
1165 DISPATCHER_HEADER Header
;
1166 ULARGE_INTEGER DueTime
;
1167 LIST_ENTRY TimerListEntry
;
1172 typedef struct _KSYSTEM_TIME
{
1176 } KSYSTEM_TIME
, *PKSYSTEM_TIME
;
1178 typedef enum _NT_PRODUCT_TYPE
{
1182 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
1184 #define PROCESSOR_FEATURE_MAX 64
1186 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
1191 } ALTERNATIVE_ARCHITECTURE_TYPE
;
1193 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1194 #define NX_SUPPORT_POLICY_ALWAYSON 1
1195 #define NX_SUPPORT_POLICY_OPTIN 2
1196 #define NX_SUPPORT_POLICY_OPTOUT 3
1198 typedef struct _KUSER_SHARED_DATA
{
1199 ULONG TickCountLowDeprecated
; /* 0x000 */
1200 ULONG TickCountMultiplier
; /* 0x004 */
1201 volatile KSYSTEM_TIME InterruptTime
; /* 0x008 */
1202 volatile KSYSTEM_TIME SystemTime
; /* 0x014 */
1203 volatile KSYSTEM_TIME TimeZoneBias
; /* 0x020 */
1204 USHORT ImageNumberLow
; /* 0x02c */
1205 USHORT ImageNumberHigh
; /* 0x02e */
1206 WCHAR NtSystemRoot
[260]; /* 0x030 */
1207 ULONG MaxStackTraceDepth
; /* 0x238 */
1208 ULONG CryptoExponent
; /* 0x23c */
1209 ULONG TimeZoneId
; /* 0x240 */
1210 ULONG LargePageMinimum
; /* 0x244 */
1211 ULONG AitSamplingValue
; /* 0x248 */
1212 ULONG AppCompatFlag
; /* 0x24c */
1213 ULONGLONG RNGSeedVersion
; /* 0x250 */
1214 ULONG GlobalValidationRunLevel
; /* 0x258 */
1215 volatile ULONG TimeZoneBiasStamp
; /* 0x25c */
1216 ULONG NtBuildNumber
; /* 0x260 */
1217 NT_PRODUCT_TYPE NtProductType
; /* 0x264 */
1218 BOOLEAN ProductTypeIsValid
; /* 0x268 */
1219 USHORT NativeProcessorArchitecture
; /* 0x26a */
1220 ULONG NtMajorVersion
; /* 0x26c */
1221 ULONG NtMinorVersion
; /* 0x270 */
1222 BOOLEAN ProcessorFeatures
[PROCESSOR_FEATURE_MAX
]; /* 0x274 */
1223 ULONG Reserved1
; /* 0x2b4 */
1224 ULONG Reserved3
; /* 0x2b8 */
1225 volatile ULONG TimeSlip
; /* 0x2bc */
1226 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture
; /* 0x2c0 */
1227 ULONG BootId
; /* 0x2c4 */
1228 LARGE_INTEGER SystemExpirationDate
; /* 0x2c8 */
1229 ULONG SuiteMask
; /* 0x2d0 */
1230 BOOLEAN KdDebuggerEnabled
; /* 0x2d4 */
1231 UCHAR NXSupportPolicy
; /* 0x2d5 */
1232 USHORT CyclesPerYield
; /* 0x2d6 */
1233 volatile ULONG ActiveConsoleId
; /* 0x2d8 */
1234 volatile ULONG DismountCount
; /* 0x2dc */
1235 ULONG ComPlusPackage
; /* 0x2e0 */
1236 ULONG LastSystemRITEventTickCount
; /* 0x2e4 */
1237 ULONG NumberOfPhysicalPages
; /* 0x2e8 */
1238 BOOLEAN SafeBootMode
; /* 0x2ec */
1239 UCHAR VirtualizationFlags
; /* 0x2ed */
1241 ULONG SharedDataFlags
; /* 0x2f0 */
1243 ULONG DbgErrorPortPresent
: 1;
1244 ULONG DbgElevationEnabed
: 1;
1245 ULONG DbgVirtEnabled
: 1;
1246 ULONG DbgInstallerDetectEnabled
: 1;
1247 ULONG DbgLkgEnabled
: 1;
1248 ULONG DbgDynProcessorEnabled
: 1;
1249 ULONG DbgConsoleBrokerEnabled
: 1;
1250 ULONG DbgSecureBootEnabled
: 1;
1251 ULONG DbgMultiSessionSku
: 1;
1252 ULONG DbgMultiUsersInSessionSku
: 1;
1253 ULONG DbgStateSeparationEnabled
: 1;
1254 ULONG SpareBits
: 21;
1257 ULONG DataFlagsPad
[1]; /* 0x2f4 */
1258 ULONGLONG TestRetInstruction
; /* 0x2f8 */
1259 LONGLONG QpcFrequency
; /* 0x300 */
1260 ULONG SystemCall
; /* 0x308 */
1262 ULONG AllFlags
; /* 0x30c */
1264 ULONG Win32Process
: 1;
1265 ULONG Sgx2Enclave
: 1;
1266 ULONG VbsBasicEnclave
: 1;
1267 ULONG SpareBits
: 29;
1269 } UserCetAvailableEnvironments
;
1270 ULONGLONG SystemCallPad
[2]; /* 0x310 */
1272 volatile KSYSTEM_TIME TickCount
; /* 0x320 */
1273 volatile ULONG64 TickCountQuad
;
1275 ULONG Cookie
; /* 0x330 */
1276 ULONG CookiePad
[1]; /* 0x334 */
1277 LONGLONG ConsoleSessionForegroundProcessId
; /* 0x338 */
1278 ULONGLONG TimeUpdateLock
; /* 0x340 */
1279 ULONGLONG BaselineSystemTimeQpc
; /* 0x348 */
1280 ULONGLONG BaselineInterruptTimeQpc
; /* 0x350 */
1281 ULONGLONG QpcSystemTimeIncrement
; /* 0x358 */
1282 ULONGLONG QpcInterruptTimeIncrement
; /* 0x360 */
1283 UCHAR QpcSystemTimeIncrementShift
; /* 0x368 */
1284 UCHAR QpcInterruptTimeIncrementShift
; /* 0x369 */
1285 USHORT UnparkedProcessorCount
; /* 0x36a */
1286 ULONG EnclaveFeatureMask
[4]; /* 0x36c */
1287 ULONG TelemetryCoverageRound
; /* 0x37c */
1288 USHORT UserModeGlobalLogger
[16]; /* 0x380 */
1289 ULONG ImageFileExecutionOptions
; /* 0x3a0 */
1290 ULONG LangGenerationCount
; /* 0x3a4 */
1291 ULONG ActiveProcessorAffinity
; /* 0x3a8 */
1292 volatile ULONGLONG InterruptTimeBias
; /* 0x3b0 */
1293 volatile ULONGLONG QpcBias
; /* 0x3b8 */
1294 ULONG ActiveProcessorCount
; /* 0x3c0 */
1295 volatile UCHAR ActiveGroupCount
; /* 0x3c4 */
1297 USHORT QpcData
; /* 0x3c6 */
1299 UCHAR
volatile QpcBypassEnabled
;
1303 LARGE_INTEGER TimeZoneBiasEffectiveStart
; /* 0x3c8 */
1304 LARGE_INTEGER TimeZoneBiasEffectiveEnd
; /* 0x3d0 */
1305 XSTATE_CONFIGURATION XState
; /* 0x3d8 */
1306 } KSHARED_USER_DATA
, *PKSHARED_USER_DATA
;
1308 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED 0x01
1309 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE 0x02
1310 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_DISABLE_32BIT 0x04
1311 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_MFENCE 0x10
1312 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_LFENCE 0x20
1313 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_A73_ERRATA 0x40
1314 #define SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_RDTSCP 0x80
1316 typedef enum _MEMORY_CACHING_TYPE
{
1319 MmWriteCombined
= 2,
1320 MmHardwareCoherentCached
= 3,
1321 MmNonCachedUnordered
= 4,
1323 MmMaximumCacheType
= 6
1324 } MEMORY_CACHING_TYPE
;
1326 typedef enum _MM_PAGE_PRIORITY
{
1328 NormalPagePriority
= 16,
1329 HighPagePriority
= 32
1332 typedef enum _MM_SYSTEM_SIZE
1339 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK
{
1341 BOOLEAN Reserved
[3];
1344 } IO_REMOVE_LOCK_COMMON_BLOCK
;
1346 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK
*PIO_REMOVE_LOCK_TRACKING_BLOCK
;
1348 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK
{
1351 LONGLONG MaxLockedTicks
;
1353 LIST_ENTRY LockList
;
1355 LONG LowMemoryCount
;
1358 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks
;
1359 } IO_REMOVE_LOCK_DBG_BLOCK
;
1361 typedef struct _IO_REMOVE_LOCK
{
1362 IO_REMOVE_LOCK_COMMON_BLOCK Common
;
1363 IO_REMOVE_LOCK_DBG_BLOCK Dbg
;
1364 } IO_REMOVE_LOCK
, *PIO_REMOVE_LOCK
;
1372 typedef struct _CALLBACK_OBJECT
1376 LIST_ENTRY RegisteredCallbacks
;
1377 BOOLEAN AllowMultipleCallbacks
;
1379 } CALLBACK_OBJECT
, *PCALLBACK_OBJECT
;
1381 typedef struct _KSPIN_LOCK_QUEUE
{
1382 struct _KSPIN_LOCK_QUEUE
* volatile Next
;
1383 volatile PKSPIN_LOCK Lock
;
1384 } KSPIN_LOCK_QUEUE
, *PKSPIN_LOCK_QUEUE
;
1386 typedef struct _KLOCK_QUEUE_HANDLE
{
1387 KSPIN_LOCK_QUEUE LockQueue
;
1389 } KLOCK_QUEUE_HANDLE
, *PKLOCK_QUEUE_HANDLE
;
1391 typedef void * (NTAPI
*PALLOCATE_FUNCTION
)(POOL_TYPE
, SIZE_T
, ULONG
);
1392 typedef void * (NTAPI
*PALLOCATE_FUNCTION_EX
)(POOL_TYPE
, SIZE_T
, ULONG
, PLOOKASIDE_LIST_EX
);
1393 typedef void (NTAPI
*PFREE_FUNCTION
)(void *);
1394 typedef void (NTAPI
*PFREE_FUNCTION_EX
)(void *, PLOOKASIDE_LIST_EX
);
1395 typedef void (NTAPI
*PCALLBACK_FUNCTION
)(void *, void *, void *);
1398 #define LOOKASIDE_ALIGN DECLSPEC_CACHEALIGN
1400 #define LOOKASIDE_ALIGN
1403 #define LOOKASIDE_MINIMUM_BLOCK_SIZE (RTL_SIZEOF_THROUGH_FIELD(SLIST_ENTRY, Next))
1405 #define GENERAL_LOOKASIDE_LAYOUT \
1408 SLIST_HEADER ListHead; \
1409 SINGLE_LIST_ENTRY SingleListHead; \
1412 USHORT MaximumDepth; \
1413 ULONG TotalAllocates; \
1416 ULONG AllocateMisses; \
1417 ULONG AllocateHits; \
1418 } DUMMYUNIONNAME2; \
1424 } DUMMYUNIONNAME3; \
1430 PALLOCATE_FUNCTION_EX AllocateEx; \
1431 PALLOCATE_FUNCTION Allocate; \
1432 } DUMMYUNIONNAME4; \
1435 PFREE_FUNCTION_EX FreeEx; \
1436 PFREE_FUNCTION Free; \
1437 } DUMMYUNIONNAME5; \
1438 LIST_ENTRY ListEntry; \
1439 ULONG LastTotalAllocates; \
1442 ULONG LastAllocateMisses; \
1443 ULONG LastAllocateHits; \
1444 } DUMMYUNIONNAME6; \
1447 typedef struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE
1449 GENERAL_LOOKASIDE_LAYOUT
1450 } GENERAL_LOOKASIDE
;
1452 typedef struct _GENERAL_LOOKASIDE_POOL
1454 GENERAL_LOOKASIDE_LAYOUT
1455 } GENERAL_LOOKASIDE_POOL
, *PGENERAL_LOOKASIDE_POOL
;
1457 typedef struct _LOOKASIDE_LIST_EX
1459 GENERAL_LOOKASIDE_POOL L
;
1460 } LOOKASIDE_LIST_EX
;
1462 typedef struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST
1464 GENERAL_LOOKASIDE L
;
1465 #if defined(__i386__)
1466 KSPIN_LOCK Lock__ObsoleteButDoNotDelete
;
1468 } NPAGED_LOOKASIDE_LIST
, *PNPAGED_LOOKASIDE_LIST
;
1470 typedef struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST
1472 GENERAL_LOOKASIDE L
;
1473 #if defined(__i386__)
1474 FAST_MUTEX Lock__ObsoleteButDoNotDelete
;
1476 } PAGED_LOOKASIDE_LIST
, *PPAGED_LOOKASIDE_LIST
;
1478 typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION
)(void *CallbackContext
, void *Argument1
, void *Argument2
);
1479 typedef EX_CALLBACK_FUNCTION
*PEX_CALLBACK_FUNCTION
;
1481 typedef ULONG OB_OPERATION
;
1483 typedef struct _OB_PRE_CREATE_HANDLE_INFORMATION
{
1484 ACCESS_MASK DesiredAccess
;
1485 ACCESS_MASK OriginalDesiredAccess
;
1486 } OB_PRE_CREATE_HANDLE_INFORMATION
, *POB_PRE_CREATE_HANDLE_INFORMATION
;
1488 typedef struct _OB_PRE_DUPLICATE_HANDLE_INFORMATION
{
1489 ACCESS_MASK DesiredAccess
;
1490 ACCESS_MASK OriginalDesiredAccess
;
1491 PVOID SourceProcess
;
1492 PVOID TargetProcess
;
1493 } OB_PRE_DUPLICATE_HANDLE_INFORMATION
, *POB_PRE_DUPLICATE_HANDLE_INFORMATION
;
1495 typedef union _OB_PRE_OPERATION_PARAMETERS
{
1496 OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1497 OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1498 } OB_PRE_OPERATION_PARAMETERS
, *POB_PRE_OPERATION_PARAMETERS
;
1500 typedef struct _OB_PRE_OPERATION_INFORMATION
{
1501 OB_OPERATION Operation
;
1505 ULONG KernelHandle
:1;
1510 POBJECT_TYPE ObjectType
;
1512 POB_PRE_OPERATION_PARAMETERS Parameters
;
1513 } OB_PRE_OPERATION_INFORMATION
, *POB_PRE_OPERATION_INFORMATION
;
1515 typedef struct _OB_POST_CREATE_HANDLE_INFORMATION
{
1516 ACCESS_MASK GrantedAccess
;
1517 } OB_POST_CREATE_HANDLE_INFORMATION
, *POB_POST_CREATE_HANDLE_INFORMATION
;
1519 typedef struct _OB_POST_DUPLICATE_HANDLE_INFORMATION
{
1520 ACCESS_MASK GrantedAccess
;
1521 } OB_POST_DUPLICATE_HANDLE_INFORMATION
, *POB_POST_DUPLICATE_HANDLE_INFORMATION
;
1523 typedef union _OB_POST_OPERATION_PARAMETERS
{
1524 OB_POST_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1525 OB_POST_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1526 } OB_POST_OPERATION_PARAMETERS
, *POB_POST_OPERATION_PARAMETERS
;
1528 typedef struct _OB_POST_OPERATION_INFORMATION
{
1529 OB_OPERATION Operation
;
1533 ULONG KernelHandle
:1;
1538 POBJECT_TYPE ObjectType
;
1540 NTSTATUS ReturnStatus
;
1541 POB_POST_OPERATION_PARAMETERS Parameters
;
1542 } OB_POST_OPERATION_INFORMATION
,*POB_POST_OPERATION_INFORMATION
;
1544 typedef enum _OB_PREOP_CALLBACK_STATUS
{
1546 } OB_PREOP_CALLBACK_STATUS
, *POB_PREOP_CALLBACK_STATUS
;
1548 typedef OB_PREOP_CALLBACK_STATUS (WINAPI
*POB_PRE_OPERATION_CALLBACK
)(void *context
, POB_PRE_OPERATION_INFORMATION information
);
1549 typedef void (WINAPI
*POB_POST_OPERATION_CALLBACK
)(void *context
, POB_POST_OPERATION_INFORMATION information
);
1551 typedef struct _OB_OPERATION_REGISTRATION
{
1552 POBJECT_TYPE
*ObjectType
;
1553 OB_OPERATION Operations
;
1554 POB_PRE_OPERATION_CALLBACK PreOperation
;
1555 POB_POST_OPERATION_CALLBACK PostOperation
;
1556 } OB_OPERATION_REGISTRATION
, *POB_OPERATION_REGISTRATION
;
1558 typedef struct _OB_CALLBACK_REGISTRATION
{
1560 USHORT OperationRegistrationCount
;
1561 UNICODE_STRING Altitude
;
1562 PVOID RegistrationContext
;
1563 OB_OPERATION_REGISTRATION
*OperationRegistration
;
1564 } OB_CALLBACK_REGISTRATION
, *POB_CALLBACK_REGISTRATION
;
1566 #define OB_FLT_REGISTRATION_VERSION_0100 0x0100
1567 #define OB_FLT_REGISTRATION_VERSION OB_FLT_REGISTRATION_VERSION_0100
1569 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS
{
1570 DirectoryNotifyInformation
= 1,
1571 DirectoryNotifyExtendedInformation
1572 } DIRECTORY_NOTIFY_INFORMATION_CLASS
, *PDIRECTORY_NOTIFY_INFORMATION_CLASS
;
1574 typedef enum _WORK_QUEUE_TYPE
{
1577 HyperCriticalWorkQueue
,
1581 typedef void (WINAPI
*PIO_WORKITEM_ROUTINE
)(PDEVICE_OBJECT
,void*);
1583 NTSTATUS WINAPI
ObCloseHandle(IN HANDLE handle
);
1585 #ifdef NONAMELESSUNION
1586 # ifdef NONAMELESSSTRUCT
1587 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1588 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1589 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1591 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1592 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1593 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1596 # ifdef NONAMELESSSTRUCT
1597 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1598 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1599 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1601 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1602 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1603 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1607 #define IoSetCancelRoutine(irp, routine) \
1608 ((PDRIVER_CANCEL)InterlockedExchangePointer((void **)&(irp)->CancelRoutine, routine))
1610 static inline void IoSetCompletionRoutine(IRP
*irp
, PIO_COMPLETION_ROUTINE routine
, void *context
,
1611 BOOLEAN on_success
, BOOLEAN on_error
, BOOLEAN on_cancel
)
1613 IO_STACK_LOCATION
*irpsp
= IoGetNextIrpStackLocation(irp
);
1614 irpsp
->CompletionRoutine
= routine
;
1615 irpsp
->Context
= context
;
1617 if (on_success
) irpsp
->Control
|= SL_INVOKE_ON_SUCCESS
;
1618 if (on_error
) irpsp
->Control
|= SL_INVOKE_ON_ERROR
;
1619 if (on_cancel
) irpsp
->Control
|= SL_INVOKE_ON_CANCEL
;
1622 static inline void IoMarkIrpPending(IRP
*irp
)
1624 IoGetCurrentIrpStackLocation(irp
)->Control
|= SL_PENDING_RETURNED
;
1627 static inline void IoCopyCurrentIrpStackLocationToNext(IRP
*irp
)
1629 IO_STACK_LOCATION
*current
= IoGetCurrentIrpStackLocation(irp
);
1630 IO_STACK_LOCATION
*next
= IoGetNextIrpStackLocation(irp
);
1631 memcpy(next
, current
, FIELD_OFFSET(IO_STACK_LOCATION
, CompletionRoutine
));
1635 #define KernelMode 0
1638 /* directory object access rights */
1639 #define DIRECTORY_QUERY 0x0001
1640 #define DIRECTORY_TRAVERSE 0x0002
1641 #define DIRECTORY_CREATE_OBJECT 0x0004
1642 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1643 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1645 /* symbolic link access rights */
1646 #define SYMBOLIC_LINK_QUERY 0x0001
1647 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1649 NTSTATUS WINAPI
DbgQueryDebugFilterState(ULONG
, ULONG
);
1651 void FASTCALL
ExAcquireFastMutex(FAST_MUTEX
*);
1652 void FASTCALL
ExAcquireFastMutexUnsafe(PFAST_MUTEX
);
1653 BOOLEAN WINAPI
ExAcquireResourceExclusiveLite(ERESOURCE
*,BOOLEAN
);
1654 BOOLEAN WINAPI
ExAcquireResourceSharedLite(ERESOURCE
*,BOOLEAN
);
1655 BOOLEAN WINAPI
ExAcquireSharedStarveExclusive(ERESOURCE
*,BOOLEAN
);
1656 BOOLEAN WINAPI
ExAcquireSharedWaitForExclusive(ERESOURCE
*,BOOLEAN
);
1657 PVOID WINAPI
ExAllocatePool(POOL_TYPE
,SIZE_T
);
1658 PVOID WINAPI
ExAllocatePoolWithQuota(POOL_TYPE
,SIZE_T
);
1659 PVOID WINAPI
ExAllocatePoolWithTag(POOL_TYPE
,SIZE_T
,ULONG
);
1660 PVOID WINAPI
ExAllocatePoolWithQuotaTag(POOL_TYPE
,SIZE_T
,ULONG
);
1661 void WINAPI
ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
);
1662 void WINAPI
ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST
);
1663 NTSTATUS WINAPI
ExDeleteResourceLite(ERESOURCE
*);
1664 void WINAPI
ExFreePool(PVOID
);
1665 void WINAPI
ExFreePoolWithTag(PVOID
,ULONG
);
1666 ULONG WINAPI
ExGetExclusiveWaiterCount(ERESOURCE
*);
1667 ULONG WINAPI
ExGetSharedWaiterCount(ERESOURCE
*);
1668 void WINAPI
ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1669 void WINAPI
ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1670 NTSTATUS WINAPI
ExInitializeResourceLite(ERESOURCE
*);
1671 PSLIST_ENTRY WINAPI
ExInterlockedFlushSList(PSLIST_HEADER
);
1672 PSLIST_ENTRY WINAPI
ExInterlockedPopEntrySList(PSLIST_HEADER
,PKSPIN_LOCK
);
1673 PSLIST_ENTRY WINAPI
ExInterlockedPushEntrySList(PSLIST_HEADER
,PSLIST_ENTRY
,PKSPIN_LOCK
);
1674 LIST_ENTRY
* WINAPI
ExInterlockedRemoveHeadList(LIST_ENTRY
*,KSPIN_LOCK
*);
1675 BOOLEAN WINAPI
ExIsResourceAcquiredExclusiveLite(ERESOURCE
*);
1676 ULONG WINAPI
ExIsResourceAcquiredSharedLite(ERESOURCE
*);
1677 void * WINAPI
ExRegisterCallback(PCALLBACK_OBJECT
,PCALLBACK_FUNCTION
,void*);
1678 void FASTCALL
ExReleaseFastMutex(FAST_MUTEX
*);
1679 void FASTCALL
ExReleaseFastMutexUnsafe(PFAST_MUTEX
);
1680 void WINAPI
ExReleaseResourceForThreadLite(ERESOURCE
*,ERESOURCE_THREAD
);
1681 ULONG WINAPI
ExSetTimerResolution(ULONG
,BOOLEAN
);
1682 void WINAPI
ExUnregisterCallback(void*);
1684 void WINAPI
IoAcquireCancelSpinLock(KIRQL
*);
1685 NTSTATUS WINAPI
IoAcquireRemoveLockEx(IO_REMOVE_LOCK
*,void*,const char*,ULONG
, ULONG
);
1686 NTSTATUS WINAPI
IoAllocateDriverObjectExtension(PDRIVER_OBJECT
,PVOID
,ULONG
,PVOID
*);
1687 PVOID WINAPI
IoAllocateErrorLogEntry(PVOID
,UCHAR
);
1688 PIRP WINAPI
IoAllocateIrp(CCHAR
,BOOLEAN
);
1689 PMDL WINAPI
IoAllocateMdl(PVOID
,ULONG
,BOOLEAN
,BOOLEAN
,IRP
*);
1690 PIO_WORKITEM WINAPI
IoAllocateWorkItem(PDEVICE_OBJECT
);
1691 void WINAPI
IoDetachDevice(PDEVICE_OBJECT
);
1692 PDEVICE_OBJECT WINAPI
IoAttachDeviceToDeviceStack(PDEVICE_OBJECT
,PDEVICE_OBJECT
);
1693 PIRP WINAPI
IoBuildAsynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,void*,ULONG
,LARGE_INTEGER
*,IO_STATUS_BLOCK
*);
1694 PIRP WINAPI
IoBuildDeviceIoControlRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PVOID
,ULONG
,BOOLEAN
,PKEVENT
,IO_STATUS_BLOCK
*);
1695 PIRP WINAPI
IoBuildSynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PLARGE_INTEGER
,PKEVENT
,IO_STATUS_BLOCK
*);
1696 NTSTATUS WINAPI
IoCallDriver(DEVICE_OBJECT
*,IRP
*);
1697 BOOLEAN WINAPI
IoCancelIrp(IRP
*);
1698 VOID WINAPI
IoCompleteRequest(IRP
*,UCHAR
);
1699 NTSTATUS WINAPI
IoCreateDevice(DRIVER_OBJECT
*,ULONG
,UNICODE_STRING
*,DEVICE_TYPE
,ULONG
,BOOLEAN
,DEVICE_OBJECT
**);
1700 NTSTATUS WINAPI
IoCreateDriver(UNICODE_STRING
*,PDRIVER_INITIALIZE
);
1701 NTSTATUS WINAPI
IoCreateSymbolicLink(UNICODE_STRING
*,UNICODE_STRING
*);
1702 PKEVENT WINAPI
IoCreateSynchronizationEvent(UNICODE_STRING
*,HANDLE
*);
1703 void WINAPI
IoDeleteDevice(DEVICE_OBJECT
*);
1704 void WINAPI
IoDeleteDriver(DRIVER_OBJECT
*);
1705 NTSTATUS WINAPI
IoDeleteSymbolicLink(UNICODE_STRING
*);
1706 void WINAPI
IoFreeIrp(IRP
*);
1707 void WINAPI
IoFreeMdl(MDL
*);
1708 void WINAPI
IoFreeWorkItem(PIO_WORKITEM
);
1709 DEVICE_OBJECT
* WINAPI
IoGetAttachedDeviceReference(DEVICE_OBJECT
*);
1710 PEPROCESS WINAPI
IoGetCurrentProcess(void);
1711 NTSTATUS WINAPI
IoGetDeviceInterfaces(const GUID
*,PDEVICE_OBJECT
,ULONG
,PWSTR
*);
1712 NTSTATUS WINAPI
IoGetDeviceObjectPointer(UNICODE_STRING
*,ACCESS_MASK
,PFILE_OBJECT
*,PDEVICE_OBJECT
*);
1713 NTSTATUS WINAPI
IoGetDeviceProperty(PDEVICE_OBJECT
,DEVICE_REGISTRY_PROPERTY
,ULONG
,PVOID
,PULONG
);
1714 PVOID WINAPI
IoGetDriverObjectExtension(PDRIVER_OBJECT
,PVOID
);
1715 PDEVICE_OBJECT WINAPI
IoGetRelatedDeviceObject(PFILE_OBJECT
);
1716 void WINAPI
IoGetStackLimits(ULONG_PTR
*,ULONG_PTR
*);
1717 void WINAPI
IoInitializeIrp(IRP
*,USHORT
,CCHAR
);
1718 VOID WINAPI
IoInitializeRemoveLockEx(PIO_REMOVE_LOCK
,ULONG
,ULONG
,ULONG
,ULONG
);
1719 void WINAPI
IoInvalidateDeviceRelations(PDEVICE_OBJECT
,DEVICE_RELATION_TYPE
);
1721 BOOLEAN WINAPI
IoIs32bitProcess(IRP
*);
1723 NTSTATUS WINAPI
IoOpenDeviceRegistryKey(DEVICE_OBJECT
*,ULONG
,ACCESS_MASK
,HANDLE
*);
1724 void WINAPI
IoQueueWorkItem(PIO_WORKITEM
,PIO_WORKITEM_ROUTINE
,WORK_QUEUE_TYPE
,void*);
1725 NTSTATUS WINAPI
IoRegisterDeviceInterface(PDEVICE_OBJECT
,const GUID
*,PUNICODE_STRING
,PUNICODE_STRING
);
1726 void WINAPI
IoReleaseCancelSpinLock(KIRQL
);
1727 void WINAPI
IoReleaseRemoveLockAndWaitEx(IO_REMOVE_LOCK
*,void*,ULONG
);
1728 void WINAPI
IoReleaseRemoveLockEx(IO_REMOVE_LOCK
*,void*,ULONG
);
1729 void WINAPI
IoReuseIrp(IRP
*,NTSTATUS
);
1730 NTSTATUS WINAPI
IoSetDeviceInterfaceState(UNICODE_STRING
*,BOOLEAN
);
1731 NTSTATUS WINAPI
IoWMIRegistrationControl(PDEVICE_OBJECT
,ULONG
);
1733 void FASTCALL
KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK
*,KLOCK_QUEUE_HANDLE
*);
1735 void WINAPI
KeAcquireSpinLock(KSPIN_LOCK
*,KIRQL
*);
1737 #define KeAcquireSpinLock( lock, irql ) *(irql) = KeAcquireSpinLockRaiseToDpc( lock )
1738 KIRQL WINAPI
KeAcquireSpinLockRaiseToDpc(KSPIN_LOCK
*);
1740 void WINAPI
KeAcquireSpinLockAtDpcLevel(KSPIN_LOCK
*);
1741 void WINAPI DECLSPEC_NORETURN
KeBugCheckEx(ULONG
,ULONG_PTR
,ULONG_PTR
,ULONG_PTR
,ULONG_PTR
);
1742 BOOLEAN WINAPI
KeCancelTimer(KTIMER
*);
1743 void WINAPI
KeClearEvent(PRKEVENT
);
1744 NTSTATUS WINAPI
KeDelayExecutionThread(KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1745 void WINAPI
KeEnterCriticalRegion(void);
1746 void WINAPI
KeGenericCallDpc(PKDEFERRED_ROUTINE
,PVOID
);
1747 ULONG WINAPI
KeGetCurrentProcessorNumber(void);
1748 PKTHREAD WINAPI
KeGetCurrentThread(void);
1749 void WINAPI
KeInitializeDpc(KDPC
*,PKDEFERRED_ROUTINE
,void*);
1750 void WINAPI
KeInitializeEvent(PRKEVENT
,EVENT_TYPE
,BOOLEAN
);
1751 void WINAPI
KeInitializeMutex(PRKMUTEX
,ULONG
);
1752 void WINAPI
KeInitializeSemaphore(PRKSEMAPHORE
,LONG
,LONG
);
1753 void WINAPI
KeInitializeSpinLock(KSPIN_LOCK
*);
1754 void WINAPI
KeInitializeTimerEx(PKTIMER
,TIMER_TYPE
);
1755 void WINAPI
KeInitializeTimer(KTIMER
*);
1756 void WINAPI
KeLeaveCriticalRegion(void);
1757 ULONG WINAPI
KeQueryActiveProcessorCountEx(USHORT
);
1758 KAFFINITY WINAPI
KeQueryActiveProcessors(void);
1759 void WINAPI
KeQuerySystemTime(LARGE_INTEGER
*);
1760 void WINAPI
KeQueryTickCount(LARGE_INTEGER
*);
1761 ULONG WINAPI
KeQueryTimeIncrement(void);
1762 LONG WINAPI
KeReadStateEvent(PRKEVENT
);
1763 void FASTCALL
KeReleaseInStackQueuedSpinLockFromDpcLevel(KLOCK_QUEUE_HANDLE
*);
1764 LONG WINAPI
KeReleaseMutex(PRKMUTEX
,BOOLEAN
);
1765 LONG WINAPI
KeReleaseSemaphore(PRKSEMAPHORE
,KPRIORITY
,LONG
,BOOLEAN
);
1766 void WINAPI
KeReleaseSpinLock(KSPIN_LOCK
*,KIRQL
);
1767 void WINAPI
KeReleaseSpinLockFromDpcLevel(KSPIN_LOCK
*);
1768 LONG WINAPI
KeResetEvent(PRKEVENT
);
1769 void WINAPI
KeRevertToUserAffinityThread(void);
1770 void WINAPI
KeRevertToUserAffinityThreadEx(KAFFINITY affinity
);
1771 LONG WINAPI
KeSetEvent(PRKEVENT
,KPRIORITY
,BOOLEAN
);
1772 KPRIORITY WINAPI
KeSetPriorityThread(PKTHREAD
,KPRIORITY
);
1773 void WINAPI
KeSetSystemAffinityThread(KAFFINITY
);
1774 KAFFINITY WINAPI
KeSetSystemAffinityThreadEx(KAFFINITY affinity
);
1775 BOOLEAN WINAPI
KeSetTimer(KTIMER
*,LARGE_INTEGER
,KDPC
*);
1776 BOOLEAN WINAPI
KeSetTimerEx(KTIMER
*,LARGE_INTEGER
,LONG
,KDPC
*);
1777 void WINAPI
KeSignalCallDpcDone(void*);
1778 BOOLEAN WINAPI
KeSignalCallDpcSynchronize(void*);
1779 NTSTATUS WINAPI
KeWaitForMultipleObjects(ULONG
,void*[],WAIT_TYPE
,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*,KWAIT_BLOCK
*);
1780 NTSTATUS WINAPI
KeWaitForSingleObject(void*,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1782 PVOID WINAPI
MmAllocateContiguousMemory(SIZE_T
,PHYSICAL_ADDRESS
);
1783 PVOID WINAPI
MmAllocateNonCachedMemory(SIZE_T
);
1784 PMDL WINAPI
MmAllocatePagesForMdl(PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,SIZE_T
);
1785 void WINAPI
MmBuildMdlForNonPagedPool(MDL
*);
1786 NTSTATUS WINAPI
MmCopyVirtualMemory(PEPROCESS
,void*,PEPROCESS
,void*,SIZE_T
,KPROCESSOR_MODE
,SIZE_T
*);
1787 void WINAPI
MmFreeNonCachedMemory(PVOID
,SIZE_T
);
1788 void * WINAPI
MmGetSystemRoutineAddress(UNICODE_STRING
*);
1789 PVOID WINAPI
MmMapLockedPagesSpecifyCache(PMDLX
,KPROCESSOR_MODE
,MEMORY_CACHING_TYPE
,PVOID
,ULONG
,MM_PAGE_PRIORITY
);
1790 MM_SYSTEMSIZE WINAPI
MmQuerySystemSize(void);
1791 void WINAPI
MmProbeAndLockPages(PMDLX
, KPROCESSOR_MODE
, LOCK_OPERATION
);
1792 void WINAPI
MmUnmapLockedPages(void*, PMDL
);
1794 static inline void *MmGetSystemAddressForMdlSafe(MDL
*mdl
, ULONG priority
)
1796 if (mdl
->MdlFlags
& (MDL_MAPPED_TO_SYSTEM_VA
| MDL_SOURCE_IS_NONPAGED_POOL
))
1797 return mdl
->MappedSystemVa
;
1799 return MmMapLockedPagesSpecifyCache(mdl
, KernelMode
, MmCached
, NULL
, FALSE
, priority
);
1802 void FASTCALL
ObfReferenceObject(void*);
1803 void WINAPI
ObDereferenceObject(void*);
1804 USHORT WINAPI
ObGetFilterVersion(void);
1805 NTSTATUS WINAPI
ObRegisterCallbacks(POB_CALLBACK_REGISTRATION
, void**);
1806 NTSTATUS WINAPI
ObReferenceObjectByHandle(HANDLE
,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,PVOID
*,POBJECT_HANDLE_INFORMATION
);
1807 NTSTATUS WINAPI
ObReferenceObjectByName(UNICODE_STRING
*,ULONG
,ACCESS_STATE
*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,void*,void**);
1808 NTSTATUS WINAPI
ObReferenceObjectByPointer(void*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
);
1809 void WINAPI
ObUnRegisterCallbacks(void*);
1811 NTSTATUS WINAPI
PoCallDriver(DEVICE_OBJECT
*,IRP
*);
1812 POWER_STATE WINAPI
PoSetPowerState(PDEVICE_OBJECT
,POWER_STATE_TYPE
,POWER_STATE
);
1813 void WINAPI
PoStartNextPowerIrp(IRP
*);
1815 NTSTATUS WINAPI
PsCreateSystemThread(PHANDLE
,ULONG
,POBJECT_ATTRIBUTES
,HANDLE
,PCLIENT_ID
,PKSTART_ROUTINE
,PVOID
);
1816 #define PsGetCurrentProcess() IoGetCurrentProcess()
1817 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1818 HANDLE WINAPI
PsGetCurrentProcessId(void);
1819 HANDLE WINAPI
PsGetCurrentThreadId(void);
1820 HANDLE WINAPI
PsGetProcessInheritedFromUniqueProcessId(PEPROCESS
);
1821 BOOLEAN WINAPI
PsGetVersion(ULONG
*,ULONG
*,ULONG
*,UNICODE_STRING
*);
1822 NTSTATUS WINAPI
PsTerminateSystemThread(NTSTATUS
);
1825 void WINAPI
RtlCopyMemoryNonTemporal(void*,const void*,SIZE_T
);
1827 #define RtlCopyMemoryNonTemporal RtlCopyMemory
1829 BOOLEAN WINAPI
RtlIsNtDdiVersionAvailable(ULONG
);
1831 NTSTATUS WINAPI
ZwAddBootEntry(PUNICODE_STRING
,PUNICODE_STRING
);
1832 NTSTATUS WINAPI
ZwAccessCheckAndAuditAlarm(PUNICODE_STRING
,HANDLE
,PUNICODE_STRING
,PUNICODE_STRING
,PSECURITY_DESCRIPTOR
,ACCESS_MASK
,PGENERIC_MAPPING
,BOOLEAN
,PACCESS_MASK
,PBOOLEAN
,PBOOLEAN
);
1833 NTSTATUS WINAPI
ZwAdjustPrivilegesToken(HANDLE
,BOOLEAN
,PTOKEN_PRIVILEGES
,DWORD
,PTOKEN_PRIVILEGES
,PDWORD
);
1834 NTSTATUS WINAPI
ZwAlertThread(HANDLE ThreadHandle
);
1835 NTSTATUS WINAPI
ZwAllocateVirtualMemory(HANDLE
,PVOID
*,ULONG
,SIZE_T
*,ULONG
,ULONG
);
1836 NTSTATUS WINAPI
ZwCancelIoFile(HANDLE
,PIO_STATUS_BLOCK
);
1837 NTSTATUS WINAPI
ZwCancelTimer(HANDLE
, BOOLEAN
*);
1838 NTSTATUS WINAPI
ZwClearEvent(HANDLE
);
1839 NTSTATUS WINAPI
ZwClose(HANDLE
);
1840 NTSTATUS WINAPI
ZwCloseObjectAuditAlarm(PUNICODE_STRING
,HANDLE
,BOOLEAN
);
1841 NTSTATUS WINAPI
ZwConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1842 NTSTATUS WINAPI
ZwCreateDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1843 NTSTATUS WINAPI
ZwCreateEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,BOOLEAN
,BOOLEAN
);
1844 NTSTATUS WINAPI
ZwCreateFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,PLARGE_INTEGER
,ULONG
,ULONG
,ULONG
,ULONG
,PVOID
,ULONG
);
1845 NTSTATUS WINAPI
ZwCreateKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,const UNICODE_STRING
*,ULONG
,PULONG
);
1846 NTSTATUS WINAPI
ZwCreateSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const LARGE_INTEGER
*,ULONG
,ULONG
,HANDLE
);
1847 NTSTATUS WINAPI
ZwCreateSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PUNICODE_STRING
);
1848 NTSTATUS WINAPI
ZwCreateTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*, TIMER_TYPE
);
1849 NTSTATUS WINAPI
ZwDeleteAtom(RTL_ATOM
);
1850 NTSTATUS WINAPI
ZwDeleteFile(POBJECT_ATTRIBUTES
);
1851 NTSTATUS WINAPI
ZwDeleteKey(HANDLE
);
1852 NTSTATUS WINAPI
ZwDeleteValueKey(HANDLE
,const UNICODE_STRING
*);
1853 NTSTATUS WINAPI
ZwDeviceIoControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1854 NTSTATUS WINAPI
ZwDisplayString(PUNICODE_STRING
);
1855 NTSTATUS WINAPI
ZwDuplicateObject(HANDLE
,HANDLE
,HANDLE
,PHANDLE
,ACCESS_MASK
,ULONG
,ULONG
);
1856 NTSTATUS WINAPI
ZwDuplicateToken(HANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,SECURITY_IMPERSONATION_LEVEL
,TOKEN_TYPE
,PHANDLE
);
1857 NTSTATUS WINAPI
ZwEnumerateKey(HANDLE
,ULONG
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1858 NTSTATUS WINAPI
ZwEnumerateValueKey(HANDLE
,ULONG
,KEY_VALUE_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1859 NTSTATUS WINAPI
ZwFlushInstructionCache(HANDLE
,LPCVOID
,SIZE_T
);
1860 NTSTATUS WINAPI
ZwFlushKey(HANDLE
);
1861 NTSTATUS WINAPI
ZwFlushVirtualMemory(HANDLE
,LPCVOID
*,SIZE_T
*,ULONG
);
1862 NTSTATUS WINAPI
ZwFreeVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1863 NTSTATUS WINAPI
ZwFsControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1864 NTSTATUS WINAPI
ZwInitiatePowerAction(POWER_ACTION
,SYSTEM_POWER_STATE
,ULONG
,BOOLEAN
);
1865 NTSTATUS WINAPI
ZwLoadDriver(const UNICODE_STRING
*);
1866 NTSTATUS WINAPI
ZwLoadKey(const OBJECT_ATTRIBUTES
*,OBJECT_ATTRIBUTES
*);
1867 NTSTATUS WINAPI
ZwLockVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1868 NTSTATUS WINAPI
ZwMakeTemporaryObject(HANDLE
);
1869 NTSTATUS WINAPI
ZwMapViewOfSection(HANDLE
,HANDLE
,PVOID
*,ULONG
,SIZE_T
,const LARGE_INTEGER
*,SIZE_T
*,SECTION_INHERIT
,ULONG
,ULONG
);
1870 NTSTATUS WINAPI
ZwNotifyChangeKey(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,BOOLEAN
,PVOID
,ULONG
,BOOLEAN
);
1871 NTSTATUS WINAPI
ZwOpenDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1872 NTSTATUS WINAPI
ZwOpenEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1873 NTSTATUS WINAPI
ZwOpenFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,ULONG
,ULONG
);
1874 NTSTATUS WINAPI
ZwOpenKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1875 NTSTATUS WINAPI
ZwOpenProcess(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1876 NTSTATUS WINAPI
ZwOpenProcessToken(HANDLE
,DWORD
,HANDLE
*);
1877 NTSTATUS WINAPI
ZwOpenSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1878 NTSTATUS WINAPI
ZwOpenSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1879 NTSTATUS WINAPI
ZwOpenThread(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1880 NTSTATUS WINAPI
ZwOpenThreadToken(HANDLE
,DWORD
,BOOLEAN
,HANDLE
*);
1881 NTSTATUS WINAPI
ZwOpenTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*);
1882 NTSTATUS WINAPI
ZwPowerInformation(POWER_INFORMATION_LEVEL
,PVOID
,ULONG
,PVOID
,ULONG
);
1883 NTSTATUS WINAPI
ZwPulseEvent(HANDLE
,PULONG
);
1884 NTSTATUS WINAPI
ZwQueryDefaultLocale(BOOLEAN
,LCID
*);
1885 NTSTATUS WINAPI
ZwQueryDefaultUILanguage(LANGID
*);
1886 NTSTATUS WINAPI
ZwQueryDirectoryFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
,BOOLEAN
,PUNICODE_STRING
,BOOLEAN
);
1887 NTSTATUS WINAPI
ZwQueryDirectoryObject(HANDLE
,PDIRECTORY_BASIC_INFORMATION
,ULONG
,BOOLEAN
,BOOLEAN
,PULONG
,PULONG
);
1888 NTSTATUS WINAPI
ZwQueryEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,BOOLEAN
,PVOID
,ULONG
,PVOID
,BOOLEAN
);
1889 NTSTATUS WINAPI
ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES
*,FILE_NETWORK_OPEN_INFORMATION
*);
1890 NTSTATUS WINAPI
ZwQueryInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,LONG
,FILE_INFORMATION_CLASS
);
1891 NTSTATUS WINAPI
ZwQueryInformationThread(HANDLE
,THREADINFOCLASS
,PVOID
,ULONG
,PULONG
);
1892 NTSTATUS WINAPI
ZwQueryInformationToken(HANDLE
,DWORD
,PVOID
,DWORD
,LPDWORD
);
1893 NTSTATUS WINAPI
ZwQueryInstallUILanguage(LANGID
*);
1894 NTSTATUS WINAPI
ZwQueryKey(HANDLE
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1895 NTSTATUS WINAPI
ZwQueryObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
, PULONG
);
1896 NTSTATUS WINAPI
ZwQuerySecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
,ULONG
,PULONG
);
1897 NTSTATUS WINAPI
ZwQuerySection(HANDLE
,SECTION_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1898 NTSTATUS WINAPI
ZwQuerySymbolicLinkObject(HANDLE
,PUNICODE_STRING
,PULONG
);
1899 NTSTATUS WINAPI
ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1900 NTSTATUS WINAPI
ZwQueryTimerResolution(PULONG
,PULONG
,PULONG
);
1901 NTSTATUS WINAPI
ZwQueryValueKey(HANDLE
,const UNICODE_STRING
*,KEY_VALUE_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1902 NTSTATUS WINAPI
ZwQueryVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1903 NTSTATUS WINAPI
ZwReadFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,PLARGE_INTEGER
,PULONG
);
1904 NTSTATUS WINAPI
ZwReplaceKey(POBJECT_ATTRIBUTES
,HANDLE
,POBJECT_ATTRIBUTES
);
1905 NTSTATUS WINAPI
ZwRequestWaitReplyPort(HANDLE
,PLPC_MESSAGE
,PLPC_MESSAGE
);
1906 NTSTATUS WINAPI
ZwResetEvent(HANDLE
,PULONG
);
1907 NTSTATUS WINAPI
ZwRestoreKey(HANDLE
,HANDLE
,ULONG
);
1908 NTSTATUS WINAPI
ZwSaveKey(HANDLE
,HANDLE
);
1909 NTSTATUS WINAPI
ZwSecureConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PSID
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1910 NTSTATUS WINAPI
ZwSetDefaultLocale(BOOLEAN
,LCID
);
1911 NTSTATUS WINAPI
ZwSetDefaultUILanguage(LANGID
);
1912 NTSTATUS WINAPI
ZwSetEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
);
1913 NTSTATUS WINAPI
ZwSetEvent(HANDLE
,PULONG
);
1914 NTSTATUS WINAPI
ZwSetInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
);
1915 NTSTATUS WINAPI
ZwSetInformationKey(HANDLE
,const int,PVOID
,ULONG
);
1916 NTSTATUS WINAPI
ZwSetInformationObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
);
1917 NTSTATUS WINAPI
ZwSetInformationProcess(HANDLE
,PROCESS_INFORMATION_CLASS
,PVOID
,ULONG
);
1918 NTSTATUS WINAPI
ZwSetInformationThread(HANDLE
,THREADINFOCLASS
,LPCVOID
,ULONG
);
1919 NTSTATUS WINAPI
ZwSetIoCompletion(HANDLE
,ULONG
,ULONG
,NTSTATUS
,ULONG
);
1920 NTSTATUS WINAPI
ZwSetLdtEntries(ULONG
,ULONG
,ULONG
,ULONG
,ULONG
,ULONG
);
1921 NTSTATUS WINAPI
ZwSetSecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
);
1922 NTSTATUS WINAPI
ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
);
1923 NTSTATUS WINAPI
ZwSetSystemTime(const LARGE_INTEGER
*,LARGE_INTEGER
*);
1924 NTSTATUS WINAPI
ZwSetTimer(HANDLE
, const LARGE_INTEGER
*, PTIMER_APC_ROUTINE
, PVOID
, BOOLEAN
, ULONG
, BOOLEAN
*);
1925 NTSTATUS WINAPI
ZwSetValueKey(HANDLE
,const UNICODE_STRING
*,ULONG
,ULONG
,const void *,ULONG
);
1926 NTSTATUS WINAPI
ZwSetVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1927 NTSTATUS WINAPI
ZwSuspendThread(HANDLE
,PULONG
);
1928 NTSTATUS WINAPI
ZwTerminateProcess(HANDLE
,LONG
);
1929 NTSTATUS WINAPI
ZwUnloadDriver(const UNICODE_STRING
*);
1930 NTSTATUS WINAPI
ZwUnloadKey(HANDLE
);
1931 NTSTATUS WINAPI
ZwUnmapViewOfSection(HANDLE
,PVOID
);
1932 NTSTATUS WINAPI
ZwWaitForSingleObject(HANDLE
,BOOLEAN
,const LARGE_INTEGER
*);
1933 NTSTATUS WINAPI
ZwWaitForMultipleObjects(ULONG
,const HANDLE
*,BOOLEAN
,BOOLEAN
,const LARGE_INTEGER
*);
1934 NTSTATUS WINAPI
ZwWriteFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,const void*,ULONG
,PLARGE_INTEGER
,PULONG
);
1935 NTSTATUS WINAPI
ZwYieldExecution(void);
1937 static inline void ExInitializeFastMutex( FAST_MUTEX
*mutex
)
1939 mutex
->Count
= FM_LOCK_BIT
;
1940 mutex
->Owner
= NULL
;
1941 mutex
->Contention
= 0;
1942 KeInitializeEvent( &mutex
->Event
, SynchronizationEvent
, FALSE
);