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