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 typedef LONG KPRIORITY
;
33 typedef ULONG_PTR KSPIN_LOCK
, *PKSPIN_LOCK
;
35 typedef ULONG_PTR ERESOURCE_THREAD
;
36 typedef ERESOURCE_THREAD
*PERESOURCE_THREAD
;
41 struct _DEVICE_OBJECT
;
42 struct _DRIVER_OBJECT
;
44 typedef VOID (WINAPI
*PKDEFERRED_ROUTINE
)(struct _KDPC
*, PVOID
, PVOID
, PVOID
);
45 typedef VOID (WINAPI
*PKSTART_ROUTINE
)(PVOID
);
47 typedef NTSTATUS (WINAPI
*PDRIVER_INITIALIZE
)(struct _DRIVER_OBJECT
*, PUNICODE_STRING
);
48 typedef NTSTATUS (WINAPI
*PDRIVER_DISPATCH
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
49 typedef void (WINAPI
*PDRIVER_STARTIO
)(struct _DEVICE_OBJECT
*, struct _IRP
*);
50 typedef void (WINAPI
*PDRIVER_UNLOAD
)(struct _DRIVER_OBJECT
*);
51 typedef NTSTATUS (WINAPI
*PDRIVER_ADD_DEVICE
)(struct _DRIVER_OBJECT
*, struct _DEVICE_OBJECT
*);
53 typedef struct _DISPATCHER_HEADER
{
59 LIST_ENTRY WaitListHead
;
60 } DISPATCHER_HEADER
, *PDISPATCHER_HEADER
;
62 typedef struct _KEVENT
{
63 DISPATCHER_HEADER Header
;
64 } KEVENT
, *PKEVENT
, *RESTRICTED_POINTER PRKEVENT
;
66 typedef struct _KSEMAPHORE
{
67 DISPATCHER_HEADER Header
;
69 } KSEMAPHORE
, *PKSEMAPHORE
, *PRKSEMAPHORE
;
71 typedef struct _KDPC
{
75 LIST_ENTRY DpcListEntry
;
76 PKDEFERRED_ROUTINE DeferredRoutine
;
77 PVOID DeferredContext
;
78 PVOID SystemArgument1
;
79 PVOID SystemArgument2
;
81 } KDPC
, *PKDPC
, *RESTRICTED_POINTER PRKDPC
;
83 typedef struct _KDEVICE_QUEUE_ENTRY
{
84 LIST_ENTRY DeviceListEntry
;
87 } KDEVICE_QUEUE_ENTRY
, *PKDEVICE_QUEUE_ENTRY
,
88 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY
;
90 typedef struct _KDEVICE_QUEUE
{
93 LIST_ENTRY DeviceListHead
;
96 } KDEVICE_QUEUE
, *PKDEVICE_QUEUE
, *RESTRICTED_POINTER PRKDEVICE_QUEUE
;
98 typedef struct _KMUTANT
{
99 DISPATCHER_HEADER Header
;
100 LIST_ENTRY MutantListEntry
;
101 struct _KTHREAD
*RESTRICTED_POINTER OwnerThread
;
104 } KMUTANT
, *PKMUTANT
, *RESTRICTED_POINTER PRKMUTANT
, KMUTEX
, *PKMUTEX
, *RESTRICTED_POINTER PRKMUTEX
;
106 typedef enum _KWAIT_REASON
136 typedef struct _ALLOCATE_FUNCTION
*PALLOCATE_FUNCTION
;
137 typedef struct _IO_TIMER
*PIO_TIMER
;
138 typedef struct _IO_TIMER_ROUTINE
*PIO_TIMER_ROUTINE
;
139 typedef struct _ETHREAD
*PETHREAD
;
140 typedef struct _FREE_FUNCTION
*PFREE_FUNCTION
;
141 typedef struct _KTHREAD
*PKTHREAD
, *PRKTHREAD
;
142 typedef struct _EPROCESS
*PEPROCESS
;
143 typedef struct _ERESOURCE
*PERESOURCE
;
144 typedef struct _IO_WORKITEM
*PIO_WORKITEM
;
145 typedef struct _NPAGED_LOOKASIDE_LIST
*PNPAGED_LOOKASIDE_LIST
;
146 typedef struct _PAGED_LOOKASIDE_LIST
*PPAGED_LOOKASIDE_LIST
;
147 typedef struct _OBJECT_TYPE
*POBJECT_TYPE
;
148 typedef struct _OBJECT_HANDLE_INFORMATION
*POBJECT_HANDLE_INFORMATION
;
149 typedef struct _ZONE_HEADER
*PZONE_HEADER
;
151 typedef struct _FAST_MUTEX
158 } FAST_MUTEX
, *PFAST_MUTEX
;
160 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
162 typedef struct _VPB
{
166 USHORT VolumeLabelLength
;
167 struct _DEVICE_OBJECT
*DeviceObject
;
168 struct _DEVICE_OBJECT
*RealDevice
;
170 ULONG ReferenceCount
;
171 WCHAR VolumeLabel
[MAXIMUM_VOLUME_LABEL_LENGTH
/ sizeof(WCHAR
)];
174 typedef enum _POOL_TYPE
{
177 NonPagedPoolMustSucceed
,
179 NonPagedPoolCacheAligned
,
180 PagedPoolCacheAligned
,
181 NonPagedPoolCacheAlignedMustS
,
185 typedef struct _WAIT_CONTEXT_BLOCK
{
186 KDEVICE_QUEUE_ENTRY WaitQueueEntry
;
187 struct _DRIVER_CONTROL
*DeviceRoutine
;
189 ULONG NumberOfMapRegisters
;
192 PKDPC BufferChainingDpc
;
193 } WAIT_CONTEXT_BLOCK
, *PWAIT_CONTEXT_BLOCK
;
195 #define DO_BUFFERED_IO 0x00000004
196 #define DO_EXCLUSIVE 0x00000008
197 #define DO_DIRECT_IO 0x00000010
198 #define DO_MAP_IO_BUFFER 0x00000020
199 #define DO_DEVICE_INITIALIZING 0x00000080
200 #define DO_SHUTDOWN_REGISTERED 0x00000800
201 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
202 #define DO_POWER_PAGABLE 0x00002000
203 #define DO_POWER_INRUSH 0x00004000
205 #define IO_NO_INCREMENT 0
206 #define IO_CD_ROM_INCREMENT 1
207 #define IO_DISK_INCREMENT 1
208 #define IO_KEYBOARD_INCREMENT 6
209 #define IO_MAILSLOT_INCREMENT 2
210 #define IO_MOUSE_INCREMENT 6
211 #define IO_NAMED_PIPE_INCREMENT 2
212 #define IO_NETWORK_INCREMENT 2
213 #define IO_PARALLEL_INCREMENT 1
214 #define IO_SERIAL_INCREMENT 2
215 #define IO_SOUND_INCREMENT 8
216 #define IO_VIDEO_INCREMENT 1
219 #define DEVICE_TYPE ULONG
221 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
222 #define IRP_MJ_CREATE 0x00
223 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
224 #define IRP_MJ_CLOSE 0x02
225 #define IRP_MJ_READ 0x03
226 #define IRP_MJ_WRITE 0x04
227 #define IRP_MJ_QUERY_INFORMATION 0x05
228 #define IRP_MJ_SET_INFORMATION 0x06
229 #define IRP_MJ_QUERY_EA 0x07
230 #define IRP_MJ_SET_EA 0x08
231 #define IRP_MJ_FLUSH_BUFFERS 0x09
232 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
233 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
234 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
235 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
236 #define IRP_MJ_DEVICE_CONTROL 0x0e
237 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
238 #define IRP_MJ_SHUTDOWN 0x10
239 #define IRP_MJ_LOCK_CONTROL 0x11
240 #define IRP_MJ_CLEANUP 0x12
241 #define IRP_MJ_CREATE_MAILSLOT 0x13
242 #define IRP_MJ_QUERY_SECURITY 0x14
243 #define IRP_MJ_SET_SECURITY 0x15
244 #define IRP_MJ_POWER 0x16
245 #define IRP_MJ_SYSTEM_CONTROL 0x17
246 #define IRP_MJ_DEVICE_CHANGE 0x18
247 #define IRP_MJ_QUERY_QUOTA 0x19
248 #define IRP_MJ_SET_QUOTA 0x1a
249 #define IRP_MJ_PNP 0x1b
251 #define IRP_MN_START_DEVICE 0x00
252 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
253 #define IRP_MN_REMOVE_DEVICE 0x02
254 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
255 #define IRP_MN_STOP_DEVICE 0x04
256 #define IRP_MN_QUERY_STOP_DEVICE 0x05
257 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
258 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
259 #define IRP_MN_QUERY_INTERFACE 0x08
260 #define IRP_MN_QUERY_CAPABILITIES 0x09
261 #define IRP_MN_QUERY_RESOURCES 0x0A
262 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
263 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
264 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
265 #define IRP_MN_READ_CONFIG 0x0F
266 #define IRP_MN_WRITE_CONFIG 0x10
267 #define IRP_MN_EJECT 0x11
268 #define IRP_MN_SET_LOCK 0x12
269 #define IRP_MN_QUERY_ID 0x13
270 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
271 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
272 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
273 #define IRP_MN_SURPRISE_REMOVAL 0x17
274 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
276 #define IRP_MN_WAIT_WAKE 0x00
277 #define IRP_MN_POWER_SEQUENCE 0x01
278 #define IRP_MN_SET_POWER 0x02
279 #define IRP_MN_QUERY_POWER 0x03
281 #define IRP_QUOTA_CHARGED 0x01
282 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
283 #define IRP_ALLOCATED_FIXED_SIZE 0x04
284 #define IRP_LOOKASIDE_ALLOCATION 0x08
286 #define IO_TYPE_ADAPTER 0x01
287 #define IO_TYPE_CONTROLLER 0x02
288 #define IO_TYPE_DEVICE 0x03
289 #define IO_TYPE_DRIVER 0x04
290 #define IO_TYPE_FILE 0x05
291 #define IO_TYPE_IRP 0x06
292 #define IO_TYPE_MASTER_ADAPTER 0x07
293 #define IO_TYPE_OPEN_PACKET 0x08
294 #define IO_TYPE_TIMER 0x09
295 #define IO_TYPE_VPB 0x0a
296 #define IO_TYPE_ERROR_LOG 0x0b
297 #define IO_TYPE_ERROR_MESSAGE 0x0c
298 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
300 typedef struct _DEVICE_OBJECT
{
304 struct _DRIVER_OBJECT
*DriverObject
;
305 struct _DEVICE_OBJECT
*NextDevice
;
306 struct _DEVICE_OBJECT
*AttachedDevice
;
307 struct _IRP
*CurrentIrp
;
310 ULONG Characteristics
;
312 PVOID DeviceExtension
;
313 DEVICE_TYPE DeviceType
;
316 LIST_ENTRY ListEntry
;
317 WAIT_CONTEXT_BLOCK Wcb
;
319 ULONG AlignmentRequirement
;
320 KDEVICE_QUEUE DeviceQueue
;
322 ULONG ActiveThreadCount
;
323 PSECURITY_DESCRIPTOR SecurityDescriptor
;
327 struct _DEVOBJ_EXTENSION
*DeviceObjectExtension
;
330 typedef struct _DEVICE_OBJECT
*PDEVICE_OBJECT
;
332 typedef struct _DEVICE_RELATIONS
{
334 PDEVICE_OBJECT Objects
[1];
336 typedef struct _DEVICE_RELATIONS
*PDEVICE_RELATIONS
;
338 typedef struct _DRIVER_EXTENSION
{
339 struct _DRIVER_OBJECT
*DriverObject
;
340 PDRIVER_ADD_DEVICE AddDevice
;
342 UNICODE_STRING ServiceKeyName
;
343 } DRIVER_EXTENSION
, *PDRIVER_EXTENSION
;
345 typedef struct _DRIVER_OBJECT
{
348 PDEVICE_OBJECT DeviceObject
;
353 PDRIVER_EXTENSION DriverExtension
;
354 UNICODE_STRING DriverName
;
355 PUNICODE_STRING HardwareDatabase
;
356 PVOID FastIoDispatch
;
357 PDRIVER_INITIALIZE DriverInit
;
358 PDRIVER_STARTIO DriverStartIo
;
359 PDRIVER_UNLOAD DriverUnload
;
360 PDRIVER_DISPATCH MajorFunction
[IRP_MJ_MAXIMUM_FUNCTION
+ 1];
362 typedef struct _DRIVER_OBJECT
*PDRIVER_OBJECT
;
364 /* Irp definitions */
365 typedef UCHAR KIRQL
, *PKIRQL
;
366 typedef CCHAR KPROCESSOR_MODE
;
368 typedef VOID (WINAPI
*PDRIVER_CANCEL
)(
369 IN
struct _DEVICE_OBJECT
*DeviceObject
,
370 IN
struct _IRP
*Irp
);
372 typedef VOID (WINAPI
*PKNORMAL_ROUTINE
)(
373 IN PVOID NormalContext
,
374 IN PVOID SystemArgument1
,
375 IN PVOID SystemArgument2
);
377 typedef VOID (WINAPI
*PKKERNEL_ROUTINE
)(
378 IN
struct _KAPC
*Apc
,
379 IN OUT PKNORMAL_ROUTINE
*NormalRoutine
,
380 IN OUT PVOID
*NormalContext
,
381 IN OUT PVOID
*SystemArgument1
,
382 IN OUT PVOID
*SystemArgument2
);
384 typedef VOID (WINAPI
*PKRUNDOWN_ROUTINE
)(
385 IN
struct _KAPC
*Apc
);
387 typedef struct _KAPC
{
391 struct _KTHREAD
*Thread
;
392 LIST_ENTRY ApcListEntry
;
393 PKKERNEL_ROUTINE KernelRoutine
;
394 PKRUNDOWN_ROUTINE RundownRoutine
;
395 PKNORMAL_ROUTINE NormalRoutine
;
397 PVOID SystemArgument1
;
398 PVOID SystemArgument2
;
400 KPROCESSOR_MODE ApcMode
;
402 } KAPC
, *PKAPC
, *RESTRICTED_POINTER PRKAPC
;
404 typedef struct _IRP
{
407 struct _MDL
*MdlAddress
;
410 struct _IRP
*MasterIrp
;
414 LIST_ENTRY ThreadListEntry
;
415 IO_STATUS_BLOCK IoStatus
;
416 KPROCESSOR_MODE RequestorMode
;
417 BOOLEAN PendingReturned
;
419 CHAR CurrentLocation
;
422 CCHAR ApcEnvironment
;
423 UCHAR AllocationFlags
;
424 PIO_STATUS_BLOCK UserIosb
;
428 PIO_APC_ROUTINE UserApcRoutine
;
429 PVOID UserApcContext
;
430 } AsynchronousParameters
;
431 LARGE_INTEGER AllocationSize
;
433 PDRIVER_CANCEL CancelRoutine
;
438 KDEVICE_QUEUE_ENTRY DeviceQueueEntry
;
440 PVOID DriverContext
[4];
444 PCHAR AuxiliaryBuffer
;
446 LIST_ENTRY ListEntry
;
448 struct _IO_STACK_LOCATION
*CurrentStackLocation
;
452 struct _FILE_OBJECT
*OriginalFileObject
;
458 typedef struct _IRP
*PIRP
;
460 #define IRP_NOCACHE 0x0001
461 #define IRP_PAGING_IO 0x0002
462 #define IRP_MOUNT_COMPLETION 0x0002
463 #define IRP_SYNCHRONOUS_API 0x0004
464 #define IRP_ASSOCIATED_IRP 0x0008
465 #define IRP_BUFFERED_IO 0x0010
466 #define IRP_DEALLOCATE_BUFFER 0x0020
467 #define IRP_INPUT_OPERATION 0x0040
468 #define IRP_SYNCHRONOUS_PAGING_IO 0x0040
469 #define IRP_CREATE_OPERATION 0x0080
470 #define IRP_READ_OPERATION 0x0100
471 #define IRP_WRITE_OPERATION 0x0200
472 #define IRP_CLOSE_OPERATION 0x0400
473 #define IRP_DEFER_IO_COMPLETION 0x0800
474 #define IRP_OB_QUERY_NAME 0x1000
475 #define IRP_HOLD_DEVICE_QUEUE 0x2000
477 typedef VOID (WINAPI
*PINTERFACE_REFERENCE
)(
480 typedef VOID (WINAPI
*PINTERFACE_DEREFERENCE
)(
483 typedef struct _INTERFACE
{
487 PINTERFACE_REFERENCE InterfaceReference
;
488 PINTERFACE_DEREFERENCE InterfaceDereference
;
489 } INTERFACE
, *PINTERFACE
;
491 typedef struct _SECTION_OBJECT_POINTERS
{
492 PVOID DataSectionObject
;
493 PVOID SharedCacheMap
;
494 PVOID ImageSectionObject
;
495 } SECTION_OBJECT_POINTERS
, *PSECTION_OBJECT_POINTERS
;
497 typedef struct _IO_COMPLETION_CONTEXT
{
500 } IO_COMPLETION_CONTEXT
, *PIO_COMPLETION_CONTEXT
;
502 typedef enum _DEVICE_RELATION_TYPE
{
507 TargetDeviceRelation
,
509 } DEVICE_RELATION_TYPE
, *PDEVICE_RELATION_TYPE
;
511 typedef struct _FILE_OBJECT
{
514 PDEVICE_OBJECT DeviceObject
;
518 PSECTION_OBJECT_POINTERS SectionObjectPointer
;
519 PVOID PrivateCacheMap
;
520 NTSTATUS FinalStatus
;
521 struct _FILE_OBJECT
*RelatedFileObject
;
522 BOOLEAN LockOperation
;
523 BOOLEAN DeletePending
;
526 BOOLEAN DeleteAccess
;
529 BOOLEAN SharedDelete
;
531 UNICODE_STRING FileName
;
532 LARGE_INTEGER CurrentByteOffset
;
538 PIO_COMPLETION_CONTEXT CompletionContext
;
540 typedef struct _FILE_OBJECT
*PFILE_OBJECT
;
542 #define INITIAL_PRIVILEGE_COUNT 3
544 typedef struct _INITIAL_PRIVILEGE_SET
{
545 ULONG PrivilegeCount
;
547 LUID_AND_ATTRIBUTES Privilege
[INITIAL_PRIVILEGE_COUNT
];
548 } INITIAL_PRIVILEGE_SET
, * PINITIAL_PRIVILEGE_SET
;
550 typedef struct _SECURITY_SUBJECT_CONTEXT
{
551 PACCESS_TOKEN ClientToken
;
552 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
553 PACCESS_TOKEN PrimaryToken
;
554 PVOID ProcessAuditId
;
555 } SECURITY_SUBJECT_CONTEXT
, *PSECURITY_SUBJECT_CONTEXT
;
557 typedef struct _ACCESS_STATE
{
559 BOOLEAN SecurityEvaluated
;
560 BOOLEAN GenerateAudit
;
561 BOOLEAN GenerateOnClose
;
562 BOOLEAN PrivilegesAllocated
;
564 ACCESS_MASK RemainingDesiredAccess
;
565 ACCESS_MASK PreviouslyGrantedAccess
;
566 ACCESS_MASK OriginalDesiredAccess
;
567 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext
;
568 PSECURITY_DESCRIPTOR SecurityDescriptor
;
571 INITIAL_PRIVILEGE_SET InitialPrivilegeSet
;
572 PRIVILEGE_SET PrivilegeSet
;
575 BOOLEAN AuditPrivileges
;
576 UNICODE_STRING ObjectName
;
577 UNICODE_STRING ObjectTypeName
;
578 } ACCESS_STATE
, *PACCESS_STATE
;
580 typedef struct _IO_SECURITY_CONTEXT
{
581 PSECURITY_QUALITY_OF_SERVICE SecurityQos
;
582 PACCESS_STATE AccessState
;
583 ACCESS_MASK DesiredAccess
;
584 ULONG FullCreateOptions
;
585 } IO_SECURITY_CONTEXT
, *PIO_SECURITY_CONTEXT
;
587 typedef struct _DEVICE_CAPABILITIES
{
592 ULONG LockSupported
: 1;
593 ULONG EjectSupported
: 1;
595 ULONG DockDevice
: 1;
597 ULONG SilentInstall
: 1;
598 ULONG RawDeviceOK
: 1;
599 ULONG SurpriseRemovalOK
: 1;
600 ULONG WakeFromD0
: 1;
601 ULONG WakeFromD1
: 1;
602 ULONG WakeFromD2
: 1;
603 ULONG WakeFromD3
: 1;
604 ULONG HardwareDisabled
: 1;
605 ULONG NonDynamic
: 1;
606 ULONG WarmEjectSupported
: 1;
607 ULONG NoDisplayInUI
: 1;
611 DEVICE_POWER_STATE DeviceState
[PowerSystemMaximum
];
612 SYSTEM_POWER_STATE SystemWake
;
613 DEVICE_POWER_STATE DeviceWake
;
617 } DEVICE_CAPABILITIES
, *PDEVICE_CAPABILITIES
;
619 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
{
623 GUID InterfaceClassGuid
;
624 PUNICODE_STRING SymbolicLinkName
;
625 } DEVICE_INTERFACE_CHANGE_NOTIFICATION
, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION
;
627 typedef enum _INTERFACE_TYPE
{
628 InterfaceTypeUndefined
= -1,
646 } INTERFACE_TYPE
, *PINTERFACE_TYPE
;
648 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
650 #define IO_RESOURCE_PREFERRED 0x01
651 #define IO_RESOURCE_DEFAULT 0x02
652 #define IO_RESOURCE_ALTERNATIVE 0x08
654 typedef struct _IO_RESOURCE_DESCRIPTOR
{
657 UCHAR ShareDisposition
;
665 PHYSICAL_ADDRESS MinimumAddress
;
666 PHYSICAL_ADDRESS MaximumAddress
;
671 PHYSICAL_ADDRESS MinimumAddress
;
672 PHYSICAL_ADDRESS MaximumAddress
;
679 ULONG MinimumChannel
;
680 ULONG MaximumChannel
;
685 PHYSICAL_ADDRESS MinimumAddress
;
686 PHYSICAL_ADDRESS MaximumAddress
;
703 } IO_RESOURCE_DESCRIPTOR
, *PIO_RESOURCE_DESCRIPTOR
;
705 typedef struct _IO_RESOURCE_LIST
{
709 IO_RESOURCE_DESCRIPTOR Descriptors
[1];
710 } IO_RESOURCE_LIST
, *PIO_RESOURCE_LIST
;
712 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
714 INTERFACE_TYPE InterfaceType
;
718 ULONG AlternativeLists
;
719 IO_RESOURCE_LIST List
[1];
720 } IO_RESOURCE_REQUIREMENTS_LIST
, *PIO_RESOURCE_REQUIREMENTS_LIST
;
722 typedef enum _BUS_QUERY_ID_TYPE
{
725 BusQueryCompatibleIDs
,
727 BusQueryDeviceSerialNumber
728 } BUS_QUERY_ID_TYPE
, *PBUS_QUERY_ID_TYPE
;
731 DevicePropertyDeviceDescription
,
732 DevicePropertyHardwareID
,
733 DevicePropertyCompatibleIDs
,
734 DevicePropertyBootConfiguration
,
735 DevicePropertyBootConfigurationTranslated
,
736 DevicePropertyClassName
,
737 DevicePropertyClassGuid
,
738 DevicePropertyDriverKeyName
,
739 DevicePropertyManufacturer
,
740 DevicePropertyFriendlyName
,
741 DevicePropertyLocationInformation
,
742 DevicePropertyPhysicalDeviceObjectName
,
743 DevicePropertyBusTypeGuid
,
744 DevicePropertyLegacyBusType
,
745 DevicePropertyBusNumber
,
746 DevicePropertyEnumeratorName
,
747 DevicePropertyAddress
,
748 DevicePropertyUINumber
,
749 DevicePropertyInstallState
,
750 DevicePropertyRemovalPolicy
751 } DEVICE_REGISTRY_PROPERTY
;
753 typedef enum _DEVICE_TEXT_TYPE
{
754 DeviceTextDescription
,
755 DeviceTextLocationInformation
756 } DEVICE_TEXT_TYPE
, *PDEVICE_TEXT_TYPE
;
758 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE
{
759 DeviceUsageTypeUndefined
,
760 DeviceUsageTypePaging
,
761 DeviceUsageTypeHibernation
,
762 DeviceUsageTypeDumpFile
763 } DEVICE_USAGE_NOTIFICATION_TYPE
;
765 typedef struct _POWER_SEQUENCE
{
769 } POWER_SEQUENCE
, *PPOWER_SEQUENCE
;
771 typedef enum _POWER_STATE_TYPE
{
774 } POWER_STATE_TYPE
, *PPOWER_STATE_TYPE
;
776 typedef union _POWER_STATE
{
777 SYSTEM_POWER_STATE SystemState
;
778 DEVICE_POWER_STATE DeviceState
;
779 } POWER_STATE
, *PPOWER_STATE
;
781 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
783 UCHAR ShareDisposition
;
787 PHYSICAL_ADDRESS Start
;
791 PHYSICAL_ADDRESS Start
;
800 PHYSICAL_ADDRESS Start
;
820 } DeviceSpecificData
;
822 } CM_PARTIAL_RESOURCE_DESCRIPTOR
, *PCM_PARTIAL_RESOURCE_DESCRIPTOR
;
824 typedef struct _CM_PARTIAL_RESOURCE_LIST
{
828 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors
[1];
829 } CM_PARTIAL_RESOURCE_LIST
, *PCM_PARTIAL_RESOURCE_LIST
;
831 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
832 INTERFACE_TYPE InterfaceType
;
834 CM_PARTIAL_RESOURCE_LIST PartialResourceList
;
835 } CM_FULL_RESOURCE_DESCRIPTOR
, *PCM_FULL_RESOURCE_DESCRIPTOR
;
837 typedef struct _CM_RESOURCE_LIST
{
839 CM_FULL_RESOURCE_DESCRIPTOR List
[1];
840 } CM_RESOURCE_LIST
, *PCM_RESOURCE_LIST
;
842 typedef NTSTATUS (WINAPI
*PIO_COMPLETION_ROUTINE
)(
843 IN
struct _DEVICE_OBJECT
*DeviceObject
,
847 #define SL_PENDING_RETURNED 0x01
848 #define SL_INVOKE_ON_CANCEL 0x20
849 #define SL_INVOKE_ON_SUCCESS 0x40
850 #define SL_INVOKE_ON_ERROR 0x80
853 #include <pshpack4.h>
855 typedef struct _IO_STACK_LOCATION
{
862 PIO_SECURITY_CONTEXT SecurityContext
;
864 USHORT POINTER_ALIGNMENT FileAttributes
;
866 ULONG POINTER_ALIGNMENT EaLength
;
870 ULONG POINTER_ALIGNMENT Key
;
871 LARGE_INTEGER ByteOffset
;
875 ULONG POINTER_ALIGNMENT Key
;
876 LARGE_INTEGER ByteOffset
;
880 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
884 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass
;
885 PFILE_OBJECT FileObject
;
888 BOOLEAN ReplaceIfExists
;
897 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass
;
900 ULONG OutputBufferLength
;
901 ULONG POINTER_ALIGNMENT InputBufferLength
;
902 ULONG POINTER_ALIGNMENT IoControlCode
;
903 PVOID Type3InputBuffer
;
906 SECURITY_INFORMATION SecurityInformation
;
907 ULONG POINTER_ALIGNMENT Length
;
910 SECURITY_INFORMATION SecurityInformation
;
911 PSECURITY_DESCRIPTOR SecurityDescriptor
;
915 PDEVICE_OBJECT DeviceObject
;
919 PDEVICE_OBJECT DeviceObject
;
922 struct _SCSI_REQUEST_BLOCK
*Srb
;
925 DEVICE_RELATION_TYPE Type
;
926 } QueryDeviceRelations
;
928 const GUID
*InterfaceType
;
931 PINTERFACE Interface
;
932 PVOID InterfaceSpecificData
;
935 PDEVICE_CAPABILITIES Capabilities
;
936 } DeviceCapabilities
;
938 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList
;
939 } FilterResourceRequirements
;
944 ULONG POINTER_ALIGNMENT Length
;
950 BUS_QUERY_ID_TYPE IdType
;
953 DEVICE_TEXT_TYPE DeviceTextType
;
954 LCID POINTER_ALIGNMENT LocaleId
;
959 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type
;
962 SYSTEM_POWER_STATE PowerState
;
965 PPOWER_SEQUENCE PowerSequence
;
969 POWER_STATE_TYPE POINTER_ALIGNMENT Type
;
970 POWER_STATE POINTER_ALIGNMENT State
;
971 POWER_ACTION POINTER_ALIGNMENT ShutdownType
;
974 PCM_RESOURCE_LIST AllocatedResources
;
975 PCM_RESOURCE_LIST AllocatedResourcesTranslated
;
978 ULONG_PTR ProviderId
;
990 PDEVICE_OBJECT DeviceObject
;
991 PFILE_OBJECT FileObject
;
992 PIO_COMPLETION_ROUTINE CompletionRoutine
;
994 } IO_STACK_LOCATION
, *PIO_STACK_LOCATION
;
999 /* MDL definitions */
1001 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1002 #define MDL_PAGES_LOCKED 0x0002
1003 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1004 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1005 #define MDL_PARTIAL 0x0010
1006 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1007 #define MDL_IO_PAGE_READ 0x0040
1008 #define MDL_WRITE_OPERATION 0x0080
1009 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1010 #define MDL_FREE_EXTRA_PTES 0x0200
1011 #define MDL_DESCRIBES_AWE 0x0400
1012 #define MDL_IO_SPACE 0x0800
1013 #define MDL_NETWORK_HEADER 0x1000
1014 #define MDL_MAPPING_CAN_FAIL 0x2000
1015 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1016 #define MDL_INTERNAL 0x8000
1018 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
1019 MDL_PAGES_LOCKED | \
1020 MDL_SOURCE_IS_NONPAGED_POOL | \
1021 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1022 MDL_PARENT_MAPPED_SYSTEM_VA | \
1026 typedef struct _MDL
{
1030 struct _EPROCESS
*Process
;
1031 PVOID MappedSystemVa
;
1039 typedef struct _KTIMER
{
1040 DISPATCHER_HEADER Header
;
1041 ULARGE_INTEGER DueTime
;
1042 LIST_ENTRY TimerListEntry
;
1047 typedef struct _KSYSTEM_TIME
{
1051 } KSYSTEM_TIME
, *PKSYSTEM_TIME
;
1053 typedef enum _NT_PRODUCT_TYPE
{
1057 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
1059 #define PROCESSOR_FEATURE_MAX 64
1061 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
1066 } ALTERNATIVE_ARCHITECTURE_TYPE
;
1068 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1069 #define NX_SUPPORT_POLICY_ALWAYSON 1
1070 #define NX_SUPPORT_POLICY_OPTIN 2
1071 #define NX_SUPPORT_POLICY_OPTOUT 3
1073 #define MAX_WOW64_SHARED_ENTRIES 16
1075 typedef struct _KUSER_SHARED_DATA
{
1076 ULONG TickCountLowDeprecated
;
1077 ULONG TickCountMultiplier
;
1078 volatile KSYSTEM_TIME InterruptTime
;
1079 volatile KSYSTEM_TIME SystemTime
;
1080 volatile KSYSTEM_TIME TimeZoneBias
;
1081 USHORT ImageNumberLow
;
1082 USHORT ImageNumberHigh
;
1083 WCHAR NtSystemRoot
[260];
1084 ULONG MaxStackTraceDepth
;
1085 ULONG CryptoExponent
;
1087 ULONG LargePageMinimum
;
1089 NT_PRODUCT_TYPE NtProductType
;
1090 BOOLEAN ProductTypeIsValid
;
1091 ULONG NtMajorVersion
;
1092 ULONG NtMinorVersion
;
1093 BOOLEAN ProcessorFeatures
[PROCESSOR_FEATURE_MAX
];
1096 volatile ULONG TimeSlip
;
1097 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture
;
1098 LARGE_INTEGER SystemExpirationDate
;
1100 BOOLEAN KdDebuggerEnabled
;
1101 UCHAR NXSupportPolicy
;
1102 volatile ULONG ActiveConsoleId
;
1103 volatile ULONG DismountCount
;
1104 ULONG ComPlusPackage
;
1105 ULONG LastSystemRITEventTickCount
;
1106 ULONG NumberOfPhysicalPages
;
1107 BOOLEAN SafeBootMode
;
1109 ULONGLONG TestRetInstruction
;
1111 ULONG SystemCallReturn
;
1112 ULONGLONG SystemCallPad
[3];
1114 volatile KSYSTEM_TIME TickCount
;
1115 volatile ULONG64 TickCountQuad
;
1118 ULONG Wow64SharedInformation
[MAX_WOW64_SHARED_ENTRIES
];
1119 } KSHARED_USER_DATA
, *PKSHARED_USER_DATA
;
1121 typedef enum _MEMORY_CACHING_TYPE
{
1124 MmWriteCombined
= 2,
1125 MmHardwareCoherentCached
= 3,
1126 MmNonCachedUnordered
= 4,
1128 MmMaximumCacheType
= 6
1129 } MEMORY_CACHING_TYPE
;
1131 typedef enum _MM_PAGE_PRIORITY
{
1133 NormalPagePriority
= 16,
1134 HighPagePriority
= 32
1137 typedef enum _MM_SYSTEM_SIZE
1144 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK
{
1146 BOOLEAN Reserved
[3];
1149 } IO_REMOVE_LOCK_COMMON_BLOCK
;
1151 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK
*PIO_REMOVE_LOCK_TRACKING_BLOCK
;
1153 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK
{
1156 LONGLONG MaxLockedTicks
;
1158 LIST_ENTRY LockList
;
1160 LONG LowMemoryCount
;
1163 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks
;
1164 } IO_REMOVE_LOCK_DBG_BLOCK
;
1166 typedef struct _IO_REMOVE_LOCK
{
1167 IO_REMOVE_LOCK_COMMON_BLOCK Common
;
1168 IO_REMOVE_LOCK_DBG_BLOCK Dbg
;
1169 } IO_REMOVE_LOCK
, *PIO_REMOVE_LOCK
;
1177 typedef struct _CALLBACK_OBJECT
1181 LIST_ENTRY RegisteredCallbacks
;
1182 BOOLEAN AllowMultipleCallbacks
;
1184 } CALLBACK_OBJECT
, *PCALLBACK_OBJECT
;
1186 typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION
)(void *CallbackContext
, void *Argument1
, void *Argument2
);
1187 typedef EX_CALLBACK_FUNCTION
*PEX_CALLBACK_FUNCTION
;
1189 NTSTATUS WINAPI
ObCloseHandle(IN HANDLE handle
);
1191 #ifdef NONAMELESSUNION
1192 # ifdef NONAMELESSSTRUCT
1193 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1194 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1196 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1197 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1200 # ifdef NONAMELESSSTRUCT
1201 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1202 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1204 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1205 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1209 static inline void IoSetCompletionRoutine(IRP
*irp
, PIO_COMPLETION_ROUTINE routine
, void *context
,
1210 BOOLEAN on_success
, BOOLEAN on_error
, BOOLEAN on_cancel
)
1212 IO_STACK_LOCATION
*irpsp
= IoGetNextIrpStackLocation(irp
);
1213 irpsp
->CompletionRoutine
= routine
;
1214 irpsp
->Context
= context
;
1216 if (on_success
) irpsp
->Control
|= SL_INVOKE_ON_SUCCESS
;
1217 if (on_error
) irpsp
->Control
|= SL_INVOKE_ON_ERROR
;
1218 if (on_cancel
) irpsp
->Control
|= SL_INVOKE_ON_CANCEL
;
1221 #define KernelMode 0
1224 /* directory object access rights */
1225 #define DIRECTORY_QUERY 0x0001
1226 #define DIRECTORY_TRAVERSE 0x0002
1227 #define DIRECTORY_CREATE_OBJECT 0x0004
1228 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1229 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1231 /* symbolic link access rights */
1232 #define SYMBOLIC_LINK_QUERY 0x0001
1233 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1235 PVOID WINAPI
ExAllocatePool(POOL_TYPE
,SIZE_T
);
1236 PVOID WINAPI
ExAllocatePoolWithQuota(POOL_TYPE
,SIZE_T
);
1237 PVOID WINAPI
ExAllocatePoolWithTag(POOL_TYPE
,SIZE_T
,ULONG
);
1238 PVOID WINAPI
ExAllocatePoolWithQuotaTag(POOL_TYPE
,SIZE_T
,ULONG
);
1239 void WINAPI
ExFreePool(PVOID
);
1240 void WINAPI
ExFreePoolWithTag(PVOID
,ULONG
);
1242 NTSTATUS WINAPI
IoAllocateDriverObjectExtension(PDRIVER_OBJECT
,PVOID
,ULONG
,PVOID
*);
1243 PVOID WINAPI
IoAllocateErrorLogEntry(PVOID
,UCHAR
);
1244 PIRP WINAPI
IoAllocateIrp(CCHAR
,BOOLEAN
);
1245 PMDL WINAPI
IoAllocateMdl(PVOID
,ULONG
,BOOLEAN
,BOOLEAN
,IRP
*);
1246 PDEVICE_OBJECT WINAPI
IoAttachDeviceToDeviceStack(PDEVICE_OBJECT
,PDEVICE_OBJECT
);
1247 PIRP WINAPI
IoBuildDeviceIoControlRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PVOID
,ULONG
,BOOLEAN
,PKEVENT
,IO_STATUS_BLOCK
*);
1248 PIRP WINAPI
IoBuildSynchronousFsdRequest(ULONG
,DEVICE_OBJECT
*,PVOID
,ULONG
,PLARGE_INTEGER
,PKEVENT
,IO_STATUS_BLOCK
*);
1249 NTSTATUS WINAPI
IoCallDriver(DEVICE_OBJECT
*,IRP
*);
1250 VOID WINAPI
IoCompleteRequest(IRP
*,UCHAR
);
1251 NTSTATUS WINAPI
IoCreateDevice(DRIVER_OBJECT
*,ULONG
,UNICODE_STRING
*,DEVICE_TYPE
,ULONG
,BOOLEAN
,DEVICE_OBJECT
**);
1252 NTSTATUS WINAPI
IoCreateDriver(UNICODE_STRING
*,PDRIVER_INITIALIZE
);
1253 NTSTATUS WINAPI
IoCreateSymbolicLink(UNICODE_STRING
*,UNICODE_STRING
*);
1254 void WINAPI
IoDeleteDevice(DEVICE_OBJECT
*);
1255 void WINAPI
IoDeleteDriver(DRIVER_OBJECT
*);
1256 NTSTATUS WINAPI
IoDeleteSymbolicLink(UNICODE_STRING
*);
1257 void WINAPI
IoFreeIrp(IRP
*);
1258 void WINAPI
IoFreeMdl(MDL
*);
1259 PEPROCESS WINAPI
IoGetCurrentProcess(void);
1260 NTSTATUS WINAPI
IoGetDeviceInterfaces(const GUID
*,PDEVICE_OBJECT
,ULONG
,PWSTR
*);
1261 NTSTATUS WINAPI
IoGetDeviceObjectPointer(UNICODE_STRING
*,ACCESS_MASK
,PFILE_OBJECT
*,PDEVICE_OBJECT
*);
1262 NTSTATUS WINAPI
IoGetDeviceProperty(PDEVICE_OBJECT
,DEVICE_REGISTRY_PROPERTY
,ULONG
,PVOID
,PULONG
);
1263 PVOID WINAPI
IoGetDriverObjectExtension(PDRIVER_OBJECT
,PVOID
);
1264 PDEVICE_OBJECT WINAPI
IoGetRelatedDeviceObject(PFILE_OBJECT
);
1265 void WINAPI
IoInitializeIrp(IRP
*,USHORT
,CCHAR
);
1266 VOID WINAPI
IoInitializeRemoveLockEx(PIO_REMOVE_LOCK
,ULONG
,ULONG
,ULONG
,ULONG
);
1267 void WINAPI
IoInvalidateDeviceRelations(PDEVICE_OBJECT
,DEVICE_RELATION_TYPE
);
1268 NTSTATUS WINAPI
IoWMIRegistrationControl(PDEVICE_OBJECT
,ULONG
);
1270 PKTHREAD WINAPI
KeGetCurrentThread(void);
1271 void WINAPI
KeQuerySystemTime(LARGE_INTEGER
*);
1272 void WINAPI
KeQueryTickCount(LARGE_INTEGER
*);
1273 ULONG WINAPI
KeQueryTimeIncrement(void);
1274 LONG WINAPI
KeReleaseSemaphore(PRKSEMAPHORE
,KPRIORITY
,LONG
,BOOLEAN
);
1275 LONG WINAPI
KeResetEvent(PRKEVENT
);
1276 LONG WINAPI
KeSetEvent(PRKEVENT
,KPRIORITY
,BOOLEAN
);
1277 KPRIORITY WINAPI
KeSetPriorityThread(PKTHREAD
,KPRIORITY
);
1278 void WINAPI
KeSetSystemAffinityThread(KAFFINITY
);
1280 PVOID WINAPI
MmAllocateContiguousMemory(SIZE_T
,PHYSICAL_ADDRESS
);
1281 PVOID WINAPI
MmAllocateNonCachedMemory(SIZE_T
);
1282 PMDL WINAPI
MmAllocatePagesForMdl(PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,PHYSICAL_ADDRESS
,SIZE_T
);
1283 void WINAPI
MmFreeNonCachedMemory(PVOID
,SIZE_T
);
1284 MM_SYSTEMSIZE WINAPI
MmQuerySystemSize(void);
1286 void WINAPI
ObDereferenceObject(void*);
1287 NTSTATUS WINAPI
ObReferenceObjectByHandle(HANDLE
,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,PVOID
*,POBJECT_HANDLE_INFORMATION
);
1288 NTSTATUS WINAPI
ObReferenceObjectByName(UNICODE_STRING
*,ULONG
,ACCESS_STATE
*,ACCESS_MASK
,POBJECT_TYPE
,KPROCESSOR_MODE
,void*,void**);
1290 POWER_STATE WINAPI
PoSetPowerState(PDEVICE_OBJECT
,POWER_STATE_TYPE
,POWER_STATE
);
1291 NTSTATUS WINAPI
PsCreateSystemThread(PHANDLE
,ULONG
,POBJECT_ATTRIBUTES
,HANDLE
,PCLIENT_ID
,PKSTART_ROUTINE
,PVOID
);
1292 #define PsGetCurrentProcess() IoGetCurrentProcess()
1293 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1294 HANDLE WINAPI
PsGetCurrentProcessId(void);
1295 HANDLE WINAPI
PsGetCurrentThreadId(void);
1296 BOOLEAN WINAPI
PsGetVersion(ULONG
*,ULONG
*,ULONG
*,UNICODE_STRING
*);
1297 NTSTATUS WINAPI
PsTerminateSystemThread(NTSTATUS
);
1299 NTSTATUS WINAPI
ZwAddBootEntry(PUNICODE_STRING
,PUNICODE_STRING
);
1300 NTSTATUS WINAPI
ZwAccessCheckAndAuditAlarm(PUNICODE_STRING
,HANDLE
,PUNICODE_STRING
,PUNICODE_STRING
,PSECURITY_DESCRIPTOR
,ACCESS_MASK
,PGENERIC_MAPPING
,BOOLEAN
,PACCESS_MASK
,PBOOLEAN
,PBOOLEAN
);
1301 NTSTATUS WINAPI
ZwAdjustPrivilegesToken(HANDLE
,BOOLEAN
,PTOKEN_PRIVILEGES
,DWORD
,PTOKEN_PRIVILEGES
,PDWORD
);
1302 NTSTATUS WINAPI
ZwAlertThread(HANDLE ThreadHandle
);
1303 NTSTATUS WINAPI
ZwAllocateVirtualMemory(HANDLE
,PVOID
*,ULONG
,SIZE_T
*,ULONG
,ULONG
);
1304 NTSTATUS WINAPI
ZwCancelIoFile(HANDLE
,PIO_STATUS_BLOCK
);
1305 NTSTATUS WINAPI
ZwCancelTimer(HANDLE
, BOOLEAN
*);
1306 NTSTATUS WINAPI
ZwClearEvent(HANDLE
);
1307 NTSTATUS WINAPI
ZwClose(HANDLE
);
1308 NTSTATUS WINAPI
ZwCloseObjectAuditAlarm(PUNICODE_STRING
,HANDLE
,BOOLEAN
);
1309 NTSTATUS WINAPI
ZwConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1310 NTSTATUS WINAPI
ZwCreateDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1311 NTSTATUS WINAPI
ZwCreateEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,BOOLEAN
,BOOLEAN
);
1312 NTSTATUS WINAPI
ZwCreateFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,PLARGE_INTEGER
,ULONG
,ULONG
,ULONG
,ULONG
,PVOID
,ULONG
);
1313 NTSTATUS WINAPI
ZwCreateKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,const UNICODE_STRING
*,ULONG
,PULONG
);
1314 NTSTATUS WINAPI
ZwCreateSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const LARGE_INTEGER
*,ULONG
,ULONG
,HANDLE
);
1315 NTSTATUS WINAPI
ZwCreateSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PUNICODE_STRING
);
1316 NTSTATUS WINAPI
ZwCreateTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*, TIMER_TYPE
);
1317 NTSTATUS WINAPI
ZwDeleteAtom(RTL_ATOM
);
1318 NTSTATUS WINAPI
ZwDeleteFile(POBJECT_ATTRIBUTES
);
1319 NTSTATUS WINAPI
ZwDeleteKey(HANDLE
);
1320 NTSTATUS WINAPI
ZwDeleteValueKey(HANDLE
,const UNICODE_STRING
*);
1321 NTSTATUS WINAPI
ZwDeviceIoControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1322 NTSTATUS WINAPI
ZwDisplayString(PUNICODE_STRING
);
1323 NTSTATUS WINAPI
ZwDuplicateObject(HANDLE
,HANDLE
,HANDLE
,PHANDLE
,ACCESS_MASK
,ULONG
,ULONG
);
1324 NTSTATUS WINAPI
ZwDuplicateToken(HANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,SECURITY_IMPERSONATION_LEVEL
,TOKEN_TYPE
,PHANDLE
);
1325 NTSTATUS WINAPI
ZwEnumerateKey(HANDLE
,ULONG
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1326 NTSTATUS WINAPI
ZwEnumerateValueKey(HANDLE
,ULONG
,KEY_VALUE_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1327 NTSTATUS WINAPI
ZwFlushInstructionCache(HANDLE
,LPCVOID
,SIZE_T
);
1328 NTSTATUS WINAPI
ZwFlushKey(HANDLE
);
1329 NTSTATUS WINAPI
ZwFlushVirtualMemory(HANDLE
,LPCVOID
*,SIZE_T
*,ULONG
);
1330 NTSTATUS WINAPI
ZwFreeVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1331 NTSTATUS WINAPI
ZwFsControlFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,PVOID
,ULONG
,PVOID
,ULONG
);
1332 NTSTATUS WINAPI
ZwInitiatePowerAction(POWER_ACTION
,SYSTEM_POWER_STATE
,ULONG
,BOOLEAN
);
1333 NTSTATUS WINAPI
ZwLoadDriver(const UNICODE_STRING
*);
1334 NTSTATUS WINAPI
ZwLoadKey(const OBJECT_ATTRIBUTES
*,OBJECT_ATTRIBUTES
*);
1335 NTSTATUS WINAPI
ZwLockVirtualMemory(HANDLE
,PVOID
*,SIZE_T
*,ULONG
);
1336 NTSTATUS WINAPI
ZwMakeTemporaryObject(HANDLE
);
1337 NTSTATUS WINAPI
ZwMapViewOfSection(HANDLE
,HANDLE
,PVOID
*,ULONG
,SIZE_T
,const LARGE_INTEGER
*,SIZE_T
*,SECTION_INHERIT
,ULONG
,ULONG
);
1338 NTSTATUS WINAPI
ZwNotifyChangeKey(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,ULONG
,BOOLEAN
,PVOID
,ULONG
,BOOLEAN
);
1339 NTSTATUS WINAPI
ZwOpenDirectoryObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1340 NTSTATUS WINAPI
ZwOpenEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1341 NTSTATUS WINAPI
ZwOpenFile(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
,PIO_STATUS_BLOCK
,ULONG
,ULONG
);
1342 NTSTATUS WINAPI
ZwOpenKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1343 NTSTATUS WINAPI
ZwOpenProcess(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1344 NTSTATUS WINAPI
ZwOpenProcessToken(HANDLE
,DWORD
,HANDLE
*);
1345 NTSTATUS WINAPI
ZwOpenSection(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
1346 NTSTATUS WINAPI
ZwOpenSymbolicLinkObject(PHANDLE
,ACCESS_MASK
,POBJECT_ATTRIBUTES
);
1347 NTSTATUS WINAPI
ZwOpenThread(HANDLE
*,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,const CLIENT_ID
*);
1348 NTSTATUS WINAPI
ZwOpenThreadToken(HANDLE
,DWORD
,BOOLEAN
,HANDLE
*);
1349 NTSTATUS WINAPI
ZwOpenTimer(HANDLE
*, ACCESS_MASK
, const OBJECT_ATTRIBUTES
*);
1350 NTSTATUS WINAPI
ZwPowerInformation(POWER_INFORMATION_LEVEL
,PVOID
,ULONG
,PVOID
,ULONG
);
1351 NTSTATUS WINAPI
ZwPulseEvent(HANDLE
,PULONG
);
1352 NTSTATUS WINAPI
ZwQueryDefaultLocale(BOOLEAN
,LCID
*);
1353 NTSTATUS WINAPI
ZwQueryDefaultUILanguage(LANGID
*);
1354 NTSTATUS WINAPI
ZwQueryDirectoryFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
,BOOLEAN
,PUNICODE_STRING
,BOOLEAN
);
1355 NTSTATUS WINAPI
ZwQueryDirectoryObject(HANDLE
,PDIRECTORY_BASIC_INFORMATION
,ULONG
,BOOLEAN
,BOOLEAN
,PULONG
,PULONG
);
1356 NTSTATUS WINAPI
ZwQueryEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,BOOLEAN
,PVOID
,ULONG
,PVOID
,BOOLEAN
);
1357 NTSTATUS WINAPI
ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES
*,FILE_NETWORK_OPEN_INFORMATION
*);
1358 NTSTATUS WINAPI
ZwQueryInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,LONG
,FILE_INFORMATION_CLASS
);
1359 NTSTATUS WINAPI
ZwQueryInformationThread(HANDLE
,THREADINFOCLASS
,PVOID
,ULONG
,PULONG
);
1360 NTSTATUS WINAPI
ZwQueryInformationToken(HANDLE
,DWORD
,PVOID
,DWORD
,LPDWORD
);
1361 NTSTATUS WINAPI
ZwQueryInstallUILanguage(LANGID
*);
1362 NTSTATUS WINAPI
ZwQueryKey(HANDLE
,KEY_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1363 NTSTATUS WINAPI
ZwQueryObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
, PULONG
);
1364 NTSTATUS WINAPI
ZwQuerySecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
,ULONG
,PULONG
);
1365 NTSTATUS WINAPI
ZwQuerySection(HANDLE
,SECTION_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1366 NTSTATUS WINAPI
ZwQuerySymbolicLinkObject(HANDLE
,PUNICODE_STRING
,PULONG
);
1367 NTSTATUS WINAPI
ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
,PULONG
);
1368 NTSTATUS WINAPI
ZwQueryTimerResolution(PULONG
,PULONG
,PULONG
);
1369 NTSTATUS WINAPI
ZwQueryValueKey(HANDLE
,const UNICODE_STRING
*,KEY_VALUE_INFORMATION_CLASS
,void *,DWORD
,DWORD
*);
1370 NTSTATUS WINAPI
ZwQueryVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1371 NTSTATUS WINAPI
ZwReadFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,PLARGE_INTEGER
,PULONG
);
1372 NTSTATUS WINAPI
ZwReplaceKey(POBJECT_ATTRIBUTES
,HANDLE
,POBJECT_ATTRIBUTES
);
1373 NTSTATUS WINAPI
ZwRequestWaitReplyPort(HANDLE
,PLPC_MESSAGE
,PLPC_MESSAGE
);
1374 NTSTATUS WINAPI
ZwResetEvent(HANDLE
,PULONG
);
1375 NTSTATUS WINAPI
ZwRestoreKey(HANDLE
,HANDLE
,ULONG
);
1376 NTSTATUS WINAPI
ZwSaveKey(HANDLE
,HANDLE
);
1377 NTSTATUS WINAPI
ZwSecureConnectPort(PHANDLE
,PUNICODE_STRING
,PSECURITY_QUALITY_OF_SERVICE
,PLPC_SECTION_WRITE
,PSID
,PLPC_SECTION_READ
,PULONG
,PVOID
,PULONG
);
1378 NTSTATUS WINAPI
ZwSetDefaultLocale(BOOLEAN
,LCID
);
1379 NTSTATUS WINAPI
ZwSetDefaultUILanguage(LANGID
);
1380 NTSTATUS WINAPI
ZwSetEaFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
);
1381 NTSTATUS WINAPI
ZwSetEvent(HANDLE
,PULONG
);
1382 NTSTATUS WINAPI
ZwSetInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FILE_INFORMATION_CLASS
);
1383 NTSTATUS WINAPI
ZwSetInformationKey(HANDLE
,const int,PVOID
,ULONG
);
1384 NTSTATUS WINAPI
ZwSetInformationObject(HANDLE
, OBJECT_INFORMATION_CLASS
, PVOID
, ULONG
);
1385 NTSTATUS WINAPI
ZwSetInformationProcess(HANDLE
,PROCESS_INFORMATION_CLASS
,PVOID
,ULONG
);
1386 NTSTATUS WINAPI
ZwSetInformationThread(HANDLE
,THREADINFOCLASS
,LPCVOID
,ULONG
);
1387 NTSTATUS WINAPI
ZwSetIoCompletion(HANDLE
,ULONG
,ULONG
,NTSTATUS
,ULONG
);
1388 NTSTATUS WINAPI
ZwSetLdtEntries(ULONG
,ULONG
,ULONG
,ULONG
,ULONG
,ULONG
);
1389 NTSTATUS WINAPI
ZwSetSecurityObject(HANDLE
,SECURITY_INFORMATION
,PSECURITY_DESCRIPTOR
);
1390 NTSTATUS WINAPI
ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS
,PVOID
,ULONG
);
1391 NTSTATUS WINAPI
ZwSetSystemTime(const LARGE_INTEGER
*,LARGE_INTEGER
*);
1392 NTSTATUS WINAPI
ZwSetTimer(HANDLE
, const LARGE_INTEGER
*, PTIMER_APC_ROUTINE
, PVOID
, BOOLEAN
, ULONG
, BOOLEAN
*);
1393 NTSTATUS WINAPI
ZwSetValueKey(HANDLE
,const UNICODE_STRING
*,ULONG
,ULONG
,const void *,ULONG
);
1394 NTSTATUS WINAPI
ZwSetVolumeInformationFile(HANDLE
,PIO_STATUS_BLOCK
,PVOID
,ULONG
,FS_INFORMATION_CLASS
);
1395 NTSTATUS WINAPI
ZwSuspendThread(HANDLE
,PULONG
);
1396 NTSTATUS WINAPI
ZwTerminateProcess(HANDLE
,LONG
);
1397 NTSTATUS WINAPI
ZwUnloadDriver(const UNICODE_STRING
*);
1398 NTSTATUS WINAPI
ZwUnloadKey(HANDLE
);
1399 NTSTATUS WINAPI
ZwUnmapViewOfSection(HANDLE
,PVOID
);
1400 NTSTATUS WINAPI
ZwWaitForSingleObject(HANDLE
,BOOLEAN
,const LARGE_INTEGER
*);
1401 NTSTATUS WINAPI
ZwWaitForMultipleObjects(ULONG
,const HANDLE
*,BOOLEAN
,BOOLEAN
,const LARGE_INTEGER
*);
1402 NTSTATUS WINAPI
ZwWriteFile(HANDLE
,HANDLE
,PIO_APC_ROUTINE
,PVOID
,PIO_STATUS_BLOCK
,const void*,ULONG
,PLARGE_INTEGER
,PULONG
);
1403 NTSTATUS WINAPI
ZwYieldExecution(void);