source: Daodan/MinGW/include/ddk/ntapi.h@ 1054

Last change on this file since 1054 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 90.7 KB
Line 
1/*
2 * ntapi.h
3 *
4 * Windows NT Native API
5 *
6 * Most structures in this file is obtained from Windows NT/2000 Native API
7 * Reference by Gary Nebbett, ISBN 1578701996.
8 *
9 * This file is part of the w32api package.
10 *
11 * Contributors:
12 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
13 *
14 * THIS SOFTWARE IS NOT COPYRIGHTED
15 *
16 * This source code is offered for use in the public domain. You may
17 * use, modify or distribute it freely.
18 *
19 * This code is distributed in the hope that it will be useful but
20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21 * DISCLAIMED. This includes but is not limited to warranties of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 *
24 */
25
26#ifndef __NTAPI_H
27#define __NTAPI_H
28
29#if __GNUC__ >= 3
30#pragma GCC system_header
31#endif
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include <stdarg.h>
38#include <winbase.h>
39#include "ntddk.h"
40#include "ntpoapi.h"
41
42#pragma pack(push,4)
43
44typedef struct _PEB *PPEB;
45
46/* FIXME: Unknown definitions */
47typedef PVOID POBJECT_TYPE_LIST;
48typedef PVOID PEXECUTION_STATE;
49typedef PVOID PLANGID;
50
51#ifndef NtCurrentProcess
52#define NtCurrentProcess() ((HANDLE)0xFFFFFFFF)
53#endif /* NtCurrentProcess */
54#ifndef NtCurrentThread
55#define NtCurrentThread() ((HANDLE)0xFFFFFFFE)
56#endif /* NtCurrentThread */
57
58/* System information and control */
59
60typedef enum _SYSTEM_INFORMATION_CLASS {
61 SystemInformationClassMin = 0,
62 SystemBasicInformation = 0,
63 SystemProcessorInformation = 1,
64 SystemPerformanceInformation = 2,
65 SystemTimeOfDayInformation = 3,
66 SystemPathInformation = 4,
67 SystemNotImplemented1 = 4,
68 SystemProcessInformation = 5,
69 SystemProcessesAndThreadsInformation = 5,
70 SystemCallCountInfoInformation = 6,
71 SystemCallCounts = 6,
72 SystemDeviceInformation = 7,
73 SystemConfigurationInformation = 7,
74 SystemProcessorPerformanceInformation = 8,
75 SystemProcessorTimes = 8,
76 SystemFlagsInformation = 9,
77 SystemGlobalFlag = 9,
78 SystemCallTimeInformation = 10,
79 SystemNotImplemented2 = 10,
80 SystemModuleInformation = 11,
81 SystemLocksInformation = 12,
82 SystemLockInformation = 12,
83 SystemStackTraceInformation = 13,
84 SystemNotImplemented3 = 13,
85 SystemPagedPoolInformation = 14,
86 SystemNotImplemented4 = 14,
87 SystemNonPagedPoolInformation = 15,
88 SystemNotImplemented5 = 15,
89 SystemHandleInformation = 16,
90 SystemObjectInformation = 17,
91 SystemPageFileInformation = 18,
92 SystemPagefileInformation = 18,
93 SystemVdmInstemulInformation = 19,
94 SystemInstructionEmulationCounts = 19,
95 SystemVdmBopInformation = 20,
96 SystemInvalidInfoClass1 = 20,
97 SystemFileCacheInformation = 21,
98 SystemCacheInformation = 21,
99 SystemPoolTagInformation = 22,
100 SystemInterruptInformation = 23,
101 SystemProcessorStatistics = 23,
102 SystemDpcBehaviourInformation = 24,
103 SystemDpcInformation = 24,
104 SystemFullMemoryInformation = 25,
105 SystemNotImplemented6 = 25,
106 SystemLoadImage = 26,
107 SystemUnloadImage = 27,
108 SystemTimeAdjustmentInformation = 28,
109 SystemTimeAdjustment = 28,
110 SystemSummaryMemoryInformation = 29,
111 SystemNotImplemented7 = 29,
112 SystemNextEventIdInformation = 30,
113 SystemNotImplemented8 = 30,
114 SystemEventIdsInformation = 31,
115 SystemNotImplemented9 = 31,
116 SystemCrashDumpInformation = 32,
117 SystemExceptionInformation = 33,
118 SystemCrashDumpStateInformation = 34,
119 SystemKernelDebuggerInformation = 35,
120 SystemContextSwitchInformation = 36,
121 SystemRegistryQuotaInformation = 37,
122 SystemLoadAndCallImage = 38,
123 SystemPrioritySeparation = 39,
124 SystemPlugPlayBusInformation = 40,
125 SystemNotImplemented10 = 40,
126 SystemDockInformation = 41,
127 SystemNotImplemented11 = 41,
128 /* SystemPowerInformation = 42, Conflicts with POWER_INFORMATION_LEVEL 1 */
129 SystemInvalidInfoClass2 = 42,
130 SystemProcessorSpeedInformation = 43,
131 SystemInvalidInfoClass3 = 43,
132 SystemCurrentTimeZoneInformation = 44,
133 SystemTimeZoneInformation = 44,
134 SystemLookasideInformation = 45,
135 SystemSetTimeSlipEvent = 46,
136 SystemCreateSession = 47,
137 SystemDeleteSession = 48,
138 SystemInvalidInfoClass4 = 49,
139 SystemRangeStartInformation = 50,
140 SystemVerifierInformation = 51,
141 SystemAddVerifier = 52,
142 SystemSessionProcessesInformation = 53,
143 SystemInformationClassMax
144} SYSTEM_INFORMATION_CLASS;
145
146typedef struct _SYSTEM_BASIC_INFORMATION {
147 ULONG Unknown;
148 ULONG MaximumIncrement;
149 ULONG PhysicalPageSize;
150 ULONG NumberOfPhysicalPages;
151 ULONG LowestPhysicalPage;
152 ULONG HighestPhysicalPage;
153 ULONG AllocationGranularity;
154 ULONG LowestUserAddress;
155 ULONG HighestUserAddress;
156 ULONG ActiveProcessors;
157 UCHAR NumberProcessors;
158} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
159
160typedef struct _SYSTEM_PROCESSOR_INFORMATION {
161 USHORT ProcessorArchitecture;
162 USHORT ProcessorLevel;
163 USHORT ProcessorRevision;
164 USHORT Unknown;
165 ULONG FeatureBits;
166} SYSTEM_PROCESSOR_INFORMATION, *PSYSTEM_PROCESSOR_INFORMATION;
167
168typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
169 LARGE_INTEGER IdleTime;
170 LARGE_INTEGER ReadTransferCount;
171 LARGE_INTEGER WriteTransferCount;
172 LARGE_INTEGER OtherTransferCount;
173 ULONG ReadOperationCount;
174 ULONG WriteOperationCount;
175 ULONG OtherOperationCount;
176 ULONG AvailablePages;
177 ULONG TotalCommittedPages;
178 ULONG TotalCommitLimit;
179 ULONG PeakCommitment;
180 ULONG PageFaults;
181 ULONG WriteCopyFaults;
182 ULONG TransitionFaults;
183 ULONG CacheTransitionFaults;
184 ULONG DemandZeroFaults;
185 ULONG PagesRead;
186 ULONG PageReadIos;
187 ULONG CacheReads;
188 ULONG CacheIos;
189 ULONG PagefilePagesWritten;
190 ULONG PagefilePageWriteIos;
191 ULONG MappedFilePagesWritten;
192 ULONG MappedFilePageWriteIos;
193 ULONG PagedPoolUsage;
194 ULONG NonPagedPoolUsage;
195 ULONG PagedPoolAllocs;
196 ULONG PagedPoolFrees;
197 ULONG NonPagedPoolAllocs;
198 ULONG NonPagedPoolFrees;
199 ULONG TotalFreeSystemPtes;
200 ULONG SystemCodePage;
201 ULONG TotalSystemDriverPages;
202 ULONG TotalSystemCodePages;
203 ULONG SmallNonPagedLookasideListAllocateHits;
204 ULONG SmallPagedLookasideListAllocateHits;
205 ULONG Reserved3;
206 ULONG MmSystemCachePage;
207 ULONG PagedPoolPage;
208 ULONG SystemDriverPage;
209 ULONG FastReadNoWait;
210 ULONG FastReadWait;
211 ULONG FastReadResourceMiss;
212 ULONG FastReadNotPossible;
213 ULONG FastMdlReadNoWait;
214 ULONG FastMdlReadWait;
215 ULONG FastMdlReadResourceMiss;
216 ULONG FastMdlReadNotPossible;
217 ULONG MapDataNoWait;
218 ULONG MapDataWait;
219 ULONG MapDataNoWaitMiss;
220 ULONG MapDataWaitMiss;
221 ULONG PinMappedDataCount;
222 ULONG PinReadNoWait;
223 ULONG PinReadWait;
224 ULONG PinReadNoWaitMiss;
225 ULONG PinReadWaitMiss;
226 ULONG CopyReadNoWait;
227 ULONG CopyReadWait;
228 ULONG CopyReadNoWaitMiss;
229 ULONG CopyReadWaitMiss;
230 ULONG MdlReadNoWait;
231 ULONG MdlReadWait;
232 ULONG MdlReadNoWaitMiss;
233 ULONG MdlReadWaitMiss;
234 ULONG ReadAheadIos;
235 ULONG LazyWriteIos;
236 ULONG LazyWritePages;
237 ULONG DataFlushes;
238 ULONG DataPages;
239 ULONG ContextSwitches;
240 ULONG FirstLevelTbFills;
241 ULONG SecondLevelTbFills;
242 ULONG SystemCalls;
243} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
244
245typedef struct _SYSTEM_TIME_OF_DAY_INFORMATION {
246 LARGE_INTEGER BootTime;
247 LARGE_INTEGER CurrentTime;
248 LARGE_INTEGER TimeZoneBias;
249 ULONG CurrentTimeZoneId;
250} SYSTEM_TIME_OF_DAY_INFORMATION, *PSYSTEM_TIME_OF_DAY_INFORMATION;
251
252typedef struct _VM_COUNTERS {
253 ULONG PeakVirtualSize;
254 ULONG VirtualSize;
255 ULONG PageFaultCount;
256 ULONG PeakWorkingSetSize;
257 ULONG WorkingSetSize;
258 ULONG QuotaPeakPagedPoolUsage;
259 ULONG QuotaPagedPoolUsage;
260 ULONG QuotaPeakNonPagedPoolUsage;
261 ULONG QuotaNonPagedPoolUsage;
262 ULONG PagefileUsage;
263 ULONG PeakPagefileUsage;
264} VM_COUNTERS;
265
266typedef enum _THREAD_STATE {
267 StateInitialized,
268 StateReady,
269 StateRunning,
270 StateStandby,
271 StateTerminated,
272 StateWait,
273 StateTransition,
274 StateUnknown
275} THREAD_STATE;
276
277typedef struct _SYSTEM_THREADS {
278 LARGE_INTEGER KernelTime;
279 LARGE_INTEGER UserTime;
280 LARGE_INTEGER CreateTime;
281 ULONG WaitTime;
282 PVOID StartAddress;
283 CLIENT_ID ClientId;
284 KPRIORITY Priority;
285 KPRIORITY BasePriority;
286 ULONG ContextSwitchCount;
287 THREAD_STATE State;
288 KWAIT_REASON WaitReason;
289} SYSTEM_THREADS, *PSYSTEM_THREADS;
290
291typedef struct _SYSTEM_PROCESSES {
292 ULONG NextEntryDelta;
293 ULONG ThreadCount;
294 ULONG Reserved1[6];
295 LARGE_INTEGER CreateTime;
296 LARGE_INTEGER UserTime;
297 LARGE_INTEGER KernelTime;
298 UNICODE_STRING ProcessName;
299 KPRIORITY BasePriority;
300 ULONG ProcessId;
301 ULONG InheritedFromProcessId;
302 ULONG HandleCount;
303 ULONG Reserved2[2];
304 VM_COUNTERS VmCounters;
305 IO_COUNTERS IoCounters;
306 SYSTEM_THREADS Threads[1];
307} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
308
309typedef struct _SYSTEM_CALLS_INFORMATION {
310 ULONG Size;
311 ULONG NumberOfDescriptorTables;
312 ULONG NumberOfRoutinesInTable[1];
313 ULONG CallCounts[ANYSIZE_ARRAY];
314} SYSTEM_CALLS_INFORMATION, *PSYSTEM_CALLS_INFORMATION;
315
316typedef struct _SYSTEM_CONFIGURATION_INFORMATION {
317 ULONG DiskCount;
318 ULONG FloppyCount;
319 ULONG CdRomCount;
320 ULONG TapeCount;
321 ULONG SerialCount;
322 ULONG ParallelCount;
323} SYSTEM_CONFIGURATION_INFORMATION, *PSYSTEM_CONFIGURATION_INFORMATION;
324
325typedef struct _SYSTEM_PROCESSOR_TIMES {
326 LARGE_INTEGER IdleTime;
327 LARGE_INTEGER KernelTime;
328 LARGE_INTEGER UserTime;
329 LARGE_INTEGER DpcTime;
330 LARGE_INTEGER InterruptTime;
331 ULONG InterruptCount;
332} SYSTEM_PROCESSOR_TIMES, *PSYSTEM_PROCESSOR_TIMES;
333
334/* SYSTEM_GLOBAL_FLAG.GlobalFlag constants */
335#define FLG_STOP_ON_EXCEPTION 0x00000001
336#define FLG_SHOW_LDR_SNAPS 0x00000002
337#define FLG_DEBUG_INITIAL_COMMAND 0x00000004
338#define FLG_STOP_ON_HUNG_GUI 0x00000008
339#define FLG_HEAP_ENABLE_TAIL_CHECK 0x00000010
340#define FLG_HEAP_ENABLE_FREE_CHECK 0x00000020
341#define FLG_HEAP_VALIDATE_PARAMETERS 0x00000040
342#define FLG_HEAP_VALIDATE_ALL 0x00000080
343#define FLG_POOL_ENABLE_TAIL_CHECK 0x00000100
344#define FLG_POOL_ENABLE_FREE_CHECK 0x00000200
345#define FLG_POOL_ENABLE_TAGGING 0x00000400
346#define FLG_HEAP_ENABLE_TAGGING 0x00000800
347#define FLG_USER_STACK_TRACE_DB 0x00001000
348#define FLG_KERNEL_STACK_TRACE_DB 0x00002000
349#define FLG_MAINTAIN_OBJECT_TYPELIST 0x00004000
350#define FLG_HEAP_ENABLE_TAG_BY_DLL 0x00008000
351#define FLG_IGNORE_DEBUG_PRIV 0x00010000
352#define FLG_ENABLE_CSRDEBUG 0x00020000
353#define FLG_ENABLE_KDEBUG_SYMBOL_LOAD 0x00040000
354#define FLG_DISABLE_PAGE_KERNEL_STACKS 0x00080000
355#define FLG_HEAP_ENABLE_CALL_TRACING 0x00100000
356#define FLG_HEAP_DISABLE_COALESCING 0x00200000
357#define FLG_ENABLE_CLOSE_EXCEPTIONS 0x00400000
358#define FLG_ENABLE_EXCEPTION_LOGGING 0x00800000
359#define FLG_ENABLE_DBGPRINT_BUFFERING 0x08000000
360
361typedef struct _SYSTEM_GLOBAL_FLAG {
362 ULONG GlobalFlag;
363} SYSTEM_GLOBAL_FLAG, *PSYSTEM_GLOBAL_FLAG;
364
365typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY {
366 ULONG Unknown1;
367 ULONG Unknown2;
368 PVOID Base;
369 ULONG Size;
370 ULONG Flags;
371 USHORT Index;
372 /* Length of module name not including the path, this
373 field contains valid value only for NTOSKRNL module */
374 USHORT NameLength;
375 USHORT LoadCount;
376 USHORT PathLength;
377 CHAR ImageName[256];
378} SYSTEM_MODULE_INFORMATION_ENTRY, *PSYSTEM_MODULE_INFORMATION_ENTRY;
379
380typedef struct _SYSTEM_MODULE_INFORMATION {
381 ULONG Count;
382 SYSTEM_MODULE_INFORMATION_ENTRY Module[1];
383} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
384
385typedef struct _SYSTEM_LOCK_INFORMATION {
386 PVOID Address;
387 USHORT Type;
388 USHORT Reserved1;
389 ULONG ExclusiveOwnerThreadId;
390 ULONG ActiveCount;
391 ULONG ContentionCount;
392 ULONG Reserved2[2];
393 ULONG NumberOfSharedWaiters;
394 ULONG NumberOfExclusiveWaiters;
395} SYSTEM_LOCK_INFORMATION, *PSYSTEM_LOCK_INFORMATION;
396
397/*SYSTEM_HANDLE_INFORMATION.Flags cosntants */
398#define PROTECT_FROM_CLOSE 0x01
399#define INHERIT 0x02
400
401typedef struct _SYSTEM_HANDLE_INFORMATION {
402 ULONG ProcessId;
403 UCHAR ObjectTypeNumber;
404 UCHAR Flags;
405 USHORT Handle;
406 PVOID Object;
407 ACCESS_MASK GrantedAccess;
408} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
409
410typedef struct _SYSTEM_OBJECT_TYPE_INFORMATION {
411 ULONG NextEntryOffset;
412 ULONG ObjectCount;
413 ULONG HandleCount;
414 ULONG TypeNumber;
415 ULONG InvalidAttributes;
416 GENERIC_MAPPING GenericMapping;
417 ACCESS_MASK ValidAccessMask;
418 POOL_TYPE PoolType;
419 UCHAR Unknown;
420 UNICODE_STRING Name;
421} SYSTEM_OBJECT_TYPE_INFORMATION, *PSYSTEM_OBJECT_TYPE_INFORMATION;
422
423/* SYSTEM_OBJECT_INFORMATION.Flags constants */
424#define FLG_SYSOBJINFO_SINGLE_HANDLE_ENTRY 0x40
425#define FLG_SYSOBJINFO_DEFAULT_SECURITY_QUOTA 0x20
426#define FLG_SYSOBJINFO_PERMANENT 0x10
427#define FLG_SYSOBJINFO_EXCLUSIVE 0x08
428#define FLG_SYSOBJINFO_CREATOR_INFO 0x04
429#define FLG_SYSOBJINFO_KERNEL_MODE 0x02
430
431typedef struct _SYSTEM_OBJECT_INFORMATION {
432 ULONG NextEntryOffset;
433 PVOID Object;
434 ULONG CreatorProcessId;
435 USHORT Unknown;
436 USHORT Flags;
437 ULONG PointerCount;
438 ULONG HandleCount;
439 ULONG PagedPoolUsage;
440 ULONG NonPagedPoolUsage;
441 ULONG ExclusiveProcessId;
442 PSECURITY_DESCRIPTOR SecurityDescriptor;
443 UNICODE_STRING Name;
444} SYSTEM_OBJECT_INFORMATION, *PSYSTEM_OBJECT_INFORMATION;
445
446typedef struct _SYSTEM_PAGEFILE_INFORMATION {
447 ULONG NextEntryOffset;
448 ULONG CurrentSize;
449 ULONG TotalUsed;
450 ULONG PeakUsed;
451 UNICODE_STRING FileName;
452} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
453
454typedef struct _SYSTEM_INSTRUCTION_EMULATION_INFORMATION {
455 ULONG SegmentNotPresent;
456 ULONG TwoByteOpcode;
457 ULONG ESprefix;
458 ULONG CSprefix;
459 ULONG SSprefix;
460 ULONG DSprefix;
461 ULONG FSPrefix;
462 ULONG GSprefix;
463 ULONG OPER32prefix;
464 ULONG ADDR32prefix;
465 ULONG INSB;
466 ULONG INSW;
467 ULONG OUTSB;
468 ULONG OUTSW;
469 ULONG PUSHFD;
470 ULONG POPFD;
471 ULONG INTnn;
472 ULONG INTO;
473 ULONG IRETD;
474 ULONG INBimm;
475 ULONG INWimm;
476 ULONG OUTBimm;
477 ULONG OUTWimm;
478 ULONG INB;
479 ULONG INW;
480 ULONG OUTB;
481 ULONG OUTW;
482 ULONG LOCKprefix;
483 ULONG REPNEprefix;
484 ULONG REPprefix;
485 ULONG HLT;
486 ULONG CLI;
487 ULONG STI;
488 ULONG GenericInvalidOpcode;
489} SYSTEM_INSTRUCTION_EMULATION_INFORMATION, *PSYSTEM_INSTRUCTION_EMULATION_INFORMATION;
490
491typedef struct _SYSTEM_POOL_TAG_INFORMATION {
492 CHAR Tag[4];
493 ULONG PagedPoolAllocs;
494 ULONG PagedPoolFrees;
495 ULONG PagedPoolUsage;
496 ULONG NonPagedPoolAllocs;
497 ULONG NonPagedPoolFrees;
498 ULONG NonPagedPoolUsage;
499} SYSTEM_POOL_TAG_INFORMATION, *PSYSTEM_POOL_TAG_INFORMATION;
500
501typedef struct _SYSTEM_PROCESSOR_STATISTICS {
502 ULONG ContextSwitches;
503 ULONG DpcCount;
504 ULONG DpcRequestRate;
505 ULONG TimeIncrement;
506 ULONG DpcBypassCount;
507 ULONG ApcBypassCount;
508} SYSTEM_PROCESSOR_STATISTICS, *PSYSTEM_PROCESSOR_STATISTICS;
509
510typedef struct _SYSTEM_DPC_INFORMATION {
511 ULONG Reserved;
512 ULONG MaximumDpcQueueDepth;
513 ULONG MinimumDpcRate;
514 ULONG AdjustDpcThreshold;
515 ULONG IdealDpcRate;
516} SYSTEM_DPC_INFORMATION, *PSYSTEM_DPC_INFORMATION;
517
518typedef struct _SYSTEM_LOAD_IMAGE {
519 UNICODE_STRING ModuleName;
520 PVOID ModuleBase;
521 PVOID SectionPointer;
522 PVOID EntryPoint;
523 PVOID ExportDirectory;
524} SYSTEM_LOAD_IMAGE, *PSYSTEM_LOAD_IMAGE;
525
526typedef struct _SYSTEM_UNLOAD_IMAGE {
527 PVOID ModuleBase;
528} SYSTEM_UNLOAD_IMAGE, *PSYSTEM_UNLOAD_IMAGE;
529
530typedef struct _SYSTEM_QUERY_TIME_ADJUSTMENT {
531 ULONG TimeAdjustment;
532 ULONG MaximumIncrement;
533 BOOLEAN TimeSynchronization;
534} SYSTEM_QUERY_TIME_ADJUSTMENT, *PSYSTEM_QUERY_TIME_ADJUSTMENT;
535
536typedef struct _SYSTEM_SET_TIME_ADJUSTMENT {
537 ULONG TimeAdjustment;
538 BOOLEAN TimeSynchronization;
539} SYSTEM_SET_TIME_ADJUSTMENT, *PSYSTEM_SET_TIME_ADJUSTMENT;
540
541typedef struct _SYSTEM_CRASH_DUMP_INFORMATION {
542 HANDLE CrashDumpSectionHandle;
543 HANDLE Unknown;
544} SYSTEM_CRASH_DUMP_INFORMATION, *PSYSTEM_CRASH_DUMP_INFORMATION;
545
546typedef struct _SYSTEM_EXCEPTION_INFORMATION {
547 ULONG AlignmentFixupCount;
548 ULONG ExceptionDispatchCount;
549 ULONG FloatingEmulationCount;
550 ULONG Reserved;
551} SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
552
553typedef struct _SYSTEM_CRASH_DUMP_STATE_INFORMATION {
554 ULONG CrashDumpSectionExists;
555 ULONG Unknown;
556} SYSTEM_CRASH_DUMP_STATE_INFORMATION, *PSYSTEM_CRASH_DUMP_STATE_INFORMATION;
557
558typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION {
559 BOOLEAN DebuggerEnabled;
560 BOOLEAN DebuggerNotPresent;
561} SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
562
563typedef struct _SYSTEM_CONTEXT_SWITCH_INFORMATION {
564 ULONG ContextSwitches;
565 ULONG ContextSwitchCounters[11];
566} SYSTEM_CONTEXT_SWITCH_INFORMATION, *PSYSTEM_CONTEXT_SWITCH_INFORMATION;
567
568typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
569 ULONG RegistryQuota;
570 ULONG RegistryQuotaInUse;
571 ULONG PagedPoolSize;
572} SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
573
574typedef struct _SYSTEM_LOAD_AND_CALL_IMAGE {
575 UNICODE_STRING ModuleName;
576} SYSTEM_LOAD_AND_CALL_IMAGE, *PSYSTEM_LOAD_AND_CALL_IMAGE;
577
578typedef struct _SYSTEM_PRIORITY_SEPARATION {
579 ULONG PrioritySeparation;
580} SYSTEM_PRIORITY_SEPARATION, *PSYSTEM_PRIORITY_SEPARATION;
581
582typedef struct _SYSTEM_TIME_ZONE_INFORMATION {
583 LONG Bias;
584 WCHAR StandardName[32];
585 LARGE_INTEGER StandardDate;
586 LONG StandardBias;
587 WCHAR DaylightName[32];
588 LARGE_INTEGER DaylightDate;
589 LONG DaylightBias;
590} SYSTEM_TIME_ZONE_INFORMATION, *PSYSTEM_TIME_ZONE_INFORMATION;
591
592typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
593 USHORT Depth;
594 USHORT MaximumDepth;
595 ULONG TotalAllocates;
596 ULONG AllocateMisses;
597 ULONG TotalFrees;
598 ULONG FreeMisses;
599 POOL_TYPE Type;
600 ULONG Tag;
601 ULONG Size;
602} SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
603
604typedef struct _SYSTEM_SET_TIME_SLIP_EVENT {
605 HANDLE TimeSlipEvent;
606} SYSTEM_SET_TIME_SLIP_EVENT, *PSYSTEM_SET_TIME_SLIP_EVENT;
607
608typedef struct _SYSTEM_CREATE_SESSION {
609 ULONG SessionId;
610} SYSTEM_CREATE_SESSION, *PSYSTEM_CREATE_SESSION;
611
612typedef struct _SYSTEM_DELETE_SESSION {
613 ULONG SessionId;
614} SYSTEM_DELETE_SESSION, *PSYSTEM_DELETE_SESSION;
615
616typedef struct _SYSTEM_RANGE_START_INFORMATION {
617 PVOID SystemRangeStart;
618} SYSTEM_RANGE_START_INFORMATION, *PSYSTEM_RANGE_START_INFORMATION;
619
620typedef struct _SYSTEM_SESSION_PROCESSES_INFORMATION {
621 ULONG SessionId;
622 ULONG BufferSize;
623 PVOID Buffer;
624} SYSTEM_SESSION_PROCESSES_INFORMATION, *PSYSTEM_SESSION_PROCESSES_INFORMATION;
625
626typedef struct _SYSTEM_POOL_BLOCK {
627 BOOLEAN Allocated;
628 USHORT Unknown;
629 ULONG Size;
630 CHAR Tag[4];
631} SYSTEM_POOL_BLOCK, *PSYSTEM_POOL_BLOCK;
632
633typedef struct _SYSTEM_POOL_BLOCKS_INFORMATION {
634 ULONG PoolSize;
635 PVOID PoolBase;
636 USHORT Unknown;
637 ULONG NumberOfBlocks;
638 SYSTEM_POOL_BLOCK PoolBlocks[1];
639} SYSTEM_POOL_BLOCKS_INFORMATION, *PSYSTEM_POOL_BLOCKS_INFORMATION;
640
641typedef struct _SYSTEM_MEMORY_USAGE {
642 PVOID Name;
643 USHORT Valid;
644 USHORT Standby;
645 USHORT Modified;
646 USHORT PageTables;
647} SYSTEM_MEMORY_USAGE, *PSYSTEM_MEMORY_USAGE;
648
649typedef struct _SYSTEM_MEMORY_USAGE_INFORMATION {
650 ULONG Reserved;
651 PVOID EndOfData;
652 SYSTEM_MEMORY_USAGE MemoryUsage[1];
653} SYSTEM_MEMORY_USAGE_INFORMATION, *PSYSTEM_MEMORY_USAGE_INFORMATION;
654
655NTOSAPI
656NTSTATUS
657NTAPI
658NtQuerySystemInformation(
659 /*IN*/ SYSTEM_INFORMATION_CLASS SystemInformationClass,
660 /*IN OUT*/ PVOID SystemInformation,
661 /*IN*/ ULONG SystemInformationLength,
662 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
663
664NTOSAPI
665NTSTATUS
666NTAPI
667ZwQuerySystemInformation(
668 /*IN*/ SYSTEM_INFORMATION_CLASS SystemInformationClass,
669 /*IN OUT*/ PVOID SystemInformation,
670 /*IN*/ ULONG SystemInformationLength,
671 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
672
673NTOSAPI
674NTAPI
675NTSTATUS
676NtQueryFullAttributesFile(
677 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
678 /*OUT*/ PFILE_NETWORK_OPEN_INFORMATION FileInformation);
679
680NTOSAPI
681NTAPI
682NTSTATUS
683ZwQueryFullAttributesFile(
684 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
685 /*OUT*/ PFILE_NETWORK_OPEN_INFORMATION FileInformation);
686
687NTOSAPI
688NTSTATUS
689NTAPI
690NtSetSystemInformation(
691 /*IN*/ SYSTEM_INFORMATION_CLASS SystemInformationClass,
692 /*IN OUT*/ PVOID SystemInformation,
693 /*IN*/ ULONG SystemInformationLength);
694
695NTOSAPI
696NTSTATUS
697NTAPI
698ZwSetSystemInformation(
699 /*IN*/ SYSTEM_INFORMATION_CLASS SystemInformationClass,
700 /*IN OUT*/ PVOID SystemInformation,
701 /*IN*/ ULONG SystemInformationLength);
702
703NTOSAPI
704NTSTATUS
705NTAPI
706NtQuerySystemEnvironmentValue(
707 /*IN*/ PUNICODE_STRING Name,
708 /*OUT*/ PVOID Value,
709 /*IN*/ ULONG ValueLength,
710 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
711
712NTOSAPI
713NTSTATUS
714NTAPI
715ZwQuerySystemEnvironmentValue(
716 /*IN*/ PUNICODE_STRING Name,
717 /*OUT*/ PVOID Value,
718 /*IN*/ ULONG ValueLength,
719 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
720
721NTOSAPI
722NTSTATUS
723NTAPI
724NtSetSystemEnvironmentValue(
725 /*IN*/ PUNICODE_STRING Name,
726 /*IN*/ PUNICODE_STRING Value);
727
728NTOSAPI
729NTSTATUS
730NTAPI
731ZwSetSystemEnvironmentValue(
732 /*IN*/ PUNICODE_STRING Name,
733 /*IN*/ PUNICODE_STRING Value);
734
735typedef enum _SHUTDOWN_ACTION {
736 ShutdownNoReboot,
737 ShutdownReboot,
738 ShutdownPowerOff
739} SHUTDOWN_ACTION;
740
741NTOSAPI
742NTSTATUS
743NTAPI
744NtShutdownSystem(
745 /*IN*/ SHUTDOWN_ACTION Action);
746
747NTOSAPI
748NTSTATUS
749NTAPI
750ZwShutdownSystem(
751 /*IN*/ SHUTDOWN_ACTION Action);
752
753typedef enum _DEBUG_CONTROL_CODE {
754 DebugGetTraceInformation = 1,
755 DebugSetInternalBreakpoint,
756 DebugSetSpecialCall,
757 DebugClearSpecialCalls,
758 DebugQuerySpecialCalls,
759 DebugDbgBreakPoint,
760 DebugMaximum
761} DEBUG_CONTROL_CODE;
762
763
764NTOSAPI
765NTSTATUS
766NTAPI
767NtSystemDebugControl(
768 /*IN*/ DEBUG_CONTROL_CODE ControlCode,
769 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
770 /*IN*/ ULONG InputBufferLength,
771 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
772 /*IN*/ ULONG OutputBufferLength,
773 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
774
775NTOSAPI
776NTSTATUS
777NTAPI
778ZwSystemDebugControl(
779 /*IN*/ DEBUG_CONTROL_CODE ControlCode,
780 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
781 /*IN*/ ULONG InputBufferLength,
782 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
783 /*IN*/ ULONG OutputBufferLength,
784 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
785
786
787
788/* Objects, Object directories, and symbolic links */
789
790typedef enum _OBJECT_INFORMATION_CLASS {
791 ObjectBasicInformation,
792 ObjectNameInformation,
793 ObjectTypeInformation,
794 ObjectAllTypesInformation,
795 ObjectHandleInformation
796} OBJECT_INFORMATION_CLASS;
797
798NTOSAPI
799NTSTATUS
800NTAPI
801NtQueryObject(
802 /*IN*/ HANDLE ObjectHandle,
803 /*IN*/ OBJECT_INFORMATION_CLASS ObjectInformationClass,
804 /*OUT*/ PVOID ObjectInformation,
805 /*IN*/ ULONG ObjectInformationLength,
806 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
807
808NTOSAPI
809NTSTATUS
810NTAPI
811ZwQueryObject(
812 /*IN*/ HANDLE ObjectHandle,
813 /*IN*/ OBJECT_INFORMATION_CLASS ObjectInformationClass,
814 /*OUT*/ PVOID ObjectInformation,
815 /*IN*/ ULONG ObjectInformationLength,
816 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
817
818NTOSAPI
819NTSTATUS
820NTAPI
821NtSetInformationObject(
822 /*IN*/ HANDLE ObjectHandle,
823 /*IN*/ OBJECT_INFORMATION_CLASS ObjectInformationClass,
824 /*IN*/ PVOID ObjectInformation,
825 /*IN*/ ULONG ObjectInformationLength);
826
827NTOSAPI
828NTSTATUS
829NTAPI
830ZwSetInformationObject(
831 /*IN*/ HANDLE ObjectHandle,
832 /*IN*/ OBJECT_INFORMATION_CLASS ObjectInformationClass,
833 /*IN*/ PVOID ObjectInformation,
834 /*IN*/ ULONG ObjectInformationLength);
835
836/* OBJECT_BASIC_INFORMATION.Attributes constants */
837/* also in winbase.h */
838#define HANDLE_FLAG_INHERIT 0x01
839#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
840/* end winbase.h */
841#define PERMANENT 0x10
842#define EXCLUSIVE 0x20
843
844typedef struct _OBJECT_BASIC_INFORMATION {
845 ULONG Attributes;
846 ACCESS_MASK GrantedAccess;
847 ULONG HandleCount;
848 ULONG PointerCount;
849 ULONG PagedPoolUsage;
850 ULONG NonPagedPoolUsage;
851 ULONG Reserved[3];
852 ULONG NameInformationLength;
853 ULONG TypeInformationLength;
854 ULONG SecurityDescriptorLength;
855 LARGE_INTEGER CreateTime;
856} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
857#if 0
858/* FIXME: Enable later */
859typedef struct _OBJECT_TYPE_INFORMATION {
860 UNICODE_STRING Name;
861 ULONG ObjectCount;
862 ULONG HandleCount;
863 ULONG Reserved1[4];
864 ULONG PeakObjectCount;
865 ULONG PeakHandleCount;
866 ULONG Reserved2[4];
867 ULONG InvalidAttributes;
868 GENERIC_MAPPING GenericMapping;
869 ULONG ValidAccess;
870 UCHAR Unknown;
871 BOOLEAN MaintainHandleDatabase;
872 POOL_TYPE PoolType;
873 ULONG PagedPoolUsage;
874 ULONG NonPagedPoolUsage;
875} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
876
877typedef struct _OBJECT_ALL_TYPES_INFORMATION {
878 ULONG NumberOfTypes;
879 OBJECT_TYPE_INFORMATION TypeInformation;
880} OBJECT_ALL_TYPES_INFORMATION, *POBJECT_ALL_TYPES_INFORMATION;
881#endif
882typedef struct _OBJECT_HANDLE_ATTRIBUTE_INFORMATION {
883 BOOLEAN Inherit;
884 BOOLEAN ProtectFromClose;
885} OBJECT_HANDLE_ATTRIBUTE_INFORMATION, *POBJECT_HANDLE_ATTRIBUTE_INFORMATION;
886
887NTOSAPI
888NTSTATUS
889NTAPI
890NtDuplicateObject(
891 /*IN*/ HANDLE SourceProcessHandle,
892 /*IN*/ HANDLE SourceHandle,
893 /*IN*/ HANDLE TargetProcessHandle,
894 /*OUT*/ PHANDLE TargetHandle /*OPTIONAL*/,
895 /*IN*/ ACCESS_MASK DesiredAccess,
896 /*IN*/ ULONG Attributes,
897 /*IN*/ ULONG Options);
898
899NTOSAPI
900NTSTATUS
901NTAPI
902ZwDuplicateObject(
903 /*IN*/ HANDLE SourceProcessHandle,
904 /*IN*/ HANDLE SourceHandle,
905 /*IN*/ HANDLE TargetProcessHandle,
906 /*OUT*/ PHANDLE TargetHandle /*OPTIONAL*/,
907 /*IN*/ ACCESS_MASK DesiredAccess,
908 /*IN*/ ULONG Attributes,
909 /*IN*/ ULONG Options);
910
911NTOSAPI
912NTSTATUS
913NTAPI
914NtQuerySecurityObject(
915 /*IN*/ HANDLE Handle,
916 /*IN*/ SECURITY_INFORMATION SecurityInformation,
917 /*OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
918 /*IN*/ ULONG SecurityDescriptorLength,
919 /*OUT*/ PULONG ReturnLength);
920
921NTOSAPI
922NTSTATUS
923NTAPI
924ZwQuerySecurityObject(
925 /*IN*/ HANDLE Handle,
926 /*IN*/ SECURITY_INFORMATION SecurityInformation,
927 /*OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
928 /*IN*/ ULONG SecurityDescriptorLength,
929 /*OUT*/ PULONG ReturnLength);
930
931NTOSAPI
932NTSTATUS
933NTAPI
934NtSetSecurityObject(
935 /*IN*/ HANDLE Handle,
936 /*IN*/ SECURITY_INFORMATION SecurityInformation,
937 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
938
939NTOSAPI
940NTSTATUS
941NTAPI
942ZwSetSecurityObject(
943 /*IN*/ HANDLE Handle,
944 /*IN*/ SECURITY_INFORMATION SecurityInformation,
945 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor);
946
947NTOSAPI
948NTSTATUS
949NTAPI
950NtOpenDirectoryObject(
951 /*OUT*/ PHANDLE DirectoryHandle,
952 /*IN*/ ACCESS_MASK DesiredAccess,
953 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
954
955NTOSAPI
956NTSTATUS
957NTAPI
958ZwOpenDirectoryObject(
959 /*OUT*/ PHANDLE DirectoryHandle,
960 /*IN*/ ACCESS_MASK DesiredAccess,
961 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
962
963NTOSAPI
964NTSTATUS
965NTAPI
966NtQueryDirectoryObject(
967 /*IN*/ HANDLE DirectoryHandle,
968 /*OUT*/ PVOID Buffer,
969 /*IN*/ ULONG BufferLength,
970 /*IN*/ BOOLEAN ReturnSingleEntry,
971 /*IN*/ BOOLEAN RestartScan,
972 /*IN OUT*/ PULONG Context,
973 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
974
975NTOSAPI
976NTSTATUS
977NTAPI
978ZwQueryDirectoryObject(
979 /*IN*/ HANDLE DirectoryHandle,
980 /*OUT*/ PVOID Buffer,
981 /*IN*/ ULONG BufferLength,
982 /*IN*/ BOOLEAN ReturnSingleEntry,
983 /*IN*/ BOOLEAN RestartScan,
984 /*IN OUT*/ PULONG Context,
985 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
986
987typedef struct _DIRECTORY_BASIC_INFORMATION {
988 UNICODE_STRING ObjectName;
989 UNICODE_STRING ObjectTypeName;
990} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
991
992NTOSAPI
993NTSTATUS
994NTAPI
995NtCreateSymbolicLinkObject(
996 /*OUT*/ PHANDLE SymbolicLinkHandle,
997 /*IN*/ ACCESS_MASK DesiredAccess,
998 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
999 /*IN*/ PUNICODE_STRING TargetName);
1000
1001NTOSAPI
1002NTSTATUS
1003NTAPI
1004ZwCreateSymbolicLinkObject(
1005 /*OUT*/ PHANDLE SymbolicLinkHandle,
1006 /*IN*/ ACCESS_MASK DesiredAccess,
1007 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1008 /*IN*/ PUNICODE_STRING TargetName);
1009
1010
1011
1012
1013/* Virtual memory */
1014
1015typedef enum _MEMORY_INFORMATION_CLASS {
1016MemoryBasicInformation,
1017MemoryWorkingSetList,
1018MemorySectionName,
1019MemoryBasicVlmInformation
1020} MEMORY_INFORMATION_CLASS;
1021
1022NTOSAPI
1023NTSTATUS
1024NTAPI
1025NtAllocateVirtualMemory(
1026 /*IN*/ HANDLE ProcessHandle,
1027 /*IN OUT*/ PVOID *BaseAddress,
1028 /*IN*/ ULONG ZeroBits,
1029 /*IN OUT*/ PULONG AllocationSize,
1030 /*IN*/ ULONG AllocationType,
1031 /*IN*/ ULONG Protect);
1032
1033NTOSAPI
1034NTSTATUS
1035NTAPI
1036ZwAllocateVirtualMemory(
1037 /*IN*/ HANDLE ProcessHandle,
1038 /*IN OUT*/ PVOID *BaseAddress,
1039 /*IN*/ ULONG ZeroBits,
1040 /*IN OUT*/ PULONG AllocationSize,
1041 /*IN*/ ULONG AllocationType,
1042 /*IN*/ ULONG Protect);
1043
1044NTOSAPI
1045NTSTATUS
1046NTAPI
1047NtFreeVirtualMemory(
1048 /*IN*/ HANDLE ProcessHandle,
1049 /*IN OUT*/ PVOID *BaseAddress,
1050 /*IN OUT*/ PULONG FreeSize,
1051 /*IN*/ ULONG FreeType);
1052
1053NTOSAPI
1054NTSTATUS
1055NTAPI
1056ZwFreeVirtualMemory(
1057 /*IN*/ HANDLE ProcessHandle,
1058 /*IN OUT*/ PVOID *BaseAddress,
1059 /*IN OUT*/ PULONG FreeSize,
1060 /*IN*/ ULONG FreeType);
1061
1062NTOSAPI
1063NTSTATUS
1064NTAPI
1065NtQueryVirtualMemory(
1066 /*IN*/ HANDLE ProcessHandle,
1067 /*IN*/ PVOID BaseAddress,
1068 /*IN*/ MEMORY_INFORMATION_CLASS MemoryInformationClass,
1069 /*OUT*/ PVOID MemoryInformation,
1070 /*IN*/ ULONG MemoryInformationLength,
1071 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1072
1073NTOSAPI
1074NTSTATUS
1075NTAPI
1076ZwQueryVirtualMemory(
1077 /*IN*/ HANDLE ProcessHandle,
1078 /*IN*/ PVOID BaseAddress,
1079 /*IN*/ MEMORY_INFORMATION_CLASS MemoryInformationClass,
1080 /*OUT*/ PVOID MemoryInformation,
1081 /*IN*/ ULONG MemoryInformationLength,
1082 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1083
1084/* MEMORY_WORKING_SET_LIST.WorkingSetList constants */
1085#define WSLE_PAGE_READONLY 0x001
1086#define WSLE_PAGE_EXECUTE 0x002
1087#define WSLE_PAGE_READWRITE 0x004
1088#define WSLE_PAGE_EXECUTE_READ 0x003
1089#define WSLE_PAGE_WRITECOPY 0x005
1090#define WSLE_PAGE_EXECUTE_READWRITE 0x006
1091#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
1092#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
1093#define WSLE_PAGE_SHAREABLE 0x100
1094
1095typedef struct _MEMORY_WORKING_SET_LIST {
1096 ULONG NumberOfPages;
1097 ULONG WorkingSetList[1];
1098} MEMORY_WORKING_SET_LIST, *PMEMORY_WORKING_SET_LIST;
1099
1100typedef struct _MEMORY_SECTION_NAME {
1101 UNICODE_STRING SectionFileName;
1102} MEMORY_SECTION_NAME, *PMEMORY_SECTION_NAME;
1103
1104/* Zw[Lock|Unlock]VirtualMemory.LockType constants */
1105#define LOCK_VM_IN_WSL 0x01
1106#define LOCK_VM_IN_RAM 0x02
1107
1108NTOSAPI
1109NTSTATUS
1110NTAPI
1111NtLockVirtualMemory(
1112 /*IN*/ HANDLE ProcessHandle,
1113 /*IN OUT*/ PVOID *BaseAddress,
1114 /*IN OUT*/ PULONG LockSize,
1115 /*IN*/ ULONG LockType);
1116
1117NTOSAPI
1118NTSTATUS
1119NTAPI
1120ZwLockVirtualMemory(
1121 /*IN*/ HANDLE ProcessHandle,
1122 /*IN OUT*/ PVOID *BaseAddress,
1123 /*IN OUT*/ PULONG LockSize,
1124 /*IN*/ ULONG LockType);
1125
1126NTOSAPI
1127NTSTATUS
1128NTAPI
1129NtUnlockVirtualMemory(
1130 /*IN*/ HANDLE ProcessHandle,
1131 /*IN OUT*/ PVOID *BaseAddress,
1132 /*IN OUT*/ PULONG LockSize,
1133 /*IN*/ ULONG LockType);
1134
1135NTOSAPI
1136NTSTATUS
1137NTAPI
1138ZwUnlockVirtualMemory(
1139 /*IN*/ HANDLE ProcessHandle,
1140 /*IN OUT*/ PVOID *BaseAddress,
1141 /*IN OUT*/ PULONG LockSize,
1142 /*IN*/ ULONG LockType);
1143
1144NTOSAPI
1145NTSTATUS
1146NTAPI
1147NtReadVirtualMemory(
1148 /*IN*/ HANDLE ProcessHandle,
1149 /*IN*/ PVOID BaseAddress,
1150 /*OUT*/ PVOID Buffer,
1151 /*IN*/ ULONG BufferLength,
1152 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1153
1154NTOSAPI
1155NTSTATUS
1156NTAPI
1157ZwReadVirtualMemory(
1158 /*IN*/ HANDLE ProcessHandle,
1159 /*IN*/ PVOID BaseAddress,
1160 /*OUT*/ PVOID Buffer,
1161 /*IN*/ ULONG BufferLength,
1162 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1163
1164NTOSAPI
1165NTSTATUS
1166NTAPI
1167NtWriteVirtualMemory(
1168 /*IN*/ HANDLE ProcessHandle,
1169 /*IN*/ PVOID BaseAddress,
1170 /*IN*/ PVOID Buffer,
1171 /*IN*/ ULONG BufferLength,
1172 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1173
1174NTOSAPI
1175NTSTATUS
1176NTAPI
1177ZwWriteVirtualMemory(
1178 /*IN*/ HANDLE ProcessHandle,
1179 /*IN*/ PVOID BaseAddress,
1180 /*IN*/ PVOID Buffer,
1181 /*IN*/ ULONG BufferLength,
1182 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1183
1184NTOSAPI
1185NTSTATUS
1186NTAPI
1187NtProtectVirtualMemory(
1188 /*IN*/ HANDLE ProcessHandle,
1189 /*IN OUT*/ PVOID *BaseAddress,
1190 /*IN OUT*/ PULONG ProtectSize,
1191 /*IN*/ ULONG NewProtect,
1192 /*OUT*/ PULONG OldProtect);
1193
1194NTOSAPI
1195NTSTATUS
1196NTAPI
1197ZwProtectVirtualMemory(
1198 /*IN*/ HANDLE ProcessHandle,
1199 /*IN OUT*/ PVOID *BaseAddress,
1200 /*IN OUT*/ PULONG ProtectSize,
1201 /*IN*/ ULONG NewProtect,
1202 /*OUT*/ PULONG OldProtect);
1203
1204NTOSAPI
1205NTSTATUS
1206NTAPI
1207NtFlushVirtualMemory(
1208 /*IN*/ HANDLE ProcessHandle,
1209 /*IN OUT*/ PVOID *BaseAddress,
1210 /*IN OUT*/ PULONG FlushSize,
1211 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
1212
1213NTOSAPI
1214NTSTATUS
1215NTAPI
1216ZwFlushVirtualMemory(
1217 /*IN*/ HANDLE ProcessHandle,
1218 /*IN OUT*/ PVOID *BaseAddress,
1219 /*IN OUT*/ PULONG FlushSize,
1220 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
1221
1222NTOSAPI
1223NTSTATUS
1224NTAPI
1225NtAllocateUserPhysicalPages(
1226 /*IN*/ HANDLE ProcessHandle,
1227 /*IN*/ PULONG NumberOfPages,
1228 /*OUT*/ PULONG PageFrameNumbers);
1229
1230NTOSAPI
1231NTSTATUS
1232NTAPI
1233ZwAllocateUserPhysicalPages(
1234 /*IN*/ HANDLE ProcessHandle,
1235 /*IN*/ PULONG NumberOfPages,
1236 /*OUT*/ PULONG PageFrameNumbers);
1237
1238NTOSAPI
1239NTSTATUS
1240NTAPI
1241NtFreeUserPhysicalPages(
1242 /*IN*/ HANDLE ProcessHandle,
1243 /*IN OUT*/ PULONG NumberOfPages,
1244 /*IN*/ PULONG PageFrameNumbers);
1245
1246NTOSAPI
1247NTSTATUS
1248NTAPI
1249ZwFreeUserPhysicalPages(
1250 /*IN*/ HANDLE ProcessHandle,
1251 /*IN OUT*/ PULONG NumberOfPages,
1252 /*IN*/ PULONG PageFrameNumbers);
1253
1254NTOSAPI
1255NTSTATUS
1256NTAPI
1257NtMapUserPhysicalPages(
1258 /*IN*/ PVOID BaseAddress,
1259 /*IN*/ PULONG NumberOfPages,
1260 /*IN*/ PULONG PageFrameNumbers);
1261
1262NTOSAPI
1263NTSTATUS
1264NTAPI
1265ZwMapUserPhysicalPages(
1266 /*IN*/ PVOID BaseAddress,
1267 /*IN*/ PULONG NumberOfPages,
1268 /*IN*/ PULONG PageFrameNumbers);
1269
1270NTOSAPI
1271NTSTATUS
1272NTAPI
1273NtMapUserPhysicalPagesScatter(
1274 /*IN*/ PVOID *BaseAddresses,
1275 /*IN*/ PULONG NumberOfPages,
1276 /*IN*/ PULONG PageFrameNumbers);
1277
1278NTOSAPI
1279NTSTATUS
1280NTAPI
1281ZwMapUserPhysicalPagesScatter(
1282 /*IN*/ PVOID *BaseAddresses,
1283 /*IN*/ PULONG NumberOfPages,
1284 /*IN*/ PULONG PageFrameNumbers);
1285
1286NTOSAPI
1287NTSTATUS
1288NTAPI
1289NtGetWriteWatch(
1290 /*IN*/ HANDLE ProcessHandle,
1291 /*IN*/ ULONG Flags,
1292 /*IN*/ PVOID BaseAddress,
1293 /*IN*/ ULONG RegionSize,
1294 /*OUT*/ PULONG Buffer,
1295 /*IN OUT*/ PULONG BufferEntries,
1296 /*OUT*/ PULONG Granularity);
1297
1298NTOSAPI
1299NTSTATUS
1300NTAPI
1301ZwGetWriteWatch(
1302 /*IN*/ HANDLE ProcessHandle,
1303 /*IN*/ ULONG Flags,
1304 /*IN*/ PVOID BaseAddress,
1305 /*IN*/ ULONG RegionSize,
1306 /*OUT*/ PULONG Buffer,
1307 /*IN OUT*/ PULONG BufferEntries,
1308 /*OUT*/ PULONG Granularity);
1309
1310NTOSAPI
1311NTSTATUS
1312NTAPI
1313NtResetWriteWatch(
1314 /*IN*/ HANDLE ProcessHandle,
1315 /*IN*/ PVOID BaseAddress,
1316 /*IN*/ ULONG RegionSize);
1317
1318NTOSAPI
1319NTSTATUS
1320NTAPI
1321ZwResetWriteWatch(
1322 /*IN*/ HANDLE ProcessHandle,
1323 /*IN*/ PVOID BaseAddress,
1324 /*IN*/ ULONG RegionSize);
1325
1326
1327
1328
1329/* Sections */
1330
1331typedef enum _SECTION_INFORMATION_CLASS {
1332 SectionBasicInformation,
1333 SectionImageInformation
1334} SECTION_INFORMATION_CLASS;
1335
1336NTOSAPI
1337NTSTATUS
1338NTAPI
1339NtCreateSection(
1340 /*OUT*/ PHANDLE SectionHandle,
1341 /*IN*/ ACCESS_MASK DesiredAccess,
1342 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1343 /*IN*/ PLARGE_INTEGER SectionSize /*OPTIONAL*/,
1344 /*IN*/ ULONG Protect,
1345 /*IN*/ ULONG Attributes,
1346 /*IN*/ HANDLE FileHandle);
1347
1348NTOSAPI
1349NTSTATUS
1350NTAPI
1351ZwCreateSection(
1352 /*OUT*/ PHANDLE SectionHandle,
1353 /*IN*/ ACCESS_MASK DesiredAccess,
1354 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1355 /*IN*/ PLARGE_INTEGER SectionSize /*OPTIONAL*/,
1356 /*IN*/ ULONG Protect,
1357 /*IN*/ ULONG Attributes,
1358 /*IN*/ HANDLE FileHandle);
1359
1360NTOSAPI
1361NTSTATUS
1362NTAPI
1363NtQuerySection(
1364 /*IN*/ HANDLE SectionHandle,
1365 /*IN*/ SECTION_INFORMATION_CLASS SectionInformationClass,
1366 /*OUT*/ PVOID SectionInformation,
1367 /*IN*/ ULONG SectionInformationLength,
1368 /*OUT*/ PULONG ResultLength /*OPTIONAL*/);
1369
1370NTOSAPI
1371NTSTATUS
1372NTAPI
1373ZwQuerySection(
1374 /*IN*/ HANDLE SectionHandle,
1375 /*IN*/ SECTION_INFORMATION_CLASS SectionInformationClass,
1376 /*OUT*/ PVOID SectionInformation,
1377 /*IN*/ ULONG SectionInformationLength,
1378 /*OUT*/ PULONG ResultLength /*OPTIONAL*/);
1379
1380NTOSAPI
1381NTSTATUS
1382NTAPI
1383NtExtendSection(
1384 /*IN*/ HANDLE SectionHandle,
1385 /*IN*/ PLARGE_INTEGER SectionSize);
1386
1387NTOSAPI
1388NTSTATUS
1389NTAPI
1390ZwExtendSection(
1391 /*IN*/ HANDLE SectionHandle,
1392 /*IN*/ PLARGE_INTEGER SectionSize);
1393
1394NTOSAPI
1395NTSTATUS
1396NTAPI
1397NtAreMappedFilesTheSame(
1398 /*IN*/ PVOID Address1,
1399 /*IN*/ PVOID Address2);
1400
1401NTOSAPI
1402NTSTATUS
1403NTAPI
1404ZwAreMappedFilesTheSame(
1405 /*IN*/ PVOID Address1,
1406 /*IN*/ PVOID Address2);
1407
1408
1409
1410
1411/* Threads */
1412
1413typedef struct _USER_STACK {
1414 PVOID FixedStackBase;
1415 PVOID FixedStackLimit;
1416 PVOID ExpandableStackBase;
1417 PVOID ExpandableStackLimit;
1418 PVOID ExpandableStackBottom;
1419} USER_STACK, *PUSER_STACK;
1420
1421NTOSAPI
1422NTSTATUS
1423NTAPI
1424NtCreateThread(
1425 /*OUT*/ PHANDLE ThreadHandle,
1426 /*IN*/ ACCESS_MASK DesiredAccess,
1427 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1428 /*IN*/ HANDLE ProcessHandle,
1429 /*OUT*/ PCLIENT_ID ClientId,
1430 /*IN*/ PCONTEXT ThreadContext,
1431 /*IN*/ PUSER_STACK UserStack,
1432 /*IN*/ BOOLEAN CreateSuspended);
1433
1434NTOSAPI
1435NTSTATUS
1436NTAPI
1437ZwCreateThread(
1438 /*OUT*/ PHANDLE ThreadHandle,
1439 /*IN*/ ACCESS_MASK DesiredAccess,
1440 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1441 /*IN*/ HANDLE ProcessHandle,
1442 /*OUT*/ PCLIENT_ID ClientId,
1443 /*IN*/ PCONTEXT ThreadContext,
1444 /*IN*/ PUSER_STACK UserStack,
1445 /*IN*/ BOOLEAN CreateSuspended);
1446
1447NTOSAPI
1448NTSTATUS
1449NTAPI
1450NtOpenThread(
1451 /*OUT*/ PHANDLE ThreadHandle,
1452 /*IN*/ ACCESS_MASK DesiredAccess,
1453 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1454 /*IN*/ PCLIENT_ID ClientId);
1455
1456NTOSAPI
1457NTSTATUS
1458NTAPI
1459ZwOpenThread(
1460 /*OUT*/ PHANDLE ThreadHandle,
1461 /*IN*/ ACCESS_MASK DesiredAccess,
1462 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1463 /*IN*/ PCLIENT_ID ClientId);
1464
1465NTOSAPI
1466NTSTATUS
1467NTAPI
1468NtTerminateThread(
1469 /*IN*/ HANDLE ThreadHandle /*OPTIONAL*/,
1470 /*IN*/ NTSTATUS ExitStatus);
1471
1472NTOSAPI
1473NTSTATUS
1474NTAPI
1475ZwTerminateThread(
1476 /*IN*/ HANDLE ThreadHandle /*OPTIONAL*/,
1477 /*IN*/ NTSTATUS ExitStatus);
1478
1479NTOSAPI
1480NTSTATUS
1481NTAPI
1482NtQueryInformationThread(
1483 /*IN*/ HANDLE ThreadHandle,
1484 /*IN*/ THREADINFOCLASS ThreadInformationClass,
1485 /*OUT*/ PVOID ThreadInformation,
1486 /*IN*/ ULONG ThreadInformationLength,
1487 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1488
1489NTOSAPI
1490NTSTATUS
1491NTAPI
1492ZwQueryInformationThread(
1493 /*IN*/ HANDLE ThreadHandle,
1494 /*IN*/ THREADINFOCLASS ThreadInformationClass,
1495 /*OUT*/ PVOID ThreadInformation,
1496 /*IN*/ ULONG ThreadInformationLength,
1497 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1498
1499NTOSAPI
1500NTSTATUS
1501NTAPI
1502NtSetInformationThread(
1503 /*IN*/ HANDLE ThreadHandle,
1504 /*IN*/ THREADINFOCLASS ThreadInformationClass,
1505 /*IN*/ PVOID ThreadInformation,
1506 /*IN*/ ULONG ThreadInformationLength);
1507
1508NTOSAPI
1509NTSTATUS
1510NTAPI
1511ZwSetInformationThread(
1512 /*IN*/ HANDLE ThreadHandle,
1513 /*IN*/ THREADINFOCLASS ThreadInformationClass,
1514 /*IN*/ PVOID ThreadInformation,
1515 /*IN*/ ULONG ThreadInformationLength);
1516
1517typedef struct _THREAD_BASIC_INFORMATION {
1518 NTSTATUS ExitStatus;
1519 PNT_TIB TebBaseAddress;
1520 CLIENT_ID ClientId;
1521 KAFFINITY AffinityMask;
1522 KPRIORITY Priority;
1523 KPRIORITY BasePriority;
1524} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
1525
1526typedef struct _KERNEL_USER_TIMES {
1527 LARGE_INTEGER CreateTime;
1528 LARGE_INTEGER ExitTime;
1529 LARGE_INTEGER KernelTime;
1530 LARGE_INTEGER UserTime;
1531} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
1532
1533NTOSAPI
1534NTSTATUS
1535NTAPI
1536NtSuspendThread(
1537 /*IN*/ HANDLE ThreadHandle,
1538 /*OUT*/ PULONG PreviousSuspendCount /*OPTIONAL*/);
1539
1540NTOSAPI
1541NTSTATUS
1542NTAPI
1543ZwSuspendThread(
1544 /*IN*/ HANDLE ThreadHandle,
1545 /*OUT*/ PULONG PreviousSuspendCount /*OPTIONAL*/);
1546
1547NTOSAPI
1548NTSTATUS
1549NTAPI
1550NtResumeThread(
1551 /*IN*/ HANDLE ThreadHandle,
1552 /*OUT*/ PULONG PreviousSuspendCount /*OPTIONAL*/);
1553
1554NTOSAPI
1555NTSTATUS
1556NTAPI
1557ZwResumeThread(
1558 /*IN*/ HANDLE ThreadHandle,
1559 /*OUT*/ PULONG PreviousSuspendCount /*OPTIONAL*/);
1560
1561NTOSAPI
1562NTSTATUS
1563NTAPI
1564NtGetContextThread(
1565 /*IN*/ HANDLE ThreadHandle,
1566 /*OUT*/ PCONTEXT Context);
1567
1568NTOSAPI
1569NTSTATUS
1570NTAPI
1571ZwGetContextThread(
1572 /*IN*/ HANDLE ThreadHandle,
1573 /*OUT*/ PCONTEXT Context);
1574
1575NTOSAPI
1576NTSTATUS
1577NTAPI
1578NtSetContextThread(
1579 /*IN*/ HANDLE ThreadHandle,
1580 /*IN*/ PCONTEXT Context);
1581
1582NTOSAPI
1583NTSTATUS
1584NTAPI
1585ZwSetContextThread(
1586 /*IN*/ HANDLE ThreadHandle,
1587 /*IN*/ PCONTEXT Context);
1588
1589NTOSAPI
1590NTSTATUS
1591NTAPI
1592NtQueueApcThread(
1593 /*IN*/ HANDLE ThreadHandle,
1594 /*IN*/ PKNORMAL_ROUTINE ApcRoutine,
1595 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
1596 /*IN*/ PVOID Argument1 /*OPTIONAL*/,
1597 /*IN*/ PVOID Argument2 /*OPTIONAL*/);
1598
1599NTOSAPI
1600NTSTATUS
1601NTAPI
1602ZwQueueApcThread(
1603 /*IN*/ HANDLE ThreadHandle,
1604 /*IN*/ PKNORMAL_ROUTINE ApcRoutine,
1605 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
1606 /*IN*/ PVOID Argument1 /*OPTIONAL*/,
1607 /*IN*/ PVOID Argument2 /*OPTIONAL*/);
1608
1609NTOSAPI
1610NTSTATUS
1611NTAPI
1612NtTestAlert(
1613 VOID);
1614
1615NTOSAPI
1616NTSTATUS
1617NTAPI
1618ZwTestAlert(
1619 VOID);
1620
1621NTOSAPI
1622NTSTATUS
1623NTAPI
1624NtAlertThread(
1625 /*IN*/ HANDLE ThreadHandle);
1626
1627NTOSAPI
1628NTSTATUS
1629NTAPI
1630ZwAlertThread(
1631 /*IN*/ HANDLE ThreadHandle);
1632
1633NTOSAPI
1634NTSTATUS
1635NTAPI
1636NtAlertResumeThread(
1637 /*IN*/ HANDLE ThreadHandle,
1638 /*OUT*/ PULONG PreviousSuspendCount /*OPTIONAL*/);
1639
1640NTOSAPI
1641NTSTATUS
1642NTAPI
1643ZwAlertResumeThread(
1644 /*IN*/ HANDLE ThreadHandle,
1645 /*OUT*/ PULONG PreviousSuspendCount /*OPTIONAL*/);
1646
1647NTOSAPI
1648NTSTATUS
1649NTAPI
1650NtRegisterThreadTerminatePort(
1651 /*IN*/ HANDLE PortHandle);
1652
1653NTOSAPI
1654NTSTATUS
1655NTAPI
1656ZwRegisterThreadTerminatePort(
1657 /*IN*/ HANDLE PortHandle);
1658
1659NTOSAPI
1660NTSTATUS
1661NTAPI
1662NtImpersonateThread(
1663 /*IN*/ HANDLE ThreadHandle,
1664 /*IN*/ HANDLE TargetThreadHandle,
1665 /*IN*/ PSECURITY_QUALITY_OF_SERVICE SecurityQos);
1666
1667NTOSAPI
1668NTSTATUS
1669NTAPI
1670ZwImpersonateThread(
1671 /*IN*/ HANDLE ThreadHandle,
1672 /*IN*/ HANDLE TargetThreadHandle,
1673 /*IN*/ PSECURITY_QUALITY_OF_SERVICE SecurityQos);
1674
1675NTOSAPI
1676NTSTATUS
1677NTAPI
1678NtImpersonateAnonymousToken(
1679 /*IN*/ HANDLE ThreadHandle);
1680
1681NTOSAPI
1682NTSTATUS
1683NTAPI
1684ZwImpersonateAnonymousToken(
1685 /*IN*/ HANDLE ThreadHandle);
1686
1687
1688
1689
1690/* Processes */
1691
1692NTOSAPI
1693NTSTATUS
1694NTAPI
1695NtCreateProcess(
1696 /*OUT*/ PHANDLE ProcessHandle,
1697 /*IN*/ ACCESS_MASK DesiredAccess,
1698 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1699 /*IN*/ HANDLE InheritFromProcessHandle,
1700 /*IN*/ BOOLEAN InheritHandles,
1701 /*IN*/ HANDLE SectionHandle /*OPTIONAL*/,
1702 /*IN*/ HANDLE DebugPort /*OPTIONAL*/,
1703 /*IN*/ HANDLE ExceptionPort /*OPTIONAL*/);
1704
1705NTOSAPI
1706NTSTATUS
1707NTAPI
1708ZwCreateProcess(
1709 /*OUT*/ PHANDLE ProcessHandle,
1710 /*IN*/ ACCESS_MASK DesiredAccess,
1711 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
1712 /*IN*/ HANDLE InheritFromProcessHandle,
1713 /*IN*/ BOOLEAN InheritHandles,
1714 /*IN*/ HANDLE SectionHandle /*OPTIONAL*/,
1715 /*IN*/ HANDLE DebugPort /*OPTIONAL*/,
1716 /*IN*/ HANDLE ExceptionPort /*OPTIONAL*/);
1717
1718NTOSAPI
1719NTSTATUS
1720NTAPI
1721NtTerminateProcess(
1722 /*IN*/ HANDLE ProcessHandle /*OPTIONAL*/,
1723 /*IN*/ NTSTATUS ExitStatus);
1724
1725NTOSAPI
1726NTSTATUS
1727NTAPI
1728ZwTerminateProcess(
1729 /*IN*/ HANDLE ProcessHandle /*OPTIONAL*/,
1730 /*IN*/ NTSTATUS ExitStatus);
1731
1732NTOSAPI
1733NTSTATUS
1734NTAPI
1735NtQueryInformationProcess(
1736 /*IN*/ HANDLE ProcessHandle,
1737 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
1738 /*OUT*/ PVOID ProcessInformation,
1739 /*IN*/ ULONG ProcessInformationLength,
1740 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1741
1742NTOSAPI
1743NTSTATUS
1744NTAPI
1745ZwQueryInformationProcess(
1746 /*IN*/ HANDLE ProcessHandle,
1747 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
1748 /*OUT*/ PVOID ProcessInformation,
1749 /*IN*/ ULONG ProcessInformationLength,
1750 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
1751
1752NTOSAPI
1753NTSTATUS
1754NTAPI
1755NtSetInformationProcess(
1756 /*IN*/ HANDLE ProcessHandle,
1757 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
1758 /*IN*/ PVOID ProcessInformation,
1759 /*IN*/ ULONG ProcessInformationLength);
1760
1761NTOSAPI
1762NTSTATUS
1763NTAPI
1764ZwSetInformationProcess(
1765 /*IN*/ HANDLE ProcessHandle,
1766 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
1767 /*IN*/ PVOID ProcessInformation,
1768 /*IN*/ ULONG ProcessInformationLength);
1769
1770typedef struct _PROCESS_BASIC_INFORMATION {
1771 NTSTATUS ExitStatus;
1772 PPEB PebBaseAddress;
1773 KAFFINITY AffinityMask;
1774 KPRIORITY BasePriority;
1775 ULONG UniqueProcessId;
1776 ULONG InheritedFromUniqueProcessId;
1777} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
1778
1779typedef struct _PROCESS_ACCESS_TOKEN {
1780 HANDLE Token;
1781 HANDLE Thread;
1782} PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN;
1783
1784/* DefaultHardErrorMode constants */
1785/* also in winbase.h */
1786#define SEM_FAILCRITICALERRORS 0x0001
1787#define SEM_NOGPFAULTERRORBOX 0x0002
1788#define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
1789#define SEM_NOOPENFILEERRORBOX 0x8000
1790/* end winbase.h */
1791typedef struct _POOLED_USAGE_AND_LIMITS {
1792 ULONG PeakPagedPoolUsage;
1793 ULONG PagedPoolUsage;
1794 ULONG PagedPoolLimit;
1795 ULONG PeakNonPagedPoolUsage;
1796 ULONG NonPagedPoolUsage;
1797 ULONG NonPagedPoolLimit;
1798 ULONG PeakPagefileUsage;
1799 ULONG PagefileUsage;
1800 ULONG PagefileLimit;
1801} POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS;
1802
1803typedef struct _PROCESS_WS_WATCH_INFORMATION {
1804 PVOID FaultingPc;
1805 PVOID FaultingVa;
1806} PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION;
1807
1808/* PROCESS_PRIORITY_CLASS.PriorityClass constants */
1809#define PC_IDLE 1
1810#define PC_NORMAL 2
1811#define PC_HIGH 3
1812#define PC_REALTIME 4
1813#define PC_BELOW_NORMAL 5
1814#define PC_ABOVE_NORMAL 6
1815
1816typedef struct _PROCESS_PRIORITY_CLASS {
1817 BOOLEAN Foreground;
1818 UCHAR PriorityClass;
1819} PROCESS_PRIORITY_CLASS, *PPROCESS_PRIORITY_CLASS;
1820
1821/* PROCESS_DEVICEMAP_INFORMATION.DriveType constants */
1822#define DRIVE_UNKNOWN 0
1823#define DRIVE_NO_ROOT_DIR 1
1824#define DRIVE_REMOVABLE 2
1825#define DRIVE_FIXED 3
1826#define DRIVE_REMOTE 4
1827#define DRIVE_CDROM 5
1828#define DRIVE_RAMDISK 6
1829
1830typedef struct _PROCESS_DEVICEMAP_INFORMATION {
1831 _ANONYMOUS_UNION union {
1832 struct {
1833 HANDLE DirectoryHandle;
1834 } Set;
1835 struct {
1836 ULONG DriveMap;
1837 UCHAR DriveType[32];
1838 } Query;
1839 } DUMMYUNIONNAME;
1840} PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION;
1841
1842typedef struct _PROCESS_SESSION_INFORMATION {
1843 ULONG SessionId;
1844} PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
1845
1846typedef struct _RTL_USER_PROCESS_PARAMETERS {
1847 ULONG AllocationSize;
1848 ULONG Size;
1849 ULONG Flags;
1850 ULONG DebugFlags;
1851 HANDLE hConsole;
1852 ULONG ProcessGroup;
1853 HANDLE hStdInput;
1854 HANDLE hStdOutput;
1855 HANDLE hStdError;
1856 UNICODE_STRING CurrentDirectoryName;
1857 HANDLE CurrentDirectoryHandle;
1858 UNICODE_STRING DllPath;
1859 UNICODE_STRING ImagePathName;
1860 UNICODE_STRING CommandLine;
1861 PWSTR Environment;
1862 ULONG dwX;
1863 ULONG dwY;
1864 ULONG dwXSize;
1865 ULONG dwYSize;
1866 ULONG dwXCountChars;
1867 ULONG dwYCountChars;
1868 ULONG dwFillAttribute;
1869 ULONG dwFlags;
1870 ULONG wShowWindow;
1871 UNICODE_STRING WindowTitle;
1872 UNICODE_STRING DesktopInfo;
1873 UNICODE_STRING ShellInfo;
1874 UNICODE_STRING RuntimeInfo;
1875} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
1876
1877NTSTATUS
1878NTAPI
1879RtlCreateProcessParameters(
1880 /*OUT*/ PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
1881 /*IN*/ PUNICODE_STRING ImageFile,
1882 /*IN*/ PUNICODE_STRING DllPath /*OPTIONAL*/,
1883 /*IN*/ PUNICODE_STRING CurrentDirectory /*OPTIONAL*/,
1884 /*IN*/ PUNICODE_STRING CommandLine /*OPTIONAL*/,
1885 /*IN*/ PWSTR Environment /*OPTIONAL*/,
1886 /*IN*/ PUNICODE_STRING WindowTitle /*OPTIONAL*/,
1887 /*IN*/ PUNICODE_STRING DesktopInfo /*OPTIONAL*/,
1888 /*IN*/ PUNICODE_STRING ShellInfo /*OPTIONAL*/,
1889 /*IN*/ PUNICODE_STRING RuntimeInfo /*OPTIONAL*/);
1890
1891NTSTATUS
1892NTAPI
1893RtlDestroyProcessParameters(
1894 /*IN*/ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1895
1896typedef struct _DEBUG_BUFFER {
1897 HANDLE SectionHandle;
1898 PVOID SectionBase;
1899 PVOID RemoteSectionBase;
1900 ULONG SectionBaseDelta;
1901 HANDLE EventPairHandle;
1902 ULONG Unknown[2];
1903 HANDLE RemoteThreadHandle;
1904 ULONG InfoClassMask;
1905 ULONG SizeOfInfo;
1906 ULONG AllocatedSize;
1907 ULONG SectionSize;
1908 PVOID ModuleInformation;
1909 PVOID BackTraceInformation;
1910 PVOID HeapInformation;
1911 PVOID LockInformation;
1912 PVOID Reserved[8];
1913} DEBUG_BUFFER, *PDEBUG_BUFFER;
1914
1915PDEBUG_BUFFER
1916NTAPI
1917RtlCreateQueryDebugBuffer(
1918 /*IN*/ ULONG Size,
1919 /*IN*/ BOOLEAN EventPair);
1920
1921/* RtlQueryProcessDebugInformation.DebugInfoClassMask constants */
1922#define PDI_MODULES 0x01
1923#define PDI_BACKTRACE 0x02
1924#define PDI_HEAPS 0x04
1925#define PDI_HEAP_TAGS 0x08
1926#define PDI_HEAP_BLOCKS 0x10
1927#define PDI_LOCKS 0x20
1928
1929NTSTATUS
1930NTAPI
1931RtlQueryProcessDebugInformation(
1932 /*IN*/ ULONG ProcessId,
1933 /*IN*/ ULONG DebugInfoClassMask,
1934 /*IN OUT*/ PDEBUG_BUFFER DebugBuffer);
1935
1936NTSTATUS
1937NTAPI
1938RtlDestroyQueryDebugBuffer(
1939 /*IN*/ PDEBUG_BUFFER DebugBuffer);
1940
1941/* DEBUG_MODULE_INFORMATION.Flags constants */
1942#define LDRP_STATIC_LINK 0x00000002
1943#define LDRP_IMAGE_DLL 0x00000004
1944#define LDRP_LOAD_IN_PROGRESS 0x00001000
1945#define LDRP_UNLOAD_IN_PROGRESS 0x00002000
1946#define LDRP_ENTRY_PROCESSED 0x00004000
1947#define LDRP_ENTRY_INSERTED 0x00008000
1948#define LDRP_CURRENT_LOAD 0x00010000
1949#define LDRP_FAILED_BUILTIN_LOAD 0x00020000
1950#define LDRP_DONT_CALL_FOR_THREADS 0x00040000
1951#define LDRP_PROCESS_ATTACH_CALLED 0x00080000
1952#define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
1953#define LDRP_IMAGE_NOT_AT_BASE 0x00200000
1954#define LDRP_WX86_IGNORE_MACHINETYPE 0x00400000
1955
1956typedef struct _DEBUG_MODULE_INFORMATION {
1957 ULONG Reserved[2];
1958 ULONG Base;
1959 ULONG Size;
1960 ULONG Flags;
1961 USHORT Index;
1962 USHORT Unknown;
1963 USHORT LoadCount;
1964 USHORT ModuleNameOffset;
1965 CHAR ImageName[256];
1966} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
1967
1968typedef struct _DEBUG_HEAP_INFORMATION {
1969 ULONG Base;
1970 ULONG Flags;
1971 USHORT Granularity;
1972 USHORT Unknown;
1973 ULONG Allocated;
1974 ULONG Committed;
1975 ULONG TagCount;
1976 ULONG BlockCount;
1977 ULONG Reserved[7];
1978 PVOID Tags;
1979 PVOID Blocks;
1980} DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
1981
1982typedef struct _DEBUG_LOCK_INFORMATION {
1983 PVOID Address;
1984 USHORT Type;
1985 USHORT CreatorBackTraceIndex;
1986 ULONG OwnerThreadId;
1987 ULONG ActiveCount;
1988 ULONG ContentionCount;
1989 ULONG EntryCount;
1990 ULONG RecursionCount;
1991 ULONG NumberOfSharedWaiters;
1992 ULONG NumberOfExclusiveWaiters;
1993} DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
1994
1995
1996
1997/* Jobs */
1998
1999NTOSAPI
2000NTSTATUS
2001NTAPI
2002NtCreateJobObject(
2003 /*OUT*/ PHANDLE JobHandle,
2004 /*IN*/ ACCESS_MASK DesiredAccess,
2005 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
2006
2007NTOSAPI
2008NTSTATUS
2009NTAPI
2010ZwCreateJobObject(
2011 /*OUT*/ PHANDLE JobHandle,
2012 /*IN*/ ACCESS_MASK DesiredAccess,
2013 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
2014
2015NTOSAPI
2016NTSTATUS
2017NTAPI
2018NtOpenJobObject(
2019 /*OUT*/ PHANDLE JobHandle,
2020 /*IN*/ ACCESS_MASK DesiredAccess,
2021 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
2022
2023NTOSAPI
2024NTSTATUS
2025NTAPI
2026ZwOpenJobObject(
2027 /*OUT*/ PHANDLE JobHandle,
2028 /*IN*/ ACCESS_MASK DesiredAccess,
2029 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
2030
2031NTOSAPI
2032NTSTATUS
2033NTAPI
2034NtTerminateJobObject(
2035 /*IN*/ HANDLE JobHandle,
2036 /*IN*/ NTSTATUS ExitStatus);
2037
2038NTOSAPI
2039NTSTATUS
2040NTAPI
2041ZwTerminateJobObject(
2042 /*IN*/ HANDLE JobHandle,
2043 /*IN*/ NTSTATUS ExitStatus);
2044
2045NTOSAPI
2046NTSTATUS
2047NTAPI
2048NtAssignProcessToJobObject(
2049 /*IN*/ HANDLE JobHandle,
2050 /*IN*/ HANDLE ProcessHandle);
2051
2052NTOSAPI
2053NTSTATUS
2054NTAPI
2055ZwAssignProcessToJobObject(
2056 /*IN*/ HANDLE JobHandle,
2057 /*IN*/ HANDLE ProcessHandle);
2058
2059NTOSAPI
2060NTSTATUS
2061NTAPI
2062NtQueryInformationJobObject(
2063 /*IN*/ HANDLE JobHandle,
2064 /*IN*/ JOBOBJECTINFOCLASS JobInformationClass,
2065 /*OUT*/ PVOID JobInformation,
2066 /*IN*/ ULONG JobInformationLength,
2067 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2068
2069NTOSAPI
2070NTSTATUS
2071NTAPI
2072ZwQueryInformationJobObject(
2073 /*IN*/ HANDLE JobHandle,
2074 /*IN*/ JOBOBJECTINFOCLASS JobInformationClass,
2075 /*OUT*/ PVOID JobInformation,
2076 /*IN*/ ULONG JobInformationLength,
2077 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2078
2079NTOSAPI
2080NTSTATUS
2081NTAPI
2082NtSetInformationJobObject(
2083 /*IN*/ HANDLE JobHandle,
2084 /*IN*/ JOBOBJECTINFOCLASS JobInformationClass,
2085 /*IN*/ PVOID JobInformation,
2086 /*IN*/ ULONG JobInformationLength);
2087
2088NTOSAPI
2089NTSTATUS
2090NTAPI
2091ZwSetInformationJobObject(
2092 /*IN*/ HANDLE JobHandle,
2093 /*IN*/ JOBOBJECTINFOCLASS JobInformationClass,
2094 /*IN*/ PVOID JobInformation,
2095 /*IN*/ ULONG JobInformationLength);
2096
2097
2098/* Tokens */
2099
2100NTOSAPI
2101NTSTATUS
2102NTAPI
2103NtCreateToken(
2104 /*OUT*/ PHANDLE TokenHandle,
2105 /*IN*/ ACCESS_MASK DesiredAccess,
2106 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2107 /*IN*/ TOKEN_TYPE Type,
2108 /*IN*/ PLUID AuthenticationId,
2109 /*IN*/ PLARGE_INTEGER ExpirationTime,
2110 /*IN*/ PTOKEN_USER User,
2111 /*IN*/ PTOKEN_GROUPS Groups,
2112 /*IN*/ PTOKEN_PRIVILEGES Privileges,
2113 /*IN*/ PTOKEN_OWNER Owner,
2114 /*IN*/ PTOKEN_PRIMARY_GROUP PrimaryGroup,
2115 /*IN*/ PTOKEN_DEFAULT_DACL DefaultDacl,
2116 /*IN*/ PTOKEN_SOURCE Source
2117);
2118
2119NTOSAPI
2120NTSTATUS
2121NTAPI
2122ZwCreateToken(
2123 /*OUT*/ PHANDLE TokenHandle,
2124 /*IN*/ ACCESS_MASK DesiredAccess,
2125 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2126 /*IN*/ TOKEN_TYPE Type,
2127 /*IN*/ PLUID AuthenticationId,
2128 /*IN*/ PLARGE_INTEGER ExpirationTime,
2129 /*IN*/ PTOKEN_USER User,
2130 /*IN*/ PTOKEN_GROUPS Groups,
2131 /*IN*/ PTOKEN_PRIVILEGES Privileges,
2132 /*IN*/ PTOKEN_OWNER Owner,
2133 /*IN*/ PTOKEN_PRIMARY_GROUP PrimaryGroup,
2134 /*IN*/ PTOKEN_DEFAULT_DACL DefaultDacl,
2135 /*IN*/ PTOKEN_SOURCE Source
2136);
2137
2138NTOSAPI
2139NTSTATUS
2140NTAPI
2141NtOpenProcessToken(
2142 /*IN*/ HANDLE ProcessHandle,
2143 /*IN*/ ACCESS_MASK DesiredAccess,
2144 /*OUT*/ PHANDLE TokenHandle);
2145
2146NTOSAPI
2147NTSTATUS
2148NTAPI
2149ZwOpenProcessToken(
2150 /*IN*/ HANDLE ProcessHandle,
2151 /*IN*/ ACCESS_MASK DesiredAccess,
2152 /*OUT*/ PHANDLE TokenHandle);
2153
2154NTOSAPI
2155NTSTATUS
2156NTAPI
2157NtOpenThreadToken(
2158 /*IN*/ HANDLE ThreadHandle,
2159 /*IN*/ ACCESS_MASK DesiredAccess,
2160 /*IN*/ BOOLEAN OpenAsSelf,
2161 /*OUT*/ PHANDLE TokenHandle);
2162
2163NTOSAPI
2164NTSTATUS
2165NTAPI
2166ZwOpenThreadToken(
2167 /*IN*/ HANDLE ThreadHandle,
2168 /*IN*/ ACCESS_MASK DesiredAccess,
2169 /*IN*/ BOOLEAN OpenAsSelf,
2170 /*OUT*/ PHANDLE TokenHandle);
2171
2172NTOSAPI
2173NTSTATUS
2174NTAPI
2175NtDuplicateToken(
2176 /*IN*/ HANDLE ExistingTokenHandle,
2177 /*IN*/ ACCESS_MASK DesiredAccess,
2178 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2179 /*IN*/ BOOLEAN EffectiveOnly,
2180 /*IN*/ TOKEN_TYPE TokenType,
2181 /*OUT*/ PHANDLE NewTokenHandle);
2182
2183NTOSAPI
2184NTSTATUS
2185NTAPI
2186ZwDuplicateToken(
2187 /*IN*/ HANDLE ExistingTokenHandle,
2188 /*IN*/ ACCESS_MASK DesiredAccess,
2189 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2190 /*IN*/ BOOLEAN EffectiveOnly,
2191 /*IN*/ TOKEN_TYPE TokenType,
2192 /*OUT*/ PHANDLE NewTokenHandle);
2193
2194NTOSAPI
2195NTSTATUS
2196NTAPI
2197NtFilterToken(
2198 /*IN*/ HANDLE ExistingTokenHandle,
2199 /*IN*/ ULONG Flags,
2200 /*IN*/ PTOKEN_GROUPS SidsToDisable,
2201 /*IN*/ PTOKEN_PRIVILEGES PrivilegesToDelete,
2202 /*IN*/ PTOKEN_GROUPS SidsToRestricted,
2203 /*OUT*/ PHANDLE NewTokenHandle);
2204
2205NTOSAPI
2206NTSTATUS
2207NTAPI
2208ZwFilterToken(
2209 /*IN*/ HANDLE ExistingTokenHandle,
2210 /*IN*/ ULONG Flags,
2211 /*IN*/ PTOKEN_GROUPS SidsToDisable,
2212 /*IN*/ PTOKEN_PRIVILEGES PrivilegesToDelete,
2213 /*IN*/ PTOKEN_GROUPS SidsToRestricted,
2214 /*OUT*/ PHANDLE NewTokenHandle);
2215
2216NTOSAPI
2217NTSTATUS
2218NTAPI
2219NtAdjustPrivilegesToken(
2220 /*IN*/ HANDLE TokenHandle,
2221 /*IN*/ BOOLEAN DisableAllPrivileges,
2222 /*IN*/ PTOKEN_PRIVILEGES NewState,
2223 /*IN*/ ULONG BufferLength,
2224 /*OUT*/ PTOKEN_PRIVILEGES PreviousState /*OPTIONAL*/,
2225 /*OUT*/ PULONG ReturnLength);
2226
2227NTOSAPI
2228NTSTATUS
2229NTAPI
2230ZwAdjustPrivilegesToken(
2231 /*IN*/ HANDLE TokenHandle,
2232 /*IN*/ BOOLEAN DisableAllPrivileges,
2233 /*IN*/ PTOKEN_PRIVILEGES NewState,
2234 /*IN*/ ULONG BufferLength,
2235 /*OUT*/ PTOKEN_PRIVILEGES PreviousState /*OPTIONAL*/,
2236 /*OUT*/ PULONG ReturnLength);
2237
2238NTOSAPI
2239NTSTATUS
2240NTAPI
2241NtAdjustGroupsToken(
2242 /*IN*/ HANDLE TokenHandle,
2243 /*IN*/ BOOLEAN ResetToDefault,
2244 /*IN*/ PTOKEN_GROUPS NewState,
2245 /*IN*/ ULONG BufferLength,
2246 /*OUT*/ PTOKEN_GROUPS PreviousState /*OPTIONAL*/,
2247 /*OUT*/ PULONG ReturnLength);
2248
2249NTOSAPI
2250NTSTATUS
2251NTAPI
2252ZwAdjustGroupsToken(
2253 /*IN*/ HANDLE TokenHandle,
2254 /*IN*/ BOOLEAN ResetToDefault,
2255 /*IN*/ PTOKEN_GROUPS NewState,
2256 /*IN*/ ULONG BufferLength,
2257 /*OUT*/ PTOKEN_GROUPS PreviousState /*OPTIONAL*/,
2258 /*OUT*/ PULONG ReturnLength);
2259
2260NTOSAPI
2261NTSTATUS
2262NTAPI
2263NtQueryInformationToken(
2264 /*IN*/ HANDLE TokenHandle,
2265 /*IN*/ TOKEN_INFORMATION_CLASS TokenInformationClass,
2266 /*OUT*/ PVOID TokenInformation,
2267 /*IN*/ ULONG TokenInformationLength,
2268 /*OUT*/ PULONG ReturnLength);
2269
2270NTOSAPI
2271NTSTATUS
2272NTAPI
2273ZwQueryInformationToken(
2274 /*IN*/ HANDLE TokenHandle,
2275 /*IN*/ TOKEN_INFORMATION_CLASS TokenInformationClass,
2276 /*OUT*/ PVOID TokenInformation,
2277 /*IN*/ ULONG TokenInformationLength,
2278 /*OUT*/ PULONG ReturnLength);
2279
2280NTOSAPI
2281NTSTATUS
2282NTAPI
2283NtSetInformationToken(
2284 /*IN*/ HANDLE TokenHandle,
2285 /*IN*/ TOKEN_INFORMATION_CLASS TokenInformationClass,
2286 /*IN*/ PVOID TokenInformation,
2287 /*IN*/ ULONG TokenInformationLength);
2288
2289NTOSAPI
2290NTSTATUS
2291NTAPI
2292ZwSetInformationToken(
2293 /*IN*/ HANDLE TokenHandle,
2294 /*IN*/ TOKEN_INFORMATION_CLASS TokenInformationClass,
2295 /*IN*/ PVOID TokenInformation,
2296 /*IN*/ ULONG TokenInformationLength);
2297
2298
2299
2300
2301/* Time */
2302
2303NTOSAPI
2304NTSTATUS
2305NTAPI
2306NtQuerySystemTime(
2307 /*OUT*/ PLARGE_INTEGER CurrentTime);
2308
2309NTOSAPI
2310NTSTATUS
2311NTAPI
2312ZwQuerySystemTime(
2313 /*OUT*/ PLARGE_INTEGER CurrentTime);
2314
2315NTOSAPI
2316NTSTATUS
2317NTAPI
2318NtSetSystemTime(
2319 /*IN*/ PLARGE_INTEGER NewTime,
2320 /*OUT*/ PLARGE_INTEGER OldTime /*OPTIONAL*/);
2321
2322NTOSAPI
2323NTSTATUS
2324NTAPI
2325ZwSetSystemTime(
2326 /*IN*/ PLARGE_INTEGER NewTime,
2327 /*OUT*/ PLARGE_INTEGER OldTime /*OPTIONAL*/);
2328
2329NTOSAPI
2330NTSTATUS
2331NTAPI
2332NtQueryPerformanceCounter(
2333 /*OUT*/ PLARGE_INTEGER PerformanceCount,
2334 /*OUT*/ PLARGE_INTEGER PerformanceFrequency /*OPTIONAL*/);
2335
2336NTOSAPI
2337NTSTATUS
2338NTAPI
2339ZwQueryPerformanceCounter(
2340 /*OUT*/ PLARGE_INTEGER PerformanceCount,
2341 /*OUT*/ PLARGE_INTEGER PerformanceFrequency /*OPTIONAL*/);
2342
2343NTOSAPI
2344NTSTATUS
2345NTAPI
2346NtQueryTimerResolution(
2347 /*OUT*/ PULONG CoarsestResolution,
2348 /*OUT*/ PULONG FinestResolution,
2349 /*OUT*/ PULONG ActualResolution);
2350
2351NTOSAPI
2352NTSTATUS
2353NTAPI
2354ZwQueryTimerResolution(
2355 /*OUT*/ PULONG CoarsestResolution,
2356 /*OUT*/ PULONG FinestResolution,
2357 /*OUT*/ PULONG ActualResolution);
2358
2359NTOSAPI
2360NTSTATUS
2361NTAPI
2362NtDelayExecution(
2363 /*IN*/ BOOLEAN Alertable,
2364 /*IN*/ PLARGE_INTEGER Interval);
2365
2366NTOSAPI
2367NTSTATUS
2368NTAPI
2369ZwDelayExecution(
2370 /*IN*/ BOOLEAN Alertable,
2371 /*IN*/ PLARGE_INTEGER Interval);
2372
2373NTOSAPI
2374NTSTATUS
2375NTAPI
2376NtYieldExecution(
2377 VOID);
2378
2379NTOSAPI
2380NTSTATUS
2381NTAPI
2382ZwYieldExecution(
2383 VOID);
2384
2385NTOSAPI
2386ULONG
2387NTAPI
2388NtGetTickCount(
2389 VOID);
2390
2391NTOSAPI
2392ULONG
2393NTAPI
2394ZwGetTickCount(
2395 VOID);
2396
2397
2398
2399
2400/* Execution profiling */
2401
2402NTOSAPI
2403NTSTATUS
2404NTAPI
2405NtCreateProfile(
2406 /*OUT*/ PHANDLE ProfileHandle,
2407 /*IN*/ HANDLE ProcessHandle,
2408 /*IN*/ PVOID Base,
2409 /*IN*/ ULONG Size,
2410 /*IN*/ ULONG BucketShift,
2411 /*IN*/ PULONG Buffer,
2412 /*IN*/ ULONG BufferLength,
2413 /*IN*/ KPROFILE_SOURCE Source,
2414 /*IN*/ ULONG ProcessorMask);
2415
2416NTOSAPI
2417NTSTATUS
2418NTAPI
2419ZwCreateProfile(
2420 /*OUT*/ PHANDLE ProfileHandle,
2421 /*IN*/ HANDLE ProcessHandle,
2422 /*IN*/ PVOID Base,
2423 /*IN*/ ULONG Size,
2424 /*IN*/ ULONG BucketShift,
2425 /*IN*/ PULONG Buffer,
2426 /*IN*/ ULONG BufferLength,
2427 /*IN*/ KPROFILE_SOURCE Source,
2428 /*IN*/ ULONG ProcessorMask);
2429
2430NTOSAPI
2431NTSTATUS
2432NTAPI
2433NtSetIntervalProfile(
2434 /*IN*/ ULONG Interval,
2435 /*IN*/ KPROFILE_SOURCE Source);
2436
2437NTOSAPI
2438NTSTATUS
2439NTAPI
2440ZwSetIntervalProfile(
2441 /*IN*/ ULONG Interval,
2442 /*IN*/ KPROFILE_SOURCE Source);
2443
2444NTOSAPI
2445NTSTATUS
2446NTAPI
2447NtQueryIntervalProfile(
2448 /*IN*/ KPROFILE_SOURCE Source,
2449 /*OUT*/ PULONG Interval);
2450
2451NTOSAPI
2452NTSTATUS
2453NTAPI
2454ZwQueryIntervalProfile(
2455 /*IN*/ KPROFILE_SOURCE Source,
2456 /*OUT*/ PULONG Interval);
2457
2458NTOSAPI
2459NTSTATUS
2460NTAPI
2461NtStartProfile(
2462 /*IN*/ HANDLE ProfileHandle);
2463
2464NTOSAPI
2465NTSTATUS
2466NTAPI
2467ZwStartProfile(
2468 /*IN*/ HANDLE ProfileHandle);
2469
2470NTOSAPI
2471NTSTATUS
2472NTAPI
2473NtStopProfile(
2474 /*IN*/ HANDLE ProfileHandle);
2475
2476NTOSAPI
2477NTSTATUS
2478NTAPI
2479ZwStopProfile(
2480 /*IN*/ HANDLE ProfileHandle);
2481
2482/* Local Procedure Call (LPC) */
2483
2484typedef struct _LPC_MESSAGE {
2485 USHORT DataSize;
2486 USHORT MessageSize;
2487 USHORT MessageType;
2488 USHORT VirtualRangesOffset;
2489 CLIENT_ID ClientId;
2490 ULONG MessageId;
2491 ULONG SectionSize;
2492 UCHAR Data[ANYSIZE_ARRAY];
2493} LPC_MESSAGE, *PLPC_MESSAGE;
2494
2495#define LPC_MESSAGE_BASE_SIZE 24
2496
2497typedef enum _LPC_TYPE {
2498 LPC_NEW_MESSAGE,
2499 LPC_REQUEST,
2500 LPC_REPLY,
2501 LPC_DATAGRAM,
2502 LPC_LOST_REPLY,
2503 LPC_PORT_CLOSED,
2504 LPC_CLIENT_DIED,
2505 LPC_EXCEPTION,
2506 LPC_DEBUG_EVENT,
2507 LPC_ERROR_EVENT,
2508 LPC_CONNECTION_REQUEST,
2509 LPC_CONNECTION_REFUSED,
2510 LPC_MAXIMUM
2511} LPC_TYPE;
2512
2513typedef struct _LPC_SECTION_WRITE {
2514 ULONG Length;
2515 HANDLE SectionHandle;
2516 ULONG SectionOffset;
2517 ULONG ViewSize;
2518 PVOID ViewBase;
2519 PVOID TargetViewBase;
2520} LPC_SECTION_WRITE, *PLPC_SECTION_WRITE;
2521
2522typedef struct _LPC_SECTION_READ {
2523 ULONG Length;
2524 ULONG ViewSize;
2525 PVOID ViewBase;
2526} LPC_SECTION_READ, *PLPC_SECTION_READ;
2527
2528NTOSAPI
2529NTSTATUS
2530NTAPI
2531NtCreatePort(
2532 /*OUT*/ PHANDLE PortHandle,
2533 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2534 /*IN*/ ULONG MaxDataSize,
2535 /*IN*/ ULONG MaxMessageSize,
2536 /*IN*/ ULONG Reserved);
2537
2538NTOSAPI
2539NTSTATUS
2540NTAPI
2541ZwCreatePort(
2542 /*OUT*/ PHANDLE PortHandle,
2543 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2544 /*IN*/ ULONG MaxDataSize,
2545 /*IN*/ ULONG MaxMessageSize,
2546 /*IN*/ ULONG Reserved);
2547
2548NTOSAPI
2549NTSTATUS
2550NTAPI
2551NtCreateWaitablePort(
2552 /*OUT*/ PHANDLE PortHandle,
2553 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2554 /*IN*/ ULONG MaxDataSize,
2555 /*IN*/ ULONG MaxMessageSize,
2556 /*IN*/ ULONG Reserved);
2557
2558NTOSAPI
2559NTSTATUS
2560NTAPI
2561ZwCreateWaitablePort(
2562 /*OUT*/ PHANDLE PortHandle,
2563 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
2564 /*IN*/ ULONG MaxDataSize,
2565 /*IN*/ ULONG MaxMessageSize,
2566 /*IN*/ ULONG Reserved);
2567
2568NTOSAPI
2569NTSTATUS
2570NTAPI
2571NtConnectPort(
2572 /*OUT*/ PHANDLE PortHandle,
2573 /*IN*/ PUNICODE_STRING PortName,
2574 /*IN*/ PSECURITY_QUALITY_OF_SERVICE SecurityQos,
2575 /*IN OUT*/ PLPC_SECTION_WRITE WriteSection /*OPTIONAL*/,
2576 /*IN OUT*/ PLPC_SECTION_READ ReadSection /*OPTIONAL*/,
2577 /*OUT*/ PULONG MaxMessageSize /*OPTIONAL*/,
2578 /*IN OUT*/ PVOID ConnectData /*OPTIONAL*/,
2579 /*IN OUT*/ PULONG ConnectDataLength /*OPTIONAL*/);
2580
2581NTOSAPI
2582NTSTATUS
2583NTAPI
2584ZwConnectPort(
2585 /*OUT*/ PHANDLE PortHandle,
2586 /*IN*/ PUNICODE_STRING PortName,
2587 /*IN*/ PSECURITY_QUALITY_OF_SERVICE SecurityQos,
2588 /*IN OUT*/ PLPC_SECTION_WRITE WriteSection /*OPTIONAL*/,
2589 /*IN OUT*/ PLPC_SECTION_READ ReadSection /*OPTIONAL*/,
2590 /*OUT*/ PULONG MaxMessageSize /*OPTIONAL*/,
2591 /*IN OUT*/ PVOID ConnectData /*OPTIONAL*/,
2592 /*IN OUT*/ PULONG ConnectDataLength /*OPTIONAL*/);
2593
2594NTOSAPI
2595NTSTATUS
2596NTAPI
2597NtListenPort(
2598 /*IN*/ HANDLE PortHandle,
2599 /*OUT*/ PLPC_MESSAGE Message);
2600
2601NTOSAPI
2602NTSTATUS
2603NTAPI
2604ZwListenPort(
2605 /*IN*/ HANDLE PortHandle,
2606 /*OUT*/ PLPC_MESSAGE Message);
2607
2608NTOSAPI
2609NTSTATUS
2610NTAPI
2611NtAcceptConnectPort(
2612 /*OUT*/ PHANDLE PortHandle,
2613 /*IN*/ ULONG PortIdentifier,
2614 /*IN*/ PLPC_MESSAGE Message,
2615 /*IN*/ BOOLEAN Accept,
2616 /*IN OUT*/ PLPC_SECTION_WRITE WriteSection /*OPTIONAL*/,
2617 /*IN OUT*/ PLPC_SECTION_READ ReadSection /*OPTIONAL*/);
2618
2619NTOSAPI
2620NTSTATUS
2621NTAPI
2622ZwAcceptConnectPort(
2623 /*OUT*/ PHANDLE PortHandle,
2624 /*IN*/ ULONG PortIdentifier,
2625 /*IN*/ PLPC_MESSAGE Message,
2626 /*IN*/ BOOLEAN Accept,
2627 /*IN OUT*/ PLPC_SECTION_WRITE WriteSection /*OPTIONAL*/,
2628 /*IN OUT*/ PLPC_SECTION_READ ReadSection /*OPTIONAL*/);
2629
2630NTOSAPI
2631NTSTATUS
2632NTAPI
2633NtCompleteConnectPort(
2634 /*IN*/ HANDLE PortHandle);
2635
2636NTOSAPI
2637NTSTATUS
2638NTAPI
2639ZwCompleteConnectPort(
2640 /*IN*/ HANDLE PortHandle);
2641
2642NTOSAPI
2643NTSTATUS
2644NTAPI
2645NtRequestPort(
2646 /*IN*/ HANDLE PortHandle,
2647 /*IN*/ PLPC_MESSAGE RequestMessage);
2648
2649NTOSAPI
2650NTSTATUS
2651NTAPI
2652ZwRequestPort(
2653 /*IN*/ HANDLE PortHandle,
2654 /*IN*/ PLPC_MESSAGE RequestMessage);
2655
2656NTOSAPI
2657NTSTATUS
2658NTAPI
2659NtRequestWaitReplyPort(
2660 /*IN*/ HANDLE PortHandle,
2661 /*IN*/ PLPC_MESSAGE RequestMessage,
2662 /*OUT*/ PLPC_MESSAGE ReplyMessage);
2663
2664NTOSAPI
2665NTSTATUS
2666NTAPI
2667ZwRequestWaitReplyPort(
2668 /*IN*/ HANDLE PortHandle,
2669 /*IN*/ PLPC_MESSAGE RequestMessage,
2670 /*OUT*/ PLPC_MESSAGE ReplyMessage);
2671
2672NTOSAPI
2673NTSTATUS
2674NTAPI
2675NtReplyPort(
2676 /*IN*/ HANDLE PortHandle,
2677 /*IN*/ PLPC_MESSAGE ReplyMessage);
2678
2679NTOSAPI
2680NTSTATUS
2681NTAPI
2682ZwReplyPort(
2683 /*IN*/ HANDLE PortHandle,
2684 /*IN*/ PLPC_MESSAGE ReplyMessage);
2685
2686NTOSAPI
2687NTSTATUS
2688NTAPI
2689NtReplyWaitReplyPort(
2690 /*IN*/ HANDLE PortHandle,
2691 /*IN OUT*/ PLPC_MESSAGE ReplyMessage);
2692
2693NTOSAPI
2694NTSTATUS
2695NTAPI
2696ZwReplyWaitReplyPort(
2697 /*IN*/ HANDLE PortHandle,
2698 /*IN OUT*/ PLPC_MESSAGE ReplyMessage);
2699
2700NTOSAPI
2701NTSTATUS
2702NTAPI
2703NtReplyWaitReceivePort(
2704 /*IN*/ HANDLE PortHandle,
2705 /*OUT*/ PULONG PortIdentifier /*OPTIONAL*/,
2706 /*IN*/ PLPC_MESSAGE ReplyMessage /*OPTIONAL*/,
2707 /*OUT*/ PLPC_MESSAGE Message);
2708
2709NTOSAPI
2710NTSTATUS
2711NTAPI
2712ZwReplyWaitReceivePort(
2713 /*IN*/ HANDLE PortHandle,
2714 /*OUT*/ PULONG PortIdentifier /*OPTIONAL*/,
2715 /*IN*/ PLPC_MESSAGE ReplyMessage /*OPTIONAL*/,
2716 /*OUT*/ PLPC_MESSAGE Message);
2717
2718NTOSAPI
2719NTSTATUS
2720NTAPI
2721NtReplyWaitReceivePortEx(
2722 /*IN*/ HANDLE PortHandle,
2723 /*OUT*/ PULONG PortIdentifier /*OPTIONAL*/,
2724 /*IN*/ PLPC_MESSAGE ReplyMessage /*OPTIONAL*/,
2725 /*OUT*/ PLPC_MESSAGE Message,
2726 /*IN*/ PLARGE_INTEGER Timeout);
2727
2728NTOSAPI
2729NTSTATUS
2730NTAPI
2731ZwReplyWaitReceivePortEx(
2732 /*IN*/ HANDLE PortHandle,
2733 /*OUT*/ PULONG PortIdentifier /*OPTIONAL*/,
2734 /*IN*/ PLPC_MESSAGE ReplyMessage /*OPTIONAL*/,
2735 /*OUT*/ PLPC_MESSAGE Message,
2736 /*IN*/ PLARGE_INTEGER Timeout);
2737
2738NTOSAPI
2739NTSTATUS
2740NTAPI
2741NtReadRequestData(
2742 /*IN*/ HANDLE PortHandle,
2743 /*IN*/ PLPC_MESSAGE Message,
2744 /*IN*/ ULONG Index,
2745 /*OUT*/ PVOID Buffer,
2746 /*IN*/ ULONG BufferLength,
2747 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2748
2749NTOSAPI
2750NTSTATUS
2751NTAPI
2752ZwReadRequestData(
2753 /*IN*/ HANDLE PortHandle,
2754 /*IN*/ PLPC_MESSAGE Message,
2755 /*IN*/ ULONG Index,
2756 /*OUT*/ PVOID Buffer,
2757 /*IN*/ ULONG BufferLength,
2758 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2759
2760NTOSAPI
2761NTSTATUS
2762NTAPI
2763NtWriteRequestData(
2764 /*IN*/ HANDLE PortHandle,
2765 /*IN*/ PLPC_MESSAGE Message,
2766 /*IN*/ ULONG Index,
2767 /*IN*/ PVOID Buffer,
2768 /*IN*/ ULONG BufferLength,
2769 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2770
2771NTOSAPI
2772NTSTATUS
2773NTAPI
2774ZwWriteRequestData(
2775 /*IN*/ HANDLE PortHandle,
2776 /*IN*/ PLPC_MESSAGE Message,
2777 /*IN*/ ULONG Index,
2778 /*IN*/ PVOID Buffer,
2779 /*IN*/ ULONG BufferLength,
2780 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2781
2782typedef enum _PORT_INFORMATION_CLASS {
2783 PortBasicInformation
2784} PORT_INFORMATION_CLASS;
2785
2786NTOSAPI
2787NTSTATUS
2788NTAPI
2789NtQueryInformationPort(
2790 /*IN*/ HANDLE PortHandle,
2791 /*IN*/ PORT_INFORMATION_CLASS PortInformationClass,
2792 /*OUT*/ PVOID PortInformation,
2793 /*IN*/ ULONG PortInformationLength,
2794 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2795
2796NTOSAPI
2797NTSTATUS
2798NTAPI
2799ZwQueryInformationPort(
2800 /*IN*/ HANDLE PortHandle,
2801 /*IN*/ PORT_INFORMATION_CLASS PortInformationClass,
2802 /*OUT*/ PVOID PortInformation,
2803 /*IN*/ ULONG PortInformationLength,
2804 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
2805
2806NTOSAPI
2807NTSTATUS
2808NTAPI
2809NtImpersonateClientOfPort(
2810 /*IN*/ HANDLE PortHandle,
2811 /*IN*/ PLPC_MESSAGE Message);
2812
2813NTOSAPI
2814NTSTATUS
2815NTAPI
2816ZwImpersonateClientOfPort(
2817 /*IN*/ HANDLE PortHandle,
2818 /*IN*/ PLPC_MESSAGE Message);
2819
2820
2821
2822
2823/* Files */
2824
2825NTOSAPI
2826NTSTATUS
2827NTAPI
2828NtDeleteFile(
2829 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
2830
2831NTOSAPI
2832NTSTATUS
2833NTAPI
2834ZwDeleteFile(
2835 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes);
2836
2837NTOSAPI
2838NTSTATUS
2839NTAPI
2840NtFlushBuffersFile(
2841 /*IN*/ HANDLE FileHandle,
2842 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
2843
2844NTOSAPI
2845NTSTATUS
2846NTAPI
2847ZwFlushBuffersFile(
2848 /*IN*/ HANDLE FileHandle,
2849 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
2850
2851NTOSAPI
2852NTSTATUS
2853NTAPI
2854NtCancelIoFile(
2855 /*IN*/ HANDLE FileHandle,
2856 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
2857
2858NTOSAPI
2859NTSTATUS
2860NTAPI
2861ZwCancelIoFile(
2862 /*IN*/ HANDLE FileHandle,
2863 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock);
2864
2865NTOSAPI
2866NTSTATUS
2867NTAPI
2868NtReadFileScatter(
2869 /*IN*/ HANDLE FileHandle,
2870 /*IN*/ HANDLE Event /*OPTIONAL*/,
2871 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
2872 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
2873 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
2874 /*IN*/ PFILE_SEGMENT_ELEMENT Buffer,
2875 /*IN*/ ULONG Length,
2876 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
2877 /*IN*/ PULONG Key /*OPTIONAL*/);
2878
2879NTOSAPI
2880NTSTATUS
2881NTAPI
2882ZwReadFileScatter(
2883 /*IN*/ HANDLE FileHandle,
2884 /*IN*/ HANDLE Event /*OPTIONAL*/,
2885 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
2886 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
2887 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
2888 /*IN*/ PFILE_SEGMENT_ELEMENT Buffer,
2889 /*IN*/ ULONG Length,
2890 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
2891 /*IN*/ PULONG Key /*OPTIONAL*/);
2892
2893NTOSAPI
2894NTSTATUS
2895NTAPI
2896NtWriteFileGather(
2897 /*IN*/ HANDLE FileHandle,
2898 /*IN*/ HANDLE Event /*OPTIONAL*/,
2899 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
2900 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
2901 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
2902 /*IN*/ PFILE_SEGMENT_ELEMENT Buffer,
2903 /*IN*/ ULONG Length,
2904 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
2905 /*IN*/ PULONG Key /*OPTIONAL*/);
2906
2907NTOSAPI
2908NTSTATUS
2909NTAPI
2910ZwWriteFileGather(
2911 /*IN*/ HANDLE FileHandle,
2912 /*IN*/ HANDLE Event /*OPTIONAL*/,
2913 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
2914 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
2915 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
2916 /*IN*/ PFILE_SEGMENT_ELEMENT Buffer,
2917 /*IN*/ ULONG Length,
2918 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
2919 /*IN*/ PULONG Key /*OPTIONAL*/);
2920
2921
2922
2923
2924/* Registry keys */
2925
2926NTOSAPI
2927NTSTATUS
2928NTAPI
2929NtSaveKey(
2930 /*IN*/ HANDLE KeyHandle,
2931 /*IN*/ HANDLE FileHandle);
2932
2933NTOSAPI
2934NTSTATUS
2935NTAPI
2936ZwSaveKey(
2937 /*IN*/ HANDLE KeyHandle,
2938 /*IN*/ HANDLE FileHandle);
2939
2940NTOSAPI
2941NTSTATUS
2942NTAPI
2943NtSaveMergedKeys(
2944 /*IN*/ HANDLE KeyHandle1,
2945 /*IN*/ HANDLE KeyHandle2,
2946 /*IN*/ HANDLE FileHandle);
2947
2948NTOSAPI
2949NTSTATUS
2950NTAPI
2951ZwSaveMergedKeys(
2952 /*IN*/ HANDLE KeyHandle1,
2953 /*IN*/ HANDLE KeyHandle2,
2954 /*IN*/ HANDLE FileHandle);
2955
2956NTOSAPI
2957NTSTATUS
2958NTAPI
2959NtRestoreKey(
2960 /*IN*/ HANDLE KeyHandle,
2961 /*IN*/ HANDLE FileHandle,
2962 /*IN*/ ULONG Flags);
2963
2964NTOSAPI
2965NTSTATUS
2966NTAPI
2967ZwRestoreKey(
2968 /*IN*/ HANDLE KeyHandle,
2969 /*IN*/ HANDLE FileHandle,
2970 /*IN*/ ULONG Flags);
2971
2972NTOSAPI
2973NTSTATUS
2974NTAPI
2975NtLoadKey(
2976 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
2977 /*IN*/ POBJECT_ATTRIBUTES FileObjectAttributes);
2978
2979NTOSAPI
2980NTSTATUS
2981NTAPI
2982ZwLoadKey(
2983 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
2984 /*IN*/ POBJECT_ATTRIBUTES FileObjectAttributes);
2985
2986NTOSAPI
2987NTSTATUS
2988NTAPI
2989NtLoadKey2(
2990 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
2991 /*IN*/ POBJECT_ATTRIBUTES FileObjectAttributes,
2992 /*IN*/ ULONG Flags);
2993
2994NTOSAPI
2995NTSTATUS
2996NTAPI
2997ZwLoadKey2(
2998 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
2999 /*IN*/ POBJECT_ATTRIBUTES FileObjectAttributes,
3000 /*IN*/ ULONG Flags);
3001
3002NTOSAPI
3003NTSTATUS
3004NTAPI
3005NtUnloadKey(
3006 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes);
3007
3008NTOSAPI
3009NTSTATUS
3010NTAPI
3011ZwUnloadKey(
3012 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes);
3013
3014NTOSAPI
3015NTSTATUS
3016NTAPI
3017NtQueryOpenSubKeys(
3018 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
3019 /*OUT*/ PULONG NumberOfKeys);
3020
3021NTOSAPI
3022NTSTATUS
3023NTAPI
3024ZwQueryOpenSubKeys(
3025 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
3026 /*OUT*/ PULONG NumberOfKeys);
3027
3028NTOSAPI
3029NTSTATUS
3030NTAPI
3031NtReplaceKey(
3032 /*IN*/ POBJECT_ATTRIBUTES NewFileObjectAttributes,
3033 /*IN*/ HANDLE KeyHandle,
3034 /*IN*/ POBJECT_ATTRIBUTES OldFileObjectAttributes);
3035
3036NTOSAPI
3037NTSTATUS
3038NTAPI
3039ZwReplaceKey(
3040 /*IN*/ POBJECT_ATTRIBUTES NewFileObjectAttributes,
3041 /*IN*/ HANDLE KeyHandle,
3042 /*IN*/ POBJECT_ATTRIBUTES OldFileObjectAttributes);
3043
3044typedef enum _KEY_SET_INFORMATION_CLASS {
3045 KeyLastWriteTimeInformation
3046} KEY_SET_INFORMATION_CLASS;
3047
3048NTOSAPI
3049NTSTATUS
3050NTAPI
3051NtSetInformationKey(
3052 /*IN*/ HANDLE KeyHandle,
3053 /*IN*/ KEY_SET_INFORMATION_CLASS KeyInformationClass,
3054 /*IN*/ PVOID KeyInformation,
3055 /*IN*/ ULONG KeyInformationLength);
3056
3057NTOSAPI
3058NTSTATUS
3059NTAPI
3060ZwSetInformationKey(
3061 /*IN*/ HANDLE KeyHandle,
3062 /*IN*/ KEY_SET_INFORMATION_CLASS KeyInformationClass,
3063 /*IN*/ PVOID KeyInformation,
3064 /*IN*/ ULONG KeyInformationLength);
3065
3066typedef struct _KEY_LAST_WRITE_TIME_INFORMATION {
3067 LARGE_INTEGER LastWriteTime;
3068} KEY_LAST_WRITE_TIME_INFORMATION, *PKEY_LAST_WRITE_TIME_INFORMATION;
3069
3070typedef struct _KEY_NAME_INFORMATION {
3071 ULONG NameLength;
3072 WCHAR Name[1];
3073} KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
3074
3075NTOSAPI
3076NTSTATUS
3077NTAPI
3078NtNotifyChangeKey(
3079 /*IN*/ HANDLE KeyHandle,
3080 /*IN*/ HANDLE EventHandle /*OPTIONAL*/,
3081 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
3082 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
3083 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
3084 /*IN*/ ULONG NotifyFilter,
3085 /*IN*/ BOOLEAN WatchSubtree,
3086 /*IN*/ PVOID Buffer,
3087 /*IN*/ ULONG BufferLength,
3088 /*IN*/ BOOLEAN Asynchronous);
3089
3090NTOSAPI
3091NTSTATUS
3092NTAPI
3093ZwNotifyChangeKey(
3094 /*IN*/ HANDLE KeyHandle,
3095 /*IN*/ HANDLE EventHandle /*OPTIONAL*/,
3096 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
3097 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
3098 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
3099 /*IN*/ ULONG NotifyFilter,
3100 /*IN*/ BOOLEAN WatchSubtree,
3101 /*IN*/ PVOID Buffer,
3102 /*IN*/ ULONG BufferLength,
3103 /*IN*/ BOOLEAN Asynchronous);
3104
3105/* ZwNotifyChangeMultipleKeys.Flags constants */
3106#define REG_MONITOR_SINGLE_KEY 0x00
3107#define REG_MONITOR_SECOND_KEY 0x01
3108
3109NTOSAPI
3110NTSTATUS
3111NTAPI
3112NtNotifyChangeMultipleKeys(
3113 /*IN*/ HANDLE KeyHandle,
3114 /*IN*/ ULONG Flags,
3115 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
3116 /*IN*/ HANDLE EventHandle /*OPTIONAL*/,
3117 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
3118 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
3119 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
3120 /*IN*/ ULONG NotifyFilter,
3121 /*IN*/ BOOLEAN WatchSubtree,
3122 /*IN*/ PVOID Buffer,
3123 /*IN*/ ULONG BufferLength,
3124 /*IN*/ BOOLEAN Asynchronous);
3125
3126NTOSAPI
3127NTSTATUS
3128NTAPI
3129ZwNotifyChangeMultipleKeys(
3130 /*IN*/ HANDLE KeyHandle,
3131 /*IN*/ ULONG Flags,
3132 /*IN*/ POBJECT_ATTRIBUTES KeyObjectAttributes,
3133 /*IN*/ HANDLE EventHandle /*OPTIONAL*/,
3134 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
3135 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
3136 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
3137 /*IN*/ ULONG NotifyFilter,
3138 /*IN*/ BOOLEAN WatchSubtree,
3139 /*IN*/ PVOID Buffer,
3140 /*IN*/ ULONG BufferLength,
3141 /*IN*/ BOOLEAN Asynchronous);
3142
3143NTOSAPI
3144NTSTATUS
3145NTAPI
3146NtQueryMultipleValueKey(
3147 /*IN*/ HANDLE KeyHandle,
3148 /*IN OUT*/ PKEY_VALUE_ENTRY ValueList,
3149 /*IN*/ ULONG NumberOfValues,
3150 /*OUT*/ PVOID Buffer,
3151 /*IN OUT*/ PULONG Length,
3152 /*OUT*/ PULONG ReturnLength);
3153
3154NTOSAPI
3155NTSTATUS
3156NTAPI
3157ZwQueryMultipleValueKey(
3158 /*IN*/ HANDLE KeyHandle,
3159 /*IN OUT*/ PKEY_VALUE_ENTRY ValueList,
3160 /*IN*/ ULONG NumberOfValues,
3161 /*OUT*/ PVOID Buffer,
3162 /*IN OUT*/ PULONG Length,
3163 /*OUT*/ PULONG ReturnLength);
3164
3165NTOSAPI
3166NTSTATUS
3167NTAPI
3168NtInitializeRegistry(
3169 /*IN*/ BOOLEAN Setup);
3170
3171NTOSAPI
3172NTSTATUS
3173NTAPI
3174ZwInitializeRegistry(
3175 /*IN*/ BOOLEAN Setup);
3176
3177
3178
3179
3180/* Security and auditing */
3181
3182NTOSAPI
3183NTSTATUS
3184NTAPI
3185NtPrivilegeCheck(
3186 /*IN*/ HANDLE TokenHandle,
3187 /*IN*/ PPRIVILEGE_SET RequiredPrivileges,
3188 /*OUT*/ PBOOLEAN Result);
3189
3190NTOSAPI
3191NTSTATUS
3192NTAPI
3193ZwPrivilegeCheck(
3194 /*IN*/ HANDLE TokenHandle,
3195 /*IN*/ PPRIVILEGE_SET RequiredPrivileges,
3196 /*OUT*/ PBOOLEAN Result);
3197
3198NTOSAPI
3199NTSTATUS
3200NTAPI
3201NtPrivilegeObjectAuditAlarm(
3202 /*IN*/ PUNICODE_STRING SubsystemName,
3203 /*IN*/ PVOID HandleId,
3204 /*IN*/ HANDLE TokenHandle,
3205 /*IN*/ ACCESS_MASK DesiredAccess,
3206 /*IN*/ PPRIVILEGE_SET Privileges,
3207 /*IN*/ BOOLEAN AccessGranted);
3208
3209NTOSAPI
3210NTSTATUS
3211NTAPI
3212ZwPrivilegeObjectAuditAlarm(
3213 /*IN*/ PUNICODE_STRING SubsystemName,
3214 /*IN*/ PVOID HandleId,
3215 /*IN*/ HANDLE TokenHandle,
3216 /*IN*/ ACCESS_MASK DesiredAccess,
3217 /*IN*/ PPRIVILEGE_SET Privileges,
3218 /*IN*/ BOOLEAN AccessGranted);
3219
3220NTOSAPI
3221NTSTATUS
3222NTAPI
3223NtAccessCheck(
3224 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3225 /*IN*/ HANDLE TokenHandle,
3226 /*IN*/ ACCESS_MASK DesiredAccess,
3227 /*IN*/ PGENERIC_MAPPING GenericMapping,
3228 /*IN*/ PPRIVILEGE_SET PrivilegeSet,
3229 /*IN*/ PULONG PrivilegeSetLength,
3230 /*OUT*/ PACCESS_MASK GrantedAccess,
3231 /*OUT*/ PBOOLEAN AccessStatus);
3232
3233NTOSAPI
3234NTSTATUS
3235NTAPI
3236ZwAccessCheck(
3237 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3238 /*IN*/ HANDLE TokenHandle,
3239 /*IN*/ ACCESS_MASK DesiredAccess,
3240 /*IN*/ PGENERIC_MAPPING GenericMapping,
3241 /*IN*/ PPRIVILEGE_SET PrivilegeSet,
3242 /*IN*/ PULONG PrivilegeSetLength,
3243 /*OUT*/ PACCESS_MASK GrantedAccess,
3244 /*OUT*/ PBOOLEAN AccessStatus);
3245
3246NTOSAPI
3247NTSTATUS
3248NTAPI
3249NtAccessCheckAndAuditAlarm(
3250 /*IN*/ PUNICODE_STRING SubsystemName,
3251 /*IN*/ PVOID HandleId,
3252 /*IN*/ PUNICODE_STRING ObjectTypeName,
3253 /*IN*/ PUNICODE_STRING ObjectName,
3254 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3255 /*IN*/ ACCESS_MASK DesiredAccess,
3256 /*IN*/ PGENERIC_MAPPING GenericMapping,
3257 /*IN*/ BOOLEAN ObjectCreation,
3258 /*OUT*/ PACCESS_MASK GrantedAccess,
3259 /*OUT*/ PBOOLEAN AccessStatus,
3260 /*OUT*/ PBOOLEAN GenerateOnClose);
3261
3262NTOSAPI
3263NTSTATUS
3264NTAPI
3265ZwAccessCheckAndAuditAlarm(
3266 /*IN*/ PUNICODE_STRING SubsystemName,
3267 /*IN*/ PVOID HandleId,
3268 /*IN*/ PUNICODE_STRING ObjectTypeName,
3269 /*IN*/ PUNICODE_STRING ObjectName,
3270 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3271 /*IN*/ ACCESS_MASK DesiredAccess,
3272 /*IN*/ PGENERIC_MAPPING GenericMapping,
3273 /*IN*/ BOOLEAN ObjectCreation,
3274 /*OUT*/ PACCESS_MASK GrantedAccess,
3275 /*OUT*/ PBOOLEAN AccessStatus,
3276 /*OUT*/ PBOOLEAN GenerateOnClose);
3277
3278NTOSAPI
3279NTSTATUS
3280NTAPI
3281NtAccessCheckByType(
3282 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3283 /*IN*/ PSID PrincipalSelfSid,
3284 /*IN*/ HANDLE TokenHandle,
3285 /*IN*/ ULONG DesiredAccess,
3286 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3287 /*IN*/ ULONG ObjectTypeListLength,
3288 /*IN*/ PGENERIC_MAPPING GenericMapping,
3289 /*IN*/ PPRIVILEGE_SET PrivilegeSet,
3290 /*IN*/ PULONG PrivilegeSetLength,
3291 /*OUT*/ PACCESS_MASK GrantedAccess,
3292 /*OUT*/ PULONG AccessStatus);
3293
3294NTOSAPI
3295NTSTATUS
3296NTAPI
3297ZwAccessCheckByType(
3298 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3299 /*IN*/ PSID PrincipalSelfSid,
3300 /*IN*/ HANDLE TokenHandle,
3301 /*IN*/ ULONG DesiredAccess,
3302 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3303 /*IN*/ ULONG ObjectTypeListLength,
3304 /*IN*/ PGENERIC_MAPPING GenericMapping,
3305 /*IN*/ PPRIVILEGE_SET PrivilegeSet,
3306 /*IN*/ PULONG PrivilegeSetLength,
3307 /*OUT*/ PACCESS_MASK GrantedAccess,
3308 /*OUT*/ PULONG AccessStatus);
3309
3310typedef enum _AUDIT_EVENT_TYPE {
3311 AuditEventObjectAccess,
3312 AuditEventDirectoryServiceAccess
3313} AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE;
3314
3315NTOSAPI
3316NTSTATUS
3317NTAPI
3318NtAccessCheckByTypeAndAuditAlarm(
3319 /*IN*/ PUNICODE_STRING SubsystemName,
3320 /*IN*/ PVOID HandleId,
3321 /*IN*/ PUNICODE_STRING ObjectTypeName,
3322 /*IN*/ PUNICODE_STRING ObjectName,
3323 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3324 /*IN*/ PSID PrincipalSelfSid,
3325 /*IN*/ ACCESS_MASK DesiredAccess,
3326 /*IN*/ AUDIT_EVENT_TYPE AuditType,
3327 /*IN*/ ULONG Flags,
3328 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3329 /*IN*/ ULONG ObjectTypeListLength,
3330 /*IN*/ PGENERIC_MAPPING GenericMapping,
3331 /*IN*/ BOOLEAN ObjectCreation,
3332 /*OUT*/ PACCESS_MASK GrantedAccess,
3333 /*OUT*/ PULONG AccessStatus,
3334 /*OUT*/ PBOOLEAN GenerateOnClose);
3335
3336NTOSAPI
3337NTSTATUS
3338NTAPI
3339ZwAccessCheckByTypeAndAuditAlarm(
3340 /*IN*/ PUNICODE_STRING SubsystemName,
3341 /*IN*/ PVOID HandleId,
3342 /*IN*/ PUNICODE_STRING ObjectTypeName,
3343 /*IN*/ PUNICODE_STRING ObjectName,
3344 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3345 /*IN*/ PSID PrincipalSelfSid,
3346 /*IN*/ ACCESS_MASK DesiredAccess,
3347 /*IN*/ AUDIT_EVENT_TYPE AuditType,
3348 /*IN*/ ULONG Flags,
3349 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3350 /*IN*/ ULONG ObjectTypeListLength,
3351 /*IN*/ PGENERIC_MAPPING GenericMapping,
3352 /*IN*/ BOOLEAN ObjectCreation,
3353 /*OUT*/ PACCESS_MASK GrantedAccess,
3354 /*OUT*/ PULONG AccessStatus,
3355 /*OUT*/ PBOOLEAN GenerateOnClose);
3356
3357NTOSAPI
3358NTSTATUS
3359NTAPI
3360NtAccessCheckByTypeResultList(
3361 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3362 /*IN*/ PSID PrincipalSelfSid,
3363 /*IN*/ HANDLE TokenHandle,
3364 /*IN*/ ACCESS_MASK DesiredAccess,
3365 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3366 /*IN*/ ULONG ObjectTypeListLength,
3367 /*IN*/ PGENERIC_MAPPING GenericMapping,
3368 /*IN*/ PPRIVILEGE_SET PrivilegeSet,
3369 /*IN*/ PULONG PrivilegeSetLength,
3370 /*OUT*/ PACCESS_MASK GrantedAccessList,
3371 /*OUT*/ PULONG AccessStatusList);
3372
3373NTOSAPI
3374NTSTATUS
3375NTAPI
3376ZwAccessCheckByTypeResultList(
3377 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3378 /*IN*/ PSID PrincipalSelfSid,
3379 /*IN*/ HANDLE TokenHandle,
3380 /*IN*/ ACCESS_MASK DesiredAccess,
3381 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3382 /*IN*/ ULONG ObjectTypeListLength,
3383 /*IN*/ PGENERIC_MAPPING GenericMapping,
3384 /*IN*/ PPRIVILEGE_SET PrivilegeSet,
3385 /*IN*/ PULONG PrivilegeSetLength,
3386 /*OUT*/ PACCESS_MASK GrantedAccessList,
3387 /*OUT*/ PULONG AccessStatusList);
3388
3389NTOSAPI
3390NTSTATUS
3391NTAPI
3392NtAccessCheckByTypeResultListAndAuditAlarm(
3393 /*IN*/ PUNICODE_STRING SubsystemName,
3394 /*IN*/ PVOID HandleId,
3395 /*IN*/ PUNICODE_STRING ObjectTypeName,
3396 /*IN*/ PUNICODE_STRING ObjectName,
3397 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3398 /*IN*/ PSID PrincipalSelfSid,
3399 /*IN*/ ACCESS_MASK DesiredAccess,
3400 /*IN*/ AUDIT_EVENT_TYPE AuditType,
3401 /*IN*/ ULONG Flags,
3402 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3403 /*IN*/ ULONG ObjectTypeListLength,
3404 /*IN*/ PGENERIC_MAPPING GenericMapping,
3405 /*IN*/ BOOLEAN ObjectCreation,
3406 /*OUT*/ PACCESS_MASK GrantedAccessList,
3407 /*OUT*/ PULONG AccessStatusList,
3408 /*OUT*/ PULONG GenerateOnClose);
3409
3410NTOSAPI
3411NTSTATUS
3412NTAPI
3413ZwAccessCheckByTypeResultListAndAuditAlarm(
3414 /*IN*/ PUNICODE_STRING SubsystemName,
3415 /*IN*/ PVOID HandleId,
3416 /*IN*/ PUNICODE_STRING ObjectTypeName,
3417 /*IN*/ PUNICODE_STRING ObjectName,
3418 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3419 /*IN*/ PSID PrincipalSelfSid,
3420 /*IN*/ ACCESS_MASK DesiredAccess,
3421 /*IN*/ AUDIT_EVENT_TYPE AuditType,
3422 /*IN*/ ULONG Flags,
3423 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3424 /*IN*/ ULONG ObjectTypeListLength,
3425 /*IN*/ PGENERIC_MAPPING GenericMapping,
3426 /*IN*/ BOOLEAN ObjectCreation,
3427 /*OUT*/ PACCESS_MASK GrantedAccessList,
3428 /*OUT*/ PULONG AccessStatusList,
3429 /*OUT*/ PULONG GenerateOnClose);
3430
3431NTOSAPI
3432NTSTATUS
3433NTAPI
3434NtAccessCheckByTypeResultListAndAuditAlarmByHandle(
3435 /*IN*/ PUNICODE_STRING SubsystemName,
3436 /*IN*/ PVOID HandleId,
3437 /*IN*/ HANDLE TokenHandle,
3438 /*IN*/ PUNICODE_STRING ObjectTypeName,
3439 /*IN*/ PUNICODE_STRING ObjectName,
3440 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3441 /*IN*/ PSID PrincipalSelfSid,
3442 /*IN*/ ACCESS_MASK DesiredAccess,
3443 /*IN*/ AUDIT_EVENT_TYPE AuditType,
3444 /*IN*/ ULONG Flags,
3445 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3446 /*IN*/ ULONG ObjectTypeListLength,
3447 /*IN*/ PGENERIC_MAPPING GenericMapping,
3448 /*IN*/ BOOLEAN ObjectCreation,
3449 /*OUT*/ PACCESS_MASK GrantedAccessList,
3450 /*OUT*/ PULONG AccessStatusList,
3451 /*OUT*/ PULONG GenerateOnClose);
3452
3453NTOSAPI
3454NTSTATUS
3455NTAPI
3456ZwAccessCheckByTypeResultListAndAuditAlarmByHandle(
3457 /*IN*/ PUNICODE_STRING SubsystemName,
3458 /*IN*/ PVOID HandleId,
3459 /*IN*/ HANDLE TokenHandle,
3460 /*IN*/ PUNICODE_STRING ObjectTypeName,
3461 /*IN*/ PUNICODE_STRING ObjectName,
3462 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3463 /*IN*/ PSID PrincipalSelfSid,
3464 /*IN*/ ACCESS_MASK DesiredAccess,
3465 /*IN*/ AUDIT_EVENT_TYPE AuditType,
3466 /*IN*/ ULONG Flags,
3467 /*IN*/ POBJECT_TYPE_LIST ObjectTypeList,
3468 /*IN*/ ULONG ObjectTypeListLength,
3469 /*IN*/ PGENERIC_MAPPING GenericMapping,
3470 /*IN*/ BOOLEAN ObjectCreation,
3471 /*OUT*/ PACCESS_MASK GrantedAccessList,
3472 /*OUT*/ PULONG AccessStatusList,
3473 /*OUT*/ PULONG GenerateOnClose);
3474
3475NTOSAPI
3476NTSTATUS
3477NTAPI
3478NtOpenObjectAuditAlarm(
3479 /*IN*/ PUNICODE_STRING SubsystemName,
3480 /*IN*/ PVOID *HandleId,
3481 /*IN*/ PUNICODE_STRING ObjectTypeName,
3482 /*IN*/ PUNICODE_STRING ObjectName,
3483 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3484 /*IN*/ HANDLE TokenHandle,
3485 /*IN*/ ACCESS_MASK DesiredAccess,
3486 /*IN*/ ACCESS_MASK GrantedAccess,
3487 /*IN*/ PPRIVILEGE_SET Privileges /*OPTIONAL*/,
3488 /*IN*/ BOOLEAN ObjectCreation,
3489 /*IN*/ BOOLEAN AccessGranted,
3490 /*OUT*/ PBOOLEAN GenerateOnClose);
3491
3492NTOSAPI
3493NTSTATUS
3494NTAPI
3495ZwOpenObjectAuditAlarm(
3496 /*IN*/ PUNICODE_STRING SubsystemName,
3497 /*IN*/ PVOID *HandleId,
3498 /*IN*/ PUNICODE_STRING ObjectTypeName,
3499 /*IN*/ PUNICODE_STRING ObjectName,
3500 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
3501 /*IN*/ HANDLE TokenHandle,
3502 /*IN*/ ACCESS_MASK DesiredAccess,
3503 /*IN*/ ACCESS_MASK GrantedAccess,
3504 /*IN*/ PPRIVILEGE_SET Privileges /*OPTIONAL*/,
3505 /*IN*/ BOOLEAN ObjectCreation,
3506 /*IN*/ BOOLEAN AccessGranted,
3507 /*OUT*/ PBOOLEAN GenerateOnClose);
3508
3509NTOSAPI
3510NTSTATUS
3511NTAPI
3512NtCloseObjectAuditAlarm(
3513 /*IN*/ PUNICODE_STRING SubsystemName,
3514 /*IN*/ PVOID HandleId,
3515 /*IN*/ BOOLEAN GenerateOnClose);
3516
3517NTOSAPI
3518NTSTATUS
3519NTAPI
3520ZwCloseObjectAuditAlarm(
3521 /*IN*/ PUNICODE_STRING SubsystemName,
3522 /*IN*/ PVOID HandleId,
3523 /*IN*/ BOOLEAN GenerateOnClose);
3524
3525NTOSAPI
3526NTSTATUS
3527NTAPI
3528NtDeleteObjectAuditAlarm(
3529 /*IN*/ PUNICODE_STRING SubsystemName,
3530 /*IN*/ PVOID HandleId,
3531 /*IN*/ BOOLEAN GenerateOnClose);
3532
3533NTOSAPI
3534NTSTATUS
3535NTAPI
3536ZwDeleteObjectAuditAlarm(
3537 /*IN*/ PUNICODE_STRING SubsystemName,
3538 /*IN*/ PVOID HandleId,
3539 /*IN*/ BOOLEAN GenerateOnClose);
3540
3541
3542
3543
3544/* Plug and play and power management */
3545
3546NTOSAPI
3547NTSTATUS
3548NTAPI
3549ZwRequestWakeupLatency(
3550 /*IN*/ LATENCY_TIME Latency);
3551
3552NTOSAPI
3553NTSTATUS
3554NTAPI
3555ZwRequestDeviceWakeup(
3556 /*IN*/ HANDLE DeviceHandle);
3557
3558NTOSAPI
3559NTSTATUS
3560NTAPI
3561ZwCancelDeviceWakeupRequest(
3562 /*IN*/ HANDLE DeviceHandle);
3563
3564NTOSAPI
3565BOOLEAN
3566NTAPI
3567ZwIsSystemResumeAutomatic(
3568 VOID);
3569
3570NTOSAPI
3571NTSTATUS
3572NTAPI
3573ZwSetThreadExecutionState(
3574 /*IN*/ EXECUTION_STATE ExecutionState,
3575 /*OUT*/ PEXECUTION_STATE PreviousExecutionState);
3576
3577NTOSAPI
3578NTSTATUS
3579NTAPI
3580ZwGetDevicePowerState(
3581 /*IN*/ HANDLE DeviceHandle,
3582 /*OUT*/ PDEVICE_POWER_STATE DevicePowerState);
3583
3584NTOSAPI
3585NTSTATUS
3586NTAPI
3587ZwSetSystemPowerState(
3588 /*IN*/ POWER_ACTION SystemAction,
3589 /*IN*/ SYSTEM_POWER_STATE MinSystemState,
3590 /*IN*/ ULONG Flags);
3591
3592NTOSAPI
3593NTSTATUS
3594NTAPI
3595ZwInitiatePowerAction(
3596 /*IN*/ POWER_ACTION SystemAction,
3597 /*IN*/ SYSTEM_POWER_STATE MinSystemState,
3598 /*IN*/ ULONG Flags,
3599 /*IN*/ BOOLEAN Asynchronous);
3600
3601NTOSAPI
3602NTSTATUS
3603NTAPI
3604ZwPowerInformation(
3605 /*IN*/ POWER_INFORMATION_LEVEL PowerInformationLevel,
3606 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
3607 /*IN*/ ULONG InputBufferLength,
3608 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
3609 /*IN*/ ULONG OutputBufferLength);
3610
3611NTOSAPI
3612NTSTATUS
3613NTAPI
3614NtPlugPlayControl(
3615 /*IN*/ ULONG ControlCode,
3616 /*IN OUT*/ PVOID Buffer,
3617 /*IN*/ ULONG BufferLength);
3618
3619NTOSAPI
3620NTSTATUS
3621NTAPI
3622ZwPlugPlayControl(
3623 /*IN*/ ULONG ControlCode,
3624 /*IN OUT*/ PVOID Buffer,
3625 /*IN*/ ULONG BufferLength);
3626
3627NTOSAPI
3628NTSTATUS
3629NTAPI
3630NtGetPlugPlayEvent(
3631 /*IN*/ ULONG Reserved1,
3632 /*IN*/ ULONG Reserved2,
3633 /*OUT*/ PVOID Buffer,
3634 /*IN*/ ULONG BufferLength);
3635
3636NTOSAPI
3637NTSTATUS
3638NTAPI
3639ZwGetPlugPlayEvent(
3640 /*IN*/ ULONG Reserved1,
3641 /*IN*/ ULONG Reserved2,
3642 /*OUT*/ PVOID Buffer,
3643 /*IN*/ ULONG BufferLength);
3644
3645
3646
3647
3648/* Miscellany */
3649
3650NTOSAPI
3651NTSTATUS
3652NTAPI
3653NtRaiseException(
3654 /*IN*/ PEXCEPTION_RECORD ExceptionRecord,
3655 /*IN*/ PCONTEXT Context,
3656 /*IN*/ BOOLEAN SearchFrames);
3657
3658NTOSAPI
3659NTSTATUS
3660NTAPI
3661ZwRaiseException(
3662 /*IN*/ PEXCEPTION_RECORD ExceptionRecord,
3663 /*IN*/ PCONTEXT Context,
3664 /*IN*/ BOOLEAN SearchFrames);
3665
3666NTOSAPI
3667NTSTATUS
3668NTAPI
3669NtContinue(
3670 /*IN*/ PCONTEXT Context,
3671 /*IN*/ BOOLEAN TestAlert);
3672
3673NTOSAPI
3674NTSTATUS
3675NTAPI
3676ZwContinue(
3677 /*IN*/ PCONTEXT Context,
3678 /*IN*/ BOOLEAN TestAlert);
3679
3680NTOSAPI
3681NTSTATUS
3682NTAPI
3683ZwW32Call(
3684 /*IN*/ ULONG RoutineIndex,
3685 /*IN*/ PVOID Argument,
3686 /*IN*/ ULONG ArgumentLength,
3687 /*OUT*/ PVOID *Result /*OPTIONAL*/,
3688 /*OUT*/ PULONG ResultLength /*OPTIONAL*/);
3689
3690NTOSAPI
3691NTSTATUS
3692NTAPI
3693NtSetLowWaitHighThread(
3694 VOID);
3695
3696NTOSAPI
3697NTSTATUS
3698NTAPI
3699ZwSetLowWaitHighThread(
3700 VOID);
3701
3702NTOSAPI
3703NTSTATUS
3704NTAPI
3705NtSetHighWaitLowThread(
3706 VOID);
3707
3708NTOSAPI
3709NTSTATUS
3710NTAPI
3711ZwSetHighWaitLowThread(
3712 VOID);
3713
3714NTOSAPI
3715NTSTATUS
3716NTAPI
3717NtLoadDriver(
3718 /*IN*/ PUNICODE_STRING DriverServiceName);
3719
3720NTOSAPI
3721NTSTATUS
3722NTAPI
3723ZwLoadDriver(
3724 /*IN*/ PUNICODE_STRING DriverServiceName);
3725
3726NTOSAPI
3727NTSTATUS
3728NTAPI
3729NtUnloadDriver(
3730 /*IN*/ PUNICODE_STRING DriverServiceName);
3731
3732NTOSAPI
3733NTSTATUS
3734NTAPI
3735ZwUnloadDriver(
3736 /*IN*/ PUNICODE_STRING DriverServiceName);
3737
3738NTOSAPI
3739NTSTATUS
3740NTAPI
3741NtFlushInstructionCache(
3742 /*IN*/ HANDLE ProcessHandle,
3743 /*IN*/ PVOID BaseAddress /*OPTIONAL*/,
3744 /*IN*/ ULONG FlushSize);
3745
3746NTOSAPI
3747NTSTATUS
3748NTAPI
3749ZwFlushInstructionCache(
3750 /*IN*/ HANDLE ProcessHandle,
3751 /*IN*/ PVOID BaseAddress /*OPTIONAL*/,
3752 /*IN*/ ULONG FlushSize);
3753
3754NTOSAPI
3755NTSTATUS
3756NTAPI
3757NtFlushWriteBuffer(
3758 VOID);
3759
3760NTOSAPI
3761NTSTATUS
3762NTAPI
3763ZwFlushWriteBuffer(
3764 VOID);
3765
3766NTOSAPI
3767NTSTATUS
3768NTAPI
3769NtQueryDefaultLocale(
3770 /*IN*/ BOOLEAN ThreadOrSystem,
3771 /*OUT*/ PLCID Locale);
3772
3773NTOSAPI
3774NTSTATUS
3775NTAPI
3776ZwQueryDefaultLocale(
3777 /*IN*/ BOOLEAN ThreadOrSystem,
3778 /*OUT*/ PLCID Locale);
3779
3780NTOSAPI
3781NTSTATUS
3782NTAPI
3783NtSetDefaultLocale(
3784 /*IN*/ BOOLEAN ThreadOrSystem,
3785 /*IN*/ LCID Locale);
3786
3787NTOSAPI
3788NTSTATUS
3789NTAPI
3790ZwSetDefaultLocale(
3791 /*IN*/ BOOLEAN ThreadOrSystem,
3792 /*IN*/ LCID Locale);
3793
3794NTOSAPI
3795NTSTATUS
3796NTAPI
3797NtQueryDefaultUILanguage(
3798 /*OUT*/ PLANGID LanguageId);
3799
3800NTOSAPI
3801NTSTATUS
3802NTAPI
3803ZwQueryDefaultUILanguage(
3804 /*OUT*/ PLANGID LanguageId);
3805
3806NTOSAPI
3807NTSTATUS
3808NTAPI
3809NtSetDefaultUILanguage(
3810 /*IN*/ LANGID LanguageId);
3811
3812NTOSAPI
3813NTSTATUS
3814NTAPI
3815ZwSetDefaultUILanguage(
3816 /*IN*/ LANGID LanguageId);
3817
3818NTOSAPI
3819NTSTATUS
3820NTAPI
3821NtQueryInstallUILanguage(
3822 /*OUT*/ PLANGID LanguageId);
3823
3824NTOSAPI
3825NTSTATUS
3826NTAPI
3827ZwQueryInstallUILanguage(
3828 /*OUT*/ PLANGID LanguageId);
3829
3830NTOSAPI
3831NTSTATUS
3832NTAPI
3833NtAllocateLocallyUniqueId(
3834 /*OUT*/ PLUID Luid);
3835
3836NTOSAPI
3837NTSTATUS
3838NTAPI
3839NtAllocateUuids(
3840 /*OUT*/ PLARGE_INTEGER UuidLastTimeAllocated,
3841 /*OUT*/ PULONG UuidDeltaTime,
3842 /*OUT*/ PULONG UuidSequenceNumber,
3843 /*OUT*/ PUCHAR UuidSeed);
3844
3845NTOSAPI
3846NTSTATUS
3847NTAPI
3848ZwAllocateUuids(
3849 /*OUT*/ PLARGE_INTEGER UuidLastTimeAllocated,
3850 /*OUT*/ PULONG UuidDeltaTime,
3851 /*OUT*/ PULONG UuidSequenceNumber,
3852 /*OUT*/ PUCHAR UuidSeed);
3853
3854NTOSAPI
3855NTSTATUS
3856NTAPI
3857NtSetUuidSeed(
3858 /*IN*/ PUCHAR UuidSeed);
3859
3860NTOSAPI
3861NTSTATUS
3862NTAPI
3863ZwSetUuidSeed(
3864 /*IN*/ PUCHAR UuidSeed);
3865
3866typedef enum _HARDERROR_RESPONSE_OPTION {
3867 OptionAbortRetryIgnore,
3868 OptionOk,
3869 OptionOkCancel,
3870 OptionRetryCancel,
3871 OptionYesNo,
3872 OptionYesNoCancel,
3873 OptionShutdownSystem
3874} HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION;
3875
3876typedef enum _HARDERROR_RESPONSE {
3877 ResponseReturnToCaller,
3878 ResponseNotHandled,
3879 ResponseAbort,
3880 ResponseCancel,
3881 ResponseIgnore,
3882 ResponseNo,
3883 ResponseOk,
3884 ResponseRetry,
3885 ResponseYes
3886} HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
3887
3888NTOSAPI
3889NTSTATUS
3890NTAPI
3891NtRaiseHardError(
3892 /*IN*/ NTSTATUS Status,
3893 /*IN*/ ULONG NumberOfArguments,
3894 /*IN*/ ULONG StringArgumentsMask,
3895 /*IN*/ PULONG Arguments,
3896 /*IN*/ HARDERROR_RESPONSE_OPTION ResponseOption,
3897 /*OUT*/ PHARDERROR_RESPONSE Response);
3898
3899NTOSAPI
3900NTSTATUS
3901NTAPI
3902ZwRaiseHardError(
3903 /*IN*/ NTSTATUS Status,
3904 /*IN*/ ULONG NumberOfArguments,
3905 /*IN*/ ULONG StringArgumentsMask,
3906 /*IN*/ PULONG Arguments,
3907 /*IN*/ HARDERROR_RESPONSE_OPTION ResponseOption,
3908 /*OUT*/ PHARDERROR_RESPONSE Response);
3909
3910NTOSAPI
3911NTSTATUS
3912NTAPI
3913NtSetDefaultHardErrorPort(
3914 /*IN*/ HANDLE PortHandle);
3915
3916NTOSAPI
3917NTSTATUS
3918NTAPI
3919ZwSetDefaultHardErrorPort(
3920 /*IN*/ HANDLE PortHandle);
3921
3922NTOSAPI
3923NTSTATUS
3924NTAPI
3925NtDisplayString(
3926 /*IN*/ PUNICODE_STRING String);
3927
3928NTOSAPI
3929NTSTATUS
3930NTAPI
3931ZwDisplayString(
3932 /*IN*/ PUNICODE_STRING String);
3933
3934NTOSAPI
3935NTSTATUS
3936NTAPI
3937NtCreatePagingFile(
3938 /*IN*/ PUNICODE_STRING FileName,
3939 /*IN*/ PULARGE_INTEGER InitialSize,
3940 /*IN*/ PULARGE_INTEGER MaximumSize,
3941 /*IN*/ ULONG Reserved);
3942
3943NTOSAPI
3944NTSTATUS
3945NTAPI
3946ZwCreatePagingFile(
3947 /*IN*/ PUNICODE_STRING FileName,
3948 /*IN*/ PULARGE_INTEGER InitialSize,
3949 /*IN*/ PULARGE_INTEGER MaximumSize,
3950 /*IN*/ ULONG Reserved);
3951
3952typedef USHORT RTL_ATOM, *PRTL_ATOM;
3953
3954NTOSAPI
3955NTSTATUS
3956NTAPI
3957NtAddAtom(
3958 /*IN*/ PWSTR AtomName,
3959 /*IN*/ ULONG AtomNameLength,
3960 /*OUT*/ PRTL_ATOM Atom);
3961
3962NTOSAPI
3963NTSTATUS
3964NTAPI
3965ZwAddAtom(
3966 /*IN*/ PWSTR AtomName,
3967 /*IN*/ ULONG AtomNameLength,
3968 /*OUT*/ PRTL_ATOM Atom);
3969
3970NTOSAPI
3971NTSTATUS
3972NTAPI
3973NtFindAtom(
3974 /*IN*/ PWSTR AtomName,
3975 /*IN*/ ULONG AtomNameLength,
3976 /*OUT*/ PRTL_ATOM Atom);
3977
3978NTOSAPI
3979NTSTATUS
3980NTAPI
3981ZwFindAtom(
3982 /*IN*/ PWSTR AtomName,
3983 /*IN*/ ULONG AtomNameLength,
3984 /*OUT*/ PRTL_ATOM Atom);
3985
3986NTOSAPI
3987NTSTATUS
3988NTAPI
3989NtDeleteAtom(
3990 /*IN*/ RTL_ATOM Atom);
3991
3992NTOSAPI
3993NTSTATUS
3994NTAPI
3995ZwDeleteAtom(
3996 /*IN*/ RTL_ATOM Atom);
3997
3998typedef enum _ATOM_INFORMATION_CLASS {
3999 AtomBasicInformation,
4000 AtomListInformation
4001} ATOM_INFORMATION_CLASS;
4002
4003NTOSAPI
4004NTSTATUS
4005NTAPI
4006NtQueryInformationAtom(
4007 /*IN*/ RTL_ATOM Atom,
4008 /*IN*/ ATOM_INFORMATION_CLASS AtomInformationClass,
4009 /*OUT*/ PVOID AtomInformation,
4010 /*IN*/ ULONG AtomInformationLength,
4011 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
4012
4013NTOSAPI
4014NTSTATUS
4015NTAPI
4016ZwQueryInformationAtom(
4017 /*IN*/ RTL_ATOM Atom,
4018 /*IN*/ ATOM_INFORMATION_CLASS AtomInformationClass,
4019 /*OUT*/ PVOID AtomInformation,
4020 /*IN*/ ULONG AtomInformationLength,
4021 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/);
4022
4023typedef struct _ATOM_BASIC_INFORMATION {
4024 USHORT ReferenceCount;
4025 USHORT Pinned;
4026 USHORT NameLength;
4027 WCHAR Name[1];
4028} ATOM_BASIC_INFORMATION, *PATOM_BASIC_INFORMATION;
4029
4030typedef struct _ATOM_LIST_INFORMATION {
4031 ULONG NumberOfAtoms;
4032 ATOM Atoms[1];
4033} ATOM_LIST_INFORMATION, *PATOM_LIST_INFORMATION;
4034
4035NTOSAPI
4036NTSTATUS
4037NTAPI
4038NtSetLdtEntries(
4039 /*IN*/ ULONG Selector1,
4040 /*IN*/ LDT_ENTRY LdtEntry1,
4041 /*IN*/ ULONG Selector2,
4042 /*IN*/ LDT_ENTRY LdtEntry2);
4043
4044NTOSAPI
4045NTSTATUS
4046NTAPI
4047ZwSetLdtEntries(
4048 /*IN*/ ULONG Selector1,
4049 /*IN*/ LDT_ENTRY LdtEntry1,
4050 /*IN*/ ULONG Selector2,
4051 /*IN*/ LDT_ENTRY LdtEntry2);
4052
4053NTOSAPI
4054NTSTATUS
4055NTAPI
4056NtVdmControl(
4057 /*IN*/ ULONG ControlCode,
4058 /*IN*/ PVOID ControlData);
4059
4060NTOSAPI
4061NTSTATUS
4062NTAPI
4063ZwVdmControl(
4064 /*IN*/ ULONG ControlCode,
4065 /*IN*/ PVOID ControlData);
4066
4067#pragma pack(pop)
4068
4069#ifdef __cplusplus
4070}
4071#endif
4072
4073#endif /* __NTAPI_H */
Note: See TracBrowser for help on using the repository browser.