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 enum _KDPC_IMPORTANCE
{
101 typedef struct _KDEVICE_QUEUE_ENTRY
{
102 LIST_ENTRY DeviceListEntry
;
105 } KDEVICE_QUEUE_ENTRY
, *PKDEVICE_QUEUE_ENTRY
,
106 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY
;
108 typedef struct _KDEVICE_QUEUE
{
111 LIST_ENTRY DeviceListHead
;
114 } KDEVICE_QUEUE
, *PKDEVICE_QUEUE
, *RESTRICTED_POINTER PRKDEVICE_QUEUE
;
116 typedef struct _KMUTANT
{
117 DISPATCHER_HEADER Header
;
118 LIST_ENTRY MutantListEntry
;
119 struct _KTHREAD
*RESTRICTED_POINTER OwnerThread
;
122 } KMUTANT
, *PKMUTANT
, *RESTRICTED_POINTER PRKMUTANT
, KMUTEX
, *PKMUTEX
, *RESTRICTED_POINTER PRKMUTEX
;
124 typedef enum _KWAIT_REASON
154 typedef struct _KWAIT_BLOCK
{
155 LIST_ENTRY WaitListEntry
;
156 struct _KTHREAD
*RESTRICTED_POINTER Thread
;
158 struct _KWAIT_BLOCK
*RESTRICTED_POINTER NextWaitBlock
;
161 } KWAIT_BLOCK
, *PKWAIT_BLOCK
, *RESTRICTED_POINTER PRKWAIT_BLOCK
;
163 typedef struct _OWNER_ENTRY
165 ERESOURCE_THREAD OwnerThread
;
170 ULONG IoPriorityBoosted
: 1;
171 ULONG OwnerReferenced
: 1;
172 ULONG IoQoSPriorityBoosted
: 1;
173 ULONG OwnerCount
: 29;
177 } OWNER_ENTRY
, *POWNER_ENTRY
;
179 #define ResourceNeverExclusive 0x0010
180 #define ResourceReleaseByOtherThread 0x0020
181 #define ResourceOwnedExclusive 0x0080
183 typedef struct _ERESOURCE
185 LIST_ENTRY SystemResourcesList
;
186 OWNER_ENTRY
*OwnerTable
;
193 UCHAR ReservedLowFlags
;
194 UCHAR WaiterPriority
;
197 KSEMAPHORE
*SharedWaiters
;
198 KEVENT
*ExclusiveWaiters
;
199 OWNER_ENTRY OwnerEntry
;
201 ULONG ContentionCount
;
202 ULONG NumberOfSharedWaiters
;
203 ULONG NumberOfExclusiveWaiters
;
210 ULONG_PTR CreatorBackTraceIndex
;
213 } ERESOURCE
, *PERESOURCE
;
215 typedef struct _IO_TIMER
*PIO_TIMER
;
216 typedef struct _IO_TIMER_ROUTINE
*PIO_TIMER_ROUTINE
;
217 typedef struct _ETHREAD
*PETHREAD
;
218 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
219 typedef struct _EPROCESS
*PEPROCESS
;
220 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
221 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
222 typedef struct _OBJECT_HANDLE_INFORMATION
*POBJECT_HANDLE_INFORMATION
;
223 typedef struct _ZONE_HEADER
*PZONE_HEADER
;
224 typedef struct _LOOKASIDE_LIST_EX
*PLOOKASIDE_LIST_EX
;
226 #define FM_LOCK_BIT 0x1
228 typedef struct _FAST_MUTEX
235 } FAST_MUTEX
, *PFAST_MUTEX
;
237 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
239 typedef struct _VPB
{
243 USHORT VolumeLabelLength
;
244 struct _DEVICE_OBJECT
*DeviceObject
;
245 struct _DEVICE_OBJECT
*RealDevice
;
247 ULONG ReferenceCount
;
248 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
251 #define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE 0x0008
252 #define POOL_RAISE_IF_ALLOCATION_FAILURE 0x0010
253 #define POOL_COLD_ALLOCATION 0x0100
254 #define POOL_NX_ALLOCATION 0x0200
256 typedef enum _POOL_TYPE
{
259 NonPagedPoolMustSucceed
,
261 NonPagedPoolCacheAligned
,
262 PagedPoolCacheAligned
,
263 NonPagedPoolCacheAlignedMustS
,
267 typedef struct _WAIT_CONTEXT_BLOCK
{
268 KDEVICE_QUEUE_ENTRY WaitQueueEntry
;
269 struct _DRIVER_CONTROL
*DeviceRoutine
;
271 ULONG NumberOfMapRegisters
;
274 PKDPC BufferChainingDpc
;
275 } WAIT_CONTEXT_BLOCK
, *PWAIT_CONTEXT_BLOCK
;
277 #define DO_BUFFERED_IO 0x00000004
278 #define DO_EXCLUSIVE 0x00000008
279 #define DO_DIRECT_IO 0x00000010
280 #define DO_MAP_IO_BUFFER 0x00000020
281 #define DO_DEVICE_INITIALIZING 0x00000080
282 #define DO_SHUTDOWN_REGISTERED 0x00000800
283 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
284 #define DO_POWER_PAGABLE 0x00002000
285 #define DO_POWER_INRUSH 0x00004000
287 #define IO_NO_INCREMENT 0
288 #define IO_CD_ROM_INCREMENT 1
289 #define IO_DISK_INCREMENT 1
290 #define IO_KEYBOARD_INCREMENT 6
291 #define IO_MAILSLOT_INCREMENT 2
292 #define IO_MOUSE_INCREMENT 6
293 #define IO_NAMED_PIPE_INCREMENT 2
294 #define IO_NETWORK_INCREMENT 2
295 #define IO_PARALLEL_INCREMENT 1
296 #define IO_SERIAL_INCREMENT 2
297 #define IO_SOUND_INCREMENT 8
298 #define IO_VIDEO_INCREMENT 1
301 #define DEVICE_TYPE ULONG
303 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
304 #define IRP_MJ_CREATE 0x00
305 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
306 #define IRP_MJ_CLOSE 0x02
307 #define IRP_MJ_READ 0x03
308 #define IRP_MJ_WRITE 0x04
309 #define IRP_MJ_QUERY_INFORMATION 0x05
310 #define IRP_MJ_SET_INFORMATION 0x06
311 #define IRP_MJ_QUERY_EA 0x07
312 #define IRP_MJ_SET_EA 0x08
313 #define IRP_MJ_FLUSH_BUFFERS 0x09
314 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
315 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
316 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
317 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
318 #define IRP_MJ_DEVICE_CONTROL 0x0e
319 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
320 #define IRP_MJ_SHUTDOWN 0x10
321 #define IRP_MJ_LOCK_CONTROL 0x11
322 #define IRP_MJ_CLEANUP 0x12
323 #define IRP_MJ_CREATE_MAILSLOT 0x13
324 #define IRP_MJ_QUERY_SECURITY 0x14
325 #define IRP_MJ_SET_SECURITY 0x15
326 #define IRP_MJ_POWER 0x16
327 #define IRP_MJ_SYSTEM_CONTROL 0x17
328 #define IRP_MJ_DEVICE_CHANGE 0x18
329 #define IRP_MJ_QUERY_QUOTA 0x19
330 #define IRP_MJ_SET_QUOTA 0x1a
331 #define IRP_MJ_PNP 0x1b
333 #define IRP_MN_START_DEVICE 0x00
334 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
335 #define IRP_MN_REMOVE_DEVICE 0x02
336 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
337 #define IRP_MN_STOP_DEVICE 0x04
338 #define IRP_MN_QUERY_STOP_DEVICE 0x05
339 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
340 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
341 #define IRP_MN_QUERY_INTERFACE 0x08
342 #define IRP_MN_QUERY_CAPABILITIES 0x09
343 #define IRP_MN_QUERY_RESOURCES 0x0A
344 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
345 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
346 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
347 #define IRP_MN_READ_CONFIG 0x0F
348 #define IRP_MN_WRITE_CONFIG 0x10
349 #define IRP_MN_EJECT 0x11
350 #define IRP_MN_SET_LOCK 0x12
351 #define IRP_MN_QUERY_ID 0x13
352 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
353 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
354 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
355 #define IRP_MN_SURPRISE_REMOVAL 0x17
356 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
358 #define IRP_MN_WAIT_WAKE 0x00
359 #define IRP_MN_POWER_SEQUENCE 0x01
360 #define IRP_MN_SET_POWER 0x02
361 #define IRP_MN_QUERY_POWER 0x03
363 #define IRP_QUOTA_CHARGED 0x01
364 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
365 #define IRP_ALLOCATED_FIXED_SIZE 0x04
366 #define IRP_LOOKASIDE_ALLOCATION 0x08
368 #define IO_TYPE_ADAPTER 0x01
369 #define IO_TYPE_CONTROLLER 0x02
370 #define IO_TYPE_DEVICE 0x03
371 #define IO_TYPE_DRIVER 0x04
372 #define IO_TYPE_FILE 0x05
373 #define IO_TYPE_IRP 0x06
374 #define IO_TYPE_MASTER_ADAPTER 0x07
375 #define IO_TYPE_OPEN_PACKET 0x08
376 #define IO_TYPE_TIMER 0x09
377 #define IO_TYPE_VPB 0x0a
378 #define IO_TYPE_ERROR_LOG 0x0b
379 #define IO_TYPE_ERROR_MESSAGE 0x0c
380 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
382 typedef struct _DEVICE_OBJECT
{
386 struct _DRIVER_OBJECT
*DriverObject
;
387 struct _DEVICE_OBJECT
*NextDevice
;
388 struct _DEVICE_OBJECT
*AttachedDevice
;
389 struct _IRP
*CurrentIrp
;
392 ULONG Characteristics
;
394 PVOID DeviceExtension
;
395 DEVICE_TYPE DeviceType
;
398 LIST_ENTRY ListEntry
;
399 WAIT_CONTEXT_BLOCK Wcb
;
401 ULONG AlignmentRequirement
;
402 KDEVICE_QUEUE DeviceQueue
;
404 ULONG ActiveThreadCount
;
405 PSECURITY_DESCRIPTOR SecurityDescriptor
;
409 struct _DEVOBJ_EXTENSION
*DeviceObjectExtension
;
412 typedef struct _DEVICE_OBJECT
*PDEVICE_OBJECT
;
414 typedef struct _DEVICE_RELATIONS
{
416 PDEVICE_OBJECT Objects
[1];
418 typedef struct _DEVICE_RELATIONS
*PDEVICE_RELATIONS
;
420 typedef struct _DRIVER_EXTENSION
{
421 struct _DRIVER_OBJECT
*DriverObject
;
422 PDRIVER_ADD_DEVICE AddDevice
;
424 UNICODE_STRING ServiceKeyName
;
425 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
427 typedef struct _DRIVER_OBJECT
{
430 PDEVICE_OBJECT DeviceObject
;
435 PDRIVER_EXTENSION DriverExtension
;
436 UNICODE_STRING DriverName
;
437 PUNICODE_STRING HardwareDatabase
;
438 PVOID FastIoDispatch
;
439 PDRIVER_INITIALIZE DriverInit
;
440 PDRIVER_STARTIO DriverStartIo
;
441 PDRIVER_UNLOAD DriverUnload
;
442 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
444 typedef struct _DRIVER_OBJECT
*PDRIVER_OBJECT
;
446 /* Irp definitions */
447 typedef UCHAR KIRQL
, *PKIRQL
;
448 typedef CCHAR KPROCESSOR_MODE
;
450 typedef VOID (WINAPI
*PDRIVER_CANCEL
)(
451 IN
struct _DEVICE_OBJECT
*DeviceObject
,
452 IN
struct _IRP
*Irp
);
454 typedef VOID (WINAPI
*PKNORMAL_ROUTINE
)(
455 IN PVOID NormalContext
,
456 IN PVOID SystemArgument1
,
457 IN PVOID SystemArgument2
);
459 typedef VOID (WINAPI
*PKKERNEL_ROUTINE
)(
460 IN
struct _KAPC
*Apc
,
461 IN OUT PKNORMAL_ROUTINE
*NormalRoutine
,
462 IN OUT PVOID
*NormalContext
,
463 IN OUT PVOID
*SystemArgument1
,
464 IN OUT PVOID
*SystemArgument2
);
466 typedef VOID (WINAPI
*PKRUNDOWN_ROUTINE
)(
467 IN
struct _KAPC
*Apc
);
469 typedef struct _KAPC
{
473 struct _KTHREAD
*Thread
;
474 LIST_ENTRY ApcListEntry
;
475 PKKERNEL_ROUTINE KernelRoutine
;
476 PKRUNDOWN_ROUTINE RundownRoutine
;
477 PKNORMAL_ROUTINE NormalRoutine
;
479 PVOID SystemArgument1
;
480 PVOID SystemArgument2
;
482 KPROCESSOR_MODE ApcMode
;
484 } KAPC
, *PKAPC
, *RESTRICTED_POINTER PRKAPC
;
486 typedef struct _IRP
{
489 struct _MDL
*MdlAddress
;
492 struct _IRP
*MasterIrp
;
496 LIST_ENTRY ThreadListEntry
;
497 IO_STATUS_BLOCK IoStatus
;
498 KPROCESSOR_MODE RequestorMode
;
499 BOOLEAN PendingReturned
;
501 CHAR CurrentLocation
;
504 CCHAR ApcEnvironment
;
505 UCHAR AllocationFlags
;
506 PIO_STATUS_BLOCK UserIosb
;
510 PIO_APC_ROUTINE UserApcRoutine
;
511 PVOID UserApcContext
;
512 } AsynchronousParameters
;
513 LARGE_INTEGER AllocationSize
;
515 PDRIVER_CANCEL CancelRoutine
;
520 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
522 PVOID DriverContext
[4];
526 PCHAR AuxiliaryBuffer
;
528 LIST_ENTRY ListEntry
;
530 struct _IO_STACK_LOCATION
*CurrentStackLocation
;
534 struct _FILE_OBJECT
*OriginalFileObject
;
540 typedef struct _IRP
*PIRP
;
542 #define IRP_NOCACHE 0x0001
543 #define IRP_PAGING_IO 0x0002
544 #define IRP_MOUNT_COMPLETION 0x0002
545 #define IRP_SYNCHRONOUS_API 0x0004
546 #define IRP_ASSOCIATED_IRP 0x0008
547 #define IRP_BUFFERED_IO 0x0010
548 #define IRP_DEALLOCATE_BUFFER 0x0020
549 #define IRP_INPUT_OPERATION 0x0040
550 #define IRP_SYNCHRONOUS_PAGING_IO 0x0040
551 #define IRP_CREATE_OPERATION 0x0080
552 #define IRP_READ_OPERATION 0x0100
553 #define IRP_WRITE_OPERATION 0x0200
554 #define IRP_CLOSE_OPERATION 0x0400
555 #define IRP_DEFER_IO_COMPLETION 0x0800
556 #define IRP_OB_QUERY_NAME 0x1000
557 #define IRP_HOLD_DEVICE_QUEUE 0x2000
559 typedef VOID (WINAPI
*PINTERFACE_REFERENCE
)(
562 typedef VOID (WINAPI
*PINTERFACE_DEREFERENCE
)(
565 typedef struct _INTERFACE
{
569 PINTERFACE_REFERENCE InterfaceReference
;
570 PINTERFACE_DEREFERENCE InterfaceDereference
;
571 } INTERFACE
, *PINTERFACE
;
573 typedef struct _SECTION_OBJECT_POINTERS
{
574 PVOID DataSectionObject
;
575 PVOID SharedCacheMap
;
576 PVOID ImageSectionObject
;
577 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
579 typedef struct _IO_COMPLETION_CONTEXT
{
582 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
584 typedef enum _DEVICE_RELATION_TYPE
{
589 TargetDeviceRelation
,
591 } DEVICE_RELATION_TYPE
, *PDEVICE_RELATION_TYPE
;
593 typedef struct _FILE_OBJECT
{
596 PDEVICE_OBJECT DeviceObject
;
600 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
601 PVOID PrivateCacheMap
;
602 NTSTATUS FinalStatus
;
603 struct _FILE_OBJECT
*RelatedFileObject
;
604 BOOLEAN LockOperation
;
605 BOOLEAN DeletePending
;
608 BOOLEAN DeleteAccess
;
611 BOOLEAN SharedDelete
;
613 UNICODE_STRING FileName
;
614 LARGE_INTEGER CurrentByteOffset
;
620 PIO_COMPLETION_CONTEXT CompletionContext
;
622 typedef struct _FILE_OBJECT
*PFILE_OBJECT
;
624 #define INITIAL_PRIVILEGE_COUNT 3
626 typedef struct _INITIAL_PRIVILEGE_SET
{
627 ULONG PrivilegeCount
;
629 LUID_AND_ATTRIBUTES Privilege
[INITIAL_PRIVILEGE_COUNT
];
630 } INITIAL_PRIVILEGE_SET
, * PINITIAL_PRIVILEGE_SET
;
632 typedef struct _SECURITY_SUBJECT_CONTEXT
{
633 PACCESS_TOKEN ClientToken
;
634 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
635 PACCESS_TOKEN PrimaryToken
;
636 PVOID ProcessAuditId
;
637 } SECURITY_SUBJECT_CONTEXT
, *PSECURITY_SUBJECT_CONTEXT
;
639 typedef struct _ACCESS_STATE
{
641 BOOLEAN SecurityEvaluated
;
642 BOOLEAN GenerateAudit
;
643 BOOLEAN GenerateOnClose
;
644 BOOLEAN PrivilegesAllocated
;
646 ACCESS_MASK RemainingDesiredAccess
;
647 ACCESS_MASK PreviouslyGrantedAccess
;
648 ACCESS_MASK OriginalDesiredAccess
;
649 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext
;
650 PSECURITY_DESCRIPTOR SecurityDescriptor
;
653 INITIAL_PRIVILEGE_SET InitialPrivilegeSet
;
654 PRIVILEGE_SET PrivilegeSet
;
657 BOOLEAN AuditPrivileges
;
658 UNICODE_STRING ObjectName
;
659 UNICODE_STRING ObjectTypeName
;
660 } ACCESS_STATE
, *PACCESS_STATE
;
662 typedef struct _IO_SECURITY_CONTEXT
{
663 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
664 PACCESS_STATE AccessState
;
665 ACCESS_MASK DesiredAccess
;
666 ULONG FullCreateOptions
;
667 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
669 typedef struct _DEVICE_CAPABILITIES
{
674 ULONG LockSupported
: 1;
675 ULONG EjectSupported
: 1;
677 ULONG DockDevice
: 1;
679 ULONG SilentInstall
: 1;
680 ULONG RawDeviceOK
: 1;
681 ULONG SurpriseRemovalOK
: 1;
682 ULONG WakeFromD0
: 1;
683 ULONG WakeFromD1
: 1;
684 ULONG WakeFromD2
: 1;
685 ULONG WakeFromD3
: 1;
686 ULONG HardwareDisabled
: 1;
687 ULONG NonDynamic
: 1;
688 ULONG WarmEjectSupported
: 1;
689 ULONG NoDisplayInUI
: 1;
693 DEVICE_POWER_STATE DeviceState
[PowerSystemMaximum
];
694 SYSTEM_POWER_STATE SystemWake
;
695 DEVICE_POWER_STATE DeviceWake
;
699 } DEVICE_CAPABILITIES
, *PDEVICE_CAPABILITIES
;
701 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
{
705 GUID InterfaceClassGuid
;
706 PUNICODE_STRING SymbolicLinkName
;
707 } DEVICE_INTERFACE_CHANGE_NOTIFICATION
, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION
;
709 typedef enum _INTERFACE_TYPE
{
710 InterfaceTypeUndefined
= -1,
728 } INTERFACE_TYPE
, *PINTERFACE_TYPE
;
730 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
732 #define IO_RESOURCE_PREFERRED 0x01
733 #define IO_RESOURCE_DEFAULT 0x02
734 #define IO_RESOURCE_ALTERNATIVE 0x08
736 typedef struct _IO_RESOURCE_DESCRIPTOR
{
739 UCHAR ShareDisposition
;
747 PHYSICAL_ADDRESS MinimumAddress
;
748 PHYSICAL_ADDRESS MaximumAddress
;
753 PHYSICAL_ADDRESS MinimumAddress
;
754 PHYSICAL_ADDRESS MaximumAddress
;
761 ULONG MinimumChannel
;
762 ULONG MaximumChannel
;
767 PHYSICAL_ADDRESS MinimumAddress
;
768 PHYSICAL_ADDRESS MaximumAddress
;
785 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
787 typedef struct _IO_RESOURCE_LIST
{
791 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
792 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
794 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
796 INTERFACE_TYPE InterfaceType
;
800 ULONG AlternativeLists
;
801 IO_RESOURCE_LIST List
[1];
802 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
804 typedef enum _BUS_QUERY_ID_TYPE
{
807 BusQueryCompatibleIDs
,
809 BusQueryDeviceSerialNumber
810 } BUS_QUERY_ID_TYPE
, *PBUS_QUERY_ID_TYPE
;
812 typedef enum _CREATE_FILE_TYPE
{
814 CreateFileTypeNamedPipe
,
815 CreateFileTypeMailslot
819 DevicePropertyDeviceDescription
,
820 DevicePropertyHardwareID
,
821 DevicePropertyCompatibleIDs
,
822 DevicePropertyBootConfiguration
,
823 DevicePropertyBootConfigurationTranslated
,
824 DevicePropertyClassName
,
825 DevicePropertyClassGuid
,
826 DevicePropertyDriverKeyName
,
827 DevicePropertyManufacturer
,
828 DevicePropertyFriendlyName
,
829 DevicePropertyLocationInformation
,
830 DevicePropertyPhysicalDeviceObjectName
,
831 DevicePropertyBusTypeGuid
,
832 DevicePropertyLegacyBusType
,
833 DevicePropertyBusNumber
,
834 DevicePropertyEnumeratorName
,
835 DevicePropertyAddress
,
836 DevicePropertyUINumber
,
837 DevicePropertyInstallState
,
838 DevicePropertyRemovalPolicy
839 } DEVICE_REGISTRY_PROPERTY
;
841 typedef enum _DEVICE_TEXT_TYPE
{
842 DeviceTextDescription
,
843 DeviceTextLocationInformation
844 } DEVICE_TEXT_TYPE
, *PDEVICE_TEXT_TYPE
;
846 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE
{
847 DeviceUsageTypeUndefined
,
848 DeviceUsageTypePaging
,
849 DeviceUsageTypeHibernation
,
850 DeviceUsageTypeDumpFile
851 } DEVICE_USAGE_NOTIFICATION_TYPE
;
853 typedef struct _POWER_SEQUENCE
{
857 } POWER_SEQUENCE
, *PPOWER_SEQUENCE
;
859 typedef enum _POWER_STATE_TYPE
{
862 } POWER_STATE_TYPE
, *PPOWER_STATE_TYPE
;
864 typedef union _POWER_STATE
{
865 SYSTEM_POWER_STATE SystemState
;
866 DEVICE_POWER_STATE DeviceState
;
867 } POWER_STATE
, *PPOWER_STATE
;
869 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
871 UCHAR ShareDisposition
;
875 PHYSICAL_ADDRESS Start
;
879 PHYSICAL_ADDRESS Start
;
888 PHYSICAL_ADDRESS Start
;
908 } DeviceSpecificData
;
910 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
912 typedef struct _CM_PARTIAL_RESOURCE_LIST
{
916 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
917 } CM_PARTIAL_RESOURCE_LIST
, *PCM_PARTIAL_RESOURCE_LIST
;
919 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
920 INTERFACE_TYPE InterfaceType
;
922 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
923 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
925 typedef struct _CM_RESOURCE_LIST
{
927 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
928 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
930 typedef NTSTATUS (WINAPI
*PIO_COMPLETION_ROUTINE
)(
931 IN
struct _DEVICE_OBJECT
*DeviceObject
,
935 #define SL_PENDING_RETURNED 0x01
936 #define SL_INVOKE_ON_CANCEL 0x20
937 #define SL_INVOKE_ON_SUCCESS 0x40
938 #define SL_INVOKE_ON_ERROR 0x80
941 #include <pshpack4.h>
943 typedef struct _IO_STACK_LOCATION
{
950 PIO_SECURITY_CONTEXT SecurityContext
;
952 USHORT POINTER_ALIGNMENT FileAttributes
;
954 ULONG POINTER_ALIGNMENT EaLength
;
958 ULONG POINTER_ALIGNMENT Key
;
959 LARGE_INTEGER ByteOffset
;
963 ULONG POINTER_ALIGNMENT Key
;
964 LARGE_INTEGER ByteOffset
;
968 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
972 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
973 PFILE_OBJECT FileObject
;
976 BOOLEAN ReplaceIfExists
;
985 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
988 ULONG OutputBufferLength
;
989 ULONG POINTER_ALIGNMENT InputBufferLength
;
990 ULONG POINTER_ALIGNMENT IoControlCode
;
991 PVOID Type3InputBuffer
;
994 SECURITY_INFORMATION SecurityInformation
;
995 ULONG POINTER_ALIGNMENT Length
;
998 SECURITY_INFORMATION SecurityInformation
;
999 PSECURITY_DESCRIPTOR SecurityDescriptor
;
1003 PDEVICE_OBJECT DeviceObject
;
1007 PDEVICE_OBJECT DeviceObject
;
1010 struct _SCSI_REQUEST_BLOCK
*Srb
;
1013 DEVICE_RELATION_TYPE Type
;
1014 } QueryDeviceRelations
;
1016 const GUID
*InterfaceType
;
1019 PINTERFACE Interface
;
1020 PVOID InterfaceSpecificData
;
1023 PDEVICE_CAPABILITIES Capabilities
;
1024 } DeviceCapabilities
;
1026 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
1027 } FilterResourceRequirements
;
1032 ULONG POINTER_ALIGNMENT Length
;
1038 BUS_QUERY_ID_TYPE IdType
;
1041 DEVICE_TEXT_TYPE DeviceTextType
;
1042 LCID POINTER_ALIGNMENT LocaleId
;
1046 BOOLEAN Reserved
[3];
1047 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
1048 } UsageNotification
;
1050 SYSTEM_POWER_STATE PowerState
;
1053 PPOWER_SEQUENCE PowerSequence
;
1056 ULONG SystemContext
;
1057 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
1058 POWER_STATE POINTER_ALIGNMENT State
;
1059 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
1062 PCM_RESOURCE_LIST AllocatedResources
;
1063 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
1066 ULONG_PTR ProviderId
;
1078 PDEVICE_OBJECT DeviceObject
;
1079 PFILE_OBJECT FileObject
;
1080 PIO_COMPLETION_ROUTINE CompletionRoutine
;
1082 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
1083 #if !defined(_WIN64)
1084 #include <poppack.h>
1087 /* MDL definitions */
1089 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1090 #define MDL_PAGES_LOCKED 0x0002
1091 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1092 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1093 #define MDL_PARTIAL 0x0010
1094 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1095 #define MDL_IO_PAGE_READ 0x0040
1096 #define MDL_WRITE_OPERATION 0x0080
1097 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1098 #define MDL_FREE_EXTRA_PTES 0x0200
1099 #define MDL_DESCRIBES_AWE 0x0400
1100 #define MDL_IO_SPACE 0x0800
1101 #define MDL_NETWORK_HEADER 0x1000
1102 #define MDL_MAPPING_CAN_FAIL 0x2000
1103 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1104 #define MDL_INTERNAL 0x8000
1106 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
1107 MDL_PAGES_LOCKED | \
1108 MDL_SOURCE_IS_NONPAGED_POOL | \
1109 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1110 MDL_PARENT_MAPPED_SYSTEM_VA | \
1114 typedef struct _MDL
{
1118 struct _EPROCESS
*Process
;
1119 PVOID MappedSystemVa
;
1126 typedef ULONG PFN_NUMBER
, *PPFN_NUMBER
;
1128 static inline void MmInitializeMdl(MDL
*mdl
, void *va
, SIZE_T length
)
1131 mdl
->Size
= sizeof(MDL
) + sizeof(PFN_NUMBER
) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(va
, length
);
1133 mdl
->StartVa
= (void *)PAGE_ALIGN(va
);
1134 mdl
->ByteOffset
= BYTE_OFFSET(va
);
1135 mdl
->ByteCount
= length
;
1138 typedef struct _KTIMER
{
1139 DISPATCHER_HEADER Header
;
1140 ULARGE_INTEGER DueTime
;
1141 LIST_ENTRY TimerListEntry
;
1146 typedef struct _KSYSTEM_TIME
{
1150 } KSYSTEM_TIME
, *PKSYSTEM_TIME
;
1152 typedef enum _NT_PRODUCT_TYPE
{
1156 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
1158 #define PROCESSOR_FEATURE_MAX 64
1160 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
1165 } ALTERNATIVE_ARCHITECTURE_TYPE
;
1167 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1168 #define NX_SUPPORT_POLICY_ALWAYSON 1
1169 #define NX_SUPPORT_POLICY_OPTIN 2
1170 #define NX_SUPPORT_POLICY_OPTOUT 3
1172 #define MAX_WOW64_SHARED_ENTRIES 16
1174 typedef struct _KUSER_SHARED_DATA
{
1175 ULONG TickCountLowDeprecated
;
1176 ULONG TickCountMultiplier
;
1177 volatile KSYSTEM_TIME InterruptTime
;
1178 volatile KSYSTEM_TIME SystemTime
;
1179 volatile KSYSTEM_TIME TimeZoneBias
;
1180 USHORT ImageNumberLow
;
1181 USHORT ImageNumberHigh
;
1182 WCHAR NtSystemRoot
[260];
1183 ULONG MaxStackTraceDepth
;
1184 ULONG CryptoExponent
;
1186 ULONG LargePageMinimum
;
1188 NT_PRODUCT_TYPE NtProductType
;
1189 BOOLEAN ProductTypeIsValid
;
1190 ULONG NtMajorVersion
;
1191 ULONG NtMinorVersion
;
1192 BOOLEAN ProcessorFeatures
[PROCESSOR_FEATURE_MAX
];
1195 volatile ULONG TimeSlip
;
1196 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture
;
1197 LARGE_INTEGER SystemExpirationDate
;
1199 BOOLEAN KdDebuggerEnabled
;
1200 UCHAR NXSupportPolicy
;
1201 volatile ULONG ActiveConsoleId
;
1202 volatile ULONG DismountCount
;
1203 ULONG ComPlusPackage
;
1204 ULONG LastSystemRITEventTickCount
;
1205 ULONG NumberOfPhysicalPages
;
1206 BOOLEAN SafeBootMode
;
1208 ULONGLONG TestRetInstruction
;
1210 ULONG SystemCallReturn
;
1211 ULONGLONG SystemCallPad
[3];
1213 volatile KSYSTEM_TIME TickCount
;
1214 volatile ULONG64 TickCountQuad
;
1217 ULONG Wow64SharedInformation
[MAX_WOW64_SHARED_ENTRIES
];
1218 } KSHARED_USER_DATA
, *PKSHARED_USER_DATA
;
1220 typedef enum _MEMORY_CACHING_TYPE
{
1223 MmWriteCombined
= 2,
1224 MmHardwareCoherentCached
= 3,
1225 MmNonCachedUnordered
= 4,
1227 MmMaximumCacheType
= 6
1228 } MEMORY_CACHING_TYPE
;
1230 typedef enum _MM_PAGE_PRIORITY
{
1232 NormalPagePriority
= 16,
1233 HighPagePriority
= 32
1236 typedef enum _MM_SYSTEM_SIZE
1243 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK
{
1245 BOOLEAN Reserved
[3];
1248 } IO_REMOVE_LOCK_COMMON_BLOCK
;
1250 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK
*PIO_REMOVE_LOCK_TRACKING_BLOCK
;
1252 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK
{
1255 LONGLONG MaxLockedTicks
;
1257 LIST_ENTRY LockList
;
1259 LONG LowMemoryCount
;
1262 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks
;
1263 } IO_REMOVE_LOCK_DBG_BLOCK
;
1265 typedef struct _IO_REMOVE_LOCK
{
1266 IO_REMOVE_LOCK_COMMON_BLOCK Common
;
1267 IO_REMOVE_LOCK_DBG_BLOCK Dbg
;
1268 } IO_REMOVE_LOCK
, *PIO_REMOVE_LOCK
;
1276 typedef struct _CALLBACK_OBJECT
1280 LIST_ENTRY RegisteredCallbacks
;
1281 BOOLEAN AllowMultipleCallbacks
;
1283 } CALLBACK_OBJECT
, *PCALLBACK_OBJECT
;
1285 typedef struct _KSPIN_LOCK_QUEUE
{
1286 struct _KSPIN_LOCK_QUEUE
* volatile Next
;
1287 volatile PKSPIN_LOCK Lock
;
1288 } KSPIN_LOCK_QUEUE
, *PKSPIN_LOCK_QUEUE
;
1290 typedef struct _KLOCK_QUEUE_HANDLE
{
1291 KSPIN_LOCK_QUEUE LockQueue
;
1293 } KLOCK_QUEUE_HANDLE
, *PKLOCK_QUEUE_HANDLE
;
1295 typedef void * (NTAPI
*PALLOCATE_FUNCTION
)(POOL_TYPE
, SIZE_T
, ULONG
);
1296 typedef void * (NTAPI
*PALLOCATE_FUNCTION_EX
)(POOL_TYPE
, SIZE_T
, ULONG
, PLOOKASIDE_LIST_EX
);
1297 typedef void (NTAPI
*PFREE_FUNCTION
)(void *);
1298 typedef void (NTAPI
*PFREE_FUNCTION_EX
)(void *, PLOOKASIDE_LIST_EX
);
1301 #define LOOKASIDE_ALIGN DECLSPEC_CACHEALIGN
1303 #define LOOKASIDE_ALIGN
1306 #define LOOKASIDE_MINIMUM_BLOCK_SIZE (RTL_SIZEOF_THROUGH_FIELD(SLIST_ENTRY, Next))
1308 #define GENERAL_LOOKASIDE_LAYOUT \
1311 SLIST_HEADER ListHead; \
1312 SINGLE_LIST_ENTRY SingleListHead; \
1315 USHORT MaximumDepth; \
1316 ULONG TotalAllocates; \
1319 ULONG AllocateMisses; \
1320 ULONG AllocateHits; \
1321 } DUMMYUNIONNAME2; \
1327 } DUMMYUNIONNAME3; \
1333 PALLOCATE_FUNCTION_EX AllocateEx; \
1334 PALLOCATE_FUNCTION Allocate; \
1335 } DUMMYUNIONNAME4; \
1338 PFREE_FUNCTION_EX FreeEx; \
1339 PFREE_FUNCTION Free; \
1340 } DUMMYUNIONNAME5; \
1341 LIST_ENTRY ListEntry; \
1342 ULONG LastTotalAllocates; \
1345 ULONG LastAllocateMisses; \
1346 ULONG LastAllocateHits; \
1347 } DUMMYUNIONNAME6; \
1350 typedef struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE
1352 GENERAL_LOOKASIDE_LAYOUT
1353 } GENERAL_LOOKASIDE
;
1355 typedef struct _GENERAL_LOOKASIDE_POOL
1357 GENERAL_LOOKASIDE_LAYOUT
1358 } GENERAL_LOOKASIDE_POOL
, *PGENERAL_LOOKASIDE_POOL
;
1360 typedef struct _LOOKASIDE_LIST_EX
1362 GENERAL_LOOKASIDE_POOL L
;
1363 } LOOKASIDE_LIST_EX
;
1365 typedef struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST
1367 GENERAL_LOOKASIDE L
;
1368 #if defined(__i386__)
1369 KSPIN_LOCK Lock__ObsoleteButDoNotDelete
;
1371 } NPAGED_LOOKASIDE_LIST
, *PNPAGED_LOOKASIDE_LIST
;
1373 typedef struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST
1375 GENERAL_LOOKASIDE L
;
1376 #if defined(__i386__)
1377 FAST_MUTEX Lock__ObsoleteButDoNotDelete
;
1379 } PAGED_LOOKASIDE_LIST
, *PPAGED_LOOKASIDE_LIST
;
1381 typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION
)(void *CallbackContext
, void *Argument1
, void *Argument2
);
1382 typedef EX_CALLBACK_FUNCTION
*PEX_CALLBACK_FUNCTION
;
1384 typedef ULONG OB_OPERATION
;
1386 typedef struct _OB_PRE_CREATE_HANDLE_INFORMATION
{
1387 ACCESS_MASK DesiredAccess
;
1388 ACCESS_MASK OriginalDesiredAccess
;
1389 } OB_PRE_CREATE_HANDLE_INFORMATION
, *POB_PRE_CREATE_HANDLE_INFORMATION
;
1391 typedef struct _OB_PRE_DUPLICATE_HANDLE_INFORMATION
{
1392 ACCESS_MASK DesiredAccess
;
1393 ACCESS_MASK OriginalDesiredAccess
;
1394 PVOID SourceProcess
;
1395 PVOID TargetProcess
;
1396 } OB_PRE_DUPLICATE_HANDLE_INFORMATION
, *POB_PRE_DUPLICATE_HANDLE_INFORMATION
;
1398 typedef union _OB_PRE_OPERATION_PARAMETERS
{
1399 OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1400 OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1401 } OB_PRE_OPERATION_PARAMETERS
, *POB_PRE_OPERATION_PARAMETERS
;
1403 typedef struct _OB_PRE_OPERATION_INFORMATION
{
1404 OB_OPERATION Operation
;
1408 ULONG KernelHandle
:1;
1413 POBJECT_TYPE ObjectType
;
1415 POB_PRE_OPERATION_PARAMETERS Parameters
;
1416 } OB_PRE_OPERATION_INFORMATION
, *POB_PRE_OPERATION_INFORMATION
;
1418 typedef struct _OB_POST_CREATE_HANDLE_INFORMATION
{
1419 ACCESS_MASK GrantedAccess
;
1420 } OB_POST_CREATE_HANDLE_INFORMATION
, *POB_POST_CREATE_HANDLE_INFORMATION
;
1422 typedef struct _OB_POST_DUPLICATE_HANDLE_INFORMATION
{
1423 ACCESS_MASK GrantedAccess
;
1424 } OB_POST_DUPLICATE_HANDLE_INFORMATION
, *POB_POST_DUPLICATE_HANDLE_INFORMATION
;
1426 typedef union _OB_POST_OPERATION_PARAMETERS
{
1427 OB_POST_CREATE_HANDLE_INFORMATION CreateHandleInformation
;
1428 OB_POST_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation
;
1429 } OB_POST_OPERATION_PARAMETERS
, *POB_POST_OPERATION_PARAMETERS
;
1431 typedef struct _OB_POST_OPERATION_INFORMATION
{
1432 OB_OPERATION Operation
;
1436 ULONG KernelHandle
:1;
1441 POBJECT_TYPE ObjectType
;
1443 NTSTATUS ReturnStatus
;
1444 POB_POST_OPERATION_PARAMETERS Parameters
;
1445 } OB_POST_OPERATION_INFORMATION
,*POB_POST_OPERATION_INFORMATION
;
1447 typedef enum _OB_PREOP_CALLBACK_STATUS
{
1449 } OB_PREOP_CALLBACK_STATUS
, *POB_PREOP_CALLBACK_STATUS
;
1451 typedef OB_PREOP_CALLBACK_STATUS (WINAPI
*POB_PRE_OPERATION_CALLBACK
)(void *context
, POB_PRE_OPERATION_INFORMATION information
);
1452 typedef void (WINAPI
*POB_POST_OPERATION_CALLBACK
)(void *context
, POB_POST_OPERATION_INFORMATION information
);
1454 typedef struct _OB_OPERATION_REGISTRATION
{
1455 POBJECT_TYPE
*ObjectType
;
1456 OB_OPERATION Operations
;
1457 POB_PRE_OPERATION_CALLBACK PreOperation
;
1458 POB_POST_OPERATION_CALLBACK PostOperation
;
1459 } OB_OPERATION_REGISTRATION
, *POB_OPERATION_REGISTRATION
;
1461 typedef struct _OB_CALLBACK_REGISTRATION
{
1463 USHORT OperationRegistrationCount
;
1464 UNICODE_STRING Altitude
;
1465 PVOID RegistrationContext
;
1466 OB_OPERATION_REGISTRATION
*OperationRegistration
;
1467 } OB_CALLBACK_REGISTRATION
, *POB_CALLBACK_REGISTRATION
;
1469 #define OB_FLT_REGISTRATION_VERSION_0100 0x0100
1470 #define OB_FLT_REGISTRATION_VERSION OB_FLT_REGISTRATION_VERSION_0100
1472 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS
{
1473 DirectoryNotifyInformation
= 1,
1474 DirectoryNotifyExtendedInformation
1475 } DIRECTORY_NOTIFY_INFORMATION_CLASS
, *PDIRECTORY_NOTIFY_INFORMATION_CLASS
;
1477 typedef enum _WORK_QUEUE_TYPE
{
1480 HyperCriticalWorkQueue
,
1484 typedef void (WINAPI
*PIO_WORKITEM_ROUTINE
)(PDEVICE_OBJECT
,void*);
1486 NTSTATUS WINAPI
ObCloseHandle(IN HANDLE handle
);
1488 #ifdef NONAMELESSUNION
1489 # ifdef NONAMELESSSTRUCT
1490 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1491 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1492 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1494 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1495 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1496 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.u2
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1499 # ifdef NONAMELESSSTRUCT
1500 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1501 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1502 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.s
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1504 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1505 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1506 static inline void IoSkipCurrentIrpStackLocation(IRP
*irp
) {irp
->Tail
.Overlay
.CurrentStackLocation
++; irp
->CurrentLocation
++;}
1510 #define IoSetCancelRoutine(irp, routine) \
1511 ((PDRIVER_CANCEL)InterlockedExchangePointer((void **)&(irp)->CancelRoutine, routine))
1513 static inline void IoSetCompletionRoutine(IRP
*irp
, PIO_COMPLETION_ROUTINE routine
, void *context
,
1514 BOOLEAN on_success
, BOOLEAN on_error
, BOOLEAN on_cancel
)
1516 IO_STACK_LOCATION
*irpsp
= IoGetNextIrpStackLocation(irp
);
1517 irpsp
->CompletionRoutine
= routine
;
1518 irpsp
->Context
= context
;
1520 if (on_success
) irpsp
->Control
|= SL_INVOKE_ON_SUCCESS
;
1521 if (on_error
) irpsp
->Control
|= SL_INVOKE_ON_ERROR
;
1522 if (on_cancel
) irpsp
->Control
|= SL_INVOKE_ON_CANCEL
;
1525 static inline void IoMarkIrpPending(IRP
*irp
)
1527 IoGetCurrentIrpStackLocation(irp
)->Control
|= SL_PENDING_RETURNED
;
1530 #define KernelMode 0
1533 /* directory object access rights */
1534 #define DIRECTORY_QUERY 0x0001
1535 #define DIRECTORY_TRAVERSE 0x0002
1536 #define DIRECTORY_CREATE_OBJECT 0x0004
1537 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1538 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1540 /* symbolic link access rights */
1541 #define SYMBOLIC_LINK_QUERY 0x0001
1542 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1544 NTSTATUS WINAPI
DbgQueryDebugFilterState(ULONG
, ULONG
);
1545 void FASTCALL
ExAcquireFastMutexUnsafe(PFAST_MUTEX
);
1546 BOOLEAN WINAPI
ExAcquireResourceExclusiveLite(ERESOURCE
*,BOOLEAN
);
1547 BOOLEAN WINAPI
ExAcquireResourceSharedLite(ERESOURCE
*,BOOLEAN
);
1548 BOOLEAN WINAPI
ExAcquireSharedStarveExclusive(ERESOURCE
*,BOOLEAN
);
1549 BOOLEAN WINAPI
ExAcquireSharedWaitForExclusive(ERESOURCE
*,BOOLEAN
);
1550 PVOID WINAPI
ExAllocatePool(POOL_TYPE
,SIZE_T
);
1551 PVOID WINAPI
ExAllocatePoolWithQuota(POOL_TYPE
,SIZE_T
);
1552 PVOID WINAPI
ExAllocatePoolWithTag(POOL_TYPE
,SIZE_T
,ULONG
);
1553 PVOID WINAPI
ExAllocatePoolWithQuotaTag(POOL_TYPE
,SIZE_T
,ULONG
);
1554 void WINAPI
ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
);
1555 void WINAPI
ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST
);
1556 NTSTATUS WINAPI
ExDeleteResourceLite(ERESOURCE
*);
1557 void WINAPI
ExFreePool(PVOID
);
1558 void WINAPI
ExFreePoolWithTag(PVOID
,ULONG
);
1559 ULONG WINAPI
ExGetExclusiveWaiterCount(ERESOURCE
*);
1560 ULONG WINAPI
ExGetSharedWaiterCount(ERESOURCE
*);
1561 void WINAPI
ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1562 void WINAPI
ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST
,PALLOCATE_FUNCTION
,PFREE_FUNCTION
,ULONG
,SIZE_T
,ULONG
,USHORT
);
1563 NTSTATUS WINAPI
ExInitializeResourceLite(ERESOURCE
*);
1564 PSLIST_ENTRY WINAPI
ExInterlockedFlushSList(PSLIST_HEADER
);
1565 PSLIST_ENTRY WINAPI
ExInterlockedPopEntrySList(PSLIST_HEADER
,PKSPIN_LOCK
);
1566 PSLIST_ENTRY WINAPI
ExInterlockedPushEntrySList(PSLIST_HEADER
,PSLIST_ENTRY
,PKSPIN_LOCK
);
1567 LIST_ENTRY
* WINAPI
ExInterlockedRemoveHeadList(LIST_ENTRY
*,KSPIN_LOCK
*);
1568 BOOLEAN WINAPI
ExIsResourceAcquiredExclusiveLite(ERESOURCE
*);
1569 ULONG WINAPI
ExIsResourceAcquiredSharedLite(ERESOURCE
*);
1570 void FASTCALL
ExReleaseFastMutexUnsafe(PFAST_MUTEX
);
1571 void WINAPI
ExReleaseResourceForThreadLite(ERESOURCE
*,ERESOURCE_THREAD
);
1572 ULONG WINAPI
ExSetTimerResolution(ULONG
,BOOLEAN
);
1574 void WINAPI
IoAcquireCancelSpinLock(KIRQL
*);
1575 NTSTATUS WINAPI
IoAcquireRemoveLockEx(IO_REMOVE_LOCK
*,void*,const char*,ULONG
, ULONG
);
1576 NTSTATUS WINAPI
IoAllocateDriverObjectExtension(PDRIVER_OBJECT
,PVOID
,ULONG
,PVOID
*);
1577 PVOID WINAPI
IoAllocateErrorLogEntry(PVOID
,UCHAR
);
1578 PIRP WINAPI
IoAllocateIrp(CCHAR
,BOOLEAN
);
1579 PMDL WINAPI
IoAllocateMdl(PVOID
,ULONG
,BOOLEAN
,BOOLEAN
,IRP
*);
1580 PIO_WORKITEM WINAPI
IoAllocateWorkItem(PDEVICE_OBJECT
);
1581 void WINAPI
IoDetachDevice(PDEVICE_OBJECT
);
1582 PDEVICE_OBJECT WINAPI
IoAttachDeviceToDeviceStack(PDEVICE_OBJECT
,PDEVICE_OBJECT
);
1583 PIRP WINAPI
IoBuildAsynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,void*,ULONG
,LARGE_INTEGER
*,IO_STATUS_BLOCK
*);
1584 PIRP WINAPI
IoBuildDeviceIoControlRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PVOID
,ULONG
,BOOLEAN
,PKEVENT
,IO_STATUS_BLOCK
*);
1585 PIRP WINAPI
IoBuildSynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PLARGE_INTEGER
,PKEVENT
,IO_STATUS_BLOCK
*);
1586 NTSTATUS WINAPI
IoCallDriver(DEVICE_OBJECT
*,IRP
*);
1587 BOOLEAN WINAPI
IoCancelIrp(IRP
*);
1588 VOID WINAPI
IoCompleteRequest(IRP
*,UCHAR
);
1589 NTSTATUS WINAPI
IoCreateDevice(DRIVER_OBJECT
*,ULONG
,UNICODE_STRING
*,DEVICE_TYPE
,ULONG
,BOOLEAN
,DEVICE_OBJECT
**);
1590 NTSTATUS WINAPI
IoCreateDriver(UNICODE_STRING
*,PDRIVER_INITIALIZE
);
1591 NTSTATUS WINAPI
IoCreateSymbolicLink(UNICODE_STRING
*,UNICODE_STRING
*);
1592 PKEVENT WINAPI
IoCreateSynchronizationEvent(UNICODE_STRING
*,HANDLE
*);
1593 void WINAPI
IoDeleteDevice(DEVICE_OBJECT
*);
1594 void WINAPI
IoDeleteDriver(DRIVER_OBJECT
*);
1595 NTSTATUS WINAPI
IoDeleteSymbolicLink(UNICODE_STRING
*);
1596 void WINAPI
IoFreeIrp(IRP
*);
1597 void WINAPI
IoFreeMdl(MDL
*);
1598 void WINAPI
IoFreeWorkItem(PIO_WORKITEM
);
1599 DEVICE_OBJECT
* WINAPI
IoGetAttachedDeviceReference(DEVICE_OBJECT
*);
1600 PEPROCESS WINAPI
IoGetCurrentProcess(void);
1601 NTSTATUS WINAPI
IoGetDeviceInterfaces(const GUID
*,PDEVICE_OBJECT
,ULONG
,PWSTR
*);
1602 NTSTATUS WINAPI
IoGetDeviceObjectPointer(UNICODE_STRING
*,ACCESS_MASK
,PFILE_OBJECT
*,PDEVICE_OBJECT
*);
1603 NTSTATUS WINAPI
IoGetDeviceProperty(PDEVICE_OBJECT
,DEVICE_REGISTRY_PROPERTY
,ULONG
,PVOID
,PULONG
);
1604 PVOID WINAPI
IoGetDriverObjectExtension(PDRIVER_OBJECT
,PVOID
);
1605 PDEVICE_OBJECT WINAPI
IoGetRelatedDeviceObject(PFILE_OBJECT
);
1606 void WINAPI
IoGetStackLimits(ULONG_PTR
*,ULONG_PTR
*);
1607 void WINAPI
IoInitializeIrp(IRP
*,USHORT
,CCHAR
);
1608 VOID WINAPI
IoInitializeRemoveLockEx(PIO_REMOVE_LOCK
,ULONG
,ULONG
,ULONG
,ULONG
);
1609 void WINAPI
IoInvalidateDeviceRelations(PDEVICE_OBJECT
,DEVICE_RELATION_TYPE
);
1610 NTSTATUS WINAPI
IoOpenDeviceRegistryKey(DEVICE_OBJECT
*,ULONG
,ACCESS_MASK
,HANDLE
*);
1611 void WINAPI
IoQueueWorkItem(PIO_WORKITEM
,PIO_WORKITEM_ROUTINE
,WORK_QUEUE_TYPE
,void*);
1612 NTSTATUS WINAPI
IoRegisterDeviceInterface(PDEVICE_OBJECT
,const GUID
*,PUNICODE_STRING
,PUNICODE_STRING
);
1613 void WINAPI
IoReleaseCancelSpinLock(KIRQL
);
1614 void WINAPI
IoReleaseRemoveLockAndWaitEx(IO_REMOVE_LOCK
*,void*,ULONG
);
1615 void WINAPI
IoReleaseRemoveLockEx(IO_REMOVE_LOCK
*,void*,ULONG
);
1616 NTSTATUS WINAPI
IoSetDeviceInterfaceState(UNICODE_STRING
*,BOOLEAN
);
1617 NTSTATUS WINAPI
IoWMIRegistrationControl(PDEVICE_OBJECT
,ULONG
);
1619 void FASTCALL
KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK
*,KLOCK_QUEUE_HANDLE
*);
1621 void WINAPI
KeAcquireSpinLock(KSPIN_LOCK
*,KIRQL
*);
1623 #define KeAcquireSpinLock( lock, irql ) *(irql) = KeAcquireSpinLockRaiseToDpc( lock )
1624 KIRQL WINAPI
KeAcquireSpinLockRaiseToDpc(KSPIN_LOCK
*);
1626 void WINAPI
KeAcquireSpinLockAtDpcLevel(KSPIN_LOCK
*);
1627 void WINAPI DECLSPEC_NORETURN
KeBugCheckEx(ULONG
,ULONG_PTR
,ULONG_PTR
,ULONG_PTR
,ULONG_PTR
);
1628 BOOLEAN WINAPI
KeCancelTimer(KTIMER
*);
1629 void WINAPI
KeClearEvent(PRKEVENT
);
1630 NTSTATUS WINAPI
KeDelayExecutionThread(KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1631 void WINAPI
KeEnterCriticalRegion(void);
1632 PKTHREAD WINAPI
KeGetCurrentThread(void);
1633 void WINAPI
KeInitializeEvent(PRKEVENT
,EVENT_TYPE
,BOOLEAN
);
1634 void WINAPI
KeInitializeMutex(PRKMUTEX
,ULONG
);
1635 void WINAPI
KeInitializeSemaphore(PRKSEMAPHORE
,LONG
,LONG
);
1636 void WINAPI
KeInitializeSpinLock(KSPIN_LOCK
*);
1637 void WINAPI
KeInitializeTimerEx(PKTIMER
,TIMER_TYPE
);
1638 void WINAPI
KeInitializeTimer(KTIMER
*);
1639 void WINAPI
KeLeaveCriticalRegion(void);
1640 void WINAPI
KeQuerySystemTime(LARGE_INTEGER
*);
1641 void WINAPI
KeQueryTickCount(LARGE_INTEGER
*);
1642 ULONG WINAPI
KeQueryTimeIncrement(void);
1643 void FASTCALL
KeReleaseInStackQueuedSpinLockFromDpcLevel(KLOCK_QUEUE_HANDLE
*);
1644 LONG WINAPI
KeReleaseMutex(PRKMUTEX
,BOOLEAN
);
1645 LONG WINAPI
KeReleaseSemaphore(PRKSEMAPHORE
,KPRIORITY
,LONG
,BOOLEAN
);
1646 void WINAPI
KeReleaseSpinLock(KSPIN_LOCK
*,KIRQL
);
1647 void WINAPI
KeReleaseSpinLockFromDpcLevel(KSPIN_LOCK
*);
1648 LONG WINAPI
KeResetEvent(PRKEVENT
);
1649 void WINAPI
KeRevertToUserAffinityThread(void);
1650 LONG WINAPI
KeSetEvent(PRKEVENT
,KPRIORITY
,BOOLEAN
);
1651 KPRIORITY WINAPI
KeSetPriorityThread(PKTHREAD
,KPRIORITY
);
1652 void WINAPI
KeSetSystemAffinityThread(KAFFINITY
);
1653 BOOLEAN WINAPI
KeSetTimerEx(KTIMER
*,LARGE_INTEGER
,LONG
,KDPC
*);
1654 NTSTATUS WINAPI
KeWaitForMultipleObjects(ULONG
,void*[],WAIT_TYPE
,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*,KWAIT_BLOCK
*);
1655 NTSTATUS WINAPI
KeWaitForSingleObject(void*,KWAIT_REASON
,KPROCESSOR_MODE
,BOOLEAN
,LARGE_INTEGER
*);
1657 PVOID WINAPI
MmAllocateContiguousMemory(SIZE_T
,PHYSICAL_ADDRESS
);
1658 PVOID WINAPI
MmAllocateNonCachedMemory(SIZE_T
);
1659 PMDL WINAPI
MmAllocatePagesForMdl(PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,SIZE_T
);
1660 void WINAPI
MmBuildMdlForNonPagedPool(MDL
*);
1661 void WINAPI
MmFreeNonCachedMemory(PVOID
,SIZE_T
);
1662 void * WINAPI
MmGetSystemRoutineAddress(UNICODE_STRING
*);
1663 PVOID WINAPI
MmMapLockedPagesSpecifyCache(PMDL
,KPROCESSOR_MODE
,MEMORY_CACHING_TYPE
,PVOID
,ULONG
,ULONG
);
1664 MM_SYSTEMSIZE WINAPI
MmQuerySystemSize(void);
1665 void WINAPI
MmProbeAndLockPages(PMDLX
, KPROCESSOR_MODE
, LOCK_OPERATION
);
1666 void WINAPI
MmUnmapLockedPages(void*, PMDL
);
1668 static inline void *MmGetSystemAddressForMdlSafe(MDL
*mdl
, ULONG priority
)
1670 if (mdl
->MdlFlags
& (MDL_MAPPED_TO_SYSTEM_VA
| MDL_SOURCE_IS_NONPAGED_POOL
))
1671 return mdl
->MappedSystemVa
;
1673 return MmMapLockedPagesSpecifyCache(mdl
, KernelMode
, MmCached
, NULL
, FALSE
, priority
);
1676 void FASTCALL
ObfReferenceObject(void*);
1677 void WINAPI
ObDereferenceObject(void*);
1678 USHORT WINAPI
ObGetFilterVersion(void);
1679 NTSTATUS WINAPI
ObRegisterCallbacks(POB_CALLBACK_REGISTRATION
*, void**);
1680 NTSTATUS WINAPI
ObReferenceObjectByHandle(HANDLE
,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,PVOID
*,POBJECT_HANDLE_INFORMATION
);
1681 NTSTATUS WINAPI
ObReferenceObjectByName(UNICODE_STRING
*,ULONG
,ACCESS_STATE
*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,void*,void**);
1682 NTSTATUS WINAPI
ObReferenceObjectByPointer(void*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
);
1683 void WINAPI
ObUnRegisterCallbacks(void*);
1685 NTSTATUS WINAPI
PoCallDriver(DEVICE_OBJECT
*,IRP
*);
1686 POWER_STATE WINAPI
PoSetPowerState(PDEVICE_OBJECT
,POWER_STATE_TYPE
,POWER_STATE
);
1687 void WINAPI
PoStartNextPowerIrp(IRP
*);
1689 NTSTATUS WINAPI
PsCreateSystemThread(PHANDLE
,ULONG
,POBJECT_ATTRIBUTES
,HANDLE
,PCLIENT_ID
,PKSTART_ROUTINE
,PVOID
);
1690 #define PsGetCurrentProcess() IoGetCurrentProcess()
1691 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1692 HANDLE WINAPI
PsGetCurrentProcessId(void);
1693 HANDLE WINAPI
PsGetCurrentThreadId(void);
1694 HANDLE WINAPI
PsGetProcessInheritedFromUniqueProcessId(PEPROCESS
);
1695 BOOLEAN WINAPI
PsGetVersion(ULONG
*,ULONG
*,ULONG
*,UNICODE_STRING
*);
1696 NTSTATUS WINAPI
PsTerminateSystemThread(NTSTATUS
);
1698 BOOLEAN WINAPI
RtlIsNtDdiVersionAvailable(ULONG
);
1700 NTSTATUS WINAPI
ZwAddBootEntry(PUNICODE_STRING
,PUNICODE_STRING
);
1701 NTSTATUS WINAPI
ZwAccessCheckAndAuditAlarm(PUNICODE_STRING
,HANDLE
,PUNICODE_STRING
,PUNICODE_STRING
,PSECURITY_DESCRIPTOR
,ACCESS_MASK
,PGENERIC_MAPPING
,BOOLEAN
,PACCESS_MASK
,PBOOLEAN
,PBOOLEAN
);
1702 NTSTATUS WINAPI
ZwAdjustPrivilegesToken(HANDLE
,BOOLEAN
,PTOKEN_PRIVILEGES
,DWORD
,PTOKEN_PRIVILEGES
,PDWORD
);
1703 NTSTATUS WINAPI
ZwAlertThread(HANDLE ThreadHandle
);
1704 NTSTATUS WINAPI
ZwAllocateVirtualMemory(HANDLE
,PVOID
*,ULONG
,SIZE_T
*,ULONG
,ULONG
);
1705 NTSTATUS WINAPI
ZwCancelIoFile(HANDLE
,PIO_STATUS_BLOCK
);
1706 NTSTATUS WINAPI
ZwCancelTimer(HANDLE
, BOOLEAN
*);
1707 NTSTATUS WINAPI
ZwClearEvent(HANDLE
);
1708 NTSTATUS WINAPI
ZwClose(HANDLE
);
1709 NTSTATUS WINAPI
ZwCloseObjectAuditAlarm(PUNICODE_STRING
,HANDLE
,BOOLEAN
);
1710 NTSTATUS WINAPI
ZwConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1711 NTSTATUS WINAPI
ZwCreateDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1712 NTSTATUS WINAPI
ZwCreateEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,BOOLEAN
,BOOLEAN
);
1713 NTSTATUS WINAPI
ZwCreateFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,PLARGE_INTEGER
,ULONG
,ULONG
,ULONG
,ULONG
,PVOID
,ULONG
);
1714 NTSTATUS WINAPI
ZwCreateKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,const UNICODE_STRING
*,ULONG
,PULONG
);
1715 NTSTATUS WINAPI
ZwCreateSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const LARGE_INTEGER
*,ULONG
,ULONG
,HANDLE
);
1716 NTSTATUS WINAPI
ZwCreateSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PUNICODE_STRING
);
1717 NTSTATUS WINAPI
ZwCreateTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*, TIMER_TYPE
);
1718 NTSTATUS WINAPI
ZwDeleteAtom(RTL_ATOM
);
1719 NTSTATUS WINAPI
ZwDeleteFile(POBJECT_ATTRIBUTES
);
1720 NTSTATUS WINAPI
ZwDeleteKey(HANDLE
);
1721 NTSTATUS WINAPI
ZwDeleteValueKey(HANDLE
,const UNICODE_STRING
*);
1722 NTSTATUS WINAPI
ZwDeviceIoControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1723 NTSTATUS WINAPI
ZwDisplayString(PUNICODE_STRING
);
1724 NTSTATUS WINAPI
ZwDuplicateObject(HANDLE
,HANDLE
,HANDLE
,PHANDLE
,ACCESS_MASK
,ULONG
,ULONG
);
1725 NTSTATUS WINAPI
ZwDuplicateToken(HANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,SECURITY_IMPERSONATION_LEVEL
,TOKEN_TYPE
,PHANDLE
);
1726 NTSTATUS WINAPI
ZwEnumerateKey(HANDLE
,ULONG
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1727 NTSTATUS WINAPI
ZwEnumerateValueKey(HANDLE
,ULONG
,KEY_VALUE_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1728 NTSTATUS WINAPI
ZwFlushInstructionCache(HANDLE
,LPCVOID
,SIZE_T
);
1729 NTSTATUS WINAPI
ZwFlushKey(HANDLE
);
1730 NTSTATUS WINAPI
ZwFlushVirtualMemory(HANDLE
,LPCVOID
*,SIZE_T
*,ULONG
);
1731 NTSTATUS WINAPI
ZwFreeVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1732 NTSTATUS WINAPI
ZwFsControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1733 NTSTATUS WINAPI
ZwInitiatePowerAction(POWER_ACTION
,SYSTEM_POWER_STATE
,ULONG
,BOOLEAN
);
1734 NTSTATUS WINAPI
ZwLoadDriver(const UNICODE_STRING
*);
1735 NTSTATUS WINAPI
ZwLoadKey(const OBJECT_ATTRIBUTES
*,OBJECT_ATTRIBUTES
*);
1736 NTSTATUS WINAPI
ZwLockVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1737 NTSTATUS WINAPI
ZwMakeTemporaryObject(HANDLE
);
1738 NTSTATUS WINAPI
ZwMapViewOfSection(HANDLE
,HANDLE
,PVOID
*,ULONG
,SIZE_T
,const LARGE_INTEGER
*,SIZE_T
*,SECTION_INHERIT
,ULONG
,ULONG
);
1739 NTSTATUS WINAPI
ZwNotifyChangeKey(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,BOOLEAN
,PVOID
,ULONG
,BOOLEAN
);
1740 NTSTATUS WINAPI
ZwOpenDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1741 NTSTATUS WINAPI
ZwOpenEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1742 NTSTATUS WINAPI
ZwOpenFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,ULONG
,ULONG
);
1743 NTSTATUS WINAPI
ZwOpenKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1744 NTSTATUS WINAPI
ZwOpenProcess(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1745 NTSTATUS WINAPI
ZwOpenProcessToken(HANDLE
,DWORD
,HANDLE
*);
1746 NTSTATUS WINAPI
ZwOpenSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1747 NTSTATUS WINAPI
ZwOpenSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1748 NTSTATUS WINAPI
ZwOpenThread(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1749 NTSTATUS WINAPI
ZwOpenThreadToken(HANDLE
,DWORD
,BOOLEAN
,HANDLE
*);
1750 NTSTATUS WINAPI
ZwOpenTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*);
1751 NTSTATUS WINAPI
ZwPowerInformation(POWER_INFORMATION_LEVEL
,PVOID
,ULONG
,PVOID
,ULONG
);
1752 NTSTATUS WINAPI
ZwPulseEvent(HANDLE
,PULONG
);
1753 NTSTATUS WINAPI
ZwQueryDefaultLocale(BOOLEAN
,LCID
*);
1754 NTSTATUS WINAPI
ZwQueryDefaultUILanguage(LANGID
*);
1755 NTSTATUS WINAPI
ZwQueryDirectoryFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
,BOOLEAN
,PUNICODE_STRING
,BOOLEAN
);
1756 NTSTATUS WINAPI
ZwQueryDirectoryObject(HANDLE
,PDIRECTORY_BASIC_INFORMATION
,ULONG
,BOOLEAN
,BOOLEAN
,PULONG
,PULONG
);
1757 NTSTATUS WINAPI
ZwQueryEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,BOOLEAN
,PVOID
,ULONG
,PVOID
,BOOLEAN
);
1758 NTSTATUS WINAPI
ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES
*,FILE_NETWORK_OPEN_INFORMATION
*);
1759 NTSTATUS WINAPI
ZwQueryInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,LONG
,FILE_INFORMATION_CLASS
);
1760 NTSTATUS WINAPI
ZwQueryInformationThread(HANDLE
,THREADINFOCLASS
,PVOID
,ULONG
,PULONG
);
1761 NTSTATUS WINAPI
ZwQueryInformationToken(HANDLE
,DWORD
,PVOID
,DWORD
,LPDWORD
);
1762 NTSTATUS WINAPI
ZwQueryInstallUILanguage(LANGID
*);
1763 NTSTATUS WINAPI
ZwQueryKey(HANDLE
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1764 NTSTATUS WINAPI
ZwQueryObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
, PULONG
);
1765 NTSTATUS WINAPI
ZwQuerySecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
,ULONG
,PULONG
);
1766 NTSTATUS WINAPI
ZwQuerySection(HANDLE
,SECTION_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1767 NTSTATUS WINAPI
ZwQuerySymbolicLinkObject(HANDLE
,PUNICODE_STRING
,PULONG
);
1768 NTSTATUS WINAPI
ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1769 NTSTATUS WINAPI
ZwQueryTimerResolution(PULONG
,PULONG
,PULONG
);
1770 NTSTATUS WINAPI
ZwQueryValueKey(HANDLE
,const UNICODE_STRING
*,KEY_VALUE_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1771 NTSTATUS WINAPI
ZwQueryVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1772 NTSTATUS WINAPI
ZwReadFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,PLARGE_INTEGER
,PULONG
);
1773 NTSTATUS WINAPI
ZwReplaceKey(POBJECT_ATTRIBUTES
,HANDLE
,POBJECT_ATTRIBUTES
);
1774 NTSTATUS WINAPI
ZwRequestWaitReplyPort(HANDLE
,PLPC_MESSAGE
,PLPC_MESSAGE
);
1775 NTSTATUS WINAPI
ZwResetEvent(HANDLE
,PULONG
);
1776 NTSTATUS WINAPI
ZwRestoreKey(HANDLE
,HANDLE
,ULONG
);
1777 NTSTATUS WINAPI
ZwSaveKey(HANDLE
,HANDLE
);
1778 NTSTATUS WINAPI
ZwSecureConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PSID
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1779 NTSTATUS WINAPI
ZwSetDefaultLocale(BOOLEAN
,LCID
);
1780 NTSTATUS WINAPI
ZwSetDefaultUILanguage(LANGID
);
1781 NTSTATUS WINAPI
ZwSetEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
);
1782 NTSTATUS WINAPI
ZwSetEvent(HANDLE
,PULONG
);
1783 NTSTATUS WINAPI
ZwSetInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
);
1784 NTSTATUS WINAPI
ZwSetInformationKey(HANDLE
,const int,PVOID
,ULONG
);
1785 NTSTATUS WINAPI
ZwSetInformationObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
);
1786 NTSTATUS WINAPI
ZwSetInformationProcess(HANDLE
,PROCESS_INFORMATION_CLASS
,PVOID
,ULONG
);
1787 NTSTATUS WINAPI
ZwSetInformationThread(HANDLE
,THREADINFOCLASS
,LPCVOID
,ULONG
);
1788 NTSTATUS WINAPI
ZwSetIoCompletion(HANDLE
,ULONG
,ULONG
,NTSTATUS
,ULONG
);
1789 NTSTATUS WINAPI
ZwSetLdtEntries(ULONG
,ULONG
,ULONG
,ULONG
,ULONG
,ULONG
);
1790 NTSTATUS WINAPI
ZwSetSecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
);
1791 NTSTATUS WINAPI
ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
);
1792 NTSTATUS WINAPI
ZwSetSystemTime(const LARGE_INTEGER
*,LARGE_INTEGER
*);
1793 NTSTATUS WINAPI
ZwSetTimer(HANDLE
, const LARGE_INTEGER
*, PTIMER_APC_ROUTINE
, PVOID
, BOOLEAN
, ULONG
, BOOLEAN
*);
1794 NTSTATUS WINAPI
ZwSetValueKey(HANDLE
,const UNICODE_STRING
*,ULONG
,ULONG
,const void *,ULONG
);
1795 NTSTATUS WINAPI
ZwSetVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1796 NTSTATUS WINAPI
ZwSuspendThread(HANDLE
,PULONG
);
1797 NTSTATUS WINAPI
ZwTerminateProcess(HANDLE
,LONG
);
1798 NTSTATUS WINAPI
ZwUnloadDriver(const UNICODE_STRING
*);
1799 NTSTATUS WINAPI
ZwUnloadKey(HANDLE
);
1800 NTSTATUS WINAPI
ZwUnmapViewOfSection(HANDLE
,PVOID
);
1801 NTSTATUS WINAPI
ZwWaitForSingleObject(HANDLE
,BOOLEAN
,const LARGE_INTEGER
*);
1802 NTSTATUS WINAPI
ZwWaitForMultipleObjects(ULONG
,const HANDLE
*,BOOLEAN
,BOOLEAN
,const LARGE_INTEGER
*);
1803 NTSTATUS WINAPI
ZwWriteFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,const void*,ULONG
,PLARGE_INTEGER
,PULONG
);
1804 NTSTATUS WINAPI
ZwYieldExecution(void);
1806 static inline void ExInitializeFastMutex( FAST_MUTEX
*mutex
)
1808 mutex
->Count
= FM_LOCK_BIT
;
1809 mutex
->Owner
= NULL
;
1810 mutex
->Contention
= 0;
1811 KeInitializeEvent( &mutex
->Event
, SynchronizationEvent
, FALSE
);