d3d10: Add support for parsing blend states.
[wine/multimedia.git] / include / ddk / wdm.h
blob85d3da56aedb2360395e2d19a7caf34deb20741b
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 typedef LONG KPRIORITY;
33 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
35 struct _KDPC;
36 struct _KAPC;
37 struct _IRP;
38 struct _DEVICE_OBJECT;
39 struct _DRIVER_OBJECT;
41 typedef VOID (WINAPI *PKDEFERRED_ROUTINE)(struct _KDPC *, PVOID, PVOID, PVOID);
42 typedef VOID (WINAPI *PKSTART_ROUTINE)(PVOID);
44 typedef NTSTATUS (WINAPI *PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT *, PUNICODE_STRING);
45 typedef NTSTATUS (WINAPI *PDRIVER_DISPATCH)(struct _DEVICE_OBJECT *, struct _IRP *);
46 typedef void (WINAPI *PDRIVER_STARTIO)(struct _DEVICE_OBJECT *, struct _IRP *);
47 typedef void (WINAPI *PDRIVER_UNLOAD)(struct _DRIVER_OBJECT *);
49 typedef struct _DISPATCHER_HEADER {
50 UCHAR Type;
51 UCHAR Absolute;
52 UCHAR Size;
53 UCHAR Inserted;
54 LONG SignalState;
55 LIST_ENTRY WaitListHead;
56 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
58 typedef struct _KEVENT {
59 DISPATCHER_HEADER Header;
60 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
62 typedef struct _KSEMAPHORE {
63 DISPATCHER_HEADER Header;
64 LONG Limit;
65 } KSEMAPHORE, *PKSEMAPHORE, *PRKSEMAPHORE;
67 typedef struct _KDPC {
68 CSHORT Type;
69 UCHAR Number;
70 UCHAR Importance;
71 LIST_ENTRY DpcListEntry;
72 PKDEFERRED_ROUTINE DeferredRoutine;
73 PVOID DeferredContext;
74 PVOID SystemArgument1;
75 PVOID SystemArgument2;
76 PULONG_PTR Lock;
77 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
79 typedef struct _KDEVICE_QUEUE_ENTRY {
80 LIST_ENTRY DeviceListEntry;
81 ULONG SortKey;
82 BOOLEAN Inserted;
83 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
84 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
86 typedef struct _KDEVICE_QUEUE {
87 CSHORT Type;
88 CSHORT Size;
89 LIST_ENTRY DeviceListHead;
90 KSPIN_LOCK Lock;
91 BOOLEAN Busy;
92 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
94 typedef struct _KMUTANT {
95 DISPATCHER_HEADER Header;
96 LIST_ENTRY MutantListEntry;
97 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
98 BOOLEAN Abandoned;
99 UCHAR ApcDisable;
100 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
102 typedef enum _KWAIT_REASON
104 Executive,
105 FreePage,
106 PageIn,
107 PoolAllocation,
108 DelayExecution,
109 Suspended,
110 UserRequest,
111 WrExecutive,
112 WrFreePage,
113 WrPageIn,
114 WrDelayExecution,
115 WrSuspended,
116 WrUserRequest,
117 WrQueue,
118 WrLpcReceive,
119 WrLpcReply,
120 WrVirtualMemory,
121 WrPageOut,
122 WrRendezvous,
123 Spare2,
124 Spare3,
125 Spare4,
126 Spare5,
127 Spare6,
128 WrKernel,
129 MaximumWaitReason,
130 } KWAIT_REASON;
132 typedef struct _ALLOCATE_FUNCTION *PALLOCATE_FUNCTION;
133 typedef struct _IO_TIMER *PIO_TIMER;
134 typedef struct _IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
135 typedef struct _ETHREAD *PETHREAD;
136 typedef struct _FREE_FUNCTION *PFREE_FUNCTION;
137 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
138 typedef struct _EPROCESS *PEPROCESS;
139 typedef struct _ERESOURCE *PERESOURCE;
140 typedef struct _IO_WORKITEM *PIO_WORKITEM;
141 typedef struct _NPAGED_LOOKASIDE_LIST *PNPAGED_LOOKASIDE_LIST;
142 typedef struct _PAGED_LOOKASIDE_LIST *PPAGED_LOOKASIDE_LIST;
143 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
144 typedef struct _OBJECT_HANDLE_INFORMATION *POBJECT_HANDLE_INFORMATION;
145 typedef struct _ZONE_HEADER *PZONE_HEADER;
147 typedef struct _FAST_MUTEX
149 LONG Count;
150 PKTHREAD Owner;
151 ULONG Contention;
152 KEVENT Gate;
153 ULONG OldIrql;
154 } FAST_MUTEX, *PFAST_MUTEX;
156 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
158 typedef struct _VPB {
159 CSHORT Type;
160 CSHORT Size;
161 USHORT Flags;
162 USHORT VolumeLabelLength;
163 struct _DEVICE_OBJECT *DeviceObject;
164 struct _DEVICE_OBJECT *RealDevice;
165 ULONG SerialNumber;
166 ULONG ReferenceCount;
167 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
168 } VPB, *PVPB;
170 typedef enum _POOL_TYPE {
171 NonPagedPool,
172 PagedPool,
173 NonPagedPoolMustSucceed,
174 DontUseThisType,
175 NonPagedPoolCacheAligned,
176 PagedPoolCacheAligned,
177 NonPagedPoolCacheAlignedMustS,
178 MaxPoolType
179 } POOL_TYPE;
181 typedef struct _WAIT_CONTEXT_BLOCK {
182 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
183 struct _DRIVER_CONTROL *DeviceRoutine;
184 PVOID DeviceContext;
185 ULONG NumberOfMapRegisters;
186 PVOID DeviceObject;
187 PVOID CurrentIrp;
188 PKDPC BufferChainingDpc;
189 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
191 #define DO_BUFFERED_IO 0x00000004
192 #define DO_EXCLUSIVE 0x00000008
193 #define DO_DIRECT_IO 0x00000010
194 #define DO_MAP_IO_BUFFER 0x00000020
195 #define DO_DEVICE_INITIALIZING 0x00000080
196 #define DO_SHUTDOWN_REGISTERED 0x00000800
197 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
198 #define DO_POWER_PAGABLE 0x00002000
199 #define DO_POWER_INRUSH 0x00004000
201 #define IO_NO_INCREMENT 0
202 #define IO_CD_ROM_INCREMENT 1
203 #define IO_DISK_INCREMENT 1
204 #define IO_KEYBOARD_INCREMENT 6
205 #define IO_MAILSLOT_INCREMENT 2
206 #define IO_MOUSE_INCREMENT 6
207 #define IO_NAMED_PIPE_INCREMENT 2
208 #define IO_NETWORK_INCREMENT 2
209 #define IO_PARALLEL_INCREMENT 1
210 #define IO_SERIAL_INCREMENT 2
211 #define IO_SOUND_INCREMENT 8
212 #define IO_VIDEO_INCREMENT 1
214 #ifndef DEVICE_TYPE
215 #define DEVICE_TYPE ULONG
216 #endif
217 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
218 #define IRP_MJ_CREATE 0x00
219 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
220 #define IRP_MJ_CLOSE 0x02
221 #define IRP_MJ_READ 0x03
222 #define IRP_MJ_WRITE 0x04
223 #define IRP_MJ_QUERY_INFORMATION 0x05
224 #define IRP_MJ_SET_INFORMATION 0x06
225 #define IRP_MJ_QUERY_EA 0x07
226 #define IRP_MJ_SET_EA 0x08
227 #define IRP_MJ_FLUSH_BUFFERS 0x09
228 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
229 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
230 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
231 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
232 #define IRP_MJ_DEVICE_CONTROL 0x0e
233 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
234 #define IRP_MJ_SHUTDOWN 0x10
235 #define IRP_MJ_LOCK_CONTROL 0x11
236 #define IRP_MJ_CLEANUP 0x12
237 #define IRP_MJ_CREATE_MAILSLOT 0x13
238 #define IRP_MJ_QUERY_SECURITY 0x14
239 #define IRP_MJ_SET_SECURITY 0x15
240 #define IRP_MJ_POWER 0x16
241 #define IRP_MJ_SYSTEM_CONTROL 0x17
242 #define IRP_MJ_DEVICE_CHANGE 0x18
243 #define IRP_MJ_QUERY_QUOTA 0x19
244 #define IRP_MJ_SET_QUOTA 0x1a
245 #define IRP_MJ_PNP 0x1b
247 #define IRP_MN_START_DEVICE 0x00
248 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
249 #define IRP_MN_REMOVE_DEVICE 0x02
250 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
251 #define IRP_MN_STOP_DEVICE 0x04
252 #define IRP_MN_QUERY_STOP_DEVICE 0x05
253 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
254 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
255 #define IRP_MN_QUERY_INTERFACE 0x08
256 #define IRP_MN_QUERY_CAPABILITIES 0x09
257 #define IRP_MN_QUERY_RESOURCES 0x0A
258 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
259 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
260 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
261 #define IRP_MN_READ_CONFIG 0x0F
262 #define IRP_MN_WRITE_CONFIG 0x10
263 #define IRP_MN_EJECT 0x11
264 #define IRP_MN_SET_LOCK 0x12
265 #define IRP_MN_QUERY_ID 0x13
266 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
267 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
268 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
269 #define IRP_MN_SURPRISE_REMOVAL 0x17
271 #define IRP_QUOTA_CHARGED 0x01
272 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
273 #define IRP_ALLOCATED_FIXED_SIZE 0x04
274 #define IRP_LOOKASIDE_ALLOCATION 0x08
276 #define IO_TYPE_ADAPTER 0x01
277 #define IO_TYPE_CONTROLLER 0x02
278 #define IO_TYPE_DEVICE 0x03
279 #define IO_TYPE_DRIVER 0x04
280 #define IO_TYPE_FILE 0x05
281 #define IO_TYPE_IRP 0x06
282 #define IO_TYPE_MASTER_ADAPTER 0x07
283 #define IO_TYPE_OPEN_PACKET 0x08
284 #define IO_TYPE_TIMER 0x09
285 #define IO_TYPE_VPB 0x0a
286 #define IO_TYPE_ERROR_LOG 0x0b
287 #define IO_TYPE_ERROR_MESSAGE 0x0c
288 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0d
290 typedef struct _DEVICE_OBJECT {
291 CSHORT Type;
292 USHORT Size;
293 LONG ReferenceCount;
294 struct _DRIVER_OBJECT *DriverObject;
295 struct _DEVICE_OBJECT *NextDevice;
296 struct _DEVICE_OBJECT *AttachedDevice;
297 struct _IRP *CurrentIrp;
298 PIO_TIMER Timer;
299 ULONG Flags;
300 ULONG Characteristics;
301 PVPB Vpb;
302 PVOID DeviceExtension;
303 DEVICE_TYPE DeviceType;
304 CCHAR StackSize;
305 union {
306 LIST_ENTRY ListEntry;
307 WAIT_CONTEXT_BLOCK Wcb;
308 } Queue;
309 ULONG AlignmentRequirement;
310 KDEVICE_QUEUE DeviceQueue;
311 KDPC Dpc;
312 ULONG ActiveThreadCount;
313 PSECURITY_DESCRIPTOR SecurityDescriptor;
314 KEVENT DeviceLock;
315 USHORT SectorSize;
316 USHORT Spare1;
317 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
318 PVOID Reserved;
319 } DEVICE_OBJECT;
320 typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
322 typedef struct _DRIVER_EXTENSION {
323 struct _DRIVER_OBJECT *DriverObject;
324 PVOID AddDevice;
325 ULONG Count;
326 UNICODE_STRING ServiceKeyName;
327 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
329 typedef struct _DRIVER_OBJECT {
330 CSHORT Type;
331 CSHORT Size;
332 PDEVICE_OBJECT DeviceObject;
333 ULONG Flags;
334 PVOID DriverStart;
335 ULONG DriverSize;
336 PVOID DriverSection;
337 PDRIVER_EXTENSION DriverExtension;
338 UNICODE_STRING DriverName;
339 PUNICODE_STRING HardwareDatabase;
340 PVOID FastIoDispatch;
341 PDRIVER_INITIALIZE DriverInit;
342 PDRIVER_STARTIO DriverStartIo;
343 PDRIVER_UNLOAD DriverUnload;
344 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
345 } DRIVER_OBJECT;
346 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
348 /* Irp definitions */
349 typedef UCHAR KIRQL, *PKIRQL;
350 typedef CCHAR KPROCESSOR_MODE;
352 typedef VOID (WINAPI *PDRIVER_CANCEL)(
353 IN struct _DEVICE_OBJECT *DeviceObject,
354 IN struct _IRP *Irp);
356 typedef VOID (WINAPI *PKNORMAL_ROUTINE)(
357 IN PVOID NormalContext,
358 IN PVOID SystemArgument1,
359 IN PVOID SystemArgument2);
361 typedef VOID (WINAPI *PKKERNEL_ROUTINE)(
362 IN struct _KAPC *Apc,
363 IN OUT PKNORMAL_ROUTINE *NormalRoutine,
364 IN OUT PVOID *NormalContext,
365 IN OUT PVOID *SystemArgument1,
366 IN OUT PVOID *SystemArgument2);
368 typedef VOID (WINAPI *PKRUNDOWN_ROUTINE)(
369 IN struct _KAPC *Apc);
371 typedef struct _KAPC {
372 CSHORT Type;
373 CSHORT Size;
374 ULONG Spare0;
375 struct _KTHREAD *Thread;
376 LIST_ENTRY ApcListEntry;
377 PKKERNEL_ROUTINE KernelRoutine;
378 PKRUNDOWN_ROUTINE RundownRoutine;
379 PKNORMAL_ROUTINE NormalRoutine;
380 PVOID NormalContext;
381 PVOID SystemArgument1;
382 PVOID SystemArgument2;
383 CCHAR ApcStateIndex;
384 KPROCESSOR_MODE ApcMode;
385 BOOLEAN Inserted;
386 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
388 #include <pshpack1.h>
389 typedef struct _IRP {
390 CSHORT Type;
391 USHORT Size;
392 struct _MDL *MdlAddress;
393 ULONG Flags;
394 union {
395 struct _IRP *MasterIrp;
396 LONG IrpCount;
397 PVOID SystemBuffer;
398 } AssociatedIrp;
399 LIST_ENTRY ThreadListEntry;
400 IO_STATUS_BLOCK IoStatus;
401 KPROCESSOR_MODE RequestorMode;
402 BOOLEAN PendingReturned;
403 CHAR StackCount;
404 CHAR CurrentLocation;
405 BOOLEAN Cancel;
406 KIRQL CancelIrql;
407 CCHAR ApcEnvironment;
408 UCHAR AllocationFlags;
409 PIO_STATUS_BLOCK UserIosb;
410 PKEVENT UserEvent;
411 union {
412 struct {
413 PIO_APC_ROUTINE UserApcRoutine;
414 PVOID UserApcContext;
415 } AsynchronousParameters;
416 LARGE_INTEGER AllocationSize;
417 } Overlay;
418 PDRIVER_CANCEL CancelRoutine;
419 PVOID UserBuffer;
420 union {
421 struct {
422 union {
423 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
424 struct {
425 PVOID DriverContext[4];
426 } DUMMYSTRUCTNAME;
427 } DUMMYUNIONNAME1;
428 PETHREAD Thread;
429 PCHAR AuxiliaryBuffer;
430 struct {
431 LIST_ENTRY ListEntry;
432 union {
433 struct _IO_STACK_LOCATION *CurrentStackLocation;
434 ULONG PacketType;
435 } DUMMYUNIONNAME2;
436 } DUMMYSTRUCTNAME;
437 struct _FILE_OBJECT *OriginalFileObject;
438 } Overlay;
439 KAPC Apc;
440 PVOID CompletionKey;
441 } Tail;
442 } IRP;
443 typedef struct _IRP *PIRP;
444 #include <poppack.h>
446 /* MDL definitions */
448 typedef VOID (WINAPI *PINTERFACE_REFERENCE)(
449 PVOID Context);
451 typedef VOID (WINAPI *PINTERFACE_DEREFERENCE)(
452 PVOID Context);
454 typedef struct _INTERFACE {
455 USHORT Size;
456 USHORT Version;
457 PVOID Context;
458 PINTERFACE_REFERENCE InterfaceReference;
459 PINTERFACE_DEREFERENCE InterfaceDereference;
460 } INTERFACE, *PINTERFACE;
462 typedef struct _SECTION_OBJECT_POINTERS {
463 PVOID DataSectionObject;
464 PVOID SharedCacheMap;
465 PVOID ImageSectionObject;
466 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
468 typedef struct _IO_COMPLETION_CONTEXT {
469 PVOID Port;
470 PVOID Key;
471 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
473 typedef enum _DEVICE_RELATION_TYPE {
474 BusRelations,
475 EjectionRelations,
476 PowerRelations,
477 RemovalRelations,
478 TargetDeviceRelation,
479 SingleBusRelations
480 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
482 typedef struct _FILE_OBJECT {
483 CSHORT Type;
484 CSHORT Size;
485 PDEVICE_OBJECT DeviceObject;
486 PVPB Vpb;
487 PVOID FsContext;
488 PVOID FsContext2;
489 PSECTION_OBJECT_POINTERS SectionObjectPointer;
490 PVOID PrivateCacheMap;
491 NTSTATUS FinalStatus;
492 struct _FILE_OBJECT *RelatedFileObject;
493 BOOLEAN LockOperation;
494 BOOLEAN DeletePending;
495 BOOLEAN ReadAccess;
496 BOOLEAN WriteAccess;
497 BOOLEAN DeleteAccess;
498 BOOLEAN SharedRead;
499 BOOLEAN SharedWrite;
500 BOOLEAN SharedDelete;
501 ULONG Flags;
502 UNICODE_STRING FileName;
503 LARGE_INTEGER CurrentByteOffset;
504 ULONG Waiters;
505 ULONG Busy;
506 PVOID LastLock;
507 KEVENT Lock;
508 KEVENT Event;
509 PIO_COMPLETION_CONTEXT CompletionContext;
510 } FILE_OBJECT;
511 typedef struct _FILE_OBJECT *PFILE_OBJECT;
513 #define INITIAL_PRIVILEGE_COUNT 3
515 typedef struct _INITIAL_PRIVILEGE_SET {
516 ULONG PrivilegeCount;
517 ULONG Control;
518 LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
519 } INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
521 typedef struct _SECURITY_SUBJECT_CONTEXT {
522 PACCESS_TOKEN ClientToken;
523 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
524 PACCESS_TOKEN PrimaryToken;
525 PVOID ProcessAuditId;
526 } SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
528 typedef struct _ACCESS_STATE {
529 LUID OperationID;
530 BOOLEAN SecurityEvaluated;
531 BOOLEAN GenerateAudit;
532 BOOLEAN GenerateOnClose;
533 BOOLEAN PrivilegesAllocated;
534 ULONG Flags;
535 ACCESS_MASK RemainingDesiredAccess;
536 ACCESS_MASK PreviouslyGrantedAccess;
537 ACCESS_MASK OriginalDesiredAccess;
538 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
539 PSECURITY_DESCRIPTOR SecurityDescriptor;
540 PVOID AuxData;
541 union {
542 INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
543 PRIVILEGE_SET PrivilegeSet;
544 } Privileges;
546 BOOLEAN AuditPrivileges;
547 UNICODE_STRING ObjectName;
548 UNICODE_STRING ObjectTypeName;
549 } ACCESS_STATE, *PACCESS_STATE;
551 typedef struct _IO_SECURITY_CONTEXT {
552 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
553 PACCESS_STATE AccessState;
554 ACCESS_MASK DesiredAccess;
555 ULONG FullCreateOptions;
556 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
558 typedef struct _DEVICE_CAPABILITIES {
559 USHORT Size;
560 USHORT Version;
561 ULONG DeviceD1 : 1;
562 ULONG DeviceD2 : 1;
563 ULONG LockSupported : 1;
564 ULONG EjectSupported : 1;
565 ULONG Removable : 1;
566 ULONG DockDevice : 1;
567 ULONG UniqueID : 1;
568 ULONG SilentInstall : 1;
569 ULONG RawDeviceOK : 1;
570 ULONG SurpriseRemovalOK : 1;
571 ULONG WakeFromD0 : 1;
572 ULONG WakeFromD1 : 1;
573 ULONG WakeFromD2 : 1;
574 ULONG WakeFromD3 : 1;
575 ULONG HardwareDisabled : 1;
576 ULONG NonDynamic : 1;
577 ULONG WarmEjectSupported : 1;
578 ULONG NoDisplayInUI : 1;
579 ULONG Reserved : 14;
580 ULONG Address;
581 ULONG UINumber;
582 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
583 SYSTEM_POWER_STATE SystemWake;
584 DEVICE_POWER_STATE DeviceWake;
585 ULONG D1Latency;
586 ULONG D2Latency;
587 ULONG D3Latency;
588 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
590 typedef enum _INTERFACE_TYPE {
591 InterfaceTypeUndefined = -1,
592 Internal,
593 Isa,
594 Eisa,
595 MicroChannel,
596 TurboChannel,
597 PCIBus,
598 VMEBus,
599 NuBus,
600 PCMCIABus,
601 CBus,
602 MPIBus,
603 MPSABus,
604 ProcessorInternal,
605 InternalPowerBus,
606 PNPISABus,
607 PNPBus,
608 MaximumInterfaceType
609 } INTERFACE_TYPE, *PINTERFACE_TYPE;
611 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
613 #define IO_RESOURCE_PREFERRED 0x01
614 #define IO_RESOURCE_DEFAULT 0x02
615 #define IO_RESOURCE_ALTERNATIVE 0x08
617 typedef struct _IO_RESOURCE_DESCRIPTOR {
618 UCHAR Option;
619 UCHAR Type;
620 UCHAR ShareDisposition;
621 UCHAR Spare1;
622 USHORT Flags;
623 USHORT Spare2;
624 union {
625 struct {
626 ULONG Length;
627 ULONG Alignment;
628 PHYSICAL_ADDRESS MinimumAddress;
629 PHYSICAL_ADDRESS MaximumAddress;
630 } Port;
631 struct {
632 ULONG Length;
633 ULONG Alignment;
634 PHYSICAL_ADDRESS MinimumAddress;
635 PHYSICAL_ADDRESS MaximumAddress;
636 } Memory;
637 struct {
638 ULONG MinimumVector;
639 ULONG MaximumVector;
640 } Interrupt;
641 struct {
642 ULONG MinimumChannel;
643 ULONG MaximumChannel;
644 } Dma;
645 struct {
646 ULONG Length;
647 ULONG Alignment;
648 PHYSICAL_ADDRESS MinimumAddress;
649 PHYSICAL_ADDRESS MaximumAddress;
650 } Generic;
651 struct {
652 ULONG Data[3];
653 } DevicePrivate;
654 struct {
655 ULONG Length;
656 ULONG MinBusNumber;
657 ULONG MaxBusNumber;
658 ULONG Reserved;
659 } BusNumber;
660 struct {
661 ULONG Priority;
662 ULONG Reserved1;
663 ULONG Reserved2;
664 } ConfigData;
665 } u;
666 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
668 typedef struct _IO_RESOURCE_LIST {
669 USHORT Version;
670 USHORT Revision;
671 ULONG Count;
672 IO_RESOURCE_DESCRIPTOR Descriptors[1];
673 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
675 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
676 ULONG ListSize;
677 INTERFACE_TYPE InterfaceType;
678 ULONG BusNumber;
679 ULONG SlotNumber;
680 ULONG Reserved[3];
681 ULONG AlternativeLists;
682 IO_RESOURCE_LIST List[1];
683 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
685 typedef enum _BUS_QUERY_ID_TYPE {
686 BusQueryDeviceID,
687 BusQueryHardwareIDs,
688 BusQueryCompatibleIDs,
689 BusQueryInstanceID,
690 BusQueryDeviceSerialNumber
691 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
693 typedef enum {
694 DevicePropertyDeviceDescription,
695 DevicePropertyHardwareID,
696 DevicePropertyCompatibleIDs,
697 DevicePropertyBootConfiguration,
698 DevicePropertyBootConfigurationTranslated,
699 DevicePropertyClassName,
700 DevicePropertyClassGuid,
701 DevicePropertyDriverKeyName,
702 DevicePropertyManufacturer,
703 DevicePropertyFriendlyName,
704 DevicePropertyLocationInformation,
705 DevicePropertyPhysicalDeviceObjectName,
706 DevicePropertyBusTypeGuid,
707 DevicePropertyLegacyBusType,
708 DevicePropertyBusNumber,
709 DevicePropertyEnumeratorName,
710 DevicePropertyAddress,
711 DevicePropertyUINumber,
712 DevicePropertyInstallState,
713 DevicePropertyRemovalPolicy
714 } DEVICE_REGISTRY_PROPERTY;
716 typedef enum _DEVICE_TEXT_TYPE {
717 DeviceTextDescription,
718 DeviceTextLocationInformation
719 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
721 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
722 DeviceUsageTypeUndefined,
723 DeviceUsageTypePaging,
724 DeviceUsageTypeHibernation,
725 DeviceUsageTypeDumpFile
726 } DEVICE_USAGE_NOTIFICATION_TYPE;
728 typedef struct _POWER_SEQUENCE {
729 ULONG SequenceD1;
730 ULONG SequenceD2;
731 ULONG SequenceD3;
732 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
734 typedef enum _POWER_STATE_TYPE {
735 SystemPowerState,
736 DevicePowerState
737 } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
739 typedef union _POWER_STATE {
740 SYSTEM_POWER_STATE SystemState;
741 DEVICE_POWER_STATE DeviceState;
742 } POWER_STATE, *PPOWER_STATE;
744 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
745 UCHAR Type;
746 UCHAR ShareDisposition;
747 USHORT Flags;
748 union {
749 struct {
750 PHYSICAL_ADDRESS Start;
751 ULONG Length;
752 } Generic;
753 struct {
754 PHYSICAL_ADDRESS Start;
755 ULONG Length;
756 } Port;
757 struct {
758 ULONG Level;
759 ULONG Vector;
760 ULONG Affinity;
761 } Interrupt;
762 struct {
763 PHYSICAL_ADDRESS Start;
764 ULONG Length;
765 } Memory;
766 struct {
767 ULONG Channel;
768 ULONG Port;
769 ULONG Reserved1;
770 } Dma;
771 struct {
772 ULONG Data[3];
773 } DevicePrivate;
774 struct {
775 ULONG Start;
776 ULONG Length;
777 ULONG Reserved;
778 } BusNumber;
779 struct {
780 ULONG DataSize;
781 ULONG Reserved1;
782 ULONG Reserved2;
783 } DeviceSpecificData;
784 } u;
785 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
787 typedef struct _CM_PARTIAL_RESOURCE_LIST {
788 USHORT Version;
789 USHORT Revision;
790 ULONG Count;
791 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
792 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
794 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
795 INTERFACE_TYPE InterfaceType;
796 ULONG BusNumber;
797 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
798 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
800 typedef struct _CM_RESOURCE_LIST {
801 ULONG Count;
802 CM_FULL_RESOURCE_DESCRIPTOR List[1];
803 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
805 typedef NTSTATUS (WINAPI *PIO_COMPLETION_ROUTINE)(
806 IN struct _DEVICE_OBJECT *DeviceObject,
807 IN struct _IRP *Irp,
808 IN PVOID Context);
810 #define SL_PENDING_RETURNED 0x01
811 #define SL_INVOKE_ON_CANCEL 0x20
812 #define SL_INVOKE_ON_SUCCESS 0x40
813 #define SL_INVOKE_ON_ERROR 0x80
815 #include <pshpack1.h>
816 typedef struct _IO_STACK_LOCATION {
817 UCHAR MajorFunction;
818 UCHAR MinorFunction;
819 UCHAR Flags;
820 UCHAR Control;
821 union {
822 struct {
823 PIO_SECURITY_CONTEXT SecurityContext;
824 ULONG Options;
825 USHORT POINTER_ALIGNMENT FileAttributes;
826 USHORT ShareAccess;
827 ULONG POINTER_ALIGNMENT EaLength;
828 } Create;
829 struct {
830 ULONG Length;
831 ULONG POINTER_ALIGNMENT Key;
832 LARGE_INTEGER ByteOffset;
833 } Read;
834 struct {
835 ULONG Length;
836 ULONG POINTER_ALIGNMENT Key;
837 LARGE_INTEGER ByteOffset;
838 } Write;
839 struct {
840 ULONG Length;
841 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
842 } QueryFile;
843 struct {
844 ULONG Length;
845 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
846 PFILE_OBJECT FileObject;
847 union {
848 struct {
849 BOOLEAN ReplaceIfExists;
850 BOOLEAN AdvanceOnly;
851 } DUMMYSTRUCTNAME;
852 ULONG ClusterCount;
853 HANDLE DeleteHandle;
854 } DUMMYUNIONNAME;
855 } SetFile;
856 struct {
857 ULONG Length;
858 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
859 } QueryVolume;
860 struct {
861 ULONG OutputBufferLength;
862 ULONG POINTER_ALIGNMENT InputBufferLength;
863 ULONG POINTER_ALIGNMENT IoControlCode;
864 PVOID Type3InputBuffer;
865 } DeviceIoControl;
866 struct {
867 SECURITY_INFORMATION SecurityInformation;
868 ULONG POINTER_ALIGNMENT Length;
869 } QuerySecurity;
870 struct {
871 SECURITY_INFORMATION SecurityInformation;
872 PSECURITY_DESCRIPTOR SecurityDescriptor;
873 } SetSecurity;
874 struct {
875 PVPB Vpb;
876 PDEVICE_OBJECT DeviceObject;
877 } MountVolume;
878 struct {
879 PVPB Vpb;
880 PDEVICE_OBJECT DeviceObject;
881 } VerifyVolume;
882 struct {
883 struct _SCSI_REQUEST_BLOCK *Srb;
884 } Scsi;
885 struct {
886 DEVICE_RELATION_TYPE Type;
887 } QueryDeviceRelations;
888 struct {
889 CONST GUID *InterfaceType;
890 USHORT Size;
891 USHORT Version;
892 PINTERFACE Interface;
893 PVOID InterfaceSpecificData;
894 } QueryInterface;
895 struct {
896 PDEVICE_CAPABILITIES Capabilities;
897 } DeviceCapabilities;
898 struct {
899 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
900 } FilterResourceRequirements;
901 struct {
902 ULONG WhichSpace;
903 PVOID Buffer;
904 ULONG Offset;
905 ULONG POINTER_ALIGNMENT Length;
906 } ReadWriteConfig;
907 struct {
908 BOOLEAN Lock;
909 } SetLock;
910 struct {
911 BUS_QUERY_ID_TYPE IdType;
912 } QueryId;
913 struct {
914 DEVICE_TEXT_TYPE DeviceTextType;
915 LCID POINTER_ALIGNMENT LocaleId;
916 } QueryDeviceText;
917 struct {
918 BOOLEAN InPath;
919 BOOLEAN Reserved[3];
920 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
921 } UsageNotification;
922 struct {
923 SYSTEM_POWER_STATE PowerState;
924 } WaitWake;
925 struct {
926 PPOWER_SEQUENCE PowerSequence;
927 } PowerSequence;
928 struct {
929 ULONG SystemContext;
930 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
931 POWER_STATE POINTER_ALIGNMENT State;
932 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
933 } Power;
934 struct {
935 PCM_RESOURCE_LIST AllocatedResources;
936 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
937 } StartDevice;
938 struct {
939 ULONG_PTR ProviderId;
940 PVOID DataPath;
941 ULONG BufferSize;
942 PVOID Buffer;
943 } WMI;
944 struct {
945 PVOID Argument1;
946 PVOID Argument2;
947 PVOID Argument3;
948 PVOID Argument4;
949 } Others;
950 } Parameters;
951 PDEVICE_OBJECT DeviceObject;
952 PFILE_OBJECT FileObject;
953 PIO_COMPLETION_ROUTINE CompletionRoutine;
954 PVOID Context;
955 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
956 #include <poppack.h>
958 typedef struct _MDL {
959 struct _MDL *Next;
960 CSHORT Size;
961 CSHORT MdlFlags;
962 struct _EPROCESS *Process;
963 PVOID MappedSystemVa;
964 PVOID StartVa;
965 ULONG ByteCount;
966 ULONG ByteOffset;
967 } MDL, *PMDL;
969 typedef struct _KTIMER {
970 DISPATCHER_HEADER Header;
971 ULARGE_INTEGER DueTime;
972 LIST_ENTRY TimerListEntry;
973 struct _KDPC *Dpc;
974 LONG Period;
975 } KTIMER, *PKTIMER;
977 typedef struct _KSYSTEM_TIME {
978 ULONG LowPart;
979 LONG High1Time;
980 LONG High2Time;
981 } KSYSTEM_TIME, *PKSYSTEM_TIME;
983 typedef enum _NT_PRODUCT_TYPE {
984 NtProductWinNt = 1,
985 NtProductLanManNt,
986 NtProductServer
987 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
989 #define PROCESSOR_FEATURE_MAX 64
991 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
993 StandardDesign,
994 NEC98x86,
995 EndAlternatives
996 } ALTERNATIVE_ARCHITECTURE_TYPE;
998 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
999 #define NX_SUPPORT_POLICY_ALWAYSON 1
1000 #define NX_SUPPORT_POLICY_OPTIN 2
1001 #define NX_SUPPORT_POLICY_OPTOUT 3
1003 #define MAX_WOW64_SHARED_ENTRIES 16
1005 typedef struct _KUSER_SHARED_DATA {
1006 ULONG TickCountLowDeprecated;
1007 ULONG TickCountMultiplier;
1008 volatile KSYSTEM_TIME InterruptTime;
1009 volatile KSYSTEM_TIME SystemTime;
1010 volatile KSYSTEM_TIME TimeZoneBias;
1011 USHORT ImageNumberLow;
1012 USHORT ImageNumberHigh;
1013 WCHAR NtSystemRoot[260];
1014 ULONG MaxStackTraceDepth;
1015 ULONG CryptoExponent;
1016 ULONG TimeZoneId;
1017 ULONG LargePageMinimum;
1018 ULONG Reserved2[7];
1019 NT_PRODUCT_TYPE NtProductType;
1020 BOOLEAN ProductTypeIsValid;
1021 ULONG NtMajorVersion;
1022 ULONG NtMinorVersion;
1023 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
1024 ULONG Reserved1;
1025 ULONG Reserved3;
1026 volatile ULONG TimeSlip;
1027 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
1028 LARGE_INTEGER SystemExpirationDate;
1029 ULONG SuiteMask;
1030 BOOLEAN KdDebuggerEnabled;
1031 UCHAR NXSupportPolicy;
1032 volatile ULONG ActiveConsoleId;
1033 volatile ULONG DismountCount;
1034 ULONG ComPlusPackage;
1035 ULONG LastSystemRITEventTickCount;
1036 ULONG NumberOfPhysicalPages;
1037 BOOLEAN SafeBootMode;
1038 ULONG TraceLogging;
1039 ULONGLONG TestRetInstruction;
1040 ULONG SystemCall;
1041 ULONG SystemCallReturn;
1042 ULONGLONG SystemCallPad[3];
1043 union {
1044 volatile KSYSTEM_TIME TickCount;
1045 volatile ULONG64 TickCountQuad;
1046 } DUMMYUNIONNAME;
1047 ULONG Cookie;
1048 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
1049 } KSHARED_USER_DATA, *PKSHARED_USER_DATA;
1051 typedef enum _MEMORY_CACHING_TYPE {
1052 MmNonCached = 0,
1053 MmCached = 1,
1054 MmWriteCombined = 2,
1055 MmHardwareCoherentCached = 3,
1056 MmNonCachedUnordered = 4,
1057 MmUSWCCached = 5,
1058 MmMaximumCacheType = 6
1059 } MEMORY_CACHING_TYPE;
1061 typedef enum _MM_SYSTEM_SIZE
1063 MmSmallSystem,
1064 MmMediumSystem,
1065 MmLargeSystem
1066 } MM_SYSTEMSIZE;
1068 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
1069 BOOLEAN Removed;
1070 BOOLEAN Reserved[3];
1071 LONG IoCount;
1072 KEVENT RemoveEvent;
1073 } IO_REMOVE_LOCK_COMMON_BLOCK;
1075 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK *PIO_REMOVE_LOCK_TRACKING_BLOCK;
1077 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
1078 LONG Signature;
1079 LONG HighWatermark;
1080 LONGLONG MaxLockedTicks;
1081 LONG AllocateTag;
1082 LIST_ENTRY LockList;
1083 KSPIN_LOCK Spin;
1084 LONG LowMemoryCount;
1085 ULONG Reserved1[4];
1086 PVOID Reserved2;
1087 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
1088 } IO_REMOVE_LOCK_DBG_BLOCK;
1090 typedef struct _IO_REMOVE_LOCK {
1091 IO_REMOVE_LOCK_COMMON_BLOCK Common;
1092 IO_REMOVE_LOCK_DBG_BLOCK Dbg;
1093 } IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
1095 NTSTATUS WINAPI ObCloseHandle(IN HANDLE handle);
1097 #ifdef NONAMELESSUNION
1098 # ifdef NONAMELESSSTRUCT
1099 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation)
1100 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.u2.CurrentStackLocation - 1)
1101 # else
1102 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation)
1103 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.u2.CurrentStackLocation - 1)
1104 # endif
1105 #else
1106 # ifdef NONAMELESSSTRUCT
1107 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation)
1108 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.s.CurrentStackLocation - 1)
1109 # else
1110 # define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
1111 # define IoGetNextIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
1112 # endif
1113 #endif
1115 #define KernelMode 0
1116 #define UserMode 1
1118 /* directory object access rights */
1119 #define DIRECTORY_QUERY 0x0001
1120 #define DIRECTORY_TRAVERSE 0x0002
1121 #define DIRECTORY_CREATE_OBJECT 0x0004
1122 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
1123 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
1125 /* symbolic link access rights */
1126 #define SYMBOLIC_LINK_QUERY 0x0001
1127 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
1129 PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T);
1130 PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T);
1131 PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG);
1132 PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG);
1133 void WINAPI ExFreePool(PVOID);
1134 void WINAPI ExFreePoolWithTag(PVOID,ULONG);
1136 NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOID*);
1137 PVOID WINAPI IoAllocateErrorLogEntry(PVOID,UCHAR);
1138 PIRP WINAPI IoAllocateIrp(CCHAR,BOOLEAN);
1139 NTSTATUS WINAPI IoCallDriver(DEVICE_OBJECT*,IRP*);
1140 VOID WINAPI IoCompleteRequest(IRP*,UCHAR);
1141 NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);
1142 NTSTATUS WINAPI IoCreateDriver(UNICODE_STRING*,PDRIVER_INITIALIZE);
1143 NTSTATUS WINAPI IoCreateSymbolicLink(UNICODE_STRING*,UNICODE_STRING*);
1144 void WINAPI IoDeleteDevice(DEVICE_OBJECT*);
1145 void WINAPI IoDeleteDriver(DRIVER_OBJECT*);
1146 NTSTATUS WINAPI IoDeleteSymbolicLink(UNICODE_STRING*);
1147 void WINAPI IoFreeIrp(IRP*);
1148 PEPROCESS WINAPI IoGetCurrentProcess(void);
1149 NTSTATUS WINAPI IoGetDeviceInterfaces(CONST GUID*,PDEVICE_OBJECT,ULONG,PWSTR*);
1150 NTSTATUS WINAPI IoGetDeviceObjectPointer(UNICODE_STRING*,ACCESS_MASK,PFILE_OBJECT*,PDEVICE_OBJECT*);
1151 NTSTATUS WINAPI IoGetDeviceProperty(PDEVICE_OBJECT,DEVICE_REGISTRY_PROPERTY,ULONG,PVOID,PULONG);
1152 PVOID WINAPI IoGetDriverObjectExtension(PDRIVER_OBJECT,PVOID);
1153 PDEVICE_OBJECT WINAPI IoGetRelatedDeviceObject(PFILE_OBJECT);
1154 void WINAPI IoInitializeIrp(IRP*,USHORT,CCHAR);
1155 VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK,ULONG,ULONG,ULONG,ULONG);
1156 NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
1158 PKTHREAD WINAPI KeGetCurrentThread(void);
1159 void WINAPI KeQuerySystemTime(LARGE_INTEGER*);
1160 void WINAPI KeQueryTickCount(LARGE_INTEGER*);
1161 ULONG WINAPI KeQueryTimeIncrement(void);
1162 LONG WINAPI KeReleaseSemaphore(PRKSEMAPHORE,KPRIORITY,LONG,BOOLEAN);
1163 LONG WINAPI KeResetEvent(PRKEVENT);
1164 LONG WINAPI KeSetEvent(PRKEVENT,KPRIORITY,BOOLEAN);
1165 KPRIORITY WINAPI KeSetPriorityThread(PKTHREAD,KPRIORITY);
1167 PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS);
1168 PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T);
1169 PMDL WINAPI MmAllocatePagesForMdl(PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,SIZE_T);
1170 void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T);
1171 MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void);
1173 NTSTATUS WINAPI ObReferenceObjectByHandle(HANDLE,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,PVOID*,POBJECT_HANDLE_INFORMATION);
1175 POWER_STATE WINAPI PoSetPowerState(PDEVICE_OBJECT,POWER_STATE_TYPE,POWER_STATE);
1176 NTSTATUS WINAPI PsCreateSystemThread(PHANDLE,ULONG,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PKSTART_ROUTINE,PVOID);
1177 #define PsGetCurrentProcess() IoGetCurrentProcess()
1178 #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
1179 HANDLE WINAPI PsGetCurrentProcessId(void);
1180 HANDLE WINAPI PsGetCurrentThreadId(void);
1181 BOOLEAN WINAPI PsGetVersion(ULONG*,ULONG*,ULONG*,UNICODE_STRING*);
1182 NTSTATUS WINAPI PsTerminateSystemThread(NTSTATUS);
1184 NTSTATUS WINAPI ZwAddBootEntry(PUNICODE_STRING,PUNICODE_STRING);
1185 NTSTATUS WINAPI ZwAccessCheckAndAuditAlarm(PUNICODE_STRING,HANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,ACCESS_MASK,PGENERIC_MAPPING,BOOLEAN,PACCESS_MASK,PBOOLEAN,PBOOLEAN);
1186 NTSTATUS WINAPI ZwAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
1187 NTSTATUS WINAPI ZwAlertThread(HANDLE ThreadHandle);
1188 NTSTATUS WINAPI ZwAllocateVirtualMemory(HANDLE,PVOID*,ULONG,SIZE_T*,ULONG,ULONG);
1189 NTSTATUS WINAPI ZwCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
1190 NTSTATUS WINAPI ZwCancelTimer(HANDLE, BOOLEAN*);
1191 NTSTATUS WINAPI ZwClearEvent(HANDLE);
1192 NTSTATUS WINAPI ZwClose(HANDLE);
1193 NTSTATUS WINAPI ZwCloseObjectAuditAlarm(PUNICODE_STRING,HANDLE,BOOLEAN);
1194 NTSTATUS WINAPI ZwConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1195 NTSTATUS WINAPI ZwCreateDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1196 NTSTATUS WINAPI ZwCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1197 NTSTATUS WINAPI ZwCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1198 NTSTATUS WINAPI ZwCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1199 NTSTATUS WINAPI ZwCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1200 NTSTATUS WINAPI ZwCreateSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PUNICODE_STRING);
1201 NTSTATUS WINAPI ZwCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1202 NTSTATUS WINAPI ZwDeleteAtom(RTL_ATOM);
1203 NTSTATUS WINAPI ZwDeleteFile(POBJECT_ATTRIBUTES);
1204 NTSTATUS WINAPI ZwDeleteKey(HANDLE);
1205 NTSTATUS WINAPI ZwDeleteValueKey(HANDLE,const UNICODE_STRING *);
1206 NTSTATUS WINAPI ZwDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1207 NTSTATUS WINAPI ZwDisplayString(PUNICODE_STRING);
1208 NTSTATUS WINAPI ZwDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1209 NTSTATUS WINAPI ZwDuplicateToken(HANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,PHANDLE);
1210 NTSTATUS WINAPI ZwEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1211 NTSTATUS WINAPI ZwEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1212 NTSTATUS WINAPI ZwFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
1213 NTSTATUS WINAPI ZwFlushKey(HANDLE);
1214 NTSTATUS WINAPI ZwFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
1215 NTSTATUS WINAPI ZwFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1216 NTSTATUS WINAPI ZwFsControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1217 NTSTATUS WINAPI ZwInitiatePowerAction(POWER_ACTION,SYSTEM_POWER_STATE,ULONG,BOOLEAN);
1218 NTSTATUS WINAPI ZwLoadDriver(const UNICODE_STRING *);
1219 NTSTATUS WINAPI ZwLoadKey(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES *);
1220 NTSTATUS WINAPI ZwLockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1221 NTSTATUS WINAPI ZwMakeTemporaryObject(HANDLE);
1222 NTSTATUS WINAPI ZwMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
1223 NTSTATUS WINAPI ZwNotifyChangeKey(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1224 NTSTATUS WINAPI ZwOpenDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1225 NTSTATUS WINAPI ZwOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1226 NTSTATUS WINAPI ZwOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1227 NTSTATUS WINAPI ZwOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1228 NTSTATUS WINAPI ZwOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1229 NTSTATUS WINAPI ZwOpenProcessToken(HANDLE,DWORD,HANDLE *);
1230 NTSTATUS WINAPI ZwOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1231 NTSTATUS WINAPI ZwOpenSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1232 NTSTATUS WINAPI ZwOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1233 NTSTATUS WINAPI ZwOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1234 NTSTATUS WINAPI ZwOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1235 NTSTATUS WINAPI ZwPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG);
1236 NTSTATUS WINAPI ZwPulseEvent(HANDLE,PULONG);
1237 NTSTATUS WINAPI ZwQueryDefaultLocale(BOOLEAN,LCID*);
1238 NTSTATUS WINAPI ZwQueryDefaultUILanguage(LANGID*);
1239 NTSTATUS WINAPI ZwQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
1240 NTSTATUS WINAPI ZwQueryDirectoryObject(HANDLE,PDIRECTORY_BASIC_INFORMATION,ULONG,BOOLEAN,BOOLEAN,PULONG,PULONG);
1241 NTSTATUS WINAPI ZwQueryEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PVOID,BOOLEAN);
1242 NTSTATUS WINAPI ZwQueryFullAttributesFile(const OBJECT_ATTRIBUTES*,FILE_NETWORK_OPEN_INFORMATION*);
1243 NTSTATUS WINAPI ZwQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1244 NTSTATUS WINAPI ZwQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
1245 NTSTATUS WINAPI ZwQueryInformationToken(HANDLE,DWORD,PVOID,DWORD,LPDWORD);
1246 NTSTATUS WINAPI ZwQueryInstallUILanguage(LANGID*);
1247 NTSTATUS WINAPI ZwQueryKey(HANDLE,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1248 NTSTATUS WINAPI ZwQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
1249 NTSTATUS WINAPI ZwQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
1250 NTSTATUS WINAPI ZwQuerySection(HANDLE,SECTION_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1251 NTSTATUS WINAPI ZwQuerySymbolicLinkObject(HANDLE,PUNICODE_STRING,PULONG);
1252 NTSTATUS WINAPI ZwQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1253 NTSTATUS WINAPI ZwQueryTimerResolution(PULONG,PULONG,PULONG);
1254 NTSTATUS WINAPI ZwQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
1255 NTSTATUS WINAPI ZwQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1256 NTSTATUS WINAPI ZwReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
1257 NTSTATUS WINAPI ZwReplaceKey(POBJECT_ATTRIBUTES,HANDLE,POBJECT_ATTRIBUTES);
1258 NTSTATUS WINAPI ZwRequestWaitReplyPort(HANDLE,PLPC_MESSAGE,PLPC_MESSAGE);
1259 NTSTATUS WINAPI ZwResetEvent(HANDLE,PULONG);
1260 NTSTATUS WINAPI ZwRestoreKey(HANDLE,HANDLE,ULONG);
1261 NTSTATUS WINAPI ZwSaveKey(HANDLE,HANDLE);
1262 NTSTATUS WINAPI ZwSecureConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PSID,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1263 NTSTATUS WINAPI ZwSetDefaultLocale(BOOLEAN,LCID);
1264 NTSTATUS WINAPI ZwSetDefaultUILanguage(LANGID);
1265 NTSTATUS WINAPI ZwSetEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG);
1266 NTSTATUS WINAPI ZwSetEvent(HANDLE,PULONG);
1267 NTSTATUS WINAPI ZwSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
1268 NTSTATUS WINAPI ZwSetInformationKey(HANDLE,const int,PVOID,ULONG);
1269 NTSTATUS WINAPI ZwSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
1270 NTSTATUS WINAPI ZwSetInformationProcess(HANDLE,PROCESS_INFORMATION_CLASS,PVOID,ULONG);
1271 NTSTATUS WINAPI ZwSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
1272 NTSTATUS WINAPI ZwSetIoCompletion(HANDLE,ULONG,ULONG,NTSTATUS,ULONG);
1273 NTSTATUS WINAPI ZwSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1274 NTSTATUS WINAPI ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG);
1275 NTSTATUS WINAPI ZwSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
1276 NTSTATUS WINAPI ZwSetTimer(HANDLE, const LARGE_INTEGER*, PTIMER_APC_ROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
1277 NTSTATUS WINAPI ZwSetValueKey(HANDLE,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
1278 NTSTATUS WINAPI ZwSetVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1279 NTSTATUS WINAPI ZwSuspendThread(HANDLE,PULONG);
1280 NTSTATUS WINAPI ZwTerminateProcess(HANDLE,LONG);
1281 NTSTATUS WINAPI ZwUnloadDriver(const UNICODE_STRING *);
1282 NTSTATUS WINAPI ZwUnloadKey(HANDLE);
1283 NTSTATUS WINAPI ZwUnmapViewOfSection(HANDLE,PVOID);
1284 NTSTATUS WINAPI ZwWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
1285 NTSTATUS WINAPI ZwWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
1286 NTSTATUS WINAPI ZwWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
1287 NTSTATUS WINAPI ZwYieldExecution(void);
1289 #endif