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 */
33 #define PAGE_SIZE 0x1000
36 #define BYTE_OFFSET(va) ((ULONG)((ULONG_PTR)(va) & (PAGE_SIZE - 1)))
37 #define PAGE_ALIGN(va) ((PVOID)((ULONG_PTR)(va) & ~(PAGE_SIZE - 1)))
38 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(va, length) \
39 ((BYTE_OFFSET(va) + ((SIZE_T)(length)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)
41 typedef LONG KPRIORITY
;
43 typedef ULONG_PTR KSPIN_LOCK
, *PKSPIN_LOCK
;
45 typedef ULONG_PTR ERESOURCE_THREAD
;
46 typedef ERESOURCE_THREAD
*PERESOURCE_THREAD
;
47 typedef struct _FILE_GET_QUOTA_INFORMATION
*PFILE_GET_QUOTA_INFORMATION
;
52 struct _DEVICE_OBJECT
;
53 struct _DRIVER_OBJECT
;
55 typedef VOID (WINAPI
*PKDEFERRED_ROUTINE
)(struct _KDPC
*, PVOID
, PVOID
, PVOID
);
56 typedef VOID (WINAPI
*PKSTART_ROUTINE
)(PVOID
);
58 typedef NTSTATUS (WINAPI
*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
*, PUNICODE_STRING
);
59 typedef NTSTATUS (WINAPI
*PDRIVER_DISPATCH
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
60 typedef void (WINAPI
*PDRIVER_STARTIO
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
61 typedef void (WINAPI
*PDRIVER_UNLOAD
)(struct _DRIVER_OBJECT
*);
62 typedef NTSTATUS (WINAPI
*PDRIVER_ADD_DEVICE
)(struct _DRIVER_OBJECT
*, struct _DEVICE_OBJECT
*);
64 typedef struct _DISPATCHER_HEADER
{
70 LIST_ENTRY WaitListHead
;
71 } DISPATCHER_HEADER
, *PDISPATCHER_HEADER
;
73 typedef struct _KEVENT
{
74 DISPATCHER_HEADER Header
;
75 } KEVENT
, *PKEVENT
, *RESTRICTED_POINTER PRKEVENT
;
77 typedef struct _KSEMAPHORE
{
78 DISPATCHER_HEADER Header
;
80 } KSEMAPHORE
, *PKSEMAPHORE
, *PRKSEMAPHORE
;
82 typedef struct _KDPC
{
86 LIST_ENTRY DpcListEntry
;
87 PKDEFERRED_ROUTINE DeferredRoutine
;
88 PVOID DeferredContext
;
89 PVOID SystemArgument1
;
90 PVOID SystemArgument2
;
92 } KDPC
, *PKDPC
, *RESTRICTED_POINTER PRKDPC
;
94 typedef struct _KDEVICE_QUEUE_ENTRY
{
95 LIST_ENTRY DeviceListEntry
;
98 } KDEVICE_QUEUE_ENTRY
, *PKDEVICE_QUEUE_ENTRY
,
99 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY
;
101 typedef struct _KDEVICE_QUEUE
{
104 LIST_ENTRY DeviceListHead
;
107 } KDEVICE_QUEUE
, *PKDEVICE_QUEUE
, *RESTRICTED_POINTER PRKDEVICE_QUEUE
;
109 typedef struct _KMUTANT
{
110 DISPATCHER_HEADER Header
;
111 LIST_ENTRY MutantListEntry
;
112 struct _KTHREAD
*RESTRICTED_POINTER OwnerThread
;
115 } KMUTANT
, *PKMUTANT
, *RESTRICTED_POINTER PRKMUTANT
, KMUTEX
, *PKMUTEX
, *RESTRICTED_POINTER PRKMUTEX
;
117 typedef enum _KWAIT_REASON
147 typedef struct _KWAIT_BLOCK
{
148 LIST_ENTRY WaitListEntry
;
149 struct _KTHREAD
*RESTRICTED_POINTER Thread
;
151 struct _KWAIT_BLOCK
*RESTRICTED_POINTER NextWaitBlock
;
154 } KWAIT_BLOCK
, *PKWAIT_BLOCK
, *RESTRICTED_POINTER PRKWAIT_BLOCK
;
156 typedef struct _OWNER_ENTRY
158 ERESOURCE_THREAD OwnerThread
;
163 ULONG IoPriorityBoosted
: 1;
164 ULONG OwnerReferenced
: 1;
165 ULONG IoQoSPriorityBoosted
: 1;
166 ULONG OwnerCount
: 29;
170 } OWNER_ENTRY
, *POWNER_ENTRY
;
172 #define ResourceNeverExclusive 0x0010
173 #define ResourceReleaseByOtherThread 0x0020
174 #define ResourceOwnedExclusive 0x0080
176 typedef struct _ERESOURCE
178 LIST_ENTRY SystemResourcesList
;
179 OWNER_ENTRY
*OwnerTable
;
186 UCHAR ReservedLowFlags
;
187 UCHAR WaiterPriority
;
190 KSEMAPHORE
*SharedWaiters
;
191 KEVENT
*ExclusiveWaiters
;
192 OWNER_ENTRY OwnerEntry
;
194 ULONG ContentionCount
;
195 ULONG NumberOfSharedWaiters
;
196 ULONG NumberOfExclusiveWaiters
;
203 ULONG_PTR CreatorBackTraceIndex
;
206 } ERESOURCE
, *PERESOURCE
;
208 typedef struct _IO_TIMER
*PIO_TIMER
;
209 typedef struct _IO_TIMER_ROUTINE
*PIO_TIMER_ROUTINE
;
210 typedef struct _ETHREAD
*PETHREAD
;
211 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
212 typedef struct _EPROCESS
*PEPROCESS
;
213 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
214 typedef struct _PAGED_LOOKASIDE_LIST
*PPAGED_LOOKASIDE_LIST
;
215 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
216 typedef struct _OBJECT_HANDLE_INFORMATION
*POBJECT_HANDLE_INFORMATION
;
217 typedef struct _ZONE_HEADER
*PZONE_HEADER
;
218 typedef struct _LOOKASIDE_LIST_EX
*PLOOKASIDE_LIST_EX
;
220 #define FM_LOCK_BIT 0x1
222 typedef struct _FAST_MUTEX
229 } FAST_MUTEX
, *PFAST_MUTEX
;
231 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
233 typedef struct _VPB
{
237 USHORT VolumeLabelLength
;
238 struct _DEVICE_OBJECT
*DeviceObject
;
239 struct _DEVICE_OBJECT
*RealDevice
;
241 ULONG ReferenceCount
;
242 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
245 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 0x0008
246 #define POOL_RAISE_IF_ALLOCATION_FAILURE 0x0010
247 #define POOL_COLD_ALLOCATION 0x0100
248 #define POOL_NX_ALLOCATION 0x0200
250 typedef enum _POOL_TYPE
{
253 NonPagedPoolMustSucceed
,
255 NonPagedPoolCacheAligned
,
256 PagedPoolCacheAligned
,
257 NonPagedPoolCacheAlignedMustS
,
261 typedef struct _WAIT_CONTEXT_BLOCK
{
262 KDEVICE_QUEUE_ENTRY WaitQueueEntry
;
263 struct _DRIVER_CONTROL
*DeviceRoutine
;
265 ULONG NumberOfMapRegisters
;
268 PKDPC BufferChainingDpc
;
269 } WAIT_CONTEXT_BLOCK
, *PWAIT_CONTEXT_BLOCK
;
271 #define DO_BUFFERED_IO 0x00000004
272 #define DO_EXCLUSIVE 0x00000008
273 #define DO_DIRECT_IO 0x00000010
274 #define DO_MAP_IO_BUFFER 0x00000020
275 #define DO_DEVICE_INITIALIZING 0x00000080
276 #define DO_SHUTDOWN_REGISTERED 0x00000800
277 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
278 #define DO_POWER_PAGABLE 0x00002000
279 #define DO_POWER_INRUSH 0x00004000
281 #define IO_NO_INCREMENT 0
282 #define IO_CD_ROM_INCREMENT 1
283 #define IO_DISK_INCREMENT 1
284 #define IO_KEYBOARD_INCREMENT 6
285 #define IO_MAILSLOT_INCREMENT 2
286 #define IO_MOUSE_INCREMENT 6
287 #define IO_NAMED_PIPE_INCREMENT 2
288 #define IO_NETWORK_INCREMENT 2
289 #define IO_PARALLEL_INCREMENT 1
290 #define IO_SERIAL_INCREMENT 2
291 #define IO_SOUND_INCREMENT 8
292 #define IO_VIDEO_INCREMENT 1
295 #define DEVICE_TYPE ULONG
297 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
298 #define IRP_MJ_CREATE 0x00
299 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
300 #define IRP_MJ_CLOSE 0x02
301 #define IRP_MJ_READ 0x03
302 #define IRP_MJ_WRITE 0x04
303 #define IRP_MJ_QUERY_INFORMATION 0x05
304 #define IRP_MJ_SET_INFORMATION 0x06
305 #define IRP_MJ_QUERY_EA 0x07
306 #define IRP_MJ_SET_EA 0x08
307 #define IRP_MJ_FLUSH_BUFFERS 0x09
308 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
309 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
310 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
311 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
312 #define IRP_MJ_DEVICE_CONTROL 0x0e
313 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
314 #define IRP_MJ_SHUTDOWN 0x10
315 #define IRP_MJ_LOCK_CONTROL 0x11
316 #define IRP_MJ_CLEANUP 0x12
317 #define IRP_MJ_CREATE_MAILSLOT 0x13
318 #define IRP_MJ_QUERY_SECURITY 0x14
319 #define IRP_MJ_SET_SECURITY 0x15
320 #define IRP_MJ_POWER 0x16
321 #define IRP_MJ_SYSTEM_CONTROL 0x17
322 #define IRP_MJ_DEVICE_CHANGE 0x18
323 #define IRP_MJ_QUERY_QUOTA 0x19
324 #define IRP_MJ_SET_QUOTA 0x1a
325 #define IRP_MJ_PNP 0x1b
327 #define IRP_MN_START_DEVICE 0x00
328 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
329 #define IRP_MN_REMOVE_DEVICE 0x02
330 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
331 #define IRP_MN_STOP_DEVICE 0x04
332 #define IRP_MN_QUERY_STOP_DEVICE 0x05
333 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
334 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
335 #define IRP_MN_QUERY_INTERFACE 0x08
336 #define IRP_MN_QUERY_CAPABILITIES 0x09
337 #define IRP_MN_QUERY_RESOURCES 0x0A
338 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
339 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
340 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
341 #define IRP_MN_READ_CONFIG 0x0F
342 #define IRP_MN_WRITE_CONFIG 0x10
343 #define IRP_MN_EJECT 0x11
344 #define IRP_MN_SET_LOCK 0x12
345 #define IRP_MN_QUERY_ID 0x13
346 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
347 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
348 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
349 #define IRP_MN_SURPRISE_REMOVAL 0x17
350 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
352 #define IRP_MN_WAIT_WAKE 0x00
353 #define IRP_MN_POWER_SEQUENCE 0x01
354 #define IRP_MN_SET_POWER 0x02
355 #define IRP_MN_QUERY_POWER 0x03
357 #define IRP_QUOTA_CHARGED 0x01
358 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
359 #define IRP_ALLOCATED_FIXED_SIZE 0x04
360 #define IRP_LOOKASIDE_ALLOCATION 0x08
362 #define IO_TYPE_ADAPTER 0x01
363 #define IO_TYPE_CONTROLLER 0x02
364 #define IO_TYPE_DEVICE 0x03
365 #define IO_TYPE_DRIVER 0x04
366 #define IO_TYPE_FILE 0x05
367 #define IO_TYPE_IRP 0x06
368 #define IO_TYPE_MASTER_ADAPTER 0x07
369 #define IO_TYPE_OPEN_PACKET 0x08
370 #define IO_TYPE_TIMER 0x09
371 #define IO_TYPE_VPB 0x0a
372 #define IO_TYPE_ERROR_LOG 0x0b
373 #define IO_TYPE_ERROR_MESSAGE 0x0c
374 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
376 typedef struct _DEVICE_OBJECT
{
380 struct _DRIVER_OBJECT
*DriverObject
;
381 struct _DEVICE_OBJECT
*NextDevice
;
382 struct _DEVICE_OBJECT
*AttachedDevice
;
383 struct _IRP
*CurrentIrp
;
386 ULONG Characteristics
;
388 PVOID DeviceExtension
;
389 DEVICE_TYPE DeviceType
;
392 LIST_ENTRY ListEntry
;
393 WAIT_CONTEXT_BLOCK Wcb
;
395 ULONG AlignmentRequirement
;
396 KDEVICE_QUEUE DeviceQueue
;
398 ULONG ActiveThreadCount
;
399 PSECURITY_DESCRIPTOR SecurityDescriptor
;
403 struct _DEVOBJ_EXTENSION
*DeviceObjectExtension
;
406 typedef struct _DEVICE_OBJECT
*PDEVICE_OBJECT
;
408 typedef struct _DEVICE_RELATIONS
{
410 PDEVICE_OBJECT Objects
[1];
412 typedef struct _DEVICE_RELATIONS
*PDEVICE_RELATIONS
;
414 typedef struct _DRIVER_EXTENSION
{
415 struct _DRIVER_OBJECT
*DriverObject
;
416 PDRIVER_ADD_DEVICE AddDevice
;
418 UNICODE_STRING ServiceKeyName
;
419 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
421 typedef struct _DRIVER_OBJECT
{
424 PDEVICE_OBJECT DeviceObject
;
429 PDRIVER_EXTENSION DriverExtension
;
430 UNICODE_STRING DriverName
;
431 PUNICODE_STRING HardwareDatabase
;
432 PVOID FastIoDispatch
;
433 PDRIVER_INITIALIZE DriverInit
;
434 PDRIVER_STARTIO DriverStartIo
;
435 PDRIVER_UNLOAD DriverUnload
;
436 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
438 typedef struct _DRIVER_OBJECT
*PDRIVER_OBJECT
;
440 /* Irp definitions */
441 typedef UCHAR KIRQL
, *PKIRQL
;
442 typedef CCHAR KPROCESSOR_MODE
;
444 typedef VOID (WINAPI
*PDRIVER_CANCEL
)(
445 IN
struct _DEVICE_OBJECT
*DeviceObject
,
446 IN
struct _IRP
*Irp
);
448 typedef VOID (WINAPI
*PKNORMAL_ROUTINE
)(
449 IN PVOID NormalContext
,
450 IN PVOID SystemArgument1
,
451 IN PVOID SystemArgument2
);
453 typedef VOID (WINAPI
*PKKERNEL_ROUTINE
)(
454 IN
struct _KAPC
*Apc
,
455 IN OUT PKNORMAL_ROUTINE
*NormalRoutine
,
456 IN OUT PVOID
*NormalContext
,
457 IN OUT PVOID
*SystemArgument1
,
458 IN OUT PVOID
*SystemArgument2
);
460 typedef VOID (WINAPI
*PKRUNDOWN_ROUTINE
)(
461 IN
struct _KAPC
*Apc
);
463 typedef struct _KAPC
{
467 struct _KTHREAD
*Thread
;
468 LIST_ENTRY ApcListEntry
;
469 PKKERNEL_ROUTINE KernelRoutine
;
470 PKRUNDOWN_ROUTINE RundownRoutine
;
471 PKNORMAL_ROUTINE NormalRoutine
;
473 PVOID SystemArgument1
;
474 PVOID SystemArgument2
;
476 KPROCESSOR_MODE ApcMode
;
478 } KAPC
, *PKAPC
, *RESTRICTED_POINTER PRKAPC
;
480 typedef struct _IRP
{
483 struct _MDL
*MdlAddress
;
486 struct _IRP
*MasterIrp
;
490 LIST_ENTRY ThreadListEntry
;
491 IO_STATUS_BLOCK IoStatus
;
492 KPROCESSOR_MODE RequestorMode
;
493 BOOLEAN PendingReturned
;
495 CHAR CurrentLocation
;
498 CCHAR ApcEnvironment
;
499 UCHAR AllocationFlags
;
500 PIO_STATUS_BLOCK UserIosb
;
504 PIO_APC_ROUTINE UserApcRoutine
;
505 PVOID UserApcContext
;
506 } AsynchronousParameters
;
507 LARGE_INTEGER AllocationSize
;
509 PDRIVER_CANCEL CancelRoutine
;
514 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
516 PVOID DriverContext
[4];
520 PCHAR AuxiliaryBuffer
;
522 LIST_ENTRY ListEntry
;
524 struct _IO_STACK_LOCATION
*CurrentStackLocation
;
528 struct _FILE_OBJECT
*OriginalFileObject
;
534 typedef struct _IRP
*PIRP
;
536 #define IRP_NOCACHE 0x0001
537 #define IRP_PAGING_IO 0x0002
538 #define IRP_MOUNT_COMPLETION 0x0002
539 #define IRP_SYNCHRONOUS_API 0x0004
540 #define IRP_ASSOCIATED_IRP 0x0008
541 #define IRP_BUFFERED_IO 0x0010
542 #define IRP_DEALLOCATE_BUFFER 0x0020
543 #define IRP_INPUT_OPERATION 0x0040
544 #define IRP_SYNCHRONOUS_PAGING_IO 0x0040
545 #define IRP_CREATE_OPERATION 0x0080
546 #define IRP_READ_OPERATION 0x0100
547 #define IRP_WRITE_OPERATION 0x0200
548 #define IRP_CLOSE_OPERATION 0x0400
549 #define IRP_DEFER_IO_COMPLETION 0x0800
550 #define IRP_OB_QUERY_NAME 0x1000
551 #define IRP_HOLD_DEVICE_QUEUE 0x2000
553 typedef VOID (WINAPI
*PINTERFACE_REFERENCE
)(
556 typedef VOID (WINAPI
*PINTERFACE_DEREFERENCE
)(
559 typedef struct _INTERFACE
{
563 PINTERFACE_REFERENCE InterfaceReference
;
564 PINTERFACE_DEREFERENCE InterfaceDereference
;
565 } INTERFACE
, *PINTERFACE
;
567 typedef struct _SECTION_OBJECT_POINTERS
{
568 PVOID DataSectionObject
;
569 PVOID SharedCacheMap
;
570 PVOID ImageSectionObject
;
571 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
573 typedef struct _IO_COMPLETION_CONTEXT
{
576 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
578 typedef enum _DEVICE_RELATION_TYPE
{
583 TargetDeviceRelation
,
585 } DEVICE_RELATION_TYPE
, *PDEVICE_RELATION_TYPE
;
587 typedef struct _FILE_OBJECT
{
590 PDEVICE_OBJECT DeviceObject
;
594 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
595 PVOID PrivateCacheMap
;
596 NTSTATUS FinalStatus
;
597 struct _FILE_OBJECT
*RelatedFileObject
;
598 BOOLEAN LockOperation
;
599 BOOLEAN DeletePending
;
602 BOOLEAN DeleteAccess
;
605 BOOLEAN SharedDelete
;
607 UNICODE_STRING FileName
;
608 LARGE_INTEGER CurrentByteOffset
;
614 PIO_COMPLETION_CONTEXT CompletionContext
;
616 typedef struct _FILE_OBJECT
*PFILE_OBJECT
;
618 #define INITIAL_PRIVILEGE_COUNT 3
620 typedef struct _INITIAL_PRIVILEGE_SET
{
621 ULONG PrivilegeCount
;
623 LUID_AND_ATTRIBUTES Privilege
[INITIAL_PRIVILEGE_COUNT
];
624 } INITIAL_PRIVILEGE_SET
, * PINITIAL_PRIVILEGE_SET
;
626 typedef struct _SECURITY_SUBJECT_CONTEXT
{
627 PACCESS_TOKEN ClientToken
;
628 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
629 PACCESS_TOKEN PrimaryToken
;
630 PVOID ProcessAuditId
;
631 } SECURITY_SUBJECT_CONTEXT
, *PSECURITY_SUBJECT_CONTEXT
;
633 typedef struct _ACCESS_STATE
{
635 BOOLEAN SecurityEvaluated
;
636 BOOLEAN GenerateAudit
;
637 BOOLEAN GenerateOnClose
;
638 BOOLEAN PrivilegesAllocated
;
640 ACCESS_MASK RemainingDesiredAccess
;
641 ACCESS_MASK PreviouslyGrantedAccess
;
642 ACCESS_MASK OriginalDesiredAccess
;
643 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext
;
644 PSECURITY_DESCRIPTOR SecurityDescriptor
;
647 INITIAL_PRIVILEGE_SET InitialPrivilegeSet
;
648 PRIVILEGE_SET PrivilegeSet
;
651 BOOLEAN AuditPrivileges
;
652 UNICODE_STRING ObjectName
;
653 UNICODE_STRING ObjectTypeName
;
654 } ACCESS_STATE
, *PACCESS_STATE
;
656 typedef struct _IO_SECURITY_CONTEXT
{
657 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
658 PACCESS_STATE AccessState
;
659 ACCESS_MASK DesiredAccess
;
660 ULONG FullCreateOptions
;
661 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
663 typedef struct _DEVICE_CAPABILITIES
{
668 ULONG LockSupported
: 1;
669 ULONG EjectSupported
: 1;
671 ULONG DockDevice
: 1;
673 ULONG SilentInstall
: 1;
674 ULONG RawDeviceOK
: 1;
675 ULONG SurpriseRemovalOK
: 1;
676 ULONG WakeFromD0
: 1;
677 ULONG WakeFromD1
: 1;
678 ULONG WakeFromD2
: 1;
679 ULONG WakeFromD3
: 1;
680 ULONG HardwareDisabled
: 1;
681 ULONG NonDynamic
: 1;
682 ULONG WarmEjectSupported
: 1;
683 ULONG NoDisplayInUI
: 1;
687 DEVICE_POWER_STATE DeviceState
[PowerSystemMaximum
];
688 SYSTEM_POWER_STATE SystemWake
;
689 DEVICE_POWER_STATE DeviceWake
;
693 } DEVICE_CAPABILITIES
, *PDEVICE_CAPABILITIES
;
695 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
{
699 GUID InterfaceClassGuid
;
700 PUNICODE_STRING SymbolicLinkName
;
701 } DEVICE_INTERFACE_CHANGE_NOTIFICATION
, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION
;
703 typedef enum _INTERFACE_TYPE
{
704 InterfaceTypeUndefined
= -1,
722 } INTERFACE_TYPE
, *PINTERFACE_TYPE
;
724 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
726 #define IO_RESOURCE_PREFERRED 0x01
727 #define IO_RESOURCE_DEFAULT 0x02
728 #define IO_RESOURCE_ALTERNATIVE 0x08
730 typedef struct _IO_RESOURCE_DESCRIPTOR
{
733 UCHAR ShareDisposition
;
741 PHYSICAL_ADDRESS MinimumAddress
;
742 PHYSICAL_ADDRESS MaximumAddress
;
747 PHYSICAL_ADDRESS MinimumAddress
;
748 PHYSICAL_ADDRESS MaximumAddress
;
755 ULONG MinimumChannel
;
756 ULONG MaximumChannel
;
761 PHYSICAL_ADDRESS MinimumAddress
;
762 PHYSICAL_ADDRESS MaximumAddress
;
779 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
781 typedef struct _IO_RESOURCE_LIST
{
785 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
786 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
788 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
790 INTERFACE_TYPE InterfaceType
;
794 ULONG AlternativeLists
;
795 IO_RESOURCE_LIST List
[1];
796 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
798 typedef enum _BUS_QUERY_ID_TYPE
{
801 BusQueryCompatibleIDs
,
803 BusQueryDeviceSerialNumber
804 } BUS_QUERY_ID_TYPE
, *PBUS_QUERY_ID_TYPE
;
806 typedef enum _CREATE_FILE_TYPE
{
808 CreateFileTypeNamedPipe
,
809 CreateFileTypeMailslot
813 DevicePropertyDeviceDescription
,
814 DevicePropertyHardwareID
,
815 DevicePropertyCompatibleIDs
,
816 DevicePropertyBootConfiguration
,
817 DevicePropertyBootConfigurationTranslated
,
818 DevicePropertyClassName
,
819 DevicePropertyClassGuid
,
820 DevicePropertyDriverKeyName
,
821 DevicePropertyManufacturer
,
822 DevicePropertyFriendlyName
,
823 DevicePropertyLocationInformation
,
824 DevicePropertyPhysicalDeviceObjectName
,
825 DevicePropertyBusTypeGuid
,
826 DevicePropertyLegacyBusType
,
827 DevicePropertyBusNumber
,
828 DevicePropertyEnumeratorName
,
829 DevicePropertyAddress
,
830 DevicePropertyUINumber
,
831 DevicePropertyInstallState
,
832 DevicePropertyRemovalPolicy
833 } DEVICE_REGISTRY_PROPERTY
;
835 typedef enum _DEVICE_TEXT_TYPE
{
836 DeviceTextDescription
,
837 DeviceTextLocationInformation
838 } DEVICE_TEXT_TYPE
, *PDEVICE_TEXT_TYPE
;
840 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE
{
841 DeviceUsageTypeUndefined
,
842 DeviceUsageTypePaging
,
843 DeviceUsageTypeHibernation
,
844 DeviceUsageTypeDumpFile
845 } DEVICE_USAGE_NOTIFICATION_TYPE
;
847 typedef struct _POWER_SEQUENCE
{
851 } POWER_SEQUENCE
, *PPOWER_SEQUENCE
;
853 typedef enum _POWER_STATE_TYPE
{
856 } POWER_STATE_TYPE
, *PPOWER_STATE_TYPE
;
858 typedef union _POWER_STATE
{
859 SYSTEM_POWER_STATE SystemState
;
860 DEVICE_POWER_STATE DeviceState
;
861 } POWER_STATE
, *PPOWER_STATE
;
863 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
865 UCHAR ShareDisposition
;
869 PHYSICAL_ADDRESS Start
;
873 PHYSICAL_ADDRESS Start
;
882 PHYSICAL_ADDRESS Start
;
902 } DeviceSpecificData
;
904 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
906 typedef struct _CM_PARTIAL_RESOURCE_LIST
{
910 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
911 } CM_PARTIAL_RESOURCE_LIST
, *PCM_PARTIAL_RESOURCE_LIST
;
913 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
914 INTERFACE_TYPE InterfaceType
;
916 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
917 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
919 typedef struct _CM_RESOURCE_LIST
{
921 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
922 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
924 typedef NTSTATUS (WINAPI
*PIO_COMPLETION_ROUTINE
)(
925 IN
struct _DEVICE_OBJECT
*DeviceObject
,
929 #define SL_PENDING_RETURNED 0x01
930 #define SL_INVOKE_ON_CANCEL 0x20
931 #define SL_INVOKE_ON_SUCCESS 0x40
932 #define SL_INVOKE_ON_ERROR 0x80
935 #include <pshpack4.h>
937 typedef struct _IO_STACK_LOCATION
{
944 PIO_SECURITY_CONTEXT SecurityContext
;
946 USHORT POINTER_ALIGNMENT FileAttributes
;
948 ULONG POINTER_ALIGNMENT EaLength
;
952 ULONG POINTER_ALIGNMENT Key
;
953 LARGE_INTEGER ByteOffset
;
957 ULONG POINTER_ALIGNMENT Key
;
958 LARGE_INTEGER ByteOffset
;
962 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
966 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
967 PFILE_OBJECT FileObject
;
970 BOOLEAN ReplaceIfExists
;
979 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
982 ULONG OutputBufferLength
;
983 ULONG POINTER_ALIGNMENT InputBufferLength
;
984 ULONG POINTER_ALIGNMENT IoControlCode
;
985 PVOID Type3InputBuffer
;
988 SECURITY_INFORMATION SecurityInformation
;
989 ULONG POINTER_ALIGNMENT Length
;
992 SECURITY_INFORMATION SecurityInformation
;
993 PSECURITY_DESCRIPTOR SecurityDescriptor
;
997 PDEVICE_OBJECT DeviceObject
;
1001 PDEVICE_OBJECT DeviceObject
;
1004 struct _SCSI_REQUEST_BLOCK
*Srb
;
1007 DEVICE_RELATION_TYPE Type
;
1008 } QueryDeviceRelations
;
1010 const GUID
*InterfaceType
;
1013 PINTERFACE Interface
;
1014 PVOID InterfaceSpecificData
;
1017 PDEVICE_CAPABILITIES Capabilities
;
1018 } DeviceCapabilities
;
1020 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
1021 } FilterResourceRequirements
;
1026 ULONG POINTER_ALIGNMENT Length
;
1032 BUS_QUERY_ID_TYPE IdType
;
1035 DEVICE_TEXT_TYPE DeviceTextType
;
1036 LCID POINTER_ALIGNMENT LocaleId
;
1040 BOOLEAN Reserved
[3];
1041 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
1042 } UsageNotification
;
1044 SYSTEM_POWER_STATE PowerState
;
1047 PPOWER_SEQUENCE PowerSequence
;
1050 ULONG SystemContext
;
1051 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
1052 POWER_STATE POINTER_ALIGNMENT State
;
1053 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
1056 PCM_RESOURCE_LIST AllocatedResources
;
1057 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
1060 ULONG_PTR ProviderId
;
1072 PDEVICE_OBJECT DeviceObject
;
1073 PFILE_OBJECT FileObject
;
1074 PIO_COMPLETION_ROUTINE CompletionRoutine
;
1076 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
1077 #if !defined(_WIN64)
1078 #include <poppack.h>
1081 /* MDL definitions */
1083 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1084 #define MDL_PAGES_LOCKED 0x0002
1085 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1086 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1087 #define MDL_PARTIAL 0x0010
1088 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1089 #define MDL_IO_PAGE_READ 0x0040
1090 #define MDL_WRITE_OPERATION 0x0080
1091 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1092 #define MDL_FREE_EXTRA_PTES 0x0200
1093 #define MDL_DESCRIBES_AWE 0x0400
1094 #define MDL_IO_SPACE 0x0800
1095 #define MDL_NETWORK_HEADER 0x1000
1096 #define MDL_MAPPING_CAN_FAIL 0x2000
1097 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1098 #define MDL_INTERNAL 0x8000
1100 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
1101 MDL_PAGES_LOCKED | \
1102 MDL_SOURCE_IS_NONPAGED_POOL | \
1103 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1104 MDL_PARENT_MAPPED_SYSTEM_VA | \
1108 typedef struct _MDL
{
1112 struct _EPROCESS
*Process
;
1113 PVOID MappedSystemVa
;
1120 typedef ULONG PFN_NUMBER
, *PPFN_NUMBER
;
1122 static inline void MmInitializeMdl(MDL
*mdl
, void *va
, SIZE_T length
)
1125 mdl
->Size
= sizeof(MDL
) + sizeof(PFN_NUMBER
) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(va
, length
);
1127 mdl
->StartVa
= (void *)PAGE_ALIGN(va
);
1128 mdl
->ByteOffset
= BYTE_OFFSET(va
);
1129 mdl
->ByteCount
= length
;
1132 typedef struct _KTIMER
{
1133 DISPATCHER_HEADER Header
;
1134 ULARGE_INTEGER DueTime
;
1135 LIST_ENTRY TimerListEntry
;
1140 typedef struct _KSYSTEM_TIME
{
1144 } KSYSTEM_TIME
, *PKSYSTEM_TIME
;
1146 typedef enum _NT_PRODUCT_TYPE
{
1150 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
1152 #define PROCESSOR_FEATURE_MAX 64
1154 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
1159 } ALTERNATIVE_ARCHITECTURE_TYPE
;
1161 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1162 #define NX_SUPPORT_POLICY_ALWAYSON 1
1163 #define NX_SUPPORT_POLICY_OPTIN 2
1164 #define NX_SUPPORT_POLICY_OPTOUT 3
1166 #define MAX_WOW64_SHARED_ENTRIES 16
1168 typedef struct _KUSER_SHARED_DATA
{
1169 ULONG TickCountLowDeprecated
;
1170 ULONG TickCountMultiplier
;
1171 volatile KSYSTEM_TIME InterruptTime
;
1172 volatile KSYSTEM_TIME SystemTime
;
1173 volatile KSYSTEM_TIME TimeZoneBias
;
1174 USHORT ImageNumberLow
;
1175 USHORT ImageNumberHigh
;
1176 WCHAR NtSystemRoot
[260];
1177 ULONG MaxStackTraceDepth
;
1178 ULONG CryptoExponent
;
1180 ULONG LargePageMinimum
;
1182 NT_PRODUCT_TYPE NtProductType
;
1183 BOOLEAN ProductTypeIsValid
;
1184 ULONG NtMajorVersion
;
1185 ULONG NtMinorVersion
;
1186 BOOLEAN ProcessorFeatures
[PROCESSOR_FEATURE_MAX
];
1189 volatile ULONG TimeSlip
;
1190 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture
;
1191 LARGE_INTEGER SystemExpirationDate
;
1193 BOOLEAN KdDebuggerEnabled
;
1194 UCHAR NXSupportPolicy
;
1195 volatile ULONG ActiveConsoleId
;
1196 volatile ULONG DismountCount
;
1197 ULONG ComPlusPackage
;
1198 ULONG LastSystemRITEventTickCount
;
1199 ULONG NumberOfPhysicalPages
;
1200 BOOLEAN SafeBootMode
;
1202 ULONGLONG TestRetInstruction
;
1204 ULONG SystemCallReturn
;
1205 ULONGLONG SystemCallPad
[3];
1207 volatile KSYSTEM_TIME TickCount
;
1208 volatile ULONG64 TickCountQuad
;
1211 ULONG Wow64SharedInformation
[MAX_WOW64_SHARED_ENTRIES
];
1212 } KSHARED_USER_DATA
, *PKSHARED_USER_DATA
;
1214 typedef enum _MEMORY_CACHING_TYPE
{
1217 MmWriteCombined
= 2,
1218 MmHardwareCoherentCached
= 3,
1219 MmNonCachedUnordered
= 4,
1221 MmMaximumCacheType
= 6
1222 } MEMORY_CACHING_TYPE
;
1224 typedef enum _MM_PAGE_PRIORITY
{
1226 NormalPagePriority
= 16,
1227 HighPagePriority
= 32
1230 typedef enum _MM_SYSTEM_SIZE
1237 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK
{
1239 BOOLEAN Reserved
[3];
1242 } IO_REMOVE_LOCK_COMMON_BLOCK
;
1244 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK
*PIO_REMOVE_LOCK_TRACKING_BLOCK
;
1246 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK
{
1249 LONGLONG MaxLockedTicks
;
1251 LIST_ENTRY LockList
;
1253 LONG LowMemoryCount
;
1256 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks
;
1257 } IO_REMOVE_LOCK_DBG_BLOCK
;
1259 typedef struct _IO_REMOVE_LOCK
{
1260 IO_REMOVE_LOCK_COMMON_BLOCK Common
;
1261 IO_REMOVE_LOCK_DBG_BLOCK Dbg
;
1262 } IO_REMOVE_LOCK
, *PIO_REMOVE_LOCK
;
1270 typedef struct _CALLBACK_OBJECT
1274 LIST_ENTRY RegisteredCallbacks
;
1275 BOOLEAN AllowMultipleCallbacks
;
1277 } CALLBACK_OBJECT
, *PCALLBACK_OBJECT
;
1279 typedef struct _KSPIN_LOCK_QUEUE
{
1280 struct _KSPIN_LOCK_QUEUE
* volatile Next
;
1281 volatile PKSPIN_LOCK Lock
;
1282 } KSPIN_LOCK_QUEUE
, *PKSPIN_LOCK_QUEUE
;
1284 typedef struct _KLOCK_QUEUE_HANDLE
{
1285 KSPIN_LOCK_QUEUE LockQueue
;
1287 } KLOCK_QUEUE_HANDLE
, *PKLOCK_QUEUE_HANDLE
;
1289 typedef void * (NTAPI
*PALLOCATE_FUNCTION
)(POOL_TYPE
, SIZE_T
, ULONG
);
1290 typedef void * (NTAPI
*PALLOCATE_FUNCTION_EX
)(POOL_TYPE
, SIZE_T
, ULONG
, PLOOKASIDE_LIST_EX
);
1291 typedef void (NTAPI
*PFREE_FUNCTION
)(void *);
1292 typedef void (NTAPI
*PFREE_FUNCTION_EX
)(void *, PLOOKASIDE_LIST_EX
);
1295 #define LOOKASIDE_ALIGN DECLSPEC_CACHEALIGN
1297 #define LOOKASIDE_ALIGN
1300 #define LOOKASIDE_MINIMUM_BLOCK_SIZE (RTL_SIZEOF_THROUGH_FIELD(SLIST_ENTRY, Next))
1302 #define GENERAL_LOOKASIDE_LAYOUT \
1305 SLIST_HEADER ListHead; \
1306 SINGLE_LIST_ENTRY SingleListHead; \
1309 USHORT MaximumDepth; \
1310 ULONG TotalAllocates; \
1313 ULONG AllocateMisses; \
1314 ULONG AllocateHits; \
1315 } DUMMYUNIONNAME2; \
1321 } DUMMYUNIONNAME3; \
1327 PALLOCATE_FUNCTION_EX AllocateEx; \
1328 PALLOCATE_FUNCTION Allocate; \
1329 } DUMMYUNIONNAME4; \
1332 PFREE_FUNCTION_EX FreeEx; \
1333 PFREE_FUNCTION Free; \
1334 } DUMMYUNIONNAME5; \
1335 LIST_ENTRY ListEntry; \
1336 ULONG LastTotalAllocates; \
1339 ULONG LastAllocateMisses; \
1340 ULONG LastAllocateHits; \
1341 } DUMMYUNIONNAME6; \
1344 typedef struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE
1346 GENERAL_LOOKASIDE_LAYOUT
1347 } GENERAL_LOOKASIDE
;
1349 typedef struct _GENERAL_LOOKASIDE_POOL
1351 GENERAL_LOOKASIDE_LAYOUT
1352 } GENERAL_LOOKASIDE_POOL
, *PGENERAL_LOOKASIDE_POOL
;
1354 typedef struct _LOOKASIDE_LIST_EX
1356 GENERAL_LOOKASIDE_POOL L
;
1357 } LOOKASIDE_LIST_EX
;
1359 typedef struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST
1361 GENERAL_LOOKASIDE L
;
1362 #if defined(__i386__)
1363 KSPIN_LOCK Lock__ObsoleteButDoNotDelete
;
1365 } NPAGED_LOOKASIDE_LIST
, *PNPAGED_LOOKASIDE_LIST
;
1367 typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION
)(void *CallbackContext
, void *Argument1
, void *Argument2
);
1368 typedef EX_CALLBACK_FUNCTION
*PEX_CALLBACK_FUNCTION
;
1370 typedef ULONG OB_OPERATION
;
1372 typedef struct _OB_PRE_CREATE_HANDLE_INFORMATION
{
1373 ACCESS_MASK DesiredAccess
;
1374 ACCESS_MASK OriginalDesiredAccess
;
1375 } OB_PRE_CREATE_HANDLE_INFORMATION
, *POB_PRE_CREATE_HANDLE_INFORMATION
;
1377 typedef struct _OB_PRE_DUPLICATE_HANDLE_INFORMATION
{
1378 ACCESS_MASK DesiredAccess
;
1379 ACCESS_MASK OriginalDesiredAccess
;
1380 PVOID SourceProcess
;
1381 PVOID TargetProcess
;
1382 } OB_PRE_DUPLICATE_HANDLE_INFORMATION
, *POB_PRE_DUPLICATE_HANDLE_INFORMATION
;
1384 typedef union _OB_PRE_OPERATION_PARAMETERS
{
1385 OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1386 OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1387 } OB_PRE_OPERATION_PARAMETERS
, *POB_PRE_OPERATION_PARAMETERS
;
1389 typedef struct _OB_PRE_OPERATION_INFORMATION
{
1390 OB_OPERATION Operation
;
1394 ULONG KernelHandle
:1;
1399 POBJECT_TYPE ObjectType
;
1401 POB_PRE_OPERATION_PARAMETERS Parameters
;
1402 } OB_PRE_OPERATION_INFORMATION
, *POB_PRE_OPERATION_INFORMATION
;
1404 typedef struct _OB_POST_CREATE_HANDLE_INFORMATION
{
1405 ACCESS_MASK GrantedAccess
;
1406 } OB_POST_CREATE_HANDLE_INFORMATION
, *POB_POST_CREATE_HANDLE_INFORMATION
;
1408 typedef struct _OB_POST_DUPLICATE_HANDLE_INFORMATION
{
1409 ACCESS_MASK GrantedAccess
;
1410 } OB_POST_DUPLICATE_HANDLE_INFORMATION
, *POB_POST_DUPLICATE_HANDLE_INFORMATION
;
1412 typedef union _OB_POST_OPERATION_PARAMETERS
{
1413 OB_POST_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1414 OB_POST_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1415 } OB_POST_OPERATION_PARAMETERS
, *POB_POST_OPERATION_PARAMETERS
;
1417 typedef struct _OB_POST_OPERATION_INFORMATION
{
1418 OB_OPERATION Operation
;
1422 ULONG KernelHandle
:1;
1427 POBJECT_TYPE ObjectType
;
1429 NTSTATUS ReturnStatus
;
1430 POB_POST_OPERATION_PARAMETERS Parameters
;
1431 } OB_POST_OPERATION_INFORMATION
,*POB_POST_OPERATION_INFORMATION
;
1433 typedef enum _OB_PREOP_CALLBACK_STATUS
{
1435 } OB_PREOP_CALLBACK_STATUS
, *POB_PREOP_CALLBACK_STATUS
;
1437 typedef OB_PREOP_CALLBACK_STATUS (WINAPI
*POB_PRE_OPERATION_CALLBACK
)(void *context
, POB_PRE_OPERATION_INFORMATION information
);
1438 typedef void (WINAPI
*POB_POST_OPERATION_CALLBACK
)(void *context
, POB_POST_OPERATION_INFORMATION information
);
1440 typedef struct _OB_OPERATION_REGISTRATION
{
1441 POBJECT_TYPE
*ObjectType
;
1442 OB_OPERATION Operations
;
1443 POB_PRE_OPERATION_CALLBACK PreOperation
;
1444 POB_POST_OPERATION_CALLBACK PostOperation
;
1445 } OB_OPERATION_REGISTRATION
, *POB_OPERATION_REGISTRATION
;
1447 typedef struct _OB_CALLBACK_REGISTRATION
{
1449 USHORT OperationRegistrationCount
;
1450 UNICODE_STRING Altitude
;
1451 PVOID RegistrationContext
;
1452 OB_OPERATION_REGISTRATION
*OperationRegistration
;
1453 } OB_CALLBACK_REGISTRATION
, *POB_CALLBACK_REGISTRATION
;
1455 #define OB_FLT_REGISTRATION_VERSION_0100 0x0100
1456 #define OB_FLT_REGISTRATION_VERSION OB_FLT_REGISTRATION_VERSION_0100
1458 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS
{
1459 DirectoryNotifyInformation
= 1,
1460 DirectoryNotifyExtendedInformation
1461 } DIRECTORY_NOTIFY_INFORMATION_CLASS
, *PDIRECTORY_NOTIFY_INFORMATION_CLASS
;
1463 typedef enum _WORK_QUEUE_TYPE
{
1466 HyperCriticalWorkQueue
,
1470 typedef void (WINAPI
*PIO_WORKITEM_ROUTINE
)(PDEVICE_OBJECT
,void*);
1472 NTSTATUS WINAPI
ObCloseHandle(IN HANDLE handle
);
1474 #ifdef NONAMELESSUNION
1475 # ifdef NONAMELESSSTRUCT
1476 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1477 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1478 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1480 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1481 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1482 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1485 # ifdef NONAMELESSSTRUCT
1486 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1487 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1488 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1490 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1491 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1492 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1496 #define IoSetCancelRoutine(irp, routine) \
1497 ((PDRIVER_CANCEL)InterlockedExchangePointer((void **)&(irp)->CancelRoutine, routine))
1499 static inline void IoSetCompletionRoutine(IRP
*irp
, PIO_COMPLETION_ROUTINE routine
, void *context
,
1500 BOOLEAN on_success
, BOOLEAN on_error
, BOOLEAN on_cancel
)
1502 IO_STACK_LOCATION
*irpsp
= IoGetNextIrpStackLocation(irp
);
1503 irpsp
->CompletionRoutine
= routine
;
1504 irpsp
->Context
= context
;
1506 if (on_success
) irpsp
->Control
|= SL_INVOKE_ON_SUCCESS
;
1507 if (on_error
) irpsp
->Control
|= SL_INVOKE_ON_ERROR
;
1508 if (on_cancel
) irpsp
->Control
|= SL_INVOKE_ON_CANCEL
;
1511 static inline void IoMarkIrpPending(IRP
*irp
)
1513 IoGetCurrentIrpStackLocation(irp
)->Control
|= SL_PENDING_RETURNED
;
1516 #define KernelMode 0
1519 /* directory object access rights */
1520 #define DIRECTORY_QUERY 0x0001
1521 #define DIRECTORY_TRAVERSE 0x0002
1522 #define DIRECTORY_CREATE_OBJECT 0x0004
1523 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1524 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1526 /* symbolic link access rights */
1527 #define SYMBOLIC_LINK_QUERY 0x0001
1528 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1530 NTSTATUS WINAPI
DbgQueryDebugFilterState(ULONG
, ULONG
);
1531 void FASTCALL
ExAcquireFastMutexUnsafe(PFAST_MUTEX
);
1532 BOOLEAN WINAPI
ExAcquireResourceExclusiveLite(ERESOURCE
*,BOOLEAN
);
1533 BOOLEAN WINAPI
ExAcquireResourceSharedLite(ERESOURCE
*,BOOLEAN
);
1534 BOOLEAN WINAPI
ExAcquireSharedStarveExclusive(ERESOURCE
*,BOOLEAN
);
1535 BOOLEAN WINAPI
ExAcquireSharedWaitForExclusive(ERESOURCE
*,BOOLEAN
);
1536 PVOID WINAPI
ExAllocatePool(POOL_TYPE
,SIZE_T
);
1537 PVOID WINAPI
ExAllocatePoolWithQuota(POOL_TYPE
,SIZE_T
);
1538 PVOID WINAPI
ExAllocatePoolWithTag(POOL_TYPE
,SIZE_T
,ULONG
);
1539 PVOID WINAPI
ExAllocatePoolWithQuotaTag(POOL_TYPE
,SIZE_T
,ULONG
);
1540 void WINAPI
ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
);
1541 NTSTATUS WINAPI
ExDeleteResourceLite(ERESOURCE
*);
1542 void WINAPI
ExFreePool(PVOID
);
1543 void WINAPI
ExFreePoolWithTag(PVOID
,ULONG
);
1544 ULONG WINAPI
ExGetExclusiveWaiterCount(ERESOURCE
*);
1545 ULONG WINAPI
ExGetSharedWaiterCount(ERESOURCE
*);
1546 void WINAPI
ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1547 NTSTATUS WINAPI
ExInitializeResourceLite(ERESOURCE
*);
1548 PSLIST_ENTRY WINAPI
ExInterlockedFlushSList(PSLIST_HEADER
);
1549 PSLIST_ENTRY WINAPI
ExInterlockedPopEntrySList(PSLIST_HEADER
,PKSPIN_LOCK
);
1550 PSLIST_ENTRY WINAPI
ExInterlockedPushEntrySList(PSLIST_HEADER
,PSLIST_ENTRY
,PKSPIN_LOCK
);
1551 LIST_ENTRY
* WINAPI
ExInterlockedRemoveHeadList(LIST_ENTRY
*,KSPIN_LOCK
*);
1552 BOOLEAN WINAPI
ExIsResourceAcquiredExclusiveLite(ERESOURCE
*);
1553 ULONG WINAPI
ExIsResourceAcquiredSharedLite(ERESOURCE
*);
1554 void FASTCALL
ExReleaseFastMutexUnsafe(PFAST_MUTEX
);
1555 void WINAPI
ExReleaseResourceForThreadLite(ERESOURCE
*,ERESOURCE_THREAD
);
1556 ULONG WINAPI
ExSetTimerResolution(ULONG
,BOOLEAN
);
1558 void WINAPI
IoAcquireCancelSpinLock(KIRQL
*);
1559 NTSTATUS WINAPI
IoAllocateDriverObjectExtension(PDRIVER_OBJECT
,PVOID
,ULONG
,PVOID
*);
1560 PVOID WINAPI
IoAllocateErrorLogEntry(PVOID
,UCHAR
);
1561 PIRP WINAPI
IoAllocateIrp(CCHAR
,BOOLEAN
);
1562 PMDL WINAPI
IoAllocateMdl(PVOID
,ULONG
,BOOLEAN
,BOOLEAN
,IRP
*);
1563 PIO_WORKITEM WINAPI
IoAllocateWorkItem(PDEVICE_OBJECT
);
1564 PDEVICE_OBJECT WINAPI
IoAttachDeviceToDeviceStack(PDEVICE_OBJECT
,PDEVICE_OBJECT
);
1565 PIRP WINAPI
IoBuildAsynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,void*,ULONG
,LARGE_INTEGER
*,IO_STATUS_BLOCK
*);
1566 PIRP WINAPI
IoBuildDeviceIoControlRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PVOID
,ULONG
,BOOLEAN
,PKEVENT
,IO_STATUS_BLOCK
*);
1567 PIRP WINAPI
IoBuildSynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PLARGE_INTEGER
,PKEVENT
,IO_STATUS_BLOCK
*);
1568 NTSTATUS WINAPI
IoCallDriver(DEVICE_OBJECT
*,IRP
*);
1569 BOOLEAN WINAPI
IoCancelIrp(IRP
*);
1570 VOID WINAPI
IoCompleteRequest(IRP
*,UCHAR
);
1571 NTSTATUS WINAPI
IoCreateDevice(DRIVER_OBJECT
*,ULONG
,UNICODE_STRING
*,DEVICE_TYPE
,ULONG
,BOOLEAN
,DEVICE_OBJECT
**);
1572 NTSTATUS WINAPI
IoCreateDriver(UNICODE_STRING
*,PDRIVER_INITIALIZE
);
1573 NTSTATUS WINAPI
IoCreateSymbolicLink(UNICODE_STRING
*,UNICODE_STRING
*);
1574 PKEVENT WINAPI
IoCreateSynchronizationEvent(UNICODE_STRING
*,HANDLE
*);
1575 void WINAPI
IoDeleteDevice(DEVICE_OBJECT
*);
1576 void WINAPI
IoDeleteDriver(DRIVER_OBJECT
*);
1577 NTSTATUS WINAPI
IoDeleteSymbolicLink(UNICODE_STRING
*);
1578 void WINAPI
IoFreeIrp(IRP
*);
1579 void WINAPI
IoFreeMdl(MDL
*);
1580 void WINAPI
IoFreeWorkItem(PIO_WORKITEM
);
1581 PEPROCESS WINAPI
IoGetCurrentProcess(void);
1582 NTSTATUS WINAPI
IoGetDeviceInterfaces(const GUID
*,PDEVICE_OBJECT
,ULONG
,PWSTR
*);
1583 NTSTATUS WINAPI
IoGetDeviceObjectPointer(UNICODE_STRING
*,ACCESS_MASK
,PFILE_OBJECT
*,PDEVICE_OBJECT
*);
1584 NTSTATUS WINAPI
IoGetDeviceProperty(PDEVICE_OBJECT
,DEVICE_REGISTRY_PROPERTY
,ULONG
,PVOID
,PULONG
);
1585 PVOID WINAPI
IoGetDriverObjectExtension(PDRIVER_OBJECT
,PVOID
);
1586 PDEVICE_OBJECT WINAPI
IoGetRelatedDeviceObject(PFILE_OBJECT
);
1587 void WINAPI
IoInitializeIrp(IRP
*,USHORT
,CCHAR
);
1588 VOID WINAPI
IoInitializeRemoveLockEx(PIO_REMOVE_LOCK
,ULONG
,ULONG
,ULONG
,ULONG
);
1589 void WINAPI
IoInvalidateDeviceRelations(PDEVICE_OBJECT
,DEVICE_RELATION_TYPE
);
1590 void WINAPI
IoQueueWorkItem(PIO_WORKITEM
,PIO_WORKITEM_ROUTINE
,WORK_QUEUE_TYPE
,void*);
1591 NTSTATUS WINAPI
IoRegisterDeviceInterface(PDEVICE_OBJECT
,const GUID
*,PUNICODE_STRING
,PUNICODE_STRING
);
1592 void WINAPI
IoReleaseCancelSpinLock(KIRQL
);
1593 NTSTATUS WINAPI
IoSetDeviceInterfaceState(UNICODE_STRING
*,BOOLEAN
);
1594 NTSTATUS WINAPI
IoWMIRegistrationControl(PDEVICE_OBJECT
,ULONG
);
1596 void FASTCALL
KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK
*,KLOCK_QUEUE_HANDLE
*);
1598 void WINAPI
KeAcquireSpinLock(KSPIN_LOCK
*,KIRQL
*);
1600 #define KeAcquireSpinLock( lock, irql ) *(irql) = KeAcquireSpinLockRaiseToDpc( lock )
1601 KIRQL WINAPI
KeAcquireSpinLockRaiseToDpc(KSPIN_LOCK
*);
1603 void WINAPI
KeAcquireSpinLockAtDpcLevel(KSPIN_LOCK
*);
1604 BOOLEAN WINAPI
KeCancelTimer(KTIMER
*);
1605 void WINAPI
KeClearEvent(PRKEVENT
);
1606 NTSTATUS WINAPI
KeDelayExecutionThread(KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1607 void WINAPI
KeEnterCriticalRegion(void);
1608 PKTHREAD WINAPI
KeGetCurrentThread(void);
1609 void WINAPI
KeInitializeEvent(PRKEVENT
,EVENT_TYPE
,BOOLEAN
);
1610 void WINAPI
KeInitializeMutex(PRKMUTEX
,ULONG
);
1611 void WINAPI
KeInitializeSemaphore(PRKSEMAPHORE
,LONG
,LONG
);
1612 void WINAPI
KeInitializeSpinLock(KSPIN_LOCK
*);
1613 void WINAPI
KeInitializeTimerEx(PKTIMER
,TIMER_TYPE
);
1614 void WINAPI
KeInitializeTimer(KTIMER
*);
1615 void WINAPI
KeLeaveCriticalRegion(void);
1616 void WINAPI
KeQuerySystemTime(LARGE_INTEGER
*);
1617 void WINAPI
KeQueryTickCount(LARGE_INTEGER
*);
1618 ULONG WINAPI
KeQueryTimeIncrement(void);
1619 void FASTCALL
KeReleaseInStackQueuedSpinLockFromDpcLevel(KLOCK_QUEUE_HANDLE
*);
1620 LONG WINAPI
KeReleaseMutex(PRKMUTEX
,BOOLEAN
);
1621 LONG WINAPI
KeReleaseSemaphore(PRKSEMAPHORE
,KPRIORITY
,LONG
,BOOLEAN
);
1622 void WINAPI
KeReleaseSpinLock(KSPIN_LOCK
*,KIRQL
);
1623 void WINAPI
KeReleaseSpinLockFromDpcLevel(KSPIN_LOCK
*);
1624 LONG WINAPI
KeResetEvent(PRKEVENT
);
1625 void WINAPI
KeRevertToUserAffinityThread(void);
1626 LONG WINAPI
KeSetEvent(PRKEVENT
,KPRIORITY
,BOOLEAN
);
1627 KPRIORITY WINAPI
KeSetPriorityThread(PKTHREAD
,KPRIORITY
);
1628 void WINAPI
KeSetSystemAffinityThread(KAFFINITY
);
1629 BOOLEAN WINAPI
KeSetTimerEx(KTIMER
*,LARGE_INTEGER
,LONG
,KDPC
*);
1630 NTSTATUS WINAPI
KeWaitForMultipleObjects(ULONG
,void*[],WAIT_TYPE
,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*,KWAIT_BLOCK
*);
1631 NTSTATUS WINAPI
KeWaitForSingleObject(void*,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1633 PVOID WINAPI
MmAllocateContiguousMemory(SIZE_T
,PHYSICAL_ADDRESS
);
1634 PVOID WINAPI
MmAllocateNonCachedMemory(SIZE_T
);
1635 PMDL WINAPI
MmAllocatePagesForMdl(PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,SIZE_T
);
1636 void WINAPI
MmBuildMdlForNonPagedPool(MDL
*);
1637 void WINAPI
MmFreeNonCachedMemory(PVOID
,SIZE_T
);
1638 void * WINAPI
MmGetSystemRoutineAddress(UNICODE_STRING
*);
1639 PVOID WINAPI
MmMapLockedPagesSpecifyCache(PMDL
,KPROCESSOR_MODE
,MEMORY_CACHING_TYPE
,PVOID
,ULONG
,ULONG
);
1640 MM_SYSTEMSIZE WINAPI
MmQuerySystemSize(void);
1641 void WINAPI
MmProbeAndLockPages(PMDLX
, KPROCESSOR_MODE
, LOCK_OPERATION
);
1642 void WINAPI
MmUnmapLockedPages(void*, PMDL
);
1644 static inline void *MmGetSystemAddressForMdlSafe(MDL
*mdl
, ULONG priority
)
1646 if (mdl
->MdlFlags
& (MDL_MAPPED_TO_SYSTEM_VA
| MDL_SOURCE_IS_NONPAGED_POOL
))
1647 return mdl
->MappedSystemVa
;
1649 return MmMapLockedPagesSpecifyCache(mdl
, KernelMode
, MmCached
, NULL
, FALSE
, priority
);
1652 void WINAPI
ObDereferenceObject(void*);
1653 USHORT WINAPI
ObGetFilterVersion(void);
1654 NTSTATUS WINAPI
ObRegisterCallbacks(POB_CALLBACK_REGISTRATION
*, void**);
1655 NTSTATUS WINAPI
ObReferenceObjectByHandle(HANDLE
,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,PVOID
*,POBJECT_HANDLE_INFORMATION
);
1656 NTSTATUS WINAPI
ObReferenceObjectByName(UNICODE_STRING
*,ULONG
,ACCESS_STATE
*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,void*,void**);
1657 NTSTATUS WINAPI
ObReferenceObjectByPointer(void*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
);
1658 void WINAPI
ObUnRegisterCallbacks(void*);
1660 POWER_STATE WINAPI
PoSetPowerState(PDEVICE_OBJECT
,POWER_STATE_TYPE
,POWER_STATE
);
1661 NTSTATUS WINAPI
PsCreateSystemThread(PHANDLE
,ULONG
,POBJECT_ATTRIBUTES
,HANDLE
,PCLIENT_ID
,PKSTART_ROUTINE
,PVOID
);
1662 #define PsGetCurrentProcess() IoGetCurrentProcess()
1663 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1664 HANDLE WINAPI
PsGetCurrentProcessId(void);
1665 HANDLE WINAPI
PsGetCurrentThreadId(void);
1666 HANDLE WINAPI
PsGetProcessInheritedFromUniqueProcessId(PEPROCESS
);
1667 BOOLEAN WINAPI
PsGetVersion(ULONG
*,ULONG
*,ULONG
*,UNICODE_STRING
*);
1668 NTSTATUS WINAPI
PsTerminateSystemThread(NTSTATUS
);
1670 NTSTATUS WINAPI
ZwAddBootEntry(PUNICODE_STRING
,PUNICODE_STRING
);
1671 NTSTATUS WINAPI
ZwAccessCheckAndAuditAlarm(PUNICODE_STRING
,HANDLE
,PUNICODE_STRING
,PUNICODE_STRING
,PSECURITY_DESCRIPTOR
,ACCESS_MASK
,PGENERIC_MAPPING
,BOOLEAN
,PACCESS_MASK
,PBOOLEAN
,PBOOLEAN
);
1672 NTSTATUS WINAPI
ZwAdjustPrivilegesToken(HANDLE
,BOOLEAN
,PTOKEN_PRIVILEGES
,DWORD
,PTOKEN_PRIVILEGES
,PDWORD
);
1673 NTSTATUS WINAPI
ZwAlertThread(HANDLE ThreadHandle
);
1674 NTSTATUS WINAPI
ZwAllocateVirtualMemory(HANDLE
,PVOID
*,ULONG
,SIZE_T
*,ULONG
,ULONG
);
1675 NTSTATUS WINAPI
ZwCancelIoFile(HANDLE
,PIO_STATUS_BLOCK
);
1676 NTSTATUS WINAPI
ZwCancelTimer(HANDLE
, BOOLEAN
*);
1677 NTSTATUS WINAPI
ZwClearEvent(HANDLE
);
1678 NTSTATUS WINAPI
ZwClose(HANDLE
);
1679 NTSTATUS WINAPI
ZwCloseObjectAuditAlarm(PUNICODE_STRING
,HANDLE
,BOOLEAN
);
1680 NTSTATUS WINAPI
ZwConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1681 NTSTATUS WINAPI
ZwCreateDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1682 NTSTATUS WINAPI
ZwCreateEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,BOOLEAN
,BOOLEAN
);
1683 NTSTATUS WINAPI
ZwCreateFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,PLARGE_INTEGER
,ULONG
,ULONG
,ULONG
,ULONG
,PVOID
,ULONG
);
1684 NTSTATUS WINAPI
ZwCreateKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,const UNICODE_STRING
*,ULONG
,PULONG
);
1685 NTSTATUS WINAPI
ZwCreateSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const LARGE_INTEGER
*,ULONG
,ULONG
,HANDLE
);
1686 NTSTATUS WINAPI
ZwCreateSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PUNICODE_STRING
);
1687 NTSTATUS WINAPI
ZwCreateTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*, TIMER_TYPE
);
1688 NTSTATUS WINAPI
ZwDeleteAtom(RTL_ATOM
);
1689 NTSTATUS WINAPI
ZwDeleteFile(POBJECT_ATTRIBUTES
);
1690 NTSTATUS WINAPI
ZwDeleteKey(HANDLE
);
1691 NTSTATUS WINAPI
ZwDeleteValueKey(HANDLE
,const UNICODE_STRING
*);
1692 NTSTATUS WINAPI
ZwDeviceIoControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1693 NTSTATUS WINAPI
ZwDisplayString(PUNICODE_STRING
);
1694 NTSTATUS WINAPI
ZwDuplicateObject(HANDLE
,HANDLE
,HANDLE
,PHANDLE
,ACCESS_MASK
,ULONG
,ULONG
);
1695 NTSTATUS WINAPI
ZwDuplicateToken(HANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,SECURITY_IMPERSONATION_LEVEL
,TOKEN_TYPE
,PHANDLE
);
1696 NTSTATUS WINAPI
ZwEnumerateKey(HANDLE
,ULONG
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1697 NTSTATUS WINAPI
ZwEnumerateValueKey(HANDLE
,ULONG
,KEY_VALUE_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1698 NTSTATUS WINAPI
ZwFlushInstructionCache(HANDLE
,LPCVOID
,SIZE_T
);
1699 NTSTATUS WINAPI
ZwFlushKey(HANDLE
);
1700 NTSTATUS WINAPI
ZwFlushVirtualMemory(HANDLE
,LPCVOID
*,SIZE_T
*,ULONG
);
1701 NTSTATUS WINAPI
ZwFreeVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1702 NTSTATUS WINAPI
ZwFsControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1703 NTSTATUS WINAPI
ZwInitiatePowerAction(POWER_ACTION
,SYSTEM_POWER_STATE
,ULONG
,BOOLEAN
);
1704 NTSTATUS WINAPI
ZwLoadDriver(const UNICODE_STRING
*);
1705 NTSTATUS WINAPI
ZwLoadKey(const OBJECT_ATTRIBUTES
*,OBJECT_ATTRIBUTES
*);
1706 NTSTATUS WINAPI
ZwLockVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1707 NTSTATUS WINAPI
ZwMakeTemporaryObject(HANDLE
);
1708 NTSTATUS WINAPI
ZwMapViewOfSection(HANDLE
,HANDLE
,PVOID
*,ULONG
,SIZE_T
,const LARGE_INTEGER
*,SIZE_T
*,SECTION_INHERIT
,ULONG
,ULONG
);
1709 NTSTATUS WINAPI
ZwNotifyChangeKey(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,BOOLEAN
,PVOID
,ULONG
,BOOLEAN
);
1710 NTSTATUS WINAPI
ZwOpenDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1711 NTSTATUS WINAPI
ZwOpenEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1712 NTSTATUS WINAPI
ZwOpenFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,ULONG
,ULONG
);
1713 NTSTATUS WINAPI
ZwOpenKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1714 NTSTATUS WINAPI
ZwOpenProcess(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1715 NTSTATUS WINAPI
ZwOpenProcessToken(HANDLE
,DWORD
,HANDLE
*);
1716 NTSTATUS WINAPI
ZwOpenSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1717 NTSTATUS WINAPI
ZwOpenSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1718 NTSTATUS WINAPI
ZwOpenThread(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1719 NTSTATUS WINAPI
ZwOpenThreadToken(HANDLE
,DWORD
,BOOLEAN
,HANDLE
*);
1720 NTSTATUS WINAPI
ZwOpenTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*);
1721 NTSTATUS WINAPI
ZwPowerInformation(POWER_INFORMATION_LEVEL
,PVOID
,ULONG
,PVOID
,ULONG
);
1722 NTSTATUS WINAPI
ZwPulseEvent(HANDLE
,PULONG
);
1723 NTSTATUS WINAPI
ZwQueryDefaultLocale(BOOLEAN
,LCID
*);
1724 NTSTATUS WINAPI
ZwQueryDefaultUILanguage(LANGID
*);
1725 NTSTATUS WINAPI
ZwQueryDirectoryFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
,BOOLEAN
,PUNICODE_STRING
,BOOLEAN
);
1726 NTSTATUS WINAPI
ZwQueryDirectoryObject(HANDLE
,PDIRECTORY_BASIC_INFORMATION
,ULONG
,BOOLEAN
,BOOLEAN
,PULONG
,PULONG
);
1727 NTSTATUS WINAPI
ZwQueryEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,BOOLEAN
,PVOID
,ULONG
,PVOID
,BOOLEAN
);
1728 NTSTATUS WINAPI
ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES
*,FILE_NETWORK_OPEN_INFORMATION
*);
1729 NTSTATUS WINAPI
ZwQueryInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,LONG
,FILE_INFORMATION_CLASS
);
1730 NTSTATUS WINAPI
ZwQueryInformationThread(HANDLE
,THREADINFOCLASS
,PVOID
,ULONG
,PULONG
);
1731 NTSTATUS WINAPI
ZwQueryInformationToken(HANDLE
,DWORD
,PVOID
,DWORD
,LPDWORD
);
1732 NTSTATUS WINAPI
ZwQueryInstallUILanguage(LANGID
*);
1733 NTSTATUS WINAPI
ZwQueryKey(HANDLE
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1734 NTSTATUS WINAPI
ZwQueryObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
, PULONG
);
1735 NTSTATUS WINAPI
ZwQuerySecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
,ULONG
,PULONG
);
1736 NTSTATUS WINAPI
ZwQuerySection(HANDLE
,SECTION_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1737 NTSTATUS WINAPI
ZwQuerySymbolicLinkObject(HANDLE
,PUNICODE_STRING
,PULONG
);
1738 NTSTATUS WINAPI
ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1739 NTSTATUS WINAPI
ZwQueryTimerResolution(PULONG
,PULONG
,PULONG
);
1740 NTSTATUS WINAPI
ZwQueryValueKey(HANDLE
,const UNICODE_STRING
*,KEY_VALUE_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1741 NTSTATUS WINAPI
ZwQueryVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1742 NTSTATUS WINAPI
ZwReadFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,PLARGE_INTEGER
,PULONG
);
1743 NTSTATUS WINAPI
ZwReplaceKey(POBJECT_ATTRIBUTES
,HANDLE
,POBJECT_ATTRIBUTES
);
1744 NTSTATUS WINAPI
ZwRequestWaitReplyPort(HANDLE
,PLPC_MESSAGE
,PLPC_MESSAGE
);
1745 NTSTATUS WINAPI
ZwResetEvent(HANDLE
,PULONG
);
1746 NTSTATUS WINAPI
ZwRestoreKey(HANDLE
,HANDLE
,ULONG
);
1747 NTSTATUS WINAPI
ZwSaveKey(HANDLE
,HANDLE
);
1748 NTSTATUS WINAPI
ZwSecureConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PSID
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1749 NTSTATUS WINAPI
ZwSetDefaultLocale(BOOLEAN
,LCID
);
1750 NTSTATUS WINAPI
ZwSetDefaultUILanguage(LANGID
);
1751 NTSTATUS WINAPI
ZwSetEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
);
1752 NTSTATUS WINAPI
ZwSetEvent(HANDLE
,PULONG
);
1753 NTSTATUS WINAPI
ZwSetInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
);
1754 NTSTATUS WINAPI
ZwSetInformationKey(HANDLE
,const int,PVOID
,ULONG
);
1755 NTSTATUS WINAPI
ZwSetInformationObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
);
1756 NTSTATUS WINAPI
ZwSetInformationProcess(HANDLE
,PROCESS_INFORMATION_CLASS
,PVOID
,ULONG
);
1757 NTSTATUS WINAPI
ZwSetInformationThread(HANDLE
,THREADINFOCLASS
,LPCVOID
,ULONG
);
1758 NTSTATUS WINAPI
ZwSetIoCompletion(HANDLE
,ULONG
,ULONG
,NTSTATUS
,ULONG
);
1759 NTSTATUS WINAPI
ZwSetLdtEntries(ULONG
,ULONG
,ULONG
,ULONG
,ULONG
,ULONG
);
1760 NTSTATUS WINAPI
ZwSetSecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
);
1761 NTSTATUS WINAPI
ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
);
1762 NTSTATUS WINAPI
ZwSetSystemTime(const LARGE_INTEGER
*,LARGE_INTEGER
*);
1763 NTSTATUS WINAPI
ZwSetTimer(HANDLE
, const LARGE_INTEGER
*, PTIMER_APC_ROUTINE
, PVOID
, BOOLEAN
, ULONG
, BOOLEAN
*);
1764 NTSTATUS WINAPI
ZwSetValueKey(HANDLE
,const UNICODE_STRING
*,ULONG
,ULONG
,const void *,ULONG
);
1765 NTSTATUS WINAPI
ZwSetVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1766 NTSTATUS WINAPI
ZwSuspendThread(HANDLE
,PULONG
);
1767 NTSTATUS WINAPI
ZwTerminateProcess(HANDLE
,LONG
);
1768 NTSTATUS WINAPI
ZwUnloadDriver(const UNICODE_STRING
*);
1769 NTSTATUS WINAPI
ZwUnloadKey(HANDLE
);
1770 NTSTATUS WINAPI
ZwUnmapViewOfSection(HANDLE
,PVOID
);
1771 NTSTATUS WINAPI
ZwWaitForSingleObject(HANDLE
,BOOLEAN
,const LARGE_INTEGER
*);
1772 NTSTATUS WINAPI
ZwWaitForMultipleObjects(ULONG
,const HANDLE
*,BOOLEAN
,BOOLEAN
,const LARGE_INTEGER
*);
1773 NTSTATUS WINAPI
ZwWriteFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,const void*,ULONG
,PLARGE_INTEGER
,PULONG
);
1774 NTSTATUS WINAPI
ZwYieldExecution(void);
1776 static inline void ExInitializeFastMutex( FAST_MUTEX
*mutex
)
1778 mutex
->Count
= FM_LOCK_BIT
;
1779 mutex
->Owner
= NULL
;
1780 mutex
->Contention
= 0;
1781 KeInitializeEvent( &mutex
->Event
, SynchronizationEvent
, FALSE
);