oleaut32: Don't accept unsupported picture types in OleCreatePictureIndirect.
[wine.git] / include / ddk / wdm.h
blob5abe18b3e65e125986bdb5414901904be96dc8d0
1 /*
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
19 #ifndef _WDMDDK_
20 #define _WDMDDK_
21 #define _NTDDK_
23 #include <ntstatus.h>
25 #ifdef _WIN64
26 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
27 #else
28 #define POINTER_ALIGNMENT
29 #endif
31 /* FIXME: We suppose that page size is 4096 */
32 #undef PAGE_SIZE
33 #define PAGE_SIZE 0x1000
34 #define PAGE_SHIFT 12
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;
49 struct _KDPC;
50 struct _KAPC;
51 struct _IRP;
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 {
65 UCHAR Type;
66 UCHAR Absolute;
67 UCHAR Size;
68 UCHAR Inserted;
69 LONG SignalState;
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;
79 LONG Limit;
80 } KSEMAPHORE, *PKSEMAPHORE, *PRKSEMAPHORE;
82 typedef struct _KDPC {
83 CSHORT Type;
84 UCHAR Number;
85 UCHAR Importance;
86 LIST_ENTRY DpcListEntry;
87 PKDEFERRED_ROUTINE DeferredRoutine;
88 PVOID DeferredContext;
89 PVOID SystemArgument1;
90 PVOID SystemArgument2;
91 PULONG_PTR Lock;
92 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
94 typedef struct _KDEVICE_QUEUE_ENTRY {
95 LIST_ENTRY DeviceListEntry;
96 ULONG SortKey;
97 BOOLEAN Inserted;
98 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
99 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
101 typedef struct _KDEVICE_QUEUE {
102 CSHORT Type;
103 CSHORT Size;
104 LIST_ENTRY DeviceListHead;
105 KSPIN_LOCK Lock;
106 BOOLEAN Busy;
107 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
109 typedef struct _KMUTANT {
110 DISPATCHER_HEADER Header;
111 LIST_ENTRY MutantListEntry;
112 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
113 BOOLEAN Abandoned;
114 UCHAR ApcDisable;
115 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
117 typedef enum _KWAIT_REASON
119 Executive,
120 FreePage,
121 PageIn,
122 PoolAllocation,
123 DelayExecution,
124 Suspended,
125 UserRequest,
126 WrExecutive,
127 WrFreePage,
128 WrPageIn,
129 WrDelayExecution,
130 WrSuspended,
131 WrUserRequest,
132 WrQueue,
133 WrLpcReceive,
134 WrLpcReply,
135 WrVirtualMemory,
136 WrPageOut,
137 WrRendezvous,
138 Spare2,
139 Spare3,
140 Spare4,
141 Spare5,
142 Spare6,
143 WrKernel,
144 MaximumWaitReason,
145 } KWAIT_REASON;
147 typedef struct _ALLOCATE_FUNCTION *PALLOCATE_FUNCTION;
148 typedef struct _IO_TIMER *PIO_TIMER;
149 typedef struct _IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
150 typedef struct _ETHREAD *PETHREAD;
151 typedef struct _FREE_FUNCTION *PFREE_FUNCTION;
152 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
153 typedef struct _EPROCESS *PEPROCESS;
154 typedef struct _ERESOURCE *PERESOURCE;
155 typedef struct _IO_WORKITEM *PIO_WORKITEM;
156 typedef struct _NPAGED_LOOKASIDE_LIST *PNPAGED_LOOKASIDE_LIST;
157 typedef struct _PAGED_LOOKASIDE_LIST *PPAGED_LOOKASIDE_LIST;
158 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
159 typedef struct _OBJECT_HANDLE_INFORMATION *POBJECT_HANDLE_INFORMATION;
160 typedef struct _ZONE_HEADER *PZONE_HEADER;
162 typedef struct _FAST_MUTEX
164 LONG Count;
165 PKTHREAD Owner;
166 ULONG Contention;
167 KEVENT Gate;
168 ULONG OldIrql;
169 } FAST_MUTEX, *PFAST_MUTEX;
171 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
173 typedef struct _VPB {
174 CSHORT Type;
175 CSHORT Size;
176 USHORT Flags;
177 USHORT VolumeLabelLength;
178 struct _DEVICE_OBJECT *DeviceObject;
179 struct _DEVICE_OBJECT *RealDevice;
180 ULONG SerialNumber;
181 ULONG ReferenceCount;
182 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
183 } VPB, *PVPB;
185 typedef enum _POOL_TYPE {
186 NonPagedPool,
187 PagedPool,
188 NonPagedPoolMustSucceed,
189 DontUseThisType,
190 NonPagedPoolCacheAligned,
191 PagedPoolCacheAligned,
192 NonPagedPoolCacheAlignedMustS,
193 MaxPoolType
194 } POOL_TYPE;
196 typedef struct _WAIT_CONTEXT_BLOCK {
197 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
198 struct _DRIVER_CONTROL *DeviceRoutine;
199 PVOID DeviceContext;
200 ULONG NumberOfMapRegisters;
201 PVOID DeviceObject;
202 PVOID CurrentIrp;
203 PKDPC BufferChainingDpc;
204 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
206 #define DO_BUFFERED_IO 0x00000004
207 #define DO_EXCLUSIVE 0x00000008
208 #define DO_DIRECT_IO 0x00000010
209 #define DO_MAP_IO_BUFFER 0x00000020
210 #define DO_DEVICE_INITIALIZING 0x00000080
211 #define DO_SHUTDOWN_REGISTERED 0x00000800
212 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
213 #define DO_POWER_PAGABLE 0x00002000
214 #define DO_POWER_INRUSH 0x00004000
216 #define IO_NO_INCREMENT 0
217 #define IO_CD_ROM_INCREMENT 1
218 #define IO_DISK_INCREMENT 1
219 #define IO_KEYBOARD_INCREMENT 6
220 #define IO_MAILSLOT_INCREMENT 2
221 #define IO_MOUSE_INCREMENT 6
222 #define IO_NAMED_PIPE_INCREMENT 2
223 #define IO_NETWORK_INCREMENT 2
224 #define IO_PARALLEL_INCREMENT 1
225 #define IO_SERIAL_INCREMENT 2
226 #define IO_SOUND_INCREMENT 8
227 #define IO_VIDEO_INCREMENT 1
229 #ifndef DEVICE_TYPE
230 #define DEVICE_TYPE ULONG
231 #endif
232 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
233 #define IRP_MJ_CREATE 0x00
234 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
235 #define IRP_MJ_CLOSE 0x02
236 #define IRP_MJ_READ 0x03
237 #define IRP_MJ_WRITE 0x04
238 #define IRP_MJ_QUERY_INFORMATION 0x05
239 #define IRP_MJ_SET_INFORMATION 0x06
240 #define IRP_MJ_QUERY_EA 0x07
241 #define IRP_MJ_SET_EA 0x08
242 #define IRP_MJ_FLUSH_BUFFERS 0x09
243 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
244 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
245 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
246 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
247 #define IRP_MJ_DEVICE_CONTROL 0x0e
248 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
249 #define IRP_MJ_SHUTDOWN 0x10
250 #define IRP_MJ_LOCK_CONTROL 0x11
251 #define IRP_MJ_CLEANUP 0x12
252 #define IRP_MJ_CREATE_MAILSLOT 0x13
253 #define IRP_MJ_QUERY_SECURITY 0x14
254 #define IRP_MJ_SET_SECURITY 0x15
255 #define IRP_MJ_POWER 0x16
256 #define IRP_MJ_SYSTEM_CONTROL 0x17
257 #define IRP_MJ_DEVICE_CHANGE 0x18
258 #define IRP_MJ_QUERY_QUOTA 0x19
259 #define IRP_MJ_SET_QUOTA 0x1a
260 #define IRP_MJ_PNP 0x1b
262 #define IRP_MN_START_DEVICE 0x00
263 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
264 #define IRP_MN_REMOVE_DEVICE 0x02
265 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
266 #define IRP_MN_STOP_DEVICE 0x04
267 #define IRP_MN_QUERY_STOP_DEVICE 0x05
268 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
269 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
270 #define IRP_MN_QUERY_INTERFACE 0x08
271 #define IRP_MN_QUERY_CAPABILITIES 0x09
272 #define IRP_MN_QUERY_RESOURCES 0x0A
273 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
274 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
275 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
276 #define IRP_MN_READ_CONFIG 0x0F
277 #define IRP_MN_WRITE_CONFIG 0x10
278 #define IRP_MN_EJECT 0x11
279 #define IRP_MN_SET_LOCK 0x12
280 #define IRP_MN_QUERY_ID 0x13
281 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
282 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
283 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
284 #define IRP_MN_SURPRISE_REMOVAL 0x17
285 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
287 #define IRP_MN_WAIT_WAKE 0x00
288 #define IRP_MN_POWER_SEQUENCE 0x01
289 #define IRP_MN_SET_POWER 0x02
290 #define IRP_MN_QUERY_POWER 0x03
292 #define IRP_QUOTA_CHARGED 0x01
293 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
294 #define IRP_ALLOCATED_FIXED_SIZE 0x04
295 #define IRP_LOOKASIDE_ALLOCATION 0x08
297 #define IO_TYPE_ADAPTER 0x01
298 #define IO_TYPE_CONTROLLER 0x02
299 #define IO_TYPE_DEVICE 0x03
300 #define IO_TYPE_DRIVER 0x04
301 #define IO_TYPE_FILE 0x05
302 #define IO_TYPE_IRP 0x06
303 #define IO_TYPE_MASTER_ADAPTER 0x07
304 #define IO_TYPE_OPEN_PACKET 0x08
305 #define IO_TYPE_TIMER 0x09
306 #define IO_TYPE_VPB 0x0a
307 #define IO_TYPE_ERROR_LOG 0x0b
308 #define IO_TYPE_ERROR_MESSAGE 0x0c
309 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
311 typedef struct _DEVICE_OBJECT {
312 CSHORT Type;
313 USHORT Size;
314 LONG ReferenceCount;
315 struct _DRIVER_OBJECT *DriverObject;
316 struct _DEVICE_OBJECT *NextDevice;
317 struct _DEVICE_OBJECT *AttachedDevice;
318 struct _IRP *CurrentIrp;
319 PIO_TIMER Timer;
320 ULONG Flags;
321 ULONG Characteristics;
322 PVPB Vpb;
323 PVOID DeviceExtension;
324 DEVICE_TYPE DeviceType;
325 CCHAR StackSize;
326 union {
327 LIST_ENTRY ListEntry;
328 WAIT_CONTEXT_BLOCK Wcb;
329 } Queue;
330 ULONG AlignmentRequirement;
331 KDEVICE_QUEUE DeviceQueue;
332 KDPC Dpc;
333 ULONG ActiveThreadCount;
334 PSECURITY_DESCRIPTOR SecurityDescriptor;
335 KEVENT DeviceLock;
336 USHORT SectorSize;
337 USHORT Spare1;
338 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
339 PVOID Reserved;
340 } DEVICE_OBJECT;
341 typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
343 typedef struct _DEVICE_RELATIONS {
344 ULONG Count;
345 PDEVICE_OBJECT Objects[1];
346 } DEVICE_RELATIONS;
347 typedef struct _DEVICE_RELATIONS *PDEVICE_RELATIONS;
349 typedef struct _DRIVER_EXTENSION {
350 struct _DRIVER_OBJECT *DriverObject;
351 PDRIVER_ADD_DEVICE AddDevice;
352 ULONG Count;
353 UNICODE_STRING ServiceKeyName;
354 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
356 typedef struct _DRIVER_OBJECT {
357 CSHORT Type;
358 CSHORT Size;
359 PDEVICE_OBJECT DeviceObject;
360 ULONG Flags;
361 PVOID DriverStart;
362 ULONG DriverSize;
363 PVOID DriverSection;
364 PDRIVER_EXTENSION DriverExtension;
365 UNICODE_STRING DriverName;
366 PUNICODE_STRING HardwareDatabase;
367 PVOID FastIoDispatch;
368 PDRIVER_INITIALIZE DriverInit;
369 PDRIVER_STARTIO DriverStartIo;
370 PDRIVER_UNLOAD DriverUnload;
371 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
372 } DRIVER_OBJECT;
373 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
375 /* Irp definitions */
376 typedef UCHAR KIRQL, *PKIRQL;
377 typedef CCHAR KPROCESSOR_MODE;
379 typedef VOID (WINAPI *PDRIVER_CANCEL)(
380 IN struct _DEVICE_OBJECT *DeviceObject,
381 IN struct _IRP *Irp);
383 typedef VOID (WINAPI *PKNORMAL_ROUTINE)(
384 IN PVOID NormalContext,
385 IN PVOID SystemArgument1,
386 IN PVOID SystemArgument2);
388 typedef VOID (WINAPI *PKKERNEL_ROUTINE)(
389 IN struct _KAPC *Apc,
390 IN OUT PKNORMAL_ROUTINE *NormalRoutine,
391 IN OUT PVOID *NormalContext,
392 IN OUT PVOID *SystemArgument1,
393 IN OUT PVOID *SystemArgument2);
395 typedef VOID (WINAPI *PKRUNDOWN_ROUTINE)(
396 IN struct _KAPC *Apc);
398 typedef struct _KAPC {
399 CSHORT Type;
400 CSHORT Size;
401 ULONG Spare0;
402 struct _KTHREAD *Thread;
403 LIST_ENTRY ApcListEntry;
404 PKKERNEL_ROUTINE KernelRoutine;
405 PKRUNDOWN_ROUTINE RundownRoutine;
406 PKNORMAL_ROUTINE NormalRoutine;
407 PVOID NormalContext;
408 PVOID SystemArgument1;
409 PVOID SystemArgument2;
410 CCHAR ApcStateIndex;
411 KPROCESSOR_MODE ApcMode;
412 BOOLEAN Inserted;
413 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
415 typedef struct _IRP {
416 CSHORT Type;
417 USHORT Size;
418 struct _MDL *MdlAddress;
419 ULONG Flags;
420 union {
421 struct _IRP *MasterIrp;
422 LONG IrpCount;
423 PVOID SystemBuffer;
424 } AssociatedIrp;
425 LIST_ENTRY ThreadListEntry;
426 IO_STATUS_BLOCK IoStatus;
427 KPROCESSOR_MODE RequestorMode;
428 BOOLEAN PendingReturned;
429 CHAR StackCount;
430 CHAR CurrentLocation;
431 BOOLEAN Cancel;
432 KIRQL CancelIrql;
433 CCHAR ApcEnvironment;
434 UCHAR AllocationFlags;
435 PIO_STATUS_BLOCK UserIosb;
436 PKEVENT UserEvent;
437 union {
438 struct {
439 PIO_APC_ROUTINE UserApcRoutine;
440 PVOID UserApcContext;
441 } AsynchronousParameters;
442 LARGE_INTEGER AllocationSize;
443 } Overlay;
444 PDRIVER_CANCEL CancelRoutine;
445 PVOID UserBuffer;
446 union {
447 struct {
448 union {
449 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
450 struct {
451 PVOID DriverContext[4];
452 } DUMMYSTRUCTNAME;
453 } DUMMYUNIONNAME1;
454 PETHREAD Thread;
455 PCHAR AuxiliaryBuffer;
456 struct {
457 LIST_ENTRY ListEntry;
458 union {
459 struct _IO_STACK_LOCATION *CurrentStackLocation;
460 ULONG PacketType;
461 } DUMMYUNIONNAME2;
462 } DUMMYSTRUCTNAME;
463 struct _FILE_OBJECT *OriginalFileObject;
464 } Overlay;
465 KAPC Apc;
466 PVOID CompletionKey;
467 } Tail;
468 } IRP;
469 typedef struct _IRP *PIRP;
471 #define IRP_NOCACHE 0x0001
472 #define IRP_PAGING_IO 0x0002
473 #define IRP_MOUNT_COMPLETION 0x0002
474 #define IRP_SYNCHRONOUS_API 0x0004
475 #define IRP_ASSOCIATED_IRP 0x0008
476 #define IRP_BUFFERED_IO 0x0010
477 #define IRP_DEALLOCATE_BUFFER 0x0020
478 #define IRP_INPUT_OPERATION 0x0040
479 #define IRP_SYNCHRONOUS_PAGING_IO 0x0040
480 #define IRP_CREATE_OPERATION 0x0080
481 #define IRP_READ_OPERATION 0x0100
482 #define IRP_WRITE_OPERATION 0x0200
483 #define IRP_CLOSE_OPERATION 0x0400
484 #define IRP_DEFER_IO_COMPLETION 0x0800
485 #define IRP_OB_QUERY_NAME 0x1000
486 #define IRP_HOLD_DEVICE_QUEUE 0x2000
488 typedef VOID (WINAPI *PINTERFACE_REFERENCE)(
489 PVOID Context);
491 typedef VOID (WINAPI *PINTERFACE_DEREFERENCE)(
492 PVOID Context);
494 typedef struct _INTERFACE {
495 USHORT Size;
496 USHORT Version;
497 PVOID Context;
498 PINTERFACE_REFERENCE InterfaceReference;
499 PINTERFACE_DEREFERENCE InterfaceDereference;
500 } INTERFACE, *PINTERFACE;
502 typedef struct _SECTION_OBJECT_POINTERS {
503 PVOID DataSectionObject;
504 PVOID SharedCacheMap;
505 PVOID ImageSectionObject;
506 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
508 typedef struct _IO_COMPLETION_CONTEXT {
509 PVOID Port;
510 PVOID Key;
511 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
513 typedef enum _DEVICE_RELATION_TYPE {
514 BusRelations,
515 EjectionRelations,
516 PowerRelations,
517 RemovalRelations,
518 TargetDeviceRelation,
519 SingleBusRelations
520 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
522 typedef struct _FILE_OBJECT {
523 CSHORT Type;
524 CSHORT Size;
525 PDEVICE_OBJECT DeviceObject;
526 PVPB Vpb;
527 PVOID FsContext;
528 PVOID FsContext2;
529 PSECTION_OBJECT_POINTERS SectionObjectPointer;
530 PVOID PrivateCacheMap;
531 NTSTATUS FinalStatus;
532 struct _FILE_OBJECT *RelatedFileObject;
533 BOOLEAN LockOperation;
534 BOOLEAN DeletePending;
535 BOOLEAN ReadAccess;
536 BOOLEAN WriteAccess;
537 BOOLEAN DeleteAccess;
538 BOOLEAN SharedRead;
539 BOOLEAN SharedWrite;
540 BOOLEAN SharedDelete;
541 ULONG Flags;
542 UNICODE_STRING FileName;
543 LARGE_INTEGER CurrentByteOffset;
544 ULONG Waiters;
545 ULONG Busy;
546 PVOID LastLock;
547 KEVENT Lock;
548 KEVENT Event;
549 PIO_COMPLETION_CONTEXT CompletionContext;
550 } FILE_OBJECT;
551 typedef struct _FILE_OBJECT *PFILE_OBJECT;
553 #define INITIAL_PRIVILEGE_COUNT 3
555 typedef struct _INITIAL_PRIVILEGE_SET {
556 ULONG PrivilegeCount;
557 ULONG Control;
558 LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
559 } INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
561 typedef struct _SECURITY_SUBJECT_CONTEXT {
562 PACCESS_TOKEN ClientToken;
563 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
564 PACCESS_TOKEN PrimaryToken;
565 PVOID ProcessAuditId;
566 } SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
568 typedef struct _ACCESS_STATE {
569 LUID OperationID;
570 BOOLEAN SecurityEvaluated;
571 BOOLEAN GenerateAudit;
572 BOOLEAN GenerateOnClose;
573 BOOLEAN PrivilegesAllocated;
574 ULONG Flags;
575 ACCESS_MASK RemainingDesiredAccess;
576 ACCESS_MASK PreviouslyGrantedAccess;
577 ACCESS_MASK OriginalDesiredAccess;
578 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
579 PSECURITY_DESCRIPTOR SecurityDescriptor;
580 PVOID AuxData;
581 union {
582 INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
583 PRIVILEGE_SET PrivilegeSet;
584 } Privileges;
586 BOOLEAN AuditPrivileges;
587 UNICODE_STRING ObjectName;
588 UNICODE_STRING ObjectTypeName;
589 } ACCESS_STATE, *PACCESS_STATE;
591 typedef struct _IO_SECURITY_CONTEXT {
592 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
593 PACCESS_STATE AccessState;
594 ACCESS_MASK DesiredAccess;
595 ULONG FullCreateOptions;
596 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
598 typedef struct _DEVICE_CAPABILITIES {
599 USHORT Size;
600 USHORT Version;
601 ULONG DeviceD1 : 1;
602 ULONG DeviceD2 : 1;
603 ULONG LockSupported : 1;
604 ULONG EjectSupported : 1;
605 ULONG Removable : 1;
606 ULONG DockDevice : 1;
607 ULONG UniqueID : 1;
608 ULONG SilentInstall : 1;
609 ULONG RawDeviceOK : 1;
610 ULONG SurpriseRemovalOK : 1;
611 ULONG WakeFromD0 : 1;
612 ULONG WakeFromD1 : 1;
613 ULONG WakeFromD2 : 1;
614 ULONG WakeFromD3 : 1;
615 ULONG HardwareDisabled : 1;
616 ULONG NonDynamic : 1;
617 ULONG WarmEjectSupported : 1;
618 ULONG NoDisplayInUI : 1;
619 ULONG Reserved : 14;
620 ULONG Address;
621 ULONG UINumber;
622 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
623 SYSTEM_POWER_STATE SystemWake;
624 DEVICE_POWER_STATE DeviceWake;
625 ULONG D1Latency;
626 ULONG D2Latency;
627 ULONG D3Latency;
628 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
630 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
631 USHORT Version;
632 USHORT Size;
633 GUID Event;
634 GUID InterfaceClassGuid;
635 PUNICODE_STRING SymbolicLinkName;
636 } DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
638 typedef enum _INTERFACE_TYPE {
639 InterfaceTypeUndefined = -1,
640 Internal,
641 Isa,
642 Eisa,
643 MicroChannel,
644 TurboChannel,
645 PCIBus,
646 VMEBus,
647 NuBus,
648 PCMCIABus,
649 CBus,
650 MPIBus,
651 MPSABus,
652 ProcessorInternal,
653 InternalPowerBus,
654 PNPISABus,
655 PNPBus,
656 MaximumInterfaceType
657 } INTERFACE_TYPE, *PINTERFACE_TYPE;
659 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
661 #define IO_RESOURCE_PREFERRED 0x01
662 #define IO_RESOURCE_DEFAULT 0x02
663 #define IO_RESOURCE_ALTERNATIVE 0x08
665 typedef struct _IO_RESOURCE_DESCRIPTOR {
666 UCHAR Option;
667 UCHAR Type;
668 UCHAR ShareDisposition;
669 UCHAR Spare1;
670 USHORT Flags;
671 USHORT Spare2;
672 union {
673 struct {
674 ULONG Length;
675 ULONG Alignment;
676 PHYSICAL_ADDRESS MinimumAddress;
677 PHYSICAL_ADDRESS MaximumAddress;
678 } Port;
679 struct {
680 ULONG Length;
681 ULONG Alignment;
682 PHYSICAL_ADDRESS MinimumAddress;
683 PHYSICAL_ADDRESS MaximumAddress;
684 } Memory;
685 struct {
686 ULONG MinimumVector;
687 ULONG MaximumVector;
688 } Interrupt;
689 struct {
690 ULONG MinimumChannel;
691 ULONG MaximumChannel;
692 } Dma;
693 struct {
694 ULONG Length;
695 ULONG Alignment;
696 PHYSICAL_ADDRESS MinimumAddress;
697 PHYSICAL_ADDRESS MaximumAddress;
698 } Generic;
699 struct {
700 ULONG Data[3];
701 } DevicePrivate;
702 struct {
703 ULONG Length;
704 ULONG MinBusNumber;
705 ULONG MaxBusNumber;
706 ULONG Reserved;
707 } BusNumber;
708 struct {
709 ULONG Priority;
710 ULONG Reserved1;
711 ULONG Reserved2;
712 } ConfigData;
713 } u;
714 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
716 typedef struct _IO_RESOURCE_LIST {
717 USHORT Version;
718 USHORT Revision;
719 ULONG Count;
720 IO_RESOURCE_DESCRIPTOR Descriptors[1];
721 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
723 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
724 ULONG ListSize;
725 INTERFACE_TYPE InterfaceType;
726 ULONG BusNumber;
727 ULONG SlotNumber;
728 ULONG Reserved[3];
729 ULONG AlternativeLists;
730 IO_RESOURCE_LIST List[1];
731 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
733 typedef enum _BUS_QUERY_ID_TYPE {
734 BusQueryDeviceID,
735 BusQueryHardwareIDs,
736 BusQueryCompatibleIDs,
737 BusQueryInstanceID,
738 BusQueryDeviceSerialNumber
739 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
741 typedef enum _CREATE_FILE_TYPE {
742 CreateFileTypeNone,
743 CreateFileTypeNamedPipe,
744 CreateFileTypeMailslot
745 } CREATE_FILE_TYPE;
747 typedef enum {
748 DevicePropertyDeviceDescription,
749 DevicePropertyHardwareID,
750 DevicePropertyCompatibleIDs,
751 DevicePropertyBootConfiguration,
752 DevicePropertyBootConfigurationTranslated,
753 DevicePropertyClassName,
754 DevicePropertyClassGuid,
755 DevicePropertyDriverKeyName,
756 DevicePropertyManufacturer,
757 DevicePropertyFriendlyName,
758 DevicePropertyLocationInformation,
759 DevicePropertyPhysicalDeviceObjectName,
760 DevicePropertyBusTypeGuid,
761 DevicePropertyLegacyBusType,
762 DevicePropertyBusNumber,
763 DevicePropertyEnumeratorName,
764 DevicePropertyAddress,
765 DevicePropertyUINumber,
766 DevicePropertyInstallState,
767 DevicePropertyRemovalPolicy
768 } DEVICE_REGISTRY_PROPERTY;
770 typedef enum _DEVICE_TEXT_TYPE {
771 DeviceTextDescription,
772 DeviceTextLocationInformation
773 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
775 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
776 DeviceUsageTypeUndefined,
777 DeviceUsageTypePaging,
778 DeviceUsageTypeHibernation,
779 DeviceUsageTypeDumpFile
780 } DEVICE_USAGE_NOTIFICATION_TYPE;
782 typedef struct _POWER_SEQUENCE {
783 ULONG SequenceD1;
784 ULONG SequenceD2;
785 ULONG SequenceD3;
786 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
788 typedef enum _POWER_STATE_TYPE {
789 SystemPowerState,
790 DevicePowerState
791 } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
793 typedef union _POWER_STATE {
794 SYSTEM_POWER_STATE SystemState;
795 DEVICE_POWER_STATE DeviceState;
796 } POWER_STATE, *PPOWER_STATE;
798 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
799 UCHAR Type;
800 UCHAR ShareDisposition;
801 USHORT Flags;
802 union {
803 struct {
804 PHYSICAL_ADDRESS Start;
805 ULONG Length;
806 } Generic;
807 struct {
808 PHYSICAL_ADDRESS Start;
809 ULONG Length;
810 } Port;
811 struct {
812 ULONG Level;
813 ULONG Vector;
814 ULONG Affinity;
815 } Interrupt;
816 struct {
817 PHYSICAL_ADDRESS Start;
818 ULONG Length;
819 } Memory;
820 struct {
821 ULONG Channel;
822 ULONG Port;
823 ULONG Reserved1;
824 } Dma;
825 struct {
826 ULONG Data[3];
827 } DevicePrivate;
828 struct {
829 ULONG Start;
830 ULONG Length;
831 ULONG Reserved;
832 } BusNumber;
833 struct {
834 ULONG DataSize;
835 ULONG Reserved1;
836 ULONG Reserved2;
837 } DeviceSpecificData;
838 } u;
839 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
841 typedef struct _CM_PARTIAL_RESOURCE_LIST {
842 USHORT Version;
843 USHORT Revision;
844 ULONG Count;
845 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
846 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
848 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
849 INTERFACE_TYPE InterfaceType;
850 ULONG BusNumber;
851 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
852 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
854 typedef struct _CM_RESOURCE_LIST {
855 ULONG Count;
856 CM_FULL_RESOURCE_DESCRIPTOR List[1];
857 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
859 typedef NTSTATUS (WINAPI *PIO_COMPLETION_ROUTINE)(
860 IN struct _DEVICE_OBJECT *DeviceObject,
861 IN struct _IRP *Irp,
862 IN PVOID Context);
864 #define SL_PENDING_RETURNED 0x01
865 #define SL_INVOKE_ON_CANCEL 0x20
866 #define SL_INVOKE_ON_SUCCESS 0x40
867 #define SL_INVOKE_ON_ERROR 0x80
869 #if !defined(_WIN64)
870 #include <pshpack4.h>
871 #endif
872 typedef struct _IO_STACK_LOCATION {
873 UCHAR MajorFunction;
874 UCHAR MinorFunction;
875 UCHAR Flags;
876 UCHAR Control;
877 union {
878 struct {
879 PIO_SECURITY_CONTEXT SecurityContext;
880 ULONG Options;
881 USHORT POINTER_ALIGNMENT FileAttributes;
882 USHORT ShareAccess;
883 ULONG POINTER_ALIGNMENT EaLength;
884 } Create;
885 struct {
886 ULONG Length;
887 ULONG POINTER_ALIGNMENT Key;
888 LARGE_INTEGER ByteOffset;
889 } Read;
890 struct {
891 ULONG Length;
892 ULONG POINTER_ALIGNMENT Key;
893 LARGE_INTEGER ByteOffset;
894 } Write;
895 struct {
896 ULONG Length;
897 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
898 } QueryFile;
899 struct {
900 ULONG Length;
901 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
902 PFILE_OBJECT FileObject;
903 union {
904 struct {
905 BOOLEAN ReplaceIfExists;
906 BOOLEAN AdvanceOnly;
907 } DUMMYSTRUCTNAME;
908 ULONG ClusterCount;
909 HANDLE DeleteHandle;
910 } DUMMYUNIONNAME;
911 } SetFile;
912 struct {
913 ULONG Length;
914 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
915 } QueryVolume;
916 struct {
917 ULONG OutputBufferLength;
918 ULONG POINTER_ALIGNMENT InputBufferLength;
919 ULONG POINTER_ALIGNMENT IoControlCode;
920 PVOID Type3InputBuffer;
921 } DeviceIoControl;
922 struct {
923 SECURITY_INFORMATION SecurityInformation;
924 ULONG POINTER_ALIGNMENT Length;
925 } QuerySecurity;
926 struct {
927 SECURITY_INFORMATION SecurityInformation;
928 PSECURITY_DESCRIPTOR SecurityDescriptor;
929 } SetSecurity;
930 struct {
931 PVPB Vpb;
932 PDEVICE_OBJECT DeviceObject;
933 } MountVolume;
934 struct {
935 PVPB Vpb;
936 PDEVICE_OBJECT DeviceObject;
937 } VerifyVolume;
938 struct {
939 struct _SCSI_REQUEST_BLOCK *Srb;
940 } Scsi;
941 struct {
942 DEVICE_RELATION_TYPE Type;
943 } QueryDeviceRelations;
944 struct {
945 const GUID *InterfaceType;
946 USHORT Size;
947 USHORT Version;
948 PINTERFACE Interface;
949 PVOID InterfaceSpecificData;
950 } QueryInterface;
951 struct {
952 PDEVICE_CAPABILITIES Capabilities;
953 } DeviceCapabilities;
954 struct {
955 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
956 } FilterResourceRequirements;
957 struct {
958 ULONG WhichSpace;
959 PVOID Buffer;
960 ULONG Offset;
961 ULONG POINTER_ALIGNMENT Length;
962 } ReadWriteConfig;
963 struct {
964 BOOLEAN Lock;
965 } SetLock;
966 struct {
967 BUS_QUERY_ID_TYPE IdType;
968 } QueryId;
969 struct {
970 DEVICE_TEXT_TYPE DeviceTextType;
971 LCID POINTER_ALIGNMENT LocaleId;
972 } QueryDeviceText;
973 struct {
974 BOOLEAN InPath;
975 BOOLEAN Reserved[3];
976 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
977 } UsageNotification;
978 struct {
979 SYSTEM_POWER_STATE PowerState;
980 } WaitWake;
981 struct {
982 PPOWER_SEQUENCE PowerSequence;
983 } PowerSequence;
984 struct {
985 ULONG SystemContext;
986 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
987 POWER_STATE POINTER_ALIGNMENT State;
988 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
989 } Power;
990 struct {
991 PCM_RESOURCE_LIST AllocatedResources;
992 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
993 } StartDevice;
994 struct {
995 ULONG_PTR ProviderId;
996 PVOID DataPath;
997 ULONG BufferSize;
998 PVOID Buffer;
999 } WMI;
1000 struct {
1001 PVOID Argument1;
1002 PVOID Argument2;
1003 PVOID Argument3;
1004 PVOID Argument4;
1005 } Others;
1006 } Parameters;
1007 PDEVICE_OBJECT DeviceObject;
1008 PFILE_OBJECT FileObject;
1009 PIO_COMPLETION_ROUTINE CompletionRoutine;
1010 PVOID Context;
1011 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
1012 #if !defined(_WIN64)
1013 #include <poppack.h>
1014 #endif
1016 /* MDL definitions */
1018 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1019 #define MDL_PAGES_LOCKED 0x0002
1020 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1021 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1022 #define MDL_PARTIAL 0x0010
1023 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1024 #define MDL_IO_PAGE_READ 0x0040
1025 #define MDL_WRITE_OPERATION 0x0080
1026 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1027 #define MDL_FREE_EXTRA_PTES 0x0200
1028 #define MDL_DESCRIBES_AWE 0x0400
1029 #define MDL_IO_SPACE 0x0800
1030 #define MDL_NETWORK_HEADER 0x1000
1031 #define MDL_MAPPING_CAN_FAIL 0x2000
1032 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1033 #define MDL_INTERNAL 0x8000
1035 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
1036 MDL_PAGES_LOCKED | \
1037 MDL_SOURCE_IS_NONPAGED_POOL | \
1038 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1039 MDL_PARENT_MAPPED_SYSTEM_VA | \
1040 MDL_SYSTEM_VA | \
1041 MDL_IO_SPACE )
1043 typedef struct _MDL {
1044 struct _MDL *Next;
1045 CSHORT Size;
1046 CSHORT MdlFlags;
1047 struct _EPROCESS *Process;
1048 PVOID MappedSystemVa;
1049 PVOID StartVa;
1050 ULONG ByteCount;
1051 ULONG ByteOffset;
1052 } MDL, *PMDL;
1054 typedef MDL *PMDLX;
1055 typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
1057 static inline void MmInitializeMdl(MDL *mdl, void *va, SIZE_T length)
1059 mdl->Next = NULL;
1060 mdl->Size = sizeof(MDL) + sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(va, length);
1061 mdl->MdlFlags = 0;
1062 mdl->StartVa = (void *)PAGE_ALIGN(va);
1063 mdl->ByteOffset = BYTE_OFFSET(va);
1064 mdl->ByteCount = length;
1067 typedef struct _KTIMER {
1068 DISPATCHER_HEADER Header;
1069 ULARGE_INTEGER DueTime;
1070 LIST_ENTRY TimerListEntry;
1071 struct _KDPC *Dpc;
1072 LONG Period;
1073 } KTIMER, *PKTIMER;
1075 typedef struct _KSYSTEM_TIME {
1076 ULONG LowPart;
1077 LONG High1Time;
1078 LONG High2Time;
1079 } KSYSTEM_TIME, *PKSYSTEM_TIME;
1081 typedef enum _NT_PRODUCT_TYPE {
1082 NtProductWinNt = 1,
1083 NtProductLanManNt,
1084 NtProductServer
1085 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
1087 #define PROCESSOR_FEATURE_MAX 64
1089 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
1091 StandardDesign,
1092 NEC98x86,
1093 EndAlternatives
1094 } ALTERNATIVE_ARCHITECTURE_TYPE;
1096 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1097 #define NX_SUPPORT_POLICY_ALWAYSON 1
1098 #define NX_SUPPORT_POLICY_OPTIN 2
1099 #define NX_SUPPORT_POLICY_OPTOUT 3
1101 #define MAX_WOW64_SHARED_ENTRIES 16
1103 typedef struct _KUSER_SHARED_DATA {
1104 ULONG TickCountLowDeprecated;
1105 ULONG TickCountMultiplier;
1106 volatile KSYSTEM_TIME InterruptTime;
1107 volatile KSYSTEM_TIME SystemTime;
1108 volatile KSYSTEM_TIME TimeZoneBias;
1109 USHORT ImageNumberLow;
1110 USHORT ImageNumberHigh;
1111 WCHAR NtSystemRoot[260];
1112 ULONG MaxStackTraceDepth;
1113 ULONG CryptoExponent;
1114 ULONG TimeZoneId;
1115 ULONG LargePageMinimum;
1116 ULONG Reserved2[7];
1117 NT_PRODUCT_TYPE NtProductType;
1118 BOOLEAN ProductTypeIsValid;
1119 ULONG NtMajorVersion;
1120 ULONG NtMinorVersion;
1121 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
1122 ULONG Reserved1;
1123 ULONG Reserved3;
1124 volatile ULONG TimeSlip;
1125 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
1126 LARGE_INTEGER SystemExpirationDate;
1127 ULONG SuiteMask;
1128 BOOLEAN KdDebuggerEnabled;
1129 UCHAR NXSupportPolicy;
1130 volatile ULONG ActiveConsoleId;
1131 volatile ULONG DismountCount;
1132 ULONG ComPlusPackage;
1133 ULONG LastSystemRITEventTickCount;
1134 ULONG NumberOfPhysicalPages;
1135 BOOLEAN SafeBootMode;
1136 ULONG TraceLogging;
1137 ULONGLONG TestRetInstruction;
1138 ULONG SystemCall;
1139 ULONG SystemCallReturn;
1140 ULONGLONG SystemCallPad[3];
1141 union {
1142 volatile KSYSTEM_TIME TickCount;
1143 volatile ULONG64 TickCountQuad;
1144 } DUMMYUNIONNAME;
1145 ULONG Cookie;
1146 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
1147 } KSHARED_USER_DATA, *PKSHARED_USER_DATA;
1149 typedef enum _MEMORY_CACHING_TYPE {
1150 MmNonCached = 0,
1151 MmCached = 1,
1152 MmWriteCombined = 2,
1153 MmHardwareCoherentCached = 3,
1154 MmNonCachedUnordered = 4,
1155 MmUSWCCached = 5,
1156 MmMaximumCacheType = 6
1157 } MEMORY_CACHING_TYPE;
1159 typedef enum _MM_PAGE_PRIORITY {
1160 LowPagePriority,
1161 NormalPagePriority = 16,
1162 HighPagePriority = 32
1163 } MM_PAGE_PRIORITY;
1165 typedef enum _MM_SYSTEM_SIZE
1167 MmSmallSystem,
1168 MmMediumSystem,
1169 MmLargeSystem
1170 } MM_SYSTEMSIZE;
1172 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
1173 BOOLEAN Removed;
1174 BOOLEAN Reserved[3];
1175 LONG IoCount;
1176 KEVENT RemoveEvent;
1177 } IO_REMOVE_LOCK_COMMON_BLOCK;
1179 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK *PIO_REMOVE_LOCK_TRACKING_BLOCK;
1181 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
1182 LONG Signature;
1183 LONG HighWatermark;
1184 LONGLONG MaxLockedTicks;
1185 LONG AllocateTag;
1186 LIST_ENTRY LockList;
1187 KSPIN_LOCK Spin;
1188 LONG LowMemoryCount;
1189 ULONG Reserved1[4];
1190 PVOID Reserved2;
1191 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
1192 } IO_REMOVE_LOCK_DBG_BLOCK;
1194 typedef struct _IO_REMOVE_LOCK {
1195 IO_REMOVE_LOCK_COMMON_BLOCK Common;
1196 IO_REMOVE_LOCK_DBG_BLOCK Dbg;
1197 } IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
1199 typedef enum {
1200 IoReadAccess,
1201 IoWriteAccess,
1202 IoModifyAccess
1203 } LOCK_OPERATION;
1205 typedef struct _CALLBACK_OBJECT
1207 ULONG Signature;
1208 KSPIN_LOCK Lock;
1209 LIST_ENTRY RegisteredCallbacks;
1210 BOOLEAN AllowMultipleCallbacks;
1211 UCHAR reserved[3];
1212 } CALLBACK_OBJECT, *PCALLBACK_OBJECT;
1214 typedef struct _KSPIN_LOCK_QUEUE {
1215 struct _KSPIN_LOCK_QUEUE * volatile Next;
1216 volatile PKSPIN_LOCK Lock;
1217 } KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
1219 typedef struct _KLOCK_QUEUE_HANDLE {
1220 KSPIN_LOCK_QUEUE LockQueue;
1221 KIRQL OldIrql;
1222 } KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
1224 typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION)(void *CallbackContext, void *Argument1, void *Argument2);
1225 typedef EX_CALLBACK_FUNCTION *PEX_CALLBACK_FUNCTION;
1227 typedef ULONG OB_OPERATION;
1229 typedef struct _OB_PRE_CREATE_HANDLE_INFORMATION {
1230 ACCESS_MASK DesiredAccess;
1231 ACCESS_MASK OriginalDesiredAccess;
1232 } OB_PRE_CREATE_HANDLE_INFORMATION, *POB_PRE_CREATE_HANDLE_INFORMATION;
1234 typedef struct _OB_PRE_DUPLICATE_HANDLE_INFORMATION {
1235 ACCESS_MASK DesiredAccess;
1236 ACCESS_MASK OriginalDesiredAccess;
1237 PVOID SourceProcess;
1238 PVOID TargetProcess;
1239 } OB_PRE_DUPLICATE_HANDLE_INFORMATION, *POB_PRE_DUPLICATE_HANDLE_INFORMATION;
1241 typedef union _OB_PRE_OPERATION_PARAMETERS {
1242 OB_PRE_CREATE_HANDLE_INFORMATION CreateHandleInformation;
1243 OB_PRE_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation;
1244 } OB_PRE_OPERATION_PARAMETERS, *POB_PRE_OPERATION_PARAMETERS;
1246 typedef struct _OB_PRE_OPERATION_INFORMATION {
1247 OB_OPERATION Operation;
1248 union {
1249 ULONG Flags;
1250 struct {
1251 ULONG KernelHandle:1;
1252 ULONG Reserved:31;
1253 } DUMMYSTRUCTNAME;
1254 } DUMMYUNIONNAME;
1255 PVOID Object;
1256 POBJECT_TYPE ObjectType;
1257 PVOID CallContext;
1258 POB_PRE_OPERATION_PARAMETERS Parameters;
1259 } OB_PRE_OPERATION_INFORMATION, *POB_PRE_OPERATION_INFORMATION;
1261 typedef struct _OB_POST_CREATE_HANDLE_INFORMATION {
1262 ACCESS_MASK GrantedAccess;
1263 } OB_POST_CREATE_HANDLE_INFORMATION, *POB_POST_CREATE_HANDLE_INFORMATION;
1265 typedef struct _OB_POST_DUPLICATE_HANDLE_INFORMATION {
1266 ACCESS_MASK GrantedAccess;
1267 } OB_POST_DUPLICATE_HANDLE_INFORMATION, *POB_POST_DUPLICATE_HANDLE_INFORMATION;
1269 typedef union _OB_POST_OPERATION_PARAMETERS {
1270 OB_POST_CREATE_HANDLE_INFORMATION CreateHandleInformation;
1271 OB_POST_DUPLICATE_HANDLE_INFORMATION DuplicateHandleInformation;
1272 } OB_POST_OPERATION_PARAMETERS, *POB_POST_OPERATION_PARAMETERS;
1274 typedef struct _OB_POST_OPERATION_INFORMATION {
1275 OB_OPERATION Operation;
1276 union {
1277 ULONG Flags;
1278 struct {
1279 ULONG KernelHandle:1;
1280 ULONG Reserved:31;
1281 } DUMMYSTRUCTNAME;
1282 } DUMMYUNIONNAME;
1283 PVOID Object;
1284 POBJECT_TYPE ObjectType;
1285 PVOID CallContext;
1286 NTSTATUS ReturnStatus;
1287 POB_POST_OPERATION_PARAMETERS Parameters;
1288 } OB_POST_OPERATION_INFORMATION,*POB_POST_OPERATION_INFORMATION;
1290 typedef enum _OB_PREOP_CALLBACK_STATUS {
1291 OB_PREOP_SUCCESS
1292 } OB_PREOP_CALLBACK_STATUS, *POB_PREOP_CALLBACK_STATUS;
1294 typedef OB_PREOP_CALLBACK_STATUS (WINAPI *POB_PRE_OPERATION_CALLBACK)(void *context, POB_PRE_OPERATION_INFORMATION information);
1295 typedef void (WINAPI *POB_POST_OPERATION_CALLBACK)(void *context, POB_POST_OPERATION_INFORMATION information);
1297 typedef struct _OB_OPERATION_REGISTRATION {
1298 POBJECT_TYPE *ObjectType;
1299 OB_OPERATION Operations;
1300 POB_PRE_OPERATION_CALLBACK PreOperation;
1301 POB_POST_OPERATION_CALLBACK PostOperation;
1302 } OB_OPERATION_REGISTRATION, *POB_OPERATION_REGISTRATION;
1304 typedef struct _OB_CALLBACK_REGISTRATION {
1305 USHORT Version;
1306 USHORT OperationRegistrationCount;
1307 UNICODE_STRING Altitude;
1308 PVOID RegistrationContext;
1309 OB_OPERATION_REGISTRATION *OperationRegistration;
1310 } OB_CALLBACK_REGISTRATION, *POB_CALLBACK_REGISTRATION;
1312 #define OB_FLT_REGISTRATION_VERSION_0100 0x0100
1313 #define OB_FLT_REGISTRATION_VERSION OB_FLT_REGISTRATION_VERSION_0100
1315 typedef enum _DIRECTORY_NOTIFY_INFORMATION_CLASS {
1316 DirectoryNotifyInformation = 1,
1317 DirectoryNotifyExtendedInformation
1318 } DIRECTORY_NOTIFY_INFORMATION_CLASS, *PDIRECTORY_NOTIFY_INFORMATION_CLASS;
1320 NTSTATUS WINAPI ObCloseHandle(IN HANDLE handle);
1322 #ifdef NONAMELESSUNION
1323 # ifdef NONAMELESSSTRUCT
1324 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1325 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1326 static inline void IoSkipCurrentIrpStackLocation(IRP *irp) {irp->Tail.Overlay.s.u2.CurrentStackLocation++; irp->CurrentLocation++;}
1327 # else
1328 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1329 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1330 static inline void IoSkipCurrentIrpStackLocation(IRP *irp) {irp->Tail.Overlay.u2.CurrentStackLocation++; irp->CurrentLocation++;}
1331 # endif
1332 #else
1333 # ifdef NONAMELESSSTRUCT
1334 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1335 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1336 static inline void IoSkipCurrentIrpStackLocation(IRP *irp) {irp->Tail.Overlay.s.CurrentStackLocation++; irp->CurrentLocation++;}
1337 # else
1338 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1339 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1340 static inline void IoSkipCurrentIrpStackLocation(IRP *irp) {irp->Tail.Overlay.CurrentStackLocation++; irp->CurrentLocation++;}
1341 # endif
1342 #endif
1344 static inline void IoSetCompletionRoutine(IRP *irp, PIO_COMPLETION_ROUTINE routine, void *context,
1345 BOOLEAN on_success, BOOLEAN on_error, BOOLEAN on_cancel)
1347 IO_STACK_LOCATION *irpsp = IoGetNextIrpStackLocation(irp);
1348 irpsp->CompletionRoutine = routine;
1349 irpsp->Context = context;
1350 irpsp->Control = 0;
1351 if (on_success) irpsp->Control |= SL_INVOKE_ON_SUCCESS;
1352 if (on_error) irpsp->Control |= SL_INVOKE_ON_ERROR;
1353 if (on_cancel) irpsp->Control |= SL_INVOKE_ON_CANCEL;
1356 #define KernelMode 0
1357 #define UserMode 1
1359 /* directory object access rights */
1360 #define DIRECTORY_QUERY 0x0001
1361 #define DIRECTORY_TRAVERSE 0x0002
1362 #define DIRECTORY_CREATE_OBJECT 0x0004
1363 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1364 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1366 /* symbolic link access rights */
1367 #define SYMBOLIC_LINK_QUERY 0x0001
1368 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1370 void WINAPI ExAcquireFastMutexUnsafe(PFAST_MUTEX);
1371 PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T);
1372 PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T);
1373 PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG);
1374 PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG);
1375 void WINAPI ExFreePool(PVOID);
1376 void WINAPI ExFreePoolWithTag(PVOID,ULONG);
1377 PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
1378 PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPIN_LOCK);
1379 void WINAPI ExReleaseFastMutexUnsafe(PFAST_MUTEX);
1381 NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOID*);
1382 PVOID WINAPI IoAllocateErrorLogEntry(PVOID,UCHAR);
1383 PIRP WINAPI IoAllocateIrp(CCHAR,BOOLEAN);
1384 PMDL WINAPI IoAllocateMdl(PVOID,ULONG,BOOLEAN,BOOLEAN,IRP*);
1385 PDEVICE_OBJECT WINAPI IoAttachDeviceToDeviceStack(PDEVICE_OBJECT,PDEVICE_OBJECT);
1386 PIRP WINAPI IoBuildDeviceIoControlRequest(ULONG,DEVICE_OBJECT*,PVOID,ULONG,PVOID,ULONG,BOOLEAN,PKEVENT,IO_STATUS_BLOCK*);
1387 PIRP WINAPI IoBuildSynchronousFsdRequest(ULONG,DEVICE_OBJECT*,PVOID,ULONG,PLARGE_INTEGER,PKEVENT,IO_STATUS_BLOCK*);
1388 NTSTATUS WINAPI IoCallDriver(DEVICE_OBJECT*,IRP*);
1389 VOID WINAPI IoCompleteRequest(IRP*,UCHAR);
1390 NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);
1391 NTSTATUS WINAPI IoCreateDriver(UNICODE_STRING*,PDRIVER_INITIALIZE);
1392 NTSTATUS WINAPI IoCreateSymbolicLink(UNICODE_STRING*,UNICODE_STRING*);
1393 void WINAPI IoDeleteDevice(DEVICE_OBJECT*);
1394 void WINAPI IoDeleteDriver(DRIVER_OBJECT*);
1395 NTSTATUS WINAPI IoDeleteSymbolicLink(UNICODE_STRING*);
1396 void WINAPI IoFreeIrp(IRP*);
1397 void WINAPI IoFreeMdl(MDL*);
1398 PEPROCESS WINAPI IoGetCurrentProcess(void);
1399 NTSTATUS WINAPI IoGetDeviceInterfaces(const GUID*,PDEVICE_OBJECT,ULONG,PWSTR*);
1400 NTSTATUS WINAPI IoGetDeviceObjectPointer(UNICODE_STRING*,ACCESS_MASK,PFILE_OBJECT*,PDEVICE_OBJECT*);
1401 NTSTATUS WINAPI IoGetDeviceProperty(PDEVICE_OBJECT,DEVICE_REGISTRY_PROPERTY,ULONG,PVOID,PULONG);
1402 PVOID WINAPI IoGetDriverObjectExtension(PDRIVER_OBJECT,PVOID);
1403 PDEVICE_OBJECT WINAPI IoGetRelatedDeviceObject(PFILE_OBJECT);
1404 void WINAPI IoInitializeIrp(IRP*,USHORT,CCHAR);
1405 VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK,ULONG,ULONG,ULONG,ULONG);
1406 void WINAPI IoInvalidateDeviceRelations(PDEVICE_OBJECT,DEVICE_RELATION_TYPE);
1407 void WINAPI IoReleaseCancelSpinLock(KIRQL);
1408 NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
1410 PKTHREAD WINAPI KeGetCurrentThread(void);
1411 void WINAPI KeInitializeSemaphore(PRKSEMAPHORE,LONG,LONG);
1412 void WINAPI KeInitializeTimerEx(PKTIMER,TIMER_TYPE);
1413 void WINAPI KeQuerySystemTime(LARGE_INTEGER*);
1414 void WINAPI KeQueryTickCount(LARGE_INTEGER*);
1415 ULONG WINAPI KeQueryTimeIncrement(void);
1416 LONG WINAPI KeReleaseMutex(PRKMUTEX,BOOLEAN);
1417 LONG WINAPI KeReleaseSemaphore(PRKSEMAPHORE,KPRIORITY,LONG,BOOLEAN);
1418 LONG WINAPI KeResetEvent(PRKEVENT);
1419 LONG WINAPI KeSetEvent(PRKEVENT,KPRIORITY,BOOLEAN);
1420 KPRIORITY WINAPI KeSetPriorityThread(PKTHREAD,KPRIORITY);
1421 void WINAPI KeSetSystemAffinityThread(KAFFINITY);
1423 PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS);
1424 PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T);
1425 PMDL WINAPI MmAllocatePagesForMdl(PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,SIZE_T);
1426 void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T);
1427 void * WINAPI MmGetSystemRoutineAddress(UNICODE_STRING*);
1428 PVOID WINAPI MmMapLockedPagesSpecifyCache(PMDL,KPROCESSOR_MODE,MEMORY_CACHING_TYPE,PVOID,ULONG,ULONG);
1429 MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void);
1430 void WINAPI MmProbeAndLockPages(PMDLX, KPROCESSOR_MODE, LOCK_OPERATION);
1432 static inline void *MmGetSystemAddressForMdlSafe(MDL *mdl, ULONG priority)
1434 if (mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | MDL_SOURCE_IS_NONPAGED_POOL))
1435 return mdl->MappedSystemVa;
1436 else
1437 return MmMapLockedPagesSpecifyCache(mdl, KernelMode, MmCached, NULL, FALSE, priority);
1440 void WINAPI ObDereferenceObject(void*);
1441 USHORT WINAPI ObGetFilterVersion(void);
1442 NTSTATUS WINAPI ObRegisterCallbacks(POB_CALLBACK_REGISTRATION*, void**);
1443 NTSTATUS WINAPI ObReferenceObjectByHandle(HANDLE,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,PVOID*,POBJECT_HANDLE_INFORMATION);
1444 NTSTATUS WINAPI ObReferenceObjectByName(UNICODE_STRING*,ULONG,ACCESS_STATE*,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,void*,void**);
1445 NTSTATUS WINAPI ObReferenceObjectByPointer(void*,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE);
1446 void WINAPI ObUnRegisterCallbacks(void*);
1448 POWER_STATE WINAPI PoSetPowerState(PDEVICE_OBJECT,POWER_STATE_TYPE,POWER_STATE);
1449 NTSTATUS WINAPI PsCreateSystemThread(PHANDLE,ULONG,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PKSTART_ROUTINE,PVOID);
1450 #define PsGetCurrentProcess() IoGetCurrentProcess()
1451 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1452 HANDLE WINAPI PsGetCurrentProcessId(void);
1453 HANDLE WINAPI PsGetCurrentThreadId(void);
1454 BOOLEAN WINAPI PsGetVersion(ULONG*,ULONG*,ULONG*,UNICODE_STRING*);
1455 NTSTATUS WINAPI PsTerminateSystemThread(NTSTATUS);
1457 NTSTATUS WINAPI ZwAddBootEntry(PUNICODE_STRING,PUNICODE_STRING);
1458 NTSTATUS WINAPI ZwAccessCheckAndAuditAlarm(PUNICODE_STRING,HANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,ACCESS_MASK,PGENERIC_MAPPING,BOOLEAN,PACCESS_MASK,PBOOLEAN,PBOOLEAN);
1459 NTSTATUS WINAPI ZwAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
1460 NTSTATUS WINAPI ZwAlertThread(HANDLE ThreadHandle);
1461 NTSTATUS WINAPI ZwAllocateVirtualMemory(HANDLE,PVOID*,ULONG,SIZE_T*,ULONG,ULONG);
1462 NTSTATUS WINAPI ZwCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
1463 NTSTATUS WINAPI ZwCancelTimer(HANDLE, BOOLEAN*);
1464 NTSTATUS WINAPI ZwClearEvent(HANDLE);
1465 NTSTATUS WINAPI ZwClose(HANDLE);
1466 NTSTATUS WINAPI ZwCloseObjectAuditAlarm(PUNICODE_STRING,HANDLE,BOOLEAN);
1467 NTSTATUS WINAPI ZwConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1468 NTSTATUS WINAPI ZwCreateDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1469 NTSTATUS WINAPI ZwCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1470 NTSTATUS WINAPI ZwCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1471 NTSTATUS WINAPI ZwCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1472 NTSTATUS WINAPI ZwCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1473 NTSTATUS WINAPI ZwCreateSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PUNICODE_STRING);
1474 NTSTATUS WINAPI ZwCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1475 NTSTATUS WINAPI ZwDeleteAtom(RTL_ATOM);
1476 NTSTATUS WINAPI ZwDeleteFile(POBJECT_ATTRIBUTES);
1477 NTSTATUS WINAPI ZwDeleteKey(HANDLE);
1478 NTSTATUS WINAPI ZwDeleteValueKey(HANDLE,const UNICODE_STRING *);
1479 NTSTATUS WINAPI ZwDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1480 NTSTATUS WINAPI ZwDisplayString(PUNICODE_STRING);
1481 NTSTATUS WINAPI ZwDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1482 NTSTATUS WINAPI ZwDuplicateToken(HANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,PHANDLE);
1483 NTSTATUS WINAPI ZwEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1484 NTSTATUS WINAPI ZwEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1485 NTSTATUS WINAPI ZwFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
1486 NTSTATUS WINAPI ZwFlushKey(HANDLE);
1487 NTSTATUS WINAPI ZwFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
1488 NTSTATUS WINAPI ZwFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1489 NTSTATUS WINAPI ZwFsControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1490 NTSTATUS WINAPI ZwInitiatePowerAction(POWER_ACTION,SYSTEM_POWER_STATE,ULONG,BOOLEAN);
1491 NTSTATUS WINAPI ZwLoadDriver(const UNICODE_STRING *);
1492 NTSTATUS WINAPI ZwLoadKey(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES *);
1493 NTSTATUS WINAPI ZwLockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1494 NTSTATUS WINAPI ZwMakeTemporaryObject(HANDLE);
1495 NTSTATUS WINAPI ZwMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
1496 NTSTATUS WINAPI ZwNotifyChangeKey(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1497 NTSTATUS WINAPI ZwOpenDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1498 NTSTATUS WINAPI ZwOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1499 NTSTATUS WINAPI ZwOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1500 NTSTATUS WINAPI ZwOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1501 NTSTATUS WINAPI ZwOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1502 NTSTATUS WINAPI ZwOpenProcessToken(HANDLE,DWORD,HANDLE *);
1503 NTSTATUS WINAPI ZwOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1504 NTSTATUS WINAPI ZwOpenSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1505 NTSTATUS WINAPI ZwOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1506 NTSTATUS WINAPI ZwOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1507 NTSTATUS WINAPI ZwOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1508 NTSTATUS WINAPI ZwPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG);
1509 NTSTATUS WINAPI ZwPulseEvent(HANDLE,PULONG);
1510 NTSTATUS WINAPI ZwQueryDefaultLocale(BOOLEAN,LCID*);
1511 NTSTATUS WINAPI ZwQueryDefaultUILanguage(LANGID*);
1512 NTSTATUS WINAPI ZwQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
1513 NTSTATUS WINAPI ZwQueryDirectoryObject(HANDLE,PDIRECTORY_BASIC_INFORMATION,ULONG,BOOLEAN,BOOLEAN,PULONG,PULONG);
1514 NTSTATUS WINAPI ZwQueryEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PVOID,BOOLEAN);
1515 NTSTATUS WINAPI ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES*,FILE_NETWORK_OPEN_INFORMATION*);
1516 NTSTATUS WINAPI ZwQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1517 NTSTATUS WINAPI ZwQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
1518 NTSTATUS WINAPI ZwQueryInformationToken(HANDLE,DWORD,PVOID,DWORD,LPDWORD);
1519 NTSTATUS WINAPI ZwQueryInstallUILanguage(LANGID*);
1520 NTSTATUS WINAPI ZwQueryKey(HANDLE,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1521 NTSTATUS WINAPI ZwQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
1522 NTSTATUS WINAPI ZwQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
1523 NTSTATUS WINAPI ZwQuerySection(HANDLE,SECTION_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1524 NTSTATUS WINAPI ZwQuerySymbolicLinkObject(HANDLE,PUNICODE_STRING,PULONG);
1525 NTSTATUS WINAPI ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1526 NTSTATUS WINAPI ZwQueryTimerResolution(PULONG,PULONG,PULONG);
1527 NTSTATUS WINAPI ZwQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
1528 NTSTATUS WINAPI ZwQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1529 NTSTATUS WINAPI ZwReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
1530 NTSTATUS WINAPI ZwReplaceKey(POBJECT_ATTRIBUTES,HANDLE,POBJECT_ATTRIBUTES);
1531 NTSTATUS WINAPI ZwRequestWaitReplyPort(HANDLE,PLPC_MESSAGE,PLPC_MESSAGE);
1532 NTSTATUS WINAPI ZwResetEvent(HANDLE,PULONG);
1533 NTSTATUS WINAPI ZwRestoreKey(HANDLE,HANDLE,ULONG);
1534 NTSTATUS WINAPI ZwSaveKey(HANDLE,HANDLE);
1535 NTSTATUS WINAPI ZwSecureConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PSID,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1536 NTSTATUS WINAPI ZwSetDefaultLocale(BOOLEAN,LCID);
1537 NTSTATUS WINAPI ZwSetDefaultUILanguage(LANGID);
1538 NTSTATUS WINAPI ZwSetEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG);
1539 NTSTATUS WINAPI ZwSetEvent(HANDLE,PULONG);
1540 NTSTATUS WINAPI ZwSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
1541 NTSTATUS WINAPI ZwSetInformationKey(HANDLE,const int,PVOID,ULONG);
1542 NTSTATUS WINAPI ZwSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
1543 NTSTATUS WINAPI ZwSetInformationProcess(HANDLE,PROCESS_INFORMATION_CLASS,PVOID,ULONG);
1544 NTSTATUS WINAPI ZwSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
1545 NTSTATUS WINAPI ZwSetIoCompletion(HANDLE,ULONG,ULONG,NTSTATUS,ULONG);
1546 NTSTATUS WINAPI ZwSetLdtEntries(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG);
1547 NTSTATUS WINAPI ZwSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1548 NTSTATUS WINAPI ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG);
1549 NTSTATUS WINAPI ZwSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
1550 NTSTATUS WINAPI ZwSetTimer(HANDLE, const LARGE_INTEGER*, PTIMER_APC_ROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
1551 NTSTATUS WINAPI ZwSetValueKey(HANDLE,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
1552 NTSTATUS WINAPI ZwSetVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1553 NTSTATUS WINAPI ZwSuspendThread(HANDLE,PULONG);
1554 NTSTATUS WINAPI ZwTerminateProcess(HANDLE,LONG);
1555 NTSTATUS WINAPI ZwUnloadDriver(const UNICODE_STRING *);
1556 NTSTATUS WINAPI ZwUnloadKey(HANDLE);
1557 NTSTATUS WINAPI ZwUnmapViewOfSection(HANDLE,PVOID);
1558 NTSTATUS WINAPI ZwWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
1559 NTSTATUS WINAPI ZwWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
1560 NTSTATUS WINAPI ZwWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
1561 NTSTATUS WINAPI ZwYieldExecution(void);
1563 #endif