1 {******************************************************************************}
2 {                                                                              }
3 { Interface unit for the Windows NT Native API                                 }
4 { Copyright (C) 1999, 2000, 2005 Marcel van Brakel (brakelm)                   }
5 { Copyright (C) 2000-2001, 2005 Oliver Schneider (assarbad)                    }
6 {                                                                              }
7 { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
8 {                                                                              }
9 { You may retrieve the latest version of this file at the Project JEDI         }
10 { APILIB home page, located at http://jedi-apilib.sourceforge.net              }
11 {                                                                              }
12 { The contents of this file are used with permission, subject to the Mozilla   }
13 { Public License Version 1.1 (the "License"); you may not use this file except }
14 { in compliance with the License. You may obtain a copy of the License at      }
15 { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
16 {                                                                              }
17 { Software distributed under the License is distributed on an "AS IS" basis,   }
18 { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
19 { the specific language governing rights and limitations under the License.    }
20 {                                                                              }
21 { Alternatively, the contents of this file may be used under the terms of the  }
22 { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
23 { provisions of the LGPL License are applicable instead of those above.        }
24 { If you wish to allow use of your version of this file only under the terms   }
25 { of the LGPL License and not to allow others to use your version of this file }
26 { under the MPL, indicate your decision by deleting  the provisions above and  }
27 { replace  them with the notice and other provisions required by the LGPL      }
28 { License.  If you do not delete the provisions above, a recipient may use     }
29 { your version of this file under either the MPL or the LGPL License.          }
30 {                                                                              }
31 { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
32 {                                                                              }
33 {******************************************************************************}
34 
35 // $Id: JwaNative.pas,v 1.24 2007/09/14 06:48:46 marquardt Exp $
36 
37 {******************************************************************************}
38 {** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING  **}
39 {******************************************************************************}
40 {**                                                                          **}
41 {** The prototypes, declarations and information in this file has been       **}
42 {** compiled from various sources as well as through reverse engineering     **}
43 {** techniques. We make no guarantee as to the correctness of the contents.  **}
44 {** Caution is recommended, USE AT YOUR OWN RISK.                            **}
45 {**                                                                          **}
46 {******************************************************************************}
47 {** About the Native API						     **                                          }
48 {******************************************************************************}
49 {**                                                                          **}
50 {** The functions herein are usually referred to as the NT Native API.       **}
51 {** The Native API is subdivided into several functional categories, which   **}
52 {** you can distinguish by the function name prefix:                         **}
53 {**                                                                          **}
54 {**   Cc   = Cache Controller                                                **}
55 {**   Cm   = Configuration Manager                                           **}
56 {**   Csr  = Client Server support functions (LPC; related: CSRSS.EXE)       **}
57 {**   Dbg  = Debugger support functions                                      **}
58 {**   Etw  = Event Tracing for Windows                                       **}
59 {**   Ex   = Executive                                                       **}
60 {**   Fs   = File system support functions                                   **}
61 {**   Hal  = Hardware abstraction layer functions                            **}
62 {**   Inbv = Something like: _In_itial _B_oot _V_ideo functions              **}
63 {**   Io   = I/O manager support functions                                   **}
64 {**   Kd   = Kernel debugger support functions                               **}
65 {**   Ke   = General Kernel                                                  **}
66 {**   Ki   = Kernel internal support functions (???)                         **}
67 {**   Ldr  = PE image loader support functions                               **}
68 {**   Lpc  = LPC support functions                                           **}
69 {**   Lsa  = Local security authority support functions                      **}
70 {**   Mm   = Memory manager support functions                                **}
71 {**   Nls  = National Language Support                                       **}
72 {**   Nt   = Generic Native APIs                                             **}
73 {**   Ob   = Object manager functions                                        **}
74 {**   Pfx  = Name prefix support functions (???)                             **}
75 {**   Po   = Power management support functions                              **}
76 {**   Ps   = Process management support functions                            **}
77 {**   Rtl  = Runtime library functions                                       **}
78 {**   Rtlp = Private runtime library functions 1)                            **}
79 {**   Se   = Security support functions                                      **}
80 {**   Wmi  = Windows management instrumentation support functions            **}
81 {**   Vf   = Driver Verifier                                                 **}
82 {**   Zw   = Nt* counterparts. Zw == "Zero Warranty"???                      **}
83 {**          1) "p" after the prefix means "private"                         **}
84 {**                                                                          **}
85 {** The Native API is split into a user mode component (mainly NTDLL.DLL)    **}
86 {** and a kernel mode component (mainly NTOSKRNL.EXE). While a large part of **}
87 {** the Native API is available both from usermode and kernelmode, some      **}
88 {** functions are exclusive to either mode. This unit only deals with 	     **}
89 {** functions that are available to usermode code.                           **}
90 {**                                                                          **}
91 {** Note that the functions prefixed with "Nt" and "Zw" usually appear in    **}
92 {** pairs, though not always! For details see http://native.assarbad.net     **}
93 {**                                                                          **}
94 {** Most of the Native API is undocumented. However, Microsoft recently      **}
95 {** started to document a subset of the API in "winternl.h" in the Platform  **}
96 {** SDK. A small part of the Native API functions, specifically those useful **}
97 {** for kernel mode development (device drivers) are documented in the DDK.  **}
98 {**                                                                          **}
99 {******************************************************************************}
100 {** Special notes                                                            **}
101 {******************************************************************************}
102 {**                                                                          **}
103 {** Some functions herein have been implemented instead of being imported.   **}
104 {** That's due to the fact, that the FASTCALL calling convention is not      **}
105 {** available in Delphi. These functions include:                            **}
106 {** - RtlUshortByteSwap()                                                    **}
107 {** - RtlUlongByteSwap()                                                     **}
108 {** - RtlUlonglongByteSwap()                                                 **}
109 {**                                                                          **}
110 {** Other functions are implemented and also imported, but have been made    **}
111 {** available for OS versions not actually supporting them. These are:       **}
112 {** - RtlGetLastWin32Error()                                                 **}
113 {** - RtlSetLastWin32Error()                                                 **}
114 {**                                                                          **}
115 {** Starting with Windows XP, the Kernel32!GetLastError() and counterpart    **}
116 {** Kernel32!SetLastError() have been moved into NTDLL and are only function **}
117 {** forwarders to the NTDLL functions with the names above.                  **}
118 {** By importing them directly from Kernel32.dll via their old names we      **}
119 {** enable you to use these functions transparently without regard to the OS **}
120 {** version.                                                                 **}
121 {**                                                                          **}
122 {** RtlCopyMemory() had to be implemented via Delphi means because it's only **}
123 {** a macro (pointing to memcpy) in the C-world.                             **}
124 {**                                                                          **}
125 {** Last but not least we've implemented our own versions of some of the     **}
126 {** functions available through NTDLL [declared private Ntp*, Rtlp*]:        **}
127 {** - NtpGetProcessHeap()                                                    **}
128 {** - NtpCurrentTeb()                                                        **}
129 {** - RtlpGetCurrentPeb()                                                    **}
130 {**                                                                          **}
131 {** Plus a function that is available starting from Windows XP, but could be **}
132 {** useful on earlier versions as well [declared private Rtlp*]:             **}
133 {** - RtlpValidateUnicodeString()                                            **}
134 {**                                                                          **}
135 {** And our own flavor of it, omitting the first (currently unused)          **}
136 {** parameter:                                                               **}
137 {** - RtlpValidateUnicodeString2()                                           **}
138 {**                                                                          **}
139 {******************************************************************************}
140 {** References, Tools, Docs                                                  **}
141 {******************************************************************************}
142 {**                                                                          **}
143 {** - Windows NT/2000 Native API References (Gary Nebbett)                   **}
144 {**   ISBN 1-57870-199-6                                                     **}
145 {** - Undocumented Windows 2000 Secrets (Sven B. Schreiber)                  **}
146 {**   ISBN 0-201-72187-2                                                     **}
147 {** - Undocumented Windows NT (Prasad Dabak, Sandeep Phadke, Milind Borate)  **}
148 {**   ISBN 0-7645-4569-8                                                     **}
149 {** - Platform SDK for Windows 2003 Server (or later version)                **}
150 {**   http://www.microsoft.com/msdownload/platformsdk/sdkupdate/             **}
151 {** - Windows 2003 DDK (or similar DDK version                               **}
152 {**   http://www.microsoft.com/whdc/ddk/                                     **}
153 {** - WinDbg - a debugger that is usually badly underestimated!              **}
154 {**   http://www.microsoft.com/whdc/devtools/debugging                       **}
155 {** - IDA Pro Standard 4.7 (or later) - world's best disassembler            **}
156 {**   http://www.datarescue.com/idabase/                                     **}
157 {** - NTDEV, NTFSD, WINDBG mailing lists and more ...                        **}
158 {**   http://www.osronline.com/                                              **}
159 {** - Sysinternals tools and documentation of some "Windows secrets"         **}
160 {**   http://www.sysinternals.com/                                           **}
161 {** - A nicely done online compilation of NT Native APIs                     **}
162 {**   http://undocumented.ntinternals.net/                                   **}
163 {** - ReactOS (to cross-check own assumptions with those of other smart guys)**}
164 {**   http://www.reactos.com/                                                **}
165 {**                                                                          **}
166 {******************************************************************************}
167 {$IFNDEF JWA_OMIT_SECTIONS}
168 unit JwaNative;
169 
170 interface
171 {$INCLUDE jediapilib.inc}
172 uses
173   JwaWinType, JwaWinNT, JwaWinBase, JwaNtStatus;
174 
175 {$WEAKPACKAGEUNIT}
176 
177 // For native APIs we consider RTDL the better method of importing
178 {.$DEFINE RTDL}
179 {$IFDEF RTDL}{$DEFINE DYNAMIC_LINK}{$ENDIF}
180 const
181   ntdll = 'ntdll.dll';
182 
183 //------------------------------------------------------------------------------
184 
185 {$ENDIF JWA_OMIT_SECTIONS}
186 {$IFNDEF JWA_IMPLEMENTATIONSECTION}
187 
188 type
189 
190   _CLIENT_ID = record
191     UniqueProcess: HANDLE;
192     UniqueThread: HANDLE;
193   end;
194   CLIENT_ID = _CLIENT_ID;
195   PCLIENT_ID = ^CLIENT_ID;
196   TClientID = CLIENT_ID;
197   PClientID = ^TClientID;
198 
199   KPRIORITY = LONG;
200 
201   _KWAIT_REASON = (
202     Executive,
203     FreePage,
204     PageIn,
205     PoolAllocation,
206     DelayExecution,
207     Suspended,
208     UserRequest,
209     WrExecutive,
210     WrFreePage,
211     WrPageIn,
212     WrPoolAllocation,
213     WrDelayExecution,
214     WrSuspended,
215     WrUserRequest,
216     WrEventPair,
217     WrQueue,
218     WrLpcReceive,
219     WrLpcReply,
220     WrVirtualMemory,
221     WrPageOut,
222     WrRendezvous,
223     Spare2,
224     Spare3,
225     Spare4,
226     Spare5,
227     Spare6,
228     WrKernel,
229     MaximumWaitReason);
230   KWAIT_REASON = _KWAIT_REASON;
231   TKWaitReason = KWAIT_REASON;
232 
233   _VM_COUNTERS = record
234     PeakVirtualSize: SIZE_T;
235     VirtualSize: SIZE_T;
236     PageFaultCount: ULONG;
237     PeakWorkingSetSize: SIZE_T;
238     WorkingSetSize: SIZE_T;
239     QuotaPeakPagedPoolUsage: SIZE_T;
240     QuotaPagedPoolUsage: SIZE_T;
241     QuotaPeakNonPagedPoolUsage: SIZE_T;
242     QuotaNonPagedPoolUsage: SIZE_T;
243     PagefileUsage: SIZE_T;
244     PeakPagefileUsage: SIZE_T;
245   end;
246   VM_COUNTERS = _VM_COUNTERS;
247   PVM_COUNTERS = ^VM_COUNTERS;
248   TVmCounters = VM_COUNTERS;
249   PVmCounters = ^TVmCounters;
250 
251 const
252   NonPagedPool = 0;
253   PagedPool = 1;
254   NonPagedPoolMustSucceed = 2;
255   DontUseThisType = 3;
256   NonPagedPoolCacheAligned = 4;
257   PagedPoolCacheAligned = 5;
258   NonPagedPoolCacheAlignedMustS = 6;
259   MaxPoolType = 7;
260   NonPagedPoolSession = 32;
261   PagedPoolSession = NonPagedPoolSession + 1;
262   NonPagedPoolMustSucceedSession = PagedPoolSession + 1;
263   DontUseThisTypeSession = NonPagedPoolMustSucceedSession + 1;
264   NonPagedPoolCacheAlignedSession = DontUseThisTypeSession + 1;
265   PagedPoolCacheAlignedSession = NonPagedPoolCacheAlignedSession + 1;
266   NonPagedPoolCacheAlignedMustSSession = PagedPoolCacheAlignedSession + 1;
267 
268 type
269   POOL_TYPE = NonPagedPool..NonPagedPoolCacheAlignedMustSSession;
270 
271   _IO_STATUS_BLOCK = record
272     //union {
273     Status: NTSTATUS;
274     //    PVOID Pointer;
275     //}
276     Information: ULONG_PTR;
277   end;
278   IO_STATUS_BLOCK = _IO_STATUS_BLOCK;
279   PIO_STATUS_BLOCK = ^IO_STATUS_BLOCK;
280   TIoStatusBlock = IO_STATUS_BLOCK;
281   PIoStatusBlock = ^TIoStatusBlock;
282 
283 
284 const
285   ViewShare = 1;
286   ViewUnmap = 2;
287 
288 type
289   SECTION_INHERIT = ViewShare..ViewUnmap;
290 
291   {.$IFNDEF JWA_INCLUDEMODE}
292   _THREADINFOCLASS = (
293     ThreadBasicInformation,
294     ThreadTimes,
295     ThreadPriority,
296     ThreadBasePriority,
297     ThreadAffinityMask,
298     ThreadImpersonationToken,
299     ThreadDescriptorTableEntry,
300     ThreadEnableAlignmentFaultFixup,
301     ThreadEventPair_Reusable,
302     ThreadQuerySetWin32StartAddress,
303     ThreadZeroTlsCell,
304     ThreadPerformanceCount,
305     ThreadAmILastThread,
306     ThreadIdealProcessor,
307     ThreadPriorityBoost,
308     ThreadSetTlsArrayAddress,
309     ThreadIsIoPending,
310     ThreadHideFromDebugger,
311     ThreadBreakOnTermination, // was added in XP - used by RtlSetThreadIsCritical()
312     MaxThreadInfoClass);
313   THREADINFOCLASS = _THREADINFOCLASS;
314   {.$ENDIF JWA_INCLUDEMODE}
315   THREAD_INFORMATION_CLASS = THREADINFOCLASS;
316 
317 
318   TThreadInfoClass = THREADINFOCLASS;
319 
320 {$IFNDEF JWA_INCLUDEMODE}
321   KAFFINITY = ULONG;
322   PKAFFINITY = ^KAFFINITY;
323 {$ENDIF JWA_INCLUDEMODE}
324 
325   PKNORMAL_ROUTINE = procedure(NormalContext, SystemArgument1, SystemArgument2: PVOID); stdcall;
326 
327 
328   _PROCESSINFOCLASS = (
329     ProcessBasicInformation,
330     ProcessQuotaLimits,
331     ProcessIoCounters,
332     ProcessVmCounters,
333     ProcessTimes,
334     ProcessBasePriority,
335     ProcessRaisePriority,
336     ProcessDebugPort,
337     ProcessExceptionPort,
338     ProcessAccessToken,
339     ProcessLdtInformation,
340     ProcessLdtSize,
341     ProcessDefaultHardErrorMode,
342     ProcessIoPortHandlers, // Note: this is kernel mode only
343     ProcessPooledUsageAndLimits,
344     ProcessWorkingSetWatch,
345     ProcessUserModeIOPL,
346     ProcessEnableAlignmentFaultFixup,
347     ProcessPriorityClass,
348     ProcessWx86Information,
349     ProcessHandleCount,
350     ProcessAffinityMask,
351     ProcessPriorityBoost,
352     ProcessDeviceMap,
353     ProcessSessionInformation,
354     ProcessForegroundInformation,
355     ProcessWow64Information, // = 26
356     ProcessImageFileName, // added after W2K
357     ProcessLUIDDeviceMapsEnabled,
358     ProcessBreakOnTermination, // used by RtlSetProcessIsCritical()
359     ProcessDebugObjectHandle,
360     ProcessDebugFlags,
361     ProcessHandleTracing,
362     MaxProcessInfoClass);
363   PROCESSINFOCLASS = _PROCESSINFOCLASS;
364   PROCESS_INFORMATION_CLASS = PROCESSINFOCLASS;
365   TProcessInfoClass = PROCESSINFOCLASS;
366 
367   _KPROFILE_SOURCE = (
368     ProfileTime,
369     ProfileAlignmentFixup,
370     ProfileTotalIssues,
371     ProfilePipelineDry,
372     ProfileLoadInstructions,
373     ProfilePipelineFrozen,
374     ProfileBranchInstructions,
375     ProfileTotalNonissues,
376     ProfileDcacheMisses,
377     ProfileIcacheMisses,
378     ProfileCacheMisses,
379     ProfileBranchMispredictions,
380     ProfileStoreInstructions,
381     ProfileFpInstructions,
382     ProfileIntegerInstructions,
383     Profile2Issue,
384     Profile3Issue,
385     Profile4Issue,
386     ProfileSpecialInstructions,
387     ProfileTotalCycles,
388     ProfileIcacheIssues,
389     ProfileDcacheAccesses,
390     ProfileMemoryBarrierCycles,
391     ProfileLoadLinkedIssues,
392     ProfileMaximum);
393   KPROFILE_SOURCE = _KPROFILE_SOURCE;
394   TKProfileSource = KPROFILE_SOURCE;
395 
396   PIO_APC_ROUTINE = procedure(ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Reserved: ULONG); stdcall;
397 
398   _FILE_FULL_EA_INFORMATION = record
399     NextEntryOffset: ULONG;
400     Flags: UCHAR;
401     EaNameLength: UCHAR;
402     EaValueLength: USHORT;
403     EaName: array[0..0] of CHAR;
404   end;
405   FILE_FULL_EA_INFORMATION = _FILE_FULL_EA_INFORMATION;
406   PFILE_FULL_EA_INFORMATION = ^FILE_FULL_EA_INFORMATION;
407   TFileFullEaInformation = FILE_FULL_EA_INFORMATION;
408   PFileFullEaInformation = ^TFileFullEaInformation;
409 
410   _FSINFOCLASS = (
411     FileFsFiller0,
412     FileFsVolumeInformation, // 1
413     FileFsLabelInformation, // 2
414     FileFsSizeInformation, // 3
415     FileFsDeviceInformation, // 4
416     FileFsAttributeInformation, // 5
417     FileFsControlInformation, // 6
418     FileFsFullSizeInformation, // 7
419     FileFsObjectIdInformation, // 8
420     FileFsMaximumInformation);
421   FS_INFORMATION_CLASS = _FSINFOCLASS;
422   PFS_INFORMATION_CLASS = ^FS_INFORMATION_CLASS;
423   TFsInformationClass = FS_INFORMATION_CLASS;
424   PFsInformationClass = ^TFsInformationClass;
425 
426 
427 {$IFNDEF JWA_INCLUDEMODE} //defined in jwaWindows.pas
428   UUID = GUID;
429 {$ENDIF JWA_INCLUDEMODE}
430 
431 
432   _FILE_BASIC_INFORMATION = record
433     CreationTime: LARGE_INTEGER;
434     LastAccessTime: LARGE_INTEGER;
435     LastWriteTime: LARGE_INTEGER;
436     ChangeTime: LARGE_INTEGER;
437     FileAttributes: ULONG;
438   end;
439   FILE_BASIC_INFORMATION = _FILE_BASIC_INFORMATION;
440   PFILE_BASIC_INFORMATION = ^FILE_BASIC_INFORMATION;
441   TFileBasicInformation = FILE_BASIC_INFORMATION;
442   PFileBasicInformation = ^TFileBasicInformation;
443 
444   _FILE_NETWORK_OPEN_INFORMATION = record
445     CreationTime: LARGE_INTEGER;
446     LastAccessTime: LARGE_INTEGER;
447     LastWriteTime: LARGE_INTEGER;
448     ChangeTime: LARGE_INTEGER;
449     AllocationSize: LARGE_INTEGER;
450     EndOfFile: LARGE_INTEGER;
451     FileAttributes: ULONG;
452   end;
453   FILE_NETWORK_OPEN_INFORMATION = _FILE_NETWORK_OPEN_INFORMATION;
454   PFILE_NETWORK_OPEN_INFORMATION = ^FILE_NETWORK_OPEN_INFORMATION;
455   TFileNetworkOpenInformation = FILE_NETWORK_OPEN_INFORMATION;
456   PFileNetworkOpenInformation = ^TFileNetworkOpenInformation;
457 
458 
459   _FILE_INFORMATION_CLASS = (
460     FileFiller0,
461     FileDirectoryInformation, // 1
462     FileFullDirectoryInformation, // 2
463     FileBothDirectoryInformation, // 3
464     FileBasicInformation, // 4  wdm
465     FileStandardInformation, // 5  wdm
466     FileInternalInformation, // 6
467     FileEaInformation, // 7
468     FileAccessInformation, // 8
469     FileNameInformation, // 9
470     FileRenameInformation, // 10
471     FileLinkInformation, // 11
472     FileNamesInformation, // 12
473     FileDispositionInformation, // 13
474     FilePositionInformation, // 14 wdm
475     FileFullEaInformation, // 15
476     FileModeInformation, // 16
477     FileAlignmentInformation, // 17
478     FileAllInformation, // 18
479     FileAllocationInformation, // 19
480     FileEndOfFileInformation, // 20 wdm
481     FileAlternateNameInformation, // 21
482     FileStreamInformation, // 22
483     FilePipeInformation, // 23
484     FilePipeLocalInformation, // 24
485     FilePipeRemoteInformation, // 25
486     FileMailslotQueryInformation, // 26
487     FileMailslotSetInformation, // 27
488     FileCompressionInformation, // 28
489     FileObjectIdInformation, // 29
490     FileCompletionInformation, // 30
491     FileMoveClusterInformation, // 31
492     FileQuotaInformation, // 32
493     FileReparsePointInformation, // 33
494     FileNetworkOpenInformation, // 34
495     FileAttributeTagInformation, // 35
496     FileTrackingInformation, // 36
497     FileMaximumInformation);
498   FILE_INFORMATION_CLASS = _FILE_INFORMATION_CLASS;
499   PFILE_INFORMATION_CLASS = ^FILE_INFORMATION_CLASS;
500   TFileInformationClass = FILE_INFORMATION_CLASS;
501   PFileInformationClass = ^TFileInformationClass;
502 
503   _FILE_STANDARD_INFORMATION = record
504     AllocationSize: LARGE_INTEGER;
505     EndOfFile: LARGE_INTEGER;
506     NumberOfLinks: ULONG;
507     DeletePending: ByteBool;
508     Directory: ByteBool;
509   end;
510   FILE_STANDARD_INFORMATION = _FILE_STANDARD_INFORMATION;
511   PFILE_STANDARD_INFORMATION = ^FILE_STANDARD_INFORMATION;
512   TFileStandardInformation = FILE_STANDARD_INFORMATION;
513   PFileStandardInformation = ^TFileStandardInformation;
514 
515   _FILE_POSITION_INFORMATION = record
516     CurrentByteOffset: LARGE_INTEGER;
517   end;
518   FILE_POSITION_INFORMATION = _FILE_POSITION_INFORMATION;
519   PFILE_POSITION_INFORMATION = ^FILE_POSITION_INFORMATION;
520   TFilePositionInformation = FILE_POSITION_INFORMATION;
521   PFilePositionInformation = ^TFilePositionInformation;
522 
523   _FILE_ALIGNMENT_INFORMATION = record
524     AlignmentRequirement: ULONG;
525   end;
526   FILE_ALIGNMENT_INFORMATION = _FILE_ALIGNMENT_INFORMATION;
527   PFILE_ALIGNMENT_INFORMATION = ^FILE_ALIGNMENT_INFORMATION;
528   TFileAlignmentInformation = FILE_ALIGNMENT_INFORMATION;
529   PFileAlignmentInformation = ^TFileAlignmentInformation;
530 
531   _KEY_SET_INFORMATION_CLASS = (KeyWriteTimeInformation);
532   KEY_SET_INFORMATION_CLASS = _KEY_SET_INFORMATION_CLASS;
533 
534   _KEY_INFORMATION_CLASS = (
535     KeyBasicInformation,
536     KeyNodeInformation,
537     KeyFullInformation,
538     KeyNameInformation);
539   KEY_INFORMATION_CLASS = _KEY_INFORMATION_CLASS;
540   TKeyInformationClass = KEY_INFORMATION_CLASS;
541 
542   _KEY_VALUE_INFORMATION_CLASS = (
543     KeyValueBasicInformation,
544     KeyValueFullInformation,
545     KeyValuePartialInformation,
546     KeyValueFullInformationAlign64,
547     KeyValuePartialInformationAlign64);
548   KEY_VALUE_INFORMATION_CLASS = _KEY_VALUE_INFORMATION_CLASS;
549   TKeyValueInformationClass = KEY_VALUE_INFORMATION_CLASS;
550 
551   _KEY_VALUE_ENTRY = record
552     ValueName: PUNICODE_STRING;
553     DataLength: ULONG;
554     DataOffset: ULONG;
555     Type_: ULONG;
556   end;
557   KEY_VALUE_ENTRY = _KEY_VALUE_ENTRY;
558   PKEY_VALUE_ENTRY = ^KEY_VALUE_ENTRY;
559   TKeyValueEntry = KEY_VALUE_ENTRY;
560   PKeyValueEntry = ^TKeyValueEntry;
561 
562   {$IFNDEF JWA_INCLUDEMODE}
563   _DEVICE_POWER_STATE = (
564     PowerDeviceUnspecified,
565     PowerDeviceD0,
566     PowerDeviceD1,
567     PowerDeviceD2,
568     PowerDeviceD3,
569     PowerDeviceMaximum);
570 
571   DEVICE_POWER_STATE = _DEVICE_POWER_STATE;
572   PDEVICE_POWER_STATE = ^DEVICE_POWER_STATE;
573   TDevicePowerState = DEVICE_POWER_STATE;
574 
575   POWER_ACTION = (
576     PowerActionNone,
577     PowerActionReserved,
578     PowerActionSleep,
579     PowerActionHibernate,
580     PowerActionShutdown,
581     PowerActionShutdownReset,
582     PowerActionShutdownOff,
583     PowerActionWarmEject);
584   PPOWER_ACTION = ^POWER_ACTION;
585   TPowerAction = POWER_ACTION;
586 
587   _SYSTEM_POWER_STATE = (
588     PowerSystemUnspecified,
589     PowerSystemWorking,
590     PowerSystemSleeping1,
591     PowerSystemSleeping2,
592     PowerSystemSleeping3,
593     PowerSystemHibernate,
594     PowerSystemShutdown,
595     PowerSystemMaximum);
596   SYSTEM_POWER_STATE = _SYSTEM_POWER_STATE;
597   PSYSTEM_POWER_STATE = ^SYSTEM_POWER_STATE;
598   TSystemPowerState = SYSTEM_POWER_STATE;
599 
600   POWER_INFORMATION_LEVEL = (
601     SystemPowerPolicyAc,
602     SystemPowerPolicyDc,
603     VerifySystemPolicyAc,
604     VerifySystemPolicyDc,
605     SystemPowerCapabilities,
606     SystemBatteryState,
607     SystemPowerStateHandler,
608     ProcessorStateHandler,
609     SystemPowerPolicyCurrent,
610     AdministratorPowerPolicy,
611     SystemReserveHiberFile,
612     ProcessorInformation,
613     SystemPowerInformation);
614   TPowerInformationLevel = POWER_INFORMATION_LEVEL;
615   {$ENDIF JWA_INCLUDEMODE}
616 
617   _RTL_RANGE = record
618     // The start of the range
619     Start: ULONGLONG; // Read only
620     // The end of the range
621     End_: ULONGLONG; // Read only
622     // Data the user passed in when they created the range
623     UserData: PVOID; // Read/Write
624     // The owner of the range
625     Owner: PVOID; // Read/Write
626     // User defined flags the user specified when they created the range
627     Attributes: UCHAR; // Read/Write
628     // Flags (RTL_RANGE_*)
629     Flags: UCHAR; // Read only
630   end;
631   RTL_RANGE = _RTL_RANGE;
632   PRTL_RANGE = ^RTL_RANGE;
633   TRtlRange = RTL_RANGE;
634   PRtlRange = ^TRtlRange;
635 
636 const
637   RTL_RANGE_SHARED = $01;
638   RTL_RANGE_CONFLICT = $02;
639 
640 type
641   _RTL_RANGE_LIST = record
642     // The list of ranges
643     ListHead: LIST_ENTRY;
644     // These always come in useful
645     Flags: ULONG; // use RANGE_LIST_FLAG_*
646     // The number of entries in the list
647     Count: ULONG;
648     // Every time an add/delete operation is performed on the list this is
649     // incremented.  It is checked during iteration to ensure that the list
650     // hasn't changed between GetFirst/GetNext or GetNext/GetNext calls
651     Stamp: ULONG;
652   end;
653   RTL_RANGE_LIST = _RTL_RANGE_LIST;
654   PRTL_RANGE_LIST = ^RTL_RANGE_LIST;
655   TRtlRangeList = RTL_RANGE_LIST;
656   PRtlRangeList = ^TRtlRangeList;
657 
658   _RANGE_LIST_ITERATOR = record
659     RangeListHead: PLIST_ENTRY;
660     MergedHead: PLIST_ENTRY;
661     Current: PVOID;
662     Stamp: ULONG;
663   end;
664   RTL_RANGE_LIST_ITERATOR = _RANGE_LIST_ITERATOR;
665   PRTL_RANGE_LIST_ITERATOR = ^RTL_RANGE_LIST_ITERATOR;
666   TRtlRangeListIterator = RTL_RANGE_LIST_ITERATOR;
667   PRtlRangeListIterator = ^TRtlRangeListIterator;
668 
669 // End of NTDDK.H
670 
671 //==============================================================================
672 // NT System Services
673 //==============================================================================
674 
675 type
676   _SYSTEM_INFORMATION_CLASS = (
677     SystemBasicInformation,
678     SystemProcessorInformation,
679     SystemPerformanceInformation,
680     SystemTimeOfDayInformation,
681     SystemNotImplemented1,
682     SystemProcessesAndThreadsInformation,
683     SystemCallCounts,
684     SystemConfigurationInformation,
685     SystemProcessorTimes,
686     SystemGlobalFlag,
687     SystemNotImplemented2,
688     SystemModuleInformation,
689     SystemLockInformation,
690     SystemNotImplemented3,
691     SystemNotImplemented4,
692     SystemNotImplemented5,
693     SystemHandleInformation,
694     SystemObjectInformation,
695     SystemPagefileInformation,
696     SystemInstructionEmulationCounts,
697     SystemInvalidInfoClass1,
698     SystemCacheInformation,
699     SystemPoolTagInformation,
700     SystemProcessorStatistics,
701     SystemDpcInformation,
702     SystemNotImplemented6,
703     SystemLoadImage,
704     SystemUnloadImage,
705     SystemTimeAdjustment,
706     SystemNotImplemented7,
707     SystemNotImplemented8,
708     SystemNotImplemented9,
709     SystemCrashDumpInformation,
710     SystemExceptionInformation,
711     SystemCrashDumpStateInformation,
712     SystemKernelDebuggerInformation,
713     SystemContextSwitchInformation,
714     SystemRegistryQuotaInformation,
715     SystemLoadAndCallImage,
716     SystemPrioritySeparation,
717     SystemNotImplemented10,
718     SystemNotImplemented11,
719     SystemInvalidInfoClass2,
720     SystemInvalidInfoClass3,
721     SystemTimeZoneInformation,
722     SystemLookasideInformation,
723     SystemSetTimeSlipEvent,
724     SystemCreateSession,
725     SystemDeleteSession,
726     SystemInvalidInfoClass4,
727     SystemRangeStartInformation,
728     SystemVerifierInformation,
729     SystemAddVerifier,
730     SystemSessionProcessesInformation);
731   SYSTEM_INFORMATION_CLASS = _SYSTEM_INFORMATION_CLASS;
732   TSystemInformationClass = SYSTEM_INFORMATION_CLASS;
733 
734 type
735   {$IFNDEF JWA_INCLUDEMODE}
736   _SYSTEM_BASIC_INFORMATION = record // Information Class 0
737     Unknown: ULONG;
738     MaximumIncrement: ULONG;
739     PhysicalPageSize: ULONG;
740     NumberOfPhysicalPages: ULONG;
741     LowestPhysicalPage: ULONG;
742     HighestPhysicalPage: ULONG;
743     AllocationGranularity: ULONG;
744     LowestUserAddress: ULONG;
745     HighestUserAddress: ULONG;
746     ActiveProcessors: ULONG;
747     NumberProcessors: UCHAR;
748   end;
749   SYSTEM_BASIC_INFORMATION = _SYSTEM_BASIC_INFORMATION;
750   PSYSTEM_BASIC_INFORMATION = ^SYSTEM_BASIC_INFORMATION;
751   TSystemBasicInformation = SYSTEM_BASIC_INFORMATION;
752   PSystemBasicInformation = ^TSystemBasicInformation;
753   {$ENDIF JWA_INCLUDEMODE}
754 
755   _SYSTEM_PROCESSOR_INFORMATION = record // Information Class 1
756     ProcessorArchitecture: USHORT;
757     ProcessorLevel: USHORT;
758     ProcessorRevision: USHORT;
759     Unknown: USHORT;
760     FeatureBits: ULONG;
761   end;
762   SYSTEM_PROCESSOR_INFORMATION = _SYSTEM_PROCESSOR_INFORMATION;
763   PSYSTEM_PROCESSOR_INFORMATION = ^SYSTEM_PROCESSOR_INFORMATION;
764 
765   {$IFNDEF JWA_INCLUDEMODE}
766   TSystemProcessorInformation = SYSTEM_PROCESSOR_INFORMATION;
767   PSystemProcessorInformation = ^TSystemProcessorInformation;
768 
769   _SYSTEM_PERFORMANCE_INFORMATION = record // Information Class 2
770     IdleTime: LARGE_INTEGER;
771     ReadTransferCount: LARGE_INTEGER;
772     WriteTransferCount: LARGE_INTEGER;
773     OtherTransferCount: LARGE_INTEGER;
774     ReadOperationCount: ULONG;
775     WriteOperationCount: ULONG;
776     OtherOperationCount: ULONG;
777     AvailablePages: ULONG;
778     TotalCommittedPages: ULONG;
779     TotalCommitLimit: ULONG;
780     PeakCommitment: ULONG;
781     PageFaults: ULONG;
782     WriteCopyFaults: ULONG;
783     TransistionFaults: ULONG;
784     Reserved1: ULONG;
785     DemandZeroFaults: ULONG;
786     PagesRead: ULONG;
787     PageReadIos: ULONG;
788     Reserved2: array[0..1] of ULONG;
789     PagefilePagesWritten: ULONG;
790     PagefilePageWriteIos: ULONG;
791     MappedFilePagesWritten: ULONG;
792     MappedFilePageWriteIos: ULONG;
793     PagedPoolUsage: ULONG;
794     NonPagedPoolUsage: ULONG;
795     PagedPoolAllocs: ULONG;
796     PagedPoolFrees: ULONG;
797     NonPagedPoolAllocs: ULONG;
798     NonPagedPoolFrees: ULONG;
799     TotalFreeSystemPtes: ULONG;
800     SystemCodePage: ULONG;
801     TotalSystemDriverPages: ULONG;
802     TotalSystemCodePages: ULONG;
803     SmallNonPagedLookasideListAllocateHits: ULONG;
804     SmallPagedLookasideListAllocateHits: ULONG;
805     Reserved3: ULONG;
806     MmSystemCachePage: ULONG;
807     PagedPoolPage: ULONG;
808     SystemDriverPage: ULONG;
809     FastReadNoWait: ULONG;
810     FastReadWait: ULONG;
811     FastReadResourceMiss: ULONG;
812     FastReadNotPossible: ULONG;
813     FastMdlReadNoWait: ULONG;
814     FastMdlReadWait: ULONG;
815     FastMdlReadResourceMiss: ULONG;
816     FastMdlReadNotPossible: ULONG;
817     MapDataNoWait: ULONG;
818     MapDataWait: ULONG;
819     MapDataNoWaitMiss: ULONG;
820     MapDataWaitMiss: ULONG;
821     PinMappedDataCount: ULONG;
822     PinReadNoWait: ULONG;
823     PinReadWait: ULONG;
824     PinReadNoWaitMiss: ULONG;
825     PinReadWaitMiss: ULONG;
826     CopyReadNoWait: ULONG;
827     CopyReadWait: ULONG;
828     CopyReadNoWaitMiss: ULONG;
829     CopyReadWaitMiss: ULONG;
830     MdlReadNoWait: ULONG;
831     MdlReadWait: ULONG;
832     MdlReadNoWaitMiss: ULONG;
833     MdlReadWaitMiss: ULONG;
834     ReadAheadIos: ULONG;
835     LazyWriteIos: ULONG;
836     LazyWritePages: ULONG;
837     DataFlushes: ULONG;
838     DataPages: ULONG;
839     ContextSwitches: ULONG;
840     FirstLevelTbFills: ULONG;
841     SecondLevelTbFills: ULONG;
842     SystemCalls: ULONG;
843   end;
844   SYSTEM_PERFORMANCE_INFORMATION = _SYSTEM_PERFORMANCE_INFORMATION;
845   PSYSTEM_PERFORMANCE_INFORMATION = ^SYSTEM_PERFORMANCE_INFORMATION;
846   TSystemPerformanceInformation = SYSTEM_PERFORMANCE_INFORMATION;
847   PSystemPerformanceInformation = ^TSystemPerformanceInformation;
848   {$ENDIF JWA_INCLUDEMODE}
849 
850   _SYSTEM_TIME_OF_DAY_INFORMATION = record // Information Class 3
851     BootTime: LARGE_INTEGER;
852     CurrentTime: LARGE_INTEGER;
853     TimeZoneBias: LARGE_INTEGER;
854     CurrentTimeZoneId: ULONG;
855   end;
856   SYSTEM_TIME_OF_DAY_INFORMATION = _SYSTEM_TIME_OF_DAY_INFORMATION;
857   PSYSTEM_TIME_OF_DAY_INFORMATION = ^SYSTEM_TIME_OF_DAY_INFORMATION;
858 
859   {$IFNDEF JWA_INCLUDEMODE}
860   TSystemTimeOfDayInformation = SYSTEM_TIME_OF_DAY_INFORMATION;
861   PSystemTimeOfDayInformation = ^TSystemTimeOfDayInformation;
862   {$ENDIF JWA_INCLUDEMODE}
863 
864   _IO_COUNTERSEX = record
865     ReadOperationCount: LARGE_INTEGER;
866     WriteOperationCount: LARGE_INTEGER;
867     OtherOperationCount: LARGE_INTEGER;
868     ReadTransferCount: LARGE_INTEGER;
869     WriteTransferCount: LARGE_INTEGER;
870     OtherTransferCount: LARGE_INTEGER;
871   end;
872   IO_COUNTERSEX = _IO_COUNTERSEX;
873   PIO_COUNTERSEX = ^IO_COUNTERSEX;
874   TIoCountersEx = IO_COUNTERSEX;
875   PIoCountersEx = ^TIoCountersEx;
876 
877   THREAD_STATE = (
878     StateInitialized,
879     StateReady,
880     StateRunning,
881     StateStandby,
882     StateTerminated,
883     StateWait,
884     StateTransition,
885     StateUnknown);
886   TThreadState = THREAD_STATE;
887 
888   _SYSTEM_THREADS = record
889     KernelTime: LARGE_INTEGER;
890     UserTime: LARGE_INTEGER;
891     CreateTime: LARGE_INTEGER;
892     WaitTime: ULONG;
893     StartAddress: PVOID;
894     ClientId: CLIENT_ID;
895     Priority: KPRIORITY;
896     BasePriority: KPRIORITY;
897     ContextSwitchCount: ULONG;
898     State: THREAD_STATE;
899     WaitReason: KWAIT_REASON;
900   end;
901   SYSTEM_THREADS = _SYSTEM_THREADS;
902   PSYSTEM_THREADS = ^SYSTEM_THREADS;
903   TSystemThreads = SYSTEM_THREADS;
904   PSystemThreads = PSYSTEM_THREADS;
905 
906   _SYSTEM_PROCESSES = record // Information Class 5
907     NextEntryDelta: ULONG;
908     ThreadCount: ULONG;
909     Reserved1: array[0..5] of ULONG;
910     CreateTime: LARGE_INTEGER;
911     UserTime: LARGE_INTEGER;
912     KernelTime: LARGE_INTEGER;
913     ProcessName: UNICODE_STRING;
914     BasePriority: KPRIORITY;
915     ProcessId: ULONG;
916     InheritedFromProcessId: ULONG;
917     HandleCount: ULONG;
918     // next two were Reserved2: array [0..1] of ULONG; thanks to Nico Bendlin
919     SessionId: ULONG;
920     Reserved2: ULONG;
921     VmCounters: VM_COUNTERS;
922     PrivatePageCount: ULONG;
923     IoCounters: IO_COUNTERSEX; // Windows 2000 only
924     Threads: array[0..0] of SYSTEM_THREADS;
925   end;
926   SYSTEM_PROCESSES = _SYSTEM_PROCESSES;
927   PSYSTEM_PROCESSES = ^SYSTEM_PROCESSES;
928   TSystemProcesses = SYSTEM_PROCESSES;
929   PSystemProcesses = PSYSTEM_PROCESSES;
930 
931   _SYSTEM_CALLS_INFORMATION = record // Information Class 6
932     Size: ULONG;
933     NumberOfDescriptorTables: ULONG;
934     NumberOfRoutinesInTable: array[0..0] of ULONG;
935     // ULONG CallCounts[];
936   end;
937   SYSTEM_CALLS_INFORMATION = _SYSTEM_CALLS_INFORMATION;
938   PSYSTEM_CALLS_INFORMATION = ^SYSTEM_CALLS_INFORMATION;
939   TSystemCallsInformation = SYSTEM_CALLS_INFORMATION;
940   PSystemCallsInformation = ^TSystemCallsInformation;
941 
942   _SYSTEM_CONFIGURATION_INFORMATION = record // Information Class 7
943     DiskCount: ULONG;
944     FloppyCount: ULONG;
945     CdRomCount: ULONG;
946     TapeCount: ULONG;
947     SerialCount: ULONG;
948     ParallelCount: ULONG;
949   end;
950   SYSTEM_CONFIGURATION_INFORMATION = _SYSTEM_CONFIGURATION_INFORMATION;
951   PSYSTEM_CONFIGURATION_INFORMATION = ^SYSTEM_CONFIGURATION_INFORMATION;
952   TSystemConfigurationInformation = SYSTEM_CONFIGURATION_INFORMATION;
953   PSystemConfigurationInformation = ^TSystemConfigurationInformation;
954 
955   _SYSTEM_PROCESSOR_TIMES = record // Information Class 8
956     IdleTime: LARGE_INTEGER;
957     KernelTime: LARGE_INTEGER;
958     UserTime: LARGE_INTEGER;
959     DpcTime: LARGE_INTEGER;
960     InterruptTime: LARGE_INTEGER;
961     InterruptCount: ULONG;
962   end;
963   SYSTEM_PROCESSOR_TIMES = _SYSTEM_PROCESSOR_TIMES;
964   PSYSTEM_PROCESSOR_TIMES = ^SYSTEM_PROCESSOR_TIMES;
965   TSystemProcessorTimes = SYSTEM_PROCESSOR_TIMES;
966   PSystemProcessorTimes = ^TSystemProcessorTimes;
967 
968   _SYSTEM_GLOBAL_FLAG = record // Information Class 9
969     GlobalFlag: ULONG;
970   end;
971   SYSTEM_GLOBAL_FLAG = _SYSTEM_GLOBAL_FLAG;
972   PSYSTEM_GLOBAL_FLAG = ^SYSTEM_GLOBAL_FLAG;
973   TSystemGlobalFlag = SYSTEM_GLOBAL_FLAG;
974   PSystemGlobalFlag = ^TSystemGlobalFlag;
975 
976   _SYSTEM_MODULE_INFORMATION = record // Information Class 11
977     Reserved: array[0..1] of ULONG;
978     Base: PVOID;
979     Size: ULONG;
980     Flags: ULONG;
981     Index: USHORT;
982     Unknown: USHORT;
983     LoadCount: USHORT;
984     ModuleNameOffset: USHORT;
985     ImageName: array[0..255] of CHAR;
986   end;
987   SYSTEM_MODULE_INFORMATION = _SYSTEM_MODULE_INFORMATION;
988   PSYSTEM_MODULE_INFORMATION = ^SYSTEM_MODULE_INFORMATION;
989   TSystemModuleInformation = SYSTEM_MODULE_INFORMATION;
990   PSystemModuleInformation = PSYSTEM_MODULE_INFORMATION;
991 
992   _SYSTEM_LOCK_INFORMATION = record // Information Class 12
993     Address: PVOID;
994     Type_: USHORT;
995     Reserved1: USHORT;
996     ExclusiveOwnerThreadId: ULONG;
997     ActiveCount: ULONG;
998     ContentionCount: ULONG;
999     Reserved2: array[0..1] of ULONG;
1000     NumberOfSharedWaiters: ULONG;
1001     NumberOfExclusiveWaiters: ULONG;
1002   end;
1003   SYSTEM_LOCK_INFORMATION = _SYSTEM_LOCK_INFORMATION;
1004   PSYSTEM_LOCK_INFORMATION = ^SYSTEM_LOCK_INFORMATION;
1005   TSystemLockInformation = SYSTEM_LOCK_INFORMATION;
1006   PSystemLockInformation = ^TSystemLockInformation;
1007 
1008   _SYSTEM_HANDLE_INFORMATION = record // Information Class 16
1009     ProcessId: ULONG;
1010     ObjectTypeNumber: UCHAR;
1011     Flags: UCHAR; // 0x01 = PROTECT_FROM_CLOSE, 0x02 = INHERIT
1012     Handle: USHORT;
1013     Object_: PVOID;
1014     GrantedAccess: ACCESS_MASK;
1015   end;
1016   SYSTEM_HANDLE_INFORMATION = _SYSTEM_HANDLE_INFORMATION;
1017   PSYSTEM_HANDLE_INFORMATION = ^SYSTEM_HANDLE_INFORMATION;
1018   TSystemHandleInformation = SYSTEM_HANDLE_INFORMATION;
1019   PSystemHandleInformation = ^TSystemHandleInformation;
1020 
1021   _SYSTEM_OBJECT_TYPE_INFORMATION = record // Information Class 17
1022     NextEntryOffset: ULONG;
1023     ObjectCount: ULONG;
1024     HandleCount: ULONG;
1025     TypeNumber: ULONG;
1026     InvalidAttributes: ULONG;
1027     GenericMapping: GENERIC_MAPPING;
1028     ValidAccessMask: ACCESS_MASK;
1029     PoolType: POOL_TYPE;
1030     Unknown: UCHAR;
1031     Name: UNICODE_STRING;
1032   end;
1033   SYSTEM_OBJECT_TYPE_INFORMATION = _SYSTEM_OBJECT_TYPE_INFORMATION;
1034   PSYSTEM_OBJECT_TYPE_INFORMATION = ^SYSTEM_OBJECT_TYPE_INFORMATION;
1035   TSystemObjectTypeInformation = SYSTEM_OBJECT_TYPE_INFORMATION;
1036   PSystemObjectTypeInformation = ^TSystemObjectTypeInformation;
1037 
1038   _SYSTEM_OBJECT_INFORMATION = record
1039     NextEntryOffset: ULONG;
1040     Object_: PVOID;
1041     CreatorProcessId: ULONG;
1042     Unknown: USHORT;
1043     Flags: USHORT;
1044     PointerCount: ULONG;
1045     HandleCount: ULONG;
1046     PagedPoolUsage: ULONG;
1047     NonPagedPoolUsage: ULONG;
1048     ExclusiveProcessId: ULONG;
1049     SecurityDescriptor: PSECURITY_DESCRIPTOR;
1050     Name: UNICODE_STRING;
1051   end;
1052   SYSTEM_OBJECT_INFORMATION = _SYSTEM_OBJECT_INFORMATION;
1053   PSYSTEM_OBJECT_INFORMATION = ^SYSTEM_OBJECT_INFORMATION;
1054   TSystemObjectInformation = SYSTEM_OBJECT_INFORMATION;
1055   PSystemObjectInformation = ^TSystemObjectInformation;
1056 
1057   _SYSTEM_PAGEFILE_INFORMATION = record // Information Class 18
1058     NextEntryOffset: ULONG;
1059     CurrentSize: ULONG;
1060     TotalUsed: ULONG;
1061     PeakUsed: ULONG;
1062     FileName: UNICODE_STRING;
1063   end;
1064   SYSTEM_PAGEFILE_INFORMATION = _SYSTEM_PAGEFILE_INFORMATION;
1065   PSYSTEM_PAGEFILE_INFORMATION = ^SYSTEM_PAGEFILE_INFORMATION;
1066   TSystemPageFileInformation = SYSTEM_PAGEFILE_INFORMATION;
1067   PSystemPageFileInformation = PSYSTEM_PAGEFILE_INFORMATION;
1068 
1069   _SYSTEM_INSTRUCTION_EMULATION_INFORMATION = record // Info Class 19
1070     GenericInvalidOpcode: ULONG;
1071     TwoByteOpcode: ULONG;
1072     ESprefix: ULONG;
1073     CSprefix: ULONG;
1074     SSprefix: ULONG;
1075     DSprefix: ULONG;
1076     FSPrefix: ULONG;
1077     GSprefix: ULONG;
1078     OPER32prefix: ULONG;
1079     ADDR32prefix: ULONG;
1080     INSB: ULONG;
1081     INSW: ULONG;
1082     OUTSB: ULONG;
1083     OUTSW: ULONG;
1084     PUSHFD: ULONG;
1085     POPFD: ULONG;
1086     INTnn: ULONG;
1087     INTO: ULONG;
1088     IRETD: ULONG;
1089     FloatingPointOpcode: ULONG;
1090     INBimm: ULONG;
1091     INWimm: ULONG;
1092     OUTBimm: ULONG;
1093     OUTWimm: ULONG;
1094     INB: ULONG;
1095     INW: ULONG;
1096     OUTB: ULONG;
1097     OUTW: ULONG;
1098     LOCKprefix: ULONG;
1099     REPNEprefix: ULONG;
1100     REPprefix: ULONG;
1101     CLI: ULONG;
1102     STI: ULONG;
1103     HLT: ULONG;
1104   end;
1105   SYSTEM_INSTRUCTION_EMULATION_INFORMATION = _SYSTEM_INSTRUCTION_EMULATION_INFORMATION;
1106   PSYSTEM_INSTRUCTION_EMULATION_INFORMATION = ^SYSTEM_INSTRUCTION_EMULATION_INFORMATION;
1107   TSystemInstructionEmulationInformation = SYSTEM_INSTRUCTION_EMULATION_INFORMATION;
1108   PSystemInstructionEmulationInformation = ^TSystemInstructionEmulationInformation;
1109 
1110   _SYSTEM_CACHE_INFORMATION = record // Information Class 21
1111     SystemCacheWsSize: ULONG;
1112     SystemCacheWsPeakSize: ULONG;
1113     SystemCacheWsFaults: ULONG;
1114     SystemCacheWsMinimum: ULONG;
1115     SystemCacheWsMaximum: ULONG;
1116     TransitionSharedPages: ULONG;
1117     TransitionSharedPagesPeak: ULONG;
1118     Reserved: array[0..1] of ULONG;
1119   end;
1120   SYSTEM_CACHE_INFORMATION = _SYSTEM_CACHE_INFORMATION;
1121   PSYSTEM_CACHE_INFORMATION = ^SYSTEM_CACHE_INFORMATION;
1122   TSystemCacheInformation = SYSTEM_CACHE_INFORMATION;
1123   PSystemCacheInformation = ^TSystemCacheInformation;
1124 
1125   _SYSTEM_POOL_TAG_INFORMATION = record // Information Class 22
1126     Tag: array[0..3] of CHAR;
1127     PagedPoolAllocs: ULONG;
1128     PagedPoolFrees: ULONG;
1129     PagedPoolUsage: ULONG;
1130     NonPagedPoolAllocs: ULONG;
1131     NonPagedPoolFrees: ULONG;
1132     NonPagedPoolUsage: ULONG;
1133   end;
1134   SYSTEM_POOL_TAG_INFORMATION = _SYSTEM_POOL_TAG_INFORMATION;
1135   PSYSTEM_POOL_TAG_INFORMATION = ^SYSTEM_POOL_TAG_INFORMATION;
1136   TSystemPoolTagInformation = SYSTEM_POOL_TAG_INFORMATION;
1137   PSystemPoolTagInformation = ^TSystemPoolTagInformation;
1138 
1139   _SYSTEM_PROCESSOR_STATISTICS = record // Information Class 23
1140     ContextSwitches: ULONG;
1141     DpcCount: ULONG;
1142     DpcRequestRate: ULONG;
1143     TimeIncrement: ULONG;
1144     DpcBypassCount: ULONG;
1145     ApcBypassCount: ULONG;
1146   end;
1147   SYSTEM_PROCESSOR_STATISTICS = _SYSTEM_PROCESSOR_STATISTICS;
1148   PSYSTEM_PROCESSOR_STATISTICS = ^SYSTEM_PROCESSOR_STATISTICS;
1149   TSystemProcessorStatistics = SYSTEM_PROCESSOR_STATISTICS;
1150   PSystemProcessorStatistics = ^TSystemProcessorStatistics;
1151 
1152   _SYSTEM_DPC_INFORMATION = record // Information Class 24
1153     Reserved: ULONG;
1154     MaximumDpcQueueDepth: ULONG;
1155     MinimumDpcRate: ULONG;
1156     AdjustDpcThreshold: ULONG;
1157     IdealDpcRate: ULONG;
1158   end;
1159   SYSTEM_DPC_INFORMATION = _SYSTEM_DPC_INFORMATION;
1160   PSYSTEM_DPC_INFORMATION = ^SYSTEM_DPC_INFORMATION;
1161   TSystemDpcInformation = SYSTEM_DPC_INFORMATION;
1162   PSystemDpcInformation = ^TSystemDpcInformation;
1163 
1164   _SYSTEM_LOAD_IMAGE = record // Information Class 26
1165     ModuleName: UNICODE_STRING;
1166     ModuleBase: PVOID;
1167     Unknown: PVOID;
1168     EntryPoint: PVOID;
1169     ExportDirectory: PVOID;
1170   end;
1171   SYSTEM_LOAD_IMAGE = _SYSTEM_LOAD_IMAGE;
1172   PSYSTEM_LOAD_IMAGE = ^SYSTEM_LOAD_IMAGE;
1173   TSystemLoadImage = SYSTEM_LOAD_IMAGE;
1174   PSystemLoadImage = ^TSystemLoadImage;
1175 
1176   _SYSTEM_UNLOAD_IMAGE = record // Information Class 27
1177     ModuleBase: PVOID;
1178   end;
1179   SYSTEM_UNLOAD_IMAGE = _SYSTEM_UNLOAD_IMAGE;
1180   PSYSTEM_UNLOAD_IMAGE = ^SYSTEM_UNLOAD_IMAGE;
1181   TSystemUnloadImage = SYSTEM_UNLOAD_IMAGE;
1182   PSystemUnloadImage = ^TSystemUnloadImage;
1183 
1184   _SYSTEM_QUERY_TIME_ADJUSTMENT = record // Information Class 28
1185     TimeAdjustment: ULONG;
1186     MaximumIncrement: ULONG;
1187     TimeSynchronization: ByteBool;
1188   end;
1189   SYSTEM_QUERY_TIME_ADJUSTMENT = _SYSTEM_QUERY_TIME_ADJUSTMENT;
1190   PSYSTEM_QUERY_TIME_ADJUSTMENT = ^SYSTEM_QUERY_TIME_ADJUSTMENT;
1191   TSystemQueryTimeAdjustment = SYSTEM_QUERY_TIME_ADJUSTMENT;
1192   PSystemQueryTimeAdjustment = ^TSystemQueryTimeAdjustment;
1193 
1194   _SYSTEM_SET_TIME_ADJUSTMENT = record // Information Class 28
1195     TimeAdjustment: ULONG;
1196     TimeSynchronization: ByteBool;
1197   end;
1198   SYSTEM_SET_TIME_ADJUSTMENT = _SYSTEM_SET_TIME_ADJUSTMENT;
1199   PSYSTEM_SET_TIME_ADJUSTMENT = ^SYSTEM_SET_TIME_ADJUSTMENT;
1200   TSystemSetTimeAdjustment = SYSTEM_SET_TIME_ADJUSTMENT;
1201   PSystemSetTimeAdjustment = ^TSystemSetTimeAdjustment;
1202 
1203   _SYSTEM_CRASH_DUMP_INFORMATION = record // Information Class 32
1204     CrashDumpSectionHandle: HANDLE;
1205     Unknown: HANDLE; // Windows 2000 only
1206   end;
1207   SYSTEM_CRASH_DUMP_INFORMATION = _SYSTEM_CRASH_DUMP_INFORMATION;
1208   PSYSTEM_CRASH_DUMP_INFORMATION = ^SYSTEM_CRASH_DUMP_INFORMATION;
1209   TSystemCrashDumpInformation = SYSTEM_CRASH_DUMP_INFORMATION;
1210   PSystemCrashDumpInformation = ^TSystemCrashDumpInformation;
1211 
1212   {$IFNDEF JWA_INCLUDEMODE}
1213   _SYSTEM_EXCEPTION_INFORMATION = record // Information Class 33
1214     AlignmentFixupCount: ULONG;
1215     ExceptionDispatchCount: ULONG;
1216     FloatingEmulationCount: ULONG;
1217     Reserved: ULONG;
1218   end;
1219   SYSTEM_EXCEPTION_INFORMATION = _SYSTEM_EXCEPTION_INFORMATION;
1220   PSYSTEM_EXCEPTION_INFORMATION = ^SYSTEM_EXCEPTION_INFORMATION;
1221   TSystemExceptionInformation = SYSTEM_EXCEPTION_INFORMATION;
1222   PSystemExceptionInformation = ^TSystemExceptionInformation;
1223   {$ENDIF JWA_INCLUDEMODE}
1224 
1225   _SYSTEM_CRASH_STATE_INFORMATION = record // Information Class 34
1226     ValidCrashDump: ULONG;
1227     Unknown: ULONG; // Windows 2000 only
1228   end;
1229   SYSTEM_CRASH_STATE_INFORMATION = _SYSTEM_CRASH_STATE_INFORMATION;
1230   PSYSTEM_CRASH_STATE_INFORMATION = ^SYSTEM_CRASH_STATE_INFORMATION;
1231   TSystemCrashStateInformation = SYSTEM_CRASH_STATE_INFORMATION;
1232   PSystemCrashStateInformation = ^TSystemCrashStateInformation;
1233 
1234   _SYSTEM_KERNEL_DEBUGGER_INFORMATION = record // Information Class 35
1235     DebuggerEnabled: ByteBool;
1236     DebuggerNotPresent: ByteBool;
1237   end;
1238   SYSTEM_KERNEL_DEBUGGER_INFORMATION = _SYSTEM_KERNEL_DEBUGGER_INFORMATION;
1239   PSYSTEM_KERNEL_DEBUGGER_INFORMATION = ^SYSTEM_KERNEL_DEBUGGER_INFORMATION;
1240   TSystemKernelDebuggerInformation = SYSTEM_KERNEL_DEBUGGER_INFORMATION;
1241   PSystemKernelDebuggerInformation = ^TSystemKernelDebuggerInformation;
1242 
1243   _SYSTEM_CONTEXT_SWITCH_INFORMATION = record // Information Class 36
1244     ContextSwitches: ULONG;
1245     ContextSwitchCounters: array[0..10] of ULONG;
1246   end;
1247   SYSTEM_CONTEXT_SWITCH_INFORMATION = _SYSTEM_CONTEXT_SWITCH_INFORMATION;
1248   PSYSTEM_CONTEXT_SWITCH_INFORMATION = ^SYSTEM_CONTEXT_SWITCH_INFORMATION;
1249   TSystemContextSwitchInformation = SYSTEM_CONTEXT_SWITCH_INFORMATION;
1250   PSystemContextSwitchInformation = ^TSystemContextSwitchInformation;
1251 
1252   {$IFNDEF JWA_INCLUDEMODE}
1253   _SYSTEM_REGISTRY_QUOTA_INFORMATION = record // Information Class 37
1254     RegistryQuota: ULONG;
1255     RegistryQuotaInUse: ULONG;
1256     PagedPoolSize: ULONG;
1257   end;
1258   SYSTEM_REGISTRY_QUOTA_INFORMATION = _SYSTEM_REGISTRY_QUOTA_INFORMATION;
1259   PSYSTEM_REGISTRY_QUOTA_INFORMATION = ^SYSTEM_REGISTRY_QUOTA_INFORMATION;
1260   TSystemRegistryQuotaInformation = SYSTEM_REGISTRY_QUOTA_INFORMATION;
1261   PSystemRegistryQuotaInformation = ^TSystemRegistryQuotaInformation;
1262   {$ENDIF JWA_INCLUDEMODE}
1263 
1264   _SYSTEM_LOAD_AND_CALL_IMAGE = record // Information Class 38
1265     ModuleName: UNICODE_STRING;
1266   end;
1267   SYSTEM_LOAD_AND_CALL_IMAGE = _SYSTEM_LOAD_AND_CALL_IMAGE;
1268   PSYSTEM_LOAD_AND_CALL_IMAGE = ^SYSTEM_LOAD_AND_CALL_IMAGE;
1269   TSystemLoadAndCallImage = SYSTEM_LOAD_AND_CALL_IMAGE;
1270   PSystemLoadAndCallImage = ^TSystemLoadAndCallImage;
1271 
1272   _SYSTEM_PRIORITY_SEPARATION = record // Information Class 39
1273     PrioritySeparation: ULONG;
1274   end;
1275   SYSTEM_PRIORITY_SEPARATION = _SYSTEM_PRIORITY_SEPARATION;
1276   PSYSTEM_PRIORITY_SEPARATION = ^SYSTEM_PRIORITY_SEPARATION;
1277   TSystemPrioritySeparation = SYSTEM_PRIORITY_SEPARATION;
1278   PSystemPrioritySeparation = ^TSystemPrioritySeparation;
1279 
1280   _SYSTEM_TIME_ZONE_INFORMATION = record // Information Class 44
1281     Bias: LONG;
1282     StandardName: array[0..31] of WCHAR;
1283     StandardDate: SYSTEMTIME;
1284     StandardBias: LONG;
1285     DaylightName: array[0..31] of WCHAR;
1286     DaylightDate: SYSTEMTIME;
1287     DaylightBias: LONG;
1288   end;
1289   SYSTEM_TIME_ZONE_INFORMATION = _SYSTEM_TIME_ZONE_INFORMATION;
1290   PSYSTEM_TIME_ZONE_INFORMATION = ^SYSTEM_TIME_ZONE_INFORMATION;
1291   TSystemTimeZoneInformation = SYSTEM_TIME_ZONE_INFORMATION;
1292   PSystemTimeZoneInformation = ^TSystemTimeZoneInformation;
1293 
1294   {$IFNDEF JWA_INCLUDEMODE}
1295   _SYSTEM_LOOKASIDE_INFORMATION = record // Information Class 45
1296     Depth: USHORT;
1297     MaximumDepth: USHORT;
1298     TotalAllocates: ULONG;
1299     AllocateMisses: ULONG;
1300     TotalFrees: ULONG;
1301     FreeMisses: ULONG;
1302     Type_: POOL_TYPE;
1303     Tag: ULONG;
1304     Size: ULONG;
1305   end;
1306   SYSTEM_LOOKASIDE_INFORMATION = _SYSTEM_LOOKASIDE_INFORMATION;
1307   PSYSTEM_LOOKASIDE_INFORMATION = ^SYSTEM_LOOKASIDE_INFORMATION;
1308   TSystemLookAsideInformation = SYSTEM_LOOKASIDE_INFORMATION;
1309   PSystemLookAsideInformation = ^TSystemLookAsideInformation;
1310   {$ENDIF JWA_INCLUDEMODE}
1311 
1312   _SYSTEM_SET_TIME_SLIP_EVENT = record // Information Class 46
1313     TimeSlipEvent: HANDLE;
1314   end;
1315   SYSTEM_SET_TIME_SLIP_EVENT = _SYSTEM_SET_TIME_SLIP_EVENT;
1316   PSYSTEM_SET_TIME_SLIP_EVENT = ^SYSTEM_SET_TIME_SLIP_EVENT;
1317   TSystemSetTimeSlipEvent = SYSTEM_SET_TIME_SLIP_EVENT;
1318   PSystemSetTimeSlipEvent = ^TSystemSetTimeSlipEvent;
1319 
1320   _SYSTEM_CREATE_SESSION = record // Information Class 47
1321     Session: ULONG;
1322   end;
1323   SYSTEM_CREATE_SESSION = _SYSTEM_CREATE_SESSION;
1324   PSYSTEM_CREATE_SESSION = ^SYSTEM_CREATE_SESSION;
1325   TSystemCreateSession = SYSTEM_CREATE_SESSION;
1326   PSystemCreateSession = ^TSystemCreateSession;
1327 
1328   _SYSTEM_DELETE_SESSION = record // Information Class 48
1329     Session: ULONG;
1330   end;
1331   SYSTEM_DELETE_SESSION = _SYSTEM_DELETE_SESSION;
1332   PSYSTEM_DELETE_SESSION = ^SYSTEM_DELETE_SESSION;
1333   TSystemDeleteSession = SYSTEM_DELETE_SESSION;
1334   PSystemDeleteSession = ^TSystemDeleteSession;
1335 
1336   _SYSTEM_RANGE_START_INFORMATION = record // Information Class 50
1337     SystemRangeStart: PVOID;
1338   end;
1339   SYSTEM_RANGE_START_INFORMATION = _SYSTEM_RANGE_START_INFORMATION;
1340   PSYSTEM_RANGE_START_INFORMATION = ^SYSTEM_RANGE_START_INFORMATION;
1341   TSystemRangeStartInformation = SYSTEM_RANGE_START_INFORMATION;
1342   PSystemRangeStartInformation = ^TSystemRangeStartInformation;
1343 
1344   _SYSTEM_POOL_BLOCK = record
1345     Allocated: ByteBool;
1346     Unknown: USHORT;
1347     Size: ULONG;
1348     Tag: array[0..3] of CHAR;
1349   end;
1350   SYSTEM_POOL_BLOCK = _SYSTEM_POOL_BLOCK;
1351   PSYSTEM_POOL_BLOCK = ^SYSTEM_POOL_BLOCK;
1352   TSystemPoolBlock = SYSTEM_POOL_BLOCK;
1353   PSystemPoolBlock = ^TSystemPoolBlock;
1354 
1355   _SYSTEM_POOL_BLOCKS_INFORMATION = record // Info Classes 14 and 15
1356     PoolSize: ULONG;
1357     PoolBase: PVOID;
1358     Unknown: USHORT;
1359     NumberOfBlocks: ULONG;
1360     PoolBlocks: array[0..0] of SYSTEM_POOL_BLOCK;
1361   end;
1362   SYSTEM_POOL_BLOCKS_INFORMATION = _SYSTEM_POOL_BLOCKS_INFORMATION;
1363   PSYSTEM_POOL_BLOCKS_INFORMATION = ^SYSTEM_POOL_BLOCKS_INFORMATION;
1364   TSystemPoolBlocksInformation = SYSTEM_POOL_BLOCKS_INFORMATION;
1365   PSystemPoolBlocksInformation = ^TSystemPoolBlocksInformation;
1366 
1367   _SYSTEM_MEMORY_USAGE = record
1368     Name: PVOID;
1369     Valid: USHORT;
1370     Standby: USHORT;
1371     Modified: USHORT;
1372     PageTables: USHORT;
1373   end;
1374   SYSTEM_MEMORY_USAGE = _SYSTEM_MEMORY_USAGE;
1375   PSYSTEM_MEMORY_USAGE = ^SYSTEM_MEMORY_USAGE;
1376   TSystemMemoryUsage = SYSTEM_MEMORY_USAGE;
1377   PSystemMemoryUsage = ^TSystemMemoryUsage;
1378 
1379   _SYSTEM_MEMORY_USAGE_INFORMATION = record // Info Classes 25 and 29
1380     Reserved: ULONG;
1381     EndOfData: PVOID;
1382     MemoryUsage: array[0..0] of SYSTEM_MEMORY_USAGE;
1383   end;
1384   SYSTEM_MEMORY_USAGE_INFORMATION = _SYSTEM_MEMORY_USAGE_INFORMATION;
1385   PSYSTEM_MEMORY_USAGE_INFORMATION = ^SYSTEM_MEMORY_USAGE_INFORMATION;
1386   TSystemMemoryUsageInformation = SYSTEM_MEMORY_USAGE_INFORMATION;
1387   PSystemMemoryUsageInformation = ^TSystemMemoryUsageInformation;
1388 
1389 type
1390   _SHUTDOWN_ACTION = (
1391     ShutdownNoReboot,
1392     ShutdownReboot,
1393     ShutdownPowerOff);
1394   SHUTDOWN_ACTION = _SHUTDOWN_ACTION;
1395   TShutdownAction = SHUTDOWN_ACTION;
1396 
1397 type
1398   _DEBUG_CONTROL_CODE = (
1399     DebugFiller0,
1400     DebugGetTraceInformation,
1401     DebugSetInternalBreakpoint,
1402     DebugSetSpecialCall,
1403     DebugClearSpecialCalls,
1404     DebugQuerySpecialCalls,
1405     DebugDbgBreakPoint);
1406   DEBUG_CONTROL_CODE = _DEBUG_CONTROL_CODE;
1407   TDebugControlCode = DEBUG_CONTROL_CODE;
1408 
1409 type
1410   _OBJECT_INFORMATION_CLASS = (
1411     ObjectBasicInformation,
1412     ObjectNameInformation,
1413     ObjectTypeInformation,
1414     ObjectAllTypesInformation,
1415     ObjectHandleInformation);
1416   OBJECT_INFORMATION_CLASS = _OBJECT_INFORMATION_CLASS;
1417   TObjectInformationClass = OBJECT_INFORMATION_CLASS;
1418 
1419 type
1420   _OBJECT_BASIC_INFORMATION = record // Information Class 0
1421     Attributes: ULONG;
1422     GrantedAccess: ACCESS_MASK;
1423     HandleCount: ULONG;
1424     PointerCount: ULONG;
1425     PagedPoolUsage: ULONG;
1426     NonPagedPoolUsage: ULONG;
1427     Reserved: array[0..2] of ULONG;
1428     NameInformationLength: ULONG;
1429     TypeInformationLength: ULONG;
1430     SecurityDescriptorLength: ULONG;
1431     CreateTime: LARGE_INTEGER;
1432   end;
1433   OBJECT_BASIC_INFORMATION = _OBJECT_BASIC_INFORMATION;
1434   POBJECT_BASIC_INFORMATION = ^OBJECT_BASIC_INFORMATION;
1435   TObjectBasicInformation = OBJECT_BASIC_INFORMATION;
1436   PObjectBasicInformation = ^TObjectBasicInformation;
1437 
1438   _OBJECT_TYPE_INFORMATION = record // Information Class 2
1439     Name: UNICODE_STRING;
1440     ObjectCount: ULONG;
1441     HandleCount: ULONG;
1442     Reserved1: array[0..3] of ULONG;
1443     PeakObjectCount: ULONG;
1444     PeakHandleCount: ULONG;
1445     Reserved2: array[0..3] of ULONG;
1446     InvalidAttributes: ULONG;
1447     GenericMapping: GENERIC_MAPPING;
1448     ValidAccess: ULONG;
1449     Unknown: UCHAR;
1450     MaintainHandleDatabase: ByteBool;
1451     Reserved3: array[0..1] of UCHAR;
1452     PoolType: POOL_TYPE;
1453     PagedPoolUsage: ULONG;
1454     NonPagedPoolUsage: ULONG;
1455   end;
1456   OBJECT_TYPE_INFORMATION = _OBJECT_TYPE_INFORMATION;
1457   POBJECT_TYPE_INFORMATION = ^OBJECT_TYPE_INFORMATION;
1458   TObjectTypeInformation = OBJECT_TYPE_INFORMATION;
1459   PObjectTypeInformation = ^TObjectTypeInformation;
1460 
1461   _OBJECT_ALL_TYPES_INFORMATION = record // Information Class 3
1462     NumberOfTypes: ULONG;
1463     TypeInformation: OBJECT_TYPE_INFORMATION;
1464   end;
1465   OBJECT_ALL_TYPES_INFORMATION = _OBJECT_ALL_TYPES_INFORMATION;
1466   POBJECT_ALL_TYPES_INFORMATION = ^OBJECT_ALL_TYPES_INFORMATION;
1467   TObjectAllTypesInformation = OBJECT_ALL_TYPES_INFORMATION;
1468   PObjectAllTypesInformation = ^TObjectAllTypesInformation;
1469 
1470   _OBJECT_HANDLE_ATTRIBUTE_INFORMATION = record // Information Class 4
1471     Inherit: ByteBool;
1472     ProtectFromClose: ByteBool;
1473   end;
1474   OBJECT_HANDLE_ATTRIBUTE_INFORMATION = _OBJECT_HANDLE_ATTRIBUTE_INFORMATION;
1475   POBJECT_HANDLE_ATTRIBUTE_INFORMATION = ^OBJECT_HANDLE_ATTRIBUTE_INFORMATION;
1476   TObjectHandleAttributeInformation = OBJECT_HANDLE_ATTRIBUTE_INFORMATION;
1477   PObjectHandleAttributeInformation = ^TObjectHandleAttributeInformation;
1478 
1479 type
1480   _DIRECTORY_BASIC_INFORMATION = record
1481     ObjectName: UNICODE_STRING;
1482     ObjectTypeName: UNICODE_STRING;
1483   end;
1484   DIRECTORY_BASIC_INFORMATION = _DIRECTORY_BASIC_INFORMATION;
1485   PDIRECTORY_BASIC_INFORMATION = ^DIRECTORY_BASIC_INFORMATION;
1486   TDirectoryBasicInformation = DIRECTORY_BASIC_INFORMATION;
1487   PDirectoryBasicInformation = ^TDirectoryBasicInformation;
1488 
1489 type
1490   _MEMORY_INFORMATION_CLASS = (
1491     MemoryBasicInformation,
1492     MemoryWorkingSetList,
1493     MemorySectionName,
1494     MemoryBasicVlmInformation);
1495   MEMORY_INFORMATION_CLASS = _MEMORY_INFORMATION_CLASS;
1496   TMemoryInformationClass = MEMORY_INFORMATION_CLASS;
1497   PMemoryInformationClass = ^TMemoryInformationClass;
1498 
1499 type
1500   {$IFNDEF JWA_INCLUDEMODE}
1501   _MEMORY_BASIC_INFORMATION = record // Information Class 0
1502     BaseAddress: PVOID;
1503     AllocationBase: PVOID;
1504     AllocationProtect: ULONG;
1505     RegionSize: ULONG;
1506     State: ULONG;
1507     Protect: ULONG;
1508     Type_: ULONG;
1509   end;
1510   MEMORY_BASIC_INFORMATION = _MEMORY_BASIC_INFORMATION;
1511   PMEMORY_BASIC_INFORMATION = ^MEMORY_BASIC_INFORMATION;
1512   TMemoryBasicInformation = MEMORY_BASIC_INFORMATION;
1513   PMemoryBasicInformation = ^TMemoryBasicInformation;
1514   {$ENDIF JWA_INCLUDEMODE}
1515 
1516   _MEMORY_WORKING_SET_LIST = record // Information Class 1
1517     NumberOfPages: ULONG;
1518     WorkingSetList: array[0..0] of ULONG;
1519   end;
1520   MEMORY_WORKING_SET_LIST = _MEMORY_WORKING_SET_LIST;
1521   PMEMORY_WORKING_SET_LIST = ^MEMORY_WORKING_SET_LIST;
1522   TMemoryWorkingSetList = MEMORY_WORKING_SET_LIST;
1523   PMemoryWorkingSetList = ^TMemoryWorkingSetList;
1524 
1525   _MEMORY_SECTION_NAME = record // Information Class 2
1526     SectionFileName: UNICODE_STRING;
1527   end;
1528   MEMORY_SECTION_NAME = _MEMORY_SECTION_NAME;
1529   PMEMORY_SECTION_NAME = ^MEMORY_SECTION_NAME;
1530   TMemorySectionName = MEMORY_SECTION_NAME;
1531   PMemorySectionName = ^TMemorySectionName;
1532 
1533 type
1534   _SECTION_INFORMATION_CLASS = (
1535     SectionBasicInformation,
1536     SectionImageInformation);
1537   SECTION_INFORMATION_CLASS = _SECTION_INFORMATION_CLASS;
1538   TSectionInformationClass = SECTION_INFORMATION_CLASS;
1539 
1540 type
1541   _SECTION_BASIC_INFORMATION = record // Information Class 0
1542     BaseAddress: PVOID;
1543     Attributes: ULONG;
1544     Size: LARGE_INTEGER;
1545   end;
1546   SECTION_BASIC_INFORMATION = _SECTION_BASIC_INFORMATION;
1547   PSECTION_BASIC_INFORMATION = ^SECTION_BASIC_INFORMATION;
1548   TSectionBasicInformation = SECTION_BASIC_INFORMATION;
1549   PSectionBasicInformation = ^TSectionBasicInformation;
1550 
1551   _SECTION_IMAGE_INFORMATION = record // Information Class 1
1552     EntryPoint: PVOID;
1553     Unknown1: ULONG;
1554     StackReserve: ULONG;
1555     StackCommit: ULONG;
1556     Subsystem: ULONG;
1557     MinorSubsystemVersion: USHORT;
1558     MajorSubsystemVersion: USHORT;
1559     Unknown2: ULONG;
1560     Characteristics: ULONG;
1561     ImageNumber: USHORT;
1562     Executable: ByteBool;
1563     Unknown3: UCHAR;
1564     Unknown4: array[0..2] of ULONG;
1565   end;
1566   SECTION_IMAGE_INFORMATION = _SECTION_IMAGE_INFORMATION;
1567   PSECTION_IMAGE_INFORMATION = ^SECTION_IMAGE_INFORMATION;
1568   TSectionImageInformation = SECTION_IMAGE_INFORMATION;
1569   PSectionImageInformation = TSectionImageInformation;
1570 
1571 type
1572   _USER_STACK = record
1573     FixedStackBase: PVOID;
1574     FixedStackLimit: PVOID;
1575     ExpandableStackBase: PVOID;
1576     ExpandableStackLimit: PVOID;
1577     ExpandableStackBottom: PVOID;
1578   end;
1579   USER_STACK = _USER_STACK;
1580   PUSER_STACK = ^USER_STACK;
1581   TUserStack = USER_STACK;
1582   PUserStack = ^TUserStack;
1583 
1584 type
1585   _THREAD_BASIC_INFORMATION = record // Information Class 0
1586     ExitStatus: NTSTATUS;
1587     TebBaseAddress: PNT_TIB;
1588     ClientId: CLIENT_ID;
1589     AffinityMask: KAFFINITY;
1590     Priority: KPRIORITY;
1591     BasePriority: KPRIORITY;
1592   end;
1593   THREAD_BASIC_INFORMATION = _THREAD_BASIC_INFORMATION;
1594   PTHREAD_BASIC_INFORMATION = ^THREAD_BASIC_INFORMATION;
1595   TThreadBasicInformation = THREAD_BASIC_INFORMATION;
1596   PThreadBasicInformation = ^TThreadBasicInformation;
1597 
1598 type
1599   _PROCESS_PRIORITY_CLASS = record // Information Class 18
1600     Foreground: ByteBool;
1601     PriorityClass: UCHAR;
1602   end;
1603   PROCESS_PRIORITY_CLASS = _PROCESS_PRIORITY_CLASS;
1604   PPROCESS_PRIORITY_CLASS = ^PROCESS_PRIORITY_CLASS;
1605   TProcessPriorityClass = PROCESS_PRIORITY_CLASS;
1606   PProcessPriorityClass = ^TProcessPriorityClass;
1607 
1608   _RTL_PROCESS_INFORMATION = record
1609     Size: ULONG;
1610     hProcess: HANDLE;
1611     hThread: HANDLE;
1612     ClientId: CLIENT_ID;
1613     ImageInfo: SECTION_IMAGE_INFORMATION;
1614   end;
1615   RTL_PROCESS_INFORMATION = _RTL_PROCESS_INFORMATION;
1616   PRTL_PROCESS_INFORMATION = ^RTL_PROCESS_INFORMATION;
1617   TRtlProcessInformation = RTL_PROCESS_INFORMATION;
1618   PRtlProcessInformation = ^RTL_PROCESS_INFORMATION;
1619 
1620 type
1621   _DEBUG_BUFFER = record
1622     SectionHandle: HANDLE;
1623     SectionBase: PVOID;
1624     RemoteSectionBase: PVOID;
1625     SectionBaseDelta: ULONG;
1626     EventPairHandle: HANDLE;
1627     Unknown: array[0..1] of ULONG;
1628     RemoteThreadHandle: HANDLE;
1629     InfoClassMask: ULONG;
1630     SizeOfInfo: ULONG;
1631     AllocatedSize: ULONG;
1632     SectionSize: ULONG;
1633     ModuleInformation: PVOID;
1634     BackTraceInformation: PVOID;
1635     HeapInformation: PVOID;
1636     LockInformation: PVOID;
1637     Reserved: array[0..7] of PVOID;
1638   end;
1639   DEBUG_BUFFER = _DEBUG_BUFFER;
1640   PDEBUG_BUFFER = ^DEBUG_BUFFER;
1641   TDebugBuffer = DEBUG_BUFFER;
1642   PDebugBuffer = ^TDebugBuffer;
1643 
1644 const
1645   PDI_MODULES = $01;
1646   PDI_BACKTRACE = $02;
1647   PDI_HEAPS = $04;
1648   PDI_HEAP_TAGS = $08;
1649   PDI_HEAP_BLOCKS = $10;
1650   PDI_LOCKS = $20;
1651 
1652 type
1653   _DEBUG_MODULE_INFORMATION = record // c.f. SYSTEM_MODULE_INFORMATION
1654     Reserved: array[0..1] of ULONG;
1655     Base: ULONG;
1656     Size: ULONG;
1657     Flags: ULONG;
1658     Index: USHORT;
1659     Unknown: USHORT;
1660     LoadCount: USHORT;
1661     ModuleNameOffset: USHORT;
1662     ImageName: array[0..255] of CHAR;
1663   end;
1664   DEBUG_MODULE_INFORMATION = _DEBUG_MODULE_INFORMATION;
1665   PDEBUG_MODULE_INFORMATION = ^DEBUG_MODULE_INFORMATION;
1666   TDebugModuleInformation = DEBUG_MODULE_INFORMATION;
1667   PDebugModuleInformation = ^TDebugModuleInformation;
1668 
1669   _DEBUG_HEAP_INFORMATION = record
1670     Base: ULONG;
1671     Flags: ULONG;
1672     Granularity: USHORT;
1673     Unknown: USHORT;
1674     Allocated: ULONG;
1675     Committed: ULONG;
1676     TagCount: ULONG;
1677     BlockCount: ULONG;
1678     Reserved: array[0..6] of ULONG;
1679     Tags: PVOID;
1680     Blocks: PVOID;
1681   end;
1682   DEBUG_HEAP_INFORMATION = _DEBUG_HEAP_INFORMATION;
1683   PDEBUG_HEAP_INFORMATION = ^DEBUG_HEAP_INFORMATION;
1684   TDebugHeapInformation = DEBUG_HEAP_INFORMATION;
1685   PDebugHeapInformation = ^TDebugHeapInformation;
1686 
1687   _DEBUG_LOCK_INFORMATION = record // c.f. SYSTEM_LOCK_INFORMATION
1688     Address: PVOID;
1689     Type_: USHORT;
1690     CreatorBackTraceIndex: USHORT;
1691     OwnerThreadId: ULONG;
1692     ActiveCount: ULONG;
1693     ContentionCount: ULONG;
1694     EntryCount: ULONG;
1695     RecursionCount: ULONG;
1696     NumberOfSharedWaiters: ULONG;
1697     NumberOfExclusiveWaiters: ULONG;
1698   end;
1699   DEBUG_LOCK_INFORMATION = _DEBUG_LOCK_INFORMATION;
1700   PDEBUG_LOCK_INFORMATION = ^DEBUG_LOCK_INFORMATION;
1701   TDebugLockInformation = DEBUG_LOCK_INFORMATION;
1702   PDebugLockInformation = ^TDebugLockInformation;
1703 
1704 type
1705   PTIMER_APC_ROUTINE = procedure(TimerContext: PVOID; TimerLowValue: ULONG; TimerHighValue: LONG); stdcall;
1706 
1707 type
1708   _TIMER_INFORMATION_CLASS = (TimerBasicInformation);
1709   TIMER_INFORMATION_CLASS = _TIMER_INFORMATION_CLASS;
1710   TTimerInformationClass = TIMER_INFORMATION_CLASS;
1711 
1712 type
1713   _TIMER_BASIC_INFORMATION = record
1714     TimeRemaining: LARGE_INTEGER;
1715     SignalState: ByteBool;
1716   end;
1717   TIMER_BASIC_INFORMATION = _TIMER_BASIC_INFORMATION;
1718   PTIMER_BASIC_INFORMATION = ^TIMER_BASIC_INFORMATION;
1719   TTimerBasicInformation = TIMER_BASIC_INFORMATION;
1720   PTimerBasicInformation = ^TTimerBasicInformation;
1721 
1722 type
1723   _EVENT_INFORMATION_CLASS = (EventBasicInformation);
1724   EVENT_INFORMATION_CLASS = _EVENT_INFORMATION_CLASS;
1725   TEventInformationClass = EVENT_INFORMATION_CLASS;
1726 
1727 type
1728   _EVENT_BASIC_INFORMATION = record
1729     EventType: EVENT_TYPE;
1730     SignalState: LONG;
1731   end;
1732   EVENT_BASIC_INFORMATION = _EVENT_BASIC_INFORMATION;
1733   PEVENT_BASIC_INFORMATION = ^EVENT_BASIC_INFORMATION;
1734   TEventBasicInformation = EVENT_BASIC_INFORMATION;
1735   PEventBasicInformation = ^TEventBasicInformation;
1736 
1737 type
1738   _SEMAPHORE_INFORMATION_CLASS = (SemaphoreBasicInformation);
1739   SEMAPHORE_INFORMATION_CLASS = _SEMAPHORE_INFORMATION_CLASS;
1740   TSemaphoreInformationClass = SEMAPHORE_INFORMATION_CLASS;
1741 
1742 type
1743   _SEMAPHORE_BASIC_INFORMATION = record
1744     CurrentCount: LONG;
1745     MaximumCount: LONG;
1746   end;
1747   SEMAPHORE_BASIC_INFORMATION = _SEMAPHORE_BASIC_INFORMATION;
1748   PSEMAPHORE_BASIC_INFORMATION = ^SEMAPHORE_BASIC_INFORMATION;
1749   TSemaphoreBasicInformation = SEMAPHORE_BASIC_INFORMATION;
1750 
1751 type
1752   _MUTANT_INFORMATION_CLASS = (MutantBasicInformation);
1753   MUTANT_INFORMATION_CLASS = _MUTANT_INFORMATION_CLASS;
1754   TMutantInformationClass = MUTANT_INFORMATION_CLASS;
1755 
1756 type
1757   _MUTANT_BASIC_INFORMATION = record
1758     SignalState: LONG;
1759     Owned: ByteBool;
1760     Abandoned: ByteBool;
1761   end;
1762   MUTANT_BASIC_INFORMATION = _MUTANT_BASIC_INFORMATION;
1763   PMUTANT_BASIC_INFORMATION = ^MUTANT_BASIC_INFORMATION;
1764   TMutantBasicInformation = MUTANT_BASIC_INFORMATION;
1765   PMutantBasicInformation = ^TMutantBasicInformation;
1766 
1767 type
1768   _IO_COMPLETION_INFORMATION_CLASS = (IoCompletionBasicInformation);
1769   IO_COMPLETION_INFORMATION_CLASS = _IO_COMPLETION_INFORMATION_CLASS;
1770   TIoCompletionInformationClass = IO_COMPLETION_INFORMATION_CLASS;
1771 
1772 type
1773   _IO_COMPLETION_BASIC_INFORMATION = record
1774     SignalState: LONG;
1775   end;
1776   IO_COMPLETION_BASIC_INFORMATION = _IO_COMPLETION_BASIC_INFORMATION;
1777   PIO_COMPLETION_BASIC_INFORMATION = ^IO_COMPLETION_BASIC_INFORMATION;
1778   TIoCompletionBasicInformation = IO_COMPLETION_BASIC_INFORMATION;
1779   PIoCompletionBasicInformation = ^TIoCompletionBasicInformation;
1780 
1781 type
1782   _PORT_MESSAGE = record
1783     DataSize: USHORT;
1784     MessageSize: USHORT;
1785     MessageType: USHORT;
1786     VirtualRangesOffset: USHORT;
1787     ClientId: CLIENT_ID;
1788     MessageId: ULONG;
1789     SectionSize: ULONG;
1790     // UCHAR Data[];
1791   end;
1792   PORT_MESSAGE = _PORT_MESSAGE;
1793   PPORT_MESSAGE = ^PORT_MESSAGE;
1794   TPortMessage = PORT_MESSAGE;
1795   PPortMessage = ^TPortMessage;
1796 
1797   _LPC_TYPE = (
1798     LPC_NEW_MESSAGE, // A new message
1799     LPC_REQUEST, // A request message
1800     LPC_REPLY, // A reply to a request message
1801     LPC_DATAGRAM, //
1802     LPC_LOST_REPLY, //
1803     LPC_PORT_CLOSED, // Sent when port is deleted
1804     LPC_CLIENT_DIED, // Messages to thread termination ports
1805     LPC_EXCEPTION, // Messages to thread exception port
1806     LPC_DEBUG_EVENT, // Messages to thread debug port
1807     LPC_ERROR_EVENT, // Used by ZwRaiseHardError
1808     LPC_CONNECTION_REQUEST); // Used by ZwConnectPort
1809   LPC_TYPE = _LPC_TYPE;
1810   TLpcType = LPC_TYPE;
1811 
1812   _PORT_SECTION_WRITE = record
1813     Length: ULONG;
1814     SectionHandle: HANDLE;
1815     SectionOffset: ULONG;
1816     ViewSize: ULONG;
1817     ViewBase: PVOID;
1818     TargetViewBase: PVOID;
1819   end;
1820   PORT_SECTION_WRITE = _PORT_SECTION_WRITE;
1821   PPORT_SECTION_WRITE = ^PORT_SECTION_WRITE;
1822   TPortSectionWrite = PORT_SECTION_WRITE;
1823   PPortSectionWrite = ^TPortSectionWrite;
1824 
1825   _PORT_SECTION_READ = record
1826     Length: ULONG;
1827     ViewSize: ULONG;
1828     ViewBase: ULONG;
1829   end;
1830   PORT_SECTION_READ = _PORT_SECTION_READ;
1831   PPORT_SECTION_READ = ^PORT_SECTION_READ;
1832   TPortSectionRead = PORT_SECTION_READ;
1833   PPortSectionRead = ^TPortSectionRead;
1834 
1835 type
1836   _PORT_INFORMATION_CLASS = (PortBasicInformation);
1837   PORT_INFORMATION_CLASS = _PORT_INFORMATION_CLASS;
1838   TPortInformationClass = PORT_INFORMATION_CLASS;
1839 
1840 
1841 type
1842   _PORT_BASIC_INFORMATION = record
1843   end;
1844   PORT_BASIC_INFORMATION = _PORT_BASIC_INFORMATION;
1845   PPORT_BASIC_INFORMATION = ^PORT_BASIC_INFORMATION;
1846   TPortBasicInformation = PORT_BASIC_INFORMATION;
1847   PPortBasicInformation = ^TPortBasicInformation;
1848 
1849 type
1850   _FILE_GET_EA_INFORMATION = record
1851     NextEntryOffset: ULONG;
1852     EaNameLength: UCHAR;
1853     EaName: array[0..0] of CHAR;
1854   end;
1855   FILE_GET_EA_INFORMATION = _FILE_GET_EA_INFORMATION;
1856   PFILE_GET_EA_INFORMATION = ^FILE_GET_EA_INFORMATION;
1857   TFileGetEaInformation = FILE_GET_EA_INFORMATION;
1858   PFileGetEaInformation = ^TFileGetEaInformation;
1859 
1860 type
1861   _FILE_FS_VOLUME_INFORMATION = record
1862     VolumeCreationTime: LARGE_INTEGER;
1863     VolumeSerialNumber: ULONG;
1864     VolumeLabelLength: ULONG;
1865     Unknown: UCHAR;
1866     VolumeLabel: array[0..0] of WCHAR;
1867   end;
1868   FILE_FS_VOLUME_INFORMATION = _FILE_FS_VOLUME_INFORMATION;
1869   PFILE_FS_VOLUME_INFORMATION = ^FILE_FS_VOLUME_INFORMATION;
1870   TFileFsVolumeInformation = FILE_FS_VOLUME_INFORMATION;
1871   PFileFsVolumeInformation = ^TFileFsVolumeInformation;
1872 
1873   _FILE_FS_LABEL_INFORMATION = record
1874     VolumeLabelLength: ULONG;
1875     VolumeLabel: WCHAR;
1876   end;
1877   FILE_FS_LABEL_INFORMATION = _FILE_FS_LABEL_INFORMATION;
1878   PFILE_FS_LABEL_INFORMATION = ^FILE_FS_LABEL_INFORMATION;
1879   TFileFsLabelInformation = FILE_FS_LABEL_INFORMATION;
1880   PFileFsLabelInformation = ^TFileFsLabelInformation;
1881 
1882   _FILE_FS_SIZE_INFORMATION = record
1883     TotalAllocationUnits: LARGE_INTEGER;
1884     AvailableAllocationUnits: LARGE_INTEGER;
1885     SectorsPerAllocationUnit: ULONG;
1886     BytesPerSector: ULONG;
1887   end;
1888   FILE_FS_SIZE_INFORMATION = _FILE_FS_SIZE_INFORMATION;
1889   PFILE_FS_SIZE_INFORMATION = ^FILE_FS_SIZE_INFORMATION;
1890   TFileFsSizeInformation = FILE_FS_SIZE_INFORMATION;
1891   PFileFsSizeInformation = ^TFileFsSizeInformation;
1892 
1893   _FILE_FS_ATTRIBUTE_INFORMATION = record
1894     FileSystemFlags: ULONG;
1895     MaximumComponentNameLength: ULONG;
1896     FileSystemNameLength: ULONG;
1897     FileSystemName: array[0..0] of WCHAR;
1898   end;
1899   FILE_FS_ATTRIBUTE_INFORMATION = _FILE_FS_ATTRIBUTE_INFORMATION;
1900   PFILE_FS_ATTRIBUTE_INFORMATION = ^FILE_FS_ATTRIBUTE_INFORMATION;
1901   TFileFsAttributeInformation = FILE_FS_ATTRIBUTE_INFORMATION;
1902   PFileFsAttributeInformation = ^TFileFsAttributeInformation;
1903 
1904   _FILE_FS_CONTROL_INFORMATION = record
1905     Reserved: array[0..2] of LARGE_INTEGER;
1906     DefaultQuotaThreshold: LARGE_INTEGER;
1907     DefaultQuotaLimit: LARGE_INTEGER;
1908     QuotaFlags: ULONG;
1909   end;
1910   FILE_FS_CONTROL_INFORMATION = _FILE_FS_CONTROL_INFORMATION;
1911   PFILE_FS_CONTROL_INFORMATION = ^FILE_FS_CONTROL_INFORMATION;
1912   TFileFsControlInformation = FILE_FS_CONTROL_INFORMATION;
1913   PFileFsControlInformation = ^TFileFsControlInformation;
1914 
1915   _FILE_FS_FULL_SIZE_INFORMATION = record
1916     TotalQuotaAllocationUnits: LARGE_INTEGER;
1917     AvailableQuotaAllocationUnits: LARGE_INTEGER;
1918     AvailableAllocationUnits: LARGE_INTEGER;
1919     SectorsPerAllocationUnit: ULONG;
1920     BytesPerSector: ULONG;
1921   end;
1922   FILE_FS_FULL_SIZE_INFORMATION = _FILE_FS_FULL_SIZE_INFORMATION;
1923   PFILE_FS_FULL_SIZE_INFORMATION = ^FILE_FS_FULL_SIZE_INFORMATION;
1924   TFileFsFullSizeInformation = FILE_FS_FULL_SIZE_INFORMATION;
1925   PFileFsFullSizeInformation = ^TFileFsFullSizeInformation;
1926 
1927   _FILE_FS_OBJECT_ID_INFORMATION = record
1928     VolumeObjectId: UUID;
1929     VolumeObjectIdExtendedInfo: array[0..11] of ULONG;
1930   end;
1931   FILE_FS_OBJECT_ID_INFORMATION = _FILE_FS_OBJECT_ID_INFORMATION;
1932   PFILE_FS_OBJECT_ID_INFORMATION = ^FILE_FS_OBJECT_ID_INFORMATION;
1933   TFileFsObjectIdInformation = FILE_FS_OBJECT_ID_INFORMATION;
1934   PFileFsObjectIdInformation = ^TFileFsObjectIdInformation;
1935 
1936   _FILE_USER_QUOTA_INFORMATION = record
1937     NextEntryOffset: ULONG;
1938     SidLength: ULONG;
1939     ChangeTime: LARGE_INTEGER;
1940     QuotaUsed: LARGE_INTEGER;
1941     QuotaThreshold: LARGE_INTEGER;
1942     QuotaLimit: LARGE_INTEGER;
1943     Sid: array[0..0] of SID;
1944   end;
1945   FILE_USER_QUOTA_INFORMATION = _FILE_USER_QUOTA_INFORMATION;
1946   PFILE_USER_QUOTA_INFORMATION = ^FILE_USER_QUOTA_INFORMATION;
1947   TFileUserQuotaInformation = FILE_USER_QUOTA_INFORMATION;
1948   PFileUserQuotaInformation = ^TFileUserQuotaInformation;
1949 
1950   _FILE_QUOTA_LIST_INFORMATION = record
1951     NextEntryOffset: ULONG;
1952     SidLength: ULONG;
1953     Sid: array[0..0] of SID;
1954   end;
1955   FILE_QUOTA_LIST_INFORMATION = _FILE_QUOTA_LIST_INFORMATION;
1956   PFILE_QUOTA_LIST_INFORMATION = ^FILE_QUOTA_LIST_INFORMATION;
1957   TFileQuotaListInformation = FILE_QUOTA_LIST_INFORMATION;
1958   PFileQuotaListInformation = ^TFileQuotaListInformation;
1959 
1960 type
1961   _FILE_DIRECTORY_INFORMATION = record // Information Class 1
1962     NextEntryOffset: ULONG;
1963     Unknown: ULONG;
1964     CreationTime: LARGE_INTEGER;
1965     LastAccessTime: LARGE_INTEGER;
1966     LastWriteTime: LARGE_INTEGER;
1967     ChangeTime: LARGE_INTEGER;
1968     EndOfFile: LARGE_INTEGER;
1969     AllocationSize: LARGE_INTEGER;
1970     FileAttributes: ULONG;
1971     FileNameLength: ULONG;
1972     FileName: array[0..0] of WCHAR;
1973   end;
1974   FILE_DIRECTORY_INFORMATION = _FILE_DIRECTORY_INFORMATION;
1975   PFILE_DIRECTORY_INFORMATION = ^FILE_DIRECTORY_INFORMATION;
1976   TFileDirectoryInformation = FILE_DIRECTORY_INFORMATION;
1977   PFileDirectoryInformation = ^TFileDirectoryInformation;
1978 
1979   _FILE_FULL_DIRECTORY_INFORMATION = record // Information Class 2
1980     NextEntryOffset: ULONG;
1981     Unknown: ULONG;
1982     CreationTime: LARGE_INTEGER;
1983     LastAccessTime: LARGE_INTEGER;
1984     LastWriteTime: LARGE_INTEGER;
1985     ChangeTime: LARGE_INTEGER;
1986     EndOfFile: LARGE_INTEGER;
1987     AllocationSize: LARGE_INTEGER;
1988     FileAttributes: ULONG;
1989     FileNameLength: ULONG;
1990     EaInformationLength: ULONG;
1991     FileName: array[0..0] of WCHAR;
1992   end;
1993   FILE_FULL_DIRECTORY_INFORMATION = _FILE_FULL_DIRECTORY_INFORMATION;
1994   PFILE_FULL_DIRECTORY_INFORMATION = ^FILE_FULL_DIRECTORY_INFORMATION;
1995   TFileFullDirectoryInformation = FILE_FULL_DIRECTORY_INFORMATION;
1996   PFileFullDirectoryInformation = ^TFileFullDirectoryInformation;
1997 
1998   _FILE_BOTH_DIRECTORY_INFORMATION = record // Information Class 3
1999     NextEntryOffset: ULONG;
2000     Unknown: ULONG;
2001     CreationTime: LARGE_INTEGER;
2002     LastAccessTime: LARGE_INTEGER;
2003     LastWriteTime: LARGE_INTEGER;
2004     ChangeTime: LARGE_INTEGER;
2005     EndOfFile: LARGE_INTEGER;
2006     AllocationSize: LARGE_INTEGER;
2007     FileAttributes: ULONG;
2008     FileNameLength: ULONG;
2009     EaInformationLength: ULONG;
2010     AlternateNameLength: UCHAR;
2011     AlternateName: array[0..11] of WCHAR;
2012     FileName: array[0..0] of WCHAR;
2013   end;
2014   FILE_BOTH_DIRECTORY_INFORMATION = _FILE_BOTH_DIRECTORY_INFORMATION;
2015   PFILE_BOTH_DIRECTORY_INFORMATION = ^FILE_BOTH_DIRECTORY_INFORMATION;
2016   TFileBothDirectoryInformation = FILE_BOTH_DIRECTORY_INFORMATION;
2017   PFileBothDirectoryInformation = ^TFileBothDirectoryInformation;
2018 
2019   _FILE_INTERNAL_INFORMATION = record // Information Class 6
2020     FileId: LARGE_INTEGER;
2021   end;
2022   FILE_INTERNAL_INFORMATION = _FILE_INTERNAL_INFORMATION;
2023   PFILE_INTERNAL_INFORMATION = ^FILE_INTERNAL_INFORMATION;
2024   TFileInternalInformation = FILE_INTERNAL_INFORMATION;
2025   PFileInternalInformation = ^TFileInternalInformation;
2026 
2027   _FILE_EA_INFORMATION = record // Information Class 7
2028     EaInformationLength: ULONG;
2029   end;
2030   FILE_EA_INFORMATION = _FILE_EA_INFORMATION;
2031   PFILE_EA_INFORMATION = ^FILE_EA_INFORMATION;
2032   TFileEaInformation = FILE_EA_INFORMATION;
2033   PFileEaInformation = ^TFileEaInformation;
2034 
2035   _FILE_ACCESS_INFORMATION = record // Information Class 8
2036     GrantedAccess: ACCESS_MASK;
2037   end;
2038   FILE_ACCESS_INFORMATION = _FILE_ACCESS_INFORMATION;
2039   PFILE_ACCESS_INFORMATION = ^FILE_ACCESS_INFORMATION;
2040   TFileAccessInformation = FILE_ACCESS_INFORMATION;
2041   PFileAccessInformation = ^TFileAccessInformation;
2042 
2043   _FILE_NAME_INFORMATION = record // Information Classes 9 and 21
2044     FileNameLength: ULONG;
2045     FileName: array[0..0] of WCHAR;
2046   end;
2047   FILE_NAME_INFORMATION = _FILE_NAME_INFORMATION;
2048   PFILE_NAME_INFORMATION = ^FILE_NAME_INFORMATION;
2049   FILE_ALTERNATE_NAME_INFORMATION = _FILE_NAME_INFORMATION;
2050   PFILE_ALTERNATE_NAME_INFORMATION = ^FILE_ALTERNATE_NAME_INFORMATION;
2051   TFileNameInformation = FILE_NAME_INFORMATION;
2052   PFileNameInformation = ^TFileNameInformation;
2053 
2054   _FILE_LINK_RENAME_INFORMATION = record // Info Classes 10 and 11
2055     ReplaceIfExists: ByteBool;
2056     RootDirectory: HANDLE;
2057     FileNameLength: ULONG;
2058     FileName: array[0..0] of WCHAR;
2059   end;
2060   FILE_LINK_INFORMATION = _FILE_LINK_RENAME_INFORMATION;
2061   PFILE_LINK_INFORMATION = ^FILE_LINK_INFORMATION;
2062   FILE_RENAME_INFORMATION = _FILE_LINK_RENAME_INFORMATION;
2063   PFILE_RENAME_INFORMATION = ^FILE_RENAME_INFORMATION;
2064   TFileLinkInformation = FILE_LINK_INFORMATION;
2065   PFileLinkInformation = ^TFileLinkInformation;
2066 
2067   _FILE_NAMES_INFORMATION = record // Information Class 12
2068     NextEntryOffset: ULONG;
2069     Unknown: ULONG;
2070     FileNameLength: ULONG;
2071     FileName: array[0..0] of WCHAR;
2072   end;
2073   FILE_NAMES_INFORMATION = _FILE_NAMES_INFORMATION;
2074   PFILE_NAMES_INFORMATION = ^FILE_NAMES_INFORMATION;
2075   TFileNamesInformation = FILE_NAMES_INFORMATION;
2076   PFileNamesInformation = ^TFileNamesInformation;
2077 
2078   _FILE_MODE_INFORMATION = record // Information Class 16
2079     Mode: ULONG;
2080   end;
2081   FILE_MODE_INFORMATION = _FILE_MODE_INFORMATION;
2082   PFILE_MODE_INFORMATION = ^FILE_MODE_INFORMATION;
2083   TFileModeInformation = FILE_MODE_INFORMATION;
2084   PFileModeInformation = ^TFileModeInformation;
2085 
2086   _FILE_ALL_INFORMATION = record // Information Class 18
2087     BasicInformation: FILE_BASIC_INFORMATION;
2088     StandardInformation: FILE_STANDARD_INFORMATION;
2089     InternalInformation: FILE_INTERNAL_INFORMATION;
2090     EaInformation: FILE_EA_INFORMATION;
2091     AccessInformation: FILE_ACCESS_INFORMATION;
2092     PositionInformation: FILE_POSITION_INFORMATION;
2093     ModeInformation: FILE_MODE_INFORMATION;
2094     AlignmentInformation: FILE_ALIGNMENT_INFORMATION;
2095     NameInformation: FILE_NAME_INFORMATION;
2096   end;
2097   FILE_ALL_INFORMATION = _FILE_ALL_INFORMATION;
2098   PFILE_ALL_INFORMATION = ^FILE_ALL_INFORMATION;
2099   TFileAllInformation = FILE_ALL_INFORMATION;
2100   PFileAllInformation = ^TFileAllInformation;
2101 
2102   _FILE_ALLOCATION_INFORMATION = record // Information Class 19
2103     AllocationSize: LARGE_INTEGER;
2104   end;
2105   FILE_ALLOCATION_INFORMATION = _FILE_ALLOCATION_INFORMATION;
2106   PFILE_ALLOCATION_INFORMATION = ^FILE_ALLOCATION_INFORMATION;
2107   TFileAllocationInformation = FILE_ALLOCATION_INFORMATION;
2108   PFileAllocationInformation = ^TFileAllocationInformation;
2109 
2110   _FILE_STREAM_INFORMATION = record // Information Class 22
2111     NextEntryOffset: ULONG;
2112     StreamNameLength: ULONG;
2113     EndOfStream: LARGE_INTEGER;
2114     AllocationSize: LARGE_INTEGER;
2115     StreamName: array[0..0] of WCHAR;
2116   end;
2117   FILE_STREAM_INFORMATION = _FILE_STREAM_INFORMATION;
2118   PFILE_STREAM_INFORMATION = ^FILE_STREAM_INFORMATION;
2119   TFileStreamInformation = FILE_STREAM_INFORMATION;
2120   PFileStreamInformation = ^TFileStreamInformation;
2121 
2122   _FILE_PIPE_INFORMATION = record // Information Class 23
2123     ReadModeMessage: ULONG;
2124     WaitModeBlocking: ULONG;
2125   end;
2126   FILE_PIPE_INFORMATION = _FILE_PIPE_INFORMATION;
2127   PFILE_PIPE_INFORMATION = ^FILE_PIPE_INFORMATION;
2128   TFilePipeInformation = FILE_PIPE_INFORMATION;
2129   PFilePipeInformation = ^TFilePipeInformation;
2130 
2131   _FILE_PIPE_LOCAL_INFORMATION = record // Information Class 24
2132     MessageType: ULONG;
2133     Unknown1: ULONG;
2134     MaxInstances: ULONG;
2135     CurInstances: ULONG;
2136     InBufferSize: ULONG;
2137     Unknown2: ULONG;
2138     OutBufferSize: ULONG;
2139     Unknown3: array[0..1] of ULONG;
2140     ServerEnd: ULONG;
2141   end;
2142   FILE_PIPE_LOCAL_INFORMATION = _FILE_PIPE_LOCAL_INFORMATION;
2143   PFILE_PIPE_LOCAL_INFORMATION = ^FILE_PIPE_LOCAL_INFORMATION;
2144   TFilePipeLocalInformation = FILE_PIPE_LOCAL_INFORMATION;
2145   PFilePipeLocalInformation = ^TFilePipeLocalInformation;
2146 
2147   _FILE_PIPE_REMOTE_INFORMATION = record // Information Class 25
2148     CollectDataTimeout: LARGE_INTEGER;
2149     MaxCollectionCount: ULONG;
2150   end;
2151   FILE_PIPE_REMOTE_INFORMATION = _FILE_PIPE_REMOTE_INFORMATION;
2152   PFILE_PIPE_REMOTE_INFORMATION = ^FILE_PIPE_REMOTE_INFORMATION;
2153   TFilePipeRemoteInformation = FILE_PIPE_REMOTE_INFORMATION;
2154   PFilePipeRemoteInformation = ^TFilePipeRemoteInformation;
2155 
2156   _FILE_MAILSLOT_QUERY_INFORMATION = record // Information Class 26
2157     MaxMessageSize: ULONG;
2158     Unknown: ULONG;
2159     NextSize: ULONG;
2160     MessageCount: ULONG;
2161     ReadTimeout: LARGE_INTEGER;
2162   end;
2163   FILE_MAILSLOT_QUERY_INFORMATION = _FILE_MAILSLOT_QUERY_INFORMATION;
2164   PFILE_MAILSLOT_QUERY_INFORMATION = ^FILE_MAILSLOT_QUERY_INFORMATION;
2165   TFileMailslotQueryInformation = FILE_MAILSLOT_QUERY_INFORMATION;
2166   PFileMailslotQueryInformation = ^TFileMailslotQueryInformation;
2167 
2168   _FILE_MAILSLOT_SET_INFORMATION = record // Information Class 27
2169     ReadTimeout: LARGE_INTEGER;
2170   end;
2171   FILE_MAILSLOT_SET_INFORMATION = _FILE_MAILSLOT_SET_INFORMATION;
2172   PFILE_MAILSLOT_SET_INFORMATION = ^FILE_MAILSLOT_SET_INFORMATION;
2173   TFileMailslotSetInformation = FILE_MAILSLOT_SET_INFORMATION;
2174   PFileMailslotSetInformation = ^TFileMailslotSetInformation;
2175 
2176   _FILE_COMPRESSION_INFORMATION = record // Information Class 28
2177     CompressedSize: LARGE_INTEGER;
2178     CompressionFormat: USHORT;
2179     CompressionUnitShift: UCHAR;
2180     Unknown: UCHAR;
2181     ClusterSizeShift: UCHAR;
2182   end;
2183   FILE_COMPRESSION_INFORMATION = _FILE_COMPRESSION_INFORMATION;
2184   PFILE_COMPRESSION_INFORMATION = ^FILE_COMPRESSION_INFORMATION;
2185   TFileCompressionInformation = FILE_COMPRESSION_INFORMATION;
2186   PFileCompressionInformation = ^TFileCompressionInformation;
2187 
2188   _FILE_COMPLETION_INFORMATION = record // Information Class 30
2189     IoCompletionHandle: HANDLE;
2190     CompletionKey: ULONG;
2191   end;
2192   FILE_COMPLETION_INFORMATION = _FILE_COMPLETION_INFORMATION;
2193   PFILE_COMPLETION_INFORMATION = ^FILE_COMPLETION_INFORMATION;
2194   TFileCompletionInformation = FILE_COMPLETION_INFORMATION;
2195   PFileCompletionInformation = ^TFileCompletionInformation;
2196 
2197 type
2198   PEXECUTION_STATE = ^EXECUTION_STATE;
2199   PExecutionState = PEXECUTION_STATE;
2200 
2201 {$IFNDEF JWA_INCLUDEMODE}
2202 type
2203   PLANGID = ^LANGID;
2204 {$ENDIF JWA_INCLUDEMODE}
2205 
2206 type
2207   _ATOM_INFORMATION_CLASS = (AtomBasicInformation, AtomListInformation);
2208   ATOM_INFORMATION_CLASS = _ATOM_INFORMATION_CLASS;
2209   TAtomInformationClass = ATOM_INFORMATION_CLASS;
2210 
2211 type
2212   _ATOM_BASIC_INFORMATION = record
2213     ReferenceCount: USHORT;
2214     Pinned: USHORT;
2215     NameLength: USHORT;
2216     Name: array[0..0] of WCHAR;
2217   end;
2218   ATOM_BASIC_INFORMATION = _ATOM_BASIC_INFORMATION;
2219   PATOM_BASIC_INFORMATION = ^ATOM_BASIC_INFORMATION;
2220   TAtomBasicInformation = ATOM_BASIC_INFORMATION;
2221   PAtomBasicInformation = ^TAtomBasicInformation;
2222 
2223   _ATOM_LIST_INFORMATION = record
2224     NumberOfAtoms: ULONG;
2225     Atoms: array[0..0] of ATOM;
2226   end;
2227   ATOM_LIST_INFORMATION = _ATOM_LIST_INFORMATION;
2228   PATOM_LIST_INFORMATION = ^ATOM_LIST_INFORMATION;
2229   TAtomListInformation = ATOM_LIST_INFORMATION;
2230   PAtomListInformation = ^TAtomListInformation;
2231 
2232 //==============================================================================
2233 // NTFS on disk structure structures
2234 //==============================================================================
2235 
2236 type
2237   _NTFS_RECORD_HEADER = record
2238     Type_: ULONG;
2239     UsaOffset: USHORT;
2240     UsaCount: USHORT;
2241     Usn: USN;
2242   end;
2243   NTFS_RECORD_HEADER = _NTFS_RECORD_HEADER;
2244   PNTFS_RECORD_HEADER = ^NTFS_RECORD_HEADER;
2245   TNtfsRecordHeader = NTFS_RECORD_HEADER;
2246   PNtfsRecordHeader = ^TNtfsRecordHeader;
2247 
2248   _FILE_RECORD_HEADER = record
2249     Ntfs: NTFS_RECORD_HEADER;
2250     SequenceNumber: USHORT;
2251     LinkCount: USHORT;
2252     AttributesOffset: USHORT;
2253     Flags: USHORT; // 0x0001 = InUse, 0x0002 = Directory
2254     BytesInUse: ULONG;
2255     BytesAllocated: ULONG;
2256     BaseFileRecord: ULONGLONG;
2257     NextAttributeNumber: USHORT;
2258   end;
2259   FILE_RECORD_HEADER = _FILE_RECORD_HEADER;
2260   PFILE_RECORD_HEADER = ^FILE_RECORD_HEADER;
2261   TFileRecordHeader = FILE_RECORD_HEADER;
2262   PFileRecordHeader = ^TFileRecordHeader;
2263 
2264 const
2265   AttributeStandardInformation = $10;
2266   AttributeAttributeList = $20;
2267   AttributeFileName = $30;
2268   AttributeObjectId = $40;
2269   AttributeSecurityDescriptor = $50;
2270   AttributeVolumeName = $60;
2271   AttributeVolumeInformation = $70;
2272   AttributeData = $80;
2273   AttributeIndexRoot = $90;
2274   AttributeIndexAllocation = $A0;
2275   AttributeBitmap = $B0;
2276   AttributeReparsePoint = $C0;
2277   AttributeEAInformation = $D0;
2278   AttributeEA = $E0;
2279   AttributePropertySet = $F0;
2280   AttributeLoggedUtilityStream = $100;
2281 
2282 type
2283   ATTRIBUTE_TYPE = AttributeStandardInformation..AttributeLoggedUtilityStream;
2284   PATTRIBUTE_TYPE = ^ATTRIBUTE_TYPE;
2285   TAttributeType = ATTRIBUTE_TYPE;
2286 
2287   _ATTRIBUTE = record
2288     AttributeType: ATTRIBUTE_TYPE;
2289     Length: ULONG;
2290     Nonresident: ByteBool;
2291     NameLength: UCHAR;
2292     NameOffset: USHORT;
2293     Flags: USHORT; // 0x0001 = Compressed
2294     AttributeNumber: USHORT;
2295   end;
2296   ATTRIBUTE = _ATTRIBUTE;
2297   PATTRIBUTE = ^ATTRIBUTE;
2298   TAttribute = ATTRIBUTE;
2299 
2300   _RESIDENT_ATTRIBUTE = record
2301     Attribute: ATTRIBUTE;
2302     ValueLength: ULONG;
2303     ValueOffset: USHORT;
2304     Flags: USHORT; // 0x0001 = Indexed
2305   end;
2306   RESIDENT_ATTRIBUTE = _RESIDENT_ATTRIBUTE;
2307   PRESIDENT_ATTRIBUTE = ^RESIDENT_ATTRIBUTE;
2308   TResidentAttribute = RESIDENT_ATTRIBUTE;
2309   PResidentAttribute = ^TResidentAttribute;
2310 
2311   _NONRESIDENT_ATTRIBUTE = record
2312     Attribute: ATTRIBUTE;
2313     LowVcn: ULONGLONG;
2314     HighVcn: ULONGLONG;
2315     RunArrayOffset: USHORT;
2316     CompressionUnit: UCHAR;
2317     AlignmentOrReserved: array[0..4] of UCHAR;
2318     AllocatedSize: ULONGLONG;
2319     DataSize: ULONGLONG;
2320     InitializedSize: ULONGLONG;
2321     CompressedSize: ULONGLONG; // Only when compressed
2322   end;
2323   NONRESIDENT_ATTRIBUTE = _NONRESIDENT_ATTRIBUTE;
2324   PNONRESIDENT_ATTRIBUTE = ^NONRESIDENT_ATTRIBUTE;
2325   TNonResidentAttribute = NONRESIDENT_ATTRIBUTE;
2326   PNonResidentAttribute = ^TNonResidentAttribute;
2327 
2328   _STANDARD_INFORMATION = record
2329     CreationTime: ULONGLONG;
2330     ChangeTime: ULONGLONG;
2331     LastWriteTime: ULONGLONG;
2332     LastAccessTime: ULONGLONG;
2333     FileAttributes: ULONG;
2334     AlignmentOrReservedOrUnknown: array[0..2] of ULONG;
2335     QuotaId: ULONG; // NTFS 3.0 only
2336     SecurityId: ULONG; // NTFS 3.0 only
2337     QuotaCharge: ULONGLONG; // NTFS 3.0 only
2338     Usn: USN; // NTFS 3.0 only
2339   end;
2340   STANDARD_INFORMATION = _STANDARD_INFORMATION;
2341   PSTANDARD_INFORMATION = ^STANDARD_INFORMATION;
2342   TStandardInformation = STANDARD_INFORMATION;
2343   PStandardInformation = ^TStandardInformation;
2344 
2345   _ATTRIBUTE_LIST = record
2346     AttributeType: ATTRIBUTE_TYPE;
2347     Length: USHORT;
2348     NameLength: UCHAR;
2349     NameOffset: UCHAR;
2350     LowVcn: ULONGLONG;
2351     FileReferenceNumber: ULONGLONG;
2352     AttributeNumber: USHORT;
2353     AlignmentOrReserved: array[0..2] of USHORT;
2354   end;
2355   ATTRIBUTE_LIST = _ATTRIBUTE_LIST;
2356   PATTRIBUTE_LIST = ^ATTRIBUTE_LIST;
2357   TAttributeList = ATTRIBUTE_LIST;
2358   PAttributeList = ^TAttributeList;
2359 
2360   _FILENAME_ATTRIBUTE = record
2361     DirectoryFileReferenceNumber: ULONGLONG;
2362     CreationTime: ULONGLONG; // Saved when filename last changed
2363     ChangeTime: ULONGLONG; // ditto
2364     LastWriteTime: ULONGLONG; // ditto
2365     LastAccessTime: ULONGLONG; // ditto
2366     AllocatedSize: ULONGLONG; // ditto
2367     DataSize: ULONGLONG; // ditto
2368     FileAttributes: ULONG; // ditto
2369     AlignmentOrReserved: ULONG;
2370     NameLength: UCHAR;
2371     NameType: UCHAR; // 0x01 = Long, 0x02 = Short
2372     Name: array[0..0] of UCHAR;
2373   end;
2374   FILENAME_ATTRIBUTE = _FILENAME_ATTRIBUTE;
2375   PFILENAME_ATTRIBUTE = ^FILENAME_ATTRIBUTE;
2376   TFilenameAttribute = FILENAME_ATTRIBUTE;
2377   PFilenameAttribute = ^TFilenameAttribute;
2378 
2379   _OBJECTID_ATTRIBUTE = record
2380     ObjectId: GUID;
2381     case Integer of
2382       0: (
2383         BirthVolumeId: GUID;
2384         BirthObjectId: GUID;
2385         DomainId: GUID);
2386       1: (
2387         ExtendedInfo: array[0..47] of UCHAR
2388         );
2389   end;
2390   OBJECTID_ATTRIBUTE = _OBJECTID_ATTRIBUTE;
2391   POBJECTID_ATTRIBUTE = ^OBJECTID_ATTRIBUTE;
2392   TObjectIdAttribute = OBJECTID_ATTRIBUTE;
2393   PObjectIdAttribute = ^TObjectIdAttribute;
2394 
2395   _VOLUME_INFORMATION = record
2396     Unknown: array[0..1] of ULONG;
2397     MajorVersion: UCHAR;
2398     MinorVersion: UCHAR;
2399     Flags: USHORT;
2400   end;
2401   VOLUME_INFORMATION = _VOLUME_INFORMATION;
2402   PVOLUME_INFORMATION = ^VOLUME_INFORMATION;
2403   TVolumeInformation = VOLUME_INFORMATION;
2404   PVolumeInformation = ^TVolumeInformation;
2405 
2406   _DIRECTORY_INDEX = record
2407     EntriesOffset: ULONG;
2408     IndexBlockLength: ULONG;
2409     AllocatedSize: ULONG;
2410     Flags: ULONG; // 0x00 = Small directory, 0x01 = Large directory
2411   end;
2412   DIRECTORY_INDEX = _DIRECTORY_INDEX;
2413   PDIRECTORY_INDEX = ^DIRECTORY_INDEX;
2414   TDirectoryIndex = DIRECTORY_INDEX;
2415   PDirectoryIndex = ^TDirectoryIndex;
2416 
2417   _DIRECTORY_ENTRY = record
2418     FileReferenceNumber: ULONGLONG;
2419     Length: USHORT;
2420     AttributeLength: USHORT;
2421     Flags: ULONG; // 0x01 = Has trailing VCN, 0x02 = Last entry
2422     // FILENAME_ATTRIBUTE Name;
2423     // ULONGLONG Vcn;       // VCN in IndexAllocation of earlier entries
2424   end;
2425   DIRECTORY_ENTRY = _DIRECTORY_ENTRY;
2426   PDIRECTORY_ENTRY = ^DIRECTORY_ENTRY;
2427   TDirectoryEntry = DIRECTORY_ENTRY;
2428   PDirectoryEntry = ^TDirectoryEntry;
2429 
2430   _INDEX_ROOT = record
2431     Type_: ATTRIBUTE_TYPE;
2432     CollationRule: ULONG;
2433     BytesPerIndexBlock: ULONG;
2434     ClustersPerIndexBlock: ULONG;
2435     DirectoryIndex: DIRECTORY_INDEX;
2436   end;
2437   INDEX_ROOT = _INDEX_ROOT;
2438   PINDEX_ROOT = ^INDEX_ROOT;
2439   TIndexRoot = INDEX_ROOT;
2440   PIndexRoot = ^TIndexRoot;
2441 
2442   _INDEX_BLOCK_HEADER = record
2443     Ntfs: NTFS_RECORD_HEADER;
2444     IndexBlockVcn: ULONGLONG;
2445     DirectoryIndex: DIRECTORY_INDEX;
2446   end;
2447   INDEX_BLOCK_HEADER = _INDEX_BLOCK_HEADER;
2448   PINDEX_BLOCK_HEADER = ^INDEX_BLOCK_HEADER;
2449   TIndexBlockHeader = _INDEX_BLOCK_HEADER;
2450   PIndexBlockHeader = ^TIndexBlockHeader;
2451 
2452   _REPARSE_POINT = record
2453     ReparseTag: ULONG;
2454     ReparseDataLength: USHORT;
2455     Reserved: USHORT;
2456     ReparseData: array[0..0] of UCHAR;
2457   end;
2458   REPARSE_POINT = _REPARSE_POINT;
2459   PREPARSE_POINT = ^REPARSE_POINT;
2460   TReparsePoint = REPARSE_POINT;
2461   PReparsePoint = ^TReparsePoint;
2462 
2463   _EA_INFORMATION = record
2464     EaLength: ULONG;
2465     EaQueryLength: ULONG;
2466   end;
2467   EA_INFORMATION = _EA_INFORMATION;
2468   PEA_INFORMATION = ^EA_INFORMATION;
2469   TEaInformation = EA_INFORMATION;
2470   PEaInformation = ^TEaInformation;
2471 
2472   _EA_ATTRIBUTE = record
2473     NextEntryOffset: ULONG;
2474     Flags: UCHAR;
2475     EaNameLength: UCHAR;
2476     EaValueLength: USHORT;
2477     EaName: array[0..0] of CHAR;
2478     // UCHAR EaData[];
2479   end;
2480   EA_ATTRIBUTE = _EA_ATTRIBUTE;
2481   PEA_ATTRIBUTE = ^EA_ATTRIBUTE;
2482   TEaAttribute = EA_ATTRIBUTE;
2483   PEaAttribute = ^TEaAttribute;
2484 
2485   _ATTRIBUTE_DEFINITION = record
2486     AttributeName: array[0..63] of WCHAR;
2487     AttributeNumber: ULONG;
2488     Unknown: array[0..1] of ULONG;
2489     Flags: ULONG;
2490     MinimumSize: ULONGLONG;
2491     MaximumSize: ULONGLONG;
2492   end;
2493   ATTRIBUTE_DEFINITION = _ATTRIBUTE_DEFINITION;
2494   PATTRIBUTE_DEFINITION = ^ATTRIBUTE_DEFINITION;
2495   TAttributeDefinition = ATTRIBUTE_DEFINITION;
2496   PAttributeDefinition = ^TAttributeDefinition;
2497 
2498   _BOOT_BLOCK = record
2499     Jump: array[0..2] of UCHAR;
2500     Format: array[0..7] of UCHAR;
2501     BytesPerSector: USHORT;
2502     SectorsPerCluster: UCHAR;
2503     BootSectors: USHORT;
2504     Mbz1: UCHAR;
2505     Mbz2: USHORT;
2506     Reserved1: USHORT;
2507     MediaType: UCHAR;
2508     Mbz3: USHORT;
2509     SectorsPerTrack: USHORT;
2510     NumberOfHeads: USHORT;
2511     PartitionOffset: ULONG;
2512     Reserved2: array[0..1] of ULONG;
2513     TotalSectors: ULONGLONG;
2514     MftStartLcn: ULONGLONG;
2515     Mft2StartLcn: ULONGLONG;
2516     ClustersPerFileRecord: ULONG;
2517     ClustersPerIndexBlock: ULONG;
2518     VolumeSerialNumber: ULONGLONG;
2519     Code: array[0..$1AD] of UCHAR;
2520     BootSignature: USHORT;
2521   end;
2522   BOOT_BLOCK = _BOOT_BLOCK;
2523   PBOOT_BLOCK = ^BOOT_BLOCK;
2524   TBootBlock = BOOT_BLOCK;
2525   PBootBlock = ^TBootBlock;
2526 
2527 const
2528   DBG_STATUS_CONTROL_C = 1;
2529   DBG_STATUS_SYSRQ = 2;
2530   DBG_STATUS_BUGCHECK_FIRST = 3;
2531   DBG_STATUS_BUGCHECK_SECOND = 4;
2532   DBG_STATUS_FATAL = 5;
2533   DBG_STATUS_DEBUG_CONTROL = 6;
2534 
2535 //function DbgPrint(Format: PCH; ...): ULONG; cdecl;
2536 //function DbgPrintReturnControlC(Format: PCH; ...): ULONG; cdecl;
2537 
2538 //==============================================================================
2539 // Runtime Library
2540 //==============================================================================
2541 
2542 const
2543   RTL_RANGE_LIST_ADD_IF_CONFLICT = $00000001;
2544   RTL_RANGE_LIST_ADD_SHARED = $00000002;
2545 
2546 const
2547   RTL_RANGE_LIST_SHARED_OK = $00000001;
2548   RTL_RANGE_LIST_NULL_CONFLICT_OK = $00000002;
2549 
2550 type
2551   PRTL_CONFLICT_RANGE_CALLBACK = function(Context: PVOID; Range: PRTL_RANGE): ByteBool; stdcall;
2552 
2553 {$IFNDEF JWA_INCLUDEMODE}
2554 type
2555   _OSVERSIONINFOW = record
2556     dwOSVersionInfoSize: ULONG;
2557     dwMajorVersion: ULONG;
2558     dwMinorVersion: ULONG;
2559     dwBuildNumber: ULONG;
2560     dwPlatformId: ULONG;
2561     szCSDVersion: array[0..127] of WCHAR; // Maintenance string for PSS usage
2562   end;
2563   OSVERSIONINFOW = _OSVERSIONINFOW;
2564   POSVERSIONINFOW = ^OSVERSIONINFOW;
2565   LPOSVERSIONINFOW = ^OSVERSIONINFOW;
2566   RTL_OSVERSIONINFOW = OSVERSIONINFOW;
2567 {$ENDIF JWA_INCLUDEMODE}
2568   PRTL_OSVERSIONINFOW = ^OSVERSIONINFOW;
2569 
2570   {$IFNDEF JWA_INCLUDEMODE}
2571   TOsVersionInfoW = OSVERSIONINFOW;
2572   //POsVersionInfoW = ^TOsVersionInfoW;
2573 
2574   OSVERSIONINFO = OSVERSIONINFOW;
2575   POSVERSIONINFO = POSVERSIONINFOW;
2576   LPOSVERSIONINFO = LPOSVERSIONINFOW;
2577   {$ENDIF JWA_INCLUDEMODE}
2578 
2579 {$IFNDEF JWA_INCLUDEMODE}
2580 const
2581   VER_PLATFORM_WIN32s = 0;
2582   VER_PLATFORM_WIN32_WINDOWS = 1;
2583   VER_PLATFORM_WIN32_NT = 2;
2584 {$ENDIF JWA_INCLUDEMODE}
2585 
2586 type
2587   _RTL_BITMAP = record
2588     SizeOfBitMap: ULONG; // Number of bits in bit map
2589     Buffer: PULONG; // Pointer to the bit map itself
2590   end;
2591   RTL_BITMAP = _RTL_BITMAP;
2592   PRTL_BITMAP = ^RTL_BITMAP;
2593   TRtlBitmap = RTL_BITMAP;
2594   PRtlBitmap = ^TRtlBitmap;
2595 
2596 const
2597   RTL_REGISTRY_ABSOLUTE = 0; // Path is a full path
2598   RTL_REGISTRY_SERVICES = 1; // \Registry\Machine\System\CurrentControlSet\Services
2599   RTL_REGISTRY_CONTROL = 2; // \Registry\Machine\System\CurrentControlSet\Control
2600   RTL_REGISTRY_WINDOWS_NT = 3; // \Registry\Machine\Software\Microsoft\Windows NT\CurrentVersion
2601   RTL_REGISTRY_DEVICEMAP = 4; // \Registry\Machine\Hardware\DeviceMap
2602   RTL_REGISTRY_USER = 5; // \Registry\User\CurrentUser
2603   RTL_REGISTRY_MAXIMUM = 6;
2604   RTL_REGISTRY_HANDLE = $40000000; // Low order bits are registry handle
2605   RTL_REGISTRY_OPTIONAL = $80000000; // Indicates the key node is optional
2606 
2607 type
2608   _TIME_FIELDS = record
2609     Year: CSHORT; // range [1601...]
2610     Month: CSHORT; // range [1..12]
2611     Day: CSHORT; // range [1..31]
2612     Hour: CSHORT; // range [0..23]
2613     Minute: CSHORT; // range [0..59]
2614     Second: CSHORT; // range [0..59]
2615     Milliseconds: CSHORT; // range [0..999]
2616     Weekday: CSHORT; // range [0..6] == [Sunday..Saturday]
2617   end;
2618   TIME_FIELDS = _TIME_FIELDS;
2619   PTIME_FIELDS = ^TIME_FIELDS;
2620   TTimeFields = TIME_FIELDS;
2621   PTimeFields = ^TTimeFields;
2622 
2623 {$IFNDEF JWA_INCLUDEMODE}
2624 type
2625   _OSVERSIONINFOEXW = record
2626     dwOSVersionInfoSize: ULONG;
2627     dwMajorVersion: ULONG;
2628     dwMinorVersion: ULONG;
2629     dwBuildNumber: ULONG;
2630     dwPlatformId: ULONG;
2631     szCSDVersion: array[0..127] of WCHAR; // Maintenance string for PSS usage
2632     wServicePackMajor: USHORT;
2633     wServicePackMinor: USHORT;
2634     wSuiteMask: USHORT;
2635     wProductType: UCHAR;
2636     wReserved: UCHAR;
2637   end;
2638   OSVERSIONINFOEXW = _OSVERSIONINFOEXW;
2639   POSVERSIONINFOEXW = ^OSVERSIONINFOEXW;
2640   LPOSVERSIONINFOEXW = ^OSVERSIONINFOEXW;
2641   RTL_OSVERSIONINFOEXW = OSVERSIONINFOEXW;
2642   PRTL_OSVERSIONINFOEXW = ^OSVERSIONINFOEXW;
2643 
2644   TOsVersionInfoExW = OSVERSIONINFOEXW;
2645   //POsVersionInfoExW = ^TOsVersionInfoExW;
2646 
2647   OSVERSIONINFOEX = OSVERSIONINFOEXW;
2648   POSVERSIONINFOEX = POSVERSIONINFOEXW;
2649   LPOSVERSIONINFOEX = LPOSVERSIONINFOEXW;
2650 {$ENDIF JWA_INCLUDEMODE}
2651 
2652 //
2653 // RtlVerifyVersionInfo() conditions
2654 //
2655 
2656 const
2657   {$IFNDEF JWA_INCLUDEMODE}
2658   VER_EQUAL = 1;
2659   VER_GREATER = 2;
2660   VER_GREATER_EQUAL = 3;
2661   VER_LESS = 4;
2662   VER_LESS_EQUAL = 5;
2663   VER_AND = 6;
2664   VER_OR = 7;
2665 
2666   VER_CONDITION_MASK = 7;
2667   VER_NUM_BITS_PER_CONDITION_MASK = 3;
2668 
2669 //
2670 // RtlVerifyVersionInfo() type mask bits
2671 //
2672 
2673   VER_MINORVERSION = $0000001;
2674   VER_MAJORVERSION = $0000002;
2675   VER_BUILDNUMBER = $0000004;
2676   VER_PLATFORMID = $0000008;
2677   VER_SERVICEPACKMINOR = $0000010;
2678   VER_SERVICEPACKMAJOR = $0000020;
2679   VER_SUITENAME = $0000040;
2680   VER_PRODUCT_TYPE = $0000080;
2681 
2682 //
2683 // RtlVerifyVersionInfo() os product type values
2684 //
2685 
2686   VER_NT_WORKSTATION = $0000001;
2687   VER_NT_DOMAIN_CONTROLLER = $0000002;
2688   VER_NT_SERVER = $0000003;
2689   {$ENDIF JWA_INCLUDEMODE}
2690 
2691 //
2692 // Related constant(s) for RtlDetermineDosPathNameType_U()
2693 //
2694   INVALID_PATH = 0;
2695   UNC_PATH = 1;
2696   ABSOLUTE_DRIVE_PATH = 2;
2697   RELATIVE_DRIVE_PATH = 3;
2698   ABSOLUTE_PATH = 4;
2699   RELATIVE_PATH = 5;
2700   DEVICE_PATH = 6;
2701   UNC_DOT_PATH = 7;
2702 
2703 type
2704   PRTL_QUERY_REGISTRY_ROUTINE = function(ValueName: PWSTR; ValueType: ULONG;
2705     ValueData: PVOID; ValueLength: ULONG; Context, EntryContext: PVOID): NTSTATUS; stdcall;
2706 
2707   _RTL_QUERY_REGISTRY_TABLE = record
2708     QueryRoutine: PRTL_QUERY_REGISTRY_ROUTINE;
2709     Flags: ULONG;
2710     Name: PWSTR;
2711     EntryContext: PVOID;
2712     DefaultType: ULONG;
2713     DefaultData: PVOID;
2714     DefaultLength: ULONG;
2715   end;
2716   RTL_QUERY_REGISTRY_TABLE = _RTL_QUERY_REGISTRY_TABLE;
2717   PRTL_QUERY_REGISTRY_TABLE = ^RTL_QUERY_REGISTRY_TABLE;
2718   TRtlQueryRegistryTable = RTL_QUERY_REGISTRY_TABLE;
2719   PRtlQueryRegistryTable = ^TRtlQueryRegistryTable;
2720 
2721   REFGUID = ^GUID;
2722   TRefGuid = REFGUID;
2723 
2724 {$IFNDEF JWA_INCLUDEMODE}
2725 const
2726   // Should be defined, but isn't
2727   HEAP_ZERO_MEMORY = $00000008;
2728 {$ENDIF JWA_INCLUDEMODE}
2729 
2730 type
2731 // =================================================================
2732 // PROCESS ENVIRONMENT BLOCK (PEB)
2733 // =================================================================
2734 
2735 // Verified in XP using WinDbg
2736   _LDR_DATA_TABLE_ENTRY = record // not packed!
2737     case Integer of
2738   (*   *)0: (
2739   (*000*)InLoadOrderLinks: LIST_ENTRY
2740         );
2741   (*   *)1: (
2742   (*000*)InMemoryOrderLinks: LIST_ENTRY
2743         );
2744   (*   *)2: (
2745   (*000*)InInitializationOrderLinks: LIST_ENTRY;
2746   (*008*)DllBase: PVOID;
2747   (*00c*)EntryPoint: PVOID;
2748   (*010*)SizeOfImage: ULONG;
2749   (*014*)FullDllName: UNICODE_STRING;
2750   (*01c*)BaseDllName: UNICODE_STRING;
2751   (*024*)Flags: ULONG;
2752   (*028*)LoadCount: USHORT;
2753   (*02a*)TlsIndex: USHORT;
2754   (*02c*)HashLinks: LIST_ENTRY;
2755   (*034*)SectionPointer: PVOID;
2756   (*038*)CheckSum: ULONG;
2757   (*03C*)TimeDateStamp: ULONG;
2758   (*040*)LoadedImports: PVOID;
2759   (*044*)EntryPointActivationContext: PVOID; // PACTIVATION_CONTEXT
2760   (*048*)PatchInformation: PVOID;
2761         )
2762   end;
2763   LDR_DATA_TABLE_ENTRY = _LDR_DATA_TABLE_ENTRY;
2764   PLDR_DATA_TABLE_ENTRY = ^_LDR_DATA_TABLE_ENTRY;
2765   PPLDR_DATA_TABLE_ENTRY = ^PLDR_DATA_TABLE_ENTRY;
2766   TLdrDataTableEntry = _LDR_DATA_TABLE_ENTRY;
2767   PLdrDataTableEntry = ^_LDR_DATA_TABLE_ENTRY;
2768 
2769 // Verified in XP using WinDbg
2770   _PEB_LDR_DATA = record // not packed!
2771   (*000*)Length: ULONG;
2772   (*004*)Initialized: BOOLEAN;
2773   (*008*)SsHandle: PVOID;
2774   (*00c*)InLoadOrderModuleList: LIST_ENTRY;
2775   (*014*)InMemoryOrderModuleList: LIST_ENTRY;
2776   (*01c*)InInitializationOrderModuleList: LIST_ENTRY;
2777   (*024*)EntryInProgress: PVOID;
2778   end;
2779   PEB_LDR_DATA = _PEB_LDR_DATA;
2780   PPEB_LDR_DATA = ^_PEB_LDR_DATA;
2781   PPPEB_LDR_DATA = ^PPEB_LDR_DATA;
2782   TPebLdrData = _PEB_LDR_DATA;
2783   PPebLdrData = ^_PEB_LDR_DATA;
2784 
2785 // Verified in XP using WinDbg
2786   _RTL_DRIVE_LETTER_CURDIR = record // not packed!
2787   (*000*)Flags: USHORT;
2788   (*002*)Length: USHORT;
2789   (*004*)TimeStamp: ULONG;
2790   (*008*)DosPath: _STRING;
2791   end;
2792   RTL_DRIVE_LETTER_CURDIR = _RTL_DRIVE_LETTER_CURDIR;
2793   PRTL_DRIVE_LETTER_CURDIR = ^_RTL_DRIVE_LETTER_CURDIR;
2794   PPRTL_DRIVE_LETTER_CURDIR = ^PRTL_DRIVE_LETTER_CURDIR;
2795   TRtlDriveLetterCurdir = _RTL_DRIVE_LETTER_CURDIR;
2796   PRtlDriveLetterCurdir = ^_RTL_DRIVE_LETTER_CURDIR;
2797 
2798   _CURDIR = record // not packed!
2799   (*000*)DosPath: UNICODE_STRING;
2800   (*008*)Handle: HANDLE;
2801   end;
2802   CURDIR = _CURDIR;
2803   PCURDIR = ^_CURDIR;
2804   PPCURDIR = ^PCURDIR;
2805   TCurdir = _CURDIR;
2806 // PCurdir = ^_CURDIR; // <--- Pascal is case-insensitive
2807 
2808 // Verified in XP using WinDbg
2809   _RTL_USER_PROCESS_PARAMETERS = record // not packed!
2810   (*000*)MaximumLength: ULONG;
2811   (*004*)Length: ULONG;
2812   (*008*)Flags: ULONG; // Bit 0: all pointers normalized
2813   (*00c*)DebugFlags: ULONG;
2814   (*010*)ConsoleHandle: HANDLE;
2815   (*014*)ConsoleFlags: ULONG;
2816   (*018*)StandardInput: HANDLE;
2817   (*01c*)StandardOutput: HANDLE;
2818   (*020*)StandardError: HANDLE;
2819   (*024*)CurrentDirectory: CURDIR;
2820   (*030*)DllPath: UNICODE_STRING;
2821   (*038*)ImagePathName: UNICODE_STRING;
2822   (*040*)CommandLine: UNICODE_STRING;
2823   (*048*)Environment: PVOID;
2824   (*04c*)StartingX: ULONG;
2825   (*050*)StartingY: ULONG;
2826   (*054*)CountX: ULONG;
2827   (*058*)CountY: ULONG;
2828   (*05c*)CountCharsX: ULONG;
2829   (*060*)CountCharsY: ULONG;
2830   (*064*)FillAttribute: ULONG;
2831   (*068*)WindowFlags: ULONG;
2832   (*06c*)ShowWindowFlags: ULONG;
2833   (*070*)WindowTitle: UNICODE_STRING;
2834   (*078*)DesktopInfo: UNICODE_STRING;
2835   (*080*)ShellInfo: UNICODE_STRING;
2836   (*088*)RuntimeData: UNICODE_STRING;
2837   (*090*)CurrentDirectories: array[0..31] of RTL_DRIVE_LETTER_CURDIR;
2838   end;
2839   RTL_USER_PROCESS_PARAMETERS = _RTL_USER_PROCESS_PARAMETERS;
2840   PRTL_USER_PROCESS_PARAMETERS = ^_RTL_USER_PROCESS_PARAMETERS;
2841   PPRTL_USER_PROCESS_PARAMETERS = ^PRTL_USER_PROCESS_PARAMETERS;
2842   TRtlUserProcessParameters = _RTL_USER_PROCESS_PARAMETERS;
2843   PRtlUserProcessParameters = ^_RTL_USER_PROCESS_PARAMETERS;
2844   TProcessParameters = _RTL_USER_PROCESS_PARAMETERS;
2845   PProcessParameters = ^_RTL_USER_PROCESS_PARAMETERS;
2846 
2847   _SYSTEM_STRINGS = record // not packed!
2848   (*000*)SystemRoot: UNICODE_STRING; // %SystemRoot%
2849   (*008*)System32Root: UNICODE_STRING; // %SystemRoot%\System32
2850   (*010*)BaseNamedObjects: UNICODE_STRING; // \BaseNamedObjects
2851   end;
2852   SYSTEM_STRINGS = _SYSTEM_STRINGS;
2853   PSYSTEM_STRINGS = ^_SYSTEM_STRINGS;
2854   PPSYSTEM_STRINGS = ^PSYSTEM_STRINGS;
2855   TSystemStrings = _SYSTEM_STRINGS;
2856   PSystemStrings = ^_SYSTEM_STRINGS;
2857 
2858 // Verified in XP using WinDbg
2859   _TEXT_INFO = record // not packed!
2860   (*000*)Reserved: PVOID;
2861   (*004*)SystemStrings: PSYSTEM_STRINGS;
2862   end;
2863   TEXT_INFO = _TEXT_INFO;
2864   PTEXT_INFO = ^_TEXT_INFO;
2865   PPTEXT_INFO = ^PTEXT_INFO;
2866   TTextInfo = _TEXT_INFO;
2867   PTextInfo = ^_TEXT_INFO;
2868 
2869 // Verified in XP using WinDbg
2870   PPEB_FREE_BLOCK = ^_PEB_FREE_BLOCK;
2871   _PEB_FREE_BLOCK = record // not packed!
2872   (*000*)Next: PPEB_FREE_BLOCK;
2873   (*004*)Size: ULONG;
2874   end;
2875   PEB_FREE_BLOCK = _PEB_FREE_BLOCK;
2876   PPPEB_FREE_BLOCK = ^PPEB_FREE_BLOCK;
2877   TPebFreeBlock = _PEB_FREE_BLOCK;
2878   PPebFreeBlock = ^_PEB_FREE_BLOCK;
2879 
2880 // Verified in W2K, WXP and W2K3 using WinDbg
2881   _PEB_W2K = packed record // packed!
2882   (*000*)InheritedAddressSpace: BOOLEAN;
2883   (*001*)ReadImageFileExecOptions: BOOLEAN;
2884   (*002*)BeingDebugged: BOOLEAN;
2885   (*003*)SpareBool: BOOLEAN;
2886   (*004*)Mutant: PVOID;
2887   (*008*)ImageBaseAddress: PVOID;
2888   (*00c*)Ldr: PPEB_LDR_DATA;
2889   (*010*)ProcessParameters: PRTL_USER_PROCESS_PARAMETERS;
2890   (*014*)SubSystemData: PVOID;
2891   (*018*)ProcessHeap: PVOID;
2892   (*01c*)FastPebLock: PRTL_CRITICAL_SECTION;
2893   (*020*)FastPebLockRoutine: PVOID; // RtlEnterCriticalSection
2894   (*024*)FastPebUnlockRoutine: PVOID; // RtlLeaveCriticalSection
2895   (*028*)EnvironmentUpdateCount: ULONG;
2896   (*02c*)KernelCallbackTable: PPVOID; // List of callback functions
2897   (*030*)SystemReserved: array[0..0] of ULONG;
2898   (*034*)d034: ULONG;
2899   (*038*)FreeList: PPEB_FREE_BLOCK;
2900   (*03c*)TlsExpansionCounter: ULONG;
2901   (*040*)TlsBitmap: PVOID; // ntdll!TlsBitMap of type PRTL_BITMAP
2902   (*044*)TlsBitmapBits: array[0..1] of ULONG; // 64 bits
2903   (*04c*)ReadOnlySharedMemoryBase: PVOID;
2904   (*050*)ReadOnlySharedMemoryHeap: PVOID;
2905   (*054*)ReadOnlyStaticServerData: PTEXT_INFO;
2906   (*058*)AnsiCodePageData: PVOID;
2907   (*05c*)OemCodePageData: PVOID;
2908   (*060*)UnicodeCaseTableData: PVOID;
2909   (*064*)NumberOfProcessors: ULONG;
2910   (*068*)NtGlobalFlag: ULONG;
2911   (*06C*)Unknown01: ULONG; // Padding or something
2912   (*070*)CriticalSectionTimeout: LARGE_INTEGER;
2913   (*078*)HeapSegmentReserve: ULONG;
2914   (*07c*)HeapSegmentCommit: ULONG;
2915   (*080*)HeapDeCommitTotalFreeThreshold: ULONG;
2916   (*084*)HeapDeCommitFreeBlockThreshold: ULONG;
2917   (*088*)NumberOfHeaps: ULONG;
2918   (*08c*)MaximumNumberOfHeaps: ULONG;
2919   (*090*)ProcessHeaps: PPVOID;
2920   (*094*)GdiSharedHandleTable: PPVOID;
2921   (*098*)ProcessStarterHelper: PVOID;
2922   (*09c*)GdiDCAttributeList: ULONG;
2923   (*0a0*)LoaderLock: PCRITICAL_SECTION;
2924   (*0a4*)OSMajorVersion: ULONG;
2925   (*0a8*)OSMinorVersion: ULONG;
2926   (*0ac*)OSBuildNumber: USHORT;
2927   (*0ae*)OSCSDVersion: USHORT;
2928   (*0b0*)OSPlatformId: ULONG;
2929   (*0b4*)ImageSubsystem: ULONG;
2930   (*0b8*)ImageSubsystemMajorVersion: ULONG;
2931   (*0bc*)ImageSubsystemMinorVersion: ULONG;
2932   (*0c0*)ImageProcessAffinityMask: ULONG;
2933   (*0c4*)GdiHandleBuffer: array[0..33] of HANDLE;
2934   (*14c*)PostProcessInitRoutine: PVOID;
2935   (*150*)TlsExpansionBitmap: PVOID;
2936   (*154*)TlsExpansionBitmapBits: array[0..31] of ULONG;
2937   (*1d4*)SessionId: ULONG;
2938   // Windows 2000
2939   (*1d8*)AppCompatInfo: PVOID;
2940   (*1dc*)CSDVersion: UNICODE_STRING;
2941   end;
2942 
2943 // Verified in W2K, WXP and W2K3 using WinDbg
2944   _PEB_WXP = packed record // packed!
2945   (*000*)InheritedAddressSpace: BOOLEAN;
2946   (*001*)ReadImageFileExecOptions: BOOLEAN;
2947   (*002*)BeingDebugged: BOOLEAN;
2948   (*003*)SpareBool: BOOLEAN;
2949   (*004*)Mutant: PVOID;
2950   (*008*)ImageBaseAddress: PVOID;
2951   (*00c*)Ldr: PPEB_LDR_DATA;
2952   (*010*)ProcessParameters: PRTL_USER_PROCESS_PARAMETERS;
2953   (*014*)SubSystemData: PVOID;
2954   (*018*)ProcessHeap: PVOID;
2955   (*01c*)FastPebLock: PRTL_CRITICAL_SECTION;
2956   (*020*)FastPebLockRoutine: PVOID; // RtlEnterCriticalSection
2957   (*024*)FastPebUnlockRoutine: PVOID; // RtlLeaveCriticalSection
2958   (*028*)EnvironmentUpdateCount: ULONG;
2959   (*02c*)KernelCallbackTable: PPVOID; // List of callback functions
2960   (*030*)SystemReserved: array[0..0] of ULONG;
2961   (*034*)AtlThunkSListPtr32: PVOID; // (Windows XP)
2962   (*038*)FreeList: PPEB_FREE_BLOCK;
2963   (*03c*)TlsExpansionCounter: ULONG;
2964   (*040*)TlsBitmap: PVOID; // ntdll!TlsBitMap of type PRTL_BITMAP
2965   (*044*)TlsBitmapBits: array[0..1] of ULONG; // 64 bits
2966   (*04c*)ReadOnlySharedMemoryBase: PVOID;
2967   (*050*)ReadOnlySharedMemoryHeap: PVOID;
2968   (*054*)ReadOnlyStaticServerData: PTEXT_INFO;
2969   (*058*)AnsiCodePageData: PVOID;
2970   (*05c*)OemCodePageData: PVOID;
2971   (*060*)UnicodeCaseTableData: PVOID;
2972   (*064*)NumberOfProcessors: ULONG;
2973   (*068*)NtGlobalFlag: ULONG;
2974   (*06C*)Unknown01: ULONG; // Padding or something
2975   (*070*)CriticalSectionTimeout: LARGE_INTEGER;
2976   (*078*)HeapSegmentReserve: ULONG;
2977   (*07c*)HeapSegmentCommit: ULONG;
2978   (*080*)HeapDeCommitTotalFreeThreshold: ULONG;
2979   (*084*)HeapDeCommitFreeBlockThreshold: ULONG;
2980   (*088*)NumberOfHeaps: ULONG;
2981   (*08c*)MaximumNumberOfHeaps: ULONG;
2982   (*090*)ProcessHeaps: PPVOID;
2983   (*094*)GdiSharedHandleTable: PPVOID;
2984   (*098*)ProcessStarterHelper: PVOID;
2985   (*09c*)GdiDCAttributeList: ULONG;
2986   (*0a0*)LoaderLock: PCRITICAL_SECTION;
2987   (*0a4*)OSMajorVersion: ULONG;
2988   (*0a8*)OSMinorVersion: ULONG;
2989   (*0ac*)OSBuildNumber: USHORT;
2990   (*0ae*)OSCSDVersion: USHORT;
2991   (*0b0*)OSPlatformId: ULONG;
2992   (*0b4*)ImageSubsystem: ULONG;
2993   (*0b8*)ImageSubsystemMajorVersion: ULONG;
2994   (*0bc*)ImageSubsystemMinorVersion: ULONG;
2995   (*0c0*)ImageProcessAffinityMask: ULONG;
2996   (*0c4*)GdiHandleBuffer: array[0..33] of HANDLE;
2997   (*14c*)PostProcessInitRoutine: PVOID;
2998   (*150*)TlsExpansionBitmap: PVOID;
2999   (*154*)TlsExpansionBitmapBits: array[0..31] of ULONG;
3000   (*1d4*)SessionId: ULONG;
3001   // Windows XP
3002   (*1d8*)AppCompatFlags: ULARGE_INTEGER;
3003   (*1e0*)AppCompatFlagsUser: ULARGE_INTEGER;
3004   (*1e8*)pShimData: PVOID;
3005   (*1ec*)AppCompatInfo: PVOID;
3006   (*1f0*)CSDVersion: UNICODE_STRING;
3007   (*1f8*)ActivationContextData: PVOID; // PACTIVATION_CONTEXT_DATA
3008   (*1fc*)ProcessAssemblyStorageMap: PVOID; // PASSEMBLY_STORAGE_MAP
3009   (*200*)SystemDefaultActivationContextData: PVOID; // PACTIVATION_CONTEXT_DATA
3010   (*204*)SystemAssemblyStorageMap: PVOID; // PASSEMBLY_STORAGE_MAP
3011   (*208*)MinimumStackCommit: ULONG;
3012   end;
3013 
3014 // Verified in W2K, WXP and W2K3 using WinDbg
3015   _PEB_2K3 = packed record // packed!
3016   (*000*)InheritedAddressSpace: BOOLEAN;
3017   (*001*)ReadImageFileExecOptions: BOOLEAN;
3018   (*002*)BeingDebugged: BOOLEAN;
3019   (*003*)SpareBool: BOOLEAN;
3020   (*004*)Mutant: PVOID;
3021   (*008*)ImageBaseAddress: PVOID;
3022   (*00c*)Ldr: PPEB_LDR_DATA;
3023   (*010*)ProcessParameters: PRTL_USER_PROCESS_PARAMETERS;
3024   (*014*)SubSystemData: PVOID;
3025   (*018*)ProcessHeap: PVOID;
3026   (*01c*)FastPebLock: PRTL_CRITICAL_SECTION;
3027   (*020*)FastPebLockRoutine: PVOID; // RtlEnterCriticalSection
3028   (*024*)FastPebUnlockRoutine: PVOID; // RtlLeaveCriticalSection
3029   (*028*)EnvironmentUpdateCount: ULONG;
3030   (*02c*)KernelCallbackTable: PPVOID; // List of callback functions
3031   (*030*)SystemReserved: array[0..0] of ULONG;
3032   (*034*)ExecuteOptions: ULONG; // 2 Bits used (Windows 2003)
3033   (*038*)FreeList: PPEB_FREE_BLOCK;
3034   (*03c*)TlsExpansionCounter: ULONG;
3035   (*040*)TlsBitmap: PVOID; // ntdll!TlsBitMap of type PRTL_BITMAP
3036   (*044*)TlsBitmapBits: array[0..1] of ULONG; // 64 bits
3037   (*04c*)ReadOnlySharedMemoryBase: PVOID;
3038   (*050*)ReadOnlySharedMemoryHeap: PVOID;
3039   (*054*)ReadOnlyStaticServerData: PTEXT_INFO;
3040   (*058*)AnsiCodePageData: PVOID;
3041   (*05c*)OemCodePageData: PVOID;
3042   (*060*)UnicodeCaseTableData: PVOID;
3043   (*064*)NumberOfProcessors: ULONG;
3044   (*068*)NtGlobalFlag: ULONG;
3045   (*06C*)Unknown01: ULONG; // Padding or something
3046   (*070*)CriticalSectionTimeout: LARGE_INTEGER;
3047   (*078*)HeapSegmentReserve: ULONG;
3048   (*07c*)HeapSegmentCommit: ULONG;
3049   (*080*)HeapDeCommitTotalFreeThreshold: ULONG;
3050   (*084*)HeapDeCommitFreeBlockThreshold: ULONG;
3051   (*088*)NumberOfHeaps: ULONG;
3052   (*08c*)MaximumNumberOfHeaps: ULONG;
3053   (*090*)ProcessHeaps: PPVOID;
3054   (*094*)GdiSharedHandleTable: PPVOID;
3055   (*098*)ProcessStarterHelper: PVOID;
3056   (*09c*)GdiDCAttributeList: ULONG;
3057   (*0a0*)LoaderLock: PCRITICAL_SECTION;
3058   (*0a4*)OSMajorVersion: ULONG;
3059   (*0a8*)OSMinorVersion: ULONG;
3060   (*0ac*)OSBuildNumber: USHORT;
3061   (*0ae*)OSCSDVersion: USHORT;
3062   (*0b0*)OSPlatformId: ULONG;
3063   (*0b4*)ImageSubsystem: ULONG;
3064   (*0b8*)ImageSubsystemMajorVersion: ULONG;
3065   (*0bc*)ImageSubsystemMinorVersion: ULONG;
3066   (*0c0*)ImageProcessAffinityMask: ULONG;
3067   (*0c4*)GdiHandleBuffer: array[0..33] of HANDLE;
3068   (*14c*)PostProcessInitRoutine: PVOID;
3069   (*150*)TlsExpansionBitmap: PVOID;
3070   (*154*)TlsExpansionBitmapBits: array[0..31] of ULONG;
3071   (*1d4*)SessionId: ULONG;
3072   // Windows XP
3073   (*1d8*)AppCompatFlags: ULARGE_INTEGER;
3074   (*1e0*)AppCompatFlagsUser: ULARGE_INTEGER;
3075   (*1e8*)pShimData: PVOID;
3076   (*1ec*)AppCompatInfo: PVOID;
3077   (*1f0*)CSDVersion: UNICODE_STRING;
3078   (*1f8*)ActivationContextData: PVOID; // PACTIVATION_CONTEXT_DATA
3079   (*1fc*)ProcessAssemblyStorageMap: PVOID; // PASSEMBLY_STORAGE_MAP
3080   (*200*)SystemDefaultActivationContextData: PVOID; // PACTIVATION_CONTEXT_DATA
3081   (*204*)SystemAssemblyStorageMap: PVOID; // PASSEMBLY_STORAGE_MAP
3082   (*208*)MinimumStackCommit: ULONG;
3083   // New members in Windows 2003
3084   (*20c*)FlsCallback: PPVOID;
3085   (*210*)FlsListHead: LIST_ENTRY;
3086   (*218*)FlsBitmap: PVOID;
3087   (*21c*)FlsBitmapBits: array[0..3] of ULONG;
3088   (*22c*)FlsHighIndex: ULONG;
3089   end;
3090 
3091   {$IFDEF WINNT4}
3092   _PEB = _PEB_W2K; // Exact layout for NT4 unknown
3093   {$ENDIF WINNT4}
3094 
3095   {$IFDEF WIN2000}
3096   _PEB = _PEB_W2K;
3097   {$ENDIF WIN2000}
3098 
3099   {$IFDEF WINXP}
3100   _PEB = _PEB_WXP;
3101   {$ENDIF WINXP}
3102 
3103   {$IFDEF WIN2003}
3104   _PEB = _PEB_2K3;
3105   {$ENDIF WIN2003}
3106 
3107   PEB = _PEB;
3108   PPEB = ^_PEB;
3109   PPPEB = ^PPEB;
3110 
3111 {$IFNDEF JWA_INCLUDEMODE}
3112 // =================================================================
3113 // THREAD ENVIRONMENT BLOCK (TEB)
3114 // =================================================================
3115 
3116   PNT_TIB = ^_NT_TIB;
3117   _NT_TIB = record
3118     ExceptionList: Pointer; // ^_EXCEPTION_REGISTRATION_RECORD
3119     StackBase,
3120       StackLimit,
3121       SubSystemTib: Pointer;
3122     case Integer of
3123       0: (
3124         FiberData: Pointer
3125         );
3126       1: (
3127         Version: ULONG;
3128         ArbitraryUserPointer: Pointer;
3129         Self: PNT_TIB;
3130         )
3131   end;
3132   NT_TIB = _NT_TIB;
3133 {$ENDIF JWA_INCLUDEMODE}
3134   PPNT_TIB = ^PNT_TIB;
3135 
3136   tagACTCTX = record // not packed!
3137   (*000*)cbSize: ULONG;
3138   (*004*)dwFlags: DWORD;
3139   (*008*)lpSource: LPCWSTR;
3140   (*00C*)wProcessorArchitecture: USHORT;
3141   (*00E*)wLangId: LANGID;
3142   (*010*)lpAssemblyDirectory: LPCTSTR;
3143   (*014*)lpResourceName: LPCTSTR;
3144   (*018*)lpApplicationName: LPCTSTR;
3145   (*01C*)hModule: HMODULE;
3146   end;
3147   {$IFNDEF JWA_INCLUDEMODE}
3148   ACTCTX = tagACTCTX;
3149   PACTCTX = ^tagACTCTX;
3150   {$ENDIF JWA_INCLUDEMODE}
3151   ACTIVATION_CONTEXT = tagACTCTX;
3152   PACTIVATION_CONTEXT = ^tagACTCTX;
3153   PPACTIVATION_CONTEXT = ^PACTIVATION_CONTEXT;
3154 
3155   PRTL_ACTIVATION_CONTEXT_STACK_FRAME = ^_RTL_ACTIVATION_CONTEXT_STACK_FRAME;
3156   _RTL_ACTIVATION_CONTEXT_STACK_FRAME = record // not packed!
3157   (*000*)Previous: PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
3158   (*004*)ActivationContext: PACTIVATION_CONTEXT;
3159   (*008*)Flags: ULONG;
3160   end;
3161   RTL_ACTIVATION_CONTEXT_STACK_FRAME = _RTL_ACTIVATION_CONTEXT_STACK_FRAME;
3162   PPRTL_ACTIVATION_CONTEXT_STACK_FRAME = ^PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
3163 
3164 // Verified in XP using WinDbg
3165   _ACTIVATION_CONTEXT_STACK = record // not packed!
3166   (*000*)Flags: ULONG;
3167   (*004*)NextCookieSequenceNumber: ULONG;
3168   (*008*)ActiveFrame: PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
3169   (*00c*)FrameListCache: LIST_ENTRY;
3170   end;
3171   ACTIVATION_CONTEXT_STACK = _ACTIVATION_CONTEXT_STACK;
3172   PACTIVATION_CONTEXT_STACK = ^_ACTIVATION_CONTEXT_STACK;
3173   PPACTIVATION_CONTEXT_STACK = ^PACTIVATION_CONTEXT_STACK;
3174 
3175 // Verified in XP using WinDbg
3176   _GDI_TEB_BATCH = record // not packed!
3177   (*000*)Offset: ULONG;
3178   (*004*)HDC: HANDLE;
3179   (*008*)Buffer: array[0..309] of ULONG;
3180   end;
3181   GDI_TEB_BATCH = _GDI_TEB_BATCH;
3182   PGDI_TEB_BATCH = ^_GDI_TEB_BATCH;
3183   PPGDI_TEB_BATCH = ^PGDI_TEB_BATCH;
3184 
3185 // Verified in XP using WinDbg
3186   _Wx86ThreadState = packed record // packed!
3187   (*000*)CallBx86Eip: PULONG;
3188   (*004*)DeallocationCpu: PVOID;
3189   (*008*)UseKnownWx86Dll: BOOLEAN;
3190   (*009*)OleStubInvoked: CHAR;
3191   end;
3192   Wx86ThreadState = _Wx86ThreadState;
3193   PWx86ThreadState = ^_Wx86ThreadState;
3194   PPWx86ThreadState = ^PWx86ThreadState;
3195 
3196 // Verified in XP using WinDbg
3197   _TEB_ACTIVE_FRAME_CONTEXT = record // not packed!
3198   (*000*)Flags: ULONG;
3199   (*004*)FrameName: PCHAR;
3200   end;
3201   TEB_ACTIVE_FRAME_CONTEXT = _TEB_ACTIVE_FRAME_CONTEXT;
3202   PTEB_ACTIVE_FRAME_CONTEXT = ^_TEB_ACTIVE_FRAME_CONTEXT;
3203   PPTEB_ACTIVE_FRAME_CONTEXT = ^PTEB_ACTIVE_FRAME_CONTEXT;
3204 
3205 // Verified in XP using WinDbg
3206   PTEB_ACTIVE_FRAME = ^_TEB_ACTIVE_FRAME;
3207   _TEB_ACTIVE_FRAME = record // not packed!
3208   (*000*)Flags: ULONG;
3209   (*004*)Previous: PTEB_ACTIVE_FRAME;
3210   (*008*)Context: PTEB_ACTIVE_FRAME_CONTEXT;
3211   end;
3212   TEB_ACTIVE_FRAME = _TEB_ACTIVE_FRAME;
3213   PPTEB_ACTIVE_FRAME = ^PTEB_ACTIVE_FRAME;
3214 
3215 
3216 // Verified in W2K, WXP and W2K3 using WinDbg
3217   _TEB = record // not packed!
3218   (*000*)NtTib: NT_TIB;
3219   (*01c*)EnvironmentPointer: PVOID;
3220   (*020*)ClientId: CLIENT_ID;
3221   (*028*)ActiveRpcHandle: PVOID;
3222   (*02c*)ThreadLocalStoragePointer: PVOID;
3223   (*030*)Peb: PPEB;
3224   (*034*)LastErrorValue: ULONG;
3225   (*038*)CountOfOwnedCriticalSections: ULONG;
3226   (*03c*)CsrClientThread: PVOID;
3227   (*040*)Win32ThreadInfo: PVOID;
3228   (*044*)User32Reserved: array[0..25] of ULONG;
3229   (*0ac*)UserReserved: array[0..4] of ULONG;
3230   (*0c0*)WOW32Reserved: PVOID;
3231   (*0c4*)CurrentLocale: LCID;
3232   (*0c8*)FpSoftwareStatusRegister: ULONG;
3233   (*0cc*)SystemReserved1: array[0..53] of PVOID;
3234   (*1a4*)ExceptionCode: LONG;
3235   (*1a8*)ActivationContextStack: ACTIVATION_CONTEXT_STACK;
3236   (*1bc*)SpareBytes1: array[0..23] of UCHAR;
3237   (*1d4*)GdiTebBatch: GDI_TEB_BATCH;
3238   (*6b4*)RealClientId: CLIENT_ID;
3239   (*6bc*)GdiCachedProcessHandle: PVOID;
3240   (*6c0*)GdiClientPID: ULONG;
3241   (*6c4*)GdiClientTID: ULONG;
3242   (*6c8*)GdiThreadLocalInfo: PVOID;
3243   (*6cc*)Win32ClientInfo: array[0..61] of ULONG;
3244   (*7c4*)glDispatchTable: array[0..232] of PVOID;
3245   (*b68*)glReserved1: array[0..28] of ULONG;
3246   (*bdc*)glReserved2: PVOID;
3247   (*be0*)glSectionInfo: PVOID;
3248   (*be4*)glSection: PVOID;
3249   (*be8*)glTable: PVOID;
3250   (*bec*)glCurrentRC: PVOID;
3251   (*bf0*)glContext: PVOID;
3252   (*bf4*)LastStatusValue: ULONG;
3253   (*bf8*)StaticUnicodeString: UNICODE_STRING;
3254   (*c00*)StaticUnicodeBuffer: array[0..MAX_PATH] of WCHAR;
3255   (*e0a*)Padding: USHORT;
3256   (*e0c*)DeallocationStack: PVOID;
3257   (*e10*)TlsSlots: array[0..63] of PVOID;
3258   (*f10*)TlsLinks: LIST_ENTRY;
3259   (*f18*)Vdm: PVOID;
3260   (*f1c*)ReservedForNtRpc: PVOID;
3261   (*f20*)DbgSsReserved: array[0..1] of PVOID;
3262     case Integer of
3263   (*   *)0: (
3264   (*f28*)HardErrorMode: ULONG // (Windows 2003)
3265         );
3266   (*   *)1: (
3267   (*f28*)HardErrorsAreDisabled: ULONG; // (Windows XP)
3268   (*f2c*)Instrumentation: array[0..15] of PVOID;
3269   (*f6c*)WinSockData: PVOID;
3270   (*f70*)GdiBatchCount: ULONG;
3271   (*f74*)InDbgPrint: BOOLEAN;
3272   (*f75*)FreeStackOnTermination: BOOLEAN;
3273   (*f76*)HasFiberData: BOOLEAN;
3274   (*f77*)IdealProcessor: BOOLEAN;
3275   (*f78*)Spare3: ULONG;
3276   (*f7c*)ReservedForPerf: PVOID;
3277   (*f80*)ReservedForOle: PVOID;
3278   (*f84*)WaitingOnLoaderLock: PVOID;
3279   (*f88*)Wx86Thread: Wx86ThreadState;
3280   (*f94*)TlsExpansionSlots: PPVOID;
3281   (*f98*)ImpersonationLocale: LCID;
3282   (*f9c*)IsImpersonating: ULONG;
3283   (*fa0*)NlsCache: PVOID;
3284   (*fa4*)pShimData: PVOID;
3285   (*fa8*)HeapVirtualAffinity: ULONG;
3286   (*fac*)CurrentTransactionHandle: PVOID;
3287   (*fb0*)ActiveFrame: PTEB_ACTIVE_FRAME;
3288         case Integer of
3289           0: (
3290   (*fb4*)SafeThunkCall: BOOLEAN; // Before Windows 2003
3291   (*fb5*)BooleanSpare: array[0..2] of BOOLEAN // Before Windows 2003
3292             );
3293           1: (
3294   (*fb4*)FlsData: PVOID; // Starting with Windows 2003
3295             )
3296           )
3297   end;
3298   TEB = _TEB;
3299   PTEB = ^_TEB;
3300   PPTEB = ^PTEB;
3301 
3302 type
3303   _OBJECT_NAME_INFORMATION = record
3304     Name: UNICODE_STRING;
3305   end;
3306   OBJECT_NAME_INFORMATION = _OBJECT_NAME_INFORMATION;
3307   POBJECT_NAME_INFORMATION = ^OBJECT_NAME_INFORMATION;
3308   TObjectNameInformation = OBJECT_NAME_INFORMATION;
3309   PObjectNameInformation = ^OBJECT_NAME_INFORMATION;
3310 
3311 const
3312   NtCurrentProcess = HANDLE(-1);
3313   NtCurrentThread = HANDLE(-2);
3314 
3315 // Object Manager specific stuff
3316   OBJ_NAME_PATH_SEPARATOR = '\';
3317 
3318 // Object Manager Object Type Specific Access Rights.
3319   OBJECT_TYPE_CREATE = $0001;
3320   OBJECT_TYPE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or $1;
3321 
3322 // Object Manager Directory Specific Access Rights.
3323   DIRECTORY_QUERY = $0001;
3324   DIRECTORY_TRAVERSE = $0002;
3325   DIRECTORY_CREATE_OBJECT = $0004;
3326   DIRECTORY_CREATE_SUBDIRECTORY = $0008;
3327   DIRECTORY_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or $F;
3328 
3329 // Object Manager Symbolic Link Specific Access Rights.
3330   SYMBOLIC_LINK_QUERY = $0001;
3331   SYMBOLIC_LINK_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or $1;
3332 
3333   {$IFNDEF JWA_INCLUDEMODE}
3334   DUPLICATE_CLOSE_SOURCE = $00000001;
3335   DUPLICATE_SAME_ACCESS = $00000002;
3336   DUPLICATE_SAME_ATTRIBUTES = $00000004;
3337   {$ENDIF JWA_INCLUDEMODE}
3338 
3339 //
3340 // Define the access check value for any access
3341 //
3342 //
3343 // The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
3344 // ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
3345 // constants *MUST* always be in sync.
3346 //
3347 //
3348 // FILE_SPECIAL_ACCESS is checked by the NT I/O system the same as FILE_ANY_ACCESS.
3349 // The file systems, however, may add additional access checks for I/O and FS controls
3350 // that use this value.
3351 //
3352   {$IFNDEF JWA_INCLUDEMODE}
3353   FILE_ANY_ACCESS = 0;
3354   FILE_SPECIAL_ACCESS = FILE_ANY_ACCESS;
3355   FILE_READ_ACCESS = $0001; // file & pipe
3356   FILE_WRITE_ACCESS = $0002; // file & pipe
3357 
3358 //
3359 // Define share access rights to files and directories
3360 //
3361   FILE_SHARE_READ = $00000001; // JwaWindows.pas
3362   FILE_SHARE_WRITE = $00000002; // JwaWindows.pas
3363   FILE_SHARE_DELETE = $00000004; // JwaWindows.pas
3364   {$ENDIF JWA_INCLUDEMODE}
3365   FILE_SHARE_VALID_FLAGS = $00000007;
3366 
3367 //
3368 // Define the file attributes values
3369 //
3370 // Note:  = $00000008 is reserved for use for the old DOS VOLID (volume ID)
3371 //        and is therefore not considered valid in NT.
3372 //
3373 // Note:  = $00000010 is reserved for use for the old DOS SUBDIRECTORY flag
3374 //        and is therefore not considered valid in NT.  This flag has
3375 //        been disassociated with file attributes since the other flags are
3376 //        protected with READ_ and WRITE_ATTRIBUTES access to the file.
3377 //
3378 // Note:  Note also that the order of these flags is set to allow both the
3379 //        FAT and the Pinball File Systems to directly set the attributes
3380 //        flags in attributes words without having to pick each flag out
3381 //        individually.  The order of these flags should not be changed!
3382 //
3383   {$IFNDEF JWA_INCLUDEMODE}
3384   FILE_ATTRIBUTE_READONLY = $00000001; // JwaWindows.pas
3385   FILE_ATTRIBUTE_HIDDEN = $00000002; // JwaWindows.pas
3386   FILE_ATTRIBUTE_SYSTEM = $00000004; // JwaWindows.pas
3387 //OLD DOS VOLID                               = $00000008
3388 
3389   FILE_ATTRIBUTE_DIRECTORY = $00000010; // JwaWindows.pas
3390   FILE_ATTRIBUTE_ARCHIVE = $00000020; // JwaWindows.pas
3391   FILE_ATTRIBUTE_DEVICE = $00000040; // JwaWindows.pas
3392   FILE_ATTRIBUTE_NORMAL = $00000080; // JwaWindows.pas
3393 
3394   FILE_ATTRIBUTE_TEMPORARY = $00000100; // JwaWindows.pas
3395   FILE_ATTRIBUTE_SPARSE_FILE = $00000200; // JwaWindows.pas
3396   FILE_ATTRIBUTE_REPARSE_POINT = $00000400; // JwaWindows.pas
3397   FILE_ATTRIBUTE_COMPRESSED = $00000800; // JwaWindows.pas
3398 
3399   FILE_ATTRIBUTE_OFFLINE = $00001000; // JwaWindows.pas
3400   FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = $00002000; // JwaWindows.pas
3401   FILE_ATTRIBUTE_ENCRYPTED = $00004000; // JwaWindows.pas
3402 
3403 //
3404 //  This definition is old and will disappear shortly
3405 //
3406 
3407   FILE_ATTRIBUTE_VALID_FLAGS = $00007FB7;
3408   FILE_ATTRIBUTE_VALID_SET_FLAGS = $000031A7;
3409   {$ENDIF JWA_INCLUDEMODE}
3410 
3411 //
3412 // Define the create disposition values
3413 //
3414 
3415   FILE_SUPERSEDE = $00000000;
3416   FILE_OPEN = $00000001;
3417   FILE_CREATE = $00000002;
3418   FILE_OPEN_IF = $00000003;
3419   FILE_OVERWRITE = $00000004;
3420   FILE_OVERWRITE_IF = $00000005;
3421   FILE_MAXIMUM_DISPOSITION = $00000005;
3422 
3423 //
3424 // Define the create/open option flags
3425 //
3426 
3427   FILE_DIRECTORY_FILE = $00000001;
3428   FILE_WRITE_THROUGH = $00000002;
3429   FILE_SEQUENTIAL_ONLY = $00000004;
3430   FILE_NO_INTERMEDIATE_BUFFERING = $00000008;
3431 
3432   FILE_SYNCHRONOUS_IO_ALERT = $00000010;
3433   FILE_SYNCHRONOUS_IO_NONALERT = $00000020;
3434   FILE_NON_DIRECTORY_FILE = $00000040;
3435   FILE_CREATE_TREE_CONNECTION = $00000080;
3436 
3437   FILE_COMPLETE_IF_OPLOCKED = $00000100;
3438   FILE_NO_EA_KNOWLEDGE = $00000200;
3439   FILE_OPEN_FOR_RECOVERY = $00000400;
3440   FILE_RANDOM_ACCESS = $00000800;
3441 
3442   FILE_DELETE_ON_CLOSE = $00001000;
3443   FILE_OPEN_BY_FILE_ID = $00002000;
3444   FILE_OPEN_FOR_BACKUP_INTENT = $00004000;
3445   FILE_NO_COMPRESSION = $00008000;
3446 
3447   FILE_RESERVE_OPFILTER = $00100000;
3448   FILE_OPEN_REPARSE_POINT = $00200000;
3449   FILE_OPEN_NO_RECALL = $00400000;
3450   FILE_OPEN_FOR_FREE_SPACE_QUERY = $00800000;
3451 
3452   FILE_COPY_STRUCTURED_STORAGE = $00000041;
3453   FILE_STRUCTURED_STORAGE = $00000441;
3454 
3455   FILE_VALID_OPTION_FLAGS = $00FFFFFF;
3456   FILE_VALID_PIPE_OPTION_FLAGS = $00000032;
3457   FILE_VALID_MAILSLOT_OPTION_FLAGS = $00000032;
3458   FILE_VALID_SET_FLAGS = $00000036;
3459 
3460 //
3461 // Define the I/O status information return values for NtCreateFile/NtOpenFile
3462 //
3463 
3464   FILE_SUPERSEDED = $00000000;
3465   FILE_OPENED = $00000001;
3466   FILE_CREATED = $00000002;
3467   FILE_OVERWRITTEN = $00000003;
3468   FILE_EXISTS = $00000004;
3469   FILE_DOES_NOT_EXIST = $00000005;
3470 
3471 //
3472 // Define special ByteOffset parameters for read and write operations
3473 //
3474 
3475   FILE_WRITE_TO_END_OF_FILE = $FFFFFFFF;
3476   FILE_USE_FILE_POINTER_POSITION = $FFFFFFFE;
3477 
3478 //
3479 // Define alignment requirement values
3480 //
3481 
3482   FILE_BYTE_ALIGNMENT = $00000000;
3483   FILE_WORD_ALIGNMENT = $00000001;
3484   FILE_LONG_ALIGNMENT = $00000003;
3485   FILE_QUAD_ALIGNMENT = $00000007;
3486   FILE_OCTA_ALIGNMENT = $0000000F;
3487   FILE_32_BYTE_ALIGNMENT = $0000001F;
3488   FILE_64_BYTE_ALIGNMENT = $0000003F;
3489   FILE_128_BYTE_ALIGNMENT = $0000007F;
3490   FILE_256_BYTE_ALIGNMENT = $000000FF;
3491   FILE_512_BYTE_ALIGNMENT = $000001FF;
3492 
3493 //
3494 // Define the maximum length of a filename string
3495 //
3496 
3497   MAXIMUM_FILENAME_LENGTH = 256;
3498 
3499 //
3500 // Define the various device characteristics flags
3501 //
3502 
3503   FILE_REMOVABLE_MEDIA = $00000001;
3504   FILE_READ_ONLY_DEVICE = $00000002;
3505   FILE_FLOPPY_DISKETTE = $00000004;
3506   FILE_WRITE_ONCE_MEDIA = $00000008;
3507   FILE_REMOTE_DEVICE = $00000010;
3508   FILE_DEVICE_IS_MOUNTED = $00000020;
3509   FILE_VIRTUAL_VOLUME = $00000040;
3510   FILE_AUTOGENERATED_DEVICE_NAME = $00000080;
3511   FILE_DEVICE_SECURE_OPEN = $00000100;
3512 
3513 //
3514 // Define kernel debugger print prototypes and macros.
3515 //
cannotnull3516 // N.B. The following function cannot be directly imported because there are
3517 //      a few places in the source tree where this function is redefined.
3518 //
3519 //procedure DbgBreakPoint(); stdcall;
3520 //procedure DbgUserBreakPoint(); stdcall;
3521 //procedure DbgBreakPointWithStatus(Status: ULONG); stdcall;
3522 
3523 //// BEGIN: Reverse function forwarders and custom functions
3524 //// Using Kernel32 function with same functionality for macros and "future version" functions
3525 (* Compatibility: All *)
3526 procedure RtlCopyMemory(
3527   Destination: PVOID;
3528   Source: PVOID;
3529   Length: SIZE_T
3530   ); stdcall; // Own replacement function
3531 
3532 (* XREF: see GetLastError()! *)
3533 (* Compatibility: All *)
3534 // This functions was introduced with Windows XP. The Kernel32 version
3535 // is a function forwarder for this function.
3536 function RtlGetLastWin32Error(): DWORD; external 'kernel32.dll' name 'GetLastError'; // imported as kernel32!GetLastError
3537 
3538 (* XREF: see SetLastError()! *)
3539 (* Compatibility: All *)
3540 // This functions was introduced with Windows XP. The Kernel32 version
forwardernull3541 // is a function forwarder for this function.
3542 procedure RtlSetLastWin32Error(dwErrCode: DWORD); external 'kernel32.dll' name 'SetLastError'; // imported as kernel32!SetLastError
3543 
tonull3544 // Own function to retrieve the process's heap handle
3545 (* XREF: see GetProcessHeap()! *)
3546 (* Compatibility: All *)
3547 function NtpGetProcessHeap(): HANDLE;
3548 
3549 // Own function to retrieve the thread environment block (TEB) pointer
3550 (* Compatibility: All *)
3551 function NtpCurrentTeb(): PTEB;
3552 
3553 // Own function to retrieve the process environment block (PEB) pointer
3554 (* Compatibility: All *)
3555 function RtlpGetCurrentPeb(): PPEB;
3556 
3557 // No FASTCALL directive exists in Delphi so we write our own versions ...
3558 // Own function to swap bytes in 16bit values
3559 function RtlUshortByteSwap(Source: USHORT): USHORT;
3560 
3561 // Own function to swap bytes in 32bit values
3562 function RtlUlongByteSwap(Source: ULONG): ULONG;
3563 
3564 // Own function to swap bytes in 64bit values
3565 function RtlUlonglongByteSwap(Source: ULONGLONG): ULONGLONG;
3566 
3567 // Resembles the RtlValidateUnicodeString() function available from Windows XP
3568 // on exactly as it is on this OS version, except for the calling convention.
3569 function RtlpValidateUnicodeString(dwMustBeNull: DWORD; UnicodeString: PUNICODE_STRING): NTSTATUS;
3570 
3571 // Resembles the RtlValidateUnicodeString() function available from Windows XP
3572 // on, but does not require the first parameter which anyway must be zero.
3573 function RtlpValidateUnicodeString2(UnicodeString: PUNICODE_STRING): NTSTATUS;
3574 
3575 //// END  : Reverse function forwarders and custom functions
3576 
3577 //// BEGIN: Function prototypes
3578 // Compatibility: WXP, 2K3
3579 function  CsrGetProcessId(): DWORD; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3580 
3581 // Compatibility: WXP, 2K3
3582 function  DbgQueryDebugFilterState(
3583     ComponentId : ULONG;
3584     Level : ULONG
3585   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3586 
3587 // Compatibility: WXP, 2K3
3588 function  DbgSetDebugFilterState(
3589     ComponentId : ULONG;
3590     Level : ULONG;
3591     State : BOOLEAN
3592   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3593 
3594 // Unknown return value, maybe NTSTATUS?
3595 // Compatibility: NT4, W2K, WXP, 2K3
3596 function  KiRaiseUserExceptionDispatcher(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3597 
3598 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3599 function  LdrAccessResource(
3600     hModule : HANDLE;
3601     ResourceDataEntry : PIMAGE_RESOURCE_DATA_ENTRY;
3602     Address : PPVOID;
3603     dwSize : PULONG
3604   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3605 
3606 // Compatibility: W2K, WXP, 2K3
3607 function  LdrAlternateResourcesEnabled(): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3608 
3609 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3610 function  LdrDisableThreadCalloutsForDll(
3611     hModule : HANDLE
3612   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3613 
3614 // This function is very similar to GetModuleHandle() from Kernel32.dll.
3615 // Refer to the PSDK for additional information. Usually the same flags
3616 // apply.
3617 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3618 function  LdrGetDllHandle(
3619     pwPath : PWORD;
3620     pReserved : PVOID;
3621     pusPath : PUNICODE_STRING;
3622     var phModule : HANDLE
3623   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3624 
3625 // This function is very similar to GetProcAddress() from Kernel32.dll.
3626 // Refer to the PSDK for additional information. Usually the same flags
3627 // apply.
3628 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3629 function  LdrGetProcedureAddress(
3630     hModule : HANDLE;
3631     dwOrdinal : ULONG;
3632     psName : PSTRING;
3633     var pProcedure : PVOID
3634   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3635 
3636 // This function is very similar to LoadLibrary() from Kernel32.dll. Refer
3637 // to the PSDK for additional information. Usually the same flags apply.
3638 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3639 function  LdrLoadDll(
3640     pwPath : PWORD;
3641     pdwFlags : PDWORD;
3642     pusPath : PUNICODE_STRING;
3643     var phModule : HANDLE
3644   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3645 
3646 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3647 function  LdrQueryImageFileExecutionOptions(
3648     pusImagePath : PUNICODE_STRING;
3649     pwOptionName : PWORD;
3650     dwRequestedType : DWORD;
3651     pData : PVOID;
3652     dwSize : DWORD;
3653     pdwSize : PDWORD
3654   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3655 
3656 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3657 function  LdrQueryProcessModuleInformation(
3658     psmi : PSYSTEM_MODULE_INFORMATION;
3659     dwSize : DWORD;
3660     pdwSize : PDWORD
3661   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3662 
3663 // This function is very similar to TerminateProcess() from Kernel32.dll.
3664 // Refer to the PSDK for additional information. Usually the same flags
3665 // apply.
3666 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3667 procedure LdrShutdownProcess(); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3668 
3669 // This function is very similar to TerminateThread() from Kernel32.dll.
3670 // Refer to the PSDK for additional information. Usually the same flags
3671 // apply.
3672 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3673 procedure LdrShutdownThread(); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3674 
3675 // This function is very similar to FreeLibrary() from Kernel32.dll. Refer
3676 // to the PSDK for additional information. Usually the same flags apply.
3677 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3678 function  LdrUnloadDll(
3679     hModule : HANDLE
3680   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3681 
3682 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3683 function  NtAcceptConnectPort(
3684     PortHandle : PHANDLE;
3685     PortIdentifier : ULONG;
3686     Message : PPORT_MESSAGE;
3687     Accept : BOOLEAN;
3688     WriteSection : PPORT_SECTION_WRITE;
3689     ReadSection : PPORT_SECTION_READ
3690   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3691 function  ZwAcceptConnectPort(PortHandle: PHANDLE; PortIdentifier: ULONG; Message: PPORT_MESSAGE; Accept: BOOLEAN; WriteSection: PPORT_SECTION_WRITE; ReadSection: PPORT_SECTION_READ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;
3692    {$ENDIF}
3693 
3694 // This function is very similar to AccessCheck() from Advapi32.dll. Refer
3695 // to the PSDK for additional information. Usually the same flags apply.
3696 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3697 function  NtAccessCheck(
3698     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3699     TokenHandle : HANDLE;
3700     DesiredAccess : ACCESS_MASK;
3701     GenericMapping : PGENERIC_MAPPING;
3702     PrivilegeSet : PPRIVILEGE_SET;
3703     PrivilegeSetLength : PULONG;
3704     GrantedAccess : PACCESS_MASK;
3705     AccessStatus : PBOOLEAN
3706   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3707 function  ZwAccessCheck(SecurityDescriptor: PSECURITY_DESCRIPTOR; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; GenericMapping: PGENERIC_MAPPING; PrivilegeSet: PPRIVILEGE_SET; PrivilegeSetLength: PULONG; GrantedAccess: PACCESS_MASK;
3708     AccessStatus: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3709 
3710 // This function is very similar to AccessCheckAndAuditAlarm() from
3711 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
3712 // same flags apply.
3713 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3714 function  NtAccessCheckAndAuditAlarm(
3715     SubsystemName : PUNICODE_STRING;
3716     HandleId : PVOID;
3717     ObjectTypeName : PUNICODE_STRING;
3718     ObjectName : PUNICODE_STRING;
3719     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3720     DesiredAccess : ACCESS_MASK;
3721     GenericMapping : PGENERIC_MAPPING;
3722     ObjectCreation : BOOLEAN;
3723     GrantedAccess : PACCESS_MASK;
3724     AccessStatus : PBOOLEAN;
3725     GenerateOnClose : PBOOLEAN
3726   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3727 function  ZwAccessCheckAndAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; DesiredAccess: ACCESS_MASK;
3728     GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN; GrantedAccess: PACCESS_MASK; AccessStatus: PBOOLEAN; GenerateOnClose: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3729 
3730 // This function is very similar to AccessCheckByType() from Advapi32.dll.
3731 // Refer to the PSDK for additional information. Usually the same flags
3732 // apply.
3733 // Compatibility: W2K, WXP, 2K3
3734 function  NtAccessCheckByType(
3735     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3736     PrincipalSelfSid : PSID;
3737     TokenHandle : HANDLE;
3738     DesiredAccess : ACCESS_MASK;
3739     ObjectTypeList : POBJECT_TYPE_LIST;
3740     ObjectTypeListLength : ULONG;
3741     GenericMapping : PGENERIC_MAPPING;
3742     PrivilegeSet : PPRIVILEGE_SET;
3743     PrivilegeSetLength : PULONG;
3744     GrantedAccess : PACCESS_MASK;
3745     AccessStatus : PULONG
3746   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3747 function  ZwAccessCheckByType(SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG;
3748     GenericMapping: PGENERIC_MAPPING; PrivilegeSet: PPRIVILEGE_SET; PrivilegeSetLength: PULONG; GrantedAccess: PACCESS_MASK; AccessStatus: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3749 
3750 // This function is very similar to AccessCheckByTypeAndAuditAlarm() from
3751 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
3752 // same flags apply.
3753 // Compatibility: W2K, WXP, 2K3
3754 function  NtAccessCheckByTypeAndAuditAlarm(
3755     SubsystemName : PUNICODE_STRING;
3756     HandleId : PVOID;
3757     ObjectTypeName : PUNICODE_STRING;
3758     ObjectName : PUNICODE_STRING;
3759     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3760     PrincipalSelfSid : PSID;
3761     DesiredAccess : ACCESS_MASK;
3762     AuditType : AUDIT_EVENT_TYPE;
3763     Flags : ULONG;
3764     ObjectTypeList : POBJECT_TYPE_LIST;
3765     ObjectTypeListLength : ULONG;
3766     GenericMapping : PGENERIC_MAPPING;
3767     ObjectCreation : BOOLEAN;
3768     GrantedAccess : PACCESS_MASK;
3769     AccessStatus : PULONG;
3770     GenerateOnClose : PBOOLEAN
3771   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3772 function  ZwAccessCheckByTypeAndAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID;
3773     DesiredAccess: ACCESS_MASK; AuditType: AUDIT_EVENT_TYPE; Flags: ULONG; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG; GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN; GrantedAccess: PACCESS_MASK;
3774     AccessStatus: PULONG; GenerateOnClose: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3775 
3776 // This function is very similar to AccessCheckByTypeResultList() from
3777 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
3778 // same flags apply.
3779 // Compatibility: W2K, WXP, 2K3
3780 function  NtAccessCheckByTypeResultList(
3781     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3782     PrincipalSelfSid : PSID;
3783     TokenHandle : HANDLE;
3784     DesiredAccess : ACCESS_MASK;
3785     ObjectTypeList : POBJECT_TYPE_LIST;
3786     ObjectTypeListLength : ULONG;
3787     GenericMapping : PGENERIC_MAPPING;
3788     PrivilegeSet : PPRIVILEGE_SET;
3789     PrivilegeSetLength : PULONG;
3790     GrantedAccessList : PACCESS_MASK;
3791     AccessStatusList : PULONG
3792   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3793 function  ZwAccessCheckByTypeResultList(SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG;
3794     GenericMapping: PGENERIC_MAPPING; PrivilegeSet: PPRIVILEGE_SET; PrivilegeSetLength: PULONG; GrantedAccessList: PACCESS_MASK; AccessStatusList: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3795 
3796 // This function is very similar to
3797 // AccessCheckByTypeResultListAndAuditAlarm() from Advapi32.dll. Refer to
3798 // the PSDK for additional information. Usually the same flags apply.
3799 // Compatibility: W2K, WXP, 2K3
3800 function  NtAccessCheckByTypeResultListAndAuditAlarm(
3801     SubsystemName : PUNICODE_STRING;
3802     HandleId : PVOID;
3803     ObjectTypeName : PUNICODE_STRING;
3804     ObjectName : PUNICODE_STRING;
3805     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3806     PrincipalSelfSid : PSID;
3807     DesiredAccess : ACCESS_MASK;
3808     AuditType : AUDIT_EVENT_TYPE;
3809     Flags : ULONG;
3810     ObjectTypeList : POBJECT_TYPE_LIST;
3811     ObjectTypeListLength : ULONG;
3812     GenericMapping : PGENERIC_MAPPING;
3813     ObjectCreation : BOOLEAN;
3814     GrantedAccessList : PACCESS_MASK;
3815     AccessStatusList : PULONG;
3816     GenerateOnClose : PULONG
3817   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3818 function  ZwAccessCheckByTypeResultListAndAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID;
3819     DesiredAccess: ACCESS_MASK; AuditType: AUDIT_EVENT_TYPE; Flags: ULONG; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG; GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN; GrantedAccessList: PACCESS_MASK;
3820     AccessStatusList: PULONG; GenerateOnClose: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3821 
3822 // This function is very similar to
3823 // AccessCheckByTypeResultListAndAuditAlarmByHandle() from Advapi32.dll.
3824 // Refer to the PSDK for additional information. Usually the same flags
3825 // apply.
3826 // Compatibility: W2K, WXP, 2K3
3827 function  NtAccessCheckByTypeResultListAndAuditAlarmByHandle(
3828     SubsystemName : PUNICODE_STRING;
3829     HandleId : PVOID;
3830     TokenHandle : HANDLE;
3831     ObjectTypeName : PUNICODE_STRING;
3832     ObjectName : PUNICODE_STRING;
3833     SecurityDescriptor : PSECURITY_DESCRIPTOR;
3834     PrincipalSelfSid : PSID;
3835     DesiredAccess : ACCESS_MASK;
3836     AuditType : AUDIT_EVENT_TYPE;
3837     Flags : ULONG;
3838     ObjectTypeList : POBJECT_TYPE_LIST;
3839     ObjectTypeListLength : ULONG;
3840     GenericMapping : PGENERIC_MAPPING;
3841     ObjectCreation : BOOLEAN;
3842     GrantedAccessList : PACCESS_MASK;
3843     AccessStatusList : PULONG;
3844     GenerateOnClose : PULONG
3845   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3846 function  ZwAccessCheckByTypeResultListAndAuditAlarmByHandle(SubsystemName: PUNICODE_STRING; HandleId: PVOID; TokenHandle: HANDLE; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR;
3847     PrincipalSelfSid: PSID; DesiredAccess: ACCESS_MASK; AuditType: AUDIT_EVENT_TYPE; Flags: ULONG; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG; GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN;
3848     GrantedAccessList: PACCESS_MASK; AccessStatusList: PULONG; GenerateOnClose: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3849 
3850 // Compatibility: NT4, W2K, WXP, 2K3
3851 function  NtAddAtom(
3852     Str : PWSTR;
3853     StringLength : ULONG;
3854     Atom : PUSHORT
3855   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3856 function  ZwAddAtom(Str: PWSTR; StringLength: ULONG; Atom: PUSHORT): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3857 
3858 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3859 function  NtAdjustGroupsToken(
3860     TokenHandle : HANDLE;
3861     ResetToDefault : BOOLEAN;
3862     NewState : PTOKEN_GROUPS;
3863     BufferLength : ULONG;
3864     PreviousState : PTOKEN_GROUPS;
3865     ReturnLength : PULONG
3866   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3867 function  ZwAdjustGroupsToken(TokenHandle: HANDLE; ResetToDefault: BOOLEAN; NewState: PTOKEN_GROUPS; BufferLength: ULONG; PreviousState: PTOKEN_GROUPS; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3868 
3869 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3870 function  NtAdjustPrivilegesToken(
3871     TokenHandle : HANDLE;
3872     DisableAllPrivileges : BOOLEAN;
3873     NewState : PTOKEN_PRIVILEGES;
3874     BufferLength : ULONG;
3875     PreviousState : PTOKEN_PRIVILEGES;
3876     ReturnLength : PULONG
3877   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3878 function  ZwAdjustPrivilegesToken(TokenHandle: HANDLE; DisableAllPrivileges: BOOLEAN; NewState: PTOKEN_PRIVILEGES; BufferLength: ULONG; PreviousState: PTOKEN_PRIVILEGES; ReturnLength: PULONG): NTSTATUS; stdcall;
3879     {$IFNDEF RTDL}external ntdll;{$ENDIF}
3880 
3881 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3882 function  NtAlertResumeThread(
3883     ThreadHandle : HANDLE;
3884     PreviousSuspendCount : PULONG
3885   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3886 function  ZwAlertResumeThread(ThreadHandle: HANDLE; PreviousSuspendCount: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3887 
3888 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3889 function  NtAlertThread(
3890     ThreadHandle : HANDLE
3891   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3892 function  ZwAlertThread(ThreadHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3893 
3894 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3895 function  NtAllocateLocallyUniqueId(
3896     Luid : PLUID
3897   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3898 function  ZwAllocateLocallyUniqueId(Luid: PLUID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3899 
3900 // Compatibility: W2K, WXP, 2K3
3901 function  NtAllocateUserPhysicalPages(
3902     ProcessHandle : HANDLE;
3903     NumberOfPages : PULONG;
3904     PageFrameNumbers : PULONG
3905   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3906 function  ZwAllocateUserPhysicalPages(ProcessHandle: HANDLE; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3907 
3908 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3909 function  NtAllocateUuids(
3910     UuidLastTimeAllocated : PLARGE_INTEGER;
3911     UuidDeltaTime : PULONG;
3912     UuidSequenceNumber : PULONG;
3913     UuidSeed : PUCHAR
3914   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3915 function  ZwAllocateUuids(UuidLastTimeAllocated: PLARGE_INTEGER; UuidDeltaTime: PULONG; UuidSequenceNumber: PULONG; UuidSeed: PUCHAR): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3916 
3917 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3918 function  NtAllocateVirtualMemory(
3919     ProcessHandle : HANDLE;
3920     BaseAddress : PPVOID;
3921     ZeroBits : ULONG;
3922     AllocationSize : PULONG;
3923     AllocationType : ULONG;
3924     Protect : ULONG
3925   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3926 function  ZwAllocateVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PPVOID; ZeroBits: ULONG; AllocationSize: PULONG; AllocationType: ULONG; Protect: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3927 
3928 // Compatibility: W2K, WXP, 2K3
3929 function  NtAreMappedFilesTheSame(
3930     Address1 : PVOID;
3931     Address2 : PVOID
3932   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3933 function  ZwAreMappedFilesTheSame(Address1: PVOID; Address2: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3934 
3935 // Compatibility: W2K, WXP, 2K3
3936 function  NtAssignProcessToJobObject(
3937     JobHandle : HANDLE;
3938     ProcessHandle : HANDLE
3939   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3940 function  ZwAssignProcessToJobObject(JobHandle: HANDLE; ProcessHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3941 
3942 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3943 function  NtCallbackReturn(
3944     Result_ : PVOID;
3945     ResultLength : ULONG;
3946     Status : NTSTATUS
3947   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3948 function  ZwCallbackReturn(Result_: PVOID; ResultLength: ULONG; Status: NTSTATUS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3949 
3950 // Compatibility: W2K, WXP, 2K3
3951 function  NtCancelDeviceWakeupRequest(
3952     DeviceHandle : HANDLE
3953   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3954 function  ZwCancelDeviceWakeupRequest(DeviceHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3955 
3956 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3957 function  NtCancelIoFile(
3958     FileHandle : HANDLE;
3959     IoStatusBlock : PIO_STATUS_BLOCK
3960   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3961 function  ZwCancelIoFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3962 
3963 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3964 function  NtCancelTimer(
3965     TimerHandle : HANDLE;
3966     PreviousState : PBOOLEAN
3967   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3968 function  ZwCancelTimer(TimerHandle: HANDLE; PreviousState: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3969 
3970 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3971 function  NtClearEvent(
3972     EventHandle : HANDLE
3973   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3974 function  ZwClearEvent(EventHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3975 
3976 // This function is very similar to CloseHandle() from Kernel32.dll. Refer
3977 // to the PSDK for additional information. Usually the same flags apply.
3978 // Documented in the DDK as ZwClose().
3979 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3980 {$IFNDEF JWA_INCLUDEMODE}
3981 function  NtClose(
3982     Handle : HANDLE
3983   ): NTSTATUS; stdcall; {$IFNDEF RTDL} external ntdll; {$ENDIF}
3984 {$ENDIF JWA_INCLUDEMODE}
3985 
3986 function  ZwClose(Handle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3987 
3988 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3989 function  NtCloseObjectAuditAlarm(
3990     SubsystemName : PUNICODE_STRING;
3991     HandleId : PVOID;
3992     GenerateOnClose : BOOLEAN
3993   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3994 function  ZwCloseObjectAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PVOID; GenerateOnClose: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
3995 
3996 // Compatibility: NT3, NT4, W2K, WXP, 2K3
3997 function  NtCompleteConnectPort(
3998     PortHandle : HANDLE
3999   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4000 function  ZwCompleteConnectPort(PortHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4001 
4002 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4003 function  NtConnectPort(
4004     PortHandle : PHANDLE;
4005     PortName : PUNICODE_STRING;
4006     SecurityQos : PSECURITY_QUALITY_OF_SERVICE;
4007     WriteSection : PPORT_SECTION_WRITE;
4008     ReadSection : PPORT_SECTION_READ;
4009     MaxMessageSize : PULONG;
4010     ConnectData : PVOID;
4011     ConnectDataLength : PULONG
4012   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4013 function  ZwConnectPort(PortHandle: PHANDLE; PortName: PUNICODE_STRING; SecurityQos: PSECURITY_QUALITY_OF_SERVICE; WriteSection: PPORT_SECTION_WRITE; ReadSection: PPORT_SECTION_READ; MaxMessageSize: PULONG; ConnectData: PVOID;
4014     ConnectDataLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4015 
4016 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4017 function  NtContinue(
4018     Context : PCONTEXT;
4019     TestAlert : BOOLEAN
4020   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4021 function  ZwContinue(Context: PCONTEXT; TestAlert: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4022 
4023 // Returns STATUS_NOT_IMPLEMENTED. Only MS knows the intention behind this.
4024 //
4025 // !!!DO NOT USE!!!
4026 // Compatibility: NT4, W2K
4027 function  NtCreateChannel(
4028     ChannelHandle : PHANDLE;
4029     ObjectAttributes : POBJECT_ATTRIBUTES
4030   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4031 function  ZwCreateChannel(ChannelHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4032 
4033 // Documented in the DDK as ZwCreateDirectoryObject().
4034 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4035 function  NtCreateDirectoryObject(
4036     DirectoryHandle : PHANDLE;
4037     DesiredAccess : ACCESS_MASK;
4038     ObjectAttributes : POBJECT_ATTRIBUTES
4039   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4040 function  ZwCreateDirectoryObject(DirectoryHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4041 
4042 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4043 function  NtCreateEvent(
4044     EventHandle : PHANDLE;
4045     DesiredAccess : ACCESS_MASK;
4046     ObjectAttributes : POBJECT_ATTRIBUTES;
4047     EventType : EVENT_TYPE;
4048     InitialState : BOOLEAN
4049   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4050 function  ZwCreateEvent(EventHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; EventType: EVENT_TYPE; InitialState: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4051 
4052 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4053 function  NtCreateEventPair(
4054     EventPairHandle : PHANDLE;
4055     DesiredAccess : ACCESS_MASK;
4056     ObjectAttributes : POBJECT_ATTRIBUTES
4057   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4058 function  ZwCreateEventPair(EventPairHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4059 
4060 {$IFNDEF JWA_INCLUDEMODE}
4061 // Documented in the DDK as ZwCreateFile().
4062 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4063 function  NtCreateFile(
4064     FileHandle : PHANDLE;
4065     DesiredAccess : ACCESS_MASK;
4066     ObjectAttributes : POBJECT_ATTRIBUTES;
4067     IoStatusBlock : PIO_STATUS_BLOCK;
4068     AllocationSize : PLARGE_INTEGER;
4069     FileAttributes : ULONG;
4070     ShareAccess : ULONG;
4071     CreateDisposition : ULONG;
4072     CreateOptions : ULONG;
4073     EaBuffer : PVOID;
4074     EaLength : ULONG
4075   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4076 {$ENDIF JWA_INCLUDEMODE}
4077 function  ZwCreateFile(FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; AllocationSize: PLARGE_INTEGER; FileAttributes: ULONG; ShareAccess: ULONG;
4078     CreateDisposition: ULONG; CreateOptions: ULONG; EaBuffer: PVOID; EaLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4079 
4080 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4081 function  NtCreateIoCompletion(
4082     IoCompletionHandle : PHANDLE;
4083     DesiredAccess : ACCESS_MASK;
4084     ObjectAttributes : POBJECT_ATTRIBUTES;
4085     NumberOfConcurrentThreads : ULONG
4086   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4087 function  ZwCreateIoCompletion(IoCompletionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; NumberOfConcurrentThreads: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4088 
4089 // Compatibility: W2K, WXP, 2K3
4090 function  NtCreateJobObject(
4091     JobHandle : PHANDLE;
4092     DesiredAccess : ACCESS_MASK;
4093     ObjectAttributes : POBJECT_ATTRIBUTES
4094   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4095 function  ZwCreateJobObject(JobHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4096 
4097 // Documented in the DDK as ZwCreateKey().
4098 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4099 function  NtCreateKey(
4100     KeyHandle : PHANDLE;
4101     DesiredAccess : ACCESS_MASK;
4102     ObjectAttributes : POBJECT_ATTRIBUTES;
4103     TitleIndex : ULONG;
4104     Class_ : PUNICODE_STRING;
4105     CreateOptions : ULONG;
4106     Disposition : PULONG
4107   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4108 function  ZwCreateKey(KeyHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; TitleIndex: ULONG; Class_: PUNICODE_STRING; CreateOptions: ULONG; Disposition: PULONG): NTSTATUS; stdcall;
4109     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4110 
4111 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4112 function  NtCreateMailslotFile(
4113     FileHandle : PHANDLE;
4114     DesiredAccess : ACCESS_MASK;
4115     ObjectAttributes : POBJECT_ATTRIBUTES;
4116     IoStatusBlock : PIO_STATUS_BLOCK;
4117     CreateOptions : ULONG;
4118     Unknown : ULONG;
4119     MaxMessageSize : ULONG;
4120     ReadTimeout : PLARGE_INTEGER
4121   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4122 function  ZwCreateMailslotFile(FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; CreateOptions: ULONG; Unknown: ULONG; MaxMessageSize: ULONG;
4123     ReadTimeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4124 
4125 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4126 function  NtCreateMutant(
4127     MutantHandle : PHANDLE;
4128     DesiredAccess : ACCESS_MASK;
4129     ObjectAttributes : POBJECT_ATTRIBUTES;
4130     InitialOwner : BOOLEAN
4131   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4132 function  ZwCreateMutant(MutantHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; InitialOwner: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4133 
4134 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4135 function  NtCreateNamedPipeFile(
4136     FileHandle : PHANDLE;
4137     DesiredAccess : ACCESS_MASK;
4138     ObjectAttributes : POBJECT_ATTRIBUTES;
4139     IoStatusBlock : PIO_STATUS_BLOCK;
4140     ShareAccess : ULONG;
4141     CreateDisposition : ULONG;
4142     CreateOptions : ULONG;
4143     TypeMessage : BOOLEAN;
4144     ReadmodeMessage : BOOLEAN;
4145     Nonblocking : BOOLEAN;
4146     MaxInstances : ULONG;
4147     InBufferSize : ULONG;
4148     OutBufferSize : ULONG;
4149     DefaultTimeout : PLARGE_INTEGER
4150   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4151 function  ZwCreateNamedPipeFile(FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; ShareAccess: ULONG; CreateDisposition: ULONG; CreateOptions: ULONG;
4152     TypeMessage: BOOLEAN; ReadmodeMessage: BOOLEAN; Nonblocking: BOOLEAN; MaxInstances: ULONG; InBufferSize: ULONG; OutBufferSize: ULONG; DefaultTimeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4153 
4154 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4155 function  NtCreatePagingFile(
4156     FileName : PUNICODE_STRING;
4157     InitialSize : PULARGE_INTEGER;
4158     MaximumSize : PULARGE_INTEGER;
4159     Reserved : ULONG
4160   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4161 function  ZwCreatePagingFile(FileName: PUNICODE_STRING; InitialSize: PULARGE_INTEGER; MaximumSize: PULARGE_INTEGER; Reserved: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4162 
4163 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4164 function  NtCreatePort(
4165     PortHandle : PHANDLE;
4166     ObjectAttributes : POBJECT_ATTRIBUTES;
4167     MaxDataSize : ULONG;
4168     MaxMessageSize : ULONG;
4169     Reserved : ULONG
4170   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4171 function  ZwCreatePort(PortHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES; MaxDataSize: ULONG; MaxMessageSize: ULONG; Reserved: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4172 
4173 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4174 function  NtCreateProcess(
4175     ProcessHandle : PHANDLE;
4176     DesiredAccess : ACCESS_MASK;
4177     ObjectAttributes : POBJECT_ATTRIBUTES;
4178     InheritFromProcessHandle : HANDLE;
4179     InheritHandles : BOOLEAN;
4180     SectionHandle : HANDLE;
4181     DebugPort : HANDLE;
4182     ExceptionPort : HANDLE
4183   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4184 function  ZwCreateProcess(ProcessHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; InheritFromProcessHandle: HANDLE; InheritHandles: BOOLEAN; SectionHandle: HANDLE; DebugPort: HANDLE;
4185     ExceptionPort: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4186 
4187 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4188 function  NtCreateProfile(
4189     ProfileHandle : PHANDLE;
4190     ProcessHandle : HANDLE;
4191     Base : PVOID;
4192     Size : ULONG;
4193     BucketShift : ULONG;
4194     Buffer : PULONG;
4195     BufferLength : ULONG;
4196     Source : KPROFILE_SOURCE;
4197     ProcessorMask : ULONG
4198   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4199 function  ZwCreateProfile(ProfileHandle: PHANDLE; ProcessHandle: HANDLE; Base: PVOID; Size: ULONG; BucketShift: ULONG; Buffer: PULONG; BufferLength: ULONG; Source: KPROFILE_SOURCE; ProcessorMask: ULONG): NTSTATUS; stdcall;
4200     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4201 
4202 // Documented in the DDK as ZwCreateSection().
4203 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4204 function  NtCreateSection(
4205     SectionHandle : PHANDLE;
4206     DesiredAccess : ACCESS_MASK;
4207     ObjectAttributes : POBJECT_ATTRIBUTES;
4208     SectionSize : PLARGE_INTEGER;
4209     Protect : ULONG;
4210     Attributes : ULONG;
4211     FileHandle : HANDLE
4212   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4213 function  ZwCreateSection(SectionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; SectionSize: PLARGE_INTEGER; Protect: ULONG; Attributes: ULONG; FileHandle: HANDLE): NTSTATUS; stdcall;
4214     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4215 
4216 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4217 function  NtCreateSemaphore(
4218     SemaphoreHandle : PHANDLE;
4219     DesiredAccess : ACCESS_MASK;
4220     ObjectAttributes : POBJECT_ATTRIBUTES;
4221     InitialCount : LONG;
4222     MaximumCount : LONG
4223   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4224 function  ZwCreateSemaphore(SemaphoreHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; InitialCount: LONG; MaximumCount: LONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4225 
4226 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4227 function  NtCreateSymbolicLinkObject(
4228     SymbolicLinkHandle : PHANDLE;
4229     DesiredAccess : ACCESS_MASK;
4230     ObjectAttributes : POBJECT_ATTRIBUTES;
4231     TargetName : PUNICODE_STRING
4232   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4233 function  ZwCreateSymbolicLinkObject(SymbolicLinkHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; TargetName: PUNICODE_STRING): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4234 
4235 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4236 function  NtCreateThread(
4237     ThreadHandle : PHANDLE;
4238     DesiredAccess : ACCESS_MASK;
4239     ObjectAttributes : POBJECT_ATTRIBUTES;
4240     ProcessHandle : HANDLE;
4241     ClientId : PCLIENT_ID;
4242     ThreadContext : PCONTEXT;
4243     UserStack : PUSER_STACK;
4244     CreateSuspended : BOOLEAN
4245   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4246 function  ZwCreateThread(ThreadHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; ProcessHandle: HANDLE; ClientId: PCLIENT_ID; ThreadContext: PCONTEXT; UserStack: PUSER_STACK;
4247     CreateSuspended: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4248 
4249 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4250 function  NtCreateTimer(
4251     TimerHandle : PHANDLE;
4252     DesiredAccess : ACCESS_MASK;
4253     ObjectAttributes : POBJECT_ATTRIBUTES;
4254     TimerType : TIMER_TYPE
4255   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4256 function  ZwCreateTimer(TimerHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; TimerType: TIMER_TYPE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4257 
4258 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4259 function  NtCreateToken(
4260     TokenHandle : PHANDLE;
4261     DesiredAccess : ACCESS_MASK;
4262     ObjectAttributes : POBJECT_ATTRIBUTES;
4263     Type_ : TOKEN_TYPE;
4264     AuthenticationId : PLUID;
4265     ExpirationTime : PLARGE_INTEGER;
4266     User : PTOKEN_USER;
4267     Groups : PTOKEN_GROUPS;
4268     Privileges : PTOKEN_PRIVILEGES;
4269     Owner : PTOKEN_OWNER;
4270     PrimaryGroup : PTOKEN_PRIMARY_GROUP;
4271     DefaultDacl : PTOKEN_DEFAULT_DACL;
4272     Source : PTOKEN_SOURCE
4273   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4274 function  ZwCreateToken(TokenHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; Type_: TOKEN_TYPE; AuthenticationId: PLUID; ExpirationTime: PLARGE_INTEGER; User: PTOKEN_USER; Groups: PTOKEN_GROUPS;
4275     Privileges: PTOKEN_PRIVILEGES; Owner: PTOKEN_OWNER; PrimaryGroup: PTOKEN_PRIMARY_GROUP; DefaultDacl: PTOKEN_DEFAULT_DACL; Source: PTOKEN_SOURCE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4276 
4277 // Compatibility: W2K, WXP, 2K3
4278 function  NtCreateWaitablePort(
4279     PortHandle : PHANDLE;
4280     ObjectAttributes : POBJECT_ATTRIBUTES;
4281     MaxDataSize : ULONG;
4282     MaxMessageSize : ULONG;
4283     Reserved : ULONG
4284   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4285 function  ZwCreateWaitablePort(PortHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES; MaxDataSize: ULONG; MaxMessageSize: ULONG; Reserved: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4286 
4287 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4288 
4289 
4290 function  NtCurrentTeb(): PTEB; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4291 
4292 function  ZwCurrentTeb(): PTEB; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4293 
4294 // Compatibility: WXP, 2K3
4295 function  NtDebugActiveProcess(
4296     hProcess : HANDLE;
4297     hDebugObject : HANDLE
4298   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4299 function  ZwDebugActiveProcess(hProcess: HANDLE; hDebugObject: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4300 
4301 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4302 function  NtDelayExecution(
4303     Alertable : BOOLEAN;
4304     Interval : PLARGE_INTEGER
4305   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4306 function  ZwDelayExecution(Alertable: BOOLEAN; Interval: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4307 
4308 // Compatibility: NT4, W2K, WXP, 2K3
4309 function  NtDeleteAtom(
4310     Atom : USHORT
4311   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4312 function  ZwDeleteAtom(Atom: USHORT): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4313 
4314 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4315 function  NtDeleteFile(
4316     ObjectAttributes : POBJECT_ATTRIBUTES
4317   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4318 function  ZwDeleteFile(ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4319 
4320 // Documented in the DDK as ZwDeleteKey().
4321 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4322 function  NtDeleteKey(
4323     KeyHandle : HANDLE
4324   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4325 function  ZwDeleteKey(KeyHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4326 
4327 // Compatibility: NT4, W2K, WXP, 2K3
4328 function  NtDeleteObjectAuditAlarm(
4329     SubsystemName : PUNICODE_STRING;
4330     HandleId : PVOID;
4331     GenerateOnClose : BOOLEAN
4332   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4333 function  ZwDeleteObjectAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PVOID; GenerateOnClose: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4334 
4335 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4336 function  NtDeleteValueKey(
4337     KeyHandle : HANDLE;
4338     ValueName : PUNICODE_STRING
4339   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4340 function  ZwDeleteValueKey(KeyHandle: HANDLE; ValueName: PUNICODE_STRING): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4341 
4342 {$IFNDEF JWA_INCLUDEMODE}
4343 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4344 function  NtDeviceIoControlFile(
4345     FileHandle : HANDLE;
4346     Event : HANDLE;
4347     ApcRoutine : PIO_APC_ROUTINE;
4348     ApcContext : PVOID;
4349     IoStatusBlock : PIO_STATUS_BLOCK;
4350     IoControlCode : ULONG;
4351     InputBuffer : PVOID;
4352     InputBufferLength : ULONG;
4353     OutputBuffer : PVOID;
4354     OutputBufferLength : ULONG
4355   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4356 {$ENDIF JWA_INCLUDEMODE}
4357 
4358 function  ZwDeviceIoControlFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; IoControlCode: ULONG; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID;
4359     OutputBufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4360 
4361 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4362 function  NtDisplayString(
4363     Str : PUNICODE_STRING
4364   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4365 function  ZwDisplayString(Str: PUNICODE_STRING): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4366 
4367 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4368 function  NtDuplicateObject(
4369     SourceProcessHandle : HANDLE;
4370     SourceHandle : HANDLE;
4371     TargetProcessHandle : HANDLE;
4372     TargetHandle : PHANDLE;
4373     DesiredAccess : ACCESS_MASK;
4374     Attributes : ULONG;
4375     Options : ULONG
4376   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4377 function  ZwDuplicateObject(SourceProcessHandle: HANDLE; SourceHandle: HANDLE; TargetProcessHandle: HANDLE; TargetHandle: PHANDLE; DesiredAccess: ACCESS_MASK; Attributes: ULONG; Options: ULONG): NTSTATUS; stdcall;
4378     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4379 
4380 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4381 function  NtDuplicateToken(
4382     ExistingTokenHandle : HANDLE;
4383     DesiredAccess : ACCESS_MASK;
4384     ObjectAttributes : POBJECT_ATTRIBUTES;
4385     EffectiveOnly : BOOLEAN;
4386     TokenType : TOKEN_TYPE;
4387     NewTokenHandle : PHANDLE
4388   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4389 function  ZwDuplicateToken(ExistingTokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; EffectiveOnly: BOOLEAN; TokenType: TOKEN_TYPE; NewTokenHandle: PHANDLE): NTSTATUS; stdcall;
4390     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4391 
4392 // Documented in the DDK as ZwEnumerateKey().
4393 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4394 function  NtEnumerateKey(
4395     KeyHandle : HANDLE;
4396     Index : ULONG;
4397     KeyInformationClass : KEY_INFORMATION_CLASS;
4398     KeyInformation : PVOID;
4399     KeyInformationLength : ULONG;
4400     ResultLength : PULONG
4401   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4402 function  ZwEnumerateKey(KeyHandle: HANDLE; Index: ULONG; KeyInformationClass: KEY_INFORMATION_CLASS; KeyInformation: PVOID; KeyInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4403 
4404 // Documented in the DDK as ZwEnumerateValueKey().
4405 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4406 function  NtEnumerateValueKey(
4407     KeyHandle : HANDLE;
4408     Index : ULONG;
4409     KeyValueInformationClass : KEY_VALUE_INFORMATION_CLASS;
4410     KeyValueInformation : PVOID;
4411     KeyValueInformationLength : ULONG;
4412     ResultLength : PULONG
4413   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4414 function  ZwEnumerateValueKey(KeyHandle: HANDLE; Index: ULONG; KeyValueInformationClass: KEY_VALUE_INFORMATION_CLASS; KeyValueInformation: PVOID; KeyValueInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
4415     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4416 
4417 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4418 function  NtExtendSection(
4419     SectionHandle : HANDLE;
4420     SectionSize : PLARGE_INTEGER
4421   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4422 function  ZwExtendSection(SectionHandle: HANDLE; SectionSize: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4423 
4424 // Compatibility: W2K, WXP, 2K3
4425 function  NtFilterToken(
4426     ExistingTokenHandle : HANDLE;
4427     Flags : ULONG;
4428     SidsToDisable : PTOKEN_GROUPS;
4429     PrivilegesToDelete : PTOKEN_PRIVILEGES;
4430     SidsToRestricted : PTOKEN_GROUPS;
4431     NewTokenHandle : PHANDLE
4432   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4433 function  ZwFilterToken(ExistingTokenHandle: HANDLE; Flags: ULONG; SidsToDisable: PTOKEN_GROUPS; PrivilegesToDelete: PTOKEN_PRIVILEGES; SidsToRestricted: PTOKEN_GROUPS; NewTokenHandle: PHANDLE): NTSTATUS; stdcall;
4434     {$IFNDEF RTDL}external ntdll;{$ENDIF}
4435 
4436 // Compatibility: NT4, W2K, WXP, 2K3
4437 function  NtFindAtom(
4438     Str : PWSTR;
4439     StringLength : ULONG;
4440     Atom : PUSHORT
4441   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4442 function  ZwFindAtom(Str: PWSTR; StringLength: ULONG; Atom: PUSHORT): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4443 
4444 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4445 function  NtFlushBuffersFile(
4446     FileHandle : HANDLE;
4447     IoStatusBlock : PIO_STATUS_BLOCK
4448   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4449 function  ZwFlushBuffersFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4450 
4451 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4452 function  NtFlushInstructionCache(
4453     ProcessHandle : HANDLE;
4454     BaseAddress : PVOID;
4455     FlushSize : ULONG
4456   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4457 function  ZwFlushInstructionCache(ProcessHandle: HANDLE; BaseAddress: PVOID; FlushSize: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4458 
4459 // Documented in the DDK as ZwFlushKey().
4460 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4461 function  NtFlushKey(
4462     KeyHandle : HANDLE
4463   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4464 function  ZwFlushKey(KeyHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4465 
4466 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4467 function  NtFlushVirtualMemory(
4468     ProcessHandle : HANDLE;
4469     BaseAddress : PPVOID;
4470     FlushSize : PULONG;
4471     IoStatusBlock : PIO_STATUS_BLOCK
4472   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4473 function  ZwFlushVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PPVOID; FlushSize: PULONG; IoStatusBlock: PIO_STATUS_BLOCK): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4474 
4475 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4476 function  NtFlushWriteBuffer(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4477 function  ZwFlushWriteBuffer(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4478 
4479 // Compatibility: W2K, WXP, 2K3
4480 function  NtFreeUserPhysicalPages(
4481     ProcessHandle : HANDLE;
4482     NumberOfPages : PULONG;
4483     PageFrameNumbers : PULONG
4484   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4485 function  ZwFreeUserPhysicalPages(ProcessHandle: HANDLE; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4486 
4487 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4488 function  NtFreeVirtualMemory(
4489     ProcessHandle : HANDLE;
4490     BaseAddress : PPVOID;
4491     FreeSize : PULONG;
4492     FreeType : ULONG
4493   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4494 function  ZwFreeVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PPVOID; FreeSize: PULONG; FreeType: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4495 
4496 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4497 function  NtFsControlFile(
4498     FileHandle : HANDLE;
4499     Event : HANDLE;
4500     ApcRoutine : PIO_APC_ROUTINE;
4501     ApcContext : PVOID;
4502     IoStatusBlock : PIO_STATUS_BLOCK;
4503     FsControlCode : ULONG;
4504     InputBuffer : PVOID;
4505     InputBufferLength : ULONG;
4506     OutputBuffer : PVOID;
4507     OutputBufferLength : ULONG
4508   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4509 function  ZwFsControlFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; FsControlCode: ULONG; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID;
4510     OutputBufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4511 
4512 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4513 function  NtGetContextThread(
4514     ThreadHandle : HANDLE;
4515     Context : PCONTEXT
4516   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4517 function  ZwGetContextThread(ThreadHandle: HANDLE; Context: PCONTEXT): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4518 
4519 // Compatibility: 2K3
4520 function  NtGetCurrentProcessorNumber(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4521 function  ZwGetCurrentProcessorNumber(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4522 
4523 // Compatibility: W2K, WXP, 2K3
4524 function  NtGetDevicePowerState(
4525     DeviceHandle : HANDLE;
4526     DevicePowerState : PDEVICE_POWER_STATE
4527   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4528 function  ZwGetDevicePowerState(DeviceHandle: HANDLE; DevicePowerState: PDEVICE_POWER_STATE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4529 
4530 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4531 function  NtGetPlugPlayEvent(
4532     Reserved1 : ULONG;
4533     Reserved2 : ULONG;
4534     Buffer : PVOID;
4535     BufferLength : ULONG
4536   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4537 function  ZwGetPlugPlayEvent(Reserved1: ULONG; Reserved2: ULONG; Buffer: PVOID; BufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4538 
4539 // Compatibility: NT3, NT4, W2K, 2K3
4540 function  NtGetTickCount(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4541 function  ZwGetTickCount(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4542 
4543 // Compatibility: W2K, WXP, 2K3
4544 function  NtGetWriteWatch(
4545     ProcessHandle : HANDLE;
4546     Flags : ULONG;
4547     BaseAddress : PVOID;
4548     RegionSize : ULONG;
4549     Buffer : PULONG;
4550     BufferEntries : PULONG;
4551     Granularity : PULONG
4552   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4553 function  ZwGetWriteWatch(ProcessHandle: HANDLE; Flags: ULONG; BaseAddress: PVOID; RegionSize: ULONG; Buffer: PULONG; BufferEntries: PULONG; Granularity: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4554 
4555 // Compatibility: W2K, WXP, 2K3
4556 function  NtImpersonateAnonymousToken(
4557     ThreadHandle : HANDLE
4558   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4559 function  ZwImpersonateAnonymousToken(ThreadHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4560 
4561 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4562 function  NtImpersonateClientOfPort(
4563     PortHandle : HANDLE;
4564     Message : PPORT_MESSAGE
4565   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4566 function  ZwImpersonateClientOfPort(PortHandle: HANDLE; Message: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4567 
4568 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4569 function  NtImpersonateThread(
4570     ThreadHandle : HANDLE;
4571     TargetThreadHandle : HANDLE;
4572     SecurityQos : PSECURITY_QUALITY_OF_SERVICE
4573   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4574 function  ZwImpersonateThread(ThreadHandle: HANDLE; TargetThreadHandle: HANDLE; SecurityQos: PSECURITY_QUALITY_OF_SERVICE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4575 
4576 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4577 function  NtInitializeRegistry(
4578     Setup : BOOLEAN
4579   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4580 function  ZwInitializeRegistry(Setup: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4581 
4582 // Compatibility: W2K, WXP, 2K3
4583 function  NtInitiatePowerAction(
4584     SystemAction : POWER_ACTION;
4585     MinSystemState : SYSTEM_POWER_STATE;
4586     Flags : ULONG;
4587     Asynchronous : BOOLEAN
4588   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4589 function  ZwInitiatePowerAction(SystemAction: POWER_ACTION; MinSystemState: SYSTEM_POWER_STATE; Flags: ULONG; Asynchronous: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4590 
4591 // Compatibility: W2K, WXP, 2K3
4592 function  NtIsSystemResumeAutomatic(): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4593 function  ZwIsSystemResumeAutomatic(): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4594 
4595 // Returns STATUS_NOT_IMPLEMENTED. Only MS knows the intention behind this.
4596 //
4597 // !!!DO NOT USE!!!
4598 // Compatibility: NT4, W2K
4599 function  NtListenChannel(
4600     x : PVOID;
4601     y : PVOID
4602   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4603 function  ZwListenChannel(x: PVOID; y: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4604 
4605 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4606 function  NtListenPort(
4607     PortHandle : HANDLE;
4608     Message : PPORT_MESSAGE
4609   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4610 function  ZwListenPort(PortHandle: HANDLE; Message: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4611 
4612 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4613 function  NtLoadDriver(
4614     DriverServiceName : PUNICODE_STRING
4615   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4616 function  ZwLoadDriver(DriverServiceName: PUNICODE_STRING): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4617 
4618 // Relates to RegLoadKey().
4619 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4620 function  NtLoadKey(
4621     KeyObjectAttributes : POBJECT_ATTRIBUTES;
4622     FileObjectAttributes : POBJECT_ATTRIBUTES
4623   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4624 function  ZwLoadKey(KeyObjectAttributes: POBJECT_ATTRIBUTES; FileObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4625 
4626 // Relates to RegLoadKey().
4627 // Compatibility: NT4, W2K, WXP, 2K3
4628 function  NtLoadKey2(
4629     KeyObjectAttributes : POBJECT_ATTRIBUTES;
4630     FileObjectAttributes : POBJECT_ATTRIBUTES;
4631     Flags : ULONG
4632   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4633 function  ZwLoadKey2(KeyObjectAttributes: POBJECT_ATTRIBUTES; FileObjectAttributes: POBJECT_ATTRIBUTES; Flags: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4634 
4635 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4636 function  NtLockFile(
4637     FileHandle : HANDLE;
4638     Event : HANDLE;
4639     ApcRoutine : PIO_APC_ROUTINE;
4640     ApcContext : PVOID;
4641     IoStatusBlock : PIO_STATUS_BLOCK;
4642     LockOffset : PULARGE_INTEGER;
4643     LockLength : PULARGE_INTEGER;
4644     Key : ULONG;
4645     FailImmediately : BOOLEAN;
4646     ExclusiveLock : BOOLEAN
4647   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4648 function  ZwLockFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; LockOffset: PULARGE_INTEGER; LockLength: PULARGE_INTEGER; Key: ULONG; FailImmediately: BOOLEAN;
4649     ExclusiveLock: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4650 
4651 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4652 function  NtLockVirtualMemory(
4653     ProcessHandle : HANDLE;
4654     BaseAddress : PPVOID;
4655     LockSize : PULONG;
4656     LockType : ULONG
4657   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4658 function  ZwLockVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PPVOID; LockSize: PULONG; LockType: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4659 
4660 // Compatibility: WXP, 2K3
4661 function  NtMakePermanentObject(
4662     Handle : HANDLE
4663   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4664 function  ZwMakePermanentObject(Handle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4665 
4666 // Documented in the DDK as ZwMakeTemporaryObject().
4667 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4668 function  NtMakeTemporaryObject(
4669     Handle : HANDLE
4670   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4671 function  ZwMakeTemporaryObject(Handle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4672 
4673 // Compatibility: W2K, WXP, 2K3
4674 function  NtMapUserPhysicalPages(
4675     BaseAddress : PVOID;
4676     NumberOfPages : PULONG;
4677     PageFrameNumbers : PULONG
4678   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4679 function  ZwMapUserPhysicalPages(BaseAddress: PVOID; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4680 
4681 // Compatibility: W2K, WXP, 2K3
4682 function  NtMapUserPhysicalPagesScatter(
4683     BaseAddresses : PPVOID;
4684     NumberOfPages : PULONG;
4685     PageFrameNumbers : PULONG
4686   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4687 function  ZwMapUserPhysicalPagesScatter(BaseAddresses: PPVOID; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4688 
4689 // Documented in the DDK as ZwMapViewOfSection().
4690 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4691 function  NtMapViewOfSection(
4692     SectionHandle : HANDLE;
4693     ProcessHandle : HANDLE;
4694     BaseAddress : PPVOID;
4695     ZeroBits : ULONG;
4696     CommitSize : ULONG;
4697     SectionOffset : PLARGE_INTEGER;
4698     ViewSize : PULONG;
4699     InheritDisposition : SECTION_INHERIT;
4700     AllocationType : ULONG;
4701     Protect : ULONG
4702   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4703 function  ZwMapViewOfSection(SectionHandle: HANDLE; ProcessHandle: HANDLE; BaseAddress: PPVOID; ZeroBits: ULONG; CommitSize: ULONG; SectionOffset: PLARGE_INTEGER; ViewSize: PULONG; InheritDisposition: SECTION_INHERIT; AllocationType: ULONG;
4704     Protect: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4705 
4706 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4707 function  NtNotifyChangeDirectoryFile(
4708     FileHandle : HANDLE;
4709     Event : HANDLE;
4710     ApcRoutine : PIO_APC_ROUTINE;
4711     ApcContext : PVOID;
4712     IoStatusBlock : PIO_STATUS_BLOCK;
4713     Buffer : PFILE_NOTIFY_INFORMATION;
4714     BufferLength : ULONG;
4715     NotifyFilter : ULONG;
4716     WatchSubtree : BOOLEAN
4717   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4718 function  ZwNotifyChangeDirectoryFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_NOTIFY_INFORMATION; BufferLength: ULONG; NotifyFilter: ULONG;
4719     WatchSubtree: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4720 
4721 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4722 function  NtNotifyChangeKey(
4723     KeyHandle : HANDLE;
4724     EventHandle : HANDLE;
4725     ApcRoutine : PIO_APC_ROUTINE;
4726     ApcContext : PVOID;
4727     IoStatusBlock : PIO_STATUS_BLOCK;
4728     NotifyFilter : ULONG;
4729     WatchSubtree : BOOLEAN;
4730     Buffer : PVOID;
4731     BufferLength : ULONG;
4732     Asynchronous : BOOLEAN
4733   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4734 function  ZwNotifyChangeKey(KeyHandle: HANDLE; EventHandle: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; NotifyFilter: ULONG; WatchSubtree: BOOLEAN; Buffer: PVOID; BufferLength: ULONG;
4735     Asynchronous: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4736 
4737 // Compatibility: W2K, WXP, 2K3
4738 function  NtNotifyChangeMultipleKeys(
4739     KeyHandle : HANDLE;
4740     Flags : ULONG;
4741     KeyObjectAttributes : POBJECT_ATTRIBUTES;
4742     EventHandle : HANDLE;
4743     ApcRoutine : PIO_APC_ROUTINE;
4744     ApcContext : PVOID;
4745     IoStatusBlock : PIO_STATUS_BLOCK;
4746     NotifyFilter : ULONG;
4747     WatchSubtree : BOOLEAN;
4748     Buffer : PVOID;
4749     BufferLength : ULONG;
4750     Asynchronous : BOOLEAN
4751   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4752 function  ZwNotifyChangeMultipleKeys(KeyHandle: HANDLE; Flags: ULONG; KeyObjectAttributes: POBJECT_ATTRIBUTES; EventHandle: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; NotifyFilter: ULONG;
4753     WatchSubtree: BOOLEAN; Buffer: PVOID; BufferLength: ULONG; Asynchronous: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4754 
4755 // Returns STATUS_NOT_IMPLEMENTED. Only MS knows the intention behind this.
4756 //
4757 // !!!DO NOT USE!!!
4758 // Compatibility: NT4, W2K
4759 function  NtOpenChannel(
4760     ChannelHandle : PHANDLE;
4761     ObjectAttributes : POBJECT_ATTRIBUTES
4762   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4763 function  ZwOpenChannel(ChannelHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4764 
4765 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4766 function  NtOpenDirectoryObject(
4767     DirectoryHandle : PHANDLE;
4768     DesiredAccess : ACCESS_MASK;
4769     ObjectAttributes : POBJECT_ATTRIBUTES
4770   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4771 function  ZwOpenDirectoryObject(DirectoryHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4772 
4773 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4774 function  NtOpenEvent(
4775     EventHandle : PHANDLE;
4776     DesiredAccess : ACCESS_MASK;
4777     ObjectAttributes : POBJECT_ATTRIBUTES
4778   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4779 function  ZwOpenEvent(EventHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4780 
4781 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4782 function  NtOpenEventPair(
4783     EventPairHandle : PHANDLE;
4784     DesiredAccess : ACCESS_MASK;
4785     ObjectAttributes : POBJECT_ATTRIBUTES
4786   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4787 function  ZwOpenEventPair(EventPairHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4788 
4789 {$IFNDEF JWA_INCLUDEMODE}
4790 // Documented in the DDK as ZwOpenFile().
4791 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4792 function  NtOpenFile(
4793     FileHandle : PHANDLE;
4794     DesiredAccess : ACCESS_MASK;
4795     ObjectAttributes : POBJECT_ATTRIBUTES;
4796     IoStatusBlock : PIO_STATUS_BLOCK;
4797     ShareAccess : ULONG;
4798     OpenOptions : ULONG
4799   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4800 {$ENDIF JWA_INCLUDEMODE}
4801 
4802 function  ZwOpenFile(FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; ShareAccess: ULONG; OpenOptions: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4803 
4804 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4805 function  NtOpenIoCompletion(
4806     IoCompletionHandle : PHANDLE;
4807     DesiredAccess : ACCESS_MASK;
4808     ObjectAttributes : POBJECT_ATTRIBUTES
4809   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4810 function  ZwOpenIoCompletion(IoCompletionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4811 
4812 // Compatibility: W2K, WXP, 2K3
4813 function  NtOpenJobObject(
4814     JobHandle : PHANDLE;
4815     DesiredAccess : ACCESS_MASK;
4816     ObjectAttributes : POBJECT_ATTRIBUTES
4817   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4818 function  ZwOpenJobObject(JobHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4819 
4820 // Documented in the DDK as ZwOpenKey().
4821 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4822 function  NtOpenKey(
4823     KeyHandle : PHANDLE;
4824     DesiredAccess : ACCESS_MASK;
4825     ObjectAttributes : POBJECT_ATTRIBUTES
4826   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4827 function  ZwOpenKey(KeyHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4828 
4829 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4830 function  NtOpenMutant(
4831     MutantHandle : PHANDLE;
4832     DesiredAccess : ACCESS_MASK;
4833     ObjectAttributes : POBJECT_ATTRIBUTES
4834   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4835 function  ZwOpenMutant(MutantHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4836 
4837 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4838 function  NtOpenObjectAuditAlarm(
4839     SubsystemName : PUNICODE_STRING;
4840     HandleId : PPVOID;
4841     ObjectTypeName : PUNICODE_STRING;
4842     ObjectName : PUNICODE_STRING;
4843     SecurityDescriptor : PSECURITY_DESCRIPTOR;
4844     TokenHandle : HANDLE;
4845     DesiredAccess : ACCESS_MASK;
4846     GrantedAccess : ACCESS_MASK;
4847     Privileges : PPRIVILEGE_SET;
4848     ObjectCreation : BOOLEAN;
4849     AccessGranted : BOOLEAN;
4850     GenerateOnClose : PBOOLEAN
4851   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4852 function  ZwOpenObjectAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PPVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK;
4853     GrantedAccess: ACCESS_MASK; Privileges: PPRIVILEGE_SET; ObjectCreation: BOOLEAN; AccessGranted: BOOLEAN; GenerateOnClose: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4854 
4855 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4856 function  NtOpenProcess(
4857     ProcessHandle : PHANDLE;
4858     DesiredAccess : ACCESS_MASK;
4859     ObjectAttributes : POBJECT_ATTRIBUTES;
4860     ClientId : PCLIENT_ID
4861   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4862 function  ZwOpenProcess(ProcessHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; ClientId: PCLIENT_ID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4863 
4864 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4865 function  NtOpenProcessToken(
4866     ProcessHandle : HANDLE;
4867     DesiredAccess : ACCESS_MASK;
4868     TokenHandle : PHANDLE
4869   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4870 function  ZwOpenProcessToken(ProcessHandle: HANDLE; DesiredAccess: ACCESS_MASK; TokenHandle: PHANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4871 
4872 // Documented in the DDK as ZwOpenSection().
4873 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4874 function  NtOpenSection(
4875     SectionHandle : PHANDLE;
4876     DesiredAccess : ACCESS_MASK;
4877     ObjectAttributes : POBJECT_ATTRIBUTES
4878   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4879 function  ZwOpenSection(SectionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4880 
4881 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4882 function  NtOpenSemaphore(
4883     SemaphoreHandle : PHANDLE;
4884     DesiredAccess : ACCESS_MASK;
4885     ObjectAttributes : POBJECT_ATTRIBUTES
4886   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4887 function  ZwOpenSemaphore(SemaphoreHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4888 
4889 // Documented in the DDK as ZwOpenSymbolicLinkObject().
4890 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4891 function  NtOpenSymbolicLinkObject(
4892     SymbolicLinkHandle : PHANDLE;
4893     DesiredAccess : ACCESS_MASK;
4894     ObjectAttributes : POBJECT_ATTRIBUTES
4895   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4896 function  ZwOpenSymbolicLinkObject(SymbolicLinkHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4897 
4898 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4899 function  NtOpenThread(
4900     ThreadHandle : PHANDLE;
4901     DesiredAccess : ACCESS_MASK;
4902     ObjectAttributes : POBJECT_ATTRIBUTES;
4903     ClientId : PCLIENT_ID
4904   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4905 function  ZwOpenThread(ThreadHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; ClientId: PCLIENT_ID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4906 
4907 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4908 function  NtOpenThreadToken(
4909     ThreadHandle : HANDLE;
4910     DesiredAccess : ACCESS_MASK;
4911     OpenAsSelf : BOOLEAN;
4912     TokenHandle : PHANDLE
4913   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4914 function  ZwOpenThreadToken(ThreadHandle: HANDLE; DesiredAccess: ACCESS_MASK; OpenAsSelf: BOOLEAN; TokenHandle: PHANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4915 
4916 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4917 function  NtOpenTimer(
4918     TimerHandle : PHANDLE;
4919     DesiredAccess : ACCESS_MASK;
4920     ObjectAttributes : POBJECT_ATTRIBUTES
4921   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4922 function  ZwOpenTimer(TimerHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4923 
4924 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4925 function  NtPlugPlayControl(
4926     ControlCode : ULONG;
4927     Buffer : PVOID;
4928     BufferLength : ULONG
4929   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4930 function  ZwPlugPlayControl(ControlCode: ULONG; Buffer: PVOID; BufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4931 
4932 // Compatibility: W2K, WXP, 2K3
4933 function  NtPowerInformation(
4934     PowerInformationLevel : POWER_INFORMATION_LEVEL;
4935     InputBuffer : PVOID;
4936     InputBufferLength : ULONG;
4937     OutputBuffer : PVOID;
4938     OutputBufferLength : ULONG
4939   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4940 function  ZwPowerInformation(PowerInformationLevel: POWER_INFORMATION_LEVEL; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID; OutputBufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4941 
4942 // This function is very similar to PrivilegeCheck() from Advapi32.dll.
4943 // Refer to the PSDK for additional information. Usually the same flags
4944 // apply.
4945 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4946 function  NtPrivilegeCheck(
4947     TokenHandle : HANDLE;
4948     RequiredPrivileges : PPRIVILEGE_SET;
4949     Result_ : PBOOLEAN
4950   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4951 function  ZwPrivilegeCheck(TokenHandle: HANDLE; RequiredPrivileges: PPRIVILEGE_SET; Result_: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4952 
4953 // This function is very similar to PrivilegedServiceAuditAlarm() from
4954 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
4955 // same flags apply.
4956 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4957 function  NtPrivilegedServiceAuditAlarm(
4958     SubsystemName : PUNICODE_STRING;
4959     ServiceName : PUNICODE_STRING;
4960     TokenHandle : HANDLE;
4961     Privileges : PPRIVILEGE_SET;
4962     AccessGranted : BOOLEAN
4963   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4964 function  ZwPrivilegedServiceAuditAlarm(SubsystemName: PUNICODE_STRING; ServiceName: PUNICODE_STRING; TokenHandle: HANDLE; Privileges: PPRIVILEGE_SET; AccessGranted: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4965 
4966 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4967 function  NtPrivilegeObjectAuditAlarm(
4968     SubsystemName : PUNICODE_STRING;
4969     HandleId : PVOID;
4970     TokenHandle : HANDLE;
4971     DesiredAccess : ACCESS_MASK;
4972     Privileges : PPRIVILEGE_SET;
4973     AccessGranted : BOOLEAN
4974   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4975 function  ZwPrivilegeObjectAuditAlarm(SubsystemName: PUNICODE_STRING; HandleId: PVOID; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; Privileges: PPRIVILEGE_SET; AccessGranted: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;
4976    {$ENDIF}
4977 
4978 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4979 function  NtProtectVirtualMemory(
4980     ProcessHandle : HANDLE;
4981     BaseAddress : PPVOID;
4982     ProtectSize : PULONG;
4983     NewProtect : ULONG;
4984     OldProtect : PULONG
4985   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4986 function  ZwProtectVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PPVOID; ProtectSize: PULONG; NewProtect: ULONG; OldProtect: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4987 
4988 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4989 function  NtPulseEvent(
4990     EventHandle : HANDLE;
4991     PreviousState : PULONG
4992   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4993 function  ZwPulseEvent(EventHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
4994 
4995 // Compatibility: NT3, NT4, W2K, WXP, 2K3
4996 function  NtQueryAttributesFile(
4997     ObjectAttributes : POBJECT_ATTRIBUTES;
4998     FileInformation : PFILE_BASIC_INFORMATION
4999   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5000 function  ZwQueryAttributesFile(ObjectAttributes: POBJECT_ATTRIBUTES; FileInformation: PFILE_BASIC_INFORMATION): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5001 
5002 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5003 function  NtQueryDefaultLocale(
5004     ThreadOrSystem : BOOLEAN;
5005     Locale : PLCID
5006   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5007 function  ZwQueryDefaultLocale(ThreadOrSystem: BOOLEAN; Locale: PLCID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5008 
5009 // Compatibility: W2K, WXP, 2K3
5010 function  NtQueryDefaultUILanguage(
5011     LanguageId : PLANGID
5012   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5013 function  ZwQueryDefaultUILanguage(LanguageId: PLANGID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5014 
5015 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5016 function  NtQueryDirectoryFile(
5017     FileHandle : HANDLE;
5018     Event : HANDLE;
5019     ApcRoutine : PIO_APC_ROUTINE;
5020     ApcContext : PVOID;
5021     IoStatusBlock : PIO_STATUS_BLOCK;
5022     FileInformation : PVOID;
5023     FileInformationLength : ULONG;
5024     FileInformationClass : FILE_INFORMATION_CLASS;
5025     ReturnSingleEntry : BOOLEAN;
5026     FileName : PUNICODE_STRING;
5027     RestartScan : BOOLEAN
5028   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5029 function  ZwQueryDirectoryFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; FileInformation: PVOID; FileInformationLength: ULONG;
5030     FileInformationClass: FILE_INFORMATION_CLASS; ReturnSingleEntry: BOOLEAN; FileName: PUNICODE_STRING; RestartScan: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5031 
5032 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5033 function  NtQueryDirectoryObject(
5034     DirectoryHandle : HANDLE;
5035     Buffer : PVOID;
5036     BufferLength : ULONG;
5037     ReturnSingleEntry : BOOLEAN;
5038     RestartScan : BOOLEAN;
5039     Context : PULONG;
5040     ReturnLength : PULONG
5041   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5042 function  ZwQueryDirectoryObject(DirectoryHandle: HANDLE; Buffer: PVOID; BufferLength: ULONG; ReturnSingleEntry: BOOLEAN; RestartScan: BOOLEAN; Context: PULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;
5043    {$ENDIF}
5044 
5045 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5046 function  NtQueryEaFile(
5047     FileHandle : HANDLE;
5048     IoStatusBlock : PIO_STATUS_BLOCK;
5049     Buffer : PFILE_FULL_EA_INFORMATION;
5050     BufferLength : ULONG;
5051     ReturnSingleEntry : BOOLEAN;
5052     EaList : PFILE_GET_EA_INFORMATION;
5053     EaListLength : ULONG;
5054     EaIndex : PULONG;
5055     RestartScan : BOOLEAN
5056   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5057 function  ZwQueryEaFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_FULL_EA_INFORMATION; BufferLength: ULONG; ReturnSingleEntry: BOOLEAN; EaList: PFILE_GET_EA_INFORMATION; EaListLength: ULONG; EaIndex: PULONG;
5058     RestartScan: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5059 
5060 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5061 function  NtQueryEvent(
5062     EventHandle : HANDLE;
5063     EventInformationClass : EVENT_INFORMATION_CLASS;
5064     EventInformation : PVOID;
5065     EventInformationLength : ULONG;
5066     ResultLength : PULONG
5067   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5068 function  ZwQueryEvent(EventHandle: HANDLE; EventInformationClass: EVENT_INFORMATION_CLASS; EventInformation: PVOID; EventInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5069 
5070 // Compatibility: NT4, W2K, WXP, 2K3
5071 function  NtQueryFullAttributesFile(
5072     ObjectAttributes : POBJECT_ATTRIBUTES;
5073     FileInformation : PFILE_NETWORK_OPEN_INFORMATION
5074   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5075 function  ZwQueryFullAttributesFile(ObjectAttributes: POBJECT_ATTRIBUTES; FileInformation: PFILE_NETWORK_OPEN_INFORMATION): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5076 
5077 // Compatibility: NT4, W2K, WXP, 2K3
5078 function  NtQueryInformationAtom(
5079     Atom : USHORT;
5080     AtomInformationClass : ATOM_INFORMATION_CLASS;
5081     AtomInformation : PVOID;
5082     AtomInformationLength : ULONG;
5083     ReturnLength : PULONG
5084   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5085 function  ZwQueryInformationAtom(Atom: USHORT; AtomInformationClass: ATOM_INFORMATION_CLASS; AtomInformation: PVOID; AtomInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5086 
5087 // Documented in the DDK as ZwQueryInformationFile().
5088 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5089 function  NtQueryInformationFile(
5090     FileHandle : HANDLE;
5091     IoStatusBlock : PIO_STATUS_BLOCK;
5092     FileInformation : PVOID;
5093     FileInformationLength : ULONG;
5094     FileInformationClass : FILE_INFORMATION_CLASS
5095   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5096 function  ZwQueryInformationFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; FileInformation: PVOID; FileInformationLength: ULONG; FileInformationClass: FILE_INFORMATION_CLASS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;
5097    {$ENDIF}
5098 
5099 // Compatibility: W2K, WXP, 2K3
5100 function  NtQueryInformationJobObject(
5101     JobHandle : HANDLE;
5102     JobInformationClass : JOBOBJECTINFOCLASS;
5103     JobInformation : PVOID;
5104     JobInformationLength : ULONG;
5105     ReturnLength : PULONG
5106   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5107 function  ZwQueryInformationJobObject(JobHandle: HANDLE; JobInformationClass: JOBOBJECTINFOCLASS; JobInformation: PVOID; JobInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5108 
5109 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5110 function  NtQueryInformationPort(
5111     PortHandle : HANDLE;
5112     PortInformationClass : PORT_INFORMATION_CLASS;
5113     PortInformation : PVOID;
5114     PortInformationLength : ULONG;
5115     ReturnLength : PULONG
5116   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5117 function  ZwQueryInformationPort(PortHandle: HANDLE; PortInformationClass: PORT_INFORMATION_CLASS; PortInformation: PVOID; PortInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5118 
5119 {$IFNDEF JWA_INCLUDEMODE}
5120 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5121 function  NtQueryInformationProcess(
5122     ProcessHandle : HANDLE;
5123     ProcessInformationClass : PROCESSINFOCLASS;
5124     ProcessInformation : PVOID;
5125     ProcessInformationLength : ULONG;
5126     ReturnLength : PULONG
5127   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5128 {$ENDIF JWA_INCLUDEMODE}
5129 
5130 function  ZwQueryInformationProcess(ProcessHandle: HANDLE; ProcessInformationClass: PROCESSINFOCLASS; ProcessInformation: PVOID; ProcessInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
5131   {$IFNDEF RTDL}external ntdll;{$ENDIF}
5132 
5133 {$IFNDEF JWA_INCLUDEMODE}
5134 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5135 function  NtQueryInformationThread(
5136     ThreadHandle : HANDLE;
5137     ThreadInformationClass : THREADINFOCLASS;
5138     ThreadInformation : PVOID;
5139     ThreadInformationLength : ULONG;
5140     ReturnLength : PULONG
5141   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5142 {$ENDIF JWA_INCLUDEMODE}
5143 
5144 function  ZwQueryInformationThread(ThreadHandle: HANDLE; ThreadInformationClass: THREADINFOCLASS; ThreadInformation: PVOID; ThreadInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5145 
5146 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5147 function  NtQueryInformationToken(
5148     TokenHandle : HANDLE;
5149     TokenInformationClass : TOKEN_INFORMATION_CLASS;
5150     TokenInformation : PVOID;
5151     TokenInformationLength : ULONG;
5152     ReturnLength : PULONG
5153   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5154 function  ZwQueryInformationToken(TokenHandle: HANDLE; TokenInformationClass: TOKEN_INFORMATION_CLASS; TokenInformation: PVOID; TokenInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5155 
5156 // Compatibility: W2K, WXP, 2K3
5157 function  NtQueryInstallUILanguage(
5158     LanguageId : PLANGID
5159   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5160 function  ZwQueryInstallUILanguage(LanguageId: PLANGID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5161 
5162 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5163 function  NtQueryIntervalProfile(
5164     Source : KPROFILE_SOURCE;
5165     Interval : PULONG
5166   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5167 function  ZwQueryIntervalProfile(Source: KPROFILE_SOURCE; Interval: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5168 
5169 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5170 function  NtQueryIoCompletion(
5171     IoCompletionHandle : HANDLE;
5172     IoCompletionInformationClass : IO_COMPLETION_INFORMATION_CLASS;
5173     IoCompletionInformation : PVOID;
5174     IoCompletionInformationLength : ULONG;
5175     ResultLength : PULONG
5176   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5177 function  ZwQueryIoCompletion(IoCompletionHandle: HANDLE; IoCompletionInformationClass: IO_COMPLETION_INFORMATION_CLASS; IoCompletionInformation: PVOID; IoCompletionInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
5178     {$IFNDEF RTDL}external ntdll;{$ENDIF}
5179 
5180 // Documented in the DDK as ZwQueryKey().
5181 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5182 function  NtQueryKey(
5183     KeyHandle : HANDLE;
5184     KeyInformationClass : KEY_INFORMATION_CLASS;
5185     KeyInformation : PVOID;
5186     KeyInformationLength : ULONG;
5187     ResultLength : PULONG
5188   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5189 function  ZwQueryKey(KeyHandle: HANDLE; KeyInformationClass: KEY_INFORMATION_CLASS; KeyInformation: PVOID; KeyInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5190 
5191 // Compatibility: NT4, W2K, WXP, 2K3
5192 function  NtQueryMultipleValueKey(
5193     KeyHandle : HANDLE;
5194     ValueList : PKEY_VALUE_ENTRY;
5195     NumberOfValues : ULONG;
5196     Buffer : PVOID;
5197     Length : PULONG;
5198     ReturnLength : PULONG
5199   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5200 function  ZwQueryMultipleValueKey(KeyHandle: HANDLE; ValueList: PKEY_VALUE_ENTRY; NumberOfValues: ULONG; Buffer: PVOID; Length: PULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5201 
5202 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5203 function  NtQueryMutant(
5204     MutantHandle : HANDLE;
5205     MutantInformationClass : MUTANT_INFORMATION_CLASS;
5206     MutantInformation : PVOID;
5207     MutantInformationLength : ULONG;
5208     ResultLength : PULONG
5209   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5210 function  ZwQueryMutant(MutantHandle: HANDLE; MutantInformationClass: MUTANT_INFORMATION_CLASS; MutantInformation: PVOID; MutantInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5211 
5212 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5213 function  NtQueryObject(
5214     ObjectHandle : HANDLE;
5215     ObjectInformationClass : OBJECT_INFORMATION_CLASS;
5216     ObjectInformation : PVOID;
5217     ObjectInformationLength : ULONG;
5218     ReturnLength : PULONG
5219   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5220 function  ZwQueryObject(ObjectHandle: HANDLE; ObjectInformationClass: OBJECT_INFORMATION_CLASS; ObjectInformation: PVOID; ObjectInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5221 
5222 // Compatibility: W2K, WXP, 2K3
5223 function  NtQueryOpenSubKeys(
5224     KeyObjectAttributes : POBJECT_ATTRIBUTES;
5225     NumberOfKey : PULONG
5226   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5227 function  ZwQueryOpenSubKeys(KeyObjectAttributes: POBJECT_ATTRIBUTES; NumberOfKey: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5228 
5229 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5230 function  NtQueryPerformanceCounter(
5231     PerformanceCount : PLARGE_INTEGER;
5232     PerformanceFrequency : PLARGE_INTEGER
5233   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5234 function  ZwQueryPerformanceCounter(PerformanceCount: PLARGE_INTEGER; PerformanceFrequency: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5235 
5236 // Compatibility: WXP, 2K3
5237 function  NtQueryPortInformationProcess(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5238 function  ZwQueryPortInformationProcess(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5239 
5240 // Compatibility: W2K, WXP, 2K3
5241 function  NtQueryQuotaInformationFile(
5242     FileHandle : HANDLE;
5243     IoStatusBlock : PIO_STATUS_BLOCK;
5244     Buffer : PFILE_USER_QUOTA_INFORMATION;
5245     BufferLength : ULONG;
5246     ReturnSingleEntry : BOOLEAN;
5247     QuotaList : PFILE_QUOTA_LIST_INFORMATION;
5248     QuotaListLength : ULONG;
5249     ResumeSid : PSID;
5250     RestartScan : BOOLEAN
5251   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5252 function  ZwQueryQuotaInformationFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_USER_QUOTA_INFORMATION; BufferLength: ULONG; ReturnSingleEntry: BOOLEAN; QuotaList: PFILE_QUOTA_LIST_INFORMATION;
5253     QuotaListLength: ULONG; ResumeSid: PSID; RestartScan: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5254 
5255 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5256 function  NtQuerySection(
5257     SectionHandle : HANDLE;
5258     SectionInformationClass : SECTION_INFORMATION_CLASS;
5259     SectionInformation : PVOID;
5260     SectionInformationLength : ULONG;
5261     ResultLength : PULONG
5262   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5263 function  ZwQuerySection(SectionHandle: HANDLE; SectionInformationClass: SECTION_INFORMATION_CLASS; SectionInformation: PVOID; SectionInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5264 
5265 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5266 function  NtQuerySecurityObject(
5267     Handle : HANDLE;
5268     RequestedInformation : SECURITY_INFORMATION;
5269     SecurityDescriptor : PSECURITY_DESCRIPTOR;
5270     SecurityDescriptorLength : ULONG;
5271     ReturnLength : PULONG
5272   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5273 function  ZwQuerySecurityObject(Handle: HANDLE; RequestedInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR; SecurityDescriptorLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;
5274    {$ENDIF}
5275 
5276 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5277 function  NtQuerySemaphore(
5278     SemaphoreHandle : HANDLE;
5279     SemaphoreInformationClass : SEMAPHORE_INFORMATION_CLASS;
5280     SemaphoreInformation : PVOID;
5281     SemaphoreInformationLength : ULONG;
5282     ResultLength : PULONG
5283   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5284 function  ZwQuerySemaphore(SemaphoreHandle: HANDLE; SemaphoreInformationClass: SEMAPHORE_INFORMATION_CLASS; SemaphoreInformation: PVOID; SemaphoreInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
5285     {$IFNDEF RTDL}external ntdll;{$ENDIF}
5286 
5287 // Documented in the DDK as ZwQuerySymbolicLinkObject().
5288 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5289 function  NtQuerySymbolicLinkObject(
5290     SymbolicLinkHandle : HANDLE;
5291     TargetName : PUNICODE_STRING;
5292     ReturnLength : PULONG
5293   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5294 function  ZwQuerySymbolicLinkObject(SymbolicLinkHandle: HANDLE; TargetName: PUNICODE_STRING; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5295 
5296 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5297 function  NtQuerySystemEnvironmentValue(
5298     Name : PUNICODE_STRING;
5299     Value : PVOID;
5300     ValueLength : ULONG;
5301     ReturnLength : PULONG
5302   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5303 function  ZwQuerySystemEnvironmentValue(Name: PUNICODE_STRING; Value: PVOID; ValueLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5304 
5305 {$IFNDEF JWA_INCLUDEMODE}
5306 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5307 function  NtQuerySystemInformation(
5308     SystemInformationClass : SYSTEM_INFORMATION_CLASS;
5309     SystemInformation : PVOID;
5310     SystemInformationLength : ULONG;
5311     ReturnLength : PULONG
5312   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5313 {$ENDIF JWA_INCLUDEMODE}
5314 
5315 function  ZwQuerySystemInformation(SystemInformationClass: SYSTEM_INFORMATION_CLASS; SystemInformation: PVOID; SystemInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5316 
5317 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5318 {$IFNDEF JWA_INCLUDEMODE}
5319 function  NtQuerySystemTime(
5320     CurrentTime : PLARGE_INTEGER
5321   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5322 {$ENDIF JWA_INCLUDEMODE}
5323 
5324 function  ZwQuerySystemTime(CurrentTime: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5325 
5326 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5327 function  NtQueryTimer(
5328     TimerHandle : HANDLE;
5329     TimerInformationClass : TIMER_INFORMATION_CLASS;
5330     TimerInformation : PVOID;
5331     TimerInformationLength : ULONG;
5332     ResultLength : PULONG
5333   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5334 function  ZwQueryTimer(TimerHandle: HANDLE; TimerInformationClass: TIMER_INFORMATION_CLASS; TimerInformation: PVOID; TimerInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5335 
5336 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5337 function  NtQueryTimerResolution(
5338     CoarsestResolution : PULONG;
5339     FinestResolution : PULONG;
5340     ActualResolution : PULONG
5341   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5342 function  ZwQueryTimerResolution(CoarsestResolution: PULONG; FinestResolution: PULONG; ActualResolution: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5343 
5344 // Documented in the DDK as ZwQueryValueKey().
5345 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5346 function  NtQueryValueKey(
5347     KeyHandle : HANDLE;
5348     ValueName : PUNICODE_STRING;
5349     KeyValueInformationClass : KEY_VALUE_INFORMATION_CLASS;
5350     KeyValueInformation : PVOID;
5351     KeyValueInformationLength : ULONG;
5352     ResultLength : PULONG
5353   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5354 function  ZwQueryValueKey(KeyHandle: HANDLE; ValueName: PUNICODE_STRING; KeyValueInformationClass: KEY_VALUE_INFORMATION_CLASS; KeyValueInformation: PVOID; KeyValueInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
5355     {$IFNDEF RTDL}external ntdll;{$ENDIF}
5356 
5357 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5358 function  NtQueryVirtualMemory(
5359     ProcessHandle : HANDLE;
5360     BaseAddress : PVOID;
5361     MemoryInformationClass : MEMORY_INFORMATION_CLASS;
5362     MemoryInformation : PVOID;
5363     MemoryInformationLength : ULONG;
5364     ReturnLength : PULONG
5365   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5366 function  ZwQueryVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PVOID; MemoryInformationClass: MEMORY_INFORMATION_CLASS; MemoryInformation: PVOID; MemoryInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
5367     {$IFNDEF RTDL}external ntdll;{$ENDIF}
5368 
5369 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5370 function  NtQueryVolumeInformationFile(
5371     FileHandle : HANDLE;
5372     IoStatusBlock : PIO_STATUS_BLOCK;
5373     VolumeInformation : PVOID;
5374     VolumeInformationLength : ULONG;
5375     VolumeInformationClass : FS_INFORMATION_CLASS
5376   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5377 function  ZwQueryVolumeInformationFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; VolumeInformation: PVOID; VolumeInformationLength: ULONG; VolumeInformationClass: FS_INFORMATION_CLASS): NTSTATUS; stdcall;
5378     {$IFNDEF RTDL}external ntdll;{$ENDIF}
5379 
5380 // Compatibility: NT4, W2K, WXP, 2K3
5381 function  NtQueueApcThread(
5382     ThreadHandle : HANDLE;
5383     ApcRoutine : PKNORMAL_ROUTINE;
5384     ApcContext : PVOID;
5385     Argument1 : PVOID;
5386     Argument2 : PVOID
5387   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5388 function  ZwQueueApcThread(ThreadHandle: HANDLE; ApcRoutine: PKNORMAL_ROUTINE; ApcContext: PVOID; Argument1: PVOID; Argument2: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5389 
5390 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5391 function  NtRaiseException(
5392     ExceptionRecord : PEXCEPTION_RECORD;
5393     Context : PCONTEXT;
5394     SearchFrames : BOOLEAN
5395   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5396 function  ZwRaiseException(ExceptionRecord: PEXCEPTION_RECORD; Context: PCONTEXT; SearchFrames: BOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5397 
5398 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5399 function  NtRaiseHardError(
5400     Status : NTSTATUS;
5401     NumberOfArguments : ULONG;
5402     StringArgumentsMask : ULONG;
5403     Arguments : PULONG;
5404     MessageBoxType : ULONG;
5405     MessageBoxResult : PULONG
5406   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5407 function  ZwRaiseHardError(Status: NTSTATUS; NumberOfArguments: ULONG; StringArgumentsMask: ULONG; Arguments: PULONG; MessageBoxType: ULONG; MessageBoxResult: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5408 
5409 // Documented in the DDK as ZwReadFile().
5410 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5411 function  NtReadFile(
5412     FileHandle : HANDLE;
5413     Event : HANDLE;
5414     ApcRoutine : PIO_APC_ROUTINE;
5415     ApcContext : PVOID;
5416     IoStatusBlock : PIO_STATUS_BLOCK;
5417     Buffer : PVOID;
5418     Length : ULONG;
5419     ByteOffset : PLARGE_INTEGER;
5420     Key : PULONG
5421   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5422 function  ZwReadFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PVOID; Length: ULONG; ByteOffset: PLARGE_INTEGER; Key: PULONG): NTSTATUS; stdcall;
5423     {$IFNDEF RTDL}external ntdll;{$ENDIF}
5424 
5425 // Compatibility: NT4, W2K, WXP, 2K3
5426 function  NtReadFileScatter(
5427     FileHandle : HANDLE;
5428     Event : HANDLE;
5429     ApcRoutine : PIO_APC_ROUTINE;
5430     ApcContext : PVOID;
5431     IoStatusBlock : PIO_STATUS_BLOCK;
5432     Buffer : PFILE_SEGMENT_ELEMENT;
5433     Length : ULONG;
5434     ByteOffset : PLARGE_INTEGER;
5435     Key : PULONG
5436   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5437 function  ZwReadFileScatter(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_SEGMENT_ELEMENT; Length: ULONG; ByteOffset: PLARGE_INTEGER;
5438     Key: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5439 
5440 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5441 function  NtReadRequestData(
5442     PortHandle : HANDLE;
5443     Message : PPORT_MESSAGE;
5444     Index : ULONG;
5445     Buffer : PVOID;
5446     BufferLength : ULONG;
5447     ReturnLength : PULONG
5448   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5449 function  ZwReadRequestData(PortHandle: HANDLE; Message: PPORT_MESSAGE; Index: ULONG; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5450 
5451 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5452 function  NtReadVirtualMemory(
5453     ProcessHandle : HANDLE;
5454     BaseAddress : PVOID;
5455     Buffer : PVOID;
5456     BufferLength : ULONG;
5457     ReturnLength : PULONG
5458   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5459 function  ZwReadVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PVOID; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5460 
5461 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5462 function  NtRegisterThreadTerminatePort(
5463     PortHandle : HANDLE
5464   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5465 function  ZwRegisterThreadTerminatePort(PortHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5466 
5467 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5468 function  NtReleaseMutant(
5469     MutantHandle : HANDLE;
5470     PreviousState : PULONG
5471   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5472 function  ZwReleaseMutant(MutantHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5473 
5474 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5475 function  NtReleaseSemaphore(
5476     SemaphoreHandle : HANDLE;
5477     ReleaseCount : LONG;
5478     PreviousCount : PLONG
5479   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5480 function  ZwReleaseSemaphore(SemaphoreHandle: HANDLE; ReleaseCount: LONG; PreviousCount: PLONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5481 
5482 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5483 function  NtRemoveIoCompletion(
5484     IoCompletionHandle : HANDLE;
5485     CompletionKey : PULONG;
5486     CompletionValue : PULONG;
5487     IoStatusBlock : PIO_STATUS_BLOCK;
5488     Timeout : PLARGE_INTEGER
5489   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5490 function  ZwRemoveIoCompletion(IoCompletionHandle: HANDLE; CompletionKey: PULONG; CompletionValue: PULONG; IoStatusBlock: PIO_STATUS_BLOCK; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5491 
5492 // Compatibility: WXP, 2K3
5493 function  NtRemoveProcessDebug(
5494     hProcess : HANDLE;
5495     hDebugObject : HANDLE
5496   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5497 function  ZwRemoveProcessDebug(hProcess: HANDLE; hDebugObject: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5498 
5499 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5500 function  NtReplaceKey(
5501     NewFileObjectAttributes : POBJECT_ATTRIBUTES;
5502     KeyHandle : HANDLE;
5503     OldFileObjectAttributes : POBJECT_ATTRIBUTES
5504   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5505 function  ZwReplaceKey(NewFileObjectAttributes: POBJECT_ATTRIBUTES; KeyHandle: HANDLE; OldFileObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5506 
5507 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5508 function  NtReplyPort(
5509     PortHandle : HANDLE;
5510     ReplyMessage : PPORT_MESSAGE
5511   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5512 function  ZwReplyPort(PortHandle: HANDLE; ReplyMessage: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5513 
5514 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5515 function  NtReplyWaitReceivePort(
5516     PortHandle : HANDLE;
5517     PortIdentifier : PULONG;
5518     ReplyMessage : PPORT_MESSAGE;
5519     Message : PPORT_MESSAGE
5520   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5521 function  ZwReplyWaitReceivePort(PortHandle: HANDLE; PortIdentifier: PULONG; ReplyMessage: PPORT_MESSAGE; Message: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5522 
5523 // Compatibility: W2K, WXP, 2K3
5524 function  NtReplyWaitReceivePortEx(
5525     PortHandle : HANDLE;
5526     PortIdentifier : PULONG;
5527     ReplyMessage : PPORT_MESSAGE;
5528     Message : PPORT_MESSAGE;
5529     Timeout : PLARGE_INTEGER
5530   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5531 function  ZwReplyWaitReceivePortEx(PortHandle: HANDLE; PortIdentifier: PULONG; ReplyMessage: PPORT_MESSAGE; Message: PPORT_MESSAGE; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5532 
5533 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5534 function  NtReplyWaitReplyPort(
5535     PortHandle : HANDLE;
5536     ReplyMessage : PPORT_MESSAGE
5537   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5538 function  ZwReplyWaitReplyPort(PortHandle: HANDLE; ReplyMessage: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5539 
5540 // Returns STATUS_NOT_IMPLEMENTED. Only MS knows the intention behind this.
5541 //
5542 // !!!DO NOT USE!!!
5543 // Compatibility: NT4, W2K
5544 function  NtReplyWaitSendChannel(
5545     x : PVOID;
5546     y : PVOID;
5547     z : PVOID
5548   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5549 function  ZwReplyWaitSendChannel(x: PVOID; y: PVOID; z: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5550 
5551 // Compatibility: W2K, WXP, 2K3
5552 function  NtRequestDeviceWakeup(
5553     DeviceHandle : HANDLE
5554   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5555 function  ZwRequestDeviceWakeup(DeviceHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5556 
5557 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5558 function  NtRequestPort(
5559     PortHandle : HANDLE;
5560     RequestMessage : PPORT_MESSAGE
5561   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5562 function  ZwRequestPort(PortHandle: HANDLE; RequestMessage: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5563 
5564 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5565 function  NtRequestWaitReplyPort(
5566     PortHandle : HANDLE;
5567     RequestMessage : PPORT_MESSAGE;
5568     ReplyMessage : PPORT_MESSAGE
5569   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5570 function  ZwRequestWaitReplyPort(PortHandle: HANDLE; RequestMessage: PPORT_MESSAGE; ReplyMessage: PPORT_MESSAGE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5571 
5572 // Compatibility: W2K, WXP, 2K3
5573 function  NtRequestWakeupLatency(
5574     Latency : LATENCY_TIME
5575   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5576 function  ZwRequestWakeupLatency(Latency: LATENCY_TIME): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5577 
5578 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5579 function  NtResetEvent(
5580     EventHandle : HANDLE;
5581     PreviousState : PULONG
5582   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5583 function  ZwResetEvent(EventHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5584 
5585 // Compatibility: W2K, WXP, 2K3
5586 function  NtResetWriteWatch(
5587     ProcessHandle : HANDLE;
5588     BaseAddress : PVOID;
5589     RegionSize : ULONG
5590   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5591 function  ZwResetWriteWatch(ProcessHandle: HANDLE; BaseAddress: PVOID; RegionSize: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5592 
5593 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5594 function  NtRestoreKey(
5595     KeyHandle : HANDLE;
5596     FileHandle : HANDLE;
5597     Flags : ULONG
5598   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5599 function  ZwRestoreKey(KeyHandle: HANDLE; FileHandle: HANDLE; Flags: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5600 
5601 // Compatibility: WXP, 2K3
5602 function  NtResumeProcess(
5603     hProcess : HANDLE
5604   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5605 function  ZwResumeProcess(hProcess: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5606 
5607 // This function is very similar to ResumeThread() from Kernel32.dll. Refer
5608 // to the PSDK for additional information. Usually the same flags apply.
5609 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5610 function  NtResumeThread(
5611     hThread : HANDLE;
5612     dwResumeCount : PULONG
5613   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5614 function  ZwResumeThread(hThread: HANDLE; dwResumeCount: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5615 
5616 // Relates to RegSaveKey().
5617 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5618 function  NtSaveKey(
5619     KeyHandle : HANDLE;
5620     FileHandle : HANDLE
5621   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5622 function  ZwSaveKey(KeyHandle: HANDLE; FileHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5623 
5624 // Relates to RegSaveKeyEx().
5625 // Compatibility: WXP, 2K3
5626 function  NtSaveKeyEx(
5627     KeyHandle : HANDLE;
5628     FileHandle : HANDLE;
5629     Flags : DWORD
5630   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5631 function  ZwSaveKeyEx(KeyHandle: HANDLE; FileHandle: HANDLE; Flags: DWORD): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5632 
5633 // Compatibility: W2K, WXP, 2K3
5634 function  NtSaveMergedKeys(
5635     KeyHandle1 : HANDLE;
5636     KeyHandle2 : HANDLE;
5637     FileHandle : HANDLE
5638   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5639 function  ZwSaveMergedKeys(KeyHandle1: HANDLE; KeyHandle2: HANDLE; FileHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5640 
5641 // Compatibility: W2K, WXP, 2K3
5642 function  NtSecureConnectPort(
5643     PortHandle : PHANDLE;
5644     PortName : PUNICODE_STRING;
5645     SecurityQos : PSECURITY_QUALITY_OF_SERVICE;
5646     WriteSection : PPORT_SECTION_WRITE;
5647     ServerSid : PSID;
5648     ReadSection : PPORT_SECTION_READ;
5649     MaxMessageSize : PULONG;
5650     ConnectData : PVOID;
5651     ConnectDataLength : PULONG
5652   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5653 function  ZwSecureConnectPort(PortHandle: PHANDLE; PortName: PUNICODE_STRING; SecurityQos: PSECURITY_QUALITY_OF_SERVICE; WriteSection: PPORT_SECTION_WRITE; ServerSid: PSID; ReadSection: PPORT_SECTION_READ; MaxMessageSize: PULONG;
5654     ConnectData: PVOID; ConnectDataLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5655 
5656 // Returns STATUS_NOT_IMPLEMENTED. Only MS knows the intention behind this.
5657 //
5658 // !!!DO NOT USE!!!
5659 // Compatibility: NT4, W2K
5660 function  NtSendWaitReplyChannel(
5661     x : PVOID;
5662     y : PVOID;
5663     z : PVOID;
5664     z2 : PVOID
5665   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5666 function  ZwSendWaitReplyChannel(x: PVOID; y: PVOID; z: PVOID; z2: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5667 
5668 // Returns STATUS_NOT_IMPLEMENTED. Only MS knows the intention behind this.
5669 //
5670 // !!!DO NOT USE!!!
5671 // Compatibility: NT4, W2K
5672 function  NtSetContextChannel(
5673     x : PVOID
5674   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5675 function  ZwSetContextChannel(x: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5676 
5677 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5678 function  NtSetContextThread(
5679     ThreadHandle : HANDLE;
5680     Context : PCONTEXT
5681   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5682 function  ZwSetContextThread(ThreadHandle: HANDLE; Context: PCONTEXT): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5683 
5684 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5685 function  NtSetDefaultHardErrorPort(
5686     PortHandle : HANDLE
5687   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5688 function  ZwSetDefaultHardErrorPort(PortHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5689 
5690 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5691 function  NtSetDefaultLocale(
5692     ThreadOrSystem : BOOLEAN;
5693     Locale : LCID
5694   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5695 function  ZwSetDefaultLocale(ThreadOrSystem: BOOLEAN; Locale: LCID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5696 
5697 // Compatibility: W2K, WXP, 2K3
5698 function  NtSetDefaultUILanguage(
5699     LanguageId : LANGID
5700   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5701 function  ZwSetDefaultUILanguage(LanguageId: LANGID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5702 
5703 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5704 function  NtSetEaFile(
5705     FileHandle : HANDLE;
5706     IoStatusBlock : PIO_STATUS_BLOCK;
5707     Buffer : PFILE_FULL_EA_INFORMATION;
5708     BufferLength : ULONG
5709   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5710 function  ZwSetEaFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_FULL_EA_INFORMATION; BufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5711 
5712 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5713 function  NtSetEvent(
5714     EventHandle : HANDLE;
5715     PreviousState : PULONG
5716   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5717 function  ZwSetEvent(EventHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5718 
5719 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5720 function  NtSetHighEventPair(
5721     EventPairHandle : HANDLE
5722   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5723 function  ZwSetHighEventPair(EventPairHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5724 
5725 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5726 function  NtSetHighWaitLowEventPair(
5727     EventPairHandle : HANDLE
5728   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5729 function  ZwSetHighWaitLowEventPair(EventPairHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5730 
5731 // Compatibility: NT3, NT4
5732 function  NtSetHighWaitLowThread(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5733 function  ZwSetHighWaitLowThread(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5734 
5735 // Documented in the DDK as ZwSetInformationFile().
5736 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5737 function  NtSetInformationFile(
5738     FileHandle : HANDLE;
5739     IoStatusBlock : PIO_STATUS_BLOCK;
5740     FileInformation : PVOID;
5741     FileInformationLength : ULONG;
5742     FileInformationClass : FILE_INFORMATION_CLASS
5743   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5744 function  ZwSetInformationFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; FileInformation: PVOID; FileInformationLength: ULONG; FileInformationClass: FILE_INFORMATION_CLASS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;
5745    {$ENDIF}
5746 
5747 // Compatibility: W2K, WXP, 2K3
5748 function  NtSetInformationJobObject(
5749     JobHandle : HANDLE;
5750     JobInformationClass : JOBOBJECTINFOCLASS;
5751     JobInformation : PVOID;
5752     JobInformationLength : ULONG
5753   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5754 function  ZwSetInformationJobObject(JobHandle: HANDLE; JobInformationClass: JOBOBJECTINFOCLASS; JobInformation: PVOID; JobInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5755 
5756 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5757 function  NtSetInformationKey(
5758     KeyHandle : HANDLE;
5759     KeyInformationClass : KEY_SET_INFORMATION_CLASS;
5760     KeyInformation : PVOID;
5761     KeyInformationLength : ULONG
5762   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5763 function  ZwSetInformationKey(KeyHandle: HANDLE; KeyInformationClass: KEY_SET_INFORMATION_CLASS; KeyInformation: PVOID; KeyInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5764 
5765 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5766 function  NtSetInformationObject(
5767     ObjectHandle : HANDLE;
5768     ObjectInformationClass : OBJECT_INFORMATION_CLASS;
5769     ObjectInformation : PVOID;
5770     ObjectInformationLength : ULONG
5771   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5772 function  ZwSetInformationObject(ObjectHandle: HANDLE; ObjectInformationClass: OBJECT_INFORMATION_CLASS; ObjectInformation: PVOID; ObjectInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5773 
5774 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5775 function  NtSetInformationProcess(
5776     ProcessHandle : HANDLE;
5777     ProcessInformationClass : PROCESSINFOCLASS;
5778     ProcessInformation : PVOID;
5779     ProcessInformationLength : ULONG
5780   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5781 function  ZwSetInformationProcess(ProcessHandle: HANDLE; ProcessInformationClass: PROCESSINFOCLASS; ProcessInformation: PVOID; ProcessInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5782 
5783 // Documented in the DDK as ZwSetInformationThread().
5784 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5785 function  NtSetInformationThread(
5786     ThreadHandle : HANDLE;
5787     ThreadInformationClass : THREADINFOCLASS;
5788     ThreadInformation : PVOID;
5789     ThreadInformationLength : ULONG
5790   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5791 function  ZwSetInformationThread(ThreadHandle: HANDLE; ThreadInformationClass: THREADINFOCLASS; ThreadInformation: PVOID; ThreadInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5792 
5793 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5794 function  NtSetInformationToken(
5795     TokenHandle : HANDLE;
5796     TokenInformationClass : TOKEN_INFORMATION_CLASS;
5797     TokenInformation : PVOID;
5798     TokenInformationLength : ULONG
5799   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5800 function  ZwSetInformationToken(TokenHandle: HANDLE; TokenInformationClass: TOKEN_INFORMATION_CLASS; TokenInformation: PVOID; TokenInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5801 
5802 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5803 function  NtSetIntervalProfile(
5804     Interval : ULONG;
5805     Source : KPROFILE_SOURCE
5806   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5807 function  ZwSetIntervalProfile(Interval: ULONG; Source: KPROFILE_SOURCE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5808 
5809 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5810 function  NtSetIoCompletion(
5811     IoCompletionHandle : HANDLE;
5812     CompletionKey : ULONG;
5813     CompletionValue : ULONG;
5814     Status : NTSTATUS;
5815     Information : ULONG
5816   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5817 function  ZwSetIoCompletion(IoCompletionHandle: HANDLE; CompletionKey: ULONG; CompletionValue: ULONG; Status: NTSTATUS; Information: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5818 
5819 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5820 function  NtSetLdtEntries(
5821     Selector1 : ULONG;
5822     LdtEntry1 : LDT_ENTRY;
5823     Selector2 : ULONG;
5824     LdtEntry2 : LDT_ENTRY
5825   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5826 function  ZwSetLdtEntries(Selector1: ULONG; LdtEntry1: LDT_ENTRY; Selector2: ULONG; LdtEntry2: LDT_ENTRY): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5827 
5828 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5829 function  NtSetLowEventPair(
5830     EventPairHandle : HANDLE
5831   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5832 function  ZwSetLowEventPair(EventPairHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5833 
5834 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5835 function  NtSetLowWaitHighEventPair(
5836     EventPairHandle : HANDLE
5837   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5838 function  ZwSetLowWaitHighEventPair(EventPairHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5839 
5840 // Compatibility: NT3, NT4
5841 function  NtSetLowWaitHighThread(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5842 function  ZwSetLowWaitHighThread(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5843 
5844 // Compatibility: W2K, WXP, 2K3
5845 function  NtSetQuotaInformationFile(
5846     FileHandle : HANDLE;
5847     IoStatusBlock : PIO_STATUS_BLOCK;
5848     Buffer : PFILE_USER_QUOTA_INFORMATION;
5849     BufferLength : ULONG
5850   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5851 function  ZwSetQuotaInformationFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_USER_QUOTA_INFORMATION; BufferLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5852 
5853 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5854 function  NtSetSecurityObject(
5855     Handle : HANDLE;
5856     SecurityInformation : SECURITY_INFORMATION;
5857     SecurityDescriptor : PSECURITY_DESCRIPTOR
5858   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5859 function  ZwSetSecurityObject(Handle: HANDLE; SecurityInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5860 
5861 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5862 function  NtSetSystemEnvironmentValue(
5863     Name : PUNICODE_STRING;
5864     Value : PUNICODE_STRING
5865   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5866 function  ZwSetSystemEnvironmentValue(Name: PUNICODE_STRING; Value: PUNICODE_STRING): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5867 
5868 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5869 function  NtSetSystemInformation(
5870     SystemInformationClass : SYSTEM_INFORMATION_CLASS;
5871     SystemInformation : PVOID;
5872     SystemInformationLength : ULONG
5873   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5874 function  ZwSetSystemInformation(SystemInformationClass: SYSTEM_INFORMATION_CLASS; SystemInformation: PVOID; SystemInformationLength: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5875 
5876 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5877 function  NtSetSystemPowerState(
5878     SystemAction : POWER_ACTION;
5879     MinSystemState : SYSTEM_POWER_STATE;
5880     Flags : ULONG
5881   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5882 function  ZwSetSystemPowerState(SystemAction: POWER_ACTION; MinSystemState: SYSTEM_POWER_STATE; Flags: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5883 
5884 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5885 function  NtSetSystemTime(
5886     NewTime : PLARGE_INTEGER;
5887     OldTime : PLARGE_INTEGER
5888   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5889 function  ZwSetSystemTime(NewTime: PLARGE_INTEGER; OldTime: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5890 
5891 // Compatibility: W2K, WXP, 2K3
5892 function  NtSetThreadExecutionState(
5893     ExecutionState : EXECUTION_STATE;
5894     PreviousExecutionState : PEXECUTION_STATE
5895   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5896 function  ZwSetThreadExecutionState(ExecutionState: EXECUTION_STATE; PreviousExecutionState: PEXECUTION_STATE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5897 
5898 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5899 function  NtSetTimer(
5900     TimerHandle : HANDLE;
5901     DueTime : PLARGE_INTEGER;
5902     TimerApcRoutine : PTIMER_APC_ROUTINE;
5903     TimerContext : PVOID;
5904     Resume : BOOLEAN;
5905     Period : LONG;
5906     PreviousState : PBOOLEAN
5907   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5908 function  ZwSetTimer(TimerHandle: HANDLE; DueTime: PLARGE_INTEGER; TimerApcRoutine: PTIMER_APC_ROUTINE; TimerContext: PVOID; Resume: BOOLEAN; Period: LONG; PreviousState: PBOOLEAN): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5909 
5910 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5911 function  NtSetTimerResolution(
5912     RequestedResolution : ULONG;
5913     Set_ : BOOLEAN;
5914     ActualResolution : PULONG
5915   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5916 function  ZwSetTimerResolution(RequestedResolution: ULONG; Set_: BOOLEAN; ActualResolution: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5917 
5918 // Compatibility: W2K, WXP, 2K3
5919 function  NtSetUuidSeed(
5920     UuidSeed : PUCHAR
5921   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5922 function  ZwSetUuidSeed(UuidSeed: PUCHAR): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5923 
5924 // Documented in the DDK as ZwSetValueKey().
5925 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5926 function  NtSetValueKey(
5927     KeyHandle : HANDLE;
5928     ValueName : PUNICODE_STRING;
5929     TitleIndex : ULONG;
5930     Type_ : ULONG;
5931     Data : PVOID;
5932     DataSize : ULONG
5933   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5934 function  ZwSetValueKey(KeyHandle: HANDLE; ValueName: PUNICODE_STRING; TitleIndex: ULONG; Type_: ULONG; Data: PVOID; DataSize: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5935 
5936 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5937 function  NtSetVolumeInformationFile(
5938     FileHandle : HANDLE;
5939     IoStatusBlock : PIO_STATUS_BLOCK;
5940     Buffer : PVOID;
5941     BufferLength : ULONG;
5942     VolumeInformationClass : FS_INFORMATION_CLASS
5943   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5944 function  ZwSetVolumeInformationFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PVOID; BufferLength: ULONG; VolumeInformationClass: FS_INFORMATION_CLASS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5945 
5946 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5947 function  NtShutdownSystem(
5948     Action : SHUTDOWN_ACTION
5949   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5950 function  ZwShutdownSystem(Action: SHUTDOWN_ACTION): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5951 
5952 // Compatibility: NT4, W2K, WXP, 2K3
5953 function  NtSignalAndWaitForSingleObject(
5954     HandleToSignal : HANDLE;
5955     HandleToWait : HANDLE;
5956     Alertable : BOOLEAN;
5957     Timeout : PLARGE_INTEGER
5958   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5959 function  ZwSignalAndWaitForSingleObject(HandleToSignal: HANDLE; HandleToWait: HANDLE; Alertable: BOOLEAN; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5960 
5961 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5962 function  NtStartProfile(
5963     ProfileHandle : HANDLE
5964   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5965 function  ZwStartProfile(ProfileHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5966 
5967 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5968 function  NtStopProfile(
5969     ProfileHandle : HANDLE
5970   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5971 function  ZwStopProfile(ProfileHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5972 
5973 // Compatibility: WXP, 2K3
5974 function  NtSuspendProcess(
5975     hProcess : HANDLE
5976   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5977 function  ZwSuspendProcess(hProcess: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5978 
5979 // This function is very similar to SuspendThread() from Kernel32.dll.
5980 // Refer to the PSDK for additional information. Usually the same flags
5981 // apply.
5982 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5983 function  NtSuspendThread(
5984     hThread : HANDLE;
5985     dwLastResumeCount : PULONG
5986   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5987 function  ZwSuspendThread(hThread: HANDLE; dwLastResumeCount: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5988 
5989 // Compatibility: NT3, NT4, W2K, WXP, 2K3
5990 function  NtSystemDebugControl(
5991     ControlCode : DEBUG_CONTROL_CODE;
5992     InputBuffer : PVOID;
5993     InputBufferLength : ULONG;
5994     OutputBuffer : PVOID;
5995     OutputBufferLength : ULONG;
5996     ReturnLength : PULONG
5997   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5998 function  ZwSystemDebugControl(ControlCode: DEBUG_CONTROL_CODE; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID; OutputBufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
5999 
6000 // Compatibility: W2K, WXP, 2K3
6001 function  NtTerminateJobObject(
6002     JobHandle : HANDLE;
6003     ExitStatus : NTSTATUS
6004   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6005 function  ZwTerminateJobObject(JobHandle: HANDLE; ExitStatus: NTSTATUS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6006 
6007 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6008 function  NtTerminateProcess(
6009     ProcessHandle : HANDLE;
6010     ExitStatus : NTSTATUS
6011   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6012 function  ZwTerminateProcess(ProcessHandle: HANDLE; ExitStatus: NTSTATUS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6013 
6014 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6015 function  NtTerminateThread(
6016     ThreadHandle : HANDLE;
6017     ExitStatus : NTSTATUS
6018   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6019 function  ZwTerminateThread(ThreadHandle: HANDLE; ExitStatus: NTSTATUS): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6020 
6021 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6022 function  NtTestAlert(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6023 function  ZwTestAlert(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6024 
6025 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6026 function  NtUnloadDriver(
6027     DriverServiceName : PUNICODE_STRING
6028   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6029 function  ZwUnloadDriver(DriverServiceName: PUNICODE_STRING): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6030 
6031 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6032 function  NtUnloadKey(
6033     KeyObjectAttributes : POBJECT_ATTRIBUTES
6034   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6035 function  ZwUnloadKey(KeyObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6036 
6037 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6038 function  NtUnlockFile(
6039     FileHandle : HANDLE;
6040     IoStatusBlock : PIO_STATUS_BLOCK;
6041     LockOffset : PULARGE_INTEGER;
6042     LockLength : PULARGE_INTEGER;
6043     Key : ULONG
6044   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6045 function  ZwUnlockFile(FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; LockOffset: PULARGE_INTEGER; LockLength: PULARGE_INTEGER; Key: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6046 
6047 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6048 function  NtUnlockVirtualMemory(
6049     ProcessHandle : HANDLE;
6050     BaseAddress : PPVOID;
6051     LockSize : PULONG;
6052     LockType : ULONG
6053   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6054 function  ZwUnlockVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PPVOID; LockSize: PULONG; LockType: ULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6055 
6056 // Documented in the DDK as ZwUnmapViewOfSection().
6057 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6058 function  NtUnmapViewOfSection(
6059     ProcessHandle : HANDLE;
6060     BaseAddress : PVOID
6061   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6062 function  ZwUnmapViewOfSection(ProcessHandle: HANDLE; BaseAddress: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6063 
6064 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6065 function  NtVdmControl(
6066     ControlCode : ULONG;
6067     ControlData : PVOID
6068   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6069 function  ZwVdmControl(ControlCode: ULONG; ControlData: PVOID): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6070 
6071 // Compatibility: NT3
6072 function  NtW32Call(
6073     RoutineIndex : ULONG;
6074     Argument : PVOID;
6075     ArgumentLength : ULONG;
6076     Result_ : PPVOID;
6077     ResultLength : PULONG
6078   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6079 function  ZwW32Call(RoutineIndex: ULONG; Argument: PVOID; ArgumentLength: ULONG; Result_: PPVOID; ResultLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6080 
6081 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6082 function  NtWaitForMultipleObjects(
6083     HandleCount : ULONG;
6084     Handles : PHANDLE;
6085     WaitType : WAIT_TYPE;
6086     Alertable : BOOLEAN;
6087     Timeout : PLARGE_INTEGER
6088   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6089 function  ZwWaitForMultipleObjects(HandleCount: ULONG; Handles: PHANDLE; WaitType: WAIT_TYPE; Alertable: BOOLEAN; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6090 
6091 {$IFNDEF JWA_INCLUDEMODE}
6092 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6093 function  NtWaitForSingleObject(
6094     Handle : HANDLE;
6095     Alertable : BOOLEAN;
6096     Timeout : PLARGE_INTEGER
6097   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6098 {$ENDIF JWA_INCLUDEMODE}
6099 
6100 function  ZwWaitForSingleObject(Handle: HANDLE; Alertable: BOOLEAN; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6101 
6102 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6103 function  NtWaitHighEventPair(
6104     EventPairHandle : HANDLE
6105   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6106 function  ZwWaitHighEventPair(EventPairHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6107 
6108 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6109 function  NtWaitLowEventPair(
6110     EventPairHandle : HANDLE
6111   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6112 function  ZwWaitLowEventPair(EventPairHandle: HANDLE): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6113 
6114 // Documented in the DDK as ZwWriteFile().
6115 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6116 function  NtWriteFile(
6117     FileHandle : HANDLE;
6118     Event : HANDLE;
6119     ApcRoutine : PIO_APC_ROUTINE;
6120     ApcContext : PVOID;
6121     IoStatusBlock : PIO_STATUS_BLOCK;
6122     Buffer : PVOID;
6123     Length : ULONG;
6124     ByteOffset : PLARGE_INTEGER;
6125     Key : PULONG
6126   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6127 function  ZwWriteFile(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PVOID; Length: ULONG; ByteOffset: PLARGE_INTEGER; Key: PULONG): NTSTATUS; stdcall;
6128     {$IFNDEF RTDL}external ntdll;{$ENDIF}
6129 
6130 // Compatibility: NT4, W2K, WXP, 2K3
6131 function  NtWriteFileGather(
6132     FileHandle : HANDLE;
6133     Event : HANDLE;
6134     ApcRoutine : PIO_APC_ROUTINE;
6135     ApcContext : PVOID;
6136     IoStatusBlock : PIO_STATUS_BLOCK;
6137     Buffer : PFILE_SEGMENT_ELEMENT;
6138     Length : ULONG;
6139     ByteOffset : PLARGE_INTEGER;
6140     Key : PULONG
6141   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6142 function  ZwWriteFileGather(FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_SEGMENT_ELEMENT; Length: ULONG; ByteOffset: PLARGE_INTEGER;
6143     Key: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6144 
6145 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6146 function  NtWriteRequestData(
6147     PortHandle : HANDLE;
6148     Message : PPORT_MESSAGE;
6149     Index : ULONG;
6150     Buffer : PVOID;
6151     BufferLength : ULONG;
6152     ReturnLength : PULONG
6153   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6154 function  ZwWriteRequestData(PortHandle: HANDLE; Message: PPORT_MESSAGE; Index: ULONG; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6155 
6156 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6157 function  NtWriteVirtualMemory(
6158     ProcessHandle : HANDLE;
6159     BaseAddress : PVOID;
6160     Buffer : PVOID;
6161     BufferLength : ULONG;
6162     ReturnLength : PULONG
6163   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6164 function  ZwWriteVirtualMemory(ProcessHandle: HANDLE; BaseAddress: PVOID; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6165 
6166 // Compatibility: NT4, W2K, WXP, 2K3
6167 function  NtYieldExecution(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6168 function  ZwYieldExecution(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6169 
6170 // This function is very similar to MakeSelfRelativeSD() from Advapi32.dll.
6171 // Refer to the PSDK for additional information. Usually the same flags
6172 // apply.
6173 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6174 function  RtlAbsoluteToSelfRelativeSD(
6175     pAbsoluteSD : PSECURITY_DESCRIPTOR;
6176     pSelfRelativeSD : PSECURITY_DESCRIPTOR;
6177     lpdwBufferLength : LPDWORD
6178   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6179 
6180 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6181 procedure RtlAcquirePebLock(); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6182 
6183 // This function is very similar to AddAccessAllowedAce() from
6184 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6185 // same flags apply.
6186 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6187 function  RtlAddAccessAllowedAce(
6188     pAcl: PACL;
6189     dwAceRevision : DWORD;
6190     AccessMask : ACCESS_MASK;
6191     pSid : PSID
6192   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6193 
6194 // This function is very similar to AddAccessAllowedAceEx() from
6195 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6196 // same flags apply.
6197 // Compatibility: W2K, WXP, 2K3
6198 function  RtlAddAccessAllowedAceEx(
6199     pAcl : PACL;
6200     dwAceRevision : DWORD;
6201     AceFlags : DWORD;
6202     AccessMask : ACCESS_MASK;
6203     pSid : PSID
6204   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6205 
6206 // This function is very similar to AddAccessDeniedAce() from Advapi32.dll.
6207 // Refer to the PSDK for additional information. Usually the same flags
6208 // apply.
6209 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6210 function  RtlAddAccessDeniedAce(
6211     pAcl : PACL;
6212     dwAceRevision : DWORD;
6213     AccessMask : ACCESS_MASK;
6214     pSid : PSID
6215   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6216 
6217 // This function is very similar to AddAccessDeniedAceEx() from
6218 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6219 // same flags apply.
6220 // Compatibility: W2K, WXP, 2K3
6221 function  RtlAddAccessDeniedAceEx(
6222     pAcl : PACL;
6223     dwAceRevision : DWORD;
6224     AceFlags : DWORD;
6225     AccessMask : ACCESS_MASK;
6226     pSid : PSID
6227   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6228 
6229 // This function is very similar to AddAce() from Advapi32.dll. Refer to
6230 // the PSDK for additional information. Usually the same flags apply.
6231 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6232 function  RtlAddAce(
6233     pAcl : PACL;
6234     dwAceRevision : DWORD;
6235     dwStartingAceIndex : DWORD;
6236     pAceList : PVOID;
6237     nAceListLength : DWORD
6238   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6239 
6240 // This function is very similar to AddAuditAccessAce() from Advapi32.dll.
6241 // Refer to the PSDK for additional information. Usually the same flags
6242 // apply.
6243 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6244 function  RtlAddAuditAccessAce(
6245     pAcl : PACL;
6246     dwAceRevision : DWORD;
6247     AccessMask : ACCESS_MASK;
6248     pSid : PSID;
6249     bAuditSuccess : BOOLEAN;
6250     bAuditFailure : BOOLEAN
6251   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6252 
6253 // This function is very similar to AddAuditAccessAceEx() from
6254 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6255 // same flags apply.
6256 // Compatibility: W2K, WXP, 2K3
6257 function  RtlAddAuditAccessAceEx(
6258     pAcl : PACL;
6259     dwAceRevision : DWORD;
6260     AceFlags : DWORD;
6261     AccessMask : ACCESS_MASK;
6262     pSid : PSID;
6263     bAuditSuccess : BOOLEAN;
6264     bAuditFailure : BOOLEAN
6265   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6266 
6267 // Compatibility: W2K, WXP
6268 function  RtlAddRange(
6269     RangeList : PRTL_RANGE_LIST;
6270     Start : ULONGLONG;
6271     End_ : ULONGLONG;
6272     Attributes : UCHAR;
6273     Flags : ULONG;
6274     UserData : PVOID;
6275     Owner : PVOID
6276   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6277 
6278 // Compatibility: WXP, 2K3
6279 function  RtlAddVectoredExceptionHandler(
6280     FirstHandler : ULONG;
6281     VectoredHandler : PVECTORED_EXCEPTION_HANDLER
6282   ): PVOID; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6283 
6284 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6285 function  RtlAdjustPrivilege(
6286     Privilege : ULONG;
6287     Enable : BOOLEAN;
6288     CurrentThread : BOOLEAN;
6289     Enabled : PBOOLEAN
6290   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6291 
6292 // This function is very similar to AllocateAndInitializeSid() from
6293 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6294 // same flags apply.
6295 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6296 function  RtlAllocateAndInitializeSid(
6297     pIdentifierAuthority : PSID_IDENTIFIER_AUTHORITY;
6298     SubAuthorityCount : BYTE;
6299     nSubAuthority0 : DWORD;
6300     nSubAuthority1 : DWORD;
6301     nSubAuthority2 : DWORD;
6302     nSubAuthority3 : DWORD;
6303     nSubAuthority4 : DWORD;
6304     nSubAuthority5 : DWORD;
6305     nSubAuthority6 : DWORD;
6306     nSubAuthority7 : DWORD;
6307     var pSid : PSID
6308   ): BOOL; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6309 
6310 // The function HeapAlloc() from Kernel32.dll is an export forwarder to
6311 // this function. This means you can refer to the documentation of
6312 // HeapAlloc()!
6313 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6314 function  RtlAllocateHeap(
6315     hHeap : HANDLE;
6316     dwFlags : ULONG;
6317     Size : ULONG
6318   ): PVOID; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6319 
6320 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6321 function  RtlAnsiCharToUnicodeChar(
6322     AnsiChar : CHAR
6323   ): WCHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6324 
6325 // Documented in the DDK.
6326 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6327 function  RtlAnsiStringToUnicodeSize(
6328     AnsiString : PANSI_STRING
6329   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6330 
6331 {$IFNDEF JWA_INCLUDEMODE}
6332 // Documented in the DDK.
6333 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6334 function  RtlAnsiStringToUnicodeString(
6335     DestinationString : PUNICODE_STRING;
6336     SourceString : PANSI_STRING;
6337     AllocateDestinationString : BOOLEAN
6338   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6339 {$ENDIF JWA_INCLUDEMODE}
6340 
6341 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6342 function  RtlAppendAsciizToString(
6343     DestinationString : PSTRING;
6344     AppendThisString : LPCSTR
6345   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6346 
6347 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6348 function  RtlAppendStringToString(
6349     DestinationString : PSTRING;
6350     AppendThisString : PSTRING
6351   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6352 
6353 // Documented in the DDK.
6354 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6355 function  RtlAppendUnicodeStringToString(
6356     DestinationString : PUNICODE_STRING;
6357     SourceString : PUNICODE_STRING
6358   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6359 
6360 // Documented in the DDK.
6361 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6362 function  RtlAppendUnicodeToString(
6363     Destination : PUNICODE_STRING;
6364     Source : LPCWSTR
6365   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6366 
6367 // This function is very similar to AreAllAccessesGranted() from
6368 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6369 // same flags apply.
6370 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6371 function  RtlAreAllAccessesGranted(
6372     GrantedAccess : ACCESS_MASK;
6373     WantedAccess : ACCESS_MASK
6374   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6375 
6376 // This function is very similar to AreAnyAccessesGranted() from
6377 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6378 // same flags apply.
6379 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6380 function  RtlAreAnyAccessesGranted(
6381     GrantedAccess : ACCESS_MASK;
6382     WantedAccess : ACCESS_MASK
6383   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6384 
6385 // Documented in the DDK.
6386 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6387 function  RtlAreBitsClear(
6388     BitMapHeader : PRTL_BITMAP;
6389     StartingIndex : ULONG;
6390     Length : ULONG
6391   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6392 
6393 // Documented in the DDK.
6394 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6395 function  RtlAreBitsSet(
6396     BitMapHeader : PRTL_BITMAP;
6397     StartingIndex : ULONG;
6398     Length : ULONG
6399   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6400 
6401 // Mentioned in the DDK.
6402 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6403 procedure RtlAssert(
6404     FailedAssertion : PVOID;
6405     FileName : PVOID;
6406     LineNumber : ULONG;
6407     Message : PCHAR
6408   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6409 {$IFNDEF JWA_INCLUDEMODE}
6410 // The function RtlCaptureContext() from Kernel32.dll is an export
6411 // forwarder to this function. This means you can refer to the
6412 // documentation of RtlCaptureContext()!
6413 // Compatibility: WXP, 2K3
6414 procedure RtlCaptureContext(
6415     ContextRecord : PCONTEXT
6416   ); stdcall;  {$IFNDEF RTDL}external ntdll;{$ENDIF}
6417 {$ENDIF JWA_INCLUDEMODE}
6418 
6419 {$IFNDEF JWA_INCLUDEMODE}
6420 // Documented in the DDK.
6421 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6422 function  RtlCharToInteger(
6423     Str : PCSZ;
6424     Base : ULONG;
6425     Value : PULONG
6426   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6427 {$ENDIF JWA_INCLUDEMODE}
6428 
6429 
6430 // Somehow internally used.
6431 // Compatibility: W2K, WXP, 2K3
6432 procedure RtlCheckForOrphanedCriticalSections(
6433     hThread : HANDLE
6434   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6435 
6436 // Documented in the DDK.
6437 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6438 function  RtlCheckRegistryKey(
6439     RelativeTo : ULONG;
6440     Path : PWSTR
6441   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6442 
6443 // Documented in the DDK.
6444 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6445 procedure RtlClearAllBits(
6446     BitMapHeader : PRTL_BITMAP
6447   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6448 
6449 // Documented in the DDK.
6450 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6451 procedure RtlClearBits(
6452     BitMapHeader : PRTL_BITMAP;
6453     StartingIndex : ULONG;
6454     NumberToClear : ULONG
6455   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6456 
6457 // This function is very similar to HeapCompact() from Kernel32.dll. Refer
6458 // to the PSDK for additional information. Usually the same flags apply.
6459 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6460 function  RtlCompactHeap(
6461     hHeap : HANDLE;
6462     dwFlags : ULONG
6463   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6464 
6465 {$IFNDEF JWA_INCLUDEMODE}
6466 // Documented in the DDK.
6467 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6468 function  RtlCompareMemory(
6469     Source1 : PVOID;
6470     Source2 : PVOID;
6471     Length : SIZE_T
6472   ): SIZE_T; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6473 {$ENDIF JWA_INCLUDEMODE}
6474 
6475 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6476 function  RtlCompareMemoryUlong(
6477     Source : PVOID;
6478     Length : ULONG;
6479     Value : ULONG
6480   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6481 
6482 // Documented in the DDK.
6483 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6484 function  RtlCompareString(
6485     String1 : PSTRING;
6486     String2 : PSTRING;
6487     CaseInsensitive : BOOLEAN
6488   ): LONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6489 
6490 // Documented in the DDK.
6491 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6492 function  RtlCompareUnicodeString(
6493     String1 : PUNICODE_STRING;
6494     String2 : PUNICODE_STRING;
6495     CaseInsensitive : BOOLEAN
6496   ): LONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6497 
6498 // Documented in the DDK.
6499 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6500 function  RtlConvertLongToLargeInteger(
6501     SignedInteger : LONG
6502   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6503 
6504 {$IFNDEF JWA_INCLUDEMODE}
6505 // This function is very similar to ConvertSidToStringSid() from
6506 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
6507 // same flags apply.
6508 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6509 function  RtlConvertSidToUnicodeString(
6510     UnicodeString : PUNICODE_STRING;
6511     Sid : PSID;
6512     AllocateDestinationString : BOOLEAN
6513   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6514 {$ENDIF JWA_INCLUDEMODE}
6515 
6516 // Documented in the DDK.
6517 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6518 function  RtlConvertUlongToLargeInteger(
6519     UnsignedInteger : ULONG
6520   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6521 
6522 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6523 procedure RtlCopyLuid(
6524     Destination : PLUID;
6525     Source : PLUID
6526   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6527 
6528 // Compatibility: W2K, WXP
6529 function  RtlCopyRangeList(
6530     CopyRangeList : PRTL_RANGE_LIST;
6531     RangeList : PRTL_RANGE_LIST
6532   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6533 
6534 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6535 function  RtlCopySecurityDescriptor(
6536     Source : PSECURITY_DESCRIPTOR;
6537     var Destination : PSECURITY_DESCRIPTOR
6538   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6539 
6540 // This function is very similar to CopySid() from Advapi32.dll. Refer to
6541 // the PSDK for additional information. Usually the same flags apply.
6542 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6543 function  RtlCopySid(
6544     DestinationLength : ULONG;
6545     Destination : PSID;
6546     Source : PSID
6547   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6548 
6549 // Documented in the DDK.
6550 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6551 procedure RtlCopyString(
6552     DestinationString : PSTRING;
6553     SourceString : PSTRING
6554   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6555 
6556 // Documented in the DDK.
6557 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6558 procedure RtlCopyUnicodeString(
6559     DestinationString : PUNICODE_STRING;
6560     SourceString : PUNICODE_STRING
6561   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6562 
6563 // This function is very similar to InitializeAcl() from Advapi32.dll.
6564 // Refer to the PSDK for additional information. Usually the same flags
6565 // apply.
6566 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6567 function  RtlCreateAcl(
6568     pAcl : PACL;
6569     nAclLength : DWORD;
6570     dwAclRevision : DWORD
6571   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6572 
6573 // This function is very similar to HeapCreate() from Kernel32.dll. Refer
6574 // to the PSDK for additional information. Usually the same flags apply.
6575 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6576 function  RtlCreateHeap(
6577     dwOptions : ULONG;
6578     Base : PVOID;
6579     dwMaximumSize : SIZE_T;
6580     dwInitialSize : SIZE_T;
6581     UnknownOptional1 : PVOID;
6582     UnknownOptional2 : PVOID
6583   ): HANDLE; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6584 
6585 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6586 function  RtlCreateProcessParameters(
6587     ProcessParameters : PPRTL_USER_PROCESS_PARAMETERS;
6588     ImageFile : PUNICODE_STRING;
6589     DllPath : PUNICODE_STRING;
6590     CurrentDirectory : PUNICODE_STRING;
6591     CommandLine : PUNICODE_STRING;
6592     CreationFlags : ULONG;
6593     WindowTitle : PUNICODE_STRING;
6594     Desktop : PUNICODE_STRING;
6595     Reserved : PUNICODE_STRING;
6596     Reserved2 : PUNICODE_STRING
6597   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6598 
6599 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6600 function  RtlCreateQueryDebugBuffer(
6601     Size : ULONG;
6602     EventPair : BOOLEAN
6603   ): PDEBUG_BUFFER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6604 
6605 // Documented in the DDK.
6606 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6607 function  RtlCreateRegistryKey(
6608     RelativeTo : ULONG;
6609     Path : PWSTR
6610   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6611 
6612 // Documented in the DDK.
6613 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6614 function  RtlCreateSecurityDescriptor(
6615     SecurityDescriptor : PSECURITY_DESCRIPTOR;
6616     Revision : ULONG
6617   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6618 
6619 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6620 function  RtlCreateUnicodeString(
6621     DestinationString : PUNICODE_STRING;
6622     SourceString : PWSTR
6623   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6624 
6625 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6626 function  RtlCreateUnicodeStringFromAsciiz(
6627     DestinationString : PUNICODE_STRING;
6628     SourceString : PCHAR
6629   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6630 
6631 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6632 function  RtlCreateUserProcess(
6633     ImageFileName : PUNICODE_STRING;
6634     Attributes : ULONG;
6635     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS;
6636     ProcessSecurityDescriptor : PSECURITY_DESCRIPTOR;
6637     ThreadSecurityDescriptor : PSECURITY_DESCRIPTOR;
6638     ParentProcess : HANDLE;
6639     InheritHandles : BOOLEAN;
6640     DebugPort : HANDLE;
6641     ExceptionPort : HANDLE;
6642     ProcessInfo : PRTL_PROCESS_INFORMATION
6643   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6644 
6645 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6646 function  RtlCreateUserThread(
6647     hProcess : HANDLE;
6648     SecurityDescriptor : PSECURITY_DESCRIPTOR;
6649     CreateSuspended : BOOLEAN;
6650     StackZeroBits : ULONG;
6651     StackReserve : ULONG;
6652     StackCommit : ULONG;
6653     lpStartAddress : PTHREAD_START_ROUTINE;
6654     lpParameter : PVOID;
6655     phThread : PHANDLE;
6656     ClientId : PCLIENT_ID
6657   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6658 
6659 // #->REVIEW LAST PARAMETER
6660 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6661 function  RtlCutoverTimeToSystemTime(
6662     TargetTimeFields : PTIME_FIELDS;
6663     Time : PLARGE_INTEGER;
6664     CurrentTime : PLARGE_INTEGER;
6665     bUnknown : BOOLEAN
6666   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6667 
6668 // This function is very similar to DeleteAce() from Advapi32.dll. Refer to
6669 // the PSDK for additional information. Usually the same flags apply.
6670 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6671 function  RtlDeleteAce(
6672     pAcl : PACL;
6673     dwAceIndex : DWORD
6674   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6675 
6676 // The function DeleteCriticalSection() from Kernel32.dll is an export
6677 // forwarder to this function. This means you can refer to the
6678 // documentation of DeleteCriticalSection()!
6679 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6680 procedure RtlDeleteCriticalSection(
6681     lpCriticalSection : PRTL_CRITICAL_SECTION
6682   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6683 
6684 // Compatibility: W2K, WXP
6685 function  RtlDeleteOwnersRanges(
6686     RangeList : PRTL_RANGE_LIST;
6687     Owner : PVOID
6688   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6689 
6690 // Compatibility: W2K, WXP
6691 function  RtlDeleteRange(
6692     RangeList : PRTL_RANGE_LIST;
6693     Start : ULONGLONG;
6694     End_ : ULONGLONG;
6695     Owner : PVOID
6696   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6697 
6698 // Documented in the DDK.
6699 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6700 function  RtlDeleteRegistryValue(
6701     RelativeTo : ULONG;
6702     Path : LPCWSTR;
6703     ValueName : LPCWSTR
6704   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6705 
6706 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6707 function  RtlDeNormalizeProcessParams(
6708     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS
6709   ): PRTL_USER_PROCESS_PARAMETERS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6710 
6711 // This function is very similar to HeapDestroy() from Kernel32.dll. Refer
6712 // to the PSDK for additional information. Usually the same flags apply.
6713 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6714 function  RtlDestroyHeap(
6715     HeapHandle : HANDLE
6716   ): HANDLE; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6717 
6718 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6719 function  RtlDestroyProcessParameters(
6720     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS
6721   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6722 
6723 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6724 function  RtlDestroyQueryDebugBuffer(
6725     DebugBuffer : PDEBUG_BUFFER
6726   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6727 
6728 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6729 function  RtlDetermineDosPathNameType_U(
6730     wcsPathNameType : PWSTR
6731   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6732 
6733 // Compatibility: W2K, WXP, 2K3
6734 function  RtlDnsHostNameToComputerName(
6735     ComputerName : PUNICODE_STRING;
6736     DnsName : PUNICODE_STRING;
6737     AllocateComputerNameString : BOOLEAN
6738   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6739 
6740 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6741 function  RtlDoesFileExists_U(
6742     FileName : PWSTR
6743   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6744 
6745 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6746 function  RtlDosPathNameToNtPathName_U(
6747     DosName : PWSTR;
6748     var NtName : UNICODE_STRING;
6749     DosFilePath : PPWSTR;
6750     NtFilePath : PUNICODE_STRING
6751   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6752 
6753 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6754 function  RtlDosSearchPath_U(
6755     SearchPath : PWSTR;
6756     Name : PWSTR;
6757     Ext : PWSTR;
6758     cbBuf : ULONG;
6759     Buffer : PWSTR;
6760     var Shortname : PWSTR
6761   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6762 
6763 // Compatibility: WXP, 2K3
6764 function  RtlDowncaseUnicodeChar(
6765     Source : WCHAR
6766   ): WCHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6767 
6768 // Compatibility: NT4, W2K, WXP, 2K3
6769 function  RtlDowncaseUnicodeString(
6770     DestinationString : PUNICODE_STRING;
6771     SourceString : PUNICODE_STRING;
6772     AllocateDestinationString : BOOLEAN
6773   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6774 
6775 // #->REVIEW First parameter must be 0..3, but details have to be
6776 // investigated!!!
6777 // Compatibility: WXP, 2K3
6778 function  RtlDuplicateUnicodeString(
6779     AddTerminatingZero : ULONG;
6780     Source : PUNICODE_STRING;
6781     Destination : PUNICODE_STRING
6782   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6783 
6784 // Compatibility: W2K, WXP, 2K3
6785 procedure RtlEnableEarlyCriticalSectionEventCreation(); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6786 
6787 // Documented in the DDK.
6788 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6789 function  RtlEnlargedIntegerMultiply(
6790     Multiplicand : LONG;
6791     Multiplier : LONG
6792   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6793 
6794 // Documented in the DDK.
6795 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6796 function  RtlEnlargedUnsignedDivide(
6797     Dividend : ULARGE_INTEGER;
6798     Divisor : ULONG;
6799     Remainder : PULONG
6800   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6801 
6802 // Documented in the DDK.
6803 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6804 function  RtlEnlargedUnsignedMultiply(
6805     Multiplicand : ULONG;
6806     Multiplier : ULONG
6807   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6808 
6809 // The function EnterCriticalSection() from Kernel32.dll is an export
6810 // forwarder to this function. This means you can refer to the
6811 // documentation of EnterCriticalSection()!
6812 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6813 procedure RtlEnterCriticalSection(
6814     lpCriticalSection : PRTL_CRITICAL_SECTION
6815   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6816 
6817 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6818 function  RtlEqualComputerName(
6819     String1 : PUNICODE_STRING;
6820     String2 : PUNICODE_STRING
6821   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6822 
6823 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6824 function  RtlEqualDomainName(
6825     String1 : PUNICODE_STRING;
6826     String2 : PUNICODE_STRING
6827   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6828 
6829 // Documented in the DDK.
6830 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6831 function  RtlEqualLuid(
6832     Luid1 : PLUID;
6833     Luid2 : PLUID
6834   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6835 
6836 // This function is very similar to EqualPrefixSid() from Advapi32.dll.
6837 // Refer to the PSDK for additional information. Usually the same flags
6838 // apply.
6839 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6840 function  RtlEqualPrefixSid(
6841     pSid1 : PSID;
6842     pSid2 : PSID
6843   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6844 
6845 // This function is very similar to EqualSid() from Advapi32.dll. Refer to
6846 // the PSDK for additional information. Usually the same flags apply.
6847 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6848 function  RtlEqualSid(
6849     pSid1 : PSID;
6850     pSid2 : PSID
6851   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6852 
6853 // Documented in the DDK.
6854 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6855 function  RtlEqualString(
6856     String1 : PSTRING;
6857     String2 : PSTRING;
6858     CaseInsensitive : BOOLEAN
6859   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6860 
6861 // Documented in the DDK.
6862 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6863 function  RtlEqualUnicodeString(
6864     String1 : PUNICODE_STRING;
6865     String2 : PUNICODE_STRING;
6866     CaseInsensitive : BOOLEAN
6867   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6868 
6869 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6870 procedure RtlEraseUnicodeString(
6871     Str : PUNICODE_STRING
6872   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6873 
6874 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6875 function  RtlExpandEnvironmentStrings_U(
6876     Environment : PVOID;
6877     Source : PUNICODE_STRING;
6878     Destination : PUNICODE_STRING;
6879     ReturnedLength : PULONG
6880   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6881 
6882 // Documented in the DDK.
6883 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6884 function  RtlExtendedIntegerMultiply(
6885     Multiplicand : LARGE_INTEGER;
6886     Multiplier : LONG
6887   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6888 
6889 // Documented in the DDK.
6890 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6891 function  RtlExtendedLargeIntegerDivide(
6892     Dividend : LARGE_INTEGER;
6893     Divisor : ULONG;
6894     Remainder : PULONG
6895   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6896 
6897 // Documented in the DDK.
6898 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6899 function  RtlExtendedMagicDivide(
6900     Dividend : LARGE_INTEGER;
6901     MagicDivisor : LARGE_INTEGER;
6902     ShiftCount : CCHAR
6903   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6904 
6905 // The function RtlFillMemory() from Kernel32.dll is an export forwarder to
6906 // this function. This means you can refer to the documentation of
6907 // RtlFillMemory()!
6908 // Documented in the DDK.
6909 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6910 procedure RtlFillMemory(
6911     Destination : PVOID;
6912     Length : SIZE_T;
6913     Fill : UCHAR
6914   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6915 
6916 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6917 procedure RtlFillMemoryUlong(
6918     Destination : PVOID;
6919     Length : ULONG;
6920     Fill : ULONG
6921   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6922 
6923 // Finds characters out of the set contained in CharactersToFind inside
6924 // UnicodeString - description of flags will follow. Only the lower 3 bits
6925 // are valid!!!
6926 // Compatibility: WXP, 2K3
6927 function  RtlFindCharInUnicodeString(
6928     dwFlags : ULONG;
6929     UnicodeString : PUNICODE_STRING;
6930     CharactersToFind : PUNICODE_STRING;
6931     Positions : PUSHORT
6932   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6933 
6934 // Documented in the DDK.
6935 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6936 function  RtlFindClearBits(
6937     BitMapHeader : PRTL_BITMAP;
6938     NumberToFind : ULONG;
6939     HintIndex : ULONG
6940   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6941 
6942 // Documented in the DDK.
6943 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6944 function  RtlFindClearBitsAndSet(
6945     BitMapHeader : PRTL_BITMAP;
6946     NumberToFind : ULONG;
6947     HintIndex : ULONG
6948   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6949 
6950 // Documented in the DDK.
6951 // Compatibility: W2K, WXP, 2K3
6952 function  RtlFindLastBackwardRunClear(
6953     BitMapHeader : PRTL_BITMAP;
6954     FromIndex : ULONG;
6955     StartingRunIndex : PULONG
6956   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6957 
6958 // Documented in the DDK.
6959 // Compatibility: W2K, WXP, 2K3
6960 function  RtlFindLeastSignificantBit(
6961     Set_ : ULONGLONG
6962   ): CCHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6963 
6964 // Documented in the DDK.
6965 // Compatibility: NT3, NT4, W2K, WXP, 2K3
6966 function  RtlFindLongestRunClear(
6967     BitMapHeader : PRTL_BITMAP;
6968     StartingIndex : PULONG
6969   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6970 
6971 // Compatibility: W2K, WXP, 2K3
6972 function  RtlFindMostSignificantBit(
6973     Set_ : ULONGLONG
6974   ): CCHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6975 
6976 // Documented in the DDK.
6977 // Compatibility: W2K, WXP, 2K3
6978 function  RtlFindNextForwardRunClear(
6979     BitMapHeader : PRTL_BITMAP;
6980     FromIndex : ULONG;
6981     StartingRunIndex : PULONG
6982   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6983 
6984 // Compatibility: W2K, WXP
6985 function  RtlFindRange(
6986     RangeList : PRTL_RANGE_LIST;
6987     Minimum : ULONGLONG;
6988     Maximum : ULONGLONG;
6989     Length : ULONG;
6990     Alignment : ULONG;
6991     Flags : ULONG;
6992     AttributeAvailableMask : UCHAR;
6993     Context : PVOID;
6994     Callback : PRTL_CONFLICT_RANGE_CALLBACK;
6995     Start : PULONGLONG
6996   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
6997 
6998 // Documented in the DDK.
6999 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7000 function  RtlFindSetBits(
7001     BitMapHeader : PRTL_BITMAP;
7002     NumberToFind : ULONG;
7003     HintIndex : ULONG
7004   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7005 
7006 // Documented in the DDK.
7007 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7008 function  RtlFindSetBitsAndClear(
7009     BitMapHeader : PRTL_BITMAP;
7010     NumberToFind : ULONG;
7011     HintIndex : ULONG
7012   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7013 
7014 // This function is very similar to FindFirstFreeAce() from Advapi32.dll.
7015 // Refer to the PSDK for additional information. Usually the same flags
7016 // apply.
7017 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7018 function  RtlFirstFreeAce(
7019     pAcl : PACL;
7020     var pAce : PVOID
7021   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7022 
7023 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7024 function  RtlFormatCurrentUserKeyPath(
7025     CurrentUserKeyPath : PUNICODE_STRING
7026   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7027 
7028 // Documented in the DDK.
7029 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7030 procedure RtlFreeAnsiString(
7031     AnsiString : PANSI_STRING
7032   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7033 
7034 // The function HeapFree() from Kernel32.dll is an export forwarder to this
7035 // function. This means you can refer to the documentation of HeapFree()!
7036 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7037 function  RtlFreeHeap(
7038     hHeap : HANDLE;
7039     dwFlags : ULONG;
7040     MemoryPointer : PVOID
7041   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7042 
7043 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7044 procedure RtlFreeOemString(
7045     OemString : POEM_STRING
7046   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7047 
7048 // Compatibility: W2K, WXP
7049 procedure RtlFreeRangeList(
7050     RangeList : PRTL_RANGE_LIST
7051   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7052 
7053 // This function is very similar to FreeSid() from Advapi32.dll. Refer to
7054 // the PSDK for additional information. Usually the same flags apply.
7055 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7056 function  RtlFreeSid(
7057     pSid : PSID
7058   ): PVOID; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7059 
7060 // Documented in the DDK.
7061 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7062 procedure RtlFreeUnicodeString(
7063     UnicodeString : PUNICODE_STRING
7064   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7065 
7066 // This function is very similar to GetAce() from Advapi32.dll. Refer to
7067 // the PSDK for additional information. Usually the same flags apply.
7068 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7069 function  RtlGetAce(
7070     pAcl : PACL;
7071     dwAceIndex : DWORD;
7072     var pAce : PVOID
7073   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7074 
7075 // Mentioned in the DDK.
7076 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7077 procedure RtlGetCallersAddress(
7078     CallersAddress : PPVOID;
7079     CallersCaller : PPVOID
7080   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7081 
7082 // This function is very similar to GetSecurityDescriptorControl() from
7083 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7084 // same flags apply.
7085 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7086 function  RtlGetControlSecurityDescriptor(
7087     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7088     var Control : SECURITY_DESCRIPTOR_CONTROL;
7089     var dwRevision : DWORD
7090   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7091 
7092 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7093 function  RtlGetCurrentDirectory_U(
7094     MaximumLength : ULONG;
7095     Buffer : PWSTR
7096   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7097 
7098 // Compatibility: WXP, 2K3
7099 function  RtlGetCurrentPeb(): PPEB; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7100 
7101 // This function is very similar to GetSecurityDescriptorDacl() from
7102 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7103 // same flags apply.
7104 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7105 function  RtlGetDaclSecurityDescriptor(
7106     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7107     var bDaclPresent : BOOLEAN;
7108     var Dacl : PACL;
7109     var bDaclDefaulted : BOOLEAN
7110   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7111 
7112 // Compatibility: W2K, WXP
7113 function  RtlGetFirstRange(
7114     RangeList : PRTL_RANGE_LIST;
7115     Iterator : PRTL_RANGE_LIST_ITERATOR;
7116     var Range : PRTL_RANGE
7117   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7118 
7119 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7120 function  RtlGetFullPathName_U(
7121     DosName : PWSTR;
7122     Size : ULONG;
7123     Buf : PWSTR;
7124     var Shortname : PWSTR
7125   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7126 
7127 // This function is very similar to GetSecurityDescriptorGroup() from
7128 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7129 // same flags apply.
7130 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7131 function  RtlGetGroupSecurityDescriptor(
7132     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7133     var pGroup : PSID;
7134     var bGroupDefaulted : BOOLEAN
7135   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7136 
7137 // Compatibility: WXP, 2K3
7138 function  RtlGetLastNtStatus(): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7139 
7140 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7141 function  RtlGetLongestNtPathLength(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7142 
7143 // Compatibility: W2K, WXP
7144 function  RtlGetNextRange(
7145     Iterator : PRTL_RANGE_LIST_ITERATOR;
7146     var Range : PRTL_RANGE;
7147     MoveForwards : BOOLEAN
7148   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7149 
7150 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7151 function  RtlGetNtGlobalFlags(): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7152 
7153 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7154 function  RtlGetNtProductType(
7155     var ProductType : ULONG
7156   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7157 
7158 // #->REVIEW LAST PARAMETER
7159 // Compatibility: WXP, 2K3
7160 procedure RtlGetNtVersionNumbers(
7161     var dwMajorVersion : ULONG;
7162     var dwMinorVersion : ULONG;
7163     UnknownCanBeNull : PDWORD
7164   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7165 
7166 // This function is very similar to GetSecurityDescriptorOwner() from
7167 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7168 // same flags apply.
7169 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7170 function  RtlGetOwnerSecurityDescriptor(
7171     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7172     var pOwner : PSID;
7173     var OwnerDefaulted : BOOLEAN
7174   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7175 
7176 // This function is very similar to GetProcessHeaps() from Kernel32.dll.
7177 // Refer to the PSDK for additional information. Usually the same flags
7178 // apply.
7179 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7180 function  RtlGetProcessHeaps(
7181     ArraySize : ULONG;
7182     HeapArray : PHANDLE
7183   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7184 
7185 // This function is very similar to GetSecurityDescriptorSacl() from
7186 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7187 // same flags apply.
7188 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7189 function  RtlGetSaclSecurityDescriptor(
7190     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7191     var bSaclPresent : BOOLEAN;
7192     var Sacl : PACL;
7193     var bSaclDefaulted : BOOLEAN
7194   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7195 
7196 // This function is very similar to GetVersionEx() from Kernel32.dll. Refer
7197 // to the PSDK for additional information. Usually the same flags apply.
7198 // Documented in the DDK.
7199 // Compatibility: W2K, WXP, 2K3
7200 function  RtlGetVersion(
7201     lpVersionInformation : PRTL_OSVERSIONINFOW
7202   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7203 
7204 // Documented in the DDK.
7205 // Compatibility: W2K, WXP, 2K3
7206 function  RtlGUIDFromString(
7207     GuidString : PUNICODE_STRING;
7208     Guid : LPGUID
7209   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7210 
7211 // This function is very similar to GetSidIdentifierAuthority() from
7212 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7213 // same flags apply.
7214 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7215 function  RtlIdentifierAuthoritySid(
7216     Sid : PSID
7217   ): PSID_IDENTIFIER_AUTHORITY; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7218 
7219 // This function is very similar to ImageDirectoryEntryToData() from
7220 // Dbghelp.dll. Refer to the PSDK for additional information. Usually the
7221 // same flags apply.
7222 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7223 function  RtlImageDirectoryEntryToData(
7224     ImageBase : HMODULE;
7225     MappedAsImage : BOOLEAN;
7226     DirectoryEntry : USHORT;
7227     Size : PULONG
7228   ): PVOID; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7229 
7230 // This function is very similar to ImageNtHeader() from Dbghelp.dll. Refer
7231 // to the PSDK for additional information. Usually the same flags apply.
7232 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7233 function  RtlImageNtHeader(
7234     ImageBase : HMODULE
7235   ): PIMAGE_NT_HEADERS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7236 
7237 // This function is very similar to ImageNtHeader() from Dbghelp.dll. Refer
7238 // to the PSDK for additional information. Usually the same flags apply.
7239 // With dwFlags equal 1 it shows the same behavior as RtlImageNtHeader()
7240 // Compatibility: 2K3
7241 function  RtlImageNtHeaderEx(
7242     dwFlags : DWORD;
7243     ImageBase : HMODULE
7244   ): PIMAGE_NT_HEADERS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7245 
7246 // This function is very similar to ImageRvaToSection() from Dbghelp.dll.
7247 // Refer to the PSDK for additional information. Usually the same flags
7248 // apply.
7249 // Compatibility: NT4, W2K, WXP, 2K3
7250 function  RtlImageRvaToSection(
7251     NtHeaders : PIMAGE_NT_HEADERS;
7252     ImageBase : HMODULE;
7253     Rva : ULONG
7254   ): PIMAGE_SECTION_HEADER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7255 
7256 // This function is very similar to ImageRvaToVa() from Dbghelp.dll. Refer
7257 // to the PSDK for additional information. Usually the same flags apply.
7258 // Compatibility: NT4, W2K, WXP, 2K3
7259 function  RtlImageRvaToVa(
7260     NtHeaders : PIMAGE_NT_HEADERS;
7261     ImageBase : HMODULE;
7262     Rva : ULONG;
7263     var LastRvaSection : PIMAGE_SECTION_HEADER
7264   ): PVOID; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7265 
7266 // This function is very similar to ImpersonateSelf() from Advapi32.dll.
7267 // Refer to the PSDK for additional information. Usually the same flags
7268 // apply.
7269 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7270 function  RtlImpersonateSelf(
7271     ImpersonationLevel : SECURITY_IMPERSONATION_LEVEL
7272   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7273 
7274 // Documented in the DDK.
7275 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7276 procedure RtlInitAnsiString(
7277     DestinationString : PANSI_STRING;
7278     SourceString : PCSZ
7279   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7280 
7281 // Compatibility: 2K3
7282 function  RtlInitAnsiStringEx(
7283     DestinationString : PANSI_STRING;
7284     SourceString : PCSZ
7285   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7286 
7287 // Documented in the DDK.
7288 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7289 procedure RtlInitializeBitMap(
7290     BitMapHeader : PRTL_BITMAP;
7291     BitMapBuffer : PULONG;
7292     SizeOfBitMap : ULONG
7293   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7294 
7295 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7296 function  RtlInitializeCriticalSection(
7297     lpCriticalSection : PRTL_CRITICAL_SECTION
7298   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7299 
7300 // Compatibility: NT4, W2K, WXP, 2K3
7301 function  RtlInitializeCriticalSectionAndSpinCount(
7302     lpCriticalSection : PRTL_CRITICAL_SECTION;
7303     dwSpinCount : ULONG
7304   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7305 
7306 // Compatibility: W2K, WXP
7307 procedure RtlInitializeRangeList(
7308     RangeList : PRTL_RANGE_LIST
7309   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7310 
7311 // This function is very similar to InitializeSid() from Advapi32.dll.
7312 // Refer to the PSDK for additional information. Usually the same flags
7313 // apply.
7314 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7315 function  RtlInitializeSid(
7316     pSid : PSID;
7317     pIdentifierAuthority : PSID_IDENTIFIER_AUTHORITY;
7318     nSubAuthorityCount : UCHAR
7319   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7320 
7321 {$IFNDEF JWA_INCLUDEMODE}
7322 // Compatibility: WXP, 2K3
7323 procedure RtlInitializeSListHead(
7324     ListHead : PSLIST_HEADER
7325   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7326 {$ENDIF JWA_INCLUDEMODE}
7327 
7328 // Documented in the DDK.
7329 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7330 procedure RtlInitString(
7331     DestinationString : PSTRING;
7332     SourceString : PCSZ
7333   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7334 
7335 // Documented in the DDK.
7336 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7337 procedure RtlInitUnicodeString(
7338     DestinationString : PUNICODE_STRING;
7339     SourceString : LPCWSTR
7340   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7341 
7342 // Compatibility: WXP, 2K3
7343 function  RtlInitUnicodeStringEx(
7344     DestinationString : PUNICODE_STRING;
7345     SourceString : LPCWSTR
7346   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7347 
7348 // Documented in the DDK.
7349 // Compatibility: W2K, WXP, 2K3
7350 function  RtlInt64ToUnicodeString(
7351     Value : ULONGLONG;
7352     Base : ULONG;
7353     Str : PUNICODE_STRING
7354   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7355 
7356 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7357 function  RtlIntegerToChar(
7358     Value : ULONG;
7359     Base : ULONG;
7360     Length : ULONG;
7361     Str : PCHAR
7362   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7363 
7364 // Documented in the DDK.
7365 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7366 function  RtlIntegerToUnicodeString(
7367     Value : ULONG;
7368     Base : ULONG;
7369     Str : PUNICODE_STRING
7370   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7371 
7372 {$IFNDEF JWA_INCLUDEMODE}
7373 // Compatibility: WXP, 2K3
7374 function  RtlInterlockedFlushSList(
7375     ListHead : PSLIST_HEADER
7376   ): PSLIST_ENTRY; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7377 
7378 
7379 // Compatibility: WXP, 2K3
7380 function  RtlInterlockedPopEntrySList(
7381     ListHead : PSLIST_HEADER
7382   ): PSLIST_ENTRY; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7383 {$ENDIF JWA_INCLUDEMODE}
7384 // Compatibility: WXP, 2K3
7385 function  RtlInterlockedPushEntrySList(
7386     ListHead : PSLIST_HEADER;
7387     ListEntry : PSLIST_ENTRY
7388   ): PSLIST_ENTRY; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7389 
7390 
7391 // Compatibility: W2K, WXP
7392 function  RtlInvertRangeList(
7393     InvertedRangeList : PRTL_RANGE_LIST;
7394     RangeList : PRTL_RANGE_LIST
7395   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7396 
7397 // Compatibility: WXP, 2K3
7398 function  RtlIpv4AddressToStringA(
7399     IP : PULONG;
7400     Buffer : LPSTR
7401   ): LPSTR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7402 
7403 // Compatibility: WXP, 2K3
7404 function  RtlIpv4AddressToStringW(
7405     IP : PULONG;
7406     Buffer : LPWSTR
7407   ): LPWSTR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7408 
7409 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7410 function  RtlIsDosDeviceName_U(
7411     TestString : LPCWSTR
7412   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7413 
7414 {$IFNDEF JWA_INCLUDEMODE}
7415 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7416 function  RtlIsNameLegalDOS8Dot3(
7417     Name : PUNICODE_STRING;
7418     OemName : POEM_STRING;
7419     NameContainsSpaces : PBOOLEAN
7420   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7421 {$ENDIF JWA_INCLUDEMODE}
7422 
7423 // Compatibility: W2K, WXP
7424 function  RtlIsRangeAvailable(
7425     RangeList : PRTL_RANGE_LIST;
7426     Start : ULONGLONG;
7427     End_ : ULONGLONG;
7428     Flags : ULONG;
7429     AttributeAvailableMask : UCHAR;
7430     Context : PVOID;
7431     Callback : PRTL_CONFLICT_RANGE_CALLBACK;
7432     Available : PBOOLEAN
7433   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7434 
7435 // This function is very similar to IsTextUnicode() from Advapi32.dll.
7436 // Refer to the PSDK for additional information. Usually the same flags
7437 // apply.
7438 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7439 function  RtlIsTextUnicode(
7440     lpBuffer : PVOID;
7441     cb : Integer;
7442     lpi : LPINT
7443   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7444 
7445 // Documented in the DDK.
7446 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7447 function  RtlLargeIntegerAdd(
7448     Addend1 : LARGE_INTEGER;
7449     Addend2 : LARGE_INTEGER
7450   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7451 
7452 // Documented in the DDK.
7453 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7454 function  RtlLargeIntegerArithmeticShift(
7455     LargeInteger : LARGE_INTEGER;
7456     ShiftCount : CCHAR
7457   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7458 
7459 // Documented in the DDK.
7460 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7461 function  RtlLargeIntegerDivide(
7462     Dividend : LARGE_INTEGER;
7463     Divisor : LARGE_INTEGER;
7464     Remainder : PLARGE_INTEGER
7465   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7466 
7467 // Documented in the DDK.
7468 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7469 function  RtlLargeIntegerNegate(
7470     NegateThis : LARGE_INTEGER
7471   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7472 
7473 // Documented in the DDK.
7474 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7475 function  RtlLargeIntegerShiftLeft(
7476     LargeInteger : LARGE_INTEGER;
7477     ShiftCount : CCHAR
7478   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7479 
7480 // Documented in the DDK.
7481 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7482 function  RtlLargeIntegerShiftRight(
7483     LargeInteger : LARGE_INTEGER;
7484     ShiftCount : CCHAR
7485   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7486 
7487 // Documented in the DDK.
7488 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7489 function  RtlLargeIntegerSubtract(
7490     Number : LARGE_INTEGER;
7491     Subtrahend : LARGE_INTEGER
7492   ): LARGE_INTEGER; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7493 
7494 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7495 function  RtlLargeIntegerToChar(
7496     Value : PLARGE_INTEGER;
7497     Base : ULONG;
7498     BufferLength : ULONG;
7499     Buffer : PCHAR
7500   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7501 
7502 // The function LeaveCriticalSection() from Kernel32.dll is an export
7503 // forwarder to this function. This means you can refer to the
7504 // documentation of LeaveCriticalSection()!
7505 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7506 procedure RtlLeaveCriticalSection(
7507     lpCriticalSection : PRTL_CRITICAL_SECTION
7508   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7509 
7510 // This function is very similar to GetSidLengthRequired() from
7511 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7512 // same flags apply.
7513 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7514 function  RtlLengthRequiredSid(
7515     nSubAuthorityCount : ULONG
7516   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7517 
7518 // This function is very similar to GetSecurityDescriptorLength() from
7519 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7520 // same flags apply.
7521 // Documented in the DDK.
7522 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7523 function  RtlLengthSecurityDescriptor(
7524     SecurityDescriptor : PSECURITY_DESCRIPTOR
7525   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7526 
7527 // This function is very similar to GetLengthSid() from Advapi32.dll. Refer
7528 // to the PSDK for additional information. Usually the same flags apply.
7529 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7530 function  RtlLengthSid(
7531     pSid : PSID
7532   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7533 
7534 {$IFNDEF JWA_INCLUDEMODE}
7535 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7536 function  RtlLocalTimeToSystemTime(
7537     LocalTime : PLARGE_INTEGER;
7538     SystemTime : PLARGE_INTEGER
7539   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7540 {$ENDIF JWA_INCLUDEMODE}
7541 
7542 // This function is very similar to HeapLock() from Kernel32.dll. Refer to
7543 // the PSDK for additional information. Usually the same flags apply.
7544 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7545 function  RtlLockHeap(
7546     hHeap : PVOID
7547   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7548 
7549 // This function is very similar to MakeSelfRelativeSD() from Advapi32.dll.
7550 // Refer to the PSDK for additional information. Usually the same flags
7551 // apply.
7552 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7553 function  RtlMakeSelfRelativeSD(
7554     pAbsoluteSD : PSECURITY_DESCRIPTOR;
7555     pSelfRelativeSD : PSECURITY_DESCRIPTOR;
7556     lpdwBufferLength : LPDWORD
7557   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7558 
7559 // This function is very similar to MapGenericMask() from Advapi32.dll.
7560 // Refer to the PSDK for additional information. Usually the same flags
7561 // apply.
7562 // Documented in the DDK.
7563 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7564 procedure RtlMapGenericMask(
7565     AccessMask : PACCESS_MASK;
7566     GenericMapping : PGENERIC_MAPPING
7567   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7568 
7569 // Maps an error from the security subsystem to a native error status.
7570 // Compatibility: WXP, 2K3
7571 function  RtlMapSecurityErrorToNtStatus(
7572     SecurityError : DWORD
7573   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7574 
7575 // Compatibility: W2K, WXP
7576 function  RtlMergeRangeLists(
7577     MergedRangeList : PRTL_RANGE_LIST;
7578     RangeList1 : PRTL_RANGE_LIST;
7579     RangeList2 : PRTL_RANGE_LIST;
7580     Flags : ULONG
7581   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7582 
7583 // Documented in the DDK.
7584 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7585 procedure RtlMoveMemory(
7586     Destination : PVOID;
7587     Source : PVOID;
7588     Length : SIZE_T
7589   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7590 
7591 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7592 function  RtlNormalizeProcessParams(
7593     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS
7594   ): PRTL_USER_PROCESS_PARAMETERS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7595 
7596 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7597 function  RtlNtStatusToDosError(
7598     Status : NTSTATUS
7599   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7600 
7601 
7602 // Compatibility: WXP, 2K3
7603 function  RtlNtStatusToDosErrorNoTeb(
7604     Status : NTSTATUS
7605   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7606 
7607 // Documented in the DDK.
7608 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7609 function  RtlNumberOfClearBits(
7610     BitMapHeader : PRTL_BITMAP
7611   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7612 
7613 // Documented in the DDK.
7614 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7615 function  RtlNumberOfSetBits(
7616     BitMapHeader : PRTL_BITMAP
7617   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7618 
7619 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7620 function  RtlOemStringToUnicodeSize(
7621     AnsiString : POEM_STRING
7622   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7623 
7624 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7625 function  RtlOemStringToUnicodeString(
7626     DestinationString : PUNICODE_STRING;
7627     SourceString : POEM_STRING;
7628     AllocateDestinationString : BOOLEAN
7629   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7630 
7631 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7632 function  RtlOemToUnicodeN(
7633     UnicodeString : PWSTR;
7634     UnicodeSize : ULONG;
7635     var ResultSize : ULONG;
7636     OemString : PCHAR;
7637     OemSize : ULONG
7638   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7639 
7640 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7641 function  RtlOpenCurrentUser(
7642     samDesired : ACCESS_MASK;
7643     phkResult : PHKEY
7644   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7645 
7646 // Either raises an exception of type STATUS_RESOURCE_NOT_OWNED or returns
7647 // a BOOLEAN value.
7648 // Should perhaps not be called explicitly.
7649 // Compatibility: WXP, 2K3
7650 function  RtlpNotOwnerCriticalSection(
7651     lpCriticalSection : PRTL_CRITICAL_SECTION
7652   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7653 
7654 // This is a private wrapper for NtCreateKey().
7655 // However, 2 of the parameters are not being used!
7656 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7657 function  RtlpNtCreateKey(
7658     KeyHandle : PHANDLE;
7659     DesiredAccess : ACCESS_MASK;
7660     ObjectAttributes : POBJECT_ATTRIBUTES;
7661     Unused1 : ULONG;
7662     Unused2 : ULONG;
7663     Disposition : PULONG
7664   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7665 
7666 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7667 function  RtlpNtEnumerateSubKey(
7668     KeyHandle : HANDLE;
7669     SubKeyName : PUNICODE_STRING;
7670     Index : ULONG;
7671     Unused1 : ULONG
7672   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7673 
7674 // This function is very similar to NtCreateKey() from Ntdll.dll. Usually
7675 // the same or similar flags apply.
7676 // This is exactly the same as NtDeleteKey() by now!
7677 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7678 function  RtlpNtMakeTemporaryKey(
7679     KeyHandle : HANDLE
7680   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7681 
7682 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7683 function  RtlpNtOpenKey(
7684     KeyHandle : HANDLE;
7685     DesiredAccess : ACCESS_MASK;
7686     ObjectAttributes : POBJECT_ATTRIBUTES;
7687     Unused : ULONG
7688   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7689 
7690 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7691 function  RtlpNtQueryValueKey(
7692     KeyHandle : HANDLE;
7693     Type_ : PULONG;
7694     Data : PVOID;
7695     DataSize : PULONG;
7696     Unused : ULONG
7697   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7698 
7699 // This is a private wrapper for NtSetValueKey().
7700 // The parameters of TitleIndex and ValueName are not being passed, that is
7701 // empty.
7702 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7703 function  RtlpNtSetValueKey(
7704     KeyHandle : HANDLE;
7705     Type_ : ULONG;
7706     Data : PVOID;
7707     DataSize : ULONG
7708   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7709 
7710 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7711 function  RtlPrefixString(
7712     String1 : PANSI_STRING;
7713     String2 : PANSI_STRING;
7714     CaseInsensitive : BOOLEAN
7715   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7716 
7717 // Documented in the DDK.
7718 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7719 function  RtlPrefixUnicodeString(
7720     String1 : PUNICODE_STRING;
7721     String2 : PUNICODE_STRING;
7722     CaseInsensitive : BOOLEAN
7723   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7724 
7725 {$IFNDEF JWA_INCLUDEMODE}
7726 // Compatibility: WXP, 2K3
7727 function  RtlQueryDepthSList(
7728     ListHead : PSLIST_HEADER
7729   ): USHORT; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7730 {$ENDIF JWA_INCLUDEMODE}
7731 
7732 // VarValue has to have a buffer assigned big enough to hold the value.
7733 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7734 function  RtlQueryEnvironmentVariable_U(
7735     Environment : PVOID;
7736     VarName : PUNICODE_STRING;
7737     VarValue : PUNICODE_STRING
7738   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7739 
7740 // This function is very similar to GetAclInformation() from Advapi32.dll.
7741 // Refer to the PSDK for additional information. Usually the same flags
7742 // apply.
7743 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7744 function  RtlQueryInformationAcl(
7745     pAcl : PACL;
7746     pAclInformation : PVOID;
7747     nAclInformationLength : DWORD;
7748     dwAclInformationClass : ACL_INFORMATION_CLASS
7749   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7750 
7751 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7752 function  RtlQueryProcessDebugInformation(
7753     ProcessId : ULONG;
7754     DebugInfoClassMask : ULONG;
7755     DebugBuffer : PDEBUG_BUFFER
7756   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7757 
7758 // Documented in the DDK.
7759 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7760 function  RtlQueryRegistryValues(
7761     RelativeTo : ULONG;
7762     Path : LPCWSTR;
7763     QueryTable : PRTL_QUERY_REGISTRY_TABLE;
7764     Context : PVOID;
7765     Environment : PVOID
7766   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7767 
7768 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7769 procedure RtlRaiseStatus(
7770     Status : NTSTATUS
7771   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7772 
7773 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7774 function  RtlRandom(
7775     Seed : PULONG
7776   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7777 
7778 // Compatibility: WXP, 2K3
7779 function  RtlRandomEx(
7780     Seed : PULONG
7781   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7782 
7783 // The function HeapReAlloc() from Kernel32.dll is an export forwarder to
7784 // this function. This means you can refer to the documentation of
7785 // HeapReAlloc()!
7786 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7787 function  RtlReAllocateHeap(
7788     hHeap : HANDLE;
7789     dwFlags : ULONG;
7790     lpMem : PVOID;
7791     dwBytes : SIZE_T
7792   ): PVOID; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7793 
7794 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7795 procedure RtlReleasePebLock(); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7796 
7797 // Compatibility: WXP, 2K3
7798 function  RtlRemoveVectoredExceptionHandler(
7799     VectoredHandlerHandle : PVOID
7800   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7801 
7802 // Compatibility: WXP, 2K3
7803 procedure RtlRestoreLastWin32Error(
7804     dwErrCode : DWORD
7805   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7806 
7807 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7808 procedure RtlRunDecodeUnicodeString(
7809     CodeSeed : UCHAR;
7810     StringToDecode : PUNICODE_STRING
7811   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7812 
7813 // If CodeSeed == 0 it will be assigned a value by the function. Use this
7814 // very value in a call to RtlRunDecodeUnicodeString()! To decode the
7815 // string afterwards.
7816 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7817 procedure RtlRunEncodeUnicodeString(
7818     var CodeSeed : UCHAR;
7819     StringToEncode : PUNICODE_STRING
7820   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7821 
7822 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7823 procedure RtlSecondsSince1970ToTime(
7824     SecondsSince1970 : ULONG;
7825     Time : PLARGE_INTEGER
7826   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7827 
7828 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7829 procedure RtlSecondsSince1980ToTime(
7830     SecondsSince1980 : ULONG;
7831     Time : PLARGE_INTEGER
7832   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7833 
7834 // This function is very similar to MakeAbsoluteSD() from Advapi32.dll.
7835 // Refer to the PSDK for additional information. Usually the same flags
7836 // apply.
7837 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7838 function  RtlSelfRelativeToAbsoluteSD(
7839     pSelfRelativeSD : PSECURITY_DESCRIPTOR;
7840     pAbsoluteSD : PSECURITY_DESCRIPTOR;
7841     lpdwAbsoluteSDSize : LPDWORD;
7842     pDacl : PACL;
7843     lpdwDaclSize : LPDWORD;
7844     pSacl : PACL;
7845     lpdwSaclSize : LPDWORD;
7846     pOwner : PSID;
7847     lpdwOwnerSize : LPDWORD;
7848     pPrimaryGroup : PSID;
7849     lpdwPrimaryGroupSize : LPDWORD
7850   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7851 
7852 // Documented in the DDK.
7853 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7854 procedure RtlSetAllBits(
7855     BitMapHeader : PRTL_BITMAP
7856   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7857 
7858 // Documented in the DDK.
7859 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7860 procedure RtlSetBits(
7861     BitMapHeader : PRTL_BITMAP;
7862     StartingIndex : ULONG;
7863     NumberToSet : ULONG
7864   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7865 
7866 // This function is very similar to SetSecurityDescriptorControl() from
7867 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7868 // same flags apply.
7869 // Compatibility: W2K, WXP, 2K3
7870 function  RtlSetControlSecurityDescriptor(
7871     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7872     ControlBitsOfInterest : SECURITY_DESCRIPTOR_CONTROL;
7873     ControlBitsToSet : SECURITY_DESCRIPTOR_CONTROL
7874   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7875 
7876 // The function SetCriticalSectionSpinCount() from Kernel32.dll is an
7877 // export forwarder to this function. This means you can refer to the
7878 // documentation of SetCriticalSectionSpinCount()!
7879 // Compatibility: NT4, W2K, WXP, 2K3
7880 function  RtlSetCriticalSectionSpinCount(
7881     lpCriticalSection : PRTL_CRITICAL_SECTION;
7882     dwSpinCount : ULONG
7883   ): DWORD; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7884 
7885 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7886 function  RtlSetCurrentDirectory_U(
7887     NewCurrentDirectory : PUNICODE_STRING
7888   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7889 
7890 // Documented in the DDK.
7891 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7892 function  RtlSetDaclSecurityDescriptor(
7893     SecurityDescriptor : PSECURITY_DESCRIPTOR;
7894     DaclPresent : BOOLEAN;
7895     Dacl : PACL;
7896     DaclDefaulted : BOOLEAN
7897   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7898 
7899 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7900 function  RtlSetGroupSecurityDescriptor(
7901     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7902     pGroup : PSID;
7903     bGroupDefaulted : BOOLEAN
7904   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7905 
7906 // This function is very similar to SetAclInformation() from Advapi32.dll.
7907 // Refer to the PSDK for additional information. Usually the same flags
7908 // apply.
7909 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7910 function  RtlSetInformationAcl(
7911     pAcl : PACL;
7912     pAclInformation : PVOID;
7913     nInformationLength : DWORD;
7914     dwAclInformationClass : ACL_INFORMATION_CLASS
7915   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7916 
7917 // Compatibility: WXP, 2K3
7918 function  RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
7919     Status : NTSTATUS
7920   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7921 
7922 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7923 function  RtlSetOwnerSecurityDescriptor(
7924     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7925     pOwner : PSID;
7926     bOwnerDefaulted : BOOLEAN
7927   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7928 
7929 // Compatibility: WXP, 2K3
7930 function  RtlSetProcessIsCritical(
7931     bIsCritical : BOOLEAN;
7932     pbOldIsCriticalValue : PBOOLEAN;
7933     bUnknownCanBeFalse : BOOLEAN
7934   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7935 
7936 // This function is very similar to SetSecurityDescriptorSacl() from
7937 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7938 // same flags apply.
7939 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7940 function  RtlSetSaclSecurityDescriptor(
7941     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
7942     bSaclPresent : BOOLEAN;
7943     pSacl : PACL;
7944     SaclDefaulted : BOOLEAN
7945   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7946 
7947 // Compatibility: WXP, 2K3
7948 function  RtlSetThreadIsCritical(
7949     bIsCritical : BOOLEAN;
7950     pbOldIsCriticalValue : PBOOLEAN;
7951     bUnknownCanBeFalse : BOOLEAN
7952   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7953 
7954 // The function HeapSize() from Kernel32.dll is an export forwarder to this
7955 // function. This means you can refer to the documentation of HeapSize()!
7956 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7957 function  RtlSizeHeap(
7958     hHeap : HANDLE;
7959     dwFlags : ULONG;
7960     lpMem : PVOID
7961   ): SIZE_T; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7962 
7963 // Documented in the DDK.
7964 // Compatibility: W2K, WXP, 2K3
7965 function  RtlStringFromGUID(
7966     Guid : REFGUID;
7967     GuidString : PUNICODE_STRING
7968   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7969 
7970 // This function is very similar to GetSidSubAuthorityCount() from
7971 // Advapi32.dll. Refer to the PSDK for additional information. Usually the
7972 // same flags apply.
7973 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7974 function  RtlSubAuthorityCountSid(
7975     pSid : PSID
7976   ): PUCHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7977 
7978 // This function is very similar to GetSidSubAuthority() from Advapi32.dll.
7979 // Refer to the PSDK for additional information. Usually the same flags
7980 // apply.
7981 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7982 function  RtlSubAuthoritySid(
7983     pSid : PSID;
7984     nSubAuthority : DWORD
7985   ): PDWORD; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7986 
7987 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7988 function  RtlSystemTimeToLocalTime(
7989     SystemTime : PLARGE_INTEGER;
7990     LocalTime : PLARGE_INTEGER
7991   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7992 
7993 // Documented in the DDK.
7994 // Compatibility: NT3, NT4, W2K, WXP, 2K3
7995 function  RtlTimeFieldsToTime(
7996     TimeFields : PTIME_FIELDS;
7997     Time : PLARGE_INTEGER
7998   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
7999 
8000 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8001 procedure RtlTimeToElapsedTimeFields(
8002     Time : PLARGE_INTEGER;
8003     TimeFields : PTIME_FIELDS
8004   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8005 
8006 {$IFNDEF JWA_INCLUDEMODE}
8007 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8008 function  RtlTimeToSecondsSince1970(
8009     Time : PLARGE_INTEGER;
8010     ElapsedSeconds : PULONG
8011   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8012 {$ENDIF JWA_INCLUDEMODE}
8013 
8014 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8015 function  RtlTimeToSecondsSince1980(
8016     Time : PLARGE_INTEGER;
8017     ElapsedSeconds : PULONG
8018   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8019 
8020 // Documented in the DDK.
8021 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8022 procedure RtlTimeToTimeFields(
8023     Time : PLARGE_INTEGER;
8024     TimeFields : PTIME_FIELDS
8025   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8026 
8027 // The function TryEnterCriticalSection() from Kernel32.dll is an export
8028 // forwarder to this function. This means you can refer to the
8029 // documentation of TryEnterCriticalSection()!
8030 // Compatibility: NT4, W2K, WXP, 2K3
8031 function  RtlTryEnterCriticalSection(
8032     lpCriticalSection : PRTL_CRITICAL_SECTION
8033   ): BOOL; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8034 
8035 // Documented in the DDK.
8036 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8037 function  RtlUnicodeStringToAnsiSize(
8038     UnicodeString : PUNICODE_STRING
8039   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8040 
8041 // Documented in the DDK.
8042 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8043 {$IFNDEF JWA_INCLUDEMODE}
8044 function  RtlUnicodeStringToAnsiString(
8045     DestinationString : PANSI_STRING;
8046     SourceString : PUNICODE_STRING;
8047     AllocateDestinationString : BOOLEAN
8048   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8049 {$ENDIF JWA_INCLUDEMODE}
8050 
8051 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8052 function  RtlUnicodeStringToCountedOemString(
8053     DestinationString : POEM_STRING;
8054     SourceString : PUNICODE_STRING;
8055     AllocateDestinationString : BOOLEAN
8056   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8057 
8058 // Documented in the DDK.
8059 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8060 function  RtlUnicodeStringToInteger(
8061     Str : PUNICODE_STRING;
8062     Base : ULONG;
8063     Value : PULONG
8064   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8065 
8066 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8067 function  RtlUnicodeStringToOemSize(
8068     UnicodeString : PUNICODE_STRING
8069   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8070 
8071 {$IFNDEF JWA_INCLUDEMODE}
8072 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8073 function  RtlUnicodeStringToOemString(
8074     DestinationString : POEM_STRING;
8075     SourceString : PCUNICODE_STRING;
8076     AllocateDestinationString : BOOLEAN
8077   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8078 {$ENDIF JWA_INCLUDEMODE}
8079 
8080 {$IFNDEF JWA_INCLUDEMODE}
8081 
8082 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8083 function  RtlUnicodeToMultiByteSize(
8084     BytesInMultiByteString : PULONG;
8085     UnicodeString : PWSTR;
8086     BytesInUnicodeString : ULONG
8087   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8088 
8089 
8090 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8091 function  RtlUniform(
8092     Seed : PULONG
8093   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8094 
8095 {$ENDIF JWA_INCLUDEMODE}
8096 
8097 // The function RtlUnwind() from Kernel32.dll is an export forwarder to
8098 // this function. This means you can refer to the documentation of
8099 // RtlUnwind()!
8100 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8101 procedure RtlUnwind(
8102     TargetFrame : PVOID;
8103     TargetIp : PVOID;
8104     ExceptionRecord : PEXCEPTION_RECORD;
8105     ReturnValue : PVOID
8106   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8107 
8108 // Documented in the DDK.
8109 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8110 function  RtlUpcaseUnicodeChar(
8111     SourceCharacter : WCHAR
8112   ): WCHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8113 
8114 // Documented in the DDK.
8115 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8116 function  RtlUpcaseUnicodeString(
8117     DestinationString : PUNICODE_STRING;
8118     SourceString : PUNICODE_STRING;
8119     AllocateDestinationString : BOOLEAN
8120   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8121 
8122 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8123 function  RtlUpcaseUnicodeStringToAnsiString(
8124     DestinationString : PSTRING;
8125     SourceString : PUNICODE_STRING;
8126     AllocateDestinationString : BOOLEAN
8127   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8128 
8129 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8130 function  RtlUpcaseUnicodeStringToCountedOemString(
8131     DestinationString : PSTRING;
8132     SourceString : PUNICODE_STRING;
8133     AllocateDestinationString : BOOLEAN
8134   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8135 
8136 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8137 function  RtlUpcaseUnicodeStringToOemString(
8138     DestinationString : PSTRING;
8139     SourceString : PUNICODE_STRING;
8140     AllocateDestinationString : BOOLEAN
8141   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8142 
8143 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8144 function  RtlUpcaseUnicodeToMultiByteN(
8145     MbString : PCHAR;
8146     MbSize : ULONG;
8147     var ResultSize : ULONG;
8148     UnicodeString : PWSTR;
8149     UnicodeSize : ULONG
8150   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8151 
8152 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8153 function  RtlUpcaseUnicodeToOemN(
8154     OemString : PCHAR;
8155     OemSize : ULONG;
8156     var ResultSize : ULONG;
8157     UnicodeString : PWSTR;
8158     UnicodeSize : ULONG
8159   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8160 
8161 // Documented in the DDK.
8162 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8163 function  RtlUpperChar(
8164     Character : CHAR
8165   ): CHAR; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8166 
8167 // Documented in the DDK.
8168 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8169 procedure RtlUpperString(
8170     DestinationString : PSTRING;
8171     SourceString : PSTRING
8172   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8173 
8174 // #->REVIEW NUMBER OF PARAMETERS
8175 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8176 function  RtlValidAcl(
8177     Acl : PACL
8178   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8179 
8180 // This function is very similar to HeapValidate() from Kernel32.dll. Refer
8181 // to the PSDK for additional information. Usually the same flags apply.
8182 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8183 function  RtlValidateHeap(
8184     hHeap : HANDLE;
8185     dwFlags : ULONG;
8186     lpMem : LPCVOID
8187   ): BOOL; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8188 
8189 // Compatibility: WXP, 2K3
8190 function  RtlValidateUnicodeString(
8191     dwMustBeNull : ULONG;
8192     ValidateThis : PUNICODE_STRING
8193   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8194 
8195 // Compatibility: W2K, WXP, 2K3
8196 function  RtlValidRelativeSecurityDescriptor(
8197     SecurityDescriptorInput : PSECURITY_DESCRIPTOR;
8198     SecurityDescriptorLength : ULONG;
8199     RequiredInformation : SECURITY_INFORMATION
8200   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8201 
8202 // Documented in the DDK.
8203 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8204 function  RtlValidSecurityDescriptor(
8205     SecurityDescriptor : PSECURITY_DESCRIPTOR
8206   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8207 
8208 // #->REVIEW NUMBER OF PARAMETERS; XREF: see IsValidSid()!
8209 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8210 function  RtlValidSid(
8211     pSid : PSID
8212   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8213 
8214 // Documented in the DDK.
8215 // Compatibility: W2K, WXP, 2K3
8216 function  RtlVerifyVersionInfo(
8217     VersionInfo : PRTL_OSVERSIONINFOEXW;
8218     TypeMask : ULONG;
8219     ConditionMask : ULONGLONG
8220   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8221 
8222 // Documented in the DDK.
8223 function  RtlVolumeDeviceToDosName(
8224     VolumeDeviceObject : PVOID;
8225     DosName : PUNICODE_STRING
8226   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8227 
8228 // Documented in the DDK.
8229 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8230 function  RtlWriteRegistryValue(
8231     RelativeTo : ULONG;
8232     Path : LPCWSTR;
8233     ValueName : LPCWSTR;
8234     ValueType : ULONG;
8235     ValueData : PVOID;
8236     ValueLength : ULONG
8237   ): NTSTATUS; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8238 
8239 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8240 function  RtlxAnsiStringToUnicodeSize(
8241     AnsiString : PANSI_STRING
8242   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8243 
8244 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8245 function  RtlxOemStringToUnicodeSize(
8246     AnsiString : POEM_STRING
8247   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8248 
8249 // Documented in the DDK.
8250 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8251 function  RtlxUnicodeStringToAnsiSize(
8252     UnicodeString : PUNICODE_STRING
8253   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8254 
8255 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8256 function  RtlxUnicodeStringToOemSize(
8257     UnicodeString : PUNICODE_STRING
8258   ): ULONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8259 
8260 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8261 function  RtlZeroHeap(
8262     hHeap : HANDLE;
8263     dwFlags : ULONG
8264   ): BOOLEAN; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8265 
8266 // Documented in the DDK.
8267 // Compatibility: NT3, NT4, W2K, WXP, 2K3
8268 procedure RtlZeroMemory(
8269     Destination : PVOID;
8270     Length : SIZE_T
8271   ); stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8272 
8273 {$IFNDEF JWA_INCLUDEMODE}
8274 // This function is very similar to VerSetConditionMask() from
8275 // Kernel32.dll. Refer to the PSDK for additional information. Usually the
8276 // same flags apply.
8277 // Compatibility: W2K, WXP, 2K3
8278 function  VerSetConditionMask(
8279     ConditionMask : ULONGLONG;
8280     dwTypeMask : DWORD;
8281     Condition : BYTE
8282   ): ULONGLONG; stdcall; {$IFNDEF RTDL}external ntdll;{$ENDIF}
8283 {$ENDIF JWA_INCLUDEMODE}
8284 
8285 //// 810 automatically created prototype entries.
8286 //// END  : Function prototypes
8287 
8288 {$ENDIF JWA_IMPLEMENTATIONSECTION}
8289 
8290 {$IFNDEF JWA_OMIT_SECTIONS}
8291 implementation
8292 {$ENDIF JWA_OMIT_SECTIONS}
8293 
8294 {$IFNDEF JWA_INTERFACESECTION}
8295 
8296 // This function is actually declared as a macro defined as memcpy()
8297 
8298 procedure RtlCopyMemory(Destination: PVOID; Source: PVOID; Length: SIZE_T); stdcall;
8299 begin
8300   Move(Source^, Destination^, Length);
8301 end;
8302 
8303 // Own function to retrieve the process's heap handle
8304 
8305 function NtpGetProcessHeap(): HANDLE;
8306 asm
8307   {$ifdef CPU386}
8308   mov   EAX, FS:[018h]            // EAX now holds the TEB address
8309   mov   EAX, [EAX+030h]           // TEB+$30 holds the PEB address
8310   mov   EAX, DWORD PTR [EAX+018h] // PEB+$30 holds the ProcessHeap's handle
8311   {$endif}
8312   {$ifdef cpux86_64}
8313     mov   RAX, GS:[030h]            // EAX now holds the TEB address
8314     mov   RAX, [RAX+060h]           // TEB+$60 holds the PEB address
8315     mov   RAX, QWORD PTR [RAX+030h] // PEB+$30 holds the ProcessHeap's handle
8316   {$endif cpux86_64}
8317 end;
8318 
tonull8319 // Own function to retrieve the thread environment block (TEB) pointer
8320 
8321 function NtpCurrentTeb(): PTEB;
8322 asm
8323   {$ifdef cpu386}
8324     mov   EAX, FS:[018h]
8325   {$endif cpu386}
8326   {$ifdef cpux86_64}
8327     mov   RAX, GS:[48]
8328   {$endif cpux86_64}
8329 
8330 end;
8331 
tonull8332 // Own function to retrieve the process environment block (PEB) pointer
8333 
8334 function RtlpGetCurrentPeb(): PPEB;
8335 asm
8336   {$ifdef cpu386}
8337    mov   EAX, FS:[018h]
8338    mov   EAX, [EAX+030h]
8339   {$endif cpu386}
8340   {$ifdef cpux86_64}
8341    mov   RAX, GS:[24]
8342    mov   RAX, [RAX+060h]
8343   {$endif cpux86_64}
8344 end;
8345 
8346 (* Own function to swap bytes in 16bit values
8347 
8348    The RtlUshortByteSwap routine converts a USHORT from
8349    little-endian to big-endian, and vice versa. *)
8350 
RtlUshortByteSwapnull8351 function RtlUshortByteSwap(Source: USHORT): USHORT;
8352 asm
8353   {$if defined(cpux86_64) or defined(cpui386)}
8354   {$ifdef cpux86_64}
8355    mov   CX, AX
8356   {$endif cpux86_64}
8357   rol   AX, 08h
8358   {$endif cpux86_64 or cpui386}
8359 end;
8360 
8361 (* Own function to swap bytes in 32bit values
8362 
8363    The RtlUlongByteSwap routine converts a ULONG from little-endian to
8364    big-endian, and vice versa. *)
8365 
RtlUlongByteSwapnull8366 function RtlUlongByteSwap(Source: ULONG): ULONG;
8367 asm
8368   {$ifndef FPC}
8369   // This is not written as mnemonics to be compatible with D4!
8370   db    0Fh, 0C8h       // "bswap EAX" can only be executed on 486+!!!
8371   {$else}
8372     {$if defined(cpux86_64) or defined(cpui386)}
8373     {$ifdef cpux86_64}
8374        mov   ECX, EAX
8375     {$endif cpux86_64}
8376        bswap EAX	// .. but bswap EAX is also 64-bit!!! 0F C8 isn't.
8377     {$endif cpux86_64 or cpui386}
8378   {$endif}
8379 
8380 (*
8381 // Does the same but perhaps slower ...
8382                         // Source = $11223344
8383   rol   AX,  08h        // Source = $11224433
8384   rol   EAX, 0Fh        // Source = $44331122
8385   rol   AX,  08h        // Source = $44332211
8386 *)
8387 end;
8388 
8389 (* Own function to swap bytes in 64bit values
8390 
8391    The RtlUlonglongByteSwap routine converts a ULONGLONG from
8392    little-endian to big-endian, and vice versa. *)
8393 
8394 function RtlUlonglongByteSwap(Source: ULONGLONG): ULONGLONG;
8395 asm
8396   {$ifdef cpu386}
8397     mov   EAX, [ESP+0Ch]  // Get the high part of the ULONGLONG into EAX
8398     mov   EDX, [ESP+08h]  // Get the low part of the ULONGLONG into EDX
8399   // This is not written as mnemonics to be compatible with D4!
8400     db    0Fh, 0C8h       // "bswap EAX" can only be executed on 486+!!!
8401     db    0Fh, 0CAh       // "bswap EDX" can only be executed on 486+!!!
8402   // High part returns in EDX, low part in EAX
8403   {$endif}
8404   {$ifdef cpux86_64}
8405     MOV   RCX,RAX
8406     BSWAP EAX
8407   {$endif cpux86_64}
8408 end;
8409 
8410 // Resembles the RtlValidateUnicodeString() function available from Windows XP
8411 // on exactly as it is on this OS version, except for the calling convention.
8412 
8413 function RtlpValidateUnicodeString(dwMustBeNull: DWORD; UnicodeString: PUNICODE_STRING): NTSTATUS;
8414 begin
8415   result := STATUS_INVALID_PARAMETER;
8416   if (dwMustBeNull = 0) then
8417   begin
8418     result := STATUS_SUCCESS;
8419     if (Assigned(UnicodeString)) then
8420     begin
8421       result := STATUS_INVALID_PARAMETER;
8422       if ((UnicodeString^.Length mod 2 = 0) and (UnicodeString^.MaximumLength mod 2 = 0) and (UnicodeString^.Length <= UnicodeString^.MaximumLength)) then
8423         if ((UnicodeString^.Length > 0) and (UnicodeString^.MaximumLength > 0)) then
8424           if (Assigned(UnicodeString^.Buffer)) then
8425             result := STATUS_SUCCESS;
8426     end;
8427   end;
8428 end;
8429 
8430 // Resembles the RtlValidateUnicodeString() function available from Windows XP
8431 // on, but does not require the first parameter which anyway must be zero.
8432 
8433 function RtlpValidateUnicodeString2(UnicodeString: PUNICODE_STRING): NTSTATUS;
8434 begin
8435   result := STATUS_SUCCESS;
8436   if (Assigned(UnicodeString)) then
8437   begin
8438     result := STATUS_INVALID_PARAMETER;
8439     if ((UnicodeString^.Length mod 2 = 0) and (UnicodeString^.MaximumLength mod 2 = 0) and (UnicodeString^.Length <= UnicodeString^.MaximumLength)) then
8440       if ((UnicodeString^.Length > 0) and (UnicodeString^.MaximumLength > 0)) then
8441         if (Assigned(UnicodeString^.Buffer)) then
8442           result := STATUS_SUCCESS;
8443   end;
8444 end;
8445 
8446 
8447 {$IFDEF RTDL}
8448 
8449 /// Function types
8450 type
8451   TFNCsrGetProcessId = function (): DWORD; stdcall;
8452   TFNDbgQueryDebugFilterState = function (ComponentId: ULONG; Level: ULONG): NTSTATUS; stdcall;
8453   TFNDbgSetDebugFilterState = function (ComponentId: ULONG; Level: ULONG; State: BOOLEAN): NTSTATUS; stdcall;
8454   TFNKiRaiseUserExceptionDispatcher = function (): ULONG; stdcall;
8455   TFNLdrAccessResource = function (hModule: HANDLE; ResourceDataEntry: PIMAGE_RESOURCE_DATA_ENTRY; Address: PPVOID; dwSize: PULONG): NTSTATUS; stdcall;
8456   TFNLdrAlternateResourcesEnabled = function (): BOOLEAN; stdcall;
8457   TFNLdrDisableThreadCalloutsForDll = function (hModule: HANDLE): NTSTATUS; stdcall;
8458   TFNLdrGetDllHandle = function (pwPath: PWORD; pReserved: PVOID; pusPath: PUNICODE_STRING; var phModule: HANDLE): NTSTATUS; stdcall;
8459   TFNLdrGetProcedureAddress = function (hModule: HANDLE; dwOrdinal: ULONG; psName: PSTRING; var pProcedure: PVOID): NTSTATUS; stdcall;
8460   TFNLdrLoadDll = function (pwPath: PWORD; pdwFlags: PDWORD; pusPath: PUNICODE_STRING; var phModule: HANDLE): NTSTATUS; stdcall;
8461   TFNLdrQueryImageFileExecutionOptions = function (pusImagePath: PUNICODE_STRING; pwOptionName: PWORD; dwRequestedType: DWORD; pData: PVOID; dwSize: DWORD; pdwSize: PDWORD): NTSTATUS; stdcall;
8462   TFNLdrQueryProcessModuleInformation = function (psmi: PSYSTEM_MODULE_INFORMATION; dwSize: DWORD; pdwSize: PDWORD): NTSTATUS; stdcall;
8463   TFNLdrShutdownProcess = procedure(); stdcall;
8464   TFNLdrShutdownThread = procedure(); stdcall;
8465   TFNLdrUnloadDll = function (hModule: HANDLE): NTSTATUS; stdcall;
8466   TFNNtAcceptConnectPort = function (PortHandle: PHANDLE; PortIdentifier: ULONG; Message: PPORT_MESSAGE; Accept: BOOLEAN; WriteSection: PPORT_SECTION_WRITE; ReadSection: PPORT_SECTION_READ): NTSTATUS; stdcall;
8467   TFNNtAccessCheck = function (SecurityDescriptor: PSECURITY_DESCRIPTOR; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; GenericMapping: PGENERIC_MAPPING; PrivilegeSet: PPRIVILEGE_SET; PrivilegeSetLength: PULONG;
8468     GrantedAccess: PACCESS_MASK; AccessStatus: PBOOLEAN): NTSTATUS; stdcall;
8469   TFNNtAccessCheckAndAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; DesiredAccess: ACCESS_MASK;
8470     GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN; GrantedAccess: PACCESS_MASK; AccessStatus: PBOOLEAN; GenerateOnClose: PBOOLEAN): NTSTATUS; stdcall;
8471   TFNNtAccessCheckByType = function (SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG;
8472     GenericMapping: PGENERIC_MAPPING; PrivilegeSet: PPRIVILEGE_SET; PrivilegeSetLength: PULONG; GrantedAccess: PACCESS_MASK; AccessStatus: PULONG): NTSTATUS; stdcall;
8473   TFNNtAccessCheckByTypeAndAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID;
8474     DesiredAccess: ACCESS_MASK; AuditType: AUDIT_EVENT_TYPE; Flags: ULONG; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG; GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN; GrantedAccess: PACCESS_MASK;
8475     AccessStatus: PULONG; GenerateOnClose: PBOOLEAN): NTSTATUS; stdcall;
8476   TFNNtAccessCheckByTypeResultList = function (SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG;
8477     GenericMapping: PGENERIC_MAPPING; PrivilegeSet: PPRIVILEGE_SET; PrivilegeSetLength: PULONG; GrantedAccessList: PACCESS_MASK; AccessStatusList: PULONG): NTSTATUS; stdcall;
8478   TFNNtAccessCheckByTypeResultListAndAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID;
8479     DesiredAccess: ACCESS_MASK; AuditType: AUDIT_EVENT_TYPE; Flags: ULONG; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG; GenericMapping: PGENERIC_MAPPING; ObjectCreation: BOOLEAN; GrantedAccessList: PACCESS_MASK;
8480     AccessStatusList: PULONG; GenerateOnClose: PULONG): NTSTATUS; stdcall;
8481   TFNNtAccessCheckByTypeResultListAndAuditAlarmByHandle = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; TokenHandle: HANDLE; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING;
8482     SecurityDescriptor: PSECURITY_DESCRIPTOR; PrincipalSelfSid: PSID; DesiredAccess: ACCESS_MASK; AuditType: AUDIT_EVENT_TYPE; Flags: ULONG; ObjectTypeList: POBJECT_TYPE_LIST; ObjectTypeListLength: ULONG; GenericMapping: PGENERIC_MAPPING;
8483     ObjectCreation: BOOLEAN; GrantedAccessList: PACCESS_MASK; AccessStatusList: PULONG; GenerateOnClose: PULONG): NTSTATUS; stdcall;
8484   TFNNtAddAtom = function (Str: PWSTR; StringLength: ULONG; Atom: PUSHORT): NTSTATUS; stdcall;
8485   TFNNtAdjustGroupsToken = function (TokenHandle: HANDLE; ResetToDefault: BOOLEAN; NewState: PTOKEN_GROUPS; BufferLength: ULONG; PreviousState: PTOKEN_GROUPS; ReturnLength: PULONG): NTSTATUS; stdcall;
8486   TFNNtAdjustPrivilegesToken = function (TokenHandle: HANDLE; DisableAllPrivileges: BOOLEAN; NewState: PTOKEN_PRIVILEGES; BufferLength: ULONG; PreviousState: PTOKEN_PRIVILEGES; ReturnLength: PULONG): NTSTATUS; stdcall;
8487   TFNNtAlertResumeThread = function (ThreadHandle: HANDLE; PreviousSuspendCount: PULONG): NTSTATUS; stdcall;
8488   TFNNtAlertThread = function (ThreadHandle: HANDLE): NTSTATUS; stdcall;
8489   TFNNtAllocateLocallyUniqueId = function (Luid: PLUID): NTSTATUS; stdcall;
8490   TFNNtAllocateUserPhysicalPages = function (ProcessHandle: HANDLE; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall;
8491   TFNNtAllocateUuids = function (UuidLastTimeAllocated: PLARGE_INTEGER; UuidDeltaTime: PULONG; UuidSequenceNumber: PULONG; UuidSeed: PUCHAR): NTSTATUS; stdcall;
8492   TFNNtAllocateVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PPVOID; ZeroBits: ULONG; AllocationSize: PULONG; AllocationType: ULONG; Protect: ULONG): NTSTATUS; stdcall;
8493   TFNNtAreMappedFilesTheSame = function (Address1: PVOID; Address2: PVOID): NTSTATUS; stdcall;
8494   TFNNtAssignProcessToJobObject = function (JobHandle: HANDLE; ProcessHandle: HANDLE): NTSTATUS; stdcall;
8495   TFNNtCallbackReturn = function (Result_: PVOID; ResultLength: ULONG; Status: NTSTATUS): NTSTATUS; stdcall;
8496   TFNNtCancelDeviceWakeupRequest = function (DeviceHandle: HANDLE): NTSTATUS; stdcall;
8497   TFNNtCancelIoFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK): NTSTATUS; stdcall;
8498   TFNNtCancelTimer = function (TimerHandle: HANDLE; PreviousState: PBOOLEAN): NTSTATUS; stdcall;
8499   TFNNtClearEvent = function (EventHandle: HANDLE): NTSTATUS; stdcall;
8500   TFNNtClose = function (Handle: HANDLE): NTSTATUS; stdcall;
8501   TFNNtCloseObjectAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; GenerateOnClose: BOOLEAN): NTSTATUS; stdcall;
8502   TFNNtCompleteConnectPort = function (PortHandle: HANDLE): NTSTATUS; stdcall;
8503   TFNNtConnectPort = function (PortHandle: PHANDLE; PortName: PUNICODE_STRING; SecurityQos: PSECURITY_QUALITY_OF_SERVICE; WriteSection: PPORT_SECTION_WRITE; ReadSection: PPORT_SECTION_READ; MaxMessageSize: PULONG; ConnectData: PVOID;
8504     ConnectDataLength: PULONG): NTSTATUS; stdcall;
8505   TFNNtContinue = function (Context: PCONTEXT; TestAlert: BOOLEAN): NTSTATUS; stdcall;
8506   TFNNtCreateChannel = function (ChannelHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8507   TFNNtCreateDirectoryObject = function (DirectoryHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8508   TFNNtCreateEvent = function (EventHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; EventType: EVENT_TYPE; InitialState: BOOLEAN): NTSTATUS; stdcall;
8509   TFNNtCreateEventPair = function (EventPairHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8510   TFNNtCreateFile = function (FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; AllocationSize: PLARGE_INTEGER; FileAttributes: ULONG; ShareAccess: ULONG;
8511     CreateDisposition: ULONG; CreateOptions: ULONG; EaBuffer: PVOID; EaLength: ULONG): NTSTATUS; stdcall;
8512   TFNNtCreateIoCompletion = function (IoCompletionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; NumberOfConcurrentThreads: ULONG): NTSTATUS; stdcall;
8513   TFNNtCreateJobObject = function (JobHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8514   TFNNtCreateKey = function (KeyHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; TitleIndex: ULONG; Class_: PUNICODE_STRING; CreateOptions: ULONG; Disposition: PULONG): NTSTATUS; stdcall;
8515   TFNNtCreateMailslotFile = function (FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; CreateOptions: ULONG; Unknown: ULONG; MaxMessageSize: ULONG;
8516     ReadTimeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8517   TFNNtCreateMutant = function (MutantHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; InitialOwner: BOOLEAN): NTSTATUS; stdcall;
8518   TFNNtCreateNamedPipeFile = function (FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; ShareAccess: ULONG; CreateDisposition: ULONG; CreateOptions: ULONG;
8519     TypeMessage: BOOLEAN; ReadmodeMessage: BOOLEAN; Nonblocking: BOOLEAN; MaxInstances: ULONG; InBufferSize: ULONG; OutBufferSize: ULONG; DefaultTimeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8520   TFNNtCreatePagingFile = function (FileName: PUNICODE_STRING; InitialSize: PULARGE_INTEGER; MaximumSize: PULARGE_INTEGER; Reserved: ULONG): NTSTATUS; stdcall;
8521   TFNNtCreatePort = function (PortHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES; MaxDataSize: ULONG; MaxMessageSize: ULONG; Reserved: ULONG): NTSTATUS; stdcall;
8522   TFNNtCreateProcess = function (ProcessHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; InheritFromProcessHandle: HANDLE; InheritHandles: BOOLEAN; SectionHandle: HANDLE; DebugPort: HANDLE;
8523     ExceptionPort: HANDLE): NTSTATUS; stdcall;
8524   TFNNtCreateProfile = function (ProfileHandle: PHANDLE; ProcessHandle: HANDLE; Base: PVOID; Size: ULONG; BucketShift: ULONG; Buffer: PULONG; BufferLength: ULONG; Source: KPROFILE_SOURCE; ProcessorMask: ULONG): NTSTATUS; stdcall;
8525   TFNNtCreateSection = function (SectionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; SectionSize: PLARGE_INTEGER; Protect: ULONG; Attributes: ULONG; FileHandle: HANDLE): NTSTATUS; stdcall;
8526   TFNNtCreateSemaphore = function (SemaphoreHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; InitialCount: LONG; MaximumCount: LONG): NTSTATUS; stdcall;
8527   TFNNtCreateSymbolicLinkObject = function (SymbolicLinkHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; TargetName: PUNICODE_STRING): NTSTATUS; stdcall;
8528   TFNNtCreateThread = function (ThreadHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; ProcessHandle: HANDLE; ClientId: PCLIENT_ID; ThreadContext: PCONTEXT; UserStack: PUSER_STACK;
8529     CreateSuspended: BOOLEAN): NTSTATUS; stdcall;
8530   TFNNtCreateTimer = function (TimerHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; TimerType: TIMER_TYPE): NTSTATUS; stdcall;
8531   TFNNtCreateToken = function (TokenHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; Type_: TOKEN_TYPE; AuthenticationId: PLUID; ExpirationTime: PLARGE_INTEGER; User: PTOKEN_USER; Groups: PTOKEN_GROUPS;
8532     Privileges: PTOKEN_PRIVILEGES; Owner: PTOKEN_OWNER; PrimaryGroup: PTOKEN_PRIMARY_GROUP; DefaultDacl: PTOKEN_DEFAULT_DACL; Source: PTOKEN_SOURCE): NTSTATUS; stdcall;
8533   TFNNtCreateWaitablePort = function (PortHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES; MaxDataSize: ULONG; MaxMessageSize: ULONG; Reserved: ULONG): NTSTATUS; stdcall;
8534   TFNNtCurrentTeb = function (): PTEB; stdcall;
8535   TFNNtDebugActiveProcess = function (hProcess: HANDLE; hDebugObject: HANDLE): NTSTATUS; stdcall;
8536   TFNNtDelayExecution = function (Alertable: BOOLEAN; Interval: PLARGE_INTEGER): NTSTATUS; stdcall;
8537   TFNNtDeleteAtom = function (Atom: USHORT): NTSTATUS; stdcall;
8538   TFNNtDeleteFile = function (ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8539   TFNNtDeleteKey = function (KeyHandle: HANDLE): NTSTATUS; stdcall;
8540   TFNNtDeleteObjectAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; GenerateOnClose: BOOLEAN): NTSTATUS; stdcall;
8541   TFNNtDeleteValueKey = function (KeyHandle: HANDLE; ValueName: PUNICODE_STRING): NTSTATUS; stdcall;
8542   TFNNtDeviceIoControlFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; IoControlCode: ULONG; InputBuffer: PVOID; InputBufferLength: ULONG;
8543     OutputBuffer: PVOID; OutputBufferLength: ULONG): NTSTATUS; stdcall;
8544   TFNNtDisplayString = function (Str: PUNICODE_STRING): NTSTATUS; stdcall;
8545   TFNNtDuplicateObject = function (SourceProcessHandle: HANDLE; SourceHandle: HANDLE; TargetProcessHandle: HANDLE; TargetHandle: PHANDLE; DesiredAccess: ACCESS_MASK; Attributes: ULONG; Options: ULONG): NTSTATUS; stdcall;
8546   TFNNtDuplicateToken = function (ExistingTokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; EffectiveOnly: BOOLEAN; TokenType: TOKEN_TYPE; NewTokenHandle: PHANDLE): NTSTATUS; stdcall;
8547   TFNNtEnumerateKey = function (KeyHandle: HANDLE; Index: ULONG; KeyInformationClass: KEY_INFORMATION_CLASS; KeyInformation: PVOID; KeyInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8548   TFNNtEnumerateValueKey = function (KeyHandle: HANDLE; Index: ULONG; KeyValueInformationClass: KEY_VALUE_INFORMATION_CLASS; KeyValueInformation: PVOID; KeyValueInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8549   TFNNtExtendSection = function (SectionHandle: HANDLE; SectionSize: PLARGE_INTEGER): NTSTATUS; stdcall;
8550   TFNNtFilterToken = function (ExistingTokenHandle: HANDLE; Flags: ULONG; SidsToDisable: PTOKEN_GROUPS; PrivilegesToDelete: PTOKEN_PRIVILEGES; SidsToRestricted: PTOKEN_GROUPS; NewTokenHandle: PHANDLE): NTSTATUS; stdcall;
8551   TFNNtFindAtom = function (Str: PWSTR; StringLength: ULONG; Atom: PUSHORT): NTSTATUS; stdcall;
8552   TFNNtFlushBuffersFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK): NTSTATUS; stdcall;
8553   TFNNtFlushInstructionCache = function (ProcessHandle: HANDLE; BaseAddress: PVOID; FlushSize: ULONG): NTSTATUS; stdcall;
8554   TFNNtFlushKey = function (KeyHandle: HANDLE): NTSTATUS; stdcall;
8555   TFNNtFlushVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PPVOID; FlushSize: PULONG; IoStatusBlock: PIO_STATUS_BLOCK): NTSTATUS; stdcall;
8556   TFNNtFlushWriteBuffer = function (): NTSTATUS; stdcall;
8557   TFNNtFreeUserPhysicalPages = function (ProcessHandle: HANDLE; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall;
8558   TFNNtFreeVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PPVOID; FreeSize: PULONG; FreeType: ULONG): NTSTATUS; stdcall;
8559   TFNNtFsControlFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; FsControlCode: ULONG; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID;
8560     OutputBufferLength: ULONG): NTSTATUS; stdcall;
8561   TFNNtGetContextThread = function (ThreadHandle: HANDLE; Context: PCONTEXT): NTSTATUS; stdcall;
8562   TFNNtGetCurrentProcessorNumber = function (): ULONG; stdcall;
8563   TFNNtGetDevicePowerState = function (DeviceHandle: HANDLE; DevicePowerState: PDEVICE_POWER_STATE): NTSTATUS; stdcall;
8564   TFNNtGetPlugPlayEvent = function (Reserved1: ULONG; Reserved2: ULONG; Buffer: PVOID; BufferLength: ULONG): NTSTATUS; stdcall;
8565   TFNNtGetTickCount = function (): ULONG; stdcall;
8566   TFNNtGetWriteWatch = function (ProcessHandle: HANDLE; Flags: ULONG; BaseAddress: PVOID; RegionSize: ULONG; Buffer: PULONG; BufferEntries: PULONG; Granularity: PULONG): NTSTATUS; stdcall;
8567   TFNNtImpersonateAnonymousToken = function (ThreadHandle: HANDLE): NTSTATUS; stdcall;
8568   TFNNtImpersonateClientOfPort = function (PortHandle: HANDLE; Message: PPORT_MESSAGE): NTSTATUS; stdcall;
8569   TFNNtImpersonateThread = function (ThreadHandle: HANDLE; TargetThreadHandle: HANDLE; SecurityQos: PSECURITY_QUALITY_OF_SERVICE): NTSTATUS; stdcall;
8570   TFNNtInitializeRegistry = function (Setup: BOOLEAN): NTSTATUS; stdcall;
8571   TFNNtInitiatePowerAction = function (SystemAction: POWER_ACTION; MinSystemState: SYSTEM_POWER_STATE; Flags: ULONG; Asynchronous: BOOLEAN): NTSTATUS; stdcall;
8572   TFNNtIsSystemResumeAutomatic = function (): BOOLEAN; stdcall;
8573   TFNNtListenChannel = function (x: PVOID; y: PVOID): NTSTATUS; stdcall;
8574   TFNNtListenPort = function (PortHandle: HANDLE; Message: PPORT_MESSAGE): NTSTATUS; stdcall;
8575   TFNNtLoadDriver = function (DriverServiceName: PUNICODE_STRING): NTSTATUS; stdcall;
8576   TFNNtLoadKey = function (KeyObjectAttributes: POBJECT_ATTRIBUTES; FileObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8577   TFNNtLoadKey2 = function (KeyObjectAttributes: POBJECT_ATTRIBUTES; FileObjectAttributes: POBJECT_ATTRIBUTES; Flags: ULONG): NTSTATUS; stdcall;
8578   TFNNtLockFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; LockOffset: PULARGE_INTEGER; LockLength: PULARGE_INTEGER; Key: ULONG; FailImmediately: BOOLEAN;
8579     ExclusiveLock: BOOLEAN): NTSTATUS; stdcall;
8580   TFNNtLockVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PPVOID; LockSize: PULONG; LockType: ULONG): NTSTATUS; stdcall;
8581   TFNNtMakePermanentObject = function (Handle: HANDLE): NTSTATUS; stdcall;
8582   TFNNtMakeTemporaryObject = function (Handle: HANDLE): NTSTATUS; stdcall;
8583   TFNNtMapUserPhysicalPages = function (BaseAddress: PVOID; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall;
8584   TFNNtMapUserPhysicalPagesScatter = function (BaseAddresses: PPVOID; NumberOfPages: PULONG; PageFrameNumbers: PULONG): NTSTATUS; stdcall;
8585   TFNNtMapViewOfSection = function (SectionHandle: HANDLE; ProcessHandle: HANDLE; BaseAddress: PPVOID; ZeroBits: ULONG; CommitSize: ULONG; SectionOffset: PLARGE_INTEGER; ViewSize: PULONG; InheritDisposition: SECTION_INHERIT;
8586     AllocationType: ULONG; Protect: ULONG): NTSTATUS; stdcall;
8587   TFNNtNotifyChangeDirectoryFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_NOTIFY_INFORMATION; BufferLength: ULONG; NotifyFilter: ULONG;
8588     WatchSubtree: BOOLEAN): NTSTATUS; stdcall;
8589   TFNNtNotifyChangeKey = function (KeyHandle: HANDLE; EventHandle: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; NotifyFilter: ULONG; WatchSubtree: BOOLEAN; Buffer: PVOID; BufferLength: ULONG;
8590     Asynchronous: BOOLEAN): NTSTATUS; stdcall;
8591   TFNNtNotifyChangeMultipleKeys = function (KeyHandle: HANDLE; Flags: ULONG; KeyObjectAttributes: POBJECT_ATTRIBUTES; EventHandle: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; NotifyFilter: ULONG;
8592     WatchSubtree: BOOLEAN; Buffer: PVOID; BufferLength: ULONG; Asynchronous: BOOLEAN): NTSTATUS; stdcall;
8593   TFNNtOpenChannel = function (ChannelHandle: PHANDLE; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8594   TFNNtOpenDirectoryObject = function (DirectoryHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8595   TFNNtOpenEvent = function (EventHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8596   TFNNtOpenEventPair = function (EventPairHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8597   TFNNtOpenFile = function (FileHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; IoStatusBlock: PIO_STATUS_BLOCK; ShareAccess: ULONG; OpenOptions: ULONG): NTSTATUS; stdcall;
8598   TFNNtOpenIoCompletion = function (IoCompletionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8599   TFNNtOpenJobObject = function (JobHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8600   TFNNtOpenKey = function (KeyHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8601   TFNNtOpenMutant = function (MutantHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8602   TFNNtOpenObjectAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PPVOID; ObjectTypeName: PUNICODE_STRING; ObjectName: PUNICODE_STRING; SecurityDescriptor: PSECURITY_DESCRIPTOR; TokenHandle: HANDLE;
8603     DesiredAccess: ACCESS_MASK; GrantedAccess: ACCESS_MASK; Privileges: PPRIVILEGE_SET; ObjectCreation: BOOLEAN; AccessGranted: BOOLEAN; GenerateOnClose: PBOOLEAN): NTSTATUS; stdcall;
8604   TFNNtOpenProcess = function (ProcessHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; ClientId: PCLIENT_ID): NTSTATUS; stdcall;
8605   TFNNtOpenProcessToken = function (ProcessHandle: HANDLE; DesiredAccess: ACCESS_MASK; TokenHandle: PHANDLE): NTSTATUS; stdcall;
8606   TFNNtOpenSection = function (SectionHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8607   TFNNtOpenSemaphore = function (SemaphoreHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8608   TFNNtOpenSymbolicLinkObject = function (SymbolicLinkHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8609   TFNNtOpenThread = function (ThreadHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; ClientId: PCLIENT_ID): NTSTATUS; stdcall;
8610   TFNNtOpenThreadToken = function (ThreadHandle: HANDLE; DesiredAccess: ACCESS_MASK; OpenAsSelf: BOOLEAN; TokenHandle: PHANDLE): NTSTATUS; stdcall;
8611   TFNNtOpenTimer = function (TimerHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8612   TFNNtPlugPlayControl = function (ControlCode: ULONG; Buffer: PVOID; BufferLength: ULONG): NTSTATUS; stdcall;
8613   TFNNtPowerInformation = function (PowerInformationLevel: POWER_INFORMATION_LEVEL; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID; OutputBufferLength: ULONG): NTSTATUS; stdcall;
8614   TFNNtPrivilegeCheck = function (TokenHandle: HANDLE; RequiredPrivileges: PPRIVILEGE_SET; Result_: PBOOLEAN): NTSTATUS; stdcall;
8615   TFNNtPrivilegeObjectAuditAlarm = function (SubsystemName: PUNICODE_STRING; HandleId: PVOID; TokenHandle: HANDLE; DesiredAccess: ACCESS_MASK; Privileges: PPRIVILEGE_SET; AccessGranted: BOOLEAN): NTSTATUS; stdcall;
8616   TFNNtPrivilegedServiceAuditAlarm = function (SubsystemName: PUNICODE_STRING; ServiceName: PUNICODE_STRING; TokenHandle: HANDLE; Privileges: PPRIVILEGE_SET; AccessGranted: BOOLEAN): NTSTATUS; stdcall;
8617   TFNNtProtectVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PPVOID; ProtectSize: PULONG; NewProtect: ULONG; OldProtect: PULONG): NTSTATUS; stdcall;
8618   TFNNtPulseEvent = function (EventHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall;
8619   TFNNtQueryAttributesFile = function (ObjectAttributes: POBJECT_ATTRIBUTES; FileInformation: PFILE_BASIC_INFORMATION): NTSTATUS; stdcall;
8620   TFNNtQueryDefaultLocale = function (ThreadOrSystem: BOOLEAN; Locale: PLCID): NTSTATUS; stdcall;
8621   TFNNtQueryDefaultUILanguage = function (LanguageId: PLANGID): NTSTATUS; stdcall;
8622   TFNNtQueryDirectoryFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; FileInformation: PVOID; FileInformationLength: ULONG;
8623     FileInformationClass: FILE_INFORMATION_CLASS; ReturnSingleEntry: BOOLEAN; FileName: PUNICODE_STRING; RestartScan: BOOLEAN): NTSTATUS; stdcall;
8624   TFNNtQueryDirectoryObject = function (DirectoryHandle: HANDLE; Buffer: PVOID; BufferLength: ULONG; ReturnSingleEntry: BOOLEAN; RestartScan: BOOLEAN; Context: PULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8625   TFNNtQueryEaFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_FULL_EA_INFORMATION; BufferLength: ULONG; ReturnSingleEntry: BOOLEAN; EaList: PFILE_GET_EA_INFORMATION; EaListLength: ULONG; EaIndex: PULONG;
8626     RestartScan: BOOLEAN): NTSTATUS; stdcall;
8627   TFNNtQueryEvent = function (EventHandle: HANDLE; EventInformationClass: EVENT_INFORMATION_CLASS; EventInformation: PVOID; EventInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8628   TFNNtQueryFullAttributesFile = function (ObjectAttributes: POBJECT_ATTRIBUTES; FileInformation: PFILE_NETWORK_OPEN_INFORMATION): NTSTATUS; stdcall;
8629   TFNNtQueryInformationAtom = function (Atom: USHORT; AtomInformationClass: ATOM_INFORMATION_CLASS; AtomInformation: PVOID; AtomInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8630   TFNNtQueryInformationFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; FileInformation: PVOID; FileInformationLength: ULONG; FileInformationClass: FILE_INFORMATION_CLASS): NTSTATUS; stdcall;
8631   TFNNtQueryInformationJobObject = function (JobHandle: HANDLE; JobInformationClass: JOBOBJECTINFOCLASS; JobInformation: PVOID; JobInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8632   TFNNtQueryInformationPort = function (PortHandle: HANDLE; PortInformationClass: PORT_INFORMATION_CLASS; PortInformation: PVOID; PortInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8633   TFNNtQueryInformationProcess = function (ProcessHandle: HANDLE; ProcessInformationClass: PROCESSINFOCLASS; ProcessInformation: PVOID; ProcessInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8634   TFNNtQueryInformationThread = function (ThreadHandle: HANDLE; ThreadInformationClass: THREADINFOCLASS; ThreadInformation: PVOID; ThreadInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8635   TFNNtQueryInformationToken = function (TokenHandle: HANDLE; TokenInformationClass: TOKEN_INFORMATION_CLASS; TokenInformation: PVOID; TokenInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8636   TFNNtQueryInstallUILanguage = function (LanguageId: PLANGID): NTSTATUS; stdcall;
8637   TFNNtQueryIntervalProfile = function (Source: KPROFILE_SOURCE; Interval: PULONG): NTSTATUS; stdcall;
8638   TFNNtQueryIoCompletion = function (IoCompletionHandle: HANDLE; IoCompletionInformationClass: IO_COMPLETION_INFORMATION_CLASS; IoCompletionInformation: PVOID; IoCompletionInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8639   TFNNtQueryKey = function (KeyHandle: HANDLE; KeyInformationClass: KEY_INFORMATION_CLASS; KeyInformation: PVOID; KeyInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8640   TFNNtQueryMultipleValueKey = function (KeyHandle: HANDLE; ValueList: PKEY_VALUE_ENTRY; NumberOfValues: ULONG; Buffer: PVOID; Length: PULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8641   TFNNtQueryMutant = function (MutantHandle: HANDLE; MutantInformationClass: MUTANT_INFORMATION_CLASS; MutantInformation: PVOID; MutantInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8642   TFNNtQueryObject = function (ObjectHandle: HANDLE; ObjectInformationClass: OBJECT_INFORMATION_CLASS; ObjectInformation: PVOID; ObjectInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8643   TFNNtQueryOpenSubKeys = function (KeyObjectAttributes: POBJECT_ATTRIBUTES; NumberOfKey: PULONG): NTSTATUS; stdcall;
8644   TFNNtQueryPerformanceCounter = function (PerformanceCount: PLARGE_INTEGER; PerformanceFrequency: PLARGE_INTEGER): NTSTATUS; stdcall;
8645   TFNNtQueryPortInformationProcess = function (): ULONG; stdcall;
8646   TFNNtQueryQuotaInformationFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_USER_QUOTA_INFORMATION; BufferLength: ULONG; ReturnSingleEntry: BOOLEAN; QuotaList: PFILE_QUOTA_LIST_INFORMATION;
8647     QuotaListLength: ULONG; ResumeSid: PSID; RestartScan: BOOLEAN): NTSTATUS; stdcall;
8648   TFNNtQuerySection = function (SectionHandle: HANDLE; SectionInformationClass: SECTION_INFORMATION_CLASS; SectionInformation: PVOID; SectionInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8649   TFNNtQuerySecurityObject = function (Handle: HANDLE; RequestedInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR; SecurityDescriptorLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8650   TFNNtQuerySemaphore = function (SemaphoreHandle: HANDLE; SemaphoreInformationClass: SEMAPHORE_INFORMATION_CLASS; SemaphoreInformation: PVOID; SemaphoreInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8651   TFNNtQuerySymbolicLinkObject = function (SymbolicLinkHandle: HANDLE; TargetName: PUNICODE_STRING; ReturnLength: PULONG): NTSTATUS; stdcall;
8652   TFNNtQuerySystemEnvironmentValue = function (Name: PUNICODE_STRING; Value: PVOID; ValueLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8653   TFNNtQuerySystemInformation = function (SystemInformationClass: SYSTEM_INFORMATION_CLASS; SystemInformation: PVOID; SystemInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8654   TFNNtQuerySystemTime = function (CurrentTime: PLARGE_INTEGER): NTSTATUS; stdcall;
8655   TFNNtQueryTimer = function (TimerHandle: HANDLE; TimerInformationClass: TIMER_INFORMATION_CLASS; TimerInformation: PVOID; TimerInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8656   TFNNtQueryTimerResolution = function (CoarsestResolution: PULONG; FinestResolution: PULONG; ActualResolution: PULONG): NTSTATUS; stdcall;
8657   TFNNtQueryValueKey = function (KeyHandle: HANDLE; ValueName: PUNICODE_STRING; KeyValueInformationClass: KEY_VALUE_INFORMATION_CLASS; KeyValueInformation: PVOID; KeyValueInformationLength: ULONG; ResultLength: PULONG): NTSTATUS; stdcall;
8658   TFNNtQueryVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PVOID; MemoryInformationClass: MEMORY_INFORMATION_CLASS; MemoryInformation: PVOID; MemoryInformationLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8659   TFNNtQueryVolumeInformationFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; VolumeInformation: PVOID; VolumeInformationLength: ULONG; VolumeInformationClass: FS_INFORMATION_CLASS): NTSTATUS; stdcall;
8660   TFNNtQueueApcThread = function (ThreadHandle: HANDLE; ApcRoutine: PKNORMAL_ROUTINE; ApcContext: PVOID; Argument1: PVOID; Argument2: PVOID): NTSTATUS; stdcall;
8661   TFNNtRaiseException = function (ExceptionRecord: PEXCEPTION_RECORD; Context: PCONTEXT; SearchFrames: BOOLEAN): NTSTATUS; stdcall;
8662   TFNNtRaiseHardError = function (Status: NTSTATUS; NumberOfArguments: ULONG; StringArgumentsMask: ULONG; Arguments: PULONG; MessageBoxType: ULONG; MessageBoxResult: PULONG): NTSTATUS; stdcall;
8663   TFNNtReadFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PVOID; Length: ULONG; ByteOffset: PLARGE_INTEGER; Key: PULONG): NTSTATUS; stdcall;
8664   TFNNtReadFileScatter = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_SEGMENT_ELEMENT; Length: ULONG; ByteOffset: PLARGE_INTEGER;
8665     Key: PULONG): NTSTATUS; stdcall;
8666   TFNNtReadRequestData = function (PortHandle: HANDLE; Message: PPORT_MESSAGE; Index: ULONG; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8667   TFNNtReadVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PVOID; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8668   TFNNtRegisterThreadTerminatePort = function (PortHandle: HANDLE): NTSTATUS; stdcall;
8669   TFNNtReleaseMutant = function (MutantHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall;
8670   TFNNtReleaseSemaphore = function (SemaphoreHandle: HANDLE; ReleaseCount: LONG; PreviousCount: PLONG): NTSTATUS; stdcall;
8671   TFNNtRemoveIoCompletion = function (IoCompletionHandle: HANDLE; CompletionKey: PULONG; CompletionValue: PULONG; IoStatusBlock: PIO_STATUS_BLOCK; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8672   TFNNtRemoveProcessDebug = function (hProcess: HANDLE; hDebugObject: HANDLE): NTSTATUS; stdcall;
8673   TFNNtReplaceKey = function (NewFileObjectAttributes: POBJECT_ATTRIBUTES; KeyHandle: HANDLE; OldFileObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8674   TFNNtReplyPort = function (PortHandle: HANDLE; ReplyMessage: PPORT_MESSAGE): NTSTATUS; stdcall;
8675   TFNNtReplyWaitReceivePort = function (PortHandle: HANDLE; PortIdentifier: PULONG; ReplyMessage: PPORT_MESSAGE; Message: PPORT_MESSAGE): NTSTATUS; stdcall;
8676   TFNNtReplyWaitReceivePortEx = function (PortHandle: HANDLE; PortIdentifier: PULONG; ReplyMessage: PPORT_MESSAGE; Message: PPORT_MESSAGE; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8677   TFNNtReplyWaitReplyPort = function (PortHandle: HANDLE; ReplyMessage: PPORT_MESSAGE): NTSTATUS; stdcall;
8678   TFNNtReplyWaitSendChannel = function (x: PVOID; y: PVOID; z: PVOID): NTSTATUS; stdcall;
8679   TFNNtRequestDeviceWakeup = function (DeviceHandle: HANDLE): NTSTATUS; stdcall;
8680   TFNNtRequestPort = function (PortHandle: HANDLE; RequestMessage: PPORT_MESSAGE): NTSTATUS; stdcall;
8681   TFNNtRequestWaitReplyPort = function (PortHandle: HANDLE; RequestMessage: PPORT_MESSAGE; ReplyMessage: PPORT_MESSAGE): NTSTATUS; stdcall;
8682   TFNNtRequestWakeupLatency = function (Latency: LATENCY_TIME): NTSTATUS; stdcall;
8683   TFNNtResetEvent = function (EventHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall;
8684   TFNNtResetWriteWatch = function (ProcessHandle: HANDLE; BaseAddress: PVOID; RegionSize: ULONG): NTSTATUS; stdcall;
8685   TFNNtRestoreKey = function (KeyHandle: HANDLE; FileHandle: HANDLE; Flags: ULONG): NTSTATUS; stdcall;
8686   TFNNtResumeProcess = function (hProcess: HANDLE): NTSTATUS; stdcall;
8687   TFNNtResumeThread = function (hThread: HANDLE; dwResumeCount: PULONG): NTSTATUS; stdcall;
8688   TFNNtSaveKey = function (KeyHandle: HANDLE; FileHandle: HANDLE): NTSTATUS; stdcall;
8689   TFNNtSaveKeyEx = function (KeyHandle: HANDLE; FileHandle: HANDLE; Flags: DWORD): NTSTATUS; stdcall;
8690   TFNNtSaveMergedKeys = function (KeyHandle1: HANDLE; KeyHandle2: HANDLE; FileHandle: HANDLE): NTSTATUS; stdcall;
8691   TFNNtSecureConnectPort = function (PortHandle: PHANDLE; PortName: PUNICODE_STRING; SecurityQos: PSECURITY_QUALITY_OF_SERVICE; WriteSection: PPORT_SECTION_WRITE; ServerSid: PSID; ReadSection: PPORT_SECTION_READ; MaxMessageSize: PULONG;
8692     ConnectData: PVOID; ConnectDataLength: PULONG): NTSTATUS; stdcall;
8693   TFNNtSendWaitReplyChannel = function (x: PVOID; y: PVOID; z: PVOID; z2: PVOID): NTSTATUS; stdcall;
8694   TFNNtSetContextChannel = function (x: PVOID): NTSTATUS; stdcall;
8695   TFNNtSetContextThread = function (ThreadHandle: HANDLE; Context: PCONTEXT): NTSTATUS; stdcall;
8696   TFNNtSetDefaultHardErrorPort = function (PortHandle: HANDLE): NTSTATUS; stdcall;
8697   TFNNtSetDefaultLocale = function (ThreadOrSystem: BOOLEAN; Locale: LCID): NTSTATUS; stdcall;
8698   TFNNtSetDefaultUILanguage = function (LanguageId: LANGID): NTSTATUS; stdcall;
8699   TFNNtSetEaFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_FULL_EA_INFORMATION; BufferLength: ULONG): NTSTATUS; stdcall;
8700   TFNNtSetEvent = function (EventHandle: HANDLE; PreviousState: PULONG): NTSTATUS; stdcall;
8701   TFNNtSetHighEventPair = function (EventPairHandle: HANDLE): NTSTATUS; stdcall;
8702   TFNNtSetHighWaitLowEventPair = function (EventPairHandle: HANDLE): NTSTATUS; stdcall;
8703   TFNNtSetHighWaitLowThread = function (): NTSTATUS; stdcall;
8704   TFNNtSetInformationFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; FileInformation: PVOID; FileInformationLength: ULONG; FileInformationClass: FILE_INFORMATION_CLASS): NTSTATUS; stdcall;
8705   TFNNtSetInformationJobObject = function (JobHandle: HANDLE; JobInformationClass: JOBOBJECTINFOCLASS; JobInformation: PVOID; JobInformationLength: ULONG): NTSTATUS; stdcall;
8706   TFNNtSetInformationKey = function (KeyHandle: HANDLE; KeyInformationClass: KEY_SET_INFORMATION_CLASS; KeyInformation: PVOID; KeyInformationLength: ULONG): NTSTATUS; stdcall;
8707   TFNNtSetInformationObject = function (ObjectHandle: HANDLE; ObjectInformationClass: OBJECT_INFORMATION_CLASS; ObjectInformation: PVOID; ObjectInformationLength: ULONG): NTSTATUS; stdcall;
8708   TFNNtSetInformationProcess = function (ProcessHandle: HANDLE; ProcessInformationClass: PROCESSINFOCLASS; ProcessInformation: PVOID; ProcessInformationLength: ULONG): NTSTATUS; stdcall;
8709   TFNNtSetInformationThread = function (ThreadHandle: HANDLE; ThreadInformationClass: THREADINFOCLASS; ThreadInformation: PVOID; ThreadInformationLength: ULONG): NTSTATUS; stdcall;
8710   TFNNtSetInformationToken = function (TokenHandle: HANDLE; TokenInformationClass: TOKEN_INFORMATION_CLASS; TokenInformation: PVOID; TokenInformationLength: ULONG): NTSTATUS; stdcall;
8711   TFNNtSetIntervalProfile = function (Interval: ULONG; Source: KPROFILE_SOURCE): NTSTATUS; stdcall;
8712   TFNNtSetIoCompletion = function (IoCompletionHandle: HANDLE; CompletionKey: ULONG; CompletionValue: ULONG; Status: NTSTATUS; Information: ULONG): NTSTATUS; stdcall;
8713   TFNNtSetLdtEntries = function (Selector1: ULONG; LdtEntry1: LDT_ENTRY; Selector2: ULONG; LdtEntry2: LDT_ENTRY): NTSTATUS; stdcall;
8714   TFNNtSetLowEventPair = function (EventPairHandle: HANDLE): NTSTATUS; stdcall;
8715   TFNNtSetLowWaitHighEventPair = function (EventPairHandle: HANDLE): NTSTATUS; stdcall;
8716   TFNNtSetLowWaitHighThread = function (): NTSTATUS; stdcall;
8717   TFNNtSetQuotaInformationFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_USER_QUOTA_INFORMATION; BufferLength: ULONG): NTSTATUS; stdcall;
8718   TFNNtSetSecurityObject = function (Handle: HANDLE; SecurityInformation: SECURITY_INFORMATION; SecurityDescriptor: PSECURITY_DESCRIPTOR): NTSTATUS; stdcall;
8719   TFNNtSetSystemEnvironmentValue = function (Name: PUNICODE_STRING; Value: PUNICODE_STRING): NTSTATUS; stdcall;
8720   TFNNtSetSystemInformation = function (SystemInformationClass: SYSTEM_INFORMATION_CLASS; SystemInformation: PVOID; SystemInformationLength: ULONG): NTSTATUS; stdcall;
8721   TFNNtSetSystemPowerState = function (SystemAction: POWER_ACTION; MinSystemState: SYSTEM_POWER_STATE; Flags: ULONG): NTSTATUS; stdcall;
8722   TFNNtSetSystemTime = function (NewTime: PLARGE_INTEGER; OldTime: PLARGE_INTEGER): NTSTATUS; stdcall;
8723   TFNNtSetThreadExecutionState = function (ExecutionState: EXECUTION_STATE; PreviousExecutionState: PEXECUTION_STATE): NTSTATUS; stdcall;
8724   TFNNtSetTimer = function (TimerHandle: HANDLE; DueTime: PLARGE_INTEGER; TimerApcRoutine: PTIMER_APC_ROUTINE; TimerContext: PVOID; Resume: BOOLEAN; Period: LONG; PreviousState: PBOOLEAN): NTSTATUS; stdcall;
8725   TFNNtSetTimerResolution = function (RequestedResolution: ULONG; Set_: BOOLEAN; ActualResolution: PULONG): NTSTATUS; stdcall;
8726   TFNNtSetUuidSeed = function (UuidSeed: PUCHAR): NTSTATUS; stdcall;
8727   TFNNtSetValueKey = function (KeyHandle: HANDLE; ValueName: PUNICODE_STRING; TitleIndex: ULONG; Type_: ULONG; Data: PVOID; DataSize: ULONG): NTSTATUS; stdcall;
8728   TFNNtSetVolumeInformationFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PVOID; BufferLength: ULONG; VolumeInformationClass: FS_INFORMATION_CLASS): NTSTATUS; stdcall;
8729   TFNNtShutdownSystem = function (Action: SHUTDOWN_ACTION): NTSTATUS; stdcall;
8730   TFNNtSignalAndWaitForSingleObject = function (HandleToSignal: HANDLE; HandleToWait: HANDLE; Alertable: BOOLEAN; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8731   TFNNtStartProfile = function (ProfileHandle: HANDLE): NTSTATUS; stdcall;
8732   TFNNtStopProfile = function (ProfileHandle: HANDLE): NTSTATUS; stdcall;
8733   TFNNtSuspendProcess = function (hProcess: HANDLE): NTSTATUS; stdcall;
8734   TFNNtSuspendThread = function (hThread: HANDLE; dwLastResumeCount: PULONG): NTSTATUS; stdcall;
8735   TFNNtSystemDebugControl = function (ControlCode: DEBUG_CONTROL_CODE; InputBuffer: PVOID; InputBufferLength: ULONG; OutputBuffer: PVOID; OutputBufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8736   TFNNtTerminateJobObject = function (JobHandle: HANDLE; ExitStatus: NTSTATUS): NTSTATUS; stdcall;
8737   TFNNtTerminateProcess = function (ProcessHandle: HANDLE; ExitStatus: NTSTATUS): NTSTATUS; stdcall;
8738   TFNNtTerminateThread = function (ThreadHandle: HANDLE; ExitStatus: NTSTATUS): NTSTATUS; stdcall;
8739   TFNNtTestAlert = function (): NTSTATUS; stdcall;
8740   TFNNtUnloadDriver = function (DriverServiceName: PUNICODE_STRING): NTSTATUS; stdcall;
8741   TFNNtUnloadKey = function (KeyObjectAttributes: POBJECT_ATTRIBUTES): NTSTATUS; stdcall;
8742   TFNNtUnlockFile = function (FileHandle: HANDLE; IoStatusBlock: PIO_STATUS_BLOCK; LockOffset: PULARGE_INTEGER; LockLength: PULARGE_INTEGER; Key: ULONG): NTSTATUS; stdcall;
8743   TFNNtUnlockVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PPVOID; LockSize: PULONG; LockType: ULONG): NTSTATUS; stdcall;
8744   TFNNtUnmapViewOfSection = function (ProcessHandle: HANDLE; BaseAddress: PVOID): NTSTATUS; stdcall;
8745   TFNNtVdmControl = function (ControlCode: ULONG; ControlData: PVOID): NTSTATUS; stdcall;
8746   TFNNtW32Call = function (RoutineIndex: ULONG; Argument: PVOID; ArgumentLength: ULONG; Result_: PPVOID; ResultLength: PULONG): NTSTATUS; stdcall;
8747   TFNNtWaitForMultipleObjects = function (HandleCount: ULONG; Handles: PHANDLE; WaitType: WAIT_TYPE; Alertable: BOOLEAN; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8748   TFNNtWaitForSingleObject = function (Handle: HANDLE; Alertable: BOOLEAN; Timeout: PLARGE_INTEGER): NTSTATUS; stdcall;
8749   TFNNtWaitHighEventPair = function (EventPairHandle: HANDLE): NTSTATUS; stdcall;
8750   TFNNtWaitLowEventPair = function (EventPairHandle: HANDLE): NTSTATUS; stdcall;
8751   TFNNtWriteFile = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PVOID; Length: ULONG; ByteOffset: PLARGE_INTEGER; Key: PULONG): NTSTATUS; stdcall;
8752   TFNNtWriteFileGather = function (FileHandle: HANDLE; Event: HANDLE; ApcRoutine: PIO_APC_ROUTINE; ApcContext: PVOID; IoStatusBlock: PIO_STATUS_BLOCK; Buffer: PFILE_SEGMENT_ELEMENT; Length: ULONG; ByteOffset: PLARGE_INTEGER;
8753     Key: PULONG): NTSTATUS; stdcall;
8754   TFNNtWriteRequestData = function (PortHandle: HANDLE; Message: PPORT_MESSAGE; Index: ULONG; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8755   TFNNtWriteVirtualMemory = function (ProcessHandle: HANDLE; BaseAddress: PVOID; Buffer: PVOID; BufferLength: ULONG; ReturnLength: PULONG): NTSTATUS; stdcall;
8756   TFNNtYieldExecution = function (): NTSTATUS; stdcall;
8757   TFNRtlAbsoluteToSelfRelativeSD = function (pAbsoluteSD: PSECURITY_DESCRIPTOR; pSelfRelativeSD: PSECURITY_DESCRIPTOR; lpdwBufferLength: LPDWORD): NTSTATUS; stdcall;
8758   TFNRtlAcquirePebLock = procedure(); stdcall;
8759   TFNRtlAddAccessAllowedAce = function (pAcl: PACL; dwAceRevision: DWORD; AccessMask: ACCESS_MASK; pSid: PSID): NTSTATUS; stdcall;
8760   TFNRtlAddAccessAllowedAceEx = function (pAcl: PACL; dwAceRevision: DWORD; AceFlags: DWORD; AccessMask: ACCESS_MASK; pSid: PSID): NTSTATUS; stdcall;
8761   TFNRtlAddAccessDeniedAce = function (pAcl: PACL; dwAceRevision: DWORD; AccessMask: ACCESS_MASK; pSid: PSID): NTSTATUS; stdcall;
8762   TFNRtlAddAccessDeniedAceEx = function (pAcl: PACL; dwAceRevision: DWORD; AceFlags: DWORD; AccessMask: ACCESS_MASK; pSid: PSID): NTSTATUS; stdcall;
8763   TFNRtlAddAce = function (pAcl: PACL; dwAceRevision: DWORD; dwStartingAceIndex: DWORD; pAceList: PVOID; nAceListLength: DWORD): NTSTATUS; stdcall;
8764   TFNRtlAddAuditAccessAce = function (pAcl: PACL; dwAceRevision: DWORD; AccessMask: ACCESS_MASK; pSid: PSID; bAuditSuccess: BOOLEAN; bAuditFailure: BOOLEAN): NTSTATUS; stdcall;
8765   TFNRtlAddAuditAccessAceEx = function (pAcl: PACL; dwAceRevision: DWORD; AceFlags: DWORD; AccessMask: ACCESS_MASK; pSid: PSID; bAuditSuccess: BOOLEAN; bAuditFailure: BOOLEAN): NTSTATUS; stdcall;
8766   TFNRtlAddRange = function (RangeList: PRTL_RANGE_LIST; Start: ULONGLONG; End_: ULONGLONG; Attributes: UCHAR; Flags: ULONG; UserData: PVOID; Owner: PVOID): NTSTATUS; stdcall;
8767   TFNRtlAddVectoredExceptionHandler = function (FirstHandler: ULONG; VectoredHandler: PVECTORED_EXCEPTION_HANDLER): PVOID; stdcall;
8768   TFNRtlAdjustPrivilege = function (Privilege: ULONG; Enable: BOOLEAN; CurrentThread: BOOLEAN; Enabled: PBOOLEAN): NTSTATUS; stdcall;
8769   TFNRtlAllocateAndInitializeSid = function (pIdentifierAuthority: PSID_IDENTIFIER_AUTHORITY; SubAuthorityCount: BYTE; nSubAuthority0: DWORD; nSubAuthority1: DWORD; nSubAuthority2: DWORD; nSubAuthority3: DWORD; nSubAuthority4: DWORD;
8770     nSubAuthority5: DWORD; nSubAuthority6: DWORD; nSubAuthority7: DWORD; var pSid: PSID): BOOL; stdcall;
8771   TFNRtlAllocateHeap = function (hHeap: HANDLE; dwFlags: ULONG; Size: ULONG): PVOID; stdcall;
8772   TFNRtlAnsiCharToUnicodeChar = function (AnsiChar: CHAR): WCHAR; stdcall;
8773   TFNRtlAnsiStringToUnicodeSize = function (AnsiString: PANSI_STRING): ULONG; stdcall;
8774   TFNRtlAnsiStringToUnicodeString = function (DestinationString: PUNICODE_STRING; SourceString: PANSI_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
8775   TFNRtlAppendAsciizToString = function (DestinationString: PSTRING; AppendThisString: LPCSTR): NTSTATUS; stdcall;
8776   TFNRtlAppendStringToString = function (DestinationString: PSTRING; AppendThisString: PSTRING): NTSTATUS; stdcall;
8777   TFNRtlAppendUnicodeStringToString = function (DestinationString: PUNICODE_STRING; SourceString: PUNICODE_STRING): NTSTATUS; stdcall;
8778   TFNRtlAppendUnicodeToString = function (Destination: PUNICODE_STRING; Source: LPCWSTR): NTSTATUS; stdcall;
8779   TFNRtlAreAllAccessesGranted = function (GrantedAccess: ACCESS_MASK; WantedAccess: ACCESS_MASK): BOOLEAN; stdcall;
8780   TFNRtlAreAnyAccessesGranted = function (GrantedAccess: ACCESS_MASK; WantedAccess: ACCESS_MASK): BOOLEAN; stdcall;
8781   TFNRtlAreBitsClear = function (BitMapHeader: PRTL_BITMAP; StartingIndex: ULONG; Length: ULONG): BOOLEAN; stdcall;
8782   TFNRtlAreBitsSet = function (BitMapHeader: PRTL_BITMAP; StartingIndex: ULONG; Length: ULONG): BOOLEAN; stdcall;
8783   TFNRtlAssert = procedure(FailedAssertion: PVOID; FileName: PVOID; LineNumber: ULONG; Message: PCHAR); stdcall;
8784   TFNRtlCaptureContext = procedure(ContextRecord: PCONTEXT); stdcall;
8785   TFNRtlCharToInteger = function (Str: PCSZ; Base: ULONG; Value: PULONG): NTSTATUS; stdcall;
8786   TFNRtlCheckForOrphanedCriticalSections = procedure(hThread: HANDLE); stdcall;
8787   TFNRtlCheckRegistryKey = function (RelativeTo: ULONG; Path: PWSTR): NTSTATUS; stdcall;
8788   TFNRtlClearAllBits = procedure(BitMapHeader: PRTL_BITMAP); stdcall;
8789   TFNRtlClearBits = procedure(BitMapHeader: PRTL_BITMAP; StartingIndex: ULONG; NumberToClear: ULONG); stdcall;
8790   TFNRtlCompactHeap = function (hHeap: HANDLE; dwFlags: ULONG): ULONG; stdcall;
8791   TFNRtlCompareMemory = function (Source1: PVOID; Source2: PVOID; Length: SIZE_T): SIZE_T; stdcall;
8792   TFNRtlCompareMemoryUlong = function (Source: PVOID; Length: ULONG; Value: ULONG): ULONG; stdcall;
8793   TFNRtlCompareString = function (String1: PSTRING; String2: PSTRING; CaseInsensitive: BOOLEAN): LONG; stdcall;
8794   TFNRtlCompareUnicodeString = function (String1: PUNICODE_STRING; String2: PUNICODE_STRING; CaseInsensitive: BOOLEAN): LONG; stdcall;
8795   TFNRtlConvertLongToLargeInteger = function (SignedInteger: LONG): LARGE_INTEGER; stdcall;
8796   TFNRtlConvertSidToUnicodeString = function (UnicodeString: PUNICODE_STRING; Sid: PSID; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
8797   TFNRtlConvertUlongToLargeInteger = function (UnsignedInteger: ULONG): LARGE_INTEGER; stdcall;
8798   TFNRtlCopyLuid = procedure(Destination: PLUID; Source: PLUID); stdcall;
8799   TFNRtlCopyRangeList = function (CopyRangeList: PRTL_RANGE_LIST; RangeList: PRTL_RANGE_LIST): NTSTATUS; stdcall;
8800   TFNRtlCopySecurityDescriptor = function (Source: PSECURITY_DESCRIPTOR; var Destination: PSECURITY_DESCRIPTOR): NTSTATUS; stdcall;
8801   TFNRtlCopySid = function (DestinationLength: ULONG; Destination: PSID; Source: PSID): NTSTATUS; stdcall;
8802   TFNRtlCopyString = procedure(DestinationString: PSTRING; SourceString: PSTRING); stdcall;
8803   TFNRtlCopyUnicodeString = procedure(DestinationString: PUNICODE_STRING; SourceString: PUNICODE_STRING); stdcall;
8804   TFNRtlCreateAcl = function (pAcl: PACL; nAclLength: DWORD; dwAclRevision: DWORD): NTSTATUS; stdcall;
8805   TFNRtlCreateHeap = function (dwOptions: ULONG; Base: PVOID; dwMaximumSize: SIZE_T; dwInitialSize: SIZE_T; UnknownOptional1: PVOID; UnknownOptional2: PVOID): HANDLE; stdcall;
8806   TFNRtlCreateProcessParameters = function (ProcessParameters: PPRTL_USER_PROCESS_PARAMETERS; ImageFile: PUNICODE_STRING; DllPath: PUNICODE_STRING; CurrentDirectory: PUNICODE_STRING; CommandLine: PUNICODE_STRING; CreationFlags: ULONG;
8807     WindowTitle: PUNICODE_STRING; Desktop: PUNICODE_STRING; Reserved: PUNICODE_STRING; Reserved2: PUNICODE_STRING): NTSTATUS; stdcall;
8808   TFNRtlCreateQueryDebugBuffer = function (Size: ULONG; EventPair: BOOLEAN): PDEBUG_BUFFER; stdcall;
8809   TFNRtlCreateRegistryKey = function (RelativeTo: ULONG; Path: PWSTR): NTSTATUS; stdcall;
8810   TFNRtlCreateSecurityDescriptor = function (SecurityDescriptor: PSECURITY_DESCRIPTOR; Revision: ULONG): NTSTATUS; stdcall;
8811   TFNRtlCreateUnicodeString = function (DestinationString: PUNICODE_STRING; SourceString: PWSTR): BOOLEAN; stdcall;
8812   TFNRtlCreateUnicodeStringFromAsciiz = function (DestinationString: PUNICODE_STRING; SourceString: PCHAR): BOOLEAN; stdcall;
8813   TFNRtlCreateUserProcess = function (ImageFileName: PUNICODE_STRING; Attributes: ULONG; ProcessParameters: PRTL_USER_PROCESS_PARAMETERS; ProcessSecurityDescriptor: PSECURITY_DESCRIPTOR; ThreadSecurityDescriptor: PSECURITY_DESCRIPTOR;
8814     ParentProcess: HANDLE; InheritHandles: BOOLEAN; DebugPort: HANDLE; ExceptionPort: HANDLE; ProcessInfo: PRTL_PROCESS_INFORMATION): NTSTATUS; stdcall;
8815   TFNRtlCreateUserThread = function (hProcess: HANDLE; SecurityDescriptor: PSECURITY_DESCRIPTOR; CreateSuspended: BOOLEAN; StackZeroBits: ULONG; StackReserve: ULONG; StackCommit: ULONG; lpStartAddress: PTHREAD_START_ROUTINE;
8816     lpParameter: PVOID; phThread: PHANDLE; ClientId: PCLIENT_ID): NTSTATUS; stdcall;
8817   TFNRtlCutoverTimeToSystemTime = function (TargetTimeFields: PTIME_FIELDS; Time: PLARGE_INTEGER; CurrentTime: PLARGE_INTEGER; bUnknown: BOOLEAN): BOOLEAN; stdcall;
8818   TFNRtlDeNormalizeProcessParams = function (ProcessParameters: PRTL_USER_PROCESS_PARAMETERS): PRTL_USER_PROCESS_PARAMETERS; stdcall;
8819   TFNRtlDeleteAce = function (pAcl: PACL; dwAceIndex: DWORD): NTSTATUS; stdcall;
8820   TFNRtlDeleteCriticalSection = procedure(lpCriticalSection: PRTL_CRITICAL_SECTION); stdcall;
8821   TFNRtlDeleteOwnersRanges = function (RangeList: PRTL_RANGE_LIST; Owner: PVOID): NTSTATUS; stdcall;
8822   TFNRtlDeleteRange = function (RangeList: PRTL_RANGE_LIST; Start: ULONGLONG; End_: ULONGLONG; Owner: PVOID): NTSTATUS; stdcall;
8823   TFNRtlDeleteRegistryValue = function (RelativeTo: ULONG; Path: LPCWSTR; ValueName: LPCWSTR): NTSTATUS; stdcall;
8824   TFNRtlDestroyHeap = function (HeapHandle: HANDLE): HANDLE; stdcall;
8825   TFNRtlDestroyProcessParameters = function (ProcessParameters: PRTL_USER_PROCESS_PARAMETERS): NTSTATUS; stdcall;
8826   TFNRtlDestroyQueryDebugBuffer = function (DebugBuffer: PDEBUG_BUFFER): NTSTATUS; stdcall;
8827   TFNRtlDetermineDosPathNameType_U = function (wcsPathNameType: PWSTR): ULONG; stdcall;
8828   TFNRtlDnsHostNameToComputerName = function (ComputerName: PUNICODE_STRING; DnsName: PUNICODE_STRING; AllocateComputerNameString: BOOLEAN): NTSTATUS; stdcall;
8829   TFNRtlDoesFileExists_U = function (FileName: PWSTR): BOOLEAN; stdcall;
8830   TFNRtlDosPathNameToNtPathName_U = function (DosName: PWSTR; var NtName: UNICODE_STRING; DosFilePath: PPWSTR; NtFilePath: PUNICODE_STRING): BOOLEAN; stdcall;
8831   TFNRtlDosSearchPath_U = function (SearchPath: PWSTR; Name: PWSTR; Ext: PWSTR; cbBuf: ULONG; Buffer: PWSTR; var Shortname: PWSTR): ULONG; stdcall;
8832   TFNRtlDowncaseUnicodeChar = function (Source: WCHAR): WCHAR; stdcall;
8833   TFNRtlDowncaseUnicodeString = function (DestinationString: PUNICODE_STRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
8834   TFNRtlDuplicateUnicodeString = function (AddTerminatingZero: ULONG; Source: PUNICODE_STRING; Destination: PUNICODE_STRING): NTSTATUS; stdcall;
8835   TFNRtlEnableEarlyCriticalSectionEventCreation = procedure(); stdcall;
8836   TFNRtlEnlargedIntegerMultiply = function (Multiplicand: LONG; Multiplier: LONG): LARGE_INTEGER; stdcall;
8837   TFNRtlEnlargedUnsignedDivide = function (Dividend: ULARGE_INTEGER; Divisor: ULONG; Remainder: PULONG): ULONG; stdcall;
8838   TFNRtlEnlargedUnsignedMultiply = function (Multiplicand: ULONG; Multiplier: ULONG): LARGE_INTEGER; stdcall;
8839   TFNRtlEnterCriticalSection = procedure(lpCriticalSection: PRTL_CRITICAL_SECTION); stdcall;
8840   TFNRtlEqualComputerName = function (String1: PUNICODE_STRING; String2: PUNICODE_STRING): BOOLEAN; stdcall;
8841   TFNRtlEqualDomainName = function (String1: PUNICODE_STRING; String2: PUNICODE_STRING): BOOLEAN; stdcall;
8842   TFNRtlEqualLuid = function (Luid1: PLUID; Luid2: PLUID): BOOLEAN; stdcall;
8843   TFNRtlEqualPrefixSid = function (pSid1: PSID; pSid2: PSID): BOOLEAN; stdcall;
8844   TFNRtlEqualSid = function (pSid1: PSID; pSid2: PSID): BOOLEAN; stdcall;
8845   TFNRtlEqualString = function (String1: PSTRING; String2: PSTRING; CaseInsensitive: BOOLEAN): BOOLEAN; stdcall;
8846   TFNRtlEqualUnicodeString = function (String1: PUNICODE_STRING; String2: PUNICODE_STRING; CaseInsensitive: BOOLEAN): BOOLEAN; stdcall;
8847   TFNRtlEraseUnicodeString = procedure(Str: PUNICODE_STRING); stdcall;
8848   TFNRtlExpandEnvironmentStrings_U = function (Environment: PVOID; Source: PUNICODE_STRING; Destination: PUNICODE_STRING; ReturnedLength: PULONG): NTSTATUS; stdcall;
8849   TFNRtlExtendedIntegerMultiply = function (Multiplicand: LARGE_INTEGER; Multiplier: LONG): LARGE_INTEGER; stdcall;
8850   TFNRtlExtendedLargeIntegerDivide = function (Dividend: LARGE_INTEGER; Divisor: ULONG; Remainder: PULONG): LARGE_INTEGER; stdcall;
8851   TFNRtlExtendedMagicDivide = function (Dividend: LARGE_INTEGER; MagicDivisor: LARGE_INTEGER; ShiftCount: CCHAR): LARGE_INTEGER; stdcall;
8852   TFNRtlFillMemory = procedure(Destination: PVOID; Length: SIZE_T; Fill: UCHAR); stdcall;
8853   TFNRtlFillMemoryUlong = procedure(Destination: PVOID; Length: ULONG; Fill: ULONG); stdcall;
8854   TFNRtlFindCharInUnicodeString = function (dwFlags: ULONG; UnicodeString: PUNICODE_STRING; CharactersToFind: PUNICODE_STRING; Positions: PUSHORT): NTSTATUS; stdcall;
8855   TFNRtlFindClearBits = function (BitMapHeader: PRTL_BITMAP; NumberToFind: ULONG; HintIndex: ULONG): ULONG; stdcall;
8856   TFNRtlFindClearBitsAndSet = function (BitMapHeader: PRTL_BITMAP; NumberToFind: ULONG; HintIndex: ULONG): ULONG; stdcall;
8857   TFNRtlFindLastBackwardRunClear = function (BitMapHeader: PRTL_BITMAP; FromIndex: ULONG; StartingRunIndex: PULONG): ULONG; stdcall;
8858   TFNRtlFindLeastSignificantBit = function (Set_: ULONGLONG): CCHAR; stdcall;
8859   TFNRtlFindLongestRunClear = function (BitMapHeader: PRTL_BITMAP; StartingIndex: PULONG): ULONG; stdcall;
8860   TFNRtlFindMostSignificantBit = function (Set_: ULONGLONG): CCHAR; stdcall;
8861   TFNRtlFindNextForwardRunClear = function (BitMapHeader: PRTL_BITMAP; FromIndex: ULONG; StartingRunIndex: PULONG): ULONG; stdcall;
8862   TFNRtlFindRange = function (RangeList: PRTL_RANGE_LIST; Minimum: ULONGLONG; Maximum: ULONGLONG; Length: ULONG; Alignment: ULONG; Flags: ULONG; AttributeAvailableMask: UCHAR; Context: PVOID; Callback: PRTL_CONFLICT_RANGE_CALLBACK;
8863     Start: PULONGLONG): NTSTATUS; stdcall;
8864   TFNRtlFindSetBits = function (BitMapHeader: PRTL_BITMAP; NumberToFind: ULONG; HintIndex: ULONG): ULONG; stdcall;
8865   TFNRtlFindSetBitsAndClear = function (BitMapHeader: PRTL_BITMAP; NumberToFind: ULONG; HintIndex: ULONG): ULONG; stdcall;
8866   TFNRtlFirstFreeAce = function (pAcl: PACL; var pAce: PVOID): BOOLEAN; stdcall;
8867   TFNRtlFormatCurrentUserKeyPath = function (CurrentUserKeyPath: PUNICODE_STRING): NTSTATUS; stdcall;
8868   TFNRtlFreeAnsiString = procedure(AnsiString: PANSI_STRING); stdcall;
8869   TFNRtlFreeHeap = function (hHeap: HANDLE; dwFlags: ULONG; MemoryPointer: PVOID): BOOLEAN; stdcall;
8870   TFNRtlFreeOemString = procedure(OemString: POEM_STRING); stdcall;
8871   TFNRtlFreeRangeList = procedure(RangeList: PRTL_RANGE_LIST); stdcall;
8872   TFNRtlFreeSid = function (pSid: PSID): PVOID; stdcall;
8873   TFNRtlFreeUnicodeString = procedure(UnicodeString: PUNICODE_STRING); stdcall;
8874   TFNRtlGUIDFromString = function (GuidString: PUNICODE_STRING; Guid: LPGUID): NTSTATUS; stdcall;
8875   TFNRtlGetAce = function (pAcl: PACL; dwAceIndex: DWORD; var pAce: PVOID): NTSTATUS; stdcall;
8876   TFNRtlGetCallersAddress = procedure(CallersAddress: PPVOID; CallersCaller: PPVOID); stdcall;
8877   TFNRtlGetControlSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; var Control: SECURITY_DESCRIPTOR_CONTROL; var dwRevision: DWORD): NTSTATUS; stdcall;
8878   TFNRtlGetCurrentDirectory_U = function (MaximumLength: ULONG; Buffer: PWSTR): ULONG; stdcall;
8879   TFNRtlGetCurrentPeb = function (): PPEB; stdcall;
8880   TFNRtlGetDaclSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; var bDaclPresent: BOOLEAN; var Dacl: PACL; var bDaclDefaulted: BOOLEAN): NTSTATUS; stdcall;
8881   TFNRtlGetFirstRange = function (RangeList: PRTL_RANGE_LIST; Iterator: PRTL_RANGE_LIST_ITERATOR; var Range: PRTL_RANGE): NTSTATUS; stdcall;
8882   TFNRtlGetFullPathName_U = function (DosName: PWSTR; Size: ULONG; Buf: PWSTR; var Shortname: PWSTR): ULONG; stdcall;
8883   TFNRtlGetGroupSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; var pGroup: PSID; var bGroupDefaulted: BOOLEAN): NTSTATUS; stdcall;
8884   TFNRtlGetLastNtStatus = function (): NTSTATUS; stdcall;
8885   TFNRtlGetLongestNtPathLength = function (): ULONG; stdcall;
8886   TFNRtlGetNextRange = function (Iterator: PRTL_RANGE_LIST_ITERATOR; var Range: PRTL_RANGE; MoveForwards: BOOLEAN): NTSTATUS; stdcall;
8887   TFNRtlGetNtGlobalFlags = function (): ULONG; stdcall;
8888   TFNRtlGetNtProductType = function (var ProductType: ULONG): BOOLEAN; stdcall;
8889   TFNRtlGetNtVersionNumbers = procedure(var dwMajorVersion: ULONG; var dwMinorVersion: ULONG; UnknownCanBeNull: PDWORD); stdcall;
8890   TFNRtlGetOwnerSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; var pOwner: PSID; var OwnerDefaulted: BOOLEAN): NTSTATUS; stdcall;
8891   TFNRtlGetProcessHeaps = function (ArraySize: ULONG; HeapArray: PHANDLE): ULONG; stdcall;
8892   TFNRtlGetSaclSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; var bSaclPresent: BOOLEAN; var Sacl: PACL; var bSaclDefaulted: BOOLEAN): NTSTATUS; stdcall;
8893   TFNRtlGetVersion = function (lpVersionInformation: PRTL_OSVERSIONINFOW): NTSTATUS; stdcall;
8894   TFNRtlIdentifierAuthoritySid = function (Sid: PSID): PSID_IDENTIFIER_AUTHORITY; stdcall;
8895   TFNRtlImageDirectoryEntryToData = function (ImageBase: HMODULE; MappedAsImage: BOOLEAN; DirectoryEntry: USHORT; Size: PULONG): PVOID; stdcall;
8896   TFNRtlImageNtHeader = function (ImageBase: HMODULE): PIMAGE_NT_HEADERS; stdcall;
8897   TFNRtlImageNtHeaderEx = function (dwFlags: DWORD; ImageBase: HMODULE): PIMAGE_NT_HEADERS; stdcall;
8898   TFNRtlImageRvaToSection = function (NtHeaders: PIMAGE_NT_HEADERS; ImageBase: HMODULE; Rva: ULONG): PIMAGE_SECTION_HEADER; stdcall;
8899   TFNRtlImageRvaToVa = function (NtHeaders: PIMAGE_NT_HEADERS; ImageBase: HMODULE; Rva: ULONG; var LastRvaSection: PIMAGE_SECTION_HEADER): PVOID; stdcall;
8900   TFNRtlImpersonateSelf = function (ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL): NTSTATUS; stdcall;
8901   TFNRtlInitAnsiString = procedure(DestinationString: PANSI_STRING; SourceString: PCSZ); stdcall;
8902   TFNRtlInitAnsiStringEx = function (DestinationString: PANSI_STRING; SourceString: PCSZ): NTSTATUS; stdcall;
8903   TFNRtlInitString = procedure(DestinationString: PSTRING; SourceString: PCSZ); stdcall;
8904   TFNRtlInitUnicodeString = procedure(DestinationString: PUNICODE_STRING; SourceString: LPCWSTR); stdcall;
8905   TFNRtlInitUnicodeStringEx = function (DestinationString: PUNICODE_STRING; SourceString: LPCWSTR): NTSTATUS; stdcall;
8906   TFNRtlInitializeBitMap = procedure(BitMapHeader: PRTL_BITMAP; BitMapBuffer: PULONG; SizeOfBitMap: ULONG); stdcall;
8907   TFNRtlInitializeCriticalSection = function (lpCriticalSection: PRTL_CRITICAL_SECTION): NTSTATUS; stdcall;
8908   TFNRtlInitializeCriticalSectionAndSpinCount = function (lpCriticalSection: PRTL_CRITICAL_SECTION; dwSpinCount: ULONG): NTSTATUS; stdcall;
8909   TFNRtlInitializeRangeList = procedure(RangeList: PRTL_RANGE_LIST); stdcall;
8910   TFNRtlInitializeSListHead = procedure(ListHead: PSLIST_HEADER); stdcall;
8911   TFNRtlInitializeSid = function (pSid: PSID; pIdentifierAuthority: PSID_IDENTIFIER_AUTHORITY; nSubAuthorityCount: UCHAR): NTSTATUS; stdcall;
8912   TFNRtlInt64ToUnicodeString = function (Value: ULONGLONG; Base: ULONG; Str: PUNICODE_STRING): NTSTATUS; stdcall;
8913   TFNRtlIntegerToChar = function (Value: ULONG; Base: ULONG; Length: ULONG; Str: PCHAR): NTSTATUS; stdcall;
8914   TFNRtlIntegerToUnicodeString = function (Value: ULONG; Base: ULONG; Str: PUNICODE_STRING): NTSTATUS; stdcall;
8915   TFNRtlInterlockedFlushSList = function (ListHead: PSLIST_HEADER): PSLIST_ENTRY; stdcall;
8916   TFNRtlInterlockedPopEntrySList = function (ListHead: PSLIST_HEADER): PSLIST_ENTRY; stdcall;
8917   TFNRtlInterlockedPushEntrySList = function (ListHead: PSLIST_HEADER; ListEntry: PSLIST_ENTRY): PSLIST_ENTRY; stdcall;
8918   TFNRtlInvertRangeList = function (InvertedRangeList: PRTL_RANGE_LIST; RangeList: PRTL_RANGE_LIST): NTSTATUS; stdcall;
8919   TFNRtlIpv4AddressToStringA = function (IP: PULONG; Buffer: LPSTR): LPSTR; stdcall;
8920   TFNRtlIpv4AddressToStringW = function (IP: PULONG; Buffer: LPWSTR): LPWSTR; stdcall;
8921   TFNRtlIsDosDeviceName_U = function (TestString: LPCWSTR): ULONG; stdcall;
8922   TFNRtlIsNameLegalDOS8Dot3 = function (Name: PUNICODE_STRING; OemName: POEM_STRING; NameContainsSpaces: PBOOLEAN): BOOLEAN; stdcall;
8923   TFNRtlIsRangeAvailable = function (RangeList: PRTL_RANGE_LIST; Start: ULONGLONG; End_: ULONGLONG; Flags: ULONG; AttributeAvailableMask: UCHAR; Context: PVOID; Callback: PRTL_CONFLICT_RANGE_CALLBACK; Available: PBOOLEAN): NTSTATUS;
8924     stdcall;
8925   TFNRtlIsTextUnicode = function (lpBuffer: PVOID; cb: Integer; lpi: LPINT): BOOLEAN; stdcall;
8926   TFNRtlLargeIntegerAdd = function (Addend1: LARGE_INTEGER; Addend2: LARGE_INTEGER): LARGE_INTEGER; stdcall;
8927   TFNRtlLargeIntegerArithmeticShift = function (LargeInteger: LARGE_INTEGER; ShiftCount: CCHAR): LARGE_INTEGER; stdcall;
8928   TFNRtlLargeIntegerDivide = function (Dividend: LARGE_INTEGER; Divisor: LARGE_INTEGER; Remainder: PLARGE_INTEGER): LARGE_INTEGER; stdcall;
8929   TFNRtlLargeIntegerNegate = function (NegateThis: LARGE_INTEGER): LARGE_INTEGER; stdcall;
8930   TFNRtlLargeIntegerShiftLeft = function (LargeInteger: LARGE_INTEGER; ShiftCount: CCHAR): LARGE_INTEGER; stdcall;
8931   TFNRtlLargeIntegerShiftRight = function (LargeInteger: LARGE_INTEGER; ShiftCount: CCHAR): LARGE_INTEGER; stdcall;
8932   TFNRtlLargeIntegerSubtract = function (Number: LARGE_INTEGER; Subtrahend: LARGE_INTEGER): LARGE_INTEGER; stdcall;
8933   TFNRtlLargeIntegerToChar = function (Value: PLARGE_INTEGER; Base: ULONG; BufferLength: ULONG; Buffer: PCHAR): NTSTATUS; stdcall;
8934   TFNRtlLeaveCriticalSection = procedure(lpCriticalSection: PRTL_CRITICAL_SECTION); stdcall;
8935   TFNRtlLengthRequiredSid = function (nSubAuthorityCount: ULONG): ULONG; stdcall;
8936   TFNRtlLengthSecurityDescriptor = function (SecurityDescriptor: PSECURITY_DESCRIPTOR): ULONG; stdcall;
8937   TFNRtlLengthSid = function (pSid: PSID): ULONG; stdcall;
8938   TFNRtlLocalTimeToSystemTime = function (LocalTime: PLARGE_INTEGER; SystemTime: PLARGE_INTEGER): NTSTATUS; stdcall;
8939   TFNRtlLockHeap = function (hHeap: PVOID): BOOLEAN; stdcall;
8940   TFNRtlMakeSelfRelativeSD = function (pAbsoluteSD: PSECURITY_DESCRIPTOR; pSelfRelativeSD: PSECURITY_DESCRIPTOR; lpdwBufferLength: LPDWORD): NTSTATUS; stdcall;
8941   TFNRtlMapGenericMask = procedure(AccessMask: PACCESS_MASK; GenericMapping: PGENERIC_MAPPING); stdcall;
8942   TFNRtlMapSecurityErrorToNtStatus = function (SecurityError: DWORD): NTSTATUS; stdcall;
8943   TFNRtlMergeRangeLists = function (MergedRangeList: PRTL_RANGE_LIST; RangeList1: PRTL_RANGE_LIST; RangeList2: PRTL_RANGE_LIST; Flags: ULONG): NTSTATUS; stdcall;
8944   TFNRtlMoveMemory = procedure(Destination: PVOID; Source: PVOID; Length: SIZE_T); stdcall;
8945   TFNRtlNormalizeProcessParams = function (ProcessParameters: PRTL_USER_PROCESS_PARAMETERS): PRTL_USER_PROCESS_PARAMETERS; stdcall;
8946   TFNRtlNtStatusToDosError = function (Status: NTSTATUS): ULONG; stdcall;
8947   TFNRtlNtStatusToDosErrorNoTeb = function (Status: NTSTATUS): ULONG; stdcall;
8948   TFNRtlNumberOfClearBits = function (BitMapHeader: PRTL_BITMAP): ULONG; stdcall;
8949   TFNRtlNumberOfSetBits = function (BitMapHeader: PRTL_BITMAP): ULONG; stdcall;
8950   TFNRtlOemStringToUnicodeSize = function (AnsiString: POEM_STRING): ULONG; stdcall;
8951   TFNRtlOemStringToUnicodeString = function (DestinationString: PUNICODE_STRING; SourceString: POEM_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
8952   TFNRtlOemToUnicodeN = function (UnicodeString: PWSTR; UnicodeSize: ULONG; var ResultSize: ULONG; OemString: PCHAR; OemSize: ULONG): NTSTATUS; stdcall;
8953   TFNRtlOpenCurrentUser = function (samDesired: ACCESS_MASK; phkResult: PHKEY): NTSTATUS; stdcall;
8954   TFNRtlPrefixString = function (String1: PANSI_STRING; String2: PANSI_STRING; CaseInsensitive: BOOLEAN): BOOLEAN; stdcall;
8955   TFNRtlPrefixUnicodeString = function (String1: PUNICODE_STRING; String2: PUNICODE_STRING; CaseInsensitive: BOOLEAN): BOOLEAN; stdcall;
8956   TFNRtlQueryDepthSList = function (ListHead: PSLIST_HEADER): USHORT; stdcall;
8957   TFNRtlQueryEnvironmentVariable_U = function (Environment: PVOID; VarName: PUNICODE_STRING; VarValue: PUNICODE_STRING): NTSTATUS; stdcall;
8958   TFNRtlQueryInformationAcl = function (pAcl: PACL; pAclInformation: PVOID; nAclInformationLength: DWORD; dwAclInformationClass: ACL_INFORMATION_CLASS): NTSTATUS; stdcall;
8959   TFNRtlQueryProcessDebugInformation = function (ProcessId: ULONG; DebugInfoClassMask: ULONG; DebugBuffer: PDEBUG_BUFFER): NTSTATUS; stdcall;
8960   TFNRtlQueryRegistryValues = function (RelativeTo: ULONG; Path: LPCWSTR; QueryTable: PRTL_QUERY_REGISTRY_TABLE; Context: PVOID; Environment: PVOID): NTSTATUS; stdcall;
8961   TFNRtlRaiseStatus = procedure(Status: NTSTATUS); stdcall;
8962   TFNRtlRandom = function (Seed: PULONG): ULONG; stdcall;
8963   TFNRtlRandomEx = function (Seed: PULONG): ULONG; stdcall;
8964   TFNRtlReAllocateHeap = function (hHeap: HANDLE; dwFlags: ULONG; lpMem: PVOID; dwBytes: SIZE_T): PVOID; stdcall;
8965   TFNRtlReleasePebLock = procedure(); stdcall;
8966   TFNRtlRemoveVectoredExceptionHandler = function (VectoredHandlerHandle: PVOID): ULONG; stdcall;
8967   TFNRtlRestoreLastWin32Error = procedure(dwErrCode: DWORD); stdcall;
8968   TFNRtlRunDecodeUnicodeString = procedure(CodeSeed: UCHAR; StringToDecode: PUNICODE_STRING); stdcall;
8969   TFNRtlRunEncodeUnicodeString = procedure(var CodeSeed: UCHAR; StringToEncode: PUNICODE_STRING); stdcall;
8970   TFNRtlSecondsSince1970ToTime = procedure(SecondsSince1970: ULONG; Time: PLARGE_INTEGER); stdcall;
8971   TFNRtlSecondsSince1980ToTime = procedure(SecondsSince1980: ULONG; Time: PLARGE_INTEGER); stdcall;
8972   TFNRtlSelfRelativeToAbsoluteSD = function (pSelfRelativeSD: PSECURITY_DESCRIPTOR; pAbsoluteSD: PSECURITY_DESCRIPTOR; lpdwAbsoluteSDSize: LPDWORD; pDacl: PACL; lpdwDaclSize: LPDWORD; pSacl: PACL; lpdwSaclSize: LPDWORD; pOwner: PSID;
8973     lpdwOwnerSize: LPDWORD; pPrimaryGroup: PSID; lpdwPrimaryGroupSize: LPDWORD): NTSTATUS; stdcall;
8974   TFNRtlSetAllBits = procedure(BitMapHeader: PRTL_BITMAP); stdcall;
8975   TFNRtlSetBits = procedure(BitMapHeader: PRTL_BITMAP; StartingIndex: ULONG; NumberToSet: ULONG); stdcall;
8976   TFNRtlSetControlSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; ControlBitsOfInterest: SECURITY_DESCRIPTOR_CONTROL; ControlBitsToSet: SECURITY_DESCRIPTOR_CONTROL): NTSTATUS; stdcall;
8977   TFNRtlSetCriticalSectionSpinCount = function (lpCriticalSection: PRTL_CRITICAL_SECTION; dwSpinCount: ULONG): DWORD; stdcall;
8978   TFNRtlSetCurrentDirectory_U = function (NewCurrentDirectory: PUNICODE_STRING): NTSTATUS; stdcall;
8979   TFNRtlSetDaclSecurityDescriptor = function (SecurityDescriptor: PSECURITY_DESCRIPTOR; DaclPresent: BOOLEAN; Dacl: PACL; DaclDefaulted: BOOLEAN): NTSTATUS; stdcall;
8980   TFNRtlSetGroupSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; pGroup: PSID; bGroupDefaulted: BOOLEAN): NTSTATUS; stdcall;
8981   TFNRtlSetInformationAcl = function (pAcl: PACL; pAclInformation: PVOID; nInformationLength: DWORD; dwAclInformationClass: ACL_INFORMATION_CLASS): NTSTATUS; stdcall;
8982   TFNRtlSetLastWin32ErrorAndNtStatusFromNtStatus = function (Status: NTSTATUS): ULONG; stdcall;
8983   TFNRtlSetOwnerSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; pOwner: PSID; bOwnerDefaulted: BOOLEAN): NTSTATUS; stdcall;
8984   TFNRtlSetProcessIsCritical = function (bIsCritical: BOOLEAN; pbOldIsCriticalValue: PBOOLEAN; bUnknownCanBeFalse: BOOLEAN): NTSTATUS; stdcall;
8985   TFNRtlSetSaclSecurityDescriptor = function (pSecurityDescriptor: PSECURITY_DESCRIPTOR; bSaclPresent: BOOLEAN; pSacl: PACL; SaclDefaulted: BOOLEAN): NTSTATUS; stdcall;
8986   TFNRtlSetThreadIsCritical = function (bIsCritical: BOOLEAN; pbOldIsCriticalValue: PBOOLEAN; bUnknownCanBeFalse: BOOLEAN): NTSTATUS; stdcall;
8987   TFNRtlSizeHeap = function (hHeap: HANDLE; dwFlags: ULONG; lpMem: PVOID): SIZE_T; stdcall;
8988   TFNRtlStringFromGUID = function (Guid: REFGUID; GuidString: PUNICODE_STRING): NTSTATUS; stdcall;
8989   TFNRtlSubAuthorityCountSid = function (pSid: PSID): PUCHAR; stdcall;
8990   TFNRtlSubAuthoritySid = function (pSid: PSID; nSubAuthority: DWORD): PDWORD; stdcall;
8991   TFNRtlSystemTimeToLocalTime = function (SystemTime: PLARGE_INTEGER; LocalTime: PLARGE_INTEGER): NTSTATUS; stdcall;
8992   TFNRtlTimeFieldsToTime = function (TimeFields: PTIME_FIELDS; Time: PLARGE_INTEGER): BOOLEAN; stdcall;
8993   TFNRtlTimeToElapsedTimeFields = procedure(Time: PLARGE_INTEGER; TimeFields: PTIME_FIELDS); stdcall;
8994   TFNRtlTimeToSecondsSince1970 = function (Time: PLARGE_INTEGER; ElapsedSeconds: PULONG): BOOLEAN; stdcall;
8995   TFNRtlTimeToSecondsSince1980 = function (Time: PLARGE_INTEGER; ElapsedSeconds: PULONG): BOOLEAN; stdcall;
8996   TFNRtlTimeToTimeFields = procedure(Time: PLARGE_INTEGER; TimeFields: PTIME_FIELDS); stdcall;
8997   TFNRtlTryEnterCriticalSection = function (lpCriticalSection: PRTL_CRITICAL_SECTION): BOOL; stdcall;
8998   TFNRtlUnicodeStringToAnsiSize = function (UnicodeString: PUNICODE_STRING): ULONG; stdcall;
8999   TFNRtlUnicodeStringToAnsiString = function (DestinationString: PANSI_STRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9000   TFNRtlUnicodeStringToCountedOemString = function (DestinationString: POEM_STRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9001   TFNRtlUnicodeStringToInteger = function (Str: PUNICODE_STRING; Base: ULONG; Value: PULONG): NTSTATUS; stdcall;
9002   TFNRtlUnicodeStringToOemSize = function (UnicodeString: PUNICODE_STRING): ULONG; stdcall;
9003   TFNRtlUnicodeStringToOemString = function (DestinationString: POEM_STRING; SourceString: PCUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9004   TFNRtlUnicodeToMultiByteSize = function (BytesInMultiByteString: PULONG; UnicodeString: PWSTR; BytesInUnicodeString: ULONG): NTSTATUS; stdcall;
9005   TFNRtlUniform = function (Seed: PULONG): ULONG; stdcall;
9006   TFNRtlUnwind = procedure(TargetFrame: PVOID; TargetIp: PVOID; ExceptionRecord: PEXCEPTION_RECORD; ReturnValue: PVOID); stdcall;
9007   TFNRtlUpcaseUnicodeChar = function (SourceCharacter: WCHAR): WCHAR; stdcall;
9008   TFNRtlUpcaseUnicodeString = function (DestinationString: PUNICODE_STRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9009   TFNRtlUpcaseUnicodeStringToAnsiString = function (DestinationString: PSTRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9010   TFNRtlUpcaseUnicodeStringToCountedOemString = function (DestinationString: PSTRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9011   TFNRtlUpcaseUnicodeStringToOemString = function (DestinationString: PSTRING; SourceString: PUNICODE_STRING; AllocateDestinationString: BOOLEAN): NTSTATUS; stdcall;
9012   TFNRtlUpcaseUnicodeToMultiByteN = function (MbString: PCHAR; MbSize: ULONG; var ResultSize: ULONG; UnicodeString: PWSTR; UnicodeSize: ULONG): NTSTATUS; stdcall;
9013   TFNRtlUpcaseUnicodeToOemN = function (OemString: PCHAR; OemSize: ULONG; var ResultSize: ULONG; UnicodeString: PWSTR; UnicodeSize: ULONG): NTSTATUS; stdcall;
9014   TFNRtlUpperChar = function (Character: CHAR): CHAR; stdcall;
9015   TFNRtlUpperString = procedure(DestinationString: PSTRING; SourceString: PSTRING); stdcall;
9016   TFNRtlValidAcl = function (Acl: PACL): BOOLEAN; stdcall;
9017   TFNRtlValidRelativeSecurityDescriptor = function (SecurityDescriptorInput: PSECURITY_DESCRIPTOR; SecurityDescriptorLength: ULONG; RequiredInformation: SECURITY_INFORMATION): BOOLEAN; stdcall;
9018   TFNRtlValidSecurityDescriptor = function (SecurityDescriptor: PSECURITY_DESCRIPTOR): BOOLEAN; stdcall;
9019   TFNRtlValidSid = function (pSid: PSID): BOOLEAN; stdcall;
9020   TFNRtlValidateHeap = function (hHeap: HANDLE; dwFlags: ULONG; lpMem: LPCVOID): BOOL; stdcall;
9021   TFNRtlValidateUnicodeString = function (dwMustBeNull: ULONG; ValidateThis: PUNICODE_STRING): NTSTATUS; stdcall;
9022   TFNRtlVerifyVersionInfo = function (VersionInfo: PRTL_OSVERSIONINFOEXW; TypeMask: ULONG; ConditionMask: ULONGLONG): NTSTATUS; stdcall;
9023   TFNRtlVolumeDeviceToDosName = function (VolumeDeviceObject: PVOID; DosName: PUNICODE_STRING): NTSTATUS; stdcall;
9024   TFNRtlWriteRegistryValue = function (RelativeTo: ULONG; Path: LPCWSTR; ValueName: LPCWSTR; ValueType: ULONG; ValueData: PVOID; ValueLength: ULONG): NTSTATUS; stdcall;
9025   TFNRtlZeroHeap = function (hHeap: HANDLE; dwFlags: ULONG): BOOLEAN; stdcall;
9026   TFNRtlZeroMemory = procedure(Destination: PVOID; Length: SIZE_T); stdcall;
9027   TFNRtlpNotOwnerCriticalSection = function (lpCriticalSection: PRTL_CRITICAL_SECTION): BOOLEAN; stdcall;
9028   TFNRtlpNtCreateKey = function (KeyHandle: PHANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; Unused1: ULONG; Unused2: ULONG; Disposition: PULONG): NTSTATUS; stdcall;
9029   TFNRtlpNtEnumerateSubKey = function (KeyHandle: HANDLE; SubKeyName: PUNICODE_STRING; Index: ULONG; Unused1: ULONG): NTSTATUS; stdcall;
9030   TFNRtlpNtMakeTemporaryKey = function (KeyHandle: HANDLE): NTSTATUS; stdcall;
9031   TFNRtlpNtOpenKey = function (KeyHandle: HANDLE; DesiredAccess: ACCESS_MASK; ObjectAttributes: POBJECT_ATTRIBUTES; Unused: ULONG): NTSTATUS; stdcall;
9032   TFNRtlpNtQueryValueKey = function (KeyHandle: HANDLE; Type_: PULONG; Data: PVOID; DataSize: PULONG; Unused: ULONG): NTSTATUS; stdcall;
9033   TFNRtlpNtSetValueKey = function (KeyHandle: HANDLE; Type_: ULONG; Data: PVOID; DataSize: ULONG): NTSTATUS; stdcall;
9034   TFNRtlxAnsiStringToUnicodeSize = function (AnsiString: PANSI_STRING): ULONG; stdcall;
9035   TFNRtlxOemStringToUnicodeSize = function (AnsiString: POEM_STRING): ULONG; stdcall;
9036   TFNRtlxUnicodeStringToAnsiSize = function (UnicodeString: PUNICODE_STRING): ULONG; stdcall;
9037   TFNRtlxUnicodeStringToOemSize = function (UnicodeString: PUNICODE_STRING): ULONG; stdcall;
9038   TFNVerSetConditionMask = function (ConditionMask: ULONGLONG; dwTypeMask: DWORD; Condition: BYTE): ULONGLONG; stdcall;
9039   TFNZwAcceptConnectPort = TFNNtAcceptConnectPort;
9040   TFNZwAccessCheck = TFNNtAccessCheck;
9041   TFNZwAccessCheckAndAuditAlarm = TFNNtAccessCheckAndAuditAlarm;
9042   TFNZwAccessCheckByType = TFNNtAccessCheckByType;
9043   TFNZwAccessCheckByTypeAndAuditAlarm = TFNNtAccessCheckByTypeAndAuditAlarm;
9044   TFNZwAccessCheckByTypeResultList = TFNNtAccessCheckByTypeResultList;
9045   TFNZwAccessCheckByTypeResultListAndAuditAlarm = TFNNtAccessCheckByTypeResultListAndAuditAlarm;
9046   TFNZwAccessCheckByTypeResultListAndAuditAlarmByHandle = TFNNtAccessCheckByTypeResultListAndAuditAlarmByHandle;
9047   TFNZwAddAtom = TFNNtAddAtom;
9048   TFNZwAdjustGroupsToken = TFNNtAdjustGroupsToken;
9049   TFNZwAdjustPrivilegesToken = TFNNtAdjustPrivilegesToken;
9050   TFNZwAlertResumeThread = TFNNtAlertResumeThread;
9051   TFNZwAlertThread = TFNNtAlertThread;
9052   TFNZwAllocateLocallyUniqueId = TFNNtAllocateLocallyUniqueId;
9053   TFNZwAllocateUserPhysicalPages = TFNNtAllocateUserPhysicalPages;
9054   TFNZwAllocateUuids = TFNNtAllocateUuids;
9055   TFNZwAllocateVirtualMemory = TFNNtAllocateVirtualMemory;
9056   TFNZwAreMappedFilesTheSame = TFNNtAreMappedFilesTheSame;
9057   TFNZwAssignProcessToJobObject = TFNNtAssignProcessToJobObject;
9058   TFNZwCallbackReturn = TFNNtCallbackReturn;
9059   TFNZwCancelDeviceWakeupRequest = TFNNtCancelDeviceWakeupRequest;
9060   TFNZwCancelIoFile = TFNNtCancelIoFile;
9061   TFNZwCancelTimer = TFNNtCancelTimer;
9062   TFNZwClearEvent = TFNNtClearEvent;
9063   TFNZwClose = TFNNtClose;
9064   TFNZwCloseObjectAuditAlarm = TFNNtCloseObjectAuditAlarm;
9065   TFNZwCompleteConnectPort = TFNNtCompleteConnectPort;
9066   TFNZwConnectPort = TFNNtConnectPort;
9067   TFNZwContinue = TFNNtContinue;
9068   TFNZwCreateChannel = TFNNtCreateChannel;
9069   TFNZwCreateDirectoryObject = TFNNtCreateDirectoryObject;
9070   TFNZwCreateEvent = TFNNtCreateEvent;
9071   TFNZwCreateEventPair = TFNNtCreateEventPair;
9072   TFNZwCreateFile = TFNNtCreateFile;
9073   TFNZwCreateIoCompletion = TFNNtCreateIoCompletion;
9074   TFNZwCreateJobObject = TFNNtCreateJobObject;
9075   TFNZwCreateKey = TFNNtCreateKey;
9076   TFNZwCreateMailslotFile = TFNNtCreateMailslotFile;
9077   TFNZwCreateMutant = TFNNtCreateMutant;
9078   TFNZwCreateNamedPipeFile = TFNNtCreateNamedPipeFile;
9079   TFNZwCreatePagingFile = TFNNtCreatePagingFile;
9080   TFNZwCreatePort = TFNNtCreatePort;
9081   TFNZwCreateProcess = TFNNtCreateProcess;
9082   TFNZwCreateProfile = TFNNtCreateProfile;
9083   TFNZwCreateSection = TFNNtCreateSection;
9084   TFNZwCreateSemaphore = TFNNtCreateSemaphore;
9085   TFNZwCreateSymbolicLinkObject = TFNNtCreateSymbolicLinkObject;
9086   TFNZwCreateThread = TFNNtCreateThread;
9087   TFNZwCreateTimer = TFNNtCreateTimer;
9088   TFNZwCreateToken = TFNNtCreateToken;
9089   TFNZwCreateWaitablePort = TFNNtCreateWaitablePort;
9090   TFNZwCurrentTeb = TFNNtCurrentTeb;
9091   TFNZwDebugActiveProcess = TFNNtDebugActiveProcess;
9092   TFNZwDelayExecution = TFNNtDelayExecution;
9093   TFNZwDeleteAtom = TFNNtDeleteAtom;
9094   TFNZwDeleteFile = TFNNtDeleteFile;
9095   TFNZwDeleteKey = TFNNtDeleteKey;
9096   TFNZwDeleteObjectAuditAlarm = TFNNtDeleteObjectAuditAlarm;
9097   TFNZwDeleteValueKey = TFNNtDeleteValueKey;
9098   TFNZwDeviceIoControlFile = TFNNtDeviceIoControlFile;
9099   TFNZwDisplayString = TFNNtDisplayString;
9100   TFNZwDuplicateObject = TFNNtDuplicateObject;
9101   TFNZwDuplicateToken = TFNNtDuplicateToken;
9102   TFNZwEnumerateKey = TFNNtEnumerateKey;
9103   TFNZwEnumerateValueKey = TFNNtEnumerateValueKey;
9104   TFNZwExtendSection = TFNNtExtendSection;
9105   TFNZwFilterToken = TFNNtFilterToken;
9106   TFNZwFindAtom = TFNNtFindAtom;
9107   TFNZwFlushBuffersFile = TFNNtFlushBuffersFile;
9108   TFNZwFlushInstructionCache = TFNNtFlushInstructionCache;
9109   TFNZwFlushKey = TFNNtFlushKey;
9110   TFNZwFlushVirtualMemory = TFNNtFlushVirtualMemory;
9111   TFNZwFlushWriteBuffer = TFNNtFlushWriteBuffer;
9112   TFNZwFreeUserPhysicalPages = TFNNtFreeUserPhysicalPages;
9113   TFNZwFreeVirtualMemory = TFNNtFreeVirtualMemory;
9114   TFNZwFsControlFile = TFNNtFsControlFile;
9115   TFNZwGetContextThread = TFNNtGetContextThread;
9116   TFNZwGetCurrentProcessorNumber = TFNNtGetCurrentProcessorNumber;
9117   TFNZwGetDevicePowerState = TFNNtGetDevicePowerState;
9118   TFNZwGetPlugPlayEvent = TFNNtGetPlugPlayEvent;
9119   TFNZwGetTickCount = TFNNtGetTickCount;
9120   TFNZwGetWriteWatch = TFNNtGetWriteWatch;
9121   TFNZwImpersonateAnonymousToken = TFNNtImpersonateAnonymousToken;
9122   TFNZwImpersonateClientOfPort = TFNNtImpersonateClientOfPort;
9123   TFNZwImpersonateThread = TFNNtImpersonateThread;
9124   TFNZwInitializeRegistry = TFNNtInitializeRegistry;
9125   TFNZwInitiatePowerAction = TFNNtInitiatePowerAction;
9126   TFNZwIsSystemResumeAutomatic = TFNNtIsSystemResumeAutomatic;
9127   TFNZwListenChannel = TFNNtListenChannel;
9128   TFNZwListenPort = TFNNtListenPort;
9129   TFNZwLoadDriver = TFNNtLoadDriver;
9130   TFNZwLoadKey = TFNNtLoadKey;
9131   TFNZwLoadKey2 = TFNNtLoadKey2;
9132   TFNZwLockFile = TFNNtLockFile;
9133   TFNZwLockVirtualMemory = TFNNtLockVirtualMemory;
9134   TFNZwMakePermanentObject = TFNNtMakePermanentObject;
9135   TFNZwMakeTemporaryObject = TFNNtMakeTemporaryObject;
9136   TFNZwMapUserPhysicalPages = TFNNtMapUserPhysicalPages;
9137   TFNZwMapUserPhysicalPagesScatter = TFNNtMapUserPhysicalPagesScatter;
9138   TFNZwMapViewOfSection = TFNNtMapViewOfSection;
9139   TFNZwNotifyChangeDirectoryFile = TFNNtNotifyChangeDirectoryFile;
9140   TFNZwNotifyChangeKey = TFNNtNotifyChangeKey;
9141   TFNZwNotifyChangeMultipleKeys = TFNNtNotifyChangeMultipleKeys;
9142   TFNZwOpenChannel = TFNNtOpenChannel;
9143   TFNZwOpenDirectoryObject = TFNNtOpenDirectoryObject;
9144   TFNZwOpenEvent = TFNNtOpenEvent;
9145   TFNZwOpenEventPair = TFNNtOpenEventPair;
9146   TFNZwOpenFile = TFNNtOpenFile;
9147   TFNZwOpenIoCompletion = TFNNtOpenIoCompletion;
9148   TFNZwOpenJobObject = TFNNtOpenJobObject;
9149   TFNZwOpenKey = TFNNtOpenKey;
9150   TFNZwOpenMutant = TFNNtOpenMutant;
9151   TFNZwOpenObjectAuditAlarm = TFNNtOpenObjectAuditAlarm;
9152   TFNZwOpenProcess = TFNNtOpenProcess;
9153   TFNZwOpenProcessToken = TFNNtOpenProcessToken;
9154   TFNZwOpenSection = TFNNtOpenSection;
9155   TFNZwOpenSemaphore = TFNNtOpenSemaphore;
9156   TFNZwOpenSymbolicLinkObject = TFNNtOpenSymbolicLinkObject;
9157   TFNZwOpenThread = TFNNtOpenThread;
9158   TFNZwOpenThreadToken = TFNNtOpenThreadToken;
9159   TFNZwOpenTimer = TFNNtOpenTimer;
9160   TFNZwPlugPlayControl = TFNNtPlugPlayControl;
9161   TFNZwPowerInformation = TFNNtPowerInformation;
9162   TFNZwPrivilegeCheck = TFNNtPrivilegeCheck;
9163   TFNZwPrivilegeObjectAuditAlarm = TFNNtPrivilegeObjectAuditAlarm;
9164   TFNZwPrivilegedServiceAuditAlarm = TFNNtPrivilegedServiceAuditAlarm;
9165   TFNZwProtectVirtualMemory = TFNNtProtectVirtualMemory;
9166   TFNZwPulseEvent = TFNNtPulseEvent;
9167   TFNZwQueryAttributesFile = TFNNtQueryAttributesFile;
9168   TFNZwQueryDefaultLocale = TFNNtQueryDefaultLocale;
9169   TFNZwQueryDefaultUILanguage = TFNNtQueryDefaultUILanguage;
9170   TFNZwQueryDirectoryFile = TFNNtQueryDirectoryFile;
9171   TFNZwQueryDirectoryObject = TFNNtQueryDirectoryObject;
9172   TFNZwQueryEaFile = TFNNtQueryEaFile;
9173   TFNZwQueryEvent = TFNNtQueryEvent;
9174   TFNZwQueryFullAttributesFile = TFNNtQueryFullAttributesFile;
9175   TFNZwQueryInformationAtom = TFNNtQueryInformationAtom;
9176   TFNZwQueryInformationFile = TFNNtQueryInformationFile;
9177   TFNZwQueryInformationJobObject = TFNNtQueryInformationJobObject;
9178   TFNZwQueryInformationPort = TFNNtQueryInformationPort;
9179   TFNZwQueryInformationProcess = TFNNtQueryInformationProcess;
9180   TFNZwQueryInformationThread = TFNNtQueryInformationThread;
9181   TFNZwQueryInformationToken = TFNNtQueryInformationToken;
9182   TFNZwQueryInstallUILanguage = TFNNtQueryInstallUILanguage;
9183   TFNZwQueryIntervalProfile = TFNNtQueryIntervalProfile;
9184   TFNZwQueryIoCompletion = TFNNtQueryIoCompletion;
9185   TFNZwQueryKey = TFNNtQueryKey;
9186   TFNZwQueryMultipleValueKey = TFNNtQueryMultipleValueKey;
9187   TFNZwQueryMutant = TFNNtQueryMutant;
9188   TFNZwQueryObject = TFNNtQueryObject;
9189   TFNZwQueryOpenSubKeys = TFNNtQueryOpenSubKeys;
9190   TFNZwQueryPerformanceCounter = TFNNtQueryPerformanceCounter;
9191   TFNZwQueryPortInformationProcess = TFNNtQueryPortInformationProcess;
9192   TFNZwQueryQuotaInformationFile = TFNNtQueryQuotaInformationFile;
9193   TFNZwQuerySection = TFNNtQuerySection;
9194   TFNZwQuerySecurityObject = TFNNtQuerySecurityObject;
9195   TFNZwQuerySemaphore = TFNNtQuerySemaphore;
9196   TFNZwQuerySymbolicLinkObject = TFNNtQuerySymbolicLinkObject;
9197   TFNZwQuerySystemEnvironmentValue = TFNNtQuerySystemEnvironmentValue;
9198   TFNZwQuerySystemInformation = TFNNtQuerySystemInformation;
9199   TFNZwQuerySystemTime = TFNNtQuerySystemTime;
9200   TFNZwQueryTimer = TFNNtQueryTimer;
9201   TFNZwQueryTimerResolution = TFNNtQueryTimerResolution;
9202   TFNZwQueryValueKey = TFNNtQueryValueKey;
9203   TFNZwQueryVirtualMemory = TFNNtQueryVirtualMemory;
9204   TFNZwQueryVolumeInformationFile = TFNNtQueryVolumeInformationFile;
9205   TFNZwQueueApcThread = TFNNtQueueApcThread;
9206   TFNZwRaiseException = TFNNtRaiseException;
9207   TFNZwRaiseHardError = TFNNtRaiseHardError;
9208   TFNZwReadFile = TFNNtReadFile;
9209   TFNZwReadFileScatter = TFNNtReadFileScatter;
9210   TFNZwReadRequestData = TFNNtReadRequestData;
9211   TFNZwReadVirtualMemory = TFNNtReadVirtualMemory;
9212   TFNZwRegisterThreadTerminatePort = TFNNtRegisterThreadTerminatePort;
9213   TFNZwReleaseMutant = TFNNtReleaseMutant;
9214   TFNZwReleaseSemaphore = TFNNtReleaseSemaphore;
9215   TFNZwRemoveIoCompletion = TFNNtRemoveIoCompletion;
9216   TFNZwRemoveProcessDebug = TFNNtRemoveProcessDebug;
9217   TFNZwReplaceKey = TFNNtReplaceKey;
9218   TFNZwReplyPort = TFNNtReplyPort;
9219   TFNZwReplyWaitReceivePort = TFNNtReplyWaitReceivePort;
9220   TFNZwReplyWaitReceivePortEx = TFNNtReplyWaitReceivePortEx;
9221   TFNZwReplyWaitReplyPort = TFNNtReplyWaitReplyPort;
9222   TFNZwReplyWaitSendChannel = TFNNtReplyWaitSendChannel;
9223   TFNZwRequestDeviceWakeup = TFNNtRequestDeviceWakeup;
9224   TFNZwRequestPort = TFNNtRequestPort;
9225   TFNZwRequestWaitReplyPort = TFNNtRequestWaitReplyPort;
9226   TFNZwRequestWakeupLatency = TFNNtRequestWakeupLatency;
9227   TFNZwResetEvent = TFNNtResetEvent;
9228   TFNZwResetWriteWatch = TFNNtResetWriteWatch;
9229   TFNZwRestoreKey = TFNNtRestoreKey;
9230   TFNZwResumeProcess = TFNNtResumeProcess;
9231   TFNZwResumeThread = TFNNtResumeThread;
9232   TFNZwSaveKey = TFNNtSaveKey;
9233   TFNZwSaveKeyEx = TFNNtSaveKeyEx;
9234   TFNZwSaveMergedKeys = TFNNtSaveMergedKeys;
9235   TFNZwSecureConnectPort = TFNNtSecureConnectPort;
9236   TFNZwSendWaitReplyChannel = TFNNtSendWaitReplyChannel;
9237   TFNZwSetContextChannel = TFNNtSetContextChannel;
9238   TFNZwSetContextThread = TFNNtSetContextThread;
9239   TFNZwSetDefaultHardErrorPort = TFNNtSetDefaultHardErrorPort;
9240   TFNZwSetDefaultLocale = TFNNtSetDefaultLocale;
9241   TFNZwSetDefaultUILanguage = TFNNtSetDefaultUILanguage;
9242   TFNZwSetEaFile = TFNNtSetEaFile;
9243   TFNZwSetEvent = TFNNtSetEvent;
9244   TFNZwSetHighEventPair = TFNNtSetHighEventPair;
9245   TFNZwSetHighWaitLowEventPair = TFNNtSetHighWaitLowEventPair;
9246   TFNZwSetHighWaitLowThread = TFNNtSetHighWaitLowThread;
9247   TFNZwSetInformationFile = TFNNtSetInformationFile;
9248   TFNZwSetInformationJobObject = TFNNtSetInformationJobObject;
9249   TFNZwSetInformationKey = TFNNtSetInformationKey;
9250   TFNZwSetInformationObject = TFNNtSetInformationObject;
9251   TFNZwSetInformationProcess = TFNNtSetInformationProcess;
9252   TFNZwSetInformationThread = TFNNtSetInformationThread;
9253   TFNZwSetInformationToken = TFNNtSetInformationToken;
9254   TFNZwSetIntervalProfile = TFNNtSetIntervalProfile;
9255   TFNZwSetIoCompletion = TFNNtSetIoCompletion;
9256   TFNZwSetLdtEntries = TFNNtSetLdtEntries;
9257   TFNZwSetLowEventPair = TFNNtSetLowEventPair;
9258   TFNZwSetLowWaitHighEventPair = TFNNtSetLowWaitHighEventPair;
9259   TFNZwSetLowWaitHighThread = TFNNtSetLowWaitHighThread;
9260   TFNZwSetQuotaInformationFile = TFNNtSetQuotaInformationFile;
9261   TFNZwSetSecurityObject = TFNNtSetSecurityObject;
9262   TFNZwSetSystemEnvironmentValue = TFNNtSetSystemEnvironmentValue;
9263   TFNZwSetSystemInformation = TFNNtSetSystemInformation;
9264   TFNZwSetSystemPowerState = TFNNtSetSystemPowerState;
9265   TFNZwSetSystemTime = TFNNtSetSystemTime;
9266   TFNZwSetThreadExecutionState = TFNNtSetThreadExecutionState;
9267   TFNZwSetTimer = TFNNtSetTimer;
9268   TFNZwSetTimerResolution = TFNNtSetTimerResolution;
9269   TFNZwSetUuidSeed = TFNNtSetUuidSeed;
9270   TFNZwSetValueKey = TFNNtSetValueKey;
9271   TFNZwSetVolumeInformationFile = TFNNtSetVolumeInformationFile;
9272   TFNZwShutdownSystem = TFNNtShutdownSystem;
9273   TFNZwSignalAndWaitForSingleObject = TFNNtSignalAndWaitForSingleObject;
9274   TFNZwStartProfile = TFNNtStartProfile;
9275   TFNZwStopProfile = TFNNtStopProfile;
9276   TFNZwSuspendProcess = TFNNtSuspendProcess;
9277   TFNZwSuspendThread = TFNNtSuspendThread;
9278   TFNZwSystemDebugControl = TFNNtSystemDebugControl;
9279   TFNZwTerminateJobObject = TFNNtTerminateJobObject;
9280   TFNZwTerminateProcess = TFNNtTerminateProcess;
9281   TFNZwTerminateThread = TFNNtTerminateThread;
9282   TFNZwTestAlert = TFNNtTestAlert;
9283   TFNZwUnloadDriver = TFNNtUnloadDriver;
9284   TFNZwUnloadKey = TFNNtUnloadKey;
9285   TFNZwUnlockFile = TFNNtUnlockFile;
9286   TFNZwUnlockVirtualMemory = TFNNtUnlockVirtualMemory;
9287   TFNZwUnmapViewOfSection = TFNNtUnmapViewOfSection;
9288   TFNZwVdmControl = TFNNtVdmControl;
9289   TFNZwW32Call = TFNNtW32Call;
9290   TFNZwWaitForMultipleObjects = TFNNtWaitForMultipleObjects;
9291   TFNZwWaitForSingleObject = TFNNtWaitForSingleObject;
9292   TFNZwWaitHighEventPair = TFNNtWaitHighEventPair;
9293   TFNZwWaitLowEventPair = TFNNtWaitLowEventPair;
9294   TFNZwWriteFile = TFNNtWriteFile;
9295   TFNZwWriteFileGather = TFNNtWriteFileGather;
9296   TFNZwWriteRequestData = TFNNtWriteRequestData;
9297   TFNZwWriteVirtualMemory = TFNNtWriteVirtualMemory;
9298   TFNZwYieldExecution = TFNNtYieldExecution;
9299 
9300 /// (Global) function pointers
9301 var
9302   _CsrGetProcessId : Pointer = nil;
9303   _DbgQueryDebugFilterState : Pointer = nil;
9304   _DbgSetDebugFilterState : Pointer = nil;
9305   _KiRaiseUserExceptionDispatcher : Pointer = nil;
9306   _LdrAccessResource : Pointer = nil;
9307   _LdrAlternateResourcesEnabled : Pointer = nil;
9308   _LdrDisableThreadCalloutsForDll : Pointer = nil;
9309   _LdrGetDllHandle : Pointer = nil;
9310   _LdrGetProcedureAddress : Pointer = nil;
9311   _LdrLoadDll : Pointer = nil;
9312   _LdrQueryImageFileExecutionOptions : Pointer = nil;
9313   _LdrQueryProcessModuleInformation : Pointer = nil;
9314   _LdrShutdownProcess : Pointer = nil;
9315   _LdrShutdownThread : Pointer = nil;
9316   _LdrUnloadDll : Pointer = nil;
9317   _NtAcceptConnectPort : Pointer = nil;
9318   _NtAccessCheck : Pointer = nil;
9319   _NtAccessCheckAndAuditAlarm : Pointer = nil;
9320   _NtAccessCheckByType : Pointer = nil;
9321   _NtAccessCheckByTypeAndAuditAlarm : Pointer = nil;
9322   _NtAccessCheckByTypeResultList : Pointer = nil;
9323   _NtAccessCheckByTypeResultListAndAuditAlarm : Pointer = nil;
9324   _NtAccessCheckByTypeResultListAndAuditAlarmByHandle : Pointer = nil;
9325   _NtAddAtom : Pointer = nil;
9326   _NtAdjustGroupsToken : Pointer = nil;
9327   _NtAdjustPrivilegesToken : Pointer = nil;
9328   _NtAlertResumeThread : Pointer = nil;
9329   _NtAlertThread : Pointer = nil;
9330   _NtAllocateLocallyUniqueId : Pointer = nil;
9331   _NtAllocateUserPhysicalPages : Pointer = nil;
9332   _NtAllocateUuids : Pointer = nil;
9333   _NtAllocateVirtualMemory : Pointer = nil;
9334   _NtAreMappedFilesTheSame : Pointer = nil;
9335   _NtAssignProcessToJobObject : Pointer = nil;
9336   _NtCallbackReturn : Pointer = nil;
9337   _NtCancelDeviceWakeupRequest : Pointer = nil;
9338   _NtCancelIoFile : Pointer = nil;
9339   _NtCancelTimer : Pointer = nil;
9340   _NtClearEvent : Pointer = nil;
9341 
9342   _NtClose : Pointer = nil;
9343 
9344   _NtCloseObjectAuditAlarm : Pointer = nil;
9345   _NtCompleteConnectPort : Pointer = nil;
9346   _NtConnectPort : Pointer = nil;
9347   _NtContinue : Pointer = nil;
9348   _NtCreateChannel : Pointer = nil;
9349   _NtCreateDirectoryObject : Pointer = nil;
9350   _NtCreateEvent : Pointer = nil;
9351   _NtCreateEventPair : Pointer = nil;
9352 
9353   _NtCreateFile : Pointer = nil;
9354 
9355   _NtCreateIoCompletion : Pointer = nil;
9356   _NtCreateJobObject : Pointer = nil;
9357   _NtCreateKey : Pointer = nil;
9358   _NtCreateMailslotFile : Pointer = nil;
9359   _NtCreateMutant : Pointer = nil;
9360   _NtCreateNamedPipeFile : Pointer = nil;
9361   _NtCreatePagingFile : Pointer = nil;
9362   _NtCreatePort : Pointer = nil;
9363   _NtCreateProcess : Pointer = nil;
9364   _NtCreateProfile : Pointer = nil;
9365   _NtCreateSection : Pointer = nil;
9366   _NtCreateSemaphore : Pointer = nil;
9367   _NtCreateSymbolicLinkObject : Pointer = nil;
9368   _NtCreateThread : Pointer = nil;
9369   _NtCreateTimer : Pointer = nil;
9370   _NtCreateToken : Pointer = nil;
9371   _NtCreateWaitablePort : Pointer = nil;
9372   _NtCurrentTeb : Pointer = nil;
9373   _NtDebugActiveProcess : Pointer = nil;
9374   _NtDelayExecution : Pointer = nil;
9375   _NtDeleteAtom : Pointer = nil;
9376   _NtDeleteFile : Pointer = nil;
9377   _NtDeleteKey : Pointer = nil;
9378   _NtDeleteObjectAuditAlarm : Pointer = nil;
9379   _NtDeleteValueKey : Pointer = nil;
9380 
9381   _NtDeviceIoControlFile : Pointer = nil;
9382 
9383   _NtDisplayString : Pointer = nil;
9384   _NtDuplicateObject : Pointer = nil;
9385   _NtDuplicateToken : Pointer = nil;
9386   _NtEnumerateKey : Pointer = nil;
9387   _NtEnumerateValueKey : Pointer = nil;
9388   _NtExtendSection : Pointer = nil;
9389   _NtFilterToken : Pointer = nil;
9390   _NtFindAtom : Pointer = nil;
9391   _NtFlushBuffersFile : Pointer = nil;
9392   _NtFlushInstructionCache : Pointer = nil;
9393   _NtFlushKey : Pointer = nil;
9394   _NtFlushVirtualMemory : Pointer = nil;
9395   _NtFlushWriteBuffer : Pointer = nil;
9396   _NtFreeUserPhysicalPages : Pointer = nil;
9397   _NtFreeVirtualMemory : Pointer = nil;
9398   _NtFsControlFile : Pointer = nil;
9399   _NtGetContextThread : Pointer = nil;
9400   _NtGetCurrentProcessorNumber : Pointer = nil;
9401   _NtGetDevicePowerState : Pointer = nil;
9402   _NtGetPlugPlayEvent : Pointer = nil;
9403   _NtGetTickCount : Pointer = nil;
9404   _NtGetWriteWatch : Pointer = nil;
9405   _NtImpersonateAnonymousToken : Pointer = nil;
9406   _NtImpersonateClientOfPort : Pointer = nil;
9407   _NtImpersonateThread : Pointer = nil;
9408   _NtInitializeRegistry : Pointer = nil;
9409   _NtInitiatePowerAction : Pointer = nil;
9410   _NtIsSystemResumeAutomatic : Pointer = nil;
9411   _NtListenChannel : Pointer = nil;
9412   _NtListenPort : Pointer = nil;
9413   _NtLoadDriver : Pointer = nil;
9414   _NtLoadKey : Pointer = nil;
9415   _NtLoadKey2 : Pointer = nil;
9416   _NtLockFile : Pointer = nil;
9417   _NtLockVirtualMemory : Pointer = nil;
9418   _NtMakePermanentObject : Pointer = nil;
9419   _NtMakeTemporaryObject : Pointer = nil;
9420   _NtMapUserPhysicalPages : Pointer = nil;
9421   _NtMapUserPhysicalPagesScatter : Pointer = nil;
9422   _NtMapViewOfSection : Pointer = nil;
9423   _NtNotifyChangeDirectoryFile : Pointer = nil;
9424   _NtNotifyChangeKey : Pointer = nil;
9425   _NtNotifyChangeMultipleKeys : Pointer = nil;
9426   _NtOpenChannel : Pointer = nil;
9427   _NtOpenDirectoryObject : Pointer = nil;
9428   _NtOpenEvent : Pointer = nil;
9429   _NtOpenEventPair : Pointer = nil;
9430 
9431   _NtOpenFile : Pointer = nil;
9432 
9433   _NtOpenIoCompletion : Pointer = nil;
9434   _NtOpenJobObject : Pointer = nil;
9435   _NtOpenKey : Pointer = nil;
9436   _NtOpenMutant : Pointer = nil;
9437   _NtOpenObjectAuditAlarm : Pointer = nil;
9438   _NtOpenProcess : Pointer = nil;
9439   _NtOpenProcessToken : Pointer = nil;
9440   _NtOpenSection : Pointer = nil;
9441   _NtOpenSemaphore : Pointer = nil;
9442   _NtOpenSymbolicLinkObject : Pointer = nil;
9443   _NtOpenThread : Pointer = nil;
9444   _NtOpenThreadToken : Pointer = nil;
9445   _NtOpenTimer : Pointer = nil;
9446   _NtPlugPlayControl : Pointer = nil;
9447   _NtPowerInformation : Pointer = nil;
9448   _NtPrivilegeCheck : Pointer = nil;
9449   _NtPrivilegeObjectAuditAlarm : Pointer = nil;
9450   _NtPrivilegedServiceAuditAlarm : Pointer = nil;
9451   _NtProtectVirtualMemory : Pointer = nil;
9452   _NtPulseEvent : Pointer = nil;
9453   _NtQueryAttributesFile : Pointer = nil;
9454   _NtQueryDefaultLocale : Pointer = nil;
9455   _NtQueryDefaultUILanguage : Pointer = nil;
9456   _NtQueryDirectoryFile : Pointer = nil;
9457   _NtQueryDirectoryObject : Pointer = nil;
9458   _NtQueryEaFile : Pointer = nil;
9459   _NtQueryEvent : Pointer = nil;
9460   _NtQueryFullAttributesFile : Pointer = nil;
9461   _NtQueryInformationAtom : Pointer = nil;
9462   _NtQueryInformationFile : Pointer = nil;
9463   _NtQueryInformationJobObject : Pointer = nil;
9464   _NtQueryInformationPort : Pointer = nil;
9465   _NtQueryInformationProcess : Pointer = nil;
9466   _NtQueryInformationThread : Pointer = nil;
9467   _NtQueryInformationToken : Pointer = nil;
9468   _NtQueryInstallUILanguage : Pointer = nil;
9469   _NtQueryIntervalProfile : Pointer = nil;
9470   _NtQueryIoCompletion : Pointer = nil;
9471   _NtQueryKey : Pointer = nil;
9472   _NtQueryMultipleValueKey : Pointer = nil;
9473   _NtQueryMutant : Pointer = nil;
9474   _NtQueryObject : Pointer = nil;
9475   _NtQueryOpenSubKeys : Pointer = nil;
9476   _NtQueryPerformanceCounter : Pointer = nil;
9477   _NtQueryPortInformationProcess : Pointer = nil;
9478   _NtQueryQuotaInformationFile : Pointer = nil;
9479   _NtQuerySection : Pointer = nil;
9480   _NtQuerySecurityObject : Pointer = nil;
9481   _NtQuerySemaphore : Pointer = nil;
9482   _NtQuerySymbolicLinkObject : Pointer = nil;
9483   _NtQuerySystemEnvironmentValue : Pointer = nil;
9484   _NtQuerySystemInformation : Pointer = nil;
9485   _NtQuerySystemTime : Pointer = nil;
9486   _NtQueryTimer : Pointer = nil;
9487   _NtQueryTimerResolution : Pointer = nil;
9488   _NtQueryValueKey : Pointer = nil;
9489   _NtQueryVirtualMemory : Pointer = nil;
9490   _NtQueryVolumeInformationFile : Pointer = nil;
9491   _NtQueueApcThread : Pointer = nil;
9492   _NtRaiseException : Pointer = nil;
9493   _NtRaiseHardError : Pointer = nil;
9494   _NtReadFile : Pointer = nil;
9495   _NtReadFileScatter : Pointer = nil;
9496   _NtReadRequestData : Pointer = nil;
9497   _NtReadVirtualMemory : Pointer = nil;
9498   _NtRegisterThreadTerminatePort : Pointer = nil;
9499   _NtReleaseMutant : Pointer = nil;
9500   _NtReleaseSemaphore : Pointer = nil;
9501   _NtRemoveIoCompletion : Pointer = nil;
9502   _NtRemoveProcessDebug : Pointer = nil;
9503   _NtReplaceKey : Pointer = nil;
9504   _NtReplyPort : Pointer = nil;
9505   _NtReplyWaitReceivePort : Pointer = nil;
9506   _NtReplyWaitReceivePortEx : Pointer = nil;
9507   _NtReplyWaitReplyPort : Pointer = nil;
9508   _NtReplyWaitSendChannel : Pointer = nil;
9509   _NtRequestDeviceWakeup : Pointer = nil;
9510   _NtRequestPort : Pointer = nil;
9511   _NtRequestWaitReplyPort : Pointer = nil;
9512   _NtRequestWakeupLatency : Pointer = nil;
9513   _NtResetEvent : Pointer = nil;
9514   _NtResetWriteWatch : Pointer = nil;
9515   _NtRestoreKey : Pointer = nil;
9516   _NtResumeProcess : Pointer = nil;
9517   _NtResumeThread : Pointer = nil;
9518   _NtSaveKey : Pointer = nil;
9519   _NtSaveKeyEx : Pointer = nil;
9520   _NtSaveMergedKeys : Pointer = nil;
9521   _NtSecureConnectPort : Pointer = nil;
9522   _NtSendWaitReplyChannel : Pointer = nil;
9523   _NtSetContextChannel : Pointer = nil;
9524   _NtSetContextThread : Pointer = nil;
9525   _NtSetDefaultHardErrorPort : Pointer = nil;
9526   _NtSetDefaultLocale : Pointer = nil;
9527   _NtSetDefaultUILanguage : Pointer = nil;
9528   _NtSetEaFile : Pointer = nil;
9529   _NtSetEvent : Pointer = nil;
9530   _NtSetHighEventPair : Pointer = nil;
9531   _NtSetHighWaitLowEventPair : Pointer = nil;
9532   _NtSetHighWaitLowThread : Pointer = nil;
9533   _NtSetInformationFile : Pointer = nil;
9534   _NtSetInformationJobObject : Pointer = nil;
9535   _NtSetInformationKey : Pointer = nil;
9536   _NtSetInformationObject : Pointer = nil;
9537   _NtSetInformationProcess : Pointer = nil;
9538   _NtSetInformationThread : Pointer = nil;
9539   _NtSetInformationToken : Pointer = nil;
9540   _NtSetIntervalProfile : Pointer = nil;
9541   _NtSetIoCompletion : Pointer = nil;
9542   _NtSetLdtEntries : Pointer = nil;
9543   _NtSetLowEventPair : Pointer = nil;
9544   _NtSetLowWaitHighEventPair : Pointer = nil;
9545   _NtSetLowWaitHighThread : Pointer = nil;
9546   _NtSetQuotaInformationFile : Pointer = nil;
9547   _NtSetSecurityObject : Pointer = nil;
9548   _NtSetSystemEnvironmentValue : Pointer = nil;
9549   _NtSetSystemInformation : Pointer = nil;
9550   _NtSetSystemPowerState : Pointer = nil;
9551   _NtSetSystemTime : Pointer = nil;
9552   _NtSetThreadExecutionState : Pointer = nil;
9553   _NtSetTimer : Pointer = nil;
9554   _NtSetTimerResolution : Pointer = nil;
9555   _NtSetUuidSeed : Pointer = nil;
9556   _NtSetValueKey : Pointer = nil;
9557   _NtSetVolumeInformationFile : Pointer = nil;
9558   _NtShutdownSystem : Pointer = nil;
9559   _NtSignalAndWaitForSingleObject : Pointer = nil;
9560   _NtStartProfile : Pointer = nil;
9561   _NtStopProfile : Pointer = nil;
9562   _NtSuspendProcess : Pointer = nil;
9563   _NtSuspendThread : Pointer = nil;
9564   _NtSystemDebugControl : Pointer = nil;
9565   _NtTerminateJobObject : Pointer = nil;
9566   _NtTerminateProcess : Pointer = nil;
9567   _NtTerminateThread : Pointer = nil;
9568   _NtTestAlert : Pointer = nil;
9569   _NtUnloadDriver : Pointer = nil;
9570   _NtUnloadKey : Pointer = nil;
9571   _NtUnlockFile : Pointer = nil;
9572   _NtUnlockVirtualMemory : Pointer = nil;
9573   _NtUnmapViewOfSection : Pointer = nil;
9574   _NtVdmControl : Pointer = nil;
9575   _NtW32Call : Pointer = nil;
9576   _NtWaitForMultipleObjects : Pointer = nil;
9577   _NtWaitForSingleObject : Pointer = nil;
9578   _NtWaitHighEventPair : Pointer = nil;
9579   _NtWaitLowEventPair : Pointer = nil;
9580   _NtWriteFile : Pointer = nil;
9581   _NtWriteFileGather : Pointer = nil;
9582   _NtWriteRequestData : Pointer = nil;
9583   _NtWriteVirtualMemory : Pointer = nil;
9584   _NtYieldExecution : Pointer = nil;
9585   _RtlAbsoluteToSelfRelativeSD : Pointer = nil;
9586   _RtlAcquirePebLock : Pointer = nil;
9587   _RtlAddAccessAllowedAce : Pointer = nil;
9588   _RtlAddAccessAllowedAceEx : Pointer = nil;
9589   _RtlAddAccessDeniedAce : Pointer = nil;
9590   _RtlAddAccessDeniedAceEx : Pointer = nil;
9591   _RtlAddAce : Pointer = nil;
9592   _RtlAddAuditAccessAce : Pointer = nil;
9593   _RtlAddAuditAccessAceEx : Pointer = nil;
9594   _RtlAddRange : Pointer = nil;
9595   _RtlAddVectoredExceptionHandler : Pointer = nil;
9596   _RtlAdjustPrivilege : Pointer = nil;
9597   _RtlAllocateAndInitializeSid : Pointer = nil;
9598   _RtlAllocateHeap : Pointer = nil;
9599   _RtlAnsiCharToUnicodeChar : Pointer = nil;
9600   _RtlAnsiStringToUnicodeSize : Pointer = nil;
9601   _RtlAnsiStringToUnicodeString : Pointer = nil;
9602   _RtlAppendAsciizToString : Pointer = nil;
9603   _RtlAppendStringToString : Pointer = nil;
9604   _RtlAppendUnicodeStringToString : Pointer = nil;
9605   _RtlAppendUnicodeToString : Pointer = nil;
9606   _RtlAreAllAccessesGranted : Pointer = nil;
9607   _RtlAreAnyAccessesGranted : Pointer = nil;
9608   _RtlAreBitsClear : Pointer = nil;
9609   _RtlAreBitsSet : Pointer = nil;
9610   _RtlAssert : Pointer = nil;
9611   {$IFNDEF JWA_INCLUDEMODE}
9612   _RtlCaptureContext : Pointer = nil;
9613   _RtlCharToInteger : Pointer = nil;
9614   {$ENDIF JWA_INCLUDEMODE}
9615   _RtlCheckForOrphanedCriticalSections : Pointer = nil;
9616   _RtlCheckRegistryKey : Pointer = nil;
9617   _RtlClearAllBits : Pointer = nil;
9618   _RtlClearBits : Pointer = nil;
9619   _RtlCompactHeap : Pointer = nil;
9620   {$IFNDEF JWA_INCLUDEMODE}
9621   _RtlCompareMemory : Pointer = nil;
9622   {$ENDIF JWA_INCLUDEMODE}
9623   _RtlCompareMemoryUlong : Pointer = nil;
9624   _RtlCompareString : Pointer = nil;
9625   _RtlCompareUnicodeString : Pointer = nil;
9626   _RtlConvertLongToLargeInteger : Pointer = nil;
9627   _RtlConvertSidToUnicodeString : Pointer = nil;
9628   _RtlConvertUlongToLargeInteger : Pointer = nil;
9629   _RtlCopyLuid : Pointer = nil;
9630   _RtlCopyRangeList : Pointer = nil;
9631   _RtlCopySecurityDescriptor : Pointer = nil;
9632   _RtlCopySid : Pointer = nil;
9633   _RtlCopyString : Pointer = nil;
9634   _RtlCopyUnicodeString : Pointer = nil;
9635   _RtlCreateAcl : Pointer = nil;
9636   _RtlCreateHeap : Pointer = nil;
9637   _RtlCreateProcessParameters : Pointer = nil;
9638   _RtlCreateQueryDebugBuffer : Pointer = nil;
9639   _RtlCreateRegistryKey : Pointer = nil;
9640   _RtlCreateSecurityDescriptor : Pointer = nil;
9641   _RtlCreateUnicodeString : Pointer = nil;
9642   _RtlCreateUnicodeStringFromAsciiz : Pointer = nil;
9643   _RtlCreateUserProcess : Pointer = nil;
9644   _RtlCreateUserThread : Pointer = nil;
9645   _RtlCutoverTimeToSystemTime : Pointer = nil;
9646   _RtlDeNormalizeProcessParams : Pointer = nil;
9647   _RtlDeleteAce : Pointer = nil;
9648   _RtlDeleteCriticalSection : Pointer = nil;
9649   _RtlDeleteOwnersRanges : Pointer = nil;
9650   _RtlDeleteRange : Pointer = nil;
9651   _RtlDeleteRegistryValue : Pointer = nil;
9652   _RtlDestroyHeap : Pointer = nil;
9653   _RtlDestroyProcessParameters : Pointer = nil;
9654   _RtlDestroyQueryDebugBuffer : Pointer = nil;
9655   _RtlDetermineDosPathNameType_U : Pointer = nil;
9656   _RtlDnsHostNameToComputerName : Pointer = nil;
9657   _RtlDoesFileExists_U : Pointer = nil;
9658   _RtlDosPathNameToNtPathName_U : Pointer = nil;
9659   _RtlDosSearchPath_U : Pointer = nil;
9660   _RtlDowncaseUnicodeChar : Pointer = nil;
9661   _RtlDowncaseUnicodeString : Pointer = nil;
9662   _RtlDuplicateUnicodeString : Pointer = nil;
9663   _RtlEnableEarlyCriticalSectionEventCreation : Pointer = nil;
9664   _RtlEnlargedIntegerMultiply : Pointer = nil;
9665   _RtlEnlargedUnsignedDivide : Pointer = nil;
9666   _RtlEnlargedUnsignedMultiply : Pointer = nil;
9667   _RtlEnterCriticalSection : Pointer = nil;
9668   _RtlEqualComputerName : Pointer = nil;
9669   _RtlEqualDomainName : Pointer = nil;
9670   _RtlEqualLuid : Pointer = nil;
9671   _RtlEqualPrefixSid : Pointer = nil;
9672   _RtlEqualSid : Pointer = nil;
9673   _RtlEqualString : Pointer = nil;
9674   _RtlEqualUnicodeString : Pointer = nil;
9675   _RtlEraseUnicodeString : Pointer = nil;
9676   _RtlExpandEnvironmentStrings_U : Pointer = nil;
9677   _RtlExtendedIntegerMultiply : Pointer = nil;
9678   _RtlExtendedLargeIntegerDivide : Pointer = nil;
9679   _RtlExtendedMagicDivide : Pointer = nil;
9680   _RtlFillMemory : Pointer = nil;
9681   _RtlFillMemoryUlong : Pointer = nil;
9682   _RtlFindCharInUnicodeString : Pointer = nil;
9683   _RtlFindClearBits : Pointer = nil;
9684   _RtlFindClearBitsAndSet : Pointer = nil;
9685   _RtlFindLastBackwardRunClear : Pointer = nil;
9686   _RtlFindLeastSignificantBit : Pointer = nil;
9687   _RtlFindLongestRunClear : Pointer = nil;
9688   _RtlFindMostSignificantBit : Pointer = nil;
9689   _RtlFindNextForwardRunClear : Pointer = nil;
9690   _RtlFindRange : Pointer = nil;
9691   _RtlFindSetBits : Pointer = nil;
9692   _RtlFindSetBitsAndClear : Pointer = nil;
9693   _RtlFirstFreeAce : Pointer = nil;
9694   _RtlFormatCurrentUserKeyPath : Pointer = nil;
9695   _RtlFreeAnsiString : Pointer = nil;
9696   _RtlFreeHeap : Pointer = nil;
9697   _RtlFreeOemString : Pointer = nil;
9698   _RtlFreeRangeList : Pointer = nil;
9699   _RtlFreeSid : Pointer = nil;
9700   _RtlFreeUnicodeString : Pointer = nil;
9701   _RtlGUIDFromString : Pointer = nil;
9702   _RtlGetAce : Pointer = nil;
9703   _RtlGetCallersAddress : Pointer = nil;
9704   _RtlGetControlSecurityDescriptor : Pointer = nil;
9705   _RtlGetCurrentDirectory_U : Pointer = nil;
9706   _RtlGetCurrentPeb : Pointer = nil;
9707   _RtlGetDaclSecurityDescriptor : Pointer = nil;
9708   _RtlGetFirstRange : Pointer = nil;
9709   _RtlGetFullPathName_U : Pointer = nil;
9710   _RtlGetGroupSecurityDescriptor : Pointer = nil;
9711   _RtlGetLastNtStatus : Pointer = nil;
9712   _RtlGetLongestNtPathLength : Pointer = nil;
9713   _RtlGetNextRange : Pointer = nil;
9714   _RtlGetNtGlobalFlags : Pointer = nil;
9715   _RtlGetNtProductType : Pointer = nil;
9716   _RtlGetNtVersionNumbers : Pointer = nil;
9717   _RtlGetOwnerSecurityDescriptor : Pointer = nil;
9718   _RtlGetProcessHeaps : Pointer = nil;
9719   _RtlGetSaclSecurityDescriptor : Pointer = nil;
9720   _RtlGetVersion : Pointer = nil;
9721   _RtlIdentifierAuthoritySid : Pointer = nil;
9722   _RtlImageDirectoryEntryToData : Pointer = nil;
9723   _RtlImageNtHeader : Pointer = nil;
9724   _RtlImageNtHeaderEx : Pointer = nil;
9725   _RtlImageRvaToSection : Pointer = nil;
9726   _RtlImageRvaToVa : Pointer = nil;
9727   _RtlImpersonateSelf : Pointer = nil;
9728   _RtlInitAnsiString : Pointer = nil;
9729   _RtlInitAnsiStringEx : Pointer = nil;
9730   _RtlInitString : Pointer = nil;
9731   _RtlInitUnicodeString : Pointer = nil;
9732   _RtlInitUnicodeStringEx : Pointer = nil;
9733   _RtlInitializeBitMap : Pointer = nil;
9734   _RtlInitializeCriticalSection : Pointer = nil;
9735   _RtlInitializeCriticalSectionAndSpinCount : Pointer = nil;
9736   _RtlInitializeRangeList : Pointer = nil;
9737   {$IFNDEF JWA_INCLUDEMODE}
9738   _RtlInitializeSListHead : Pointer = nil;
9739   {$ENDIF JWA_INCLUDEMODE}
9740   _RtlInitializeSid : Pointer = nil;
9741   _RtlInt64ToUnicodeString : Pointer = nil;
9742   _RtlIntegerToChar : Pointer = nil;
9743   _RtlIntegerToUnicodeString : Pointer = nil;
9744   {$IFNDEF JWA_INCLUDEMODE}
9745   _RtlInterlockedFlushSList : Pointer = nil;
9746   _RtlInterlockedPopEntrySList : Pointer = nil;
9747   {$ENDIF JWA_INCLUDEMODE}
9748   _RtlInterlockedPushEntrySList : Pointer = nil;
9749   _RtlInvertRangeList : Pointer = nil;
9750   _RtlIpv4AddressToStringA : Pointer = nil;
9751   _RtlIpv4AddressToStringW : Pointer = nil;
9752   _RtlIsDosDeviceName_U : Pointer = nil;
9753   {$IFNDEF JWA_INCLUDEMODE}
9754   _RtlIsNameLegalDOS8Dot3 : Pointer = nil;
9755   {$ENDIF JWA_INCLUDEMODE}
9756   _RtlIsRangeAvailable : Pointer = nil;
9757   _RtlIsTextUnicode : Pointer = nil;
9758   _RtlLargeIntegerAdd : Pointer = nil;
9759   _RtlLargeIntegerArithmeticShift : Pointer = nil;
9760   _RtlLargeIntegerDivide : Pointer = nil;
9761   _RtlLargeIntegerNegate : Pointer = nil;
9762   _RtlLargeIntegerShiftLeft : Pointer = nil;
9763   _RtlLargeIntegerShiftRight : Pointer = nil;
9764   _RtlLargeIntegerSubtract : Pointer = nil;
9765   _RtlLargeIntegerToChar : Pointer = nil;
9766   _RtlLeaveCriticalSection : Pointer = nil;
9767   _RtlLengthRequiredSid : Pointer = nil;
9768   _RtlLengthSecurityDescriptor : Pointer = nil;
9769   _RtlLengthSid : Pointer = nil;
9770   {$IFNDEF JWA_INCLUDEMODE}
9771   _RtlLocalTimeToSystemTime : Pointer = nil;
9772   {$ENDIF JWA_INCLUDEMODE}
9773   _RtlLockHeap : Pointer = nil;
9774   _RtlMakeSelfRelativeSD : Pointer = nil;
9775   _RtlMapGenericMask : Pointer = nil;
9776   _RtlMapSecurityErrorToNtStatus : Pointer = nil;
9777   _RtlMergeRangeLists : Pointer = nil;
9778   _RtlMoveMemory : Pointer = nil;
9779   _RtlNormalizeProcessParams : Pointer = nil;
9780   _RtlNtStatusToDosError : Pointer = nil;
9781   _RtlNtStatusToDosErrorNoTeb : Pointer = nil;
9782   _RtlNumberOfClearBits : Pointer = nil;
9783   _RtlNumberOfSetBits : Pointer = nil;
9784   _RtlOemStringToUnicodeSize : Pointer = nil;
9785   _RtlOemStringToUnicodeString : Pointer = nil;
9786   _RtlOemToUnicodeN : Pointer = nil;
9787   _RtlOpenCurrentUser : Pointer = nil;
9788   _RtlPrefixString : Pointer = nil;
9789   _RtlPrefixUnicodeString : Pointer = nil;
9790   _RtlQueryDepthSList : Pointer = nil;
9791   _RtlQueryEnvironmentVariable_U : Pointer = nil;
9792   _RtlQueryInformationAcl : Pointer = nil;
9793   _RtlQueryProcessDebugInformation : Pointer = nil;
9794   _RtlQueryRegistryValues : Pointer = nil;
9795   _RtlRaiseStatus : Pointer = nil;
9796   _RtlRandom : Pointer = nil;
9797   _RtlRandomEx : Pointer = nil;
9798   _RtlReAllocateHeap : Pointer = nil;
9799   _RtlReleasePebLock : Pointer = nil;
9800   _RtlRemoveVectoredExceptionHandler : Pointer = nil;
9801   _RtlRestoreLastWin32Error : Pointer = nil;
9802   _RtlRunDecodeUnicodeString : Pointer = nil;
9803   _RtlRunEncodeUnicodeString : Pointer = nil;
9804   _RtlSecondsSince1970ToTime : Pointer = nil;
9805   _RtlSecondsSince1980ToTime : Pointer = nil;
9806   _RtlSelfRelativeToAbsoluteSD : Pointer = nil;
9807   _RtlSetAllBits : Pointer = nil;
9808   _RtlSetBits : Pointer = nil;
9809   _RtlSetControlSecurityDescriptor : Pointer = nil;
9810   _RtlSetCriticalSectionSpinCount : Pointer = nil;
9811   _RtlSetCurrentDirectory_U : Pointer = nil;
9812   _RtlSetDaclSecurityDescriptor : Pointer = nil;
9813   _RtlSetGroupSecurityDescriptor : Pointer = nil;
9814   _RtlSetInformationAcl : Pointer = nil;
9815   _RtlSetLastWin32ErrorAndNtStatusFromNtStatus : Pointer = nil;
9816   _RtlSetOwnerSecurityDescriptor : Pointer = nil;
9817   _RtlSetProcessIsCritical : Pointer = nil;
9818   _RtlSetSaclSecurityDescriptor : Pointer = nil;
9819   _RtlSetThreadIsCritical : Pointer = nil;
9820   _RtlSizeHeap : Pointer = nil;
9821   _RtlStringFromGUID : Pointer = nil;
9822   _RtlSubAuthorityCountSid : Pointer = nil;
9823   _RtlSubAuthoritySid : Pointer = nil;
9824   _RtlSystemTimeToLocalTime : Pointer = nil;
9825   _RtlTimeFieldsToTime : Pointer = nil;
9826   _RtlTimeToElapsedTimeFields : Pointer = nil;
9827   {$IFNDEF JWA_INCLUDEMODE}
9828   _RtlTimeToSecondsSince1970 : Pointer = nil;
9829   {$ENDIF JWA_INCLUDEMODE}
9830   _RtlTimeToSecondsSince1980 : Pointer = nil;
9831   _RtlTimeToTimeFields : Pointer = nil;
9832   _RtlTryEnterCriticalSection : Pointer = nil;
9833   _RtlUnicodeStringToAnsiSize : Pointer = nil;
9834   {$IFNDEF JWA_INCLUDEMODE}
9835   _RtlUnicodeStringToAnsiString : Pointer = nil;
9836   {$ENDIF JWA_INCLUDEMODE}
9837   _RtlUnicodeStringToCountedOemString : Pointer = nil;
9838   _RtlUnicodeStringToInteger : Pointer = nil;
9839   _RtlUnicodeStringToOemSize : Pointer = nil;
9840   {$IFNDEF JWA_INCLUDEMODE}
9841   _RtlUnicodeStringToOemString : Pointer = nil;
9842   _RtlUnicodeToMultiByteSize : Pointer = nil;
9843   {$ENDIF JWA_INCLUDEMODE}
9844   _RtlUniform : Pointer = nil;
9845   _RtlUnwind : Pointer = nil;
9846   _RtlUpcaseUnicodeChar : Pointer = nil;
9847   _RtlUpcaseUnicodeString : Pointer = nil;
9848   _RtlUpcaseUnicodeStringToAnsiString : Pointer = nil;
9849   _RtlUpcaseUnicodeStringToCountedOemString : Pointer = nil;
9850   _RtlUpcaseUnicodeStringToOemString : Pointer = nil;
9851   _RtlUpcaseUnicodeToMultiByteN : Pointer = nil;
9852   _RtlUpcaseUnicodeToOemN : Pointer = nil;
9853   _RtlUpperChar : Pointer = nil;
9854   _RtlUpperString : Pointer = nil;
9855   _RtlValidAcl : Pointer = nil;
9856   _RtlValidRelativeSecurityDescriptor : Pointer = nil;
9857   _RtlValidSecurityDescriptor : Pointer = nil;
9858   _RtlValidSid : Pointer = nil;
9859   _RtlValidateHeap : Pointer = nil;
9860   _RtlValidateUnicodeString : Pointer = nil;
9861   _RtlVerifyVersionInfo : Pointer = nil;
9862   _RtlVolumeDeviceToDosName : Pointer = nil;
9863   _RtlWriteRegistryValue : Pointer = nil;
9864   _RtlZeroHeap : Pointer = nil;
9865   _RtlZeroMemory : Pointer = nil;
9866   _RtlpNotOwnerCriticalSection : Pointer = nil;
9867   _RtlpNtCreateKey : Pointer = nil;
9868   _RtlpNtEnumerateSubKey : Pointer = nil;
9869   _RtlpNtMakeTemporaryKey : Pointer = nil;
9870   _RtlpNtOpenKey : Pointer = nil;
9871   _RtlpNtQueryValueKey : Pointer = nil;
9872   _RtlpNtSetValueKey : Pointer = nil;
9873   _RtlxAnsiStringToUnicodeSize : Pointer = nil;
9874   _RtlxOemStringToUnicodeSize : Pointer = nil;
9875   _RtlxUnicodeStringToAnsiSize : Pointer = nil;
9876   _RtlxUnicodeStringToOemSize : Pointer = nil;
9877   {$IFNDEF JWA_INCLUDEMODE}
9878   _VerSetConditionMask : Pointer = nil;
9879   {$ENDIF JWA_INCLUDEMODE}
9880 
9881 // Dynamic version of CsrGetProcessId
9882 function  CsrGetProcessId(): DWORD; stdcall;
9883 begin
9884   GetProcedureAddress(_CsrGetProcessId, ntdll, 'CsrGetProcessId');
9885   Result := TFNCsrGetProcessId(_CsrGetProcessId)();
9886 end;
9887 
9888 // Dynamic version of DbgQueryDebugFilterState
9889 function  DbgQueryDebugFilterState(
9890     ComponentId : ULONG;
9891     Level : ULONG
9892   ): NTSTATUS; stdcall;
9893 begin
9894   GetProcedureAddress(_DbgQueryDebugFilterState, ntdll, 'DbgQueryDebugFilterState');
9895   Result := TFNDbgQueryDebugFilterState(_DbgQueryDebugFilterState)(
9896     ComponentId, Level
9897   );
9898 end;
9899 
9900 // Dynamic version of DbgSetDebugFilterState
9901 function  DbgSetDebugFilterState(
9902     ComponentId : ULONG;
9903     Level : ULONG;
9904     State : BOOLEAN
9905   ): NTSTATUS; stdcall;
9906 begin
9907   GetProcedureAddress(_DbgSetDebugFilterState, ntdll, 'DbgSetDebugFilterState');
9908   Result := TFNDbgSetDebugFilterState(_DbgSetDebugFilterState)(
9909     ComponentId, Level, State
9910   );
9911 end;
9912 
9913 // Dynamic version of KiRaiseUserExceptionDispatcher
9914 function  KiRaiseUserExceptionDispatcher(): ULONG; stdcall;
9915 begin
9916   GetProcedureAddress(_KiRaiseUserExceptionDispatcher, ntdll, 'KiRaiseUserExceptionDispatcher');
9917   Result := TFNKiRaiseUserExceptionDispatcher(_KiRaiseUserExceptionDispatcher)();
9918 end;
9919 
9920 // Dynamic version of LdrAccessResource
9921 function  LdrAccessResource(
9922     hModule : HANDLE;
9923     ResourceDataEntry : PIMAGE_RESOURCE_DATA_ENTRY;
9924     Address : PPVOID;
9925     dwSize : PULONG
9926   ): NTSTATUS; stdcall;
9927 begin
9928   GetProcedureAddress(_LdrAccessResource, ntdll, 'LdrAccessResource');
9929   Result := TFNLdrAccessResource(_LdrAccessResource)(
9930     hModule, ResourceDataEntry, Address, dwSize
9931   );
9932 end;
9933 
9934 // Dynamic version of LdrAlternateResourcesEnabled
9935 function  LdrAlternateResourcesEnabled(): BOOLEAN; stdcall;
9936 begin
9937   GetProcedureAddress(_LdrAlternateResourcesEnabled, ntdll, 'LdrAlternateResourcesEnabled');
9938   Result := TFNLdrAlternateResourcesEnabled(_LdrAlternateResourcesEnabled)();
9939 end;
9940 
9941 // Dynamic version of LdrDisableThreadCalloutsForDll
9942 function  LdrDisableThreadCalloutsForDll(
9943     hModule : HANDLE
9944   ): NTSTATUS; stdcall;
9945 begin
9946   GetProcedureAddress(_LdrDisableThreadCalloutsForDll, ntdll, 'LdrDisableThreadCalloutsForDll');
9947   Result := TFNLdrDisableThreadCalloutsForDll(_LdrDisableThreadCalloutsForDll)(
9948     hModule
9949   );
9950 end;
9951 
9952 // Dynamic version of LdrGetDllHandle
9953 function  LdrGetDllHandle(
9954     pwPath : PWORD;
9955     pReserved : PVOID;
9956     pusPath : PUNICODE_STRING;
9957     var phModule : HANDLE
9958   ): NTSTATUS; stdcall;
9959 begin
9960   GetProcedureAddress(_LdrGetDllHandle, ntdll, 'LdrGetDllHandle');
9961   Result := TFNLdrGetDllHandle(_LdrGetDllHandle)(
9962     pwPath, pReserved, pusPath, phModule
9963   );
9964 end;
9965 
9966 // Dynamic version of LdrGetProcedureAddress
9967 function  LdrGetProcedureAddress(
9968     hModule : HANDLE;
9969     dwOrdinal : ULONG;
9970     psName : PSTRING;
9971     var pProcedure : PVOID
9972   ): NTSTATUS; stdcall;
9973 begin
9974   GetProcedureAddress(_LdrGetProcedureAddress, ntdll, 'LdrGetProcedureAddress');
9975   Result := TFNLdrGetProcedureAddress(_LdrGetProcedureAddress)(
9976     hModule, dwOrdinal, psName, pProcedure
9977   );
9978 end;
9979 
9980 // Dynamic version of LdrLoadDll
9981 function  LdrLoadDll(
9982     pwPath : PWORD;
9983     pdwFlags : PDWORD;
9984     pusPath : PUNICODE_STRING;
9985     var phModule : HANDLE
9986   ): NTSTATUS; stdcall;
9987 begin
9988   GetProcedureAddress(_LdrLoadDll, ntdll, 'LdrLoadDll');
9989   Result := TFNLdrLoadDll(_LdrLoadDll)(
9990     pwPath, pdwFlags, pusPath, phModule
9991   );
9992 end;
9993 
9994 // Dynamic version of LdrQueryImageFileExecutionOptions
9995 function  LdrQueryImageFileExecutionOptions(
9996     pusImagePath : PUNICODE_STRING;
9997     pwOptionName : PWORD;
9998     dwRequestedType : DWORD;
9999     pData : PVOID;
10000     dwSize : DWORD;
10001     pdwSize : PDWORD
10002   ): NTSTATUS; stdcall;
10003 begin
10004   GetProcedureAddress(_LdrQueryImageFileExecutionOptions, ntdll, 'LdrQueryImageFileExecutionOptions');
10005   Result := TFNLdrQueryImageFileExecutionOptions(_LdrQueryImageFileExecutionOptions)(
10006     pusImagePath, pwOptionName, dwRequestedType, pData, dwSize, pdwSize
10007   );
10008 end;
10009 
10010 // Dynamic version of LdrQueryProcessModuleInformation
10011 function  LdrQueryProcessModuleInformation(
10012     psmi : PSYSTEM_MODULE_INFORMATION;
10013     dwSize : DWORD;
10014     pdwSize : PDWORD
10015   ): NTSTATUS; stdcall;
10016 begin
10017   GetProcedureAddress(_LdrQueryProcessModuleInformation, ntdll, 'LdrQueryProcessModuleInformation');
10018   Result := TFNLdrQueryProcessModuleInformation(_LdrQueryProcessModuleInformation)(
10019     psmi, dwSize, pdwSize
10020   );
10021 end;
10022 
10023 // Dynamic version of LdrShutdownProcess
10024 procedure LdrShutdownProcess(); stdcall;
10025 begin
10026   GetProcedureAddress(_LdrShutdownProcess, ntdll, 'LdrShutdownProcess');
10027   TFNLdrShutdownProcess(_LdrShutdownProcess)();
10028 end;
10029 
10030 // Dynamic version of LdrShutdownThread
10031 procedure LdrShutdownThread(); stdcall;
10032 begin
10033   GetProcedureAddress(_LdrShutdownThread, ntdll, 'LdrShutdownThread');
10034   TFNLdrShutdownThread(_LdrShutdownThread)();
10035 end;
10036 
10037 // Dynamic version of LdrUnloadDll
10038 function  LdrUnloadDll(
10039     hModule : HANDLE
10040   ): NTSTATUS; stdcall;
10041 begin
10042   GetProcedureAddress(_LdrUnloadDll, ntdll, 'LdrUnloadDll');
10043   Result := TFNLdrUnloadDll(_LdrUnloadDll)(
10044     hModule
10045   );
10046 end;
10047 
10048 // Dynamic version of NtAcceptConnectPort
10049 function  NtAcceptConnectPort(
10050     PortHandle : PHANDLE;
10051     PortIdentifier : ULONG;
10052     Message : PPORT_MESSAGE;
10053     Accept : BOOLEAN;
10054     WriteSection : PPORT_SECTION_WRITE;
10055     ReadSection : PPORT_SECTION_READ
10056   ): NTSTATUS; stdcall;
10057 begin
10058   GetProcedureAddress(_NtAcceptConnectPort, ntdll, 'NtAcceptConnectPort');
10059   Result := TFNNtAcceptConnectPort(_NtAcceptConnectPort)(
10060     PortHandle, PortIdentifier, Message, Accept, WriteSection, ReadSection
10061   );
10062 end;
10063 
10064 // Dynamic version of NtAcceptConnectPort
10065 function  ZwAcceptConnectPort(
10066     PortHandle : PHANDLE;
10067     PortIdentifier : ULONG;
10068     Message : PPORT_MESSAGE;
10069     Accept : BOOLEAN;
10070     WriteSection : PPORT_SECTION_WRITE;
10071     ReadSection : PPORT_SECTION_READ
10072   ): NTSTATUS; stdcall;
10073 begin
10074   GetProcedureAddress(_NtAcceptConnectPort, ntdll, 'NtAcceptConnectPort');
10075   Result := TFNNtAcceptConnectPort(_NtAcceptConnectPort)(
10076     PortHandle, PortIdentifier, Message, Accept, WriteSection, ReadSection
10077   );
10078 end;
10079 
10080 // Dynamic version of NtAccessCheck
10081 function  NtAccessCheck(
10082     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10083     TokenHandle : HANDLE;
10084     DesiredAccess : ACCESS_MASK;
10085     GenericMapping : PGENERIC_MAPPING;
10086     PrivilegeSet : PPRIVILEGE_SET;
10087     PrivilegeSetLength : PULONG;
10088     GrantedAccess : PACCESS_MASK;
10089     AccessStatus : PBOOLEAN
10090   ): NTSTATUS; stdcall;
10091 begin
10092   GetProcedureAddress(_NtAccessCheck, ntdll, 'NtAccessCheck');
10093   Result := TFNNtAccessCheck(_NtAccessCheck)(
10094     SecurityDescriptor, TokenHandle, DesiredAccess, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus
10095   );
10096 end;
10097 
10098 // Dynamic version of NtAccessCheck
10099 function  ZwAccessCheck(
10100     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10101     TokenHandle : HANDLE;
10102     DesiredAccess : ACCESS_MASK;
10103     GenericMapping : PGENERIC_MAPPING;
10104     PrivilegeSet : PPRIVILEGE_SET;
10105     PrivilegeSetLength : PULONG;
10106     GrantedAccess : PACCESS_MASK;
10107     AccessStatus : PBOOLEAN
10108   ): NTSTATUS; stdcall;
10109 begin
10110   GetProcedureAddress(_NtAccessCheck, ntdll, 'NtAccessCheck');
10111   Result := TFNNtAccessCheck(_NtAccessCheck)(
10112     SecurityDescriptor, TokenHandle, DesiredAccess, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus
10113   );
10114 end;
10115 
10116 // Dynamic version of NtAccessCheckAndAuditAlarm
10117 function  NtAccessCheckAndAuditAlarm(
10118     SubsystemName : PUNICODE_STRING;
10119     HandleId : PVOID;
10120     ObjectTypeName : PUNICODE_STRING;
10121     ObjectName : PUNICODE_STRING;
10122     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10123     DesiredAccess : ACCESS_MASK;
10124     GenericMapping : PGENERIC_MAPPING;
10125     ObjectCreation : BOOLEAN;
10126     GrantedAccess : PACCESS_MASK;
10127     AccessStatus : PBOOLEAN;
10128     GenerateOnClose : PBOOLEAN
10129   ): NTSTATUS; stdcall;
10130 begin
10131   GetProcedureAddress(_NtAccessCheckAndAuditAlarm, ntdll, 'NtAccessCheckAndAuditAlarm');
10132   Result := TFNNtAccessCheckAndAuditAlarm(_NtAccessCheckAndAuditAlarm)(
10133     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, GenerateOnClose
10134   );
10135 end;
10136 
10137 // Dynamic version of NtAccessCheckAndAuditAlarm
10138 function  ZwAccessCheckAndAuditAlarm(
10139     SubsystemName : PUNICODE_STRING;
10140     HandleId : PVOID;
10141     ObjectTypeName : PUNICODE_STRING;
10142     ObjectName : PUNICODE_STRING;
10143     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10144     DesiredAccess : ACCESS_MASK;
10145     GenericMapping : PGENERIC_MAPPING;
10146     ObjectCreation : BOOLEAN;
10147     GrantedAccess : PACCESS_MASK;
10148     AccessStatus : PBOOLEAN;
10149     GenerateOnClose : PBOOLEAN
10150   ): NTSTATUS; stdcall;
10151 begin
10152   GetProcedureAddress(_NtAccessCheckAndAuditAlarm, ntdll, 'NtAccessCheckAndAuditAlarm');
10153   Result := TFNNtAccessCheckAndAuditAlarm(_NtAccessCheckAndAuditAlarm)(
10154     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, GenerateOnClose
10155   );
10156 end;
10157 
10158 // Dynamic version of NtAccessCheckByType
10159 function  NtAccessCheckByType(
10160     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10161     PrincipalSelfSid : PSID;
10162     TokenHandle : HANDLE;
10163     DesiredAccess : ACCESS_MASK;
10164     ObjectTypeList : POBJECT_TYPE_LIST;
10165     ObjectTypeListLength : ULONG;
10166     GenericMapping : PGENERIC_MAPPING;
10167     PrivilegeSet : PPRIVILEGE_SET;
10168     PrivilegeSetLength : PULONG;
10169     GrantedAccess : PACCESS_MASK;
10170     AccessStatus : PULONG
10171   ): NTSTATUS; stdcall;
10172 begin
10173   GetProcedureAddress(_NtAccessCheckByType, ntdll, 'NtAccessCheckByType');
10174   Result := TFNNtAccessCheckByType(_NtAccessCheckByType)(
10175     SecurityDescriptor, PrincipalSelfSid, TokenHandle, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus
10176   );
10177 end;
10178 
10179 // Dynamic version of NtAccessCheckByType
10180 function  ZwAccessCheckByType(
10181     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10182     PrincipalSelfSid : PSID;
10183     TokenHandle : HANDLE;
10184     DesiredAccess : ACCESS_MASK;
10185     ObjectTypeList : POBJECT_TYPE_LIST;
10186     ObjectTypeListLength : ULONG;
10187     GenericMapping : PGENERIC_MAPPING;
10188     PrivilegeSet : PPRIVILEGE_SET;
10189     PrivilegeSetLength : PULONG;
10190     GrantedAccess : PACCESS_MASK;
10191     AccessStatus : PULONG
10192   ): NTSTATUS; stdcall;
10193 begin
10194   GetProcedureAddress(_NtAccessCheckByType, ntdll, 'NtAccessCheckByType');
10195   Result := TFNNtAccessCheckByType(_NtAccessCheckByType)(
10196     SecurityDescriptor, PrincipalSelfSid, TokenHandle, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus
10197   );
10198 end;
10199 
10200 // Dynamic version of NtAccessCheckByTypeAndAuditAlarm
10201 function  NtAccessCheckByTypeAndAuditAlarm(
10202     SubsystemName : PUNICODE_STRING;
10203     HandleId : PVOID;
10204     ObjectTypeName : PUNICODE_STRING;
10205     ObjectName : PUNICODE_STRING;
10206     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10207     PrincipalSelfSid : PSID;
10208     DesiredAccess : ACCESS_MASK;
10209     AuditType : AUDIT_EVENT_TYPE;
10210     Flags : ULONG;
10211     ObjectTypeList : POBJECT_TYPE_LIST;
10212     ObjectTypeListLength : ULONG;
10213     GenericMapping : PGENERIC_MAPPING;
10214     ObjectCreation : BOOLEAN;
10215     GrantedAccess : PACCESS_MASK;
10216     AccessStatus : PULONG;
10217     GenerateOnClose : PBOOLEAN
10218   ): NTSTATUS; stdcall;
10219 begin
10220   GetProcedureAddress(_NtAccessCheckByTypeAndAuditAlarm, ntdll, 'NtAccessCheckByTypeAndAuditAlarm');
10221   Result := TFNNtAccessCheckByTypeAndAuditAlarm(_NtAccessCheckByTypeAndAuditAlarm)(
10222     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus,
10223     GenerateOnClose
10224   );
10225 end;
10226 
10227 // Dynamic version of NtAccessCheckByTypeAndAuditAlarm
10228 function  ZwAccessCheckByTypeAndAuditAlarm(
10229     SubsystemName : PUNICODE_STRING;
10230     HandleId : PVOID;
10231     ObjectTypeName : PUNICODE_STRING;
10232     ObjectName : PUNICODE_STRING;
10233     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10234     PrincipalSelfSid : PSID;
10235     DesiredAccess : ACCESS_MASK;
10236     AuditType : AUDIT_EVENT_TYPE;
10237     Flags : ULONG;
10238     ObjectTypeList : POBJECT_TYPE_LIST;
10239     ObjectTypeListLength : ULONG;
10240     GenericMapping : PGENERIC_MAPPING;
10241     ObjectCreation : BOOLEAN;
10242     GrantedAccess : PACCESS_MASK;
10243     AccessStatus : PULONG;
10244     GenerateOnClose : PBOOLEAN
10245   ): NTSTATUS; stdcall;
10246 begin
10247   GetProcedureAddress(_NtAccessCheckByTypeAndAuditAlarm, ntdll, 'NtAccessCheckByTypeAndAuditAlarm');
10248   Result := TFNNtAccessCheckByTypeAndAuditAlarm(_NtAccessCheckByTypeAndAuditAlarm)(
10249     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus,
10250     GenerateOnClose
10251   );
10252 end;
10253 
10254 // Dynamic version of NtAccessCheckByTypeResultList
10255 function  NtAccessCheckByTypeResultList(
10256     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10257     PrincipalSelfSid : PSID;
10258     TokenHandle : HANDLE;
10259     DesiredAccess : ACCESS_MASK;
10260     ObjectTypeList : POBJECT_TYPE_LIST;
10261     ObjectTypeListLength : ULONG;
10262     GenericMapping : PGENERIC_MAPPING;
10263     PrivilegeSet : PPRIVILEGE_SET;
10264     PrivilegeSetLength : PULONG;
10265     GrantedAccessList : PACCESS_MASK;
10266     AccessStatusList : PULONG
10267   ): NTSTATUS; stdcall;
10268 begin
10269   GetProcedureAddress(_NtAccessCheckByTypeResultList, ntdll, 'NtAccessCheckByTypeResultList');
10270   Result := TFNNtAccessCheckByTypeResultList(_NtAccessCheckByTypeResultList)(
10271     SecurityDescriptor, PrincipalSelfSid, TokenHandle, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccessList, AccessStatusList
10272   );
10273 end;
10274 
10275 // Dynamic version of NtAccessCheckByTypeResultList
10276 function  ZwAccessCheckByTypeResultList(
10277     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10278     PrincipalSelfSid : PSID;
10279     TokenHandle : HANDLE;
10280     DesiredAccess : ACCESS_MASK;
10281     ObjectTypeList : POBJECT_TYPE_LIST;
10282     ObjectTypeListLength : ULONG;
10283     GenericMapping : PGENERIC_MAPPING;
10284     PrivilegeSet : PPRIVILEGE_SET;
10285     PrivilegeSetLength : PULONG;
10286     GrantedAccessList : PACCESS_MASK;
10287     AccessStatusList : PULONG
10288   ): NTSTATUS; stdcall;
10289 begin
10290   GetProcedureAddress(_NtAccessCheckByTypeResultList, ntdll, 'NtAccessCheckByTypeResultList');
10291   Result := TFNNtAccessCheckByTypeResultList(_NtAccessCheckByTypeResultList)(
10292     SecurityDescriptor, PrincipalSelfSid, TokenHandle, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccessList, AccessStatusList
10293   );
10294 end;
10295 
10296 // Dynamic version of NtAccessCheckByTypeResultListAndAuditAlarm
10297 function  NtAccessCheckByTypeResultListAndAuditAlarm(
10298     SubsystemName : PUNICODE_STRING;
10299     HandleId : PVOID;
10300     ObjectTypeName : PUNICODE_STRING;
10301     ObjectName : PUNICODE_STRING;
10302     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10303     PrincipalSelfSid : PSID;
10304     DesiredAccess : ACCESS_MASK;
10305     AuditType : AUDIT_EVENT_TYPE;
10306     Flags : ULONG;
10307     ObjectTypeList : POBJECT_TYPE_LIST;
10308     ObjectTypeListLength : ULONG;
10309     GenericMapping : PGENERIC_MAPPING;
10310     ObjectCreation : BOOLEAN;
10311     GrantedAccessList : PACCESS_MASK;
10312     AccessStatusList : PULONG;
10313     GenerateOnClose : PULONG
10314   ): NTSTATUS; stdcall;
10315 begin
10316   GetProcedureAddress(_NtAccessCheckByTypeResultListAndAuditAlarm, ntdll, 'NtAccessCheckByTypeResultListAndAuditAlarm');
10317   Result := TFNNtAccessCheckByTypeResultListAndAuditAlarm(_NtAccessCheckByTypeResultListAndAuditAlarm)(
10318     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccessList, AccessStatusList,
10319     GenerateOnClose
10320   );
10321 end;
10322 
10323 // Dynamic version of NtAccessCheckByTypeResultListAndAuditAlarm
10324 function  ZwAccessCheckByTypeResultListAndAuditAlarm(
10325     SubsystemName : PUNICODE_STRING;
10326     HandleId : PVOID;
10327     ObjectTypeName : PUNICODE_STRING;
10328     ObjectName : PUNICODE_STRING;
10329     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10330     PrincipalSelfSid : PSID;
10331     DesiredAccess : ACCESS_MASK;
10332     AuditType : AUDIT_EVENT_TYPE;
10333     Flags : ULONG;
10334     ObjectTypeList : POBJECT_TYPE_LIST;
10335     ObjectTypeListLength : ULONG;
10336     GenericMapping : PGENERIC_MAPPING;
10337     ObjectCreation : BOOLEAN;
10338     GrantedAccessList : PACCESS_MASK;
10339     AccessStatusList : PULONG;
10340     GenerateOnClose : PULONG
10341   ): NTSTATUS; stdcall;
10342 begin
10343   GetProcedureAddress(_NtAccessCheckByTypeResultListAndAuditAlarm, ntdll, 'NtAccessCheckByTypeResultListAndAuditAlarm');
10344   Result := TFNNtAccessCheckByTypeResultListAndAuditAlarm(_NtAccessCheckByTypeResultListAndAuditAlarm)(
10345     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccessList, AccessStatusList,
10346     GenerateOnClose
10347   );
10348 end;
10349 
10350 // Dynamic version of NtAccessCheckByTypeResultListAndAuditAlarmByHandle
10351 function  NtAccessCheckByTypeResultListAndAuditAlarmByHandle(
10352     SubsystemName : PUNICODE_STRING;
10353     HandleId : PVOID;
10354     TokenHandle : HANDLE;
10355     ObjectTypeName : PUNICODE_STRING;
10356     ObjectName : PUNICODE_STRING;
10357     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10358     PrincipalSelfSid : PSID;
10359     DesiredAccess : ACCESS_MASK;
10360     AuditType : AUDIT_EVENT_TYPE;
10361     Flags : ULONG;
10362     ObjectTypeList : POBJECT_TYPE_LIST;
10363     ObjectTypeListLength : ULONG;
10364     GenericMapping : PGENERIC_MAPPING;
10365     ObjectCreation : BOOLEAN;
10366     GrantedAccessList : PACCESS_MASK;
10367     AccessStatusList : PULONG;
10368     GenerateOnClose : PULONG
10369   ): NTSTATUS; stdcall;
10370 begin
10371   GetProcedureAddress(_NtAccessCheckByTypeResultListAndAuditAlarmByHandle, ntdll, 'NtAccessCheckByTypeResultListAndAuditAlarmByHandle');
10372   Result := TFNNtAccessCheckByTypeResultListAndAuditAlarmByHandle(_NtAccessCheckByTypeResultListAndAuditAlarmByHandle)(
10373     SubsystemName, HandleId, TokenHandle, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccessList,
10374     AccessStatusList, GenerateOnClose
10375   );
10376 end;
10377 
10378 // Dynamic version of NtAccessCheckByTypeResultListAndAuditAlarmByHandle
10379 function  ZwAccessCheckByTypeResultListAndAuditAlarmByHandle(
10380     SubsystemName : PUNICODE_STRING;
10381     HandleId : PVOID;
10382     TokenHandle : HANDLE;
10383     ObjectTypeName : PUNICODE_STRING;
10384     ObjectName : PUNICODE_STRING;
10385     SecurityDescriptor : PSECURITY_DESCRIPTOR;
10386     PrincipalSelfSid : PSID;
10387     DesiredAccess : ACCESS_MASK;
10388     AuditType : AUDIT_EVENT_TYPE;
10389     Flags : ULONG;
10390     ObjectTypeList : POBJECT_TYPE_LIST;
10391     ObjectTypeListLength : ULONG;
10392     GenericMapping : PGENERIC_MAPPING;
10393     ObjectCreation : BOOLEAN;
10394     GrantedAccessList : PACCESS_MASK;
10395     AccessStatusList : PULONG;
10396     GenerateOnClose : PULONG
10397   ): NTSTATUS; stdcall;
10398 begin
10399   GetProcedureAddress(_NtAccessCheckByTypeResultListAndAuditAlarmByHandle, ntdll, 'NtAccessCheckByTypeResultListAndAuditAlarmByHandle');
10400   Result := TFNNtAccessCheckByTypeResultListAndAuditAlarmByHandle(_NtAccessCheckByTypeResultListAndAuditAlarmByHandle)(
10401     SubsystemName, HandleId, TokenHandle, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccessList,
10402     AccessStatusList, GenerateOnClose
10403   );
10404 end;
10405 
10406 // Dynamic version of NtAddAtom
10407 function  NtAddAtom(
10408     Str : PWSTR;
10409     StringLength : ULONG;
10410     Atom : PUSHORT
10411   ): NTSTATUS; stdcall;
10412 begin
10413   GetProcedureAddress(_NtAddAtom, ntdll, 'NtAddAtom');
10414   Result := TFNNtAddAtom(_NtAddAtom)(
10415     Str, StringLength, Atom
10416   );
10417 end;
10418 
10419 // Dynamic version of NtAddAtom
10420 function  ZwAddAtom(
10421     Str : PWSTR;
10422     StringLength : ULONG;
10423     Atom : PUSHORT
10424   ): NTSTATUS; stdcall;
10425 begin
10426   GetProcedureAddress(_NtAddAtom, ntdll, 'NtAddAtom');
10427   Result := TFNNtAddAtom(_NtAddAtom)(
10428     Str, StringLength, Atom
10429   );
10430 end;
10431 
10432 // Dynamic version of NtAdjustGroupsToken
10433 function  NtAdjustGroupsToken(
10434     TokenHandle : HANDLE;
10435     ResetToDefault : BOOLEAN;
10436     NewState : PTOKEN_GROUPS;
10437     BufferLength : ULONG;
10438     PreviousState : PTOKEN_GROUPS;
10439     ReturnLength : PULONG
10440   ): NTSTATUS; stdcall;
10441 begin
10442   GetProcedureAddress(_NtAdjustGroupsToken, ntdll, 'NtAdjustGroupsToken');
10443   Result := TFNNtAdjustGroupsToken(_NtAdjustGroupsToken)(
10444     TokenHandle, ResetToDefault, NewState, BufferLength, PreviousState, ReturnLength
10445   );
10446 end;
10447 
10448 // Dynamic version of NtAdjustGroupsToken
10449 function  ZwAdjustGroupsToken(
10450     TokenHandle : HANDLE;
10451     ResetToDefault : BOOLEAN;
10452     NewState : PTOKEN_GROUPS;
10453     BufferLength : ULONG;
10454     PreviousState : PTOKEN_GROUPS;
10455     ReturnLength : PULONG
10456   ): NTSTATUS; stdcall;
10457 begin
10458   GetProcedureAddress(_NtAdjustGroupsToken, ntdll, 'NtAdjustGroupsToken');
10459   Result := TFNNtAdjustGroupsToken(_NtAdjustGroupsToken)(
10460     TokenHandle, ResetToDefault, NewState, BufferLength, PreviousState, ReturnLength
10461   );
10462 end;
10463 
10464 // Dynamic version of NtAdjustPrivilegesToken
10465 function  NtAdjustPrivilegesToken(
10466     TokenHandle : HANDLE;
10467     DisableAllPrivileges : BOOLEAN;
10468     NewState : PTOKEN_PRIVILEGES;
10469     BufferLength : ULONG;
10470     PreviousState : PTOKEN_PRIVILEGES;
10471     ReturnLength : PULONG
10472   ): NTSTATUS; stdcall;
10473 begin
10474   GetProcedureAddress(_NtAdjustPrivilegesToken, ntdll, 'NtAdjustPrivilegesToken');
10475   Result := TFNNtAdjustPrivilegesToken(_NtAdjustPrivilegesToken)(
10476     TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength
10477   );
10478 end;
10479 
10480 // Dynamic version of NtAdjustPrivilegesToken
10481 function  ZwAdjustPrivilegesToken(
10482     TokenHandle : HANDLE;
10483     DisableAllPrivileges : BOOLEAN;
10484     NewState : PTOKEN_PRIVILEGES;
10485     BufferLength : ULONG;
10486     PreviousState : PTOKEN_PRIVILEGES;
10487     ReturnLength : PULONG
10488   ): NTSTATUS; stdcall;
10489 begin
10490   GetProcedureAddress(_NtAdjustPrivilegesToken, ntdll, 'NtAdjustPrivilegesToken');
10491   Result := TFNNtAdjustPrivilegesToken(_NtAdjustPrivilegesToken)(
10492     TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength
10493   );
10494 end;
10495 
10496 // Dynamic version of NtAlertResumeThread
10497 function  NtAlertResumeThread(
10498     ThreadHandle : HANDLE;
10499     PreviousSuspendCount : PULONG
10500   ): NTSTATUS; stdcall;
10501 begin
10502   GetProcedureAddress(_NtAlertResumeThread, ntdll, 'NtAlertResumeThread');
10503   Result := TFNNtAlertResumeThread(_NtAlertResumeThread)(
10504     ThreadHandle, PreviousSuspendCount
10505   );
10506 end;
10507 
10508 // Dynamic version of NtAlertResumeThread
10509 function  ZwAlertResumeThread(
10510     ThreadHandle : HANDLE;
10511     PreviousSuspendCount : PULONG
10512   ): NTSTATUS; stdcall;
10513 begin
10514   GetProcedureAddress(_NtAlertResumeThread, ntdll, 'NtAlertResumeThread');
10515   Result := TFNNtAlertResumeThread(_NtAlertResumeThread)(
10516     ThreadHandle, PreviousSuspendCount
10517   );
10518 end;
10519 
10520 // Dynamic version of NtAlertThread
10521 function  NtAlertThread(
10522     ThreadHandle : HANDLE
10523   ): NTSTATUS; stdcall;
10524 begin
10525   GetProcedureAddress(_NtAlertThread, ntdll, 'NtAlertThread');
10526   Result := TFNNtAlertThread(_NtAlertThread)(
10527     ThreadHandle
10528   );
10529 end;
10530 
10531 // Dynamic version of NtAlertThread
10532 function  ZwAlertThread(
10533     ThreadHandle : HANDLE
10534   ): NTSTATUS; stdcall;
10535 begin
10536   GetProcedureAddress(_NtAlertThread, ntdll, 'NtAlertThread');
10537   Result := TFNNtAlertThread(_NtAlertThread)(
10538     ThreadHandle
10539   );
10540 end;
10541 
10542 // Dynamic version of NtAllocateLocallyUniqueId
10543 function  NtAllocateLocallyUniqueId(
10544     Luid : PLUID
10545   ): NTSTATUS; stdcall;
10546 begin
10547   GetProcedureAddress(_NtAllocateLocallyUniqueId, ntdll, 'NtAllocateLocallyUniqueId');
10548   Result := TFNNtAllocateLocallyUniqueId(_NtAllocateLocallyUniqueId)(
10549     Luid
10550   );
10551 end;
10552 
10553 // Dynamic version of NtAllocateLocallyUniqueId
10554 function  ZwAllocateLocallyUniqueId(
10555     Luid : PLUID
10556   ): NTSTATUS; stdcall;
10557 begin
10558   GetProcedureAddress(_NtAllocateLocallyUniqueId, ntdll, 'NtAllocateLocallyUniqueId');
10559   Result := TFNNtAllocateLocallyUniqueId(_NtAllocateLocallyUniqueId)(
10560     Luid
10561   );
10562 end;
10563 
10564 // Dynamic version of NtAllocateUserPhysicalPages
10565 function  NtAllocateUserPhysicalPages(
10566     ProcessHandle : HANDLE;
10567     NumberOfPages : PULONG;
10568     PageFrameNumbers : PULONG
10569   ): NTSTATUS; stdcall;
10570 begin
10571   GetProcedureAddress(_NtAllocateUserPhysicalPages, ntdll, 'NtAllocateUserPhysicalPages');
10572   Result := TFNNtAllocateUserPhysicalPages(_NtAllocateUserPhysicalPages)(
10573     ProcessHandle, NumberOfPages, PageFrameNumbers
10574   );
10575 end;
10576 
10577 // Dynamic version of NtAllocateUserPhysicalPages
10578 function  ZwAllocateUserPhysicalPages(
10579     ProcessHandle : HANDLE;
10580     NumberOfPages : PULONG;
10581     PageFrameNumbers : PULONG
10582   ): NTSTATUS; stdcall;
10583 begin
10584   GetProcedureAddress(_NtAllocateUserPhysicalPages, ntdll, 'NtAllocateUserPhysicalPages');
10585   Result := TFNNtAllocateUserPhysicalPages(_NtAllocateUserPhysicalPages)(
10586     ProcessHandle, NumberOfPages, PageFrameNumbers
10587   );
10588 end;
10589 
10590 // Dynamic version of NtAllocateUuids
10591 function  NtAllocateUuids(
10592     UuidLastTimeAllocated : PLARGE_INTEGER;
10593     UuidDeltaTime : PULONG;
10594     UuidSequenceNumber : PULONG;
10595     UuidSeed : PUCHAR
10596   ): NTSTATUS; stdcall;
10597 begin
10598   GetProcedureAddress(_NtAllocateUuids, ntdll, 'NtAllocateUuids');
10599   Result := TFNNtAllocateUuids(_NtAllocateUuids)(
10600     UuidLastTimeAllocated, UuidDeltaTime, UuidSequenceNumber, UuidSeed
10601   );
10602 end;
10603 
10604 // Dynamic version of NtAllocateUuids
10605 function  ZwAllocateUuids(
10606     UuidLastTimeAllocated : PLARGE_INTEGER;
10607     UuidDeltaTime : PULONG;
10608     UuidSequenceNumber : PULONG;
10609     UuidSeed : PUCHAR
10610   ): NTSTATUS; stdcall;
10611 begin
10612   GetProcedureAddress(_NtAllocateUuids, ntdll, 'NtAllocateUuids');
10613   Result := TFNNtAllocateUuids(_NtAllocateUuids)(
10614     UuidLastTimeAllocated, UuidDeltaTime, UuidSequenceNumber, UuidSeed
10615   );
10616 end;
10617 
10618 // Dynamic version of NtAllocateVirtualMemory
10619 function  NtAllocateVirtualMemory(
10620     ProcessHandle : HANDLE;
10621     BaseAddress : PPVOID;
10622     ZeroBits : ULONG;
10623     AllocationSize : PULONG;
10624     AllocationType : ULONG;
10625     Protect : ULONG
10626   ): NTSTATUS; stdcall;
10627 begin
10628   GetProcedureAddress(_NtAllocateVirtualMemory, ntdll, 'NtAllocateVirtualMemory');
10629   Result := TFNNtAllocateVirtualMemory(_NtAllocateVirtualMemory)(
10630     ProcessHandle, BaseAddress, ZeroBits, AllocationSize, AllocationType, Protect
10631   );
10632 end;
10633 
10634 // Dynamic version of NtAllocateVirtualMemory
10635 function  ZwAllocateVirtualMemory(
10636     ProcessHandle : HANDLE;
10637     BaseAddress : PPVOID;
10638     ZeroBits : ULONG;
10639     AllocationSize : PULONG;
10640     AllocationType : ULONG;
10641     Protect : ULONG
10642   ): NTSTATUS; stdcall;
10643 begin
10644   GetProcedureAddress(_NtAllocateVirtualMemory, ntdll, 'NtAllocateVirtualMemory');
10645   Result := TFNNtAllocateVirtualMemory(_NtAllocateVirtualMemory)(
10646     ProcessHandle, BaseAddress, ZeroBits, AllocationSize, AllocationType, Protect
10647   );
10648 end;
10649 
10650 // Dynamic version of NtAreMappedFilesTheSame
10651 function  NtAreMappedFilesTheSame(
10652     Address1 : PVOID;
10653     Address2 : PVOID
10654   ): NTSTATUS; stdcall;
10655 begin
10656   GetProcedureAddress(_NtAreMappedFilesTheSame, ntdll, 'NtAreMappedFilesTheSame');
10657   Result := TFNNtAreMappedFilesTheSame(_NtAreMappedFilesTheSame)(
10658     Address1, Address2
10659   );
10660 end;
10661 
10662 // Dynamic version of NtAreMappedFilesTheSame
10663 function  ZwAreMappedFilesTheSame(
10664     Address1 : PVOID;
10665     Address2 : PVOID
10666   ): NTSTATUS; stdcall;
10667 begin
10668   GetProcedureAddress(_NtAreMappedFilesTheSame, ntdll, 'NtAreMappedFilesTheSame');
10669   Result := TFNNtAreMappedFilesTheSame(_NtAreMappedFilesTheSame)(
10670     Address1, Address2
10671   );
10672 end;
10673 
10674 // Dynamic version of NtAssignProcessToJobObject
10675 function  NtAssignProcessToJobObject(
10676     JobHandle : HANDLE;
10677     ProcessHandle : HANDLE
10678   ): NTSTATUS; stdcall;
10679 begin
10680   GetProcedureAddress(_NtAssignProcessToJobObject, ntdll, 'NtAssignProcessToJobObject');
10681   Result := TFNNtAssignProcessToJobObject(_NtAssignProcessToJobObject)(
10682     JobHandle, ProcessHandle
10683   );
10684 end;
10685 
10686 // Dynamic version of NtAssignProcessToJobObject
10687 function  ZwAssignProcessToJobObject(
10688     JobHandle : HANDLE;
10689     ProcessHandle : HANDLE
10690   ): NTSTATUS; stdcall;
10691 begin
10692   GetProcedureAddress(_NtAssignProcessToJobObject, ntdll, 'NtAssignProcessToJobObject');
10693   Result := TFNNtAssignProcessToJobObject(_NtAssignProcessToJobObject)(
10694     JobHandle, ProcessHandle
10695   );
10696 end;
10697 
10698 // Dynamic version of NtCallbackReturn
10699 function  NtCallbackReturn(
10700     Result_ : PVOID;
10701     ResultLength : ULONG;
10702     Status : NTSTATUS
10703   ): NTSTATUS; stdcall;
10704 begin
10705   GetProcedureAddress(_NtCallbackReturn, ntdll, 'NtCallbackReturn');
10706   Result := TFNNtCallbackReturn(_NtCallbackReturn)(
10707     Result_, ResultLength, Status
10708   );
10709 end;
10710 
10711 // Dynamic version of NtCallbackReturn
10712 function  ZwCallbackReturn(
10713     Result_ : PVOID;
10714     ResultLength : ULONG;
10715     Status : NTSTATUS
10716   ): NTSTATUS; stdcall;
10717 begin
10718   GetProcedureAddress(_NtCallbackReturn, ntdll, 'NtCallbackReturn');
10719   Result := TFNNtCallbackReturn(_NtCallbackReturn)(
10720     Result_, ResultLength, Status
10721   );
10722 end;
10723 
10724 // Dynamic version of NtCancelDeviceWakeupRequest
10725 function  NtCancelDeviceWakeupRequest(
10726     DeviceHandle : HANDLE
10727   ): NTSTATUS; stdcall;
10728 begin
10729   GetProcedureAddress(_NtCancelDeviceWakeupRequest, ntdll, 'NtCancelDeviceWakeupRequest');
10730   Result := TFNNtCancelDeviceWakeupRequest(_NtCancelDeviceWakeupRequest)(
10731     DeviceHandle
10732   );
10733 end;
10734 
10735 // Dynamic version of NtCancelDeviceWakeupRequest
10736 function  ZwCancelDeviceWakeupRequest(
10737     DeviceHandle : HANDLE
10738   ): NTSTATUS; stdcall;
10739 begin
10740   GetProcedureAddress(_NtCancelDeviceWakeupRequest, ntdll, 'NtCancelDeviceWakeupRequest');
10741   Result := TFNNtCancelDeviceWakeupRequest(_NtCancelDeviceWakeupRequest)(
10742     DeviceHandle
10743   );
10744 end;
10745 
10746 // Dynamic version of NtCancelIoFile
10747 function  NtCancelIoFile(
10748     FileHandle : HANDLE;
10749     IoStatusBlock : PIO_STATUS_BLOCK
10750   ): NTSTATUS; stdcall;
10751 begin
10752   GetProcedureAddress(_NtCancelIoFile, ntdll, 'NtCancelIoFile');
10753   Result := TFNNtCancelIoFile(_NtCancelIoFile)(
10754     FileHandle, IoStatusBlock
10755   );
10756 end;
10757 
10758 // Dynamic version of NtCancelIoFile
10759 function  ZwCancelIoFile(
10760     FileHandle : HANDLE;
10761     IoStatusBlock : PIO_STATUS_BLOCK
10762   ): NTSTATUS; stdcall;
10763 begin
10764   GetProcedureAddress(_NtCancelIoFile, ntdll, 'NtCancelIoFile');
10765   Result := TFNNtCancelIoFile(_NtCancelIoFile)(
10766     FileHandle, IoStatusBlock
10767   );
10768 end;
10769 
10770 // Dynamic version of NtCancelTimer
10771 function  NtCancelTimer(
10772     TimerHandle : HANDLE;
10773     PreviousState : PBOOLEAN
10774   ): NTSTATUS; stdcall;
10775 begin
10776   GetProcedureAddress(_NtCancelTimer, ntdll, 'NtCancelTimer');
10777   Result := TFNNtCancelTimer(_NtCancelTimer)(
10778     TimerHandle, PreviousState
10779   );
10780 end;
10781 
10782 // Dynamic version of NtCancelTimer
10783 function  ZwCancelTimer(
10784     TimerHandle : HANDLE;
10785     PreviousState : PBOOLEAN
10786   ): NTSTATUS; stdcall;
10787 begin
10788   GetProcedureAddress(_NtCancelTimer, ntdll, 'NtCancelTimer');
10789   Result := TFNNtCancelTimer(_NtCancelTimer)(
10790     TimerHandle, PreviousState
10791   );
10792 end;
10793 
10794 // Dynamic version of NtClearEvent
10795 function  NtClearEvent(
10796     EventHandle : HANDLE
10797   ): NTSTATUS; stdcall;
10798 begin
10799   GetProcedureAddress(_NtClearEvent, ntdll, 'NtClearEvent');
10800   Result := TFNNtClearEvent(_NtClearEvent)(
10801     EventHandle
10802   );
10803 end;
10804 
10805 // Dynamic version of NtClearEvent
10806 function  ZwClearEvent(
10807     EventHandle : HANDLE
10808   ): NTSTATUS; stdcall;
10809 begin
10810   GetProcedureAddress(_NtClearEvent, ntdll, 'NtClearEvent');
10811   Result := TFNNtClearEvent(_NtClearEvent)(
10812     EventHandle
10813   );
10814 end;
10815 
10816 {$IFNDEF JWA_INCLUDEMODE}
10817 // Dynamic version of NtClose
10818 function  NtClose(
10819     Handle : HANDLE
10820   ): NTSTATUS; stdcall;
10821 begin
10822   GetProcedureAddress(_NtClose, ntdll, 'NtClose');
10823   Result := TFNNtClose(_NtClose)(
10824     Handle
10825   );
10826 end;
10827 {$ENDIF JWA_INCLUDEMODE}
10828 
10829 // Dynamic version of NtClose
10830 function  ZwClose(
10831     Handle : HANDLE
10832   ): NTSTATUS; stdcall;
10833 begin
10834   GetProcedureAddress(_NtClose, ntdll, 'NtClose');
10835   Result := TFNNtClose(_NtClose)(
10836     Handle
10837   );
10838 end;
10839 
10840 // Dynamic version of NtCloseObjectAuditAlarm
10841 function  NtCloseObjectAuditAlarm(
10842     SubsystemName : PUNICODE_STRING;
10843     HandleId : PVOID;
10844     GenerateOnClose : BOOLEAN
10845   ): NTSTATUS; stdcall;
10846 begin
10847   GetProcedureAddress(_NtCloseObjectAuditAlarm, ntdll, 'NtCloseObjectAuditAlarm');
10848   Result := TFNNtCloseObjectAuditAlarm(_NtCloseObjectAuditAlarm)(
10849     SubsystemName, HandleId, GenerateOnClose
10850   );
10851 end;
10852 
10853 // Dynamic version of NtCloseObjectAuditAlarm
10854 function  ZwCloseObjectAuditAlarm(
10855     SubsystemName : PUNICODE_STRING;
10856     HandleId : PVOID;
10857     GenerateOnClose : BOOLEAN
10858   ): NTSTATUS; stdcall;
10859 begin
10860   GetProcedureAddress(_NtCloseObjectAuditAlarm, ntdll, 'NtCloseObjectAuditAlarm');
10861   Result := TFNNtCloseObjectAuditAlarm(_NtCloseObjectAuditAlarm)(
10862     SubsystemName, HandleId, GenerateOnClose
10863   );
10864 end;
10865 
10866 // Dynamic version of NtCompleteConnectPort
10867 function  NtCompleteConnectPort(
10868     PortHandle : HANDLE
10869   ): NTSTATUS; stdcall;
10870 begin
10871   GetProcedureAddress(_NtCompleteConnectPort, ntdll, 'NtCompleteConnectPort');
10872   Result := TFNNtCompleteConnectPort(_NtCompleteConnectPort)(
10873     PortHandle
10874   );
10875 end;
10876 
10877 // Dynamic version of NtCompleteConnectPort
10878 function  ZwCompleteConnectPort(
10879     PortHandle : HANDLE
10880   ): NTSTATUS; stdcall;
10881 begin
10882   GetProcedureAddress(_NtCompleteConnectPort, ntdll, 'NtCompleteConnectPort');
10883   Result := TFNNtCompleteConnectPort(_NtCompleteConnectPort)(
10884     PortHandle
10885   );
10886 end;
10887 
10888 // Dynamic version of NtConnectPort
10889 function  NtConnectPort(
10890     PortHandle : PHANDLE;
10891     PortName : PUNICODE_STRING;
10892     SecurityQos : PSECURITY_QUALITY_OF_SERVICE;
10893     WriteSection : PPORT_SECTION_WRITE;
10894     ReadSection : PPORT_SECTION_READ;
10895     MaxMessageSize : PULONG;
10896     ConnectData : PVOID;
10897     ConnectDataLength : PULONG
10898   ): NTSTATUS; stdcall;
10899 begin
10900   GetProcedureAddress(_NtConnectPort, ntdll, 'NtConnectPort');
10901   Result := TFNNtConnectPort(_NtConnectPort)(
10902     PortHandle, PortName, SecurityQos, WriteSection, ReadSection, MaxMessageSize, ConnectData, ConnectDataLength
10903   );
10904 end;
10905 
10906 // Dynamic version of NtConnectPort
10907 function  ZwConnectPort(
10908     PortHandle : PHANDLE;
10909     PortName : PUNICODE_STRING;
10910     SecurityQos : PSECURITY_QUALITY_OF_SERVICE;
10911     WriteSection : PPORT_SECTION_WRITE;
10912     ReadSection : PPORT_SECTION_READ;
10913     MaxMessageSize : PULONG;
10914     ConnectData : PVOID;
10915     ConnectDataLength : PULONG
10916   ): NTSTATUS; stdcall;
10917 begin
10918   GetProcedureAddress(_NtConnectPort, ntdll, 'NtConnectPort');
10919   Result := TFNNtConnectPort(_NtConnectPort)(
10920     PortHandle, PortName, SecurityQos, WriteSection, ReadSection, MaxMessageSize, ConnectData, ConnectDataLength
10921   );
10922 end;
10923 
10924 // Dynamic version of NtContinue
10925 function  NtContinue(
10926     Context : PCONTEXT;
10927     TestAlert : BOOLEAN
10928   ): NTSTATUS; stdcall;
10929 begin
10930   GetProcedureAddress(_NtContinue, ntdll, 'NtContinue');
10931   Result := TFNNtContinue(_NtContinue)(
10932     Context, TestAlert
10933   );
10934 end;
10935 
10936 // Dynamic version of NtContinue
10937 function  ZwContinue(
10938     Context : PCONTEXT;
10939     TestAlert : BOOLEAN
10940   ): NTSTATUS; stdcall;
10941 begin
10942   GetProcedureAddress(_NtContinue, ntdll, 'NtContinue');
10943   Result := TFNNtContinue(_NtContinue)(
10944     Context, TestAlert
10945   );
10946 end;
10947 
10948 // Dynamic version of NtCreateChannel
10949 function  NtCreateChannel(
10950     ChannelHandle : PHANDLE;
10951     ObjectAttributes : POBJECT_ATTRIBUTES
10952   ): NTSTATUS; stdcall;
10953 begin
10954   GetProcedureAddress(_NtCreateChannel, ntdll, 'NtCreateChannel');
10955   Result := TFNNtCreateChannel(_NtCreateChannel)(
10956     ChannelHandle, ObjectAttributes
10957   );
10958 end;
10959 
10960 // Dynamic version of NtCreateChannel
10961 function  ZwCreateChannel(
10962     ChannelHandle : PHANDLE;
10963     ObjectAttributes : POBJECT_ATTRIBUTES
10964   ): NTSTATUS; stdcall;
10965 begin
10966   GetProcedureAddress(_NtCreateChannel, ntdll, 'NtCreateChannel');
10967   Result := TFNNtCreateChannel(_NtCreateChannel)(
10968     ChannelHandle, ObjectAttributes
10969   );
10970 end;
10971 
10972 // Dynamic version of NtCreateDirectoryObject
10973 function  NtCreateDirectoryObject(
10974     DirectoryHandle : PHANDLE;
10975     DesiredAccess : ACCESS_MASK;
10976     ObjectAttributes : POBJECT_ATTRIBUTES
10977   ): NTSTATUS; stdcall;
10978 begin
10979   GetProcedureAddress(_NtCreateDirectoryObject, ntdll, 'NtCreateDirectoryObject');
10980   Result := TFNNtCreateDirectoryObject(_NtCreateDirectoryObject)(
10981     DirectoryHandle, DesiredAccess, ObjectAttributes
10982   );
10983 end;
10984 
10985 // Dynamic version of NtCreateDirectoryObject
10986 function  ZwCreateDirectoryObject(
10987     DirectoryHandle : PHANDLE;
10988     DesiredAccess : ACCESS_MASK;
10989     ObjectAttributes : POBJECT_ATTRIBUTES
10990   ): NTSTATUS; stdcall;
10991 begin
10992   GetProcedureAddress(_NtCreateDirectoryObject, ntdll, 'NtCreateDirectoryObject');
10993   Result := TFNNtCreateDirectoryObject(_NtCreateDirectoryObject)(
10994     DirectoryHandle, DesiredAccess, ObjectAttributes
10995   );
10996 end;
10997 
10998 // Dynamic version of NtCreateEvent
10999 function  NtCreateEvent(
11000     EventHandle : PHANDLE;
11001     DesiredAccess : ACCESS_MASK;
11002     ObjectAttributes : POBJECT_ATTRIBUTES;
11003     EventType : EVENT_TYPE;
11004     InitialState : BOOLEAN
11005   ): NTSTATUS; stdcall;
11006 begin
11007   GetProcedureAddress(_NtCreateEvent, ntdll, 'NtCreateEvent');
11008   Result := TFNNtCreateEvent(_NtCreateEvent)(
11009     EventHandle, DesiredAccess, ObjectAttributes, EventType, InitialState
11010   );
11011 end;
11012 
11013 // Dynamic version of NtCreateEvent
11014 function  ZwCreateEvent(
11015     EventHandle : PHANDLE;
11016     DesiredAccess : ACCESS_MASK;
11017     ObjectAttributes : POBJECT_ATTRIBUTES;
11018     EventType : EVENT_TYPE;
11019     InitialState : BOOLEAN
11020   ): NTSTATUS; stdcall;
11021 begin
11022   GetProcedureAddress(_NtCreateEvent, ntdll, 'NtCreateEvent');
11023   Result := TFNNtCreateEvent(_NtCreateEvent)(
11024     EventHandle, DesiredAccess, ObjectAttributes, EventType, InitialState
11025   );
11026 end;
11027 
11028 // Dynamic version of NtCreateEventPair
11029 function  NtCreateEventPair(
11030     EventPairHandle : PHANDLE;
11031     DesiredAccess : ACCESS_MASK;
11032     ObjectAttributes : POBJECT_ATTRIBUTES
11033   ): NTSTATUS; stdcall;
11034 begin
11035   GetProcedureAddress(_NtCreateEventPair, ntdll, 'NtCreateEventPair');
11036   Result := TFNNtCreateEventPair(_NtCreateEventPair)(
11037     EventPairHandle, DesiredAccess, ObjectAttributes
11038   );
11039 end;
11040 
11041 // Dynamic version of NtCreateEventPair
11042 function  ZwCreateEventPair(
11043     EventPairHandle : PHANDLE;
11044     DesiredAccess : ACCESS_MASK;
11045     ObjectAttributes : POBJECT_ATTRIBUTES
11046   ): NTSTATUS; stdcall;
11047 begin
11048   GetProcedureAddress(_NtCreateEventPair, ntdll, 'NtCreateEventPair');
11049   Result := TFNNtCreateEventPair(_NtCreateEventPair)(
11050     EventPairHandle, DesiredAccess, ObjectAttributes
11051   );
11052 end;
11053 
11054 {$IFNDEF JWA_INCLUDEMODE}
11055 // Dynamic version of NtCreateFile
11056 function  NtCreateFile(
11057     FileHandle : PHANDLE;
11058     DesiredAccess : ACCESS_MASK;
11059     ObjectAttributes : POBJECT_ATTRIBUTES;
11060     IoStatusBlock : PIO_STATUS_BLOCK;
11061     AllocationSize : PLARGE_INTEGER;
11062     FileAttributes : ULONG;
11063     ShareAccess : ULONG;
11064     CreateDisposition : ULONG;
11065     CreateOptions : ULONG;
11066     EaBuffer : PVOID;
11067     EaLength : ULONG
11068   ): NTSTATUS; stdcall;
11069 begin
11070   GetProcedureAddress(_NtCreateFile, ntdll, 'NtCreateFile');
11071   Result := TFNNtCreateFile(_NtCreateFile)(
11072     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, EaBuffer, EaLength
11073   );
11074 end;
11075 {$ENDIF JWA_INCLUDEMODE}
11076 
11077 // Dynamic version of NtCreateFile
11078 function  ZwCreateFile(
11079     FileHandle : PHANDLE;
11080     DesiredAccess : ACCESS_MASK;
11081     ObjectAttributes : POBJECT_ATTRIBUTES;
11082     IoStatusBlock : PIO_STATUS_BLOCK;
11083     AllocationSize : PLARGE_INTEGER;
11084     FileAttributes : ULONG;
11085     ShareAccess : ULONG;
11086     CreateDisposition : ULONG;
11087     CreateOptions : ULONG;
11088     EaBuffer : PVOID;
11089     EaLength : ULONG
11090   ): NTSTATUS; stdcall;
11091 begin
11092   GetProcedureAddress(_NtCreateFile, ntdll, 'NtCreateFile');
11093   Result := TFNNtCreateFile(_NtCreateFile)(
11094     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, EaBuffer, EaLength
11095   );
11096 end;
11097 
11098 // Dynamic version of NtCreateIoCompletion
11099 function  NtCreateIoCompletion(
11100     IoCompletionHandle : PHANDLE;
11101     DesiredAccess : ACCESS_MASK;
11102     ObjectAttributes : POBJECT_ATTRIBUTES;
11103     NumberOfConcurrentThreads : ULONG
11104   ): NTSTATUS; stdcall;
11105 begin
11106   GetProcedureAddress(_NtCreateIoCompletion, ntdll, 'NtCreateIoCompletion');
11107   Result := TFNNtCreateIoCompletion(_NtCreateIoCompletion)(
11108     IoCompletionHandle, DesiredAccess, ObjectAttributes, NumberOfConcurrentThreads
11109   );
11110 end;
11111 
11112 // Dynamic version of NtCreateIoCompletion
11113 function  ZwCreateIoCompletion(
11114     IoCompletionHandle : PHANDLE;
11115     DesiredAccess : ACCESS_MASK;
11116     ObjectAttributes : POBJECT_ATTRIBUTES;
11117     NumberOfConcurrentThreads : ULONG
11118   ): NTSTATUS; stdcall;
11119 begin
11120   GetProcedureAddress(_NtCreateIoCompletion, ntdll, 'NtCreateIoCompletion');
11121   Result := TFNNtCreateIoCompletion(_NtCreateIoCompletion)(
11122     IoCompletionHandle, DesiredAccess, ObjectAttributes, NumberOfConcurrentThreads
11123   );
11124 end;
11125 
11126 // Dynamic version of NtCreateJobObject
11127 function  NtCreateJobObject(
11128     JobHandle : PHANDLE;
11129     DesiredAccess : ACCESS_MASK;
11130     ObjectAttributes : POBJECT_ATTRIBUTES
11131   ): NTSTATUS; stdcall;
11132 begin
11133   GetProcedureAddress(_NtCreateJobObject, ntdll, 'NtCreateJobObject');
11134   Result := TFNNtCreateJobObject(_NtCreateJobObject)(
11135     JobHandle, DesiredAccess, ObjectAttributes
11136   );
11137 end;
11138 
11139 // Dynamic version of NtCreateJobObject
11140 function  ZwCreateJobObject(
11141     JobHandle : PHANDLE;
11142     DesiredAccess : ACCESS_MASK;
11143     ObjectAttributes : POBJECT_ATTRIBUTES
11144   ): NTSTATUS; stdcall;
11145 begin
11146   GetProcedureAddress(_NtCreateJobObject, ntdll, 'NtCreateJobObject');
11147   Result := TFNNtCreateJobObject(_NtCreateJobObject)(
11148     JobHandle, DesiredAccess, ObjectAttributes
11149   );
11150 end;
11151 
11152 // Dynamic version of NtCreateKey
11153 function  NtCreateKey(
11154     KeyHandle : PHANDLE;
11155     DesiredAccess : ACCESS_MASK;
11156     ObjectAttributes : POBJECT_ATTRIBUTES;
11157     TitleIndex : ULONG;
11158     Class_ : PUNICODE_STRING;
11159     CreateOptions : ULONG;
11160     Disposition : PULONG
11161   ): NTSTATUS; stdcall;
11162 begin
11163   GetProcedureAddress(_NtCreateKey, ntdll, 'NtCreateKey');
11164   Result := TFNNtCreateKey(_NtCreateKey)(
11165     KeyHandle, DesiredAccess, ObjectAttributes, TitleIndex, Class_, CreateOptions, Disposition
11166   );
11167 end;
11168 
11169 // Dynamic version of NtCreateKey
11170 function  ZwCreateKey(
11171     KeyHandle : PHANDLE;
11172     DesiredAccess : ACCESS_MASK;
11173     ObjectAttributes : POBJECT_ATTRIBUTES;
11174     TitleIndex : ULONG;
11175     Class_ : PUNICODE_STRING;
11176     CreateOptions : ULONG;
11177     Disposition : PULONG
11178   ): NTSTATUS; stdcall;
11179 begin
11180   GetProcedureAddress(_NtCreateKey, ntdll, 'NtCreateKey');
11181   Result := TFNNtCreateKey(_NtCreateKey)(
11182     KeyHandle, DesiredAccess, ObjectAttributes, TitleIndex, Class_, CreateOptions, Disposition
11183   );
11184 end;
11185 
11186 // Dynamic version of NtCreateMailslotFile
11187 function  NtCreateMailslotFile(
11188     FileHandle : PHANDLE;
11189     DesiredAccess : ACCESS_MASK;
11190     ObjectAttributes : POBJECT_ATTRIBUTES;
11191     IoStatusBlock : PIO_STATUS_BLOCK;
11192     CreateOptions : ULONG;
11193     Unknown : ULONG;
11194     MaxMessageSize : ULONG;
11195     ReadTimeout : PLARGE_INTEGER
11196   ): NTSTATUS; stdcall;
11197 begin
11198   GetProcedureAddress(_NtCreateMailslotFile, ntdll, 'NtCreateMailslotFile');
11199   Result := TFNNtCreateMailslotFile(_NtCreateMailslotFile)(
11200     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, CreateOptions, Unknown, MaxMessageSize, ReadTimeout
11201   );
11202 end;
11203 
11204 // Dynamic version of NtCreateMailslotFile
11205 function  ZwCreateMailslotFile(
11206     FileHandle : PHANDLE;
11207     DesiredAccess : ACCESS_MASK;
11208     ObjectAttributes : POBJECT_ATTRIBUTES;
11209     IoStatusBlock : PIO_STATUS_BLOCK;
11210     CreateOptions : ULONG;
11211     Unknown : ULONG;
11212     MaxMessageSize : ULONG;
11213     ReadTimeout : PLARGE_INTEGER
11214   ): NTSTATUS; stdcall;
11215 begin
11216   GetProcedureAddress(_NtCreateMailslotFile, ntdll, 'NtCreateMailslotFile');
11217   Result := TFNNtCreateMailslotFile(_NtCreateMailslotFile)(
11218     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, CreateOptions, Unknown, MaxMessageSize, ReadTimeout
11219   );
11220 end;
11221 
11222 // Dynamic version of NtCreateMutant
11223 function  NtCreateMutant(
11224     MutantHandle : PHANDLE;
11225     DesiredAccess : ACCESS_MASK;
11226     ObjectAttributes : POBJECT_ATTRIBUTES;
11227     InitialOwner : BOOLEAN
11228   ): NTSTATUS; stdcall;
11229 begin
11230   GetProcedureAddress(_NtCreateMutant, ntdll, 'NtCreateMutant');
11231   Result := TFNNtCreateMutant(_NtCreateMutant)(
11232     MutantHandle, DesiredAccess, ObjectAttributes, InitialOwner
11233   );
11234 end;
11235 
11236 // Dynamic version of NtCreateMutant
11237 function  ZwCreateMutant(
11238     MutantHandle : PHANDLE;
11239     DesiredAccess : ACCESS_MASK;
11240     ObjectAttributes : POBJECT_ATTRIBUTES;
11241     InitialOwner : BOOLEAN
11242   ): NTSTATUS; stdcall;
11243 begin
11244   GetProcedureAddress(_NtCreateMutant, ntdll, 'NtCreateMutant');
11245   Result := TFNNtCreateMutant(_NtCreateMutant)(
11246     MutantHandle, DesiredAccess, ObjectAttributes, InitialOwner
11247   );
11248 end;
11249 
11250 // Dynamic version of NtCreateNamedPipeFile
11251 function  NtCreateNamedPipeFile(
11252     FileHandle : PHANDLE;
11253     DesiredAccess : ACCESS_MASK;
11254     ObjectAttributes : POBJECT_ATTRIBUTES;
11255     IoStatusBlock : PIO_STATUS_BLOCK;
11256     ShareAccess : ULONG;
11257     CreateDisposition : ULONG;
11258     CreateOptions : ULONG;
11259     TypeMessage : BOOLEAN;
11260     ReadmodeMessage : BOOLEAN;
11261     Nonblocking : BOOLEAN;
11262     MaxInstances : ULONG;
11263     InBufferSize : ULONG;
11264     OutBufferSize : ULONG;
11265     DefaultTimeout : PLARGE_INTEGER
11266   ): NTSTATUS; stdcall;
11267 begin
11268   GetProcedureAddress(_NtCreateNamedPipeFile, ntdll, 'NtCreateNamedPipeFile');
11269   Result := TFNNtCreateNamedPipeFile(_NtCreateNamedPipeFile)(
11270     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, ShareAccess, CreateDisposition, CreateOptions, TypeMessage, ReadmodeMessage, Nonblocking, MaxInstances, InBufferSize, OutBufferSize, DefaultTimeout
11271   );
11272 end;
11273 
11274 // Dynamic version of NtCreateNamedPipeFile
11275 function  ZwCreateNamedPipeFile(
11276     FileHandle : PHANDLE;
11277     DesiredAccess : ACCESS_MASK;
11278     ObjectAttributes : POBJECT_ATTRIBUTES;
11279     IoStatusBlock : PIO_STATUS_BLOCK;
11280     ShareAccess : ULONG;
11281     CreateDisposition : ULONG;
11282     CreateOptions : ULONG;
11283     TypeMessage : BOOLEAN;
11284     ReadmodeMessage : BOOLEAN;
11285     Nonblocking : BOOLEAN;
11286     MaxInstances : ULONG;
11287     InBufferSize : ULONG;
11288     OutBufferSize : ULONG;
11289     DefaultTimeout : PLARGE_INTEGER
11290   ): NTSTATUS; stdcall;
11291 begin
11292   GetProcedureAddress(_NtCreateNamedPipeFile, ntdll, 'NtCreateNamedPipeFile');
11293   Result := TFNNtCreateNamedPipeFile(_NtCreateNamedPipeFile)(
11294     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, ShareAccess, CreateDisposition, CreateOptions, TypeMessage, ReadmodeMessage, Nonblocking, MaxInstances, InBufferSize, OutBufferSize, DefaultTimeout
11295   );
11296 end;
11297 
11298 // Dynamic version of NtCreatePagingFile
11299 function  NtCreatePagingFile(
11300     FileName : PUNICODE_STRING;
11301     InitialSize : PULARGE_INTEGER;
11302     MaximumSize : PULARGE_INTEGER;
11303     Reserved : ULONG
11304   ): NTSTATUS; stdcall;
11305 begin
11306   GetProcedureAddress(_NtCreatePagingFile, ntdll, 'NtCreatePagingFile');
11307   Result := TFNNtCreatePagingFile(_NtCreatePagingFile)(
11308     FileName, InitialSize, MaximumSize, Reserved
11309   );
11310 end;
11311 
11312 // Dynamic version of NtCreatePagingFile
11313 function  ZwCreatePagingFile(
11314     FileName : PUNICODE_STRING;
11315     InitialSize : PULARGE_INTEGER;
11316     MaximumSize : PULARGE_INTEGER;
11317     Reserved : ULONG
11318   ): NTSTATUS; stdcall;
11319 begin
11320   GetProcedureAddress(_NtCreatePagingFile, ntdll, 'NtCreatePagingFile');
11321   Result := TFNNtCreatePagingFile(_NtCreatePagingFile)(
11322     FileName, InitialSize, MaximumSize, Reserved
11323   );
11324 end;
11325 
11326 // Dynamic version of NtCreatePort
11327 function  NtCreatePort(
11328     PortHandle : PHANDLE;
11329     ObjectAttributes : POBJECT_ATTRIBUTES;
11330     MaxDataSize : ULONG;
11331     MaxMessageSize : ULONG;
11332     Reserved : ULONG
11333   ): NTSTATUS; stdcall;
11334 begin
11335   GetProcedureAddress(_NtCreatePort, ntdll, 'NtCreatePort');
11336   Result := TFNNtCreatePort(_NtCreatePort)(
11337     PortHandle, ObjectAttributes, MaxDataSize, MaxMessageSize, Reserved
11338   );
11339 end;
11340 
11341 // Dynamic version of NtCreatePort
11342 function  ZwCreatePort(
11343     PortHandle : PHANDLE;
11344     ObjectAttributes : POBJECT_ATTRIBUTES;
11345     MaxDataSize : ULONG;
11346     MaxMessageSize : ULONG;
11347     Reserved : ULONG
11348   ): NTSTATUS; stdcall;
11349 begin
11350   GetProcedureAddress(_NtCreatePort, ntdll, 'NtCreatePort');
11351   Result := TFNNtCreatePort(_NtCreatePort)(
11352     PortHandle, ObjectAttributes, MaxDataSize, MaxMessageSize, Reserved
11353   );
11354 end;
11355 
11356 // Dynamic version of NtCreateProcess
11357 function  NtCreateProcess(
11358     ProcessHandle : PHANDLE;
11359     DesiredAccess : ACCESS_MASK;
11360     ObjectAttributes : POBJECT_ATTRIBUTES;
11361     InheritFromProcessHandle : HANDLE;
11362     InheritHandles : BOOLEAN;
11363     SectionHandle : HANDLE;
11364     DebugPort : HANDLE;
11365     ExceptionPort : HANDLE
11366   ): NTSTATUS; stdcall;
11367 begin
11368   GetProcedureAddress(_NtCreateProcess, ntdll, 'NtCreateProcess');
11369   Result := TFNNtCreateProcess(_NtCreateProcess)(
11370     ProcessHandle, DesiredAccess, ObjectAttributes, InheritFromProcessHandle, InheritHandles, SectionHandle, DebugPort, ExceptionPort
11371   );
11372 end;
11373 
11374 // Dynamic version of NtCreateProcess
11375 function  ZwCreateProcess(
11376     ProcessHandle : PHANDLE;
11377     DesiredAccess : ACCESS_MASK;
11378     ObjectAttributes : POBJECT_ATTRIBUTES;
11379     InheritFromProcessHandle : HANDLE;
11380     InheritHandles : BOOLEAN;
11381     SectionHandle : HANDLE;
11382     DebugPort : HANDLE;
11383     ExceptionPort : HANDLE
11384   ): NTSTATUS; stdcall;
11385 begin
11386   GetProcedureAddress(_NtCreateProcess, ntdll, 'NtCreateProcess');
11387   Result := TFNNtCreateProcess(_NtCreateProcess)(
11388     ProcessHandle, DesiredAccess, ObjectAttributes, InheritFromProcessHandle, InheritHandles, SectionHandle, DebugPort, ExceptionPort
11389   );
11390 end;
11391 
11392 // Dynamic version of NtCreateProfile
11393 function  NtCreateProfile(
11394     ProfileHandle : PHANDLE;
11395     ProcessHandle : HANDLE;
11396     Base : PVOID;
11397     Size : ULONG;
11398     BucketShift : ULONG;
11399     Buffer : PULONG;
11400     BufferLength : ULONG;
11401     Source : KPROFILE_SOURCE;
11402     ProcessorMask : ULONG
11403   ): NTSTATUS; stdcall;
11404 begin
11405   GetProcedureAddress(_NtCreateProfile, ntdll, 'NtCreateProfile');
11406   Result := TFNNtCreateProfile(_NtCreateProfile)(
11407     ProfileHandle, ProcessHandle, Base, Size, BucketShift, Buffer, BufferLength, Source, ProcessorMask
11408   );
11409 end;
11410 
11411 // Dynamic version of NtCreateProfile
11412 function  ZwCreateProfile(
11413     ProfileHandle : PHANDLE;
11414     ProcessHandle : HANDLE;
11415     Base : PVOID;
11416     Size : ULONG;
11417     BucketShift : ULONG;
11418     Buffer : PULONG;
11419     BufferLength : ULONG;
11420     Source : KPROFILE_SOURCE;
11421     ProcessorMask : ULONG
11422   ): NTSTATUS; stdcall;
11423 begin
11424   GetProcedureAddress(_NtCreateProfile, ntdll, 'NtCreateProfile');
11425   Result := TFNNtCreateProfile(_NtCreateProfile)(
11426     ProfileHandle, ProcessHandle, Base, Size, BucketShift, Buffer, BufferLength, Source, ProcessorMask
11427   );
11428 end;
11429 
11430 // Dynamic version of NtCreateSection
11431 function  NtCreateSection(
11432     SectionHandle : PHANDLE;
11433     DesiredAccess : ACCESS_MASK;
11434     ObjectAttributes : POBJECT_ATTRIBUTES;
11435     SectionSize : PLARGE_INTEGER;
11436     Protect : ULONG;
11437     Attributes : ULONG;
11438     FileHandle : HANDLE
11439   ): NTSTATUS; stdcall;
11440 begin
11441   GetProcedureAddress(_NtCreateSection, ntdll, 'NtCreateSection');
11442   Result := TFNNtCreateSection(_NtCreateSection)(
11443     SectionHandle, DesiredAccess, ObjectAttributes, SectionSize, Protect, Attributes, FileHandle
11444   );
11445 end;
11446 
11447 // Dynamic version of NtCreateSection
11448 function  ZwCreateSection(
11449     SectionHandle : PHANDLE;
11450     DesiredAccess : ACCESS_MASK;
11451     ObjectAttributes : POBJECT_ATTRIBUTES;
11452     SectionSize : PLARGE_INTEGER;
11453     Protect : ULONG;
11454     Attributes : ULONG;
11455     FileHandle : HANDLE
11456   ): NTSTATUS; stdcall;
11457 begin
11458   GetProcedureAddress(_NtCreateSection, ntdll, 'NtCreateSection');
11459   Result := TFNNtCreateSection(_NtCreateSection)(
11460     SectionHandle, DesiredAccess, ObjectAttributes, SectionSize, Protect, Attributes, FileHandle
11461   );
11462 end;
11463 
11464 // Dynamic version of NtCreateSemaphore
11465 function  NtCreateSemaphore(
11466     SemaphoreHandle : PHANDLE;
11467     DesiredAccess : ACCESS_MASK;
11468     ObjectAttributes : POBJECT_ATTRIBUTES;
11469     InitialCount : LONG;
11470     MaximumCount : LONG
11471   ): NTSTATUS; stdcall;
11472 begin
11473   GetProcedureAddress(_NtCreateSemaphore, ntdll, 'NtCreateSemaphore');
11474   Result := TFNNtCreateSemaphore(_NtCreateSemaphore)(
11475     SemaphoreHandle, DesiredAccess, ObjectAttributes, InitialCount, MaximumCount
11476   );
11477 end;
11478 
11479 // Dynamic version of NtCreateSemaphore
11480 function  ZwCreateSemaphore(
11481     SemaphoreHandle : PHANDLE;
11482     DesiredAccess : ACCESS_MASK;
11483     ObjectAttributes : POBJECT_ATTRIBUTES;
11484     InitialCount : LONG;
11485     MaximumCount : LONG
11486   ): NTSTATUS; stdcall;
11487 begin
11488   GetProcedureAddress(_NtCreateSemaphore, ntdll, 'NtCreateSemaphore');
11489   Result := TFNNtCreateSemaphore(_NtCreateSemaphore)(
11490     SemaphoreHandle, DesiredAccess, ObjectAttributes, InitialCount, MaximumCount
11491   );
11492 end;
11493 
11494 // Dynamic version of NtCreateSymbolicLinkObject
11495 function  NtCreateSymbolicLinkObject(
11496     SymbolicLinkHandle : PHANDLE;
11497     DesiredAccess : ACCESS_MASK;
11498     ObjectAttributes : POBJECT_ATTRIBUTES;
11499     TargetName : PUNICODE_STRING
11500   ): NTSTATUS; stdcall;
11501 begin
11502   GetProcedureAddress(_NtCreateSymbolicLinkObject, ntdll, 'NtCreateSymbolicLinkObject');
11503   Result := TFNNtCreateSymbolicLinkObject(_NtCreateSymbolicLinkObject)(
11504     SymbolicLinkHandle, DesiredAccess, ObjectAttributes, TargetName
11505   );
11506 end;
11507 
11508 // Dynamic version of NtCreateSymbolicLinkObject
11509 function  ZwCreateSymbolicLinkObject(
11510     SymbolicLinkHandle : PHANDLE;
11511     DesiredAccess : ACCESS_MASK;
11512     ObjectAttributes : POBJECT_ATTRIBUTES;
11513     TargetName : PUNICODE_STRING
11514   ): NTSTATUS; stdcall;
11515 begin
11516   GetProcedureAddress(_NtCreateSymbolicLinkObject, ntdll, 'NtCreateSymbolicLinkObject');
11517   Result := TFNNtCreateSymbolicLinkObject(_NtCreateSymbolicLinkObject)(
11518     SymbolicLinkHandle, DesiredAccess, ObjectAttributes, TargetName
11519   );
11520 end;
11521 
11522 // Dynamic version of NtCreateThread
11523 function  NtCreateThread(
11524     ThreadHandle : PHANDLE;
11525     DesiredAccess : ACCESS_MASK;
11526     ObjectAttributes : POBJECT_ATTRIBUTES;
11527     ProcessHandle : HANDLE;
11528     ClientId : PCLIENT_ID;
11529     ThreadContext : PCONTEXT;
11530     UserStack : PUSER_STACK;
11531     CreateSuspended : BOOLEAN
11532   ): NTSTATUS; stdcall;
11533 begin
11534   GetProcedureAddress(_NtCreateThread, ntdll, 'NtCreateThread');
11535   Result := TFNNtCreateThread(_NtCreateThread)(
11536     ThreadHandle, DesiredAccess, ObjectAttributes, ProcessHandle, ClientId, ThreadContext, UserStack, CreateSuspended
11537   );
11538 end;
11539 
11540 // Dynamic version of NtCreateThread
11541 function  ZwCreateThread(
11542     ThreadHandle : PHANDLE;
11543     DesiredAccess : ACCESS_MASK;
11544     ObjectAttributes : POBJECT_ATTRIBUTES;
11545     ProcessHandle : HANDLE;
11546     ClientId : PCLIENT_ID;
11547     ThreadContext : PCONTEXT;
11548     UserStack : PUSER_STACK;
11549     CreateSuspended : BOOLEAN
11550   ): NTSTATUS; stdcall;
11551 begin
11552   GetProcedureAddress(_NtCreateThread, ntdll, 'NtCreateThread');
11553   Result := TFNNtCreateThread(_NtCreateThread)(
11554     ThreadHandle, DesiredAccess, ObjectAttributes, ProcessHandle, ClientId, ThreadContext, UserStack, CreateSuspended
11555   );
11556 end;
11557 
11558 // Dynamic version of NtCreateTimer
11559 function  NtCreateTimer(
11560     TimerHandle : PHANDLE;
11561     DesiredAccess : ACCESS_MASK;
11562     ObjectAttributes : POBJECT_ATTRIBUTES;
11563     TimerType : TIMER_TYPE
11564   ): NTSTATUS; stdcall;
11565 begin
11566   GetProcedureAddress(_NtCreateTimer, ntdll, 'NtCreateTimer');
11567   Result := TFNNtCreateTimer(_NtCreateTimer)(
11568     TimerHandle, DesiredAccess, ObjectAttributes, TimerType
11569   );
11570 end;
11571 
11572 // Dynamic version of NtCreateTimer
11573 function  ZwCreateTimer(
11574     TimerHandle : PHANDLE;
11575     DesiredAccess : ACCESS_MASK;
11576     ObjectAttributes : POBJECT_ATTRIBUTES;
11577     TimerType : TIMER_TYPE
11578   ): NTSTATUS; stdcall;
11579 begin
11580   GetProcedureAddress(_NtCreateTimer, ntdll, 'NtCreateTimer');
11581   Result := TFNNtCreateTimer(_NtCreateTimer)(
11582     TimerHandle, DesiredAccess, ObjectAttributes, TimerType
11583   );
11584 end;
11585 
11586 // Dynamic version of NtCreateToken
11587 function  NtCreateToken(
11588     TokenHandle : PHANDLE;
11589     DesiredAccess : ACCESS_MASK;
11590     ObjectAttributes : POBJECT_ATTRIBUTES;
11591     Type_ : TOKEN_TYPE;
11592     AuthenticationId : PLUID;
11593     ExpirationTime : PLARGE_INTEGER;
11594     User : PTOKEN_USER;
11595     Groups : PTOKEN_GROUPS;
11596     Privileges : PTOKEN_PRIVILEGES;
11597     Owner : PTOKEN_OWNER;
11598     PrimaryGroup : PTOKEN_PRIMARY_GROUP;
11599     DefaultDacl : PTOKEN_DEFAULT_DACL;
11600     Source : PTOKEN_SOURCE
11601   ): NTSTATUS; stdcall;
11602 begin
11603   GetProcedureAddress(_NtCreateToken, ntdll, 'NtCreateToken');
11604   Result := TFNNtCreateToken(_NtCreateToken)(
11605     TokenHandle, DesiredAccess, ObjectAttributes, Type_, AuthenticationId, ExpirationTime, User, Groups, Privileges, Owner, PrimaryGroup, DefaultDacl, Source
11606   );
11607 end;
11608 
11609 // Dynamic version of NtCreateToken
11610 function  ZwCreateToken(
11611     TokenHandle : PHANDLE;
11612     DesiredAccess : ACCESS_MASK;
11613     ObjectAttributes : POBJECT_ATTRIBUTES;
11614     Type_ : TOKEN_TYPE;
11615     AuthenticationId : PLUID;
11616     ExpirationTime : PLARGE_INTEGER;
11617     User : PTOKEN_USER;
11618     Groups : PTOKEN_GROUPS;
11619     Privileges : PTOKEN_PRIVILEGES;
11620     Owner : PTOKEN_OWNER;
11621     PrimaryGroup : PTOKEN_PRIMARY_GROUP;
11622     DefaultDacl : PTOKEN_DEFAULT_DACL;
11623     Source : PTOKEN_SOURCE
11624   ): NTSTATUS; stdcall;
11625 begin
11626   GetProcedureAddress(_NtCreateToken, ntdll, 'NtCreateToken');
11627   Result := TFNNtCreateToken(_NtCreateToken)(
11628     TokenHandle, DesiredAccess, ObjectAttributes, Type_, AuthenticationId, ExpirationTime, User, Groups, Privileges, Owner, PrimaryGroup, DefaultDacl, Source
11629   );
11630 end;
11631 
11632 // Dynamic version of NtCreateWaitablePort
11633 function  NtCreateWaitablePort(
11634     PortHandle : PHANDLE;
11635     ObjectAttributes : POBJECT_ATTRIBUTES;
11636     MaxDataSize : ULONG;
11637     MaxMessageSize : ULONG;
11638     Reserved : ULONG
11639   ): NTSTATUS; stdcall;
11640 begin
11641   GetProcedureAddress(_NtCreateWaitablePort, ntdll, 'NtCreateWaitablePort');
11642   Result := TFNNtCreateWaitablePort(_NtCreateWaitablePort)(
11643     PortHandle, ObjectAttributes, MaxDataSize, MaxMessageSize, Reserved
11644   );
11645 end;
11646 
11647 // Dynamic version of NtCreateWaitablePort
11648 function  ZwCreateWaitablePort(
11649     PortHandle : PHANDLE;
11650     ObjectAttributes : POBJECT_ATTRIBUTES;
11651     MaxDataSize : ULONG;
11652     MaxMessageSize : ULONG;
11653     Reserved : ULONG
11654   ): NTSTATUS; stdcall;
11655 begin
11656   GetProcedureAddress(_NtCreateWaitablePort, ntdll, 'NtCreateWaitablePort');
11657   Result := TFNNtCreateWaitablePort(_NtCreateWaitablePort)(
11658     PortHandle, ObjectAttributes, MaxDataSize, MaxMessageSize, Reserved
11659   );
11660 end;
11661 
11662 {.$IFNDEF JWA_INCLUDEMODE}
11663 
11664 // Dynamic version of NtCurrentTeb
11665 function  NtCurrentTeb(): PTEB; stdcall;
11666 begin
11667   GetProcedureAddress(_NtCurrentTeb, ntdll, 'NtCurrentTeb');
11668   Result := TFNNtCurrentTeb(_NtCurrentTeb)();
11669 end;
11670 {.$ENDIF JWA_INCLUDEMODE}
11671 
11672 // Dynamic version of NtCurrentTeb
11673 function  ZwCurrentTeb(): PTEB; stdcall;
11674 begin
11675   GetProcedureAddress(_NtCurrentTeb, ntdll, 'NtCurrentTeb');
11676   Result := TFNNtCurrentTeb(_NtCurrentTeb)();
11677 end;
11678 
11679 // Dynamic version of NtDebugActiveProcess
11680 function  NtDebugActiveProcess(
11681     hProcess : HANDLE;
11682     hDebugObject : HANDLE
11683   ): NTSTATUS; stdcall;
11684 begin
11685   GetProcedureAddress(_NtDebugActiveProcess, ntdll, 'NtDebugActiveProcess');
11686   Result := TFNNtDebugActiveProcess(_NtDebugActiveProcess)(
11687     hProcess, hDebugObject
11688   );
11689 end;
11690 
11691 // Dynamic version of NtDebugActiveProcess
11692 function  ZwDebugActiveProcess(
11693     hProcess : HANDLE;
11694     hDebugObject : HANDLE
11695   ): NTSTATUS; stdcall;
11696 begin
11697   GetProcedureAddress(_NtDebugActiveProcess, ntdll, 'NtDebugActiveProcess');
11698   Result := TFNNtDebugActiveProcess(_NtDebugActiveProcess)(
11699     hProcess, hDebugObject
11700   );
11701 end;
11702 
11703 // Dynamic version of NtDelayExecution
11704 function  NtDelayExecution(
11705     Alertable : BOOLEAN;
11706     Interval : PLARGE_INTEGER
11707   ): NTSTATUS; stdcall;
11708 begin
11709   GetProcedureAddress(_NtDelayExecution, ntdll, 'NtDelayExecution');
11710   Result := TFNNtDelayExecution(_NtDelayExecution)(
11711     Alertable, Interval
11712   );
11713 end;
11714 
11715 // Dynamic version of NtDelayExecution
11716 function  ZwDelayExecution(
11717     Alertable : BOOLEAN;
11718     Interval : PLARGE_INTEGER
11719   ): NTSTATUS; stdcall;
11720 begin
11721   GetProcedureAddress(_NtDelayExecution, ntdll, 'NtDelayExecution');
11722   Result := TFNNtDelayExecution(_NtDelayExecution)(
11723     Alertable, Interval
11724   );
11725 end;
11726 
11727 // Dynamic version of NtDeleteAtom
11728 function  NtDeleteAtom(
11729     Atom : USHORT
11730   ): NTSTATUS; stdcall;
11731 begin
11732   GetProcedureAddress(_NtDeleteAtom, ntdll, 'NtDeleteAtom');
11733   Result := TFNNtDeleteAtom(_NtDeleteAtom)(
11734     Atom
11735   );
11736 end;
11737 
11738 // Dynamic version of NtDeleteAtom
11739 function  ZwDeleteAtom(
11740     Atom : USHORT
11741   ): NTSTATUS; stdcall;
11742 begin
11743   GetProcedureAddress(_NtDeleteAtom, ntdll, 'NtDeleteAtom');
11744   Result := TFNNtDeleteAtom(_NtDeleteAtom)(
11745     Atom
11746   );
11747 end;
11748 
11749 // Dynamic version of NtDeleteFile
11750 function  NtDeleteFile(
11751     ObjectAttributes : POBJECT_ATTRIBUTES
11752   ): NTSTATUS; stdcall;
11753 begin
11754   GetProcedureAddress(_NtDeleteFile, ntdll, 'NtDeleteFile');
11755   Result := TFNNtDeleteFile(_NtDeleteFile)(
11756     ObjectAttributes
11757   );
11758 end;
11759 
11760 // Dynamic version of NtDeleteFile
11761 function  ZwDeleteFile(
11762     ObjectAttributes : POBJECT_ATTRIBUTES
11763   ): NTSTATUS; stdcall;
11764 begin
11765   GetProcedureAddress(_NtDeleteFile, ntdll, 'NtDeleteFile');
11766   Result := TFNNtDeleteFile(_NtDeleteFile)(
11767     ObjectAttributes
11768   );
11769 end;
11770 
11771 // Dynamic version of NtDeleteKey
11772 function  NtDeleteKey(
11773     KeyHandle : HANDLE
11774   ): NTSTATUS; stdcall;
11775 begin
11776   GetProcedureAddress(_NtDeleteKey, ntdll, 'NtDeleteKey');
11777   Result := TFNNtDeleteKey(_NtDeleteKey)(
11778     KeyHandle
11779   );
11780 end;
11781 
11782 // Dynamic version of NtDeleteKey
11783 function  ZwDeleteKey(
11784     KeyHandle : HANDLE
11785   ): NTSTATUS; stdcall;
11786 begin
11787   GetProcedureAddress(_NtDeleteKey, ntdll, 'NtDeleteKey');
11788   Result := TFNNtDeleteKey(_NtDeleteKey)(
11789     KeyHandle
11790   );
11791 end;
11792 
11793 // Dynamic version of NtDeleteObjectAuditAlarm
11794 function  NtDeleteObjectAuditAlarm(
11795     SubsystemName : PUNICODE_STRING;
11796     HandleId : PVOID;
11797     GenerateOnClose : BOOLEAN
11798   ): NTSTATUS; stdcall;
11799 begin
11800   GetProcedureAddress(_NtDeleteObjectAuditAlarm, ntdll, 'NtDeleteObjectAuditAlarm');
11801   Result := TFNNtDeleteObjectAuditAlarm(_NtDeleteObjectAuditAlarm)(
11802     SubsystemName, HandleId, GenerateOnClose
11803   );
11804 end;
11805 
11806 // Dynamic version of NtDeleteObjectAuditAlarm
11807 function  ZwDeleteObjectAuditAlarm(
11808     SubsystemName : PUNICODE_STRING;
11809     HandleId : PVOID;
11810     GenerateOnClose : BOOLEAN
11811   ): NTSTATUS; stdcall;
11812 begin
11813   GetProcedureAddress(_NtDeleteObjectAuditAlarm, ntdll, 'NtDeleteObjectAuditAlarm');
11814   Result := TFNNtDeleteObjectAuditAlarm(_NtDeleteObjectAuditAlarm)(
11815     SubsystemName, HandleId, GenerateOnClose
11816   );
11817 end;
11818 
11819 // Dynamic version of NtDeleteValueKey
11820 function  NtDeleteValueKey(
11821     KeyHandle : HANDLE;
11822     ValueName : PUNICODE_STRING
11823   ): NTSTATUS; stdcall;
11824 begin
11825   GetProcedureAddress(_NtDeleteValueKey, ntdll, 'NtDeleteValueKey');
11826   Result := TFNNtDeleteValueKey(_NtDeleteValueKey)(
11827     KeyHandle, ValueName
11828   );
11829 end;
11830 
11831 // Dynamic version of NtDeleteValueKey
11832 function  ZwDeleteValueKey(
11833     KeyHandle : HANDLE;
11834     ValueName : PUNICODE_STRING
11835   ): NTSTATUS; stdcall;
11836 begin
11837   GetProcedureAddress(_NtDeleteValueKey, ntdll, 'NtDeleteValueKey');
11838   Result := TFNNtDeleteValueKey(_NtDeleteValueKey)(
11839     KeyHandle, ValueName
11840   );
11841 end;
11842 
11843 {$IFNDEF JWA_INCLUDEMODE}
11844 // Dynamic version of NtDeviceIoControlFile
11845 function  NtDeviceIoControlFile(
11846     FileHandle : HANDLE;
11847     Event : HANDLE;
11848     ApcRoutine : PIO_APC_ROUTINE;
11849     ApcContext : PVOID;
11850     IoStatusBlock : PIO_STATUS_BLOCK;
11851     IoControlCode : ULONG;
11852     InputBuffer : PVOID;
11853     InputBufferLength : ULONG;
11854     OutputBuffer : PVOID;
11855     OutputBufferLength : ULONG
11856   ): NTSTATUS; stdcall;
11857 begin
11858   GetProcedureAddress(_NtDeviceIoControlFile, ntdll, 'NtDeviceIoControlFile');
11859   Result := TFNNtDeviceIoControlFile(_NtDeviceIoControlFile)(
11860     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, IoControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength
11861   );
11862 end;
11863 {$ENDIF JWA_INCLUDEMODE}
11864 
11865 // Dynamic version of NtDeviceIoControlFile
11866 function  ZwDeviceIoControlFile(
11867     FileHandle : HANDLE;
11868     Event : HANDLE;
11869     ApcRoutine : PIO_APC_ROUTINE;
11870     ApcContext : PVOID;
11871     IoStatusBlock : PIO_STATUS_BLOCK;
11872     IoControlCode : ULONG;
11873     InputBuffer : PVOID;
11874     InputBufferLength : ULONG;
11875     OutputBuffer : PVOID;
11876     OutputBufferLength : ULONG
11877   ): NTSTATUS; stdcall;
11878 begin
11879   GetProcedureAddress(_NtDeviceIoControlFile, ntdll, 'NtDeviceIoControlFile');
11880   Result := TFNNtDeviceIoControlFile(_NtDeviceIoControlFile)(
11881     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, IoControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength
11882   );
11883 end;
11884 
11885 // Dynamic version of NtDisplayString
11886 function  NtDisplayString(
11887     Str : PUNICODE_STRING
11888   ): NTSTATUS; stdcall;
11889 begin
11890   GetProcedureAddress(_NtDisplayString, ntdll, 'NtDisplayString');
11891   Result := TFNNtDisplayString(_NtDisplayString)(
11892     Str
11893   );
11894 end;
11895 
11896 // Dynamic version of NtDisplayString
11897 function  ZwDisplayString(
11898     Str : PUNICODE_STRING
11899   ): NTSTATUS; stdcall;
11900 begin
11901   GetProcedureAddress(_NtDisplayString, ntdll, 'NtDisplayString');
11902   Result := TFNNtDisplayString(_NtDisplayString)(
11903     Str
11904   );
11905 end;
11906 
11907 // Dynamic version of NtDuplicateObject
11908 function  NtDuplicateObject(
11909     SourceProcessHandle : HANDLE;
11910     SourceHandle : HANDLE;
11911     TargetProcessHandle : HANDLE;
11912     TargetHandle : PHANDLE;
11913     DesiredAccess : ACCESS_MASK;
11914     Attributes : ULONG;
11915     Options : ULONG
11916   ): NTSTATUS; stdcall;
11917 begin
11918   GetProcedureAddress(_NtDuplicateObject, ntdll, 'NtDuplicateObject');
11919   Result := TFNNtDuplicateObject(_NtDuplicateObject)(
11920     SourceProcessHandle, SourceHandle, TargetProcessHandle, TargetHandle, DesiredAccess, Attributes, Options
11921   );
11922 end;
11923 
11924 // Dynamic version of NtDuplicateObject
11925 function  ZwDuplicateObject(
11926     SourceProcessHandle : HANDLE;
11927     SourceHandle : HANDLE;
11928     TargetProcessHandle : HANDLE;
11929     TargetHandle : PHANDLE;
11930     DesiredAccess : ACCESS_MASK;
11931     Attributes : ULONG;
11932     Options : ULONG
11933   ): NTSTATUS; stdcall;
11934 begin
11935   GetProcedureAddress(_NtDuplicateObject, ntdll, 'NtDuplicateObject');
11936   Result := TFNNtDuplicateObject(_NtDuplicateObject)(
11937     SourceProcessHandle, SourceHandle, TargetProcessHandle, TargetHandle, DesiredAccess, Attributes, Options
11938   );
11939 end;
11940 
11941 // Dynamic version of NtDuplicateToken
11942 function  NtDuplicateToken(
11943     ExistingTokenHandle : HANDLE;
11944     DesiredAccess : ACCESS_MASK;
11945     ObjectAttributes : POBJECT_ATTRIBUTES;
11946     EffectiveOnly : BOOLEAN;
11947     TokenType : TOKEN_TYPE;
11948     NewTokenHandle : PHANDLE
11949   ): NTSTATUS; stdcall;
11950 begin
11951   GetProcedureAddress(_NtDuplicateToken, ntdll, 'NtDuplicateToken');
11952   Result := TFNNtDuplicateToken(_NtDuplicateToken)(
11953     ExistingTokenHandle, DesiredAccess, ObjectAttributes, EffectiveOnly, TokenType, NewTokenHandle
11954   );
11955 end;
11956 
11957 // Dynamic version of NtDuplicateToken
11958 function  ZwDuplicateToken(
11959     ExistingTokenHandle : HANDLE;
11960     DesiredAccess : ACCESS_MASK;
11961     ObjectAttributes : POBJECT_ATTRIBUTES;
11962     EffectiveOnly : BOOLEAN;
11963     TokenType : TOKEN_TYPE;
11964     NewTokenHandle : PHANDLE
11965   ): NTSTATUS; stdcall;
11966 begin
11967   GetProcedureAddress(_NtDuplicateToken, ntdll, 'NtDuplicateToken');
11968   Result := TFNNtDuplicateToken(_NtDuplicateToken)(
11969     ExistingTokenHandle, DesiredAccess, ObjectAttributes, EffectiveOnly, TokenType, NewTokenHandle
11970   );
11971 end;
11972 
11973 // Dynamic version of NtEnumerateKey
11974 function  NtEnumerateKey(
11975     KeyHandle : HANDLE;
11976     Index : ULONG;
11977     KeyInformationClass : KEY_INFORMATION_CLASS;
11978     KeyInformation : PVOID;
11979     KeyInformationLength : ULONG;
11980     ResultLength : PULONG
11981   ): NTSTATUS; stdcall;
11982 begin
11983   GetProcedureAddress(_NtEnumerateKey, ntdll, 'NtEnumerateKey');
11984   Result := TFNNtEnumerateKey(_NtEnumerateKey)(
11985     KeyHandle, Index, KeyInformationClass, KeyInformation, KeyInformationLength, ResultLength
11986   );
11987 end;
11988 
11989 // Dynamic version of NtEnumerateKey
11990 function  ZwEnumerateKey(
11991     KeyHandle : HANDLE;
11992     Index : ULONG;
11993     KeyInformationClass : KEY_INFORMATION_CLASS;
11994     KeyInformation : PVOID;
11995     KeyInformationLength : ULONG;
11996     ResultLength : PULONG
11997   ): NTSTATUS; stdcall;
11998 begin
11999   GetProcedureAddress(_NtEnumerateKey, ntdll, 'NtEnumerateKey');
12000   Result := TFNNtEnumerateKey(_NtEnumerateKey)(
12001     KeyHandle, Index, KeyInformationClass, KeyInformation, KeyInformationLength, ResultLength
12002   );
12003 end;
12004 
12005 // Dynamic version of NtEnumerateValueKey
12006 function  NtEnumerateValueKey(
12007     KeyHandle : HANDLE;
12008     Index : ULONG;
12009     KeyValueInformationClass : KEY_VALUE_INFORMATION_CLASS;
12010     KeyValueInformation : PVOID;
12011     KeyValueInformationLength : ULONG;
12012     ResultLength : PULONG
12013   ): NTSTATUS; stdcall;
12014 begin
12015   GetProcedureAddress(_NtEnumerateValueKey, ntdll, 'NtEnumerateValueKey');
12016   Result := TFNNtEnumerateValueKey(_NtEnumerateValueKey)(
12017     KeyHandle, Index, KeyValueInformationClass, KeyValueInformation, KeyValueInformationLength, ResultLength
12018   );
12019 end;
12020 
12021 // Dynamic version of NtEnumerateValueKey
12022 function  ZwEnumerateValueKey(
12023     KeyHandle : HANDLE;
12024     Index : ULONG;
12025     KeyValueInformationClass : KEY_VALUE_INFORMATION_CLASS;
12026     KeyValueInformation : PVOID;
12027     KeyValueInformationLength : ULONG;
12028     ResultLength : PULONG
12029   ): NTSTATUS; stdcall;
12030 begin
12031   GetProcedureAddress(_NtEnumerateValueKey, ntdll, 'NtEnumerateValueKey');
12032   Result := TFNNtEnumerateValueKey(_NtEnumerateValueKey)(
12033     KeyHandle, Index, KeyValueInformationClass, KeyValueInformation, KeyValueInformationLength, ResultLength
12034   );
12035 end;
12036 
12037 // Dynamic version of NtExtendSection
12038 function  NtExtendSection(
12039     SectionHandle : HANDLE;
12040     SectionSize : PLARGE_INTEGER
12041   ): NTSTATUS; stdcall;
12042 begin
12043   GetProcedureAddress(_NtExtendSection, ntdll, 'NtExtendSection');
12044   Result := TFNNtExtendSection(_NtExtendSection)(
12045     SectionHandle, SectionSize
12046   );
12047 end;
12048 
12049 // Dynamic version of NtExtendSection
12050 function  ZwExtendSection(
12051     SectionHandle : HANDLE;
12052     SectionSize : PLARGE_INTEGER
12053   ): NTSTATUS; stdcall;
12054 begin
12055   GetProcedureAddress(_NtExtendSection, ntdll, 'NtExtendSection');
12056   Result := TFNNtExtendSection(_NtExtendSection)(
12057     SectionHandle, SectionSize
12058   );
12059 end;
12060 
12061 // Dynamic version of NtFilterToken
12062 function  NtFilterToken(
12063     ExistingTokenHandle : HANDLE;
12064     Flags : ULONG;
12065     SidsToDisable : PTOKEN_GROUPS;
12066     PrivilegesToDelete : PTOKEN_PRIVILEGES;
12067     SidsToRestricted : PTOKEN_GROUPS;
12068     NewTokenHandle : PHANDLE
12069   ): NTSTATUS; stdcall;
12070 begin
12071   GetProcedureAddress(_NtFilterToken, ntdll, 'NtFilterToken');
12072   Result := TFNNtFilterToken(_NtFilterToken)(
12073     ExistingTokenHandle, Flags, SidsToDisable, PrivilegesToDelete, SidsToRestricted, NewTokenHandle
12074   );
12075 end;
12076 
12077 // Dynamic version of NtFilterToken
12078 function  ZwFilterToken(
12079     ExistingTokenHandle : HANDLE;
12080     Flags : ULONG;
12081     SidsToDisable : PTOKEN_GROUPS;
12082     PrivilegesToDelete : PTOKEN_PRIVILEGES;
12083     SidsToRestricted : PTOKEN_GROUPS;
12084     NewTokenHandle : PHANDLE
12085   ): NTSTATUS; stdcall;
12086 begin
12087   GetProcedureAddress(_NtFilterToken, ntdll, 'NtFilterToken');
12088   Result := TFNNtFilterToken(_NtFilterToken)(
12089     ExistingTokenHandle, Flags, SidsToDisable, PrivilegesToDelete, SidsToRestricted, NewTokenHandle
12090   );
12091 end;
12092 
12093 // Dynamic version of NtFindAtom
12094 function  NtFindAtom(
12095     Str : PWSTR;
12096     StringLength : ULONG;
12097     Atom : PUSHORT
12098   ): NTSTATUS; stdcall;
12099 begin
12100   GetProcedureAddress(_NtFindAtom, ntdll, 'NtFindAtom');
12101   Result := TFNNtFindAtom(_NtFindAtom)(
12102     Str, StringLength, Atom
12103   );
12104 end;
12105 
12106 // Dynamic version of NtFindAtom
12107 function  ZwFindAtom(
12108     Str : PWSTR;
12109     StringLength : ULONG;
12110     Atom : PUSHORT
12111   ): NTSTATUS; stdcall;
12112 begin
12113   GetProcedureAddress(_NtFindAtom, ntdll, 'NtFindAtom');
12114   Result := TFNNtFindAtom(_NtFindAtom)(
12115     Str, StringLength, Atom
12116   );
12117 end;
12118 
12119 // Dynamic version of NtFlushBuffersFile
12120 function  NtFlushBuffersFile(
12121     FileHandle : HANDLE;
12122     IoStatusBlock : PIO_STATUS_BLOCK
12123   ): NTSTATUS; stdcall;
12124 begin
12125   GetProcedureAddress(_NtFlushBuffersFile, ntdll, 'NtFlushBuffersFile');
12126   Result := TFNNtFlushBuffersFile(_NtFlushBuffersFile)(
12127     FileHandle, IoStatusBlock
12128   );
12129 end;
12130 
12131 // Dynamic version of NtFlushBuffersFile
12132 function  ZwFlushBuffersFile(
12133     FileHandle : HANDLE;
12134     IoStatusBlock : PIO_STATUS_BLOCK
12135   ): NTSTATUS; stdcall;
12136 begin
12137   GetProcedureAddress(_NtFlushBuffersFile, ntdll, 'NtFlushBuffersFile');
12138   Result := TFNNtFlushBuffersFile(_NtFlushBuffersFile)(
12139     FileHandle, IoStatusBlock
12140   );
12141 end;
12142 
12143 // Dynamic version of NtFlushInstructionCache
12144 function  NtFlushInstructionCache(
12145     ProcessHandle : HANDLE;
12146     BaseAddress : PVOID;
12147     FlushSize : ULONG
12148   ): NTSTATUS; stdcall;
12149 begin
12150   GetProcedureAddress(_NtFlushInstructionCache, ntdll, 'NtFlushInstructionCache');
12151   Result := TFNNtFlushInstructionCache(_NtFlushInstructionCache)(
12152     ProcessHandle, BaseAddress, FlushSize
12153   );
12154 end;
12155 
12156 // Dynamic version of NtFlushInstructionCache
12157 function  ZwFlushInstructionCache(
12158     ProcessHandle : HANDLE;
12159     BaseAddress : PVOID;
12160     FlushSize : ULONG
12161   ): NTSTATUS; stdcall;
12162 begin
12163   GetProcedureAddress(_NtFlushInstructionCache, ntdll, 'NtFlushInstructionCache');
12164   Result := TFNNtFlushInstructionCache(_NtFlushInstructionCache)(
12165     ProcessHandle, BaseAddress, FlushSize
12166   );
12167 end;
12168 
12169 // Dynamic version of NtFlushKey
12170 function  NtFlushKey(
12171     KeyHandle : HANDLE
12172   ): NTSTATUS; stdcall;
12173 begin
12174   GetProcedureAddress(_NtFlushKey, ntdll, 'NtFlushKey');
12175   Result := TFNNtFlushKey(_NtFlushKey)(
12176     KeyHandle
12177   );
12178 end;
12179 
12180 // Dynamic version of NtFlushKey
12181 function  ZwFlushKey(
12182     KeyHandle : HANDLE
12183   ): NTSTATUS; stdcall;
12184 begin
12185   GetProcedureAddress(_NtFlushKey, ntdll, 'NtFlushKey');
12186   Result := TFNNtFlushKey(_NtFlushKey)(
12187     KeyHandle
12188   );
12189 end;
12190 
12191 // Dynamic version of NtFlushVirtualMemory
12192 function  NtFlushVirtualMemory(
12193     ProcessHandle : HANDLE;
12194     BaseAddress : PPVOID;
12195     FlushSize : PULONG;
12196     IoStatusBlock : PIO_STATUS_BLOCK
12197   ): NTSTATUS; stdcall;
12198 begin
12199   GetProcedureAddress(_NtFlushVirtualMemory, ntdll, 'NtFlushVirtualMemory');
12200   Result := TFNNtFlushVirtualMemory(_NtFlushVirtualMemory)(
12201     ProcessHandle, BaseAddress, FlushSize, IoStatusBlock
12202   );
12203 end;
12204 
12205 // Dynamic version of NtFlushVirtualMemory
12206 function  ZwFlushVirtualMemory(
12207     ProcessHandle : HANDLE;
12208     BaseAddress : PPVOID;
12209     FlushSize : PULONG;
12210     IoStatusBlock : PIO_STATUS_BLOCK
12211   ): NTSTATUS; stdcall;
12212 begin
12213   GetProcedureAddress(_NtFlushVirtualMemory, ntdll, 'NtFlushVirtualMemory');
12214   Result := TFNNtFlushVirtualMemory(_NtFlushVirtualMemory)(
12215     ProcessHandle, BaseAddress, FlushSize, IoStatusBlock
12216   );
12217 end;
12218 
12219 // Dynamic version of NtFlushWriteBuffer
12220 function  NtFlushWriteBuffer(): NTSTATUS; stdcall;
12221 begin
12222   GetProcedureAddress(_NtFlushWriteBuffer, ntdll, 'NtFlushWriteBuffer');
12223   Result := TFNNtFlushWriteBuffer(_NtFlushWriteBuffer)();
12224 end;
12225 
12226 // Dynamic version of NtFlushWriteBuffer
12227 function  ZwFlushWriteBuffer(): NTSTATUS; stdcall;
12228 begin
12229   GetProcedureAddress(_NtFlushWriteBuffer, ntdll, 'NtFlushWriteBuffer');
12230   Result := TFNNtFlushWriteBuffer(_NtFlushWriteBuffer)();
12231 end;
12232 
12233 // Dynamic version of NtFreeUserPhysicalPages
12234 function  NtFreeUserPhysicalPages(
12235     ProcessHandle : HANDLE;
12236     NumberOfPages : PULONG;
12237     PageFrameNumbers : PULONG
12238   ): NTSTATUS; stdcall;
12239 begin
12240   GetProcedureAddress(_NtFreeUserPhysicalPages, ntdll, 'NtFreeUserPhysicalPages');
12241   Result := TFNNtFreeUserPhysicalPages(_NtFreeUserPhysicalPages)(
12242     ProcessHandle, NumberOfPages, PageFrameNumbers
12243   );
12244 end;
12245 
12246 // Dynamic version of NtFreeUserPhysicalPages
12247 function  ZwFreeUserPhysicalPages(
12248     ProcessHandle : HANDLE;
12249     NumberOfPages : PULONG;
12250     PageFrameNumbers : PULONG
12251   ): NTSTATUS; stdcall;
12252 begin
12253   GetProcedureAddress(_NtFreeUserPhysicalPages, ntdll, 'NtFreeUserPhysicalPages');
12254   Result := TFNNtFreeUserPhysicalPages(_NtFreeUserPhysicalPages)(
12255     ProcessHandle, NumberOfPages, PageFrameNumbers
12256   );
12257 end;
12258 
12259 // Dynamic version of NtFreeVirtualMemory
12260 function  NtFreeVirtualMemory(
12261     ProcessHandle : HANDLE;
12262     BaseAddress : PPVOID;
12263     FreeSize : PULONG;
12264     FreeType : ULONG
12265   ): NTSTATUS; stdcall;
12266 begin
12267   GetProcedureAddress(_NtFreeVirtualMemory, ntdll, 'NtFreeVirtualMemory');
12268   Result := TFNNtFreeVirtualMemory(_NtFreeVirtualMemory)(
12269     ProcessHandle, BaseAddress, FreeSize, FreeType
12270   );
12271 end;
12272 
12273 // Dynamic version of NtFreeVirtualMemory
12274 function  ZwFreeVirtualMemory(
12275     ProcessHandle : HANDLE;
12276     BaseAddress : PPVOID;
12277     FreeSize : PULONG;
12278     FreeType : ULONG
12279   ): NTSTATUS; stdcall;
12280 begin
12281   GetProcedureAddress(_NtFreeVirtualMemory, ntdll, 'NtFreeVirtualMemory');
12282   Result := TFNNtFreeVirtualMemory(_NtFreeVirtualMemory)(
12283     ProcessHandle, BaseAddress, FreeSize, FreeType
12284   );
12285 end;
12286 
12287 // Dynamic version of NtFsControlFile
12288 function  NtFsControlFile(
12289     FileHandle : HANDLE;
12290     Event : HANDLE;
12291     ApcRoutine : PIO_APC_ROUTINE;
12292     ApcContext : PVOID;
12293     IoStatusBlock : PIO_STATUS_BLOCK;
12294     FsControlCode : ULONG;
12295     InputBuffer : PVOID;
12296     InputBufferLength : ULONG;
12297     OutputBuffer : PVOID;
12298     OutputBufferLength : ULONG
12299   ): NTSTATUS; stdcall;
12300 begin
12301   GetProcedureAddress(_NtFsControlFile, ntdll, 'NtFsControlFile');
12302   Result := TFNNtFsControlFile(_NtFsControlFile)(
12303     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FsControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength
12304   );
12305 end;
12306 
12307 // Dynamic version of NtFsControlFile
12308 function  ZwFsControlFile(
12309     FileHandle : HANDLE;
12310     Event : HANDLE;
12311     ApcRoutine : PIO_APC_ROUTINE;
12312     ApcContext : PVOID;
12313     IoStatusBlock : PIO_STATUS_BLOCK;
12314     FsControlCode : ULONG;
12315     InputBuffer : PVOID;
12316     InputBufferLength : ULONG;
12317     OutputBuffer : PVOID;
12318     OutputBufferLength : ULONG
12319   ): NTSTATUS; stdcall;
12320 begin
12321   GetProcedureAddress(_NtFsControlFile, ntdll, 'NtFsControlFile');
12322   Result := TFNNtFsControlFile(_NtFsControlFile)(
12323     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FsControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength
12324   );
12325 end;
12326 
12327 // Dynamic version of NtGetContextThread
12328 function  NtGetContextThread(
12329     ThreadHandle : HANDLE;
12330     Context : PCONTEXT
12331   ): NTSTATUS; stdcall;
12332 begin
12333   GetProcedureAddress(_NtGetContextThread, ntdll, 'NtGetContextThread');
12334   Result := TFNNtGetContextThread(_NtGetContextThread)(
12335     ThreadHandle, Context
12336   );
12337 end;
12338 
12339 // Dynamic version of NtGetContextThread
12340 function  ZwGetContextThread(
12341     ThreadHandle : HANDLE;
12342     Context : PCONTEXT
12343   ): NTSTATUS; stdcall;
12344 begin
12345   GetProcedureAddress(_NtGetContextThread, ntdll, 'NtGetContextThread');
12346   Result := TFNNtGetContextThread(_NtGetContextThread)(
12347     ThreadHandle, Context
12348   );
12349 end;
12350 
12351 // Dynamic version of NtGetCurrentProcessorNumber
12352 function  NtGetCurrentProcessorNumber(): ULONG; stdcall;
12353 begin
12354   GetProcedureAddress(_NtGetCurrentProcessorNumber, ntdll, 'NtGetCurrentProcessorNumber');
12355   Result := TFNNtGetCurrentProcessorNumber(_NtGetCurrentProcessorNumber)();
12356 end;
12357 
12358 // Dynamic version of NtGetCurrentProcessorNumber
12359 function  ZwGetCurrentProcessorNumber(): ULONG; stdcall;
12360 begin
12361   GetProcedureAddress(_NtGetCurrentProcessorNumber, ntdll, 'NtGetCurrentProcessorNumber');
12362   Result := TFNNtGetCurrentProcessorNumber(_NtGetCurrentProcessorNumber)();
12363 end;
12364 
12365 // Dynamic version of NtGetDevicePowerState
12366 function  NtGetDevicePowerState(
12367     DeviceHandle : HANDLE;
12368     DevicePowerState : PDEVICE_POWER_STATE
12369   ): NTSTATUS; stdcall;
12370 begin
12371   GetProcedureAddress(_NtGetDevicePowerState, ntdll, 'NtGetDevicePowerState');
12372   Result := TFNNtGetDevicePowerState(_NtGetDevicePowerState)(
12373     DeviceHandle, DevicePowerState
12374   );
12375 end;
12376 
12377 // Dynamic version of NtGetDevicePowerState
12378 function  ZwGetDevicePowerState(
12379     DeviceHandle : HANDLE;
12380     DevicePowerState : PDEVICE_POWER_STATE
12381   ): NTSTATUS; stdcall;
12382 begin
12383   GetProcedureAddress(_NtGetDevicePowerState, ntdll, 'NtGetDevicePowerState');
12384   Result := TFNNtGetDevicePowerState(_NtGetDevicePowerState)(
12385     DeviceHandle, DevicePowerState
12386   );
12387 end;
12388 
12389 // Dynamic version of NtGetPlugPlayEvent
12390 function  NtGetPlugPlayEvent(
12391     Reserved1 : ULONG;
12392     Reserved2 : ULONG;
12393     Buffer : PVOID;
12394     BufferLength : ULONG
12395   ): NTSTATUS; stdcall;
12396 begin
12397   GetProcedureAddress(_NtGetPlugPlayEvent, ntdll, 'NtGetPlugPlayEvent');
12398   Result := TFNNtGetPlugPlayEvent(_NtGetPlugPlayEvent)(
12399     Reserved1, Reserved2, Buffer, BufferLength
12400   );
12401 end;
12402 
12403 // Dynamic version of NtGetPlugPlayEvent
12404 function  ZwGetPlugPlayEvent(
12405     Reserved1 : ULONG;
12406     Reserved2 : ULONG;
12407     Buffer : PVOID;
12408     BufferLength : ULONG
12409   ): NTSTATUS; stdcall;
12410 begin
12411   GetProcedureAddress(_NtGetPlugPlayEvent, ntdll, 'NtGetPlugPlayEvent');
12412   Result := TFNNtGetPlugPlayEvent(_NtGetPlugPlayEvent)(
12413     Reserved1, Reserved2, Buffer, BufferLength
12414   );
12415 end;
12416 
12417 // Dynamic version of NtGetTickCount
12418 function  NtGetTickCount(): ULONG; stdcall;
12419 begin
12420   GetProcedureAddress(_NtGetTickCount, ntdll, 'NtGetTickCount');
12421   Result := TFNNtGetTickCount(_NtGetTickCount)();
12422 end;
12423 
12424 // Dynamic version of NtGetTickCount
12425 function  ZwGetTickCount(): ULONG; stdcall;
12426 begin
12427   GetProcedureAddress(_NtGetTickCount, ntdll, 'NtGetTickCount');
12428   Result := TFNNtGetTickCount(_NtGetTickCount)();
12429 end;
12430 
12431 // Dynamic version of NtGetWriteWatch
12432 function  NtGetWriteWatch(
12433     ProcessHandle : HANDLE;
12434     Flags : ULONG;
12435     BaseAddress : PVOID;
12436     RegionSize : ULONG;
12437     Buffer : PULONG;
12438     BufferEntries : PULONG;
12439     Granularity : PULONG
12440   ): NTSTATUS; stdcall;
12441 begin
12442   GetProcedureAddress(_NtGetWriteWatch, ntdll, 'NtGetWriteWatch');
12443   Result := TFNNtGetWriteWatch(_NtGetWriteWatch)(
12444     ProcessHandle, Flags, BaseAddress, RegionSize, Buffer, BufferEntries, Granularity
12445   );
12446 end;
12447 
12448 // Dynamic version of NtGetWriteWatch
12449 function  ZwGetWriteWatch(
12450     ProcessHandle : HANDLE;
12451     Flags : ULONG;
12452     BaseAddress : PVOID;
12453     RegionSize : ULONG;
12454     Buffer : PULONG;
12455     BufferEntries : PULONG;
12456     Granularity : PULONG
12457   ): NTSTATUS; stdcall;
12458 begin
12459   GetProcedureAddress(_NtGetWriteWatch, ntdll, 'NtGetWriteWatch');
12460   Result := TFNNtGetWriteWatch(_NtGetWriteWatch)(
12461     ProcessHandle, Flags, BaseAddress, RegionSize, Buffer, BufferEntries, Granularity
12462   );
12463 end;
12464 
12465 // Dynamic version of NtImpersonateAnonymousToken
12466 function  NtImpersonateAnonymousToken(
12467     ThreadHandle : HANDLE
12468   ): NTSTATUS; stdcall;
12469 begin
12470   GetProcedureAddress(_NtImpersonateAnonymousToken, ntdll, 'NtImpersonateAnonymousToken');
12471   Result := TFNNtImpersonateAnonymousToken(_NtImpersonateAnonymousToken)(
12472     ThreadHandle
12473   );
12474 end;
12475 
12476 // Dynamic version of NtImpersonateAnonymousToken
12477 function  ZwImpersonateAnonymousToken(
12478     ThreadHandle : HANDLE
12479   ): NTSTATUS; stdcall;
12480 begin
12481   GetProcedureAddress(_NtImpersonateAnonymousToken, ntdll, 'NtImpersonateAnonymousToken');
12482   Result := TFNNtImpersonateAnonymousToken(_NtImpersonateAnonymousToken)(
12483     ThreadHandle
12484   );
12485 end;
12486 
12487 // Dynamic version of NtImpersonateClientOfPort
12488 function  NtImpersonateClientOfPort(
12489     PortHandle : HANDLE;
12490     Message : PPORT_MESSAGE
12491   ): NTSTATUS; stdcall;
12492 begin
12493   GetProcedureAddress(_NtImpersonateClientOfPort, ntdll, 'NtImpersonateClientOfPort');
12494   Result := TFNNtImpersonateClientOfPort(_NtImpersonateClientOfPort)(
12495     PortHandle, Message
12496   );
12497 end;
12498 
12499 // Dynamic version of NtImpersonateClientOfPort
12500 function  ZwImpersonateClientOfPort(
12501     PortHandle : HANDLE;
12502     Message : PPORT_MESSAGE
12503   ): NTSTATUS; stdcall;
12504 begin
12505   GetProcedureAddress(_NtImpersonateClientOfPort, ntdll, 'NtImpersonateClientOfPort');
12506   Result := TFNNtImpersonateClientOfPort(_NtImpersonateClientOfPort)(
12507     PortHandle, Message
12508   );
12509 end;
12510 
12511 // Dynamic version of NtImpersonateThread
12512 function  NtImpersonateThread(
12513     ThreadHandle : HANDLE;
12514     TargetThreadHandle : HANDLE;
12515     SecurityQos : PSECURITY_QUALITY_OF_SERVICE
12516   ): NTSTATUS; stdcall;
12517 begin
12518   GetProcedureAddress(_NtImpersonateThread, ntdll, 'NtImpersonateThread');
12519   Result := TFNNtImpersonateThread(_NtImpersonateThread)(
12520     ThreadHandle, TargetThreadHandle, SecurityQos
12521   );
12522 end;
12523 
12524 // Dynamic version of NtImpersonateThread
12525 function  ZwImpersonateThread(
12526     ThreadHandle : HANDLE;
12527     TargetThreadHandle : HANDLE;
12528     SecurityQos : PSECURITY_QUALITY_OF_SERVICE
12529   ): NTSTATUS; stdcall;
12530 begin
12531   GetProcedureAddress(_NtImpersonateThread, ntdll, 'NtImpersonateThread');
12532   Result := TFNNtImpersonateThread(_NtImpersonateThread)(
12533     ThreadHandle, TargetThreadHandle, SecurityQos
12534   );
12535 end;
12536 
12537 // Dynamic version of NtInitializeRegistry
12538 function  NtInitializeRegistry(
12539     Setup : BOOLEAN
12540   ): NTSTATUS; stdcall;
12541 begin
12542   GetProcedureAddress(_NtInitializeRegistry, ntdll, 'NtInitializeRegistry');
12543   Result := TFNNtInitializeRegistry(_NtInitializeRegistry)(
12544     Setup
12545   );
12546 end;
12547 
12548 // Dynamic version of NtInitializeRegistry
12549 function  ZwInitializeRegistry(
12550     Setup : BOOLEAN
12551   ): NTSTATUS; stdcall;
12552 begin
12553   GetProcedureAddress(_NtInitializeRegistry, ntdll, 'NtInitializeRegistry');
12554   Result := TFNNtInitializeRegistry(_NtInitializeRegistry)(
12555     Setup
12556   );
12557 end;
12558 
12559 // Dynamic version of NtInitiatePowerAction
12560 function  NtInitiatePowerAction(
12561     SystemAction : POWER_ACTION;
12562     MinSystemState : SYSTEM_POWER_STATE;
12563     Flags : ULONG;
12564     Asynchronous : BOOLEAN
12565   ): NTSTATUS; stdcall;
12566 begin
12567   GetProcedureAddress(_NtInitiatePowerAction, ntdll, 'NtInitiatePowerAction');
12568   Result := TFNNtInitiatePowerAction(_NtInitiatePowerAction)(
12569     SystemAction, MinSystemState, Flags, Asynchronous
12570   );
12571 end;
12572 
12573 // Dynamic version of NtInitiatePowerAction
12574 function  ZwInitiatePowerAction(
12575     SystemAction : POWER_ACTION;
12576     MinSystemState : SYSTEM_POWER_STATE;
12577     Flags : ULONG;
12578     Asynchronous : BOOLEAN
12579   ): NTSTATUS; stdcall;
12580 begin
12581   GetProcedureAddress(_NtInitiatePowerAction, ntdll, 'NtInitiatePowerAction');
12582   Result := TFNNtInitiatePowerAction(_NtInitiatePowerAction)(
12583     SystemAction, MinSystemState, Flags, Asynchronous
12584   );
12585 end;
12586 
12587 // Dynamic version of NtIsSystemResumeAutomatic
12588 function  NtIsSystemResumeAutomatic(): BOOLEAN; stdcall;
12589 begin
12590   GetProcedureAddress(_NtIsSystemResumeAutomatic, ntdll, 'NtIsSystemResumeAutomatic');
12591   Result := TFNNtIsSystemResumeAutomatic(_NtIsSystemResumeAutomatic)();
12592 end;
12593 
12594 // Dynamic version of NtIsSystemResumeAutomatic
12595 function  ZwIsSystemResumeAutomatic(): BOOLEAN; stdcall;
12596 begin
12597   GetProcedureAddress(_NtIsSystemResumeAutomatic, ntdll, 'NtIsSystemResumeAutomatic');
12598   Result := TFNNtIsSystemResumeAutomatic(_NtIsSystemResumeAutomatic)();
12599 end;
12600 
12601 // Dynamic version of NtListenChannel
12602 function  NtListenChannel(
12603     x : PVOID;
12604     y : PVOID
12605   ): NTSTATUS; stdcall;
12606 begin
12607   GetProcedureAddress(_NtListenChannel, ntdll, 'NtListenChannel');
12608   Result := TFNNtListenChannel(_NtListenChannel)(
12609     x, y
12610   );
12611 end;
12612 
12613 // Dynamic version of NtListenChannel
12614 function  ZwListenChannel(
12615     x : PVOID;
12616     y : PVOID
12617   ): NTSTATUS; stdcall;
12618 begin
12619   GetProcedureAddress(_NtListenChannel, ntdll, 'NtListenChannel');
12620   Result := TFNNtListenChannel(_NtListenChannel)(
12621     x, y
12622   );
12623 end;
12624 
12625 // Dynamic version of NtListenPort
12626 function  NtListenPort(
12627     PortHandle : HANDLE;
12628     Message : PPORT_MESSAGE
12629   ): NTSTATUS; stdcall;
12630 begin
12631   GetProcedureAddress(_NtListenPort, ntdll, 'NtListenPort');
12632   Result := TFNNtListenPort(_NtListenPort)(
12633     PortHandle, Message
12634   );
12635 end;
12636 
12637 // Dynamic version of NtListenPort
12638 function  ZwListenPort(
12639     PortHandle : HANDLE;
12640     Message : PPORT_MESSAGE
12641   ): NTSTATUS; stdcall;
12642 begin
12643   GetProcedureAddress(_NtListenPort, ntdll, 'NtListenPort');
12644   Result := TFNNtListenPort(_NtListenPort)(
12645     PortHandle, Message
12646   );
12647 end;
12648 
12649 // Dynamic version of NtLoadDriver
12650 function  NtLoadDriver(
12651     DriverServiceName : PUNICODE_STRING
12652   ): NTSTATUS; stdcall;
12653 begin
12654   GetProcedureAddress(_NtLoadDriver, ntdll, 'NtLoadDriver');
12655   Result := TFNNtLoadDriver(_NtLoadDriver)(
12656     DriverServiceName
12657   );
12658 end;
12659 
12660 // Dynamic version of NtLoadDriver
12661 function  ZwLoadDriver(
12662     DriverServiceName : PUNICODE_STRING
12663   ): NTSTATUS; stdcall;
12664 begin
12665   GetProcedureAddress(_NtLoadDriver, ntdll, 'NtLoadDriver');
12666   Result := TFNNtLoadDriver(_NtLoadDriver)(
12667     DriverServiceName
12668   );
12669 end;
12670 
12671 // Dynamic version of NtLoadKey
12672 function  NtLoadKey(
12673     KeyObjectAttributes : POBJECT_ATTRIBUTES;
12674     FileObjectAttributes : POBJECT_ATTRIBUTES
12675   ): NTSTATUS; stdcall;
12676 begin
12677   GetProcedureAddress(_NtLoadKey, ntdll, 'NtLoadKey');
12678   Result := TFNNtLoadKey(_NtLoadKey)(
12679     KeyObjectAttributes, FileObjectAttributes
12680   );
12681 end;
12682 
12683 // Dynamic version of NtLoadKey
12684 function  ZwLoadKey(
12685     KeyObjectAttributes : POBJECT_ATTRIBUTES;
12686     FileObjectAttributes : POBJECT_ATTRIBUTES
12687   ): NTSTATUS; stdcall;
12688 begin
12689   GetProcedureAddress(_NtLoadKey, ntdll, 'NtLoadKey');
12690   Result := TFNNtLoadKey(_NtLoadKey)(
12691     KeyObjectAttributes, FileObjectAttributes
12692   );
12693 end;
12694 
12695 // Dynamic version of NtLoadKey2
12696 function  NtLoadKey2(
12697     KeyObjectAttributes : POBJECT_ATTRIBUTES;
12698     FileObjectAttributes : POBJECT_ATTRIBUTES;
12699     Flags : ULONG
12700   ): NTSTATUS; stdcall;
12701 begin
12702   GetProcedureAddress(_NtLoadKey2, ntdll, 'NtLoadKey2');
12703   Result := TFNNtLoadKey2(_NtLoadKey2)(
12704     KeyObjectAttributes, FileObjectAttributes, Flags
12705   );
12706 end;
12707 
12708 // Dynamic version of NtLoadKey2
12709 function  ZwLoadKey2(
12710     KeyObjectAttributes : POBJECT_ATTRIBUTES;
12711     FileObjectAttributes : POBJECT_ATTRIBUTES;
12712     Flags : ULONG
12713   ): NTSTATUS; stdcall;
12714 begin
12715   GetProcedureAddress(_NtLoadKey2, ntdll, 'NtLoadKey2');
12716   Result := TFNNtLoadKey2(_NtLoadKey2)(
12717     KeyObjectAttributes, FileObjectAttributes, Flags
12718   );
12719 end;
12720 
12721 // Dynamic version of NtLockFile
12722 function  NtLockFile(
12723     FileHandle : HANDLE;
12724     Event : HANDLE;
12725     ApcRoutine : PIO_APC_ROUTINE;
12726     ApcContext : PVOID;
12727     IoStatusBlock : PIO_STATUS_BLOCK;
12728     LockOffset : PULARGE_INTEGER;
12729     LockLength : PULARGE_INTEGER;
12730     Key : ULONG;
12731     FailImmediately : BOOLEAN;
12732     ExclusiveLock : BOOLEAN
12733   ): NTSTATUS; stdcall;
12734 begin
12735   GetProcedureAddress(_NtLockFile, ntdll, 'NtLockFile');
12736   Result := TFNNtLockFile(_NtLockFile)(
12737     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, LockOffset, LockLength, Key, FailImmediately, ExclusiveLock
12738   );
12739 end;
12740 
12741 // Dynamic version of NtLockFile
12742 function  ZwLockFile(
12743     FileHandle : HANDLE;
12744     Event : HANDLE;
12745     ApcRoutine : PIO_APC_ROUTINE;
12746     ApcContext : PVOID;
12747     IoStatusBlock : PIO_STATUS_BLOCK;
12748     LockOffset : PULARGE_INTEGER;
12749     LockLength : PULARGE_INTEGER;
12750     Key : ULONG;
12751     FailImmediately : BOOLEAN;
12752     ExclusiveLock : BOOLEAN
12753   ): NTSTATUS; stdcall;
12754 begin
12755   GetProcedureAddress(_NtLockFile, ntdll, 'NtLockFile');
12756   Result := TFNNtLockFile(_NtLockFile)(
12757     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, LockOffset, LockLength, Key, FailImmediately, ExclusiveLock
12758   );
12759 end;
12760 
12761 // Dynamic version of NtLockVirtualMemory
12762 function  NtLockVirtualMemory(
12763     ProcessHandle : HANDLE;
12764     BaseAddress : PPVOID;
12765     LockSize : PULONG;
12766     LockType : ULONG
12767   ): NTSTATUS; stdcall;
12768 begin
12769   GetProcedureAddress(_NtLockVirtualMemory, ntdll, 'NtLockVirtualMemory');
12770   Result := TFNNtLockVirtualMemory(_NtLockVirtualMemory)(
12771     ProcessHandle, BaseAddress, LockSize, LockType
12772   );
12773 end;
12774 
12775 // Dynamic version of NtLockVirtualMemory
12776 function  ZwLockVirtualMemory(
12777     ProcessHandle : HANDLE;
12778     BaseAddress : PPVOID;
12779     LockSize : PULONG;
12780     LockType : ULONG
12781   ): NTSTATUS; stdcall;
12782 begin
12783   GetProcedureAddress(_NtLockVirtualMemory, ntdll, 'NtLockVirtualMemory');
12784   Result := TFNNtLockVirtualMemory(_NtLockVirtualMemory)(
12785     ProcessHandle, BaseAddress, LockSize, LockType
12786   );
12787 end;
12788 
12789 // Dynamic version of NtMakePermanentObject
12790 function  NtMakePermanentObject(
12791     Handle : HANDLE
12792   ): NTSTATUS; stdcall;
12793 begin
12794   GetProcedureAddress(_NtMakePermanentObject, ntdll, 'NtMakePermanentObject');
12795   Result := TFNNtMakePermanentObject(_NtMakePermanentObject)(
12796     Handle
12797   );
12798 end;
12799 
12800 // Dynamic version of NtMakePermanentObject
12801 function  ZwMakePermanentObject(
12802     Handle : HANDLE
12803   ): NTSTATUS; stdcall;
12804 begin
12805   GetProcedureAddress(_NtMakePermanentObject, ntdll, 'NtMakePermanentObject');
12806   Result := TFNNtMakePermanentObject(_NtMakePermanentObject)(
12807     Handle
12808   );
12809 end;
12810 
12811 // Dynamic version of NtMakeTemporaryObject
12812 function  NtMakeTemporaryObject(
12813     Handle : HANDLE
12814   ): NTSTATUS; stdcall;
12815 begin
12816   GetProcedureAddress(_NtMakeTemporaryObject, ntdll, 'NtMakeTemporaryObject');
12817   Result := TFNNtMakeTemporaryObject(_NtMakeTemporaryObject)(
12818     Handle
12819   );
12820 end;
12821 
12822 // Dynamic version of NtMakeTemporaryObject
12823 function  ZwMakeTemporaryObject(
12824     Handle : HANDLE
12825   ): NTSTATUS; stdcall;
12826 begin
12827   GetProcedureAddress(_NtMakeTemporaryObject, ntdll, 'NtMakeTemporaryObject');
12828   Result := TFNNtMakeTemporaryObject(_NtMakeTemporaryObject)(
12829     Handle
12830   );
12831 end;
12832 
12833 // Dynamic version of NtMapUserPhysicalPages
12834 function  NtMapUserPhysicalPages(
12835     BaseAddress : PVOID;
12836     NumberOfPages : PULONG;
12837     PageFrameNumbers : PULONG
12838   ): NTSTATUS; stdcall;
12839 begin
12840   GetProcedureAddress(_NtMapUserPhysicalPages, ntdll, 'NtMapUserPhysicalPages');
12841   Result := TFNNtMapUserPhysicalPages(_NtMapUserPhysicalPages)(
12842     BaseAddress, NumberOfPages, PageFrameNumbers
12843   );
12844 end;
12845 
12846 // Dynamic version of NtMapUserPhysicalPages
12847 function  ZwMapUserPhysicalPages(
12848     BaseAddress : PVOID;
12849     NumberOfPages : PULONG;
12850     PageFrameNumbers : PULONG
12851   ): NTSTATUS; stdcall;
12852 begin
12853   GetProcedureAddress(_NtMapUserPhysicalPages, ntdll, 'NtMapUserPhysicalPages');
12854   Result := TFNNtMapUserPhysicalPages(_NtMapUserPhysicalPages)(
12855     BaseAddress, NumberOfPages, PageFrameNumbers
12856   );
12857 end;
12858 
12859 // Dynamic version of NtMapUserPhysicalPagesScatter
12860 function  NtMapUserPhysicalPagesScatter(
12861     BaseAddresses : PPVOID;
12862     NumberOfPages : PULONG;
12863     PageFrameNumbers : PULONG
12864   ): NTSTATUS; stdcall;
12865 begin
12866   GetProcedureAddress(_NtMapUserPhysicalPagesScatter, ntdll, 'NtMapUserPhysicalPagesScatter');
12867   Result := TFNNtMapUserPhysicalPagesScatter(_NtMapUserPhysicalPagesScatter)(
12868     BaseAddresses, NumberOfPages, PageFrameNumbers
12869   );
12870 end;
12871 
12872 // Dynamic version of NtMapUserPhysicalPagesScatter
12873 function  ZwMapUserPhysicalPagesScatter(
12874     BaseAddresses : PPVOID;
12875     NumberOfPages : PULONG;
12876     PageFrameNumbers : PULONG
12877   ): NTSTATUS; stdcall;
12878 begin
12879   GetProcedureAddress(_NtMapUserPhysicalPagesScatter, ntdll, 'NtMapUserPhysicalPagesScatter');
12880   Result := TFNNtMapUserPhysicalPagesScatter(_NtMapUserPhysicalPagesScatter)(
12881     BaseAddresses, NumberOfPages, PageFrameNumbers
12882   );
12883 end;
12884 
12885 // Dynamic version of NtMapViewOfSection
12886 function  NtMapViewOfSection(
12887     SectionHandle : HANDLE;
12888     ProcessHandle : HANDLE;
12889     BaseAddress : PPVOID;
12890     ZeroBits : ULONG;
12891     CommitSize : ULONG;
12892     SectionOffset : PLARGE_INTEGER;
12893     ViewSize : PULONG;
12894     InheritDisposition : SECTION_INHERIT;
12895     AllocationType : ULONG;
12896     Protect : ULONG
12897   ): NTSTATUS; stdcall;
12898 begin
12899   GetProcedureAddress(_NtMapViewOfSection, ntdll, 'NtMapViewOfSection');
12900   Result := TFNNtMapViewOfSection(_NtMapViewOfSection)(
12901     SectionHandle, ProcessHandle, BaseAddress, ZeroBits, CommitSize, SectionOffset, ViewSize, InheritDisposition, AllocationType, Protect
12902   );
12903 end;
12904 
12905 // Dynamic version of NtMapViewOfSection
12906 function  ZwMapViewOfSection(
12907     SectionHandle : HANDLE;
12908     ProcessHandle : HANDLE;
12909     BaseAddress : PPVOID;
12910     ZeroBits : ULONG;
12911     CommitSize : ULONG;
12912     SectionOffset : PLARGE_INTEGER;
12913     ViewSize : PULONG;
12914     InheritDisposition : SECTION_INHERIT;
12915     AllocationType : ULONG;
12916     Protect : ULONG
12917   ): NTSTATUS; stdcall;
12918 begin
12919   GetProcedureAddress(_NtMapViewOfSection, ntdll, 'NtMapViewOfSection');
12920   Result := TFNNtMapViewOfSection(_NtMapViewOfSection)(
12921     SectionHandle, ProcessHandle, BaseAddress, ZeroBits, CommitSize, SectionOffset, ViewSize, InheritDisposition, AllocationType, Protect
12922   );
12923 end;
12924 
12925 // Dynamic version of NtNotifyChangeDirectoryFile
12926 function  NtNotifyChangeDirectoryFile(
12927     FileHandle : HANDLE;
12928     Event : HANDLE;
12929     ApcRoutine : PIO_APC_ROUTINE;
12930     ApcContext : PVOID;
12931     IoStatusBlock : PIO_STATUS_BLOCK;
12932     Buffer : PFILE_NOTIFY_INFORMATION;
12933     BufferLength : ULONG;
12934     NotifyFilter : ULONG;
12935     WatchSubtree : BOOLEAN
12936   ): NTSTATUS; stdcall;
12937 begin
12938   GetProcedureAddress(_NtNotifyChangeDirectoryFile, ntdll, 'NtNotifyChangeDirectoryFile');
12939   Result := TFNNtNotifyChangeDirectoryFile(_NtNotifyChangeDirectoryFile)(
12940     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, BufferLength, NotifyFilter, WatchSubtree
12941   );
12942 end;
12943 
12944 // Dynamic version of NtNotifyChangeDirectoryFile
12945 function  ZwNotifyChangeDirectoryFile(
12946     FileHandle : HANDLE;
12947     Event : HANDLE;
12948     ApcRoutine : PIO_APC_ROUTINE;
12949     ApcContext : PVOID;
12950     IoStatusBlock : PIO_STATUS_BLOCK;
12951     Buffer : PFILE_NOTIFY_INFORMATION;
12952     BufferLength : ULONG;
12953     NotifyFilter : ULONG;
12954     WatchSubtree : BOOLEAN
12955   ): NTSTATUS; stdcall;
12956 begin
12957   GetProcedureAddress(_NtNotifyChangeDirectoryFile, ntdll, 'NtNotifyChangeDirectoryFile');
12958   Result := TFNNtNotifyChangeDirectoryFile(_NtNotifyChangeDirectoryFile)(
12959     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, BufferLength, NotifyFilter, WatchSubtree
12960   );
12961 end;
12962 
12963 // Dynamic version of NtNotifyChangeKey
12964 function  NtNotifyChangeKey(
12965     KeyHandle : HANDLE;
12966     EventHandle : HANDLE;
12967     ApcRoutine : PIO_APC_ROUTINE;
12968     ApcContext : PVOID;
12969     IoStatusBlock : PIO_STATUS_BLOCK;
12970     NotifyFilter : ULONG;
12971     WatchSubtree : BOOLEAN;
12972     Buffer : PVOID;
12973     BufferLength : ULONG;
12974     Asynchronous : BOOLEAN
12975   ): NTSTATUS; stdcall;
12976 begin
12977   GetProcedureAddress(_NtNotifyChangeKey, ntdll, 'NtNotifyChangeKey');
12978   Result := TFNNtNotifyChangeKey(_NtNotifyChangeKey)(
12979     KeyHandle, EventHandle, ApcRoutine, ApcContext, IoStatusBlock, NotifyFilter, WatchSubtree, Buffer, BufferLength, Asynchronous
12980   );
12981 end;
12982 
12983 // Dynamic version of NtNotifyChangeKey
12984 function  ZwNotifyChangeKey(
12985     KeyHandle : HANDLE;
12986     EventHandle : HANDLE;
12987     ApcRoutine : PIO_APC_ROUTINE;
12988     ApcContext : PVOID;
12989     IoStatusBlock : PIO_STATUS_BLOCK;
12990     NotifyFilter : ULONG;
12991     WatchSubtree : BOOLEAN;
12992     Buffer : PVOID;
12993     BufferLength : ULONG;
12994     Asynchronous : BOOLEAN
12995   ): NTSTATUS; stdcall;
12996 begin
12997   GetProcedureAddress(_NtNotifyChangeKey, ntdll, 'NtNotifyChangeKey');
12998   Result := TFNNtNotifyChangeKey(_NtNotifyChangeKey)(
12999     KeyHandle, EventHandle, ApcRoutine, ApcContext, IoStatusBlock, NotifyFilter, WatchSubtree, Buffer, BufferLength, Asynchronous
13000   );
13001 end;
13002 
13003 // Dynamic version of NtNotifyChangeMultipleKeys
13004 function  NtNotifyChangeMultipleKeys(
13005     KeyHandle : HANDLE;
13006     Flags : ULONG;
13007     KeyObjectAttributes : POBJECT_ATTRIBUTES;
13008     EventHandle : HANDLE;
13009     ApcRoutine : PIO_APC_ROUTINE;
13010     ApcContext : PVOID;
13011     IoStatusBlock : PIO_STATUS_BLOCK;
13012     NotifyFilter : ULONG;
13013     WatchSubtree : BOOLEAN;
13014     Buffer : PVOID;
13015     BufferLength : ULONG;
13016     Asynchronous : BOOLEAN
13017   ): NTSTATUS; stdcall;
13018 begin
13019   GetProcedureAddress(_NtNotifyChangeMultipleKeys, ntdll, 'NtNotifyChangeMultipleKeys');
13020   Result := TFNNtNotifyChangeMultipleKeys(_NtNotifyChangeMultipleKeys)(
13021     KeyHandle, Flags, KeyObjectAttributes, EventHandle, ApcRoutine, ApcContext, IoStatusBlock, NotifyFilter, WatchSubtree, Buffer, BufferLength, Asynchronous
13022   );
13023 end;
13024 
13025 // Dynamic version of NtNotifyChangeMultipleKeys
13026 function  ZwNotifyChangeMultipleKeys(
13027     KeyHandle : HANDLE;
13028     Flags : ULONG;
13029     KeyObjectAttributes : POBJECT_ATTRIBUTES;
13030     EventHandle : HANDLE;
13031     ApcRoutine : PIO_APC_ROUTINE;
13032     ApcContext : PVOID;
13033     IoStatusBlock : PIO_STATUS_BLOCK;
13034     NotifyFilter : ULONG;
13035     WatchSubtree : BOOLEAN;
13036     Buffer : PVOID;
13037     BufferLength : ULONG;
13038     Asynchronous : BOOLEAN
13039   ): NTSTATUS; stdcall;
13040 begin
13041   GetProcedureAddress(_NtNotifyChangeMultipleKeys, ntdll, 'NtNotifyChangeMultipleKeys');
13042   Result := TFNNtNotifyChangeMultipleKeys(_NtNotifyChangeMultipleKeys)(
13043     KeyHandle, Flags, KeyObjectAttributes, EventHandle, ApcRoutine, ApcContext, IoStatusBlock, NotifyFilter, WatchSubtree, Buffer, BufferLength, Asynchronous
13044   );
13045 end;
13046 
13047 // Dynamic version of NtOpenChannel
13048 function  NtOpenChannel(
13049     ChannelHandle : PHANDLE;
13050     ObjectAttributes : POBJECT_ATTRIBUTES
13051   ): NTSTATUS; stdcall;
13052 begin
13053   GetProcedureAddress(_NtOpenChannel, ntdll, 'NtOpenChannel');
13054   Result := TFNNtOpenChannel(_NtOpenChannel)(
13055     ChannelHandle, ObjectAttributes
13056   );
13057 end;
13058 
13059 // Dynamic version of NtOpenChannel
13060 function  ZwOpenChannel(
13061     ChannelHandle : PHANDLE;
13062     ObjectAttributes : POBJECT_ATTRIBUTES
13063   ): NTSTATUS; stdcall;
13064 begin
13065   GetProcedureAddress(_NtOpenChannel, ntdll, 'NtOpenChannel');
13066   Result := TFNNtOpenChannel(_NtOpenChannel)(
13067     ChannelHandle, ObjectAttributes
13068   );
13069 end;
13070 
13071 // Dynamic version of NtOpenDirectoryObject
13072 function  NtOpenDirectoryObject(
13073     DirectoryHandle : PHANDLE;
13074     DesiredAccess : ACCESS_MASK;
13075     ObjectAttributes : POBJECT_ATTRIBUTES
13076   ): NTSTATUS; stdcall;
13077 begin
13078   GetProcedureAddress(_NtOpenDirectoryObject, ntdll, 'NtOpenDirectoryObject');
13079   Result := TFNNtOpenDirectoryObject(_NtOpenDirectoryObject)(
13080     DirectoryHandle, DesiredAccess, ObjectAttributes
13081   );
13082 end;
13083 
13084 // Dynamic version of NtOpenDirectoryObject
13085 function  ZwOpenDirectoryObject(
13086     DirectoryHandle : PHANDLE;
13087     DesiredAccess : ACCESS_MASK;
13088     ObjectAttributes : POBJECT_ATTRIBUTES
13089   ): NTSTATUS; stdcall;
13090 begin
13091   GetProcedureAddress(_NtOpenDirectoryObject, ntdll, 'NtOpenDirectoryObject');
13092   Result := TFNNtOpenDirectoryObject(_NtOpenDirectoryObject)(
13093     DirectoryHandle, DesiredAccess, ObjectAttributes
13094   );
13095 end;
13096 
13097 // Dynamic version of NtOpenEvent
13098 function  NtOpenEvent(
13099     EventHandle : PHANDLE;
13100     DesiredAccess : ACCESS_MASK;
13101     ObjectAttributes : POBJECT_ATTRIBUTES
13102   ): NTSTATUS; stdcall;
13103 begin
13104   GetProcedureAddress(_NtOpenEvent, ntdll, 'NtOpenEvent');
13105   Result := TFNNtOpenEvent(_NtOpenEvent)(
13106     EventHandle, DesiredAccess, ObjectAttributes
13107   );
13108 end;
13109 
13110 // Dynamic version of NtOpenEvent
13111 function  ZwOpenEvent(
13112     EventHandle : PHANDLE;
13113     DesiredAccess : ACCESS_MASK;
13114     ObjectAttributes : POBJECT_ATTRIBUTES
13115   ): NTSTATUS; stdcall;
13116 begin
13117   GetProcedureAddress(_NtOpenEvent, ntdll, 'NtOpenEvent');
13118   Result := TFNNtOpenEvent(_NtOpenEvent)(
13119     EventHandle, DesiredAccess, ObjectAttributes
13120   );
13121 end;
13122 
13123 // Dynamic version of NtOpenEventPair
13124 function  NtOpenEventPair(
13125     EventPairHandle : PHANDLE;
13126     DesiredAccess : ACCESS_MASK;
13127     ObjectAttributes : POBJECT_ATTRIBUTES
13128   ): NTSTATUS; stdcall;
13129 begin
13130   GetProcedureAddress(_NtOpenEventPair, ntdll, 'NtOpenEventPair');
13131   Result := TFNNtOpenEventPair(_NtOpenEventPair)(
13132     EventPairHandle, DesiredAccess, ObjectAttributes
13133   );
13134 end;
13135 
13136 // Dynamic version of NtOpenEventPair
13137 function  ZwOpenEventPair(
13138     EventPairHandle : PHANDLE;
13139     DesiredAccess : ACCESS_MASK;
13140     ObjectAttributes : POBJECT_ATTRIBUTES
13141   ): NTSTATUS; stdcall;
13142 begin
13143   GetProcedureAddress(_NtOpenEventPair, ntdll, 'NtOpenEventPair');
13144   Result := TFNNtOpenEventPair(_NtOpenEventPair)(
13145     EventPairHandle, DesiredAccess, ObjectAttributes
13146   );
13147 end;
13148 
13149 {$IFNDEF JWA_INCLUDEMODE}
13150 // Dynamic version of NtOpenFile
13151 function  NtOpenFile(
13152     FileHandle : PHANDLE;
13153     DesiredAccess : ACCESS_MASK;
13154     ObjectAttributes : POBJECT_ATTRIBUTES;
13155     IoStatusBlock : PIO_STATUS_BLOCK;
13156     ShareAccess : ULONG;
13157     OpenOptions : ULONG
13158   ): NTSTATUS; stdcall;
13159 begin
13160   GetProcedureAddress(_NtOpenFile, ntdll, 'NtOpenFile');
13161   Result := TFNNtOpenFile(_NtOpenFile)(
13162     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, ShareAccess, OpenOptions
13163   );
13164 end;
13165 {$ENDIF JWA_INCLUDEMODE}
13166 
13167 // Dynamic version of NtOpenFile
13168 function  ZwOpenFile(
13169     FileHandle : PHANDLE;
13170     DesiredAccess : ACCESS_MASK;
13171     ObjectAttributes : POBJECT_ATTRIBUTES;
13172     IoStatusBlock : PIO_STATUS_BLOCK;
13173     ShareAccess : ULONG;
13174     OpenOptions : ULONG
13175   ): NTSTATUS; stdcall;
13176 begin
13177   GetProcedureAddress(_NtOpenFile, ntdll, 'NtOpenFile');
13178   Result := TFNNtOpenFile(_NtOpenFile)(
13179     FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, ShareAccess, OpenOptions
13180   );
13181 end;
13182 
13183 // Dynamic version of NtOpenIoCompletion
13184 function  NtOpenIoCompletion(
13185     IoCompletionHandle : PHANDLE;
13186     DesiredAccess : ACCESS_MASK;
13187     ObjectAttributes : POBJECT_ATTRIBUTES
13188   ): NTSTATUS; stdcall;
13189 begin
13190   GetProcedureAddress(_NtOpenIoCompletion, ntdll, 'NtOpenIoCompletion');
13191   Result := TFNNtOpenIoCompletion(_NtOpenIoCompletion)(
13192     IoCompletionHandle, DesiredAccess, ObjectAttributes
13193   );
13194 end;
13195 
13196 // Dynamic version of NtOpenIoCompletion
13197 function  ZwOpenIoCompletion(
13198     IoCompletionHandle : PHANDLE;
13199     DesiredAccess : ACCESS_MASK;
13200     ObjectAttributes : POBJECT_ATTRIBUTES
13201   ): NTSTATUS; stdcall;
13202 begin
13203   GetProcedureAddress(_NtOpenIoCompletion, ntdll, 'NtOpenIoCompletion');
13204   Result := TFNNtOpenIoCompletion(_NtOpenIoCompletion)(
13205     IoCompletionHandle, DesiredAccess, ObjectAttributes
13206   );
13207 end;
13208 
13209 // Dynamic version of NtOpenJobObject
13210 function  NtOpenJobObject(
13211     JobHandle : PHANDLE;
13212     DesiredAccess : ACCESS_MASK;
13213     ObjectAttributes : POBJECT_ATTRIBUTES
13214   ): NTSTATUS; stdcall;
13215 begin
13216   GetProcedureAddress(_NtOpenJobObject, ntdll, 'NtOpenJobObject');
13217   Result := TFNNtOpenJobObject(_NtOpenJobObject)(
13218     JobHandle, DesiredAccess, ObjectAttributes
13219   );
13220 end;
13221 
13222 // Dynamic version of NtOpenJobObject
13223 function  ZwOpenJobObject(
13224     JobHandle : PHANDLE;
13225     DesiredAccess : ACCESS_MASK;
13226     ObjectAttributes : POBJECT_ATTRIBUTES
13227   ): NTSTATUS; stdcall;
13228 begin
13229   GetProcedureAddress(_NtOpenJobObject, ntdll, 'NtOpenJobObject');
13230   Result := TFNNtOpenJobObject(_NtOpenJobObject)(
13231     JobHandle, DesiredAccess, ObjectAttributes
13232   );
13233 end;
13234 
13235 // Dynamic version of NtOpenKey
13236 function  NtOpenKey(
13237     KeyHandle : PHANDLE;
13238     DesiredAccess : ACCESS_MASK;
13239     ObjectAttributes : POBJECT_ATTRIBUTES
13240   ): NTSTATUS; stdcall;
13241 begin
13242   GetProcedureAddress(_NtOpenKey, ntdll, 'NtOpenKey');
13243   Result := TFNNtOpenKey(_NtOpenKey)(
13244     KeyHandle, DesiredAccess, ObjectAttributes
13245   );
13246 end;
13247 
13248 // Dynamic version of NtOpenKey
13249 function  ZwOpenKey(
13250     KeyHandle : PHANDLE;
13251     DesiredAccess : ACCESS_MASK;
13252     ObjectAttributes : POBJECT_ATTRIBUTES
13253   ): NTSTATUS; stdcall;
13254 begin
13255   GetProcedureAddress(_NtOpenKey, ntdll, 'NtOpenKey');
13256   Result := TFNNtOpenKey(_NtOpenKey)(
13257     KeyHandle, DesiredAccess, ObjectAttributes
13258   );
13259 end;
13260 
13261 // Dynamic version of NtOpenMutant
13262 function  NtOpenMutant(
13263     MutantHandle : PHANDLE;
13264     DesiredAccess : ACCESS_MASK;
13265     ObjectAttributes : POBJECT_ATTRIBUTES
13266   ): NTSTATUS; stdcall;
13267 begin
13268   GetProcedureAddress(_NtOpenMutant, ntdll, 'NtOpenMutant');
13269   Result := TFNNtOpenMutant(_NtOpenMutant)(
13270     MutantHandle, DesiredAccess, ObjectAttributes
13271   );
13272 end;
13273 
13274 // Dynamic version of NtOpenMutant
13275 function  ZwOpenMutant(
13276     MutantHandle : PHANDLE;
13277     DesiredAccess : ACCESS_MASK;
13278     ObjectAttributes : POBJECT_ATTRIBUTES
13279   ): NTSTATUS; stdcall;
13280 begin
13281   GetProcedureAddress(_NtOpenMutant, ntdll, 'NtOpenMutant');
13282   Result := TFNNtOpenMutant(_NtOpenMutant)(
13283     MutantHandle, DesiredAccess, ObjectAttributes
13284   );
13285 end;
13286 
13287 // Dynamic version of NtOpenObjectAuditAlarm
13288 function  NtOpenObjectAuditAlarm(
13289     SubsystemName : PUNICODE_STRING;
13290     HandleId : PPVOID;
13291     ObjectTypeName : PUNICODE_STRING;
13292     ObjectName : PUNICODE_STRING;
13293     SecurityDescriptor : PSECURITY_DESCRIPTOR;
13294     TokenHandle : HANDLE;
13295     DesiredAccess : ACCESS_MASK;
13296     GrantedAccess : ACCESS_MASK;
13297     Privileges : PPRIVILEGE_SET;
13298     ObjectCreation : BOOLEAN;
13299     AccessGranted : BOOLEAN;
13300     GenerateOnClose : PBOOLEAN
13301   ): NTSTATUS; stdcall;
13302 begin
13303   GetProcedureAddress(_NtOpenObjectAuditAlarm, ntdll, 'NtOpenObjectAuditAlarm');
13304   Result := TFNNtOpenObjectAuditAlarm(_NtOpenObjectAuditAlarm)(
13305     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, TokenHandle, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, GenerateOnClose
13306   );
13307 end;
13308 
13309 // Dynamic version of NtOpenObjectAuditAlarm
13310 function  ZwOpenObjectAuditAlarm(
13311     SubsystemName : PUNICODE_STRING;
13312     HandleId : PPVOID;
13313     ObjectTypeName : PUNICODE_STRING;
13314     ObjectName : PUNICODE_STRING;
13315     SecurityDescriptor : PSECURITY_DESCRIPTOR;
13316     TokenHandle : HANDLE;
13317     DesiredAccess : ACCESS_MASK;
13318     GrantedAccess : ACCESS_MASK;
13319     Privileges : PPRIVILEGE_SET;
13320     ObjectCreation : BOOLEAN;
13321     AccessGranted : BOOLEAN;
13322     GenerateOnClose : PBOOLEAN
13323   ): NTSTATUS; stdcall;
13324 begin
13325   GetProcedureAddress(_NtOpenObjectAuditAlarm, ntdll, 'NtOpenObjectAuditAlarm');
13326   Result := TFNNtOpenObjectAuditAlarm(_NtOpenObjectAuditAlarm)(
13327     SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, TokenHandle, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, GenerateOnClose
13328   );
13329 end;
13330 
13331 // Dynamic version of NtOpenProcess
13332 function  NtOpenProcess(
13333     ProcessHandle : PHANDLE;
13334     DesiredAccess : ACCESS_MASK;
13335     ObjectAttributes : POBJECT_ATTRIBUTES;
13336     ClientId : PCLIENT_ID
13337   ): NTSTATUS; stdcall;
13338 begin
13339   GetProcedureAddress(_NtOpenProcess, ntdll, 'NtOpenProcess');
13340   Result := TFNNtOpenProcess(_NtOpenProcess)(
13341     ProcessHandle, DesiredAccess, ObjectAttributes, ClientId
13342   );
13343 end;
13344 
13345 // Dynamic version of NtOpenProcess
13346 function  ZwOpenProcess(
13347     ProcessHandle : PHANDLE;
13348     DesiredAccess : ACCESS_MASK;
13349     ObjectAttributes : POBJECT_ATTRIBUTES;
13350     ClientId : PCLIENT_ID
13351   ): NTSTATUS; stdcall;
13352 begin
13353   GetProcedureAddress(_NtOpenProcess, ntdll, 'NtOpenProcess');
13354   Result := TFNNtOpenProcess(_NtOpenProcess)(
13355     ProcessHandle, DesiredAccess, ObjectAttributes, ClientId
13356   );
13357 end;
13358 
13359 // Dynamic version of NtOpenProcessToken
13360 function  NtOpenProcessToken(
13361     ProcessHandle : HANDLE;
13362     DesiredAccess : ACCESS_MASK;
13363     TokenHandle : PHANDLE
13364   ): NTSTATUS; stdcall;
13365 begin
13366   GetProcedureAddress(_NtOpenProcessToken, ntdll, 'NtOpenProcessToken');
13367   Result := TFNNtOpenProcessToken(_NtOpenProcessToken)(
13368     ProcessHandle, DesiredAccess, TokenHandle
13369   );
13370 end;
13371 
13372 // Dynamic version of NtOpenProcessToken
13373 function  ZwOpenProcessToken(
13374     ProcessHandle : HANDLE;
13375     DesiredAccess : ACCESS_MASK;
13376     TokenHandle : PHANDLE
13377   ): NTSTATUS; stdcall;
13378 begin
13379   GetProcedureAddress(_NtOpenProcessToken, ntdll, 'NtOpenProcessToken');
13380   Result := TFNNtOpenProcessToken(_NtOpenProcessToken)(
13381     ProcessHandle, DesiredAccess, TokenHandle
13382   );
13383 end;
13384 
13385 // Dynamic version of NtOpenSection
13386 function  NtOpenSection(
13387     SectionHandle : PHANDLE;
13388     DesiredAccess : ACCESS_MASK;
13389     ObjectAttributes : POBJECT_ATTRIBUTES
13390   ): NTSTATUS; stdcall;
13391 begin
13392   GetProcedureAddress(_NtOpenSection, ntdll, 'NtOpenSection');
13393   Result := TFNNtOpenSection(_NtOpenSection)(
13394     SectionHandle, DesiredAccess, ObjectAttributes
13395   );
13396 end;
13397 
13398 // Dynamic version of NtOpenSection
13399 function  ZwOpenSection(
13400     SectionHandle : PHANDLE;
13401     DesiredAccess : ACCESS_MASK;
13402     ObjectAttributes : POBJECT_ATTRIBUTES
13403   ): NTSTATUS; stdcall;
13404 begin
13405   GetProcedureAddress(_NtOpenSection, ntdll, 'NtOpenSection');
13406   Result := TFNNtOpenSection(_NtOpenSection)(
13407     SectionHandle, DesiredAccess, ObjectAttributes
13408   );
13409 end;
13410 
13411 // Dynamic version of NtOpenSemaphore
13412 function  NtOpenSemaphore(
13413     SemaphoreHandle : PHANDLE;
13414     DesiredAccess : ACCESS_MASK;
13415     ObjectAttributes : POBJECT_ATTRIBUTES
13416   ): NTSTATUS; stdcall;
13417 begin
13418   GetProcedureAddress(_NtOpenSemaphore, ntdll, 'NtOpenSemaphore');
13419   Result := TFNNtOpenSemaphore(_NtOpenSemaphore)(
13420     SemaphoreHandle, DesiredAccess, ObjectAttributes
13421   );
13422 end;
13423 
13424 // Dynamic version of NtOpenSemaphore
13425 function  ZwOpenSemaphore(
13426     SemaphoreHandle : PHANDLE;
13427     DesiredAccess : ACCESS_MASK;
13428     ObjectAttributes : POBJECT_ATTRIBUTES
13429   ): NTSTATUS; stdcall;
13430 begin
13431   GetProcedureAddress(_NtOpenSemaphore, ntdll, 'NtOpenSemaphore');
13432   Result := TFNNtOpenSemaphore(_NtOpenSemaphore)(
13433     SemaphoreHandle, DesiredAccess, ObjectAttributes
13434   );
13435 end;
13436 
13437 // Dynamic version of NtOpenSymbolicLinkObject
13438 function  NtOpenSymbolicLinkObject(
13439     SymbolicLinkHandle : PHANDLE;
13440     DesiredAccess : ACCESS_MASK;
13441     ObjectAttributes : POBJECT_ATTRIBUTES
13442   ): NTSTATUS; stdcall;
13443 begin
13444   GetProcedureAddress(_NtOpenSymbolicLinkObject, ntdll, 'NtOpenSymbolicLinkObject');
13445   Result := TFNNtOpenSymbolicLinkObject(_NtOpenSymbolicLinkObject)(
13446     SymbolicLinkHandle, DesiredAccess, ObjectAttributes
13447   );
13448 end;
13449 
13450 // Dynamic version of NtOpenSymbolicLinkObject
13451 function  ZwOpenSymbolicLinkObject(
13452     SymbolicLinkHandle : PHANDLE;
13453     DesiredAccess : ACCESS_MASK;
13454     ObjectAttributes : POBJECT_ATTRIBUTES
13455   ): NTSTATUS; stdcall;
13456 begin
13457   GetProcedureAddress(_NtOpenSymbolicLinkObject, ntdll, 'NtOpenSymbolicLinkObject');
13458   Result := TFNNtOpenSymbolicLinkObject(_NtOpenSymbolicLinkObject)(
13459     SymbolicLinkHandle, DesiredAccess, ObjectAttributes
13460   );
13461 end;
13462 
13463 // Dynamic version of NtOpenThread
13464 function  NtOpenThread(
13465     ThreadHandle : PHANDLE;
13466     DesiredAccess : ACCESS_MASK;
13467     ObjectAttributes : POBJECT_ATTRIBUTES;
13468     ClientId : PCLIENT_ID
13469   ): NTSTATUS; stdcall;
13470 begin
13471   GetProcedureAddress(_NtOpenThread, ntdll, 'NtOpenThread');
13472   Result := TFNNtOpenThread(_NtOpenThread)(
13473     ThreadHandle, DesiredAccess, ObjectAttributes, ClientId
13474   );
13475 end;
13476 
13477 // Dynamic version of NtOpenThread
13478 function  ZwOpenThread(
13479     ThreadHandle : PHANDLE;
13480     DesiredAccess : ACCESS_MASK;
13481     ObjectAttributes : POBJECT_ATTRIBUTES;
13482     ClientId : PCLIENT_ID
13483   ): NTSTATUS; stdcall;
13484 begin
13485   GetProcedureAddress(_NtOpenThread, ntdll, 'NtOpenThread');
13486   Result := TFNNtOpenThread(_NtOpenThread)(
13487     ThreadHandle, DesiredAccess, ObjectAttributes, ClientId
13488   );
13489 end;
13490 
13491 // Dynamic version of NtOpenThreadToken
13492 function  NtOpenThreadToken(
13493     ThreadHandle : HANDLE;
13494     DesiredAccess : ACCESS_MASK;
13495     OpenAsSelf : BOOLEAN;
13496     TokenHandle : PHANDLE
13497   ): NTSTATUS; stdcall;
13498 begin
13499   GetProcedureAddress(_NtOpenThreadToken, ntdll, 'NtOpenThreadToken');
13500   Result := TFNNtOpenThreadToken(_NtOpenThreadToken)(
13501     ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle
13502   );
13503 end;
13504 
13505 // Dynamic version of NtOpenThreadToken
13506 function  ZwOpenThreadToken(
13507     ThreadHandle : HANDLE;
13508     DesiredAccess : ACCESS_MASK;
13509     OpenAsSelf : BOOLEAN;
13510     TokenHandle : PHANDLE
13511   ): NTSTATUS; stdcall;
13512 begin
13513   GetProcedureAddress(_NtOpenThreadToken, ntdll, 'NtOpenThreadToken');
13514   Result := TFNNtOpenThreadToken(_NtOpenThreadToken)(
13515     ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle
13516   );
13517 end;
13518 
13519 // Dynamic version of NtOpenTimer
13520 function  NtOpenTimer(
13521     TimerHandle : PHANDLE;
13522     DesiredAccess : ACCESS_MASK;
13523     ObjectAttributes : POBJECT_ATTRIBUTES
13524   ): NTSTATUS; stdcall;
13525 begin
13526   GetProcedureAddress(_NtOpenTimer, ntdll, 'NtOpenTimer');
13527   Result := TFNNtOpenTimer(_NtOpenTimer)(
13528     TimerHandle, DesiredAccess, ObjectAttributes
13529   );
13530 end;
13531 
13532 // Dynamic version of NtOpenTimer
13533 function  ZwOpenTimer(
13534     TimerHandle : PHANDLE;
13535     DesiredAccess : ACCESS_MASK;
13536     ObjectAttributes : POBJECT_ATTRIBUTES
13537   ): NTSTATUS; stdcall;
13538 begin
13539   GetProcedureAddress(_NtOpenTimer, ntdll, 'NtOpenTimer');
13540   Result := TFNNtOpenTimer(_NtOpenTimer)(
13541     TimerHandle, DesiredAccess, ObjectAttributes
13542   );
13543 end;
13544 
13545 // Dynamic version of NtPlugPlayControl
13546 function  NtPlugPlayControl(
13547     ControlCode : ULONG;
13548     Buffer : PVOID;
13549     BufferLength : ULONG
13550   ): NTSTATUS; stdcall;
13551 begin
13552   GetProcedureAddress(_NtPlugPlayControl, ntdll, 'NtPlugPlayControl');
13553   Result := TFNNtPlugPlayControl(_NtPlugPlayControl)(
13554     ControlCode, Buffer, BufferLength
13555   );
13556 end;
13557 
13558 // Dynamic version of NtPlugPlayControl
13559 function  ZwPlugPlayControl(
13560     ControlCode : ULONG;
13561     Buffer : PVOID;
13562     BufferLength : ULONG
13563   ): NTSTATUS; stdcall;
13564 begin
13565   GetProcedureAddress(_NtPlugPlayControl, ntdll, 'NtPlugPlayControl');
13566   Result := TFNNtPlugPlayControl(_NtPlugPlayControl)(
13567     ControlCode, Buffer, BufferLength
13568   );
13569 end;
13570 
13571 // Dynamic version of NtPowerInformation
13572 function  NtPowerInformation(
13573     PowerInformationLevel : POWER_INFORMATION_LEVEL;
13574     InputBuffer : PVOID;
13575     InputBufferLength : ULONG;
13576     OutputBuffer : PVOID;
13577     OutputBufferLength : ULONG
13578   ): NTSTATUS; stdcall;
13579 begin
13580   GetProcedureAddress(_NtPowerInformation, ntdll, 'NtPowerInformation');
13581   Result := TFNNtPowerInformation(_NtPowerInformation)(
13582     PowerInformationLevel, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength
13583   );
13584 end;
13585 
13586 // Dynamic version of NtPowerInformation
13587 function  ZwPowerInformation(
13588     PowerInformationLevel : POWER_INFORMATION_LEVEL;
13589     InputBuffer : PVOID;
13590     InputBufferLength : ULONG;
13591     OutputBuffer : PVOID;
13592     OutputBufferLength : ULONG
13593   ): NTSTATUS; stdcall;
13594 begin
13595   GetProcedureAddress(_NtPowerInformation, ntdll, 'NtPowerInformation');
13596   Result := TFNNtPowerInformation(_NtPowerInformation)(
13597     PowerInformationLevel, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength
13598   );
13599 end;
13600 
13601 // Dynamic version of NtPrivilegeCheck
13602 function  NtPrivilegeCheck(
13603     TokenHandle : HANDLE;
13604     RequiredPrivileges : PPRIVILEGE_SET;
13605     Result_ : PBOOLEAN
13606   ): NTSTATUS; stdcall;
13607 begin
13608   GetProcedureAddress(_NtPrivilegeCheck, ntdll, 'NtPrivilegeCheck');
13609   Result := TFNNtPrivilegeCheck(_NtPrivilegeCheck)(
13610     TokenHandle, RequiredPrivileges, Result_
13611   );
13612 end;
13613 
13614 // Dynamic version of NtPrivilegeCheck
13615 function  ZwPrivilegeCheck(
13616     TokenHandle : HANDLE;
13617     RequiredPrivileges : PPRIVILEGE_SET;
13618     Result_ : PBOOLEAN
13619   ): NTSTATUS; stdcall;
13620 begin
13621   GetProcedureAddress(_NtPrivilegeCheck, ntdll, 'NtPrivilegeCheck');
13622   Result := TFNNtPrivilegeCheck(_NtPrivilegeCheck)(
13623     TokenHandle, RequiredPrivileges, Result_
13624   );
13625 end;
13626 
13627 // Dynamic version of NtPrivilegeObjectAuditAlarm
13628 function  NtPrivilegeObjectAuditAlarm(
13629     SubsystemName : PUNICODE_STRING;
13630     HandleId : PVOID;
13631     TokenHandle : HANDLE;
13632     DesiredAccess : ACCESS_MASK;
13633     Privileges : PPRIVILEGE_SET;
13634     AccessGranted : BOOLEAN
13635   ): NTSTATUS; stdcall;
13636 begin
13637   GetProcedureAddress(_NtPrivilegeObjectAuditAlarm, ntdll, 'NtPrivilegeObjectAuditAlarm');
13638   Result := TFNNtPrivilegeObjectAuditAlarm(_NtPrivilegeObjectAuditAlarm)(
13639     SubsystemName, HandleId, TokenHandle, DesiredAccess, Privileges, AccessGranted
13640   );
13641 end;
13642 
13643 // Dynamic version of NtPrivilegeObjectAuditAlarm
13644 function  ZwPrivilegeObjectAuditAlarm(
13645     SubsystemName : PUNICODE_STRING;
13646     HandleId : PVOID;
13647     TokenHandle : HANDLE;
13648     DesiredAccess : ACCESS_MASK;
13649     Privileges : PPRIVILEGE_SET;
13650     AccessGranted : BOOLEAN
13651   ): NTSTATUS; stdcall;
13652 begin
13653   GetProcedureAddress(_NtPrivilegeObjectAuditAlarm, ntdll, 'NtPrivilegeObjectAuditAlarm');
13654   Result := TFNNtPrivilegeObjectAuditAlarm(_NtPrivilegeObjectAuditAlarm)(
13655     SubsystemName, HandleId, TokenHandle, DesiredAccess, Privileges, AccessGranted
13656   );
13657 end;
13658 
13659 // Dynamic version of NtPrivilegedServiceAuditAlarm
13660 function  NtPrivilegedServiceAuditAlarm(
13661     SubsystemName : PUNICODE_STRING;
13662     ServiceName : PUNICODE_STRING;
13663     TokenHandle : HANDLE;
13664     Privileges : PPRIVILEGE_SET;
13665     AccessGranted : BOOLEAN
13666   ): NTSTATUS; stdcall;
13667 begin
13668   GetProcedureAddress(_NtPrivilegedServiceAuditAlarm, ntdll, 'NtPrivilegedServiceAuditAlarm');
13669   Result := TFNNtPrivilegedServiceAuditAlarm(_NtPrivilegedServiceAuditAlarm)(
13670     SubsystemName, ServiceName, TokenHandle, Privileges, AccessGranted
13671   );
13672 end;
13673 
13674 // Dynamic version of NtPrivilegedServiceAuditAlarm
13675 function  ZwPrivilegedServiceAuditAlarm(
13676     SubsystemName : PUNICODE_STRING;
13677     ServiceName : PUNICODE_STRING;
13678     TokenHandle : HANDLE;
13679     Privileges : PPRIVILEGE_SET;
13680     AccessGranted : BOOLEAN
13681   ): NTSTATUS; stdcall;
13682 begin
13683   GetProcedureAddress(_NtPrivilegedServiceAuditAlarm, ntdll, 'NtPrivilegedServiceAuditAlarm');
13684   Result := TFNNtPrivilegedServiceAuditAlarm(_NtPrivilegedServiceAuditAlarm)(
13685     SubsystemName, ServiceName, TokenHandle, Privileges, AccessGranted
13686   );
13687 end;
13688 
13689 // Dynamic version of NtProtectVirtualMemory
13690 function  NtProtectVirtualMemory(
13691     ProcessHandle : HANDLE;
13692     BaseAddress : PPVOID;
13693     ProtectSize : PULONG;
13694     NewProtect : ULONG;
13695     OldProtect : PULONG
13696   ): NTSTATUS; stdcall;
13697 begin
13698   GetProcedureAddress(_NtProtectVirtualMemory, ntdll, 'NtProtectVirtualMemory');
13699   Result := TFNNtProtectVirtualMemory(_NtProtectVirtualMemory)(
13700     ProcessHandle, BaseAddress, ProtectSize, NewProtect, OldProtect
13701   );
13702 end;
13703 
13704 // Dynamic version of NtProtectVirtualMemory
13705 function  ZwProtectVirtualMemory(
13706     ProcessHandle : HANDLE;
13707     BaseAddress : PPVOID;
13708     ProtectSize : PULONG;
13709     NewProtect : ULONG;
13710     OldProtect : PULONG
13711   ): NTSTATUS; stdcall;
13712 begin
13713   GetProcedureAddress(_NtProtectVirtualMemory, ntdll, 'NtProtectVirtualMemory');
13714   Result := TFNNtProtectVirtualMemory(_NtProtectVirtualMemory)(
13715     ProcessHandle, BaseAddress, ProtectSize, NewProtect, OldProtect
13716   );
13717 end;
13718 
13719 // Dynamic version of NtPulseEvent
13720 function  NtPulseEvent(
13721     EventHandle : HANDLE;
13722     PreviousState : PULONG
13723   ): NTSTATUS; stdcall;
13724 begin
13725   GetProcedureAddress(_NtPulseEvent, ntdll, 'NtPulseEvent');
13726   Result := TFNNtPulseEvent(_NtPulseEvent)(
13727     EventHandle, PreviousState
13728   );
13729 end;
13730 
13731 // Dynamic version of NtPulseEvent
13732 function  ZwPulseEvent(
13733     EventHandle : HANDLE;
13734     PreviousState : PULONG
13735   ): NTSTATUS; stdcall;
13736 begin
13737   GetProcedureAddress(_NtPulseEvent, ntdll, 'NtPulseEvent');
13738   Result := TFNNtPulseEvent(_NtPulseEvent)(
13739     EventHandle, PreviousState
13740   );
13741 end;
13742 
13743 // Dynamic version of NtQueryAttributesFile
13744 function  NtQueryAttributesFile(
13745     ObjectAttributes : POBJECT_ATTRIBUTES;
13746     FileInformation : PFILE_BASIC_INFORMATION
13747   ): NTSTATUS; stdcall;
13748 begin
13749   GetProcedureAddress(_NtQueryAttributesFile, ntdll, 'NtQueryAttributesFile');
13750   Result := TFNNtQueryAttributesFile(_NtQueryAttributesFile)(
13751     ObjectAttributes, FileInformation
13752   );
13753 end;
13754 
13755 // Dynamic version of NtQueryAttributesFile
13756 function  ZwQueryAttributesFile(
13757     ObjectAttributes : POBJECT_ATTRIBUTES;
13758     FileInformation : PFILE_BASIC_INFORMATION
13759   ): NTSTATUS; stdcall;
13760 begin
13761   GetProcedureAddress(_NtQueryAttributesFile, ntdll, 'NtQueryAttributesFile');
13762   Result := TFNNtQueryAttributesFile(_NtQueryAttributesFile)(
13763     ObjectAttributes, FileInformation
13764   );
13765 end;
13766 
13767 // Dynamic version of NtQueryDefaultLocale
13768 function  NtQueryDefaultLocale(
13769     ThreadOrSystem : BOOLEAN;
13770     Locale : PLCID
13771   ): NTSTATUS; stdcall;
13772 begin
13773   GetProcedureAddress(_NtQueryDefaultLocale, ntdll, 'NtQueryDefaultLocale');
13774   Result := TFNNtQueryDefaultLocale(_NtQueryDefaultLocale)(
13775     ThreadOrSystem, Locale
13776   );
13777 end;
13778 
13779 // Dynamic version of NtQueryDefaultLocale
13780 function  ZwQueryDefaultLocale(
13781     ThreadOrSystem : BOOLEAN;
13782     Locale : PLCID
13783   ): NTSTATUS; stdcall;
13784 begin
13785   GetProcedureAddress(_NtQueryDefaultLocale, ntdll, 'NtQueryDefaultLocale');
13786   Result := TFNNtQueryDefaultLocale(_NtQueryDefaultLocale)(
13787     ThreadOrSystem, Locale
13788   );
13789 end;
13790 
13791 // Dynamic version of NtQueryDefaultUILanguage
13792 function  NtQueryDefaultUILanguage(
13793     LanguageId : PLANGID
13794   ): NTSTATUS; stdcall;
13795 begin
13796   GetProcedureAddress(_NtQueryDefaultUILanguage, ntdll, 'NtQueryDefaultUILanguage');
13797   Result := TFNNtQueryDefaultUILanguage(_NtQueryDefaultUILanguage)(
13798     LanguageId
13799   );
13800 end;
13801 
13802 // Dynamic version of NtQueryDefaultUILanguage
13803 function  ZwQueryDefaultUILanguage(
13804     LanguageId : PLANGID
13805   ): NTSTATUS; stdcall;
13806 begin
13807   GetProcedureAddress(_NtQueryDefaultUILanguage, ntdll, 'NtQueryDefaultUILanguage');
13808   Result := TFNNtQueryDefaultUILanguage(_NtQueryDefaultUILanguage)(
13809     LanguageId
13810   );
13811 end;
13812 
13813 // Dynamic version of NtQueryDirectoryFile
13814 function  NtQueryDirectoryFile(
13815     FileHandle : HANDLE;
13816     Event : HANDLE;
13817     ApcRoutine : PIO_APC_ROUTINE;
13818     ApcContext : PVOID;
13819     IoStatusBlock : PIO_STATUS_BLOCK;
13820     FileInformation : PVOID;
13821     FileInformationLength : ULONG;
13822     FileInformationClass : FILE_INFORMATION_CLASS;
13823     ReturnSingleEntry : BOOLEAN;
13824     FileName : PUNICODE_STRING;
13825     RestartScan : BOOLEAN
13826   ): NTSTATUS; stdcall;
13827 begin
13828   GetProcedureAddress(_NtQueryDirectoryFile, ntdll, 'NtQueryDirectoryFile');
13829   Result := TFNNtQueryDirectoryFile(_NtQueryDirectoryFile)(
13830     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation, FileInformationLength, FileInformationClass, ReturnSingleEntry, FileName, RestartScan
13831   );
13832 end;
13833 
13834 // Dynamic version of NtQueryDirectoryFile
13835 function  ZwQueryDirectoryFile(
13836     FileHandle : HANDLE;
13837     Event : HANDLE;
13838     ApcRoutine : PIO_APC_ROUTINE;
13839     ApcContext : PVOID;
13840     IoStatusBlock : PIO_STATUS_BLOCK;
13841     FileInformation : PVOID;
13842     FileInformationLength : ULONG;
13843     FileInformationClass : FILE_INFORMATION_CLASS;
13844     ReturnSingleEntry : BOOLEAN;
13845     FileName : PUNICODE_STRING;
13846     RestartScan : BOOLEAN
13847   ): NTSTATUS; stdcall;
13848 begin
13849   GetProcedureAddress(_NtQueryDirectoryFile, ntdll, 'NtQueryDirectoryFile');
13850   Result := TFNNtQueryDirectoryFile(_NtQueryDirectoryFile)(
13851     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation, FileInformationLength, FileInformationClass, ReturnSingleEntry, FileName, RestartScan
13852   );
13853 end;
13854 
13855 // Dynamic version of NtQueryDirectoryObject
13856 function  NtQueryDirectoryObject(
13857     DirectoryHandle : HANDLE;
13858     Buffer : PVOID;
13859     BufferLength : ULONG;
13860     ReturnSingleEntry : BOOLEAN;
13861     RestartScan : BOOLEAN;
13862     Context : PULONG;
13863     ReturnLength : PULONG
13864   ): NTSTATUS; stdcall;
13865 begin
13866   GetProcedureAddress(_NtQueryDirectoryObject, ntdll, 'NtQueryDirectoryObject');
13867   Result := TFNNtQueryDirectoryObject(_NtQueryDirectoryObject)(
13868     DirectoryHandle, Buffer, BufferLength, ReturnSingleEntry, RestartScan, Context, ReturnLength
13869   );
13870 end;
13871 
13872 // Dynamic version of NtQueryDirectoryObject
13873 function  ZwQueryDirectoryObject(
13874     DirectoryHandle : HANDLE;
13875     Buffer : PVOID;
13876     BufferLength : ULONG;
13877     ReturnSingleEntry : BOOLEAN;
13878     RestartScan : BOOLEAN;
13879     Context : PULONG;
13880     ReturnLength : PULONG
13881   ): NTSTATUS; stdcall;
13882 begin
13883   GetProcedureAddress(_NtQueryDirectoryObject, ntdll, 'NtQueryDirectoryObject');
13884   Result := TFNNtQueryDirectoryObject(_NtQueryDirectoryObject)(
13885     DirectoryHandle, Buffer, BufferLength, ReturnSingleEntry, RestartScan, Context, ReturnLength
13886   );
13887 end;
13888 
13889 // Dynamic version of NtQueryEaFile
13890 function  NtQueryEaFile(
13891     FileHandle : HANDLE;
13892     IoStatusBlock : PIO_STATUS_BLOCK;
13893     Buffer : PFILE_FULL_EA_INFORMATION;
13894     BufferLength : ULONG;
13895     ReturnSingleEntry : BOOLEAN;
13896     EaList : PFILE_GET_EA_INFORMATION;
13897     EaListLength : ULONG;
13898     EaIndex : PULONG;
13899     RestartScan : BOOLEAN
13900   ): NTSTATUS; stdcall;
13901 begin
13902   GetProcedureAddress(_NtQueryEaFile, ntdll, 'NtQueryEaFile');
13903   Result := TFNNtQueryEaFile(_NtQueryEaFile)(
13904     FileHandle, IoStatusBlock, Buffer, BufferLength, ReturnSingleEntry, EaList, EaListLength, EaIndex, RestartScan
13905   );
13906 end;
13907 
13908 // Dynamic version of NtQueryEaFile
13909 function  ZwQueryEaFile(
13910     FileHandle : HANDLE;
13911     IoStatusBlock : PIO_STATUS_BLOCK;
13912     Buffer : PFILE_FULL_EA_INFORMATION;
13913     BufferLength : ULONG;
13914     ReturnSingleEntry : BOOLEAN;
13915     EaList : PFILE_GET_EA_INFORMATION;
13916     EaListLength : ULONG;
13917     EaIndex : PULONG;
13918     RestartScan : BOOLEAN
13919   ): NTSTATUS; stdcall;
13920 begin
13921   GetProcedureAddress(_NtQueryEaFile, ntdll, 'NtQueryEaFile');
13922   Result := TFNNtQueryEaFile(_NtQueryEaFile)(
13923     FileHandle, IoStatusBlock, Buffer, BufferLength, ReturnSingleEntry, EaList, EaListLength, EaIndex, RestartScan
13924   );
13925 end;
13926 
13927 // Dynamic version of NtQueryEvent
13928 function  NtQueryEvent(
13929     EventHandle : HANDLE;
13930     EventInformationClass : EVENT_INFORMATION_CLASS;
13931     EventInformation : PVOID;
13932     EventInformationLength : ULONG;
13933     ResultLength : PULONG
13934   ): NTSTATUS; stdcall;
13935 begin
13936   GetProcedureAddress(_NtQueryEvent, ntdll, 'NtQueryEvent');
13937   Result := TFNNtQueryEvent(_NtQueryEvent)(
13938     EventHandle, EventInformationClass, EventInformation, EventInformationLength, ResultLength
13939   );
13940 end;
13941 
13942 // Dynamic version of NtQueryEvent
13943 function  ZwQueryEvent(
13944     EventHandle : HANDLE;
13945     EventInformationClass : EVENT_INFORMATION_CLASS;
13946     EventInformation : PVOID;
13947     EventInformationLength : ULONG;
13948     ResultLength : PULONG
13949   ): NTSTATUS; stdcall;
13950 begin
13951   GetProcedureAddress(_NtQueryEvent, ntdll, 'NtQueryEvent');
13952   Result := TFNNtQueryEvent(_NtQueryEvent)(
13953     EventHandle, EventInformationClass, EventInformation, EventInformationLength, ResultLength
13954   );
13955 end;
13956 
13957 // Dynamic version of NtQueryFullAttributesFile
13958 function  NtQueryFullAttributesFile(
13959     ObjectAttributes : POBJECT_ATTRIBUTES;
13960     FileInformation : PFILE_NETWORK_OPEN_INFORMATION
13961   ): NTSTATUS; stdcall;
13962 begin
13963   GetProcedureAddress(_NtQueryFullAttributesFile, ntdll, 'NtQueryFullAttributesFile');
13964   Result := TFNNtQueryFullAttributesFile(_NtQueryFullAttributesFile)(
13965     ObjectAttributes, FileInformation
13966   );
13967 end;
13968 
13969 // Dynamic version of NtQueryFullAttributesFile
13970 function  ZwQueryFullAttributesFile(
13971     ObjectAttributes : POBJECT_ATTRIBUTES;
13972     FileInformation : PFILE_NETWORK_OPEN_INFORMATION
13973   ): NTSTATUS; stdcall;
13974 begin
13975   GetProcedureAddress(_NtQueryFullAttributesFile, ntdll, 'NtQueryFullAttributesFile');
13976   Result := TFNNtQueryFullAttributesFile(_NtQueryFullAttributesFile)(
13977     ObjectAttributes, FileInformation
13978   );
13979 end;
13980 
13981 // Dynamic version of NtQueryInformationAtom
13982 function  NtQueryInformationAtom(
13983     Atom : USHORT;
13984     AtomInformationClass : ATOM_INFORMATION_CLASS;
13985     AtomInformation : PVOID;
13986     AtomInformationLength : ULONG;
13987     ReturnLength : PULONG
13988   ): NTSTATUS; stdcall;
13989 begin
13990   GetProcedureAddress(_NtQueryInformationAtom, ntdll, 'NtQueryInformationAtom');
13991   Result := TFNNtQueryInformationAtom(_NtQueryInformationAtom)(
13992     Atom, AtomInformationClass, AtomInformation, AtomInformationLength, ReturnLength
13993   );
13994 end;
13995 
13996 // Dynamic version of NtQueryInformationAtom
13997 function  ZwQueryInformationAtom(
13998     Atom : USHORT;
13999     AtomInformationClass : ATOM_INFORMATION_CLASS;
14000     AtomInformation : PVOID;
14001     AtomInformationLength : ULONG;
14002     ReturnLength : PULONG
14003   ): NTSTATUS; stdcall;
14004 begin
14005   GetProcedureAddress(_NtQueryInformationAtom, ntdll, 'NtQueryInformationAtom');
14006   Result := TFNNtQueryInformationAtom(_NtQueryInformationAtom)(
14007     Atom, AtomInformationClass, AtomInformation, AtomInformationLength, ReturnLength
14008   );
14009 end;
14010 
14011 // Dynamic version of NtQueryInformationFile
14012 function  NtQueryInformationFile(
14013     FileHandle : HANDLE;
14014     IoStatusBlock : PIO_STATUS_BLOCK;
14015     FileInformation : PVOID;
14016     FileInformationLength : ULONG;
14017     FileInformationClass : FILE_INFORMATION_CLASS
14018   ): NTSTATUS; stdcall;
14019 begin
14020   GetProcedureAddress(_NtQueryInformationFile, ntdll, 'NtQueryInformationFile');
14021   Result := TFNNtQueryInformationFile(_NtQueryInformationFile)(
14022     FileHandle, IoStatusBlock, FileInformation, FileInformationLength, FileInformationClass
14023   );
14024 end;
14025 
14026 // Dynamic version of NtQueryInformationFile
14027 function  ZwQueryInformationFile(
14028     FileHandle : HANDLE;
14029     IoStatusBlock : PIO_STATUS_BLOCK;
14030     FileInformation : PVOID;
14031     FileInformationLength : ULONG;
14032     FileInformationClass : FILE_INFORMATION_CLASS
14033   ): NTSTATUS; stdcall;
14034 begin
14035   GetProcedureAddress(_NtQueryInformationFile, ntdll, 'NtQueryInformationFile');
14036   Result := TFNNtQueryInformationFile(_NtQueryInformationFile)(
14037     FileHandle, IoStatusBlock, FileInformation, FileInformationLength, FileInformationClass
14038   );
14039 end;
14040 
14041 // Dynamic version of NtQueryInformationJobObject
14042 function  NtQueryInformationJobObject(
14043     JobHandle : HANDLE;
14044     JobInformationClass : JOBOBJECTINFOCLASS;
14045     JobInformation : PVOID;
14046     JobInformationLength : ULONG;
14047     ReturnLength : PULONG
14048   ): NTSTATUS; stdcall;
14049 begin
14050   GetProcedureAddress(_NtQueryInformationJobObject, ntdll, 'NtQueryInformationJobObject');
14051   Result := TFNNtQueryInformationJobObject(_NtQueryInformationJobObject)(
14052     JobHandle, JobInformationClass, JobInformation, JobInformationLength, ReturnLength
14053   );
14054 end;
14055 
14056 // Dynamic version of NtQueryInformationJobObject
14057 function  ZwQueryInformationJobObject(
14058     JobHandle : HANDLE;
14059     JobInformationClass : JOBOBJECTINFOCLASS;
14060     JobInformation : PVOID;
14061     JobInformationLength : ULONG;
14062     ReturnLength : PULONG
14063   ): NTSTATUS; stdcall;
14064 begin
14065   GetProcedureAddress(_NtQueryInformationJobObject, ntdll, 'NtQueryInformationJobObject');
14066   Result := TFNNtQueryInformationJobObject(_NtQueryInformationJobObject)(
14067     JobHandle, JobInformationClass, JobInformation, JobInformationLength, ReturnLength
14068   );
14069 end;
14070 
14071 // Dynamic version of NtQueryInformationPort
14072 function  NtQueryInformationPort(
14073     PortHandle : HANDLE;
14074     PortInformationClass : PORT_INFORMATION_CLASS;
14075     PortInformation : PVOID;
14076     PortInformationLength : ULONG;
14077     ReturnLength : PULONG
14078   ): NTSTATUS; stdcall;
14079 begin
14080   GetProcedureAddress(_NtQueryInformationPort, ntdll, 'NtQueryInformationPort');
14081   Result := TFNNtQueryInformationPort(_NtQueryInformationPort)(
14082     PortHandle, PortInformationClass, PortInformation, PortInformationLength, ReturnLength
14083   );
14084 end;
14085 
14086 // Dynamic version of NtQueryInformationPort
14087 function  ZwQueryInformationPort(
14088     PortHandle : HANDLE;
14089     PortInformationClass : PORT_INFORMATION_CLASS;
14090     PortInformation : PVOID;
14091     PortInformationLength : ULONG;
14092     ReturnLength : PULONG
14093   ): NTSTATUS; stdcall;
14094 begin
14095   GetProcedureAddress(_NtQueryInformationPort, ntdll, 'NtQueryInformationPort');
14096   Result := TFNNtQueryInformationPort(_NtQueryInformationPort)(
14097     PortHandle, PortInformationClass, PortInformation, PortInformationLength, ReturnLength
14098   );
14099 end;
14100 
14101 {$IFNDEF JWA_INCLUDEMODE}
14102 // Dynamic version of NtQueryInformationProcess
14103 function  NtQueryInformationProcess(
14104     ProcessHandle : HANDLE;
14105     ProcessInformationClass : PROCESSINFOCLASS;
14106     ProcessInformation : PVOID;
14107     ProcessInformationLength : ULONG;
14108     ReturnLength : PULONG
14109   ): NTSTATUS; stdcall;
14110 begin
14111   GetProcedureAddress(_NtQueryInformationProcess, ntdll, 'NtQueryInformationProcess');
14112   Result := TFNNtQueryInformationProcess(_NtQueryInformationProcess)(
14113     ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength
14114   );
14115 end;
14116 {$ENDIF JWA_INCLUDEMODE}
14117 
14118 // Dynamic version of NtQueryInformationProcess
14119 function  ZwQueryInformationProcess(
14120     ProcessHandle : HANDLE;
14121     ProcessInformationClass : PROCESSINFOCLASS;
14122     ProcessInformation : PVOID;
14123     ProcessInformationLength : ULONG;
14124     ReturnLength : PULONG
14125   ): NTSTATUS; stdcall;
14126 begin
14127   GetProcedureAddress(_NtQueryInformationProcess, ntdll, 'NtQueryInformationProcess');
14128   Result := TFNNtQueryInformationProcess(_NtQueryInformationProcess)(
14129     ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength
14130   );
14131 end;
14132 
14133 {$IFNDEF JWA_INCLUDEMODE}
14134 // Dynamic version of NtQueryInformationThread
14135 function  NtQueryInformationThread(
14136     ThreadHandle : HANDLE;
14137     ThreadInformationClass : THREADINFOCLASS;
14138     ThreadInformation : PVOID;
14139     ThreadInformationLength : ULONG;
14140     ReturnLength : PULONG
14141   ): NTSTATUS; stdcall;
14142 begin
14143   GetProcedureAddress(_NtQueryInformationThread, ntdll, 'NtQueryInformationThread');
14144   Result := TFNNtQueryInformationThread(_NtQueryInformationThread)(
14145     ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength
14146   );
14147 end;
14148 {$ENDIF JWA_INCLUDEMODE}
14149 
14150 // Dynamic version of NtQueryInformationThread
14151 function  ZwQueryInformationThread(
14152     ThreadHandle : HANDLE;
14153     ThreadInformationClass : THREADINFOCLASS;
14154     ThreadInformation : PVOID;
14155     ThreadInformationLength : ULONG;
14156     ReturnLength : PULONG
14157   ): NTSTATUS; stdcall;
14158 begin
14159   GetProcedureAddress(_NtQueryInformationThread, ntdll, 'NtQueryInformationThread');
14160   Result := TFNNtQueryInformationThread(_NtQueryInformationThread)(
14161     ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength
14162   );
14163 end;
14164 
14165 // Dynamic version of NtQueryInformationToken
14166 function  NtQueryInformationToken(
14167     TokenHandle : HANDLE;
14168     TokenInformationClass : TOKEN_INFORMATION_CLASS;
14169     TokenInformation : PVOID;
14170     TokenInformationLength : ULONG;
14171     ReturnLength : PULONG
14172   ): NTSTATUS; stdcall;
14173 begin
14174   GetProcedureAddress(_NtQueryInformationToken, ntdll, 'NtQueryInformationToken');
14175   Result := TFNNtQueryInformationToken(_NtQueryInformationToken)(
14176     TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength
14177   );
14178 end;
14179 
14180 // Dynamic version of NtQueryInformationToken
14181 function  ZwQueryInformationToken(
14182     TokenHandle : HANDLE;
14183     TokenInformationClass : TOKEN_INFORMATION_CLASS;
14184     TokenInformation : PVOID;
14185     TokenInformationLength : ULONG;
14186     ReturnLength : PULONG
14187   ): NTSTATUS; stdcall;
14188 begin
14189   GetProcedureAddress(_NtQueryInformationToken, ntdll, 'NtQueryInformationToken');
14190   Result := TFNNtQueryInformationToken(_NtQueryInformationToken)(
14191     TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength
14192   );
14193 end;
14194 
14195 // Dynamic version of NtQueryInstallUILanguage
14196 function  NtQueryInstallUILanguage(
14197     LanguageId : PLANGID
14198   ): NTSTATUS; stdcall;
14199 begin
14200   GetProcedureAddress(_NtQueryInstallUILanguage, ntdll, 'NtQueryInstallUILanguage');
14201   Result := TFNNtQueryInstallUILanguage(_NtQueryInstallUILanguage)(
14202     LanguageId
14203   );
14204 end;
14205 
14206 // Dynamic version of NtQueryInstallUILanguage
14207 function  ZwQueryInstallUILanguage(
14208     LanguageId : PLANGID
14209   ): NTSTATUS; stdcall;
14210 begin
14211   GetProcedureAddress(_NtQueryInstallUILanguage, ntdll, 'NtQueryInstallUILanguage');
14212   Result := TFNNtQueryInstallUILanguage(_NtQueryInstallUILanguage)(
14213     LanguageId
14214   );
14215 end;
14216 
14217 // Dynamic version of NtQueryIntervalProfile
14218 function  NtQueryIntervalProfile(
14219     Source : KPROFILE_SOURCE;
14220     Interval : PULONG
14221   ): NTSTATUS; stdcall;
14222 begin
14223   GetProcedureAddress(_NtQueryIntervalProfile, ntdll, 'NtQueryIntervalProfile');
14224   Result := TFNNtQueryIntervalProfile(_NtQueryIntervalProfile)(
14225     Source, Interval
14226   );
14227 end;
14228 
14229 // Dynamic version of NtQueryIntervalProfile
14230 function  ZwQueryIntervalProfile(
14231     Source : KPROFILE_SOURCE;
14232     Interval : PULONG
14233   ): NTSTATUS; stdcall;
14234 begin
14235   GetProcedureAddress(_NtQueryIntervalProfile, ntdll, 'NtQueryIntervalProfile');
14236   Result := TFNNtQueryIntervalProfile(_NtQueryIntervalProfile)(
14237     Source, Interval
14238   );
14239 end;
14240 
14241 // Dynamic version of NtQueryIoCompletion
14242 function  NtQueryIoCompletion(
14243     IoCompletionHandle : HANDLE;
14244     IoCompletionInformationClass : IO_COMPLETION_INFORMATION_CLASS;
14245     IoCompletionInformation : PVOID;
14246     IoCompletionInformationLength : ULONG;
14247     ResultLength : PULONG
14248   ): NTSTATUS; stdcall;
14249 begin
14250   GetProcedureAddress(_NtQueryIoCompletion, ntdll, 'NtQueryIoCompletion');
14251   Result := TFNNtQueryIoCompletion(_NtQueryIoCompletion)(
14252     IoCompletionHandle, IoCompletionInformationClass, IoCompletionInformation, IoCompletionInformationLength, ResultLength
14253   );
14254 end;
14255 
14256 // Dynamic version of NtQueryIoCompletion
14257 function  ZwQueryIoCompletion(
14258     IoCompletionHandle : HANDLE;
14259     IoCompletionInformationClass : IO_COMPLETION_INFORMATION_CLASS;
14260     IoCompletionInformation : PVOID;
14261     IoCompletionInformationLength : ULONG;
14262     ResultLength : PULONG
14263   ): NTSTATUS; stdcall;
14264 begin
14265   GetProcedureAddress(_NtQueryIoCompletion, ntdll, 'NtQueryIoCompletion');
14266   Result := TFNNtQueryIoCompletion(_NtQueryIoCompletion)(
14267     IoCompletionHandle, IoCompletionInformationClass, IoCompletionInformation, IoCompletionInformationLength, ResultLength
14268   );
14269 end;
14270 
14271 // Dynamic version of NtQueryKey
14272 function  NtQueryKey(
14273     KeyHandle : HANDLE;
14274     KeyInformationClass : KEY_INFORMATION_CLASS;
14275     KeyInformation : PVOID;
14276     KeyInformationLength : ULONG;
14277     ResultLength : PULONG
14278   ): NTSTATUS; stdcall;
14279 begin
14280   GetProcedureAddress(_NtQueryKey, ntdll, 'NtQueryKey');
14281   Result := TFNNtQueryKey(_NtQueryKey)(
14282     KeyHandle, KeyInformationClass, KeyInformation, KeyInformationLength, ResultLength
14283   );
14284 end;
14285 
14286 // Dynamic version of NtQueryKey
14287 function  ZwQueryKey(
14288     KeyHandle : HANDLE;
14289     KeyInformationClass : KEY_INFORMATION_CLASS;
14290     KeyInformation : PVOID;
14291     KeyInformationLength : ULONG;
14292     ResultLength : PULONG
14293   ): NTSTATUS; stdcall;
14294 begin
14295   GetProcedureAddress(_NtQueryKey, ntdll, 'NtQueryKey');
14296   Result := TFNNtQueryKey(_NtQueryKey)(
14297     KeyHandle, KeyInformationClass, KeyInformation, KeyInformationLength, ResultLength
14298   );
14299 end;
14300 
14301 // Dynamic version of NtQueryMultipleValueKey
14302 function  NtQueryMultipleValueKey(
14303     KeyHandle : HANDLE;
14304     ValueList : PKEY_VALUE_ENTRY;
14305     NumberOfValues : ULONG;
14306     Buffer : PVOID;
14307     Length : PULONG;
14308     ReturnLength : PULONG
14309   ): NTSTATUS; stdcall;
14310 begin
14311   GetProcedureAddress(_NtQueryMultipleValueKey, ntdll, 'NtQueryMultipleValueKey');
14312   Result := TFNNtQueryMultipleValueKey(_NtQueryMultipleValueKey)(
14313     KeyHandle, ValueList, NumberOfValues, Buffer, Length, ReturnLength
14314   );
14315 end;
14316 
14317 // Dynamic version of NtQueryMultipleValueKey
14318 function  ZwQueryMultipleValueKey(
14319     KeyHandle : HANDLE;
14320     ValueList : PKEY_VALUE_ENTRY;
14321     NumberOfValues : ULONG;
14322     Buffer : PVOID;
14323     Length : PULONG;
14324     ReturnLength : PULONG
14325   ): NTSTATUS; stdcall;
14326 begin
14327   GetProcedureAddress(_NtQueryMultipleValueKey, ntdll, 'NtQueryMultipleValueKey');
14328   Result := TFNNtQueryMultipleValueKey(_NtQueryMultipleValueKey)(
14329     KeyHandle, ValueList, NumberOfValues, Buffer, Length, ReturnLength
14330   );
14331 end;
14332 
14333 // Dynamic version of NtQueryMutant
14334 function  NtQueryMutant(
14335     MutantHandle : HANDLE;
14336     MutantInformationClass : MUTANT_INFORMATION_CLASS;
14337     MutantInformation : PVOID;
14338     MutantInformationLength : ULONG;
14339     ResultLength : PULONG
14340   ): NTSTATUS; stdcall;
14341 begin
14342   GetProcedureAddress(_NtQueryMutant, ntdll, 'NtQueryMutant');
14343   Result := TFNNtQueryMutant(_NtQueryMutant)(
14344     MutantHandle, MutantInformationClass, MutantInformation, MutantInformationLength, ResultLength
14345   );
14346 end;
14347 
14348 // Dynamic version of NtQueryMutant
14349 function  ZwQueryMutant(
14350     MutantHandle : HANDLE;
14351     MutantInformationClass : MUTANT_INFORMATION_CLASS;
14352     MutantInformation : PVOID;
14353     MutantInformationLength : ULONG;
14354     ResultLength : PULONG
14355   ): NTSTATUS; stdcall;
14356 begin
14357   GetProcedureAddress(_NtQueryMutant, ntdll, 'NtQueryMutant');
14358   Result := TFNNtQueryMutant(_NtQueryMutant)(
14359     MutantHandle, MutantInformationClass, MutantInformation, MutantInformationLength, ResultLength
14360   );
14361 end;
14362 
14363 // Dynamic version of NtQueryObject
14364 function  NtQueryObject(
14365     ObjectHandle : HANDLE;
14366     ObjectInformationClass : OBJECT_INFORMATION_CLASS;
14367     ObjectInformation : PVOID;
14368     ObjectInformationLength : ULONG;
14369     ReturnLength : PULONG
14370   ): NTSTATUS; stdcall;
14371 begin
14372   GetProcedureAddress(_NtQueryObject, ntdll, 'NtQueryObject');
14373   Result := TFNNtQueryObject(_NtQueryObject)(
14374     ObjectHandle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength
14375   );
14376 end;
14377 
14378 // Dynamic version of NtQueryObject
14379 function  ZwQueryObject(
14380     ObjectHandle : HANDLE;
14381     ObjectInformationClass : OBJECT_INFORMATION_CLASS;
14382     ObjectInformation : PVOID;
14383     ObjectInformationLength : ULONG;
14384     ReturnLength : PULONG
14385   ): NTSTATUS; stdcall;
14386 begin
14387   GetProcedureAddress(_NtQueryObject, ntdll, 'NtQueryObject');
14388   Result := TFNNtQueryObject(_NtQueryObject)(
14389     ObjectHandle, ObjectInformationClass, ObjectInformation, ObjectInformationLength, ReturnLength
14390   );
14391 end;
14392 
14393 // Dynamic version of NtQueryOpenSubKeys
14394 function  NtQueryOpenSubKeys(
14395     KeyObjectAttributes : POBJECT_ATTRIBUTES;
14396     NumberOfKey : PULONG
14397   ): NTSTATUS; stdcall;
14398 begin
14399   GetProcedureAddress(_NtQueryOpenSubKeys, ntdll, 'NtQueryOpenSubKeys');
14400   Result := TFNNtQueryOpenSubKeys(_NtQueryOpenSubKeys)(
14401     KeyObjectAttributes, NumberOfKey
14402   );
14403 end;
14404 
14405 // Dynamic version of NtQueryOpenSubKeys
14406 function  ZwQueryOpenSubKeys(
14407     KeyObjectAttributes : POBJECT_ATTRIBUTES;
14408     NumberOfKey : PULONG
14409   ): NTSTATUS; stdcall;
14410 begin
14411   GetProcedureAddress(_NtQueryOpenSubKeys, ntdll, 'NtQueryOpenSubKeys');
14412   Result := TFNNtQueryOpenSubKeys(_NtQueryOpenSubKeys)(
14413     KeyObjectAttributes, NumberOfKey
14414   );
14415 end;
14416 
14417 // Dynamic version of NtQueryPerformanceCounter
14418 function  NtQueryPerformanceCounter(
14419     PerformanceCount : PLARGE_INTEGER;
14420     PerformanceFrequency : PLARGE_INTEGER
14421   ): NTSTATUS; stdcall;
14422 begin
14423   GetProcedureAddress(_NtQueryPerformanceCounter, ntdll, 'NtQueryPerformanceCounter');
14424   Result := TFNNtQueryPerformanceCounter(_NtQueryPerformanceCounter)(
14425     PerformanceCount, PerformanceFrequency
14426   );
14427 end;
14428 
14429 // Dynamic version of NtQueryPerformanceCounter
14430 function  ZwQueryPerformanceCounter(
14431     PerformanceCount : PLARGE_INTEGER;
14432     PerformanceFrequency : PLARGE_INTEGER
14433   ): NTSTATUS; stdcall;
14434 begin
14435   GetProcedureAddress(_NtQueryPerformanceCounter, ntdll, 'NtQueryPerformanceCounter');
14436   Result := TFNNtQueryPerformanceCounter(_NtQueryPerformanceCounter)(
14437     PerformanceCount, PerformanceFrequency
14438   );
14439 end;
14440 
14441 // Dynamic version of NtQueryPortInformationProcess
14442 function  NtQueryPortInformationProcess(): ULONG; stdcall;
14443 begin
14444   GetProcedureAddress(_NtQueryPortInformationProcess, ntdll, 'NtQueryPortInformationProcess');
14445   Result := TFNNtQueryPortInformationProcess(_NtQueryPortInformationProcess)();
14446 end;
14447 
14448 // Dynamic version of NtQueryPortInformationProcess
14449 function  ZwQueryPortInformationProcess(): ULONG; stdcall;
14450 begin
14451   GetProcedureAddress(_NtQueryPortInformationProcess, ntdll, 'NtQueryPortInformationProcess');
14452   Result := TFNNtQueryPortInformationProcess(_NtQueryPortInformationProcess)();
14453 end;
14454 
14455 // Dynamic version of NtQueryQuotaInformationFile
14456 function  NtQueryQuotaInformationFile(
14457     FileHandle : HANDLE;
14458     IoStatusBlock : PIO_STATUS_BLOCK;
14459     Buffer : PFILE_USER_QUOTA_INFORMATION;
14460     BufferLength : ULONG;
14461     ReturnSingleEntry : BOOLEAN;
14462     QuotaList : PFILE_QUOTA_LIST_INFORMATION;
14463     QuotaListLength : ULONG;
14464     ResumeSid : PSID;
14465     RestartScan : BOOLEAN
14466   ): NTSTATUS; stdcall;
14467 begin
14468   GetProcedureAddress(_NtQueryQuotaInformationFile, ntdll, 'NtQueryQuotaInformationFile');
14469   Result := TFNNtQueryQuotaInformationFile(_NtQueryQuotaInformationFile)(
14470     FileHandle, IoStatusBlock, Buffer, BufferLength, ReturnSingleEntry, QuotaList, QuotaListLength, ResumeSid, RestartScan
14471   );
14472 end;
14473 
14474 // Dynamic version of NtQueryQuotaInformationFile
14475 function  ZwQueryQuotaInformationFile(
14476     FileHandle : HANDLE;
14477     IoStatusBlock : PIO_STATUS_BLOCK;
14478     Buffer : PFILE_USER_QUOTA_INFORMATION;
14479     BufferLength : ULONG;
14480     ReturnSingleEntry : BOOLEAN;
14481     QuotaList : PFILE_QUOTA_LIST_INFORMATION;
14482     QuotaListLength : ULONG;
14483     ResumeSid : PSID;
14484     RestartScan : BOOLEAN
14485   ): NTSTATUS; stdcall;
14486 begin
14487   GetProcedureAddress(_NtQueryQuotaInformationFile, ntdll, 'NtQueryQuotaInformationFile');
14488   Result := TFNNtQueryQuotaInformationFile(_NtQueryQuotaInformationFile)(
14489     FileHandle, IoStatusBlock, Buffer, BufferLength, ReturnSingleEntry, QuotaList, QuotaListLength, ResumeSid, RestartScan
14490   );
14491 end;
14492 
14493 // Dynamic version of NtQuerySection
14494 function  NtQuerySection(
14495     SectionHandle : HANDLE;
14496     SectionInformationClass : SECTION_INFORMATION_CLASS;
14497     SectionInformation : PVOID;
14498     SectionInformationLength : ULONG;
14499     ResultLength : PULONG
14500   ): NTSTATUS; stdcall;
14501 begin
14502   GetProcedureAddress(_NtQuerySection, ntdll, 'NtQuerySection');
14503   Result := TFNNtQuerySection(_NtQuerySection)(
14504     SectionHandle, SectionInformationClass, SectionInformation, SectionInformationLength, ResultLength
14505   );
14506 end;
14507 
14508 // Dynamic version of NtQuerySection
14509 function  ZwQuerySection(
14510     SectionHandle : HANDLE;
14511     SectionInformationClass : SECTION_INFORMATION_CLASS;
14512     SectionInformation : PVOID;
14513     SectionInformationLength : ULONG;
14514     ResultLength : PULONG
14515   ): NTSTATUS; stdcall;
14516 begin
14517   GetProcedureAddress(_NtQuerySection, ntdll, 'NtQuerySection');
14518   Result := TFNNtQuerySection(_NtQuerySection)(
14519     SectionHandle, SectionInformationClass, SectionInformation, SectionInformationLength, ResultLength
14520   );
14521 end;
14522 
14523 // Dynamic version of NtQuerySecurityObject
14524 function  NtQuerySecurityObject(
14525     Handle : HANDLE;
14526     RequestedInformation : SECURITY_INFORMATION;
14527     SecurityDescriptor : PSECURITY_DESCRIPTOR;
14528     SecurityDescriptorLength : ULONG;
14529     ReturnLength : PULONG
14530   ): NTSTATUS; stdcall;
14531 begin
14532   GetProcedureAddress(_NtQuerySecurityObject, ntdll, 'NtQuerySecurityObject');
14533   Result := TFNNtQuerySecurityObject(_NtQuerySecurityObject)(
14534     Handle, RequestedInformation, SecurityDescriptor, SecurityDescriptorLength, ReturnLength
14535   );
14536 end;
14537 
14538 // Dynamic version of NtQuerySecurityObject
14539 function  ZwQuerySecurityObject(
14540     Handle : HANDLE;
14541     RequestedInformation : SECURITY_INFORMATION;
14542     SecurityDescriptor : PSECURITY_DESCRIPTOR;
14543     SecurityDescriptorLength : ULONG;
14544     ReturnLength : PULONG
14545   ): NTSTATUS; stdcall;
14546 begin
14547   GetProcedureAddress(_NtQuerySecurityObject, ntdll, 'NtQuerySecurityObject');
14548   Result := TFNNtQuerySecurityObject(_NtQuerySecurityObject)(
14549     Handle, RequestedInformation, SecurityDescriptor, SecurityDescriptorLength, ReturnLength
14550   );
14551 end;
14552 
14553 // Dynamic version of NtQuerySemaphore
14554 function  NtQuerySemaphore(
14555     SemaphoreHandle : HANDLE;
14556     SemaphoreInformationClass : SEMAPHORE_INFORMATION_CLASS;
14557     SemaphoreInformation : PVOID;
14558     SemaphoreInformationLength : ULONG;
14559     ResultLength : PULONG
14560   ): NTSTATUS; stdcall;
14561 begin
14562   GetProcedureAddress(_NtQuerySemaphore, ntdll, 'NtQuerySemaphore');
14563   Result := TFNNtQuerySemaphore(_NtQuerySemaphore)(
14564     SemaphoreHandle, SemaphoreInformationClass, SemaphoreInformation, SemaphoreInformationLength, ResultLength
14565   );
14566 end;
14567 
14568 // Dynamic version of NtQuerySemaphore
14569 function  ZwQuerySemaphore(
14570     SemaphoreHandle : HANDLE;
14571     SemaphoreInformationClass : SEMAPHORE_INFORMATION_CLASS;
14572     SemaphoreInformation : PVOID;
14573     SemaphoreInformationLength : ULONG;
14574     ResultLength : PULONG
14575   ): NTSTATUS; stdcall;
14576 begin
14577   GetProcedureAddress(_NtQuerySemaphore, ntdll, 'NtQuerySemaphore');
14578   Result := TFNNtQuerySemaphore(_NtQuerySemaphore)(
14579     SemaphoreHandle, SemaphoreInformationClass, SemaphoreInformation, SemaphoreInformationLength, ResultLength
14580   );
14581 end;
14582 
14583 // Dynamic version of NtQuerySymbolicLinkObject
14584 function  NtQuerySymbolicLinkObject(
14585     SymbolicLinkHandle : HANDLE;
14586     TargetName : PUNICODE_STRING;
14587     ReturnLength : PULONG
14588   ): NTSTATUS; stdcall;
14589 begin
14590   GetProcedureAddress(_NtQuerySymbolicLinkObject, ntdll, 'NtQuerySymbolicLinkObject');
14591   Result := TFNNtQuerySymbolicLinkObject(_NtQuerySymbolicLinkObject)(
14592     SymbolicLinkHandle, TargetName, ReturnLength
14593   );
14594 end;
14595 
14596 // Dynamic version of NtQuerySymbolicLinkObject
14597 function  ZwQuerySymbolicLinkObject(
14598     SymbolicLinkHandle : HANDLE;
14599     TargetName : PUNICODE_STRING;
14600     ReturnLength : PULONG
14601   ): NTSTATUS; stdcall;
14602 begin
14603   GetProcedureAddress(_NtQuerySymbolicLinkObject, ntdll, 'NtQuerySymbolicLinkObject');
14604   Result := TFNNtQuerySymbolicLinkObject(_NtQuerySymbolicLinkObject)(
14605     SymbolicLinkHandle, TargetName, ReturnLength
14606   );
14607 end;
14608 
14609 // Dynamic version of NtQuerySystemEnvironmentValue
14610 function  NtQuerySystemEnvironmentValue(
14611     Name : PUNICODE_STRING;
14612     Value : PVOID;
14613     ValueLength : ULONG;
14614     ReturnLength : PULONG
14615   ): NTSTATUS; stdcall;
14616 begin
14617   GetProcedureAddress(_NtQuerySystemEnvironmentValue, ntdll, 'NtQuerySystemEnvironmentValue');
14618   Result := TFNNtQuerySystemEnvironmentValue(_NtQuerySystemEnvironmentValue)(
14619     Name, Value, ValueLength, ReturnLength
14620   );
14621 end;
14622 
14623 // Dynamic version of NtQuerySystemEnvironmentValue
14624 function  ZwQuerySystemEnvironmentValue(
14625     Name : PUNICODE_STRING;
14626     Value : PVOID;
14627     ValueLength : ULONG;
14628     ReturnLength : PULONG
14629   ): NTSTATUS; stdcall;
14630 begin
14631   GetProcedureAddress(_NtQuerySystemEnvironmentValue, ntdll, 'NtQuerySystemEnvironmentValue');
14632   Result := TFNNtQuerySystemEnvironmentValue(_NtQuerySystemEnvironmentValue)(
14633     Name, Value, ValueLength, ReturnLength
14634   );
14635 end;
14636 
14637 {$IFNDEF JWA_INCLUDEMODE}
14638 // Dynamic version of NtQuerySystemInformation
14639 function  NtQuerySystemInformation(
14640     SystemInformationClass : SYSTEM_INFORMATION_CLASS;
14641     SystemInformation : PVOID;
14642     SystemInformationLength : ULONG;
14643     ReturnLength : PULONG
14644   ): NTSTATUS; stdcall;
14645 begin
14646   GetProcedureAddress(_NtQuerySystemInformation, ntdll, 'NtQuerySystemInformation');
14647   Result := TFNNtQuerySystemInformation(_NtQuerySystemInformation)(
14648     SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength
14649   );
14650 end;
14651 {$ENDIF JWA_INCLUDEMODE}
14652 
14653 // Dynamic version of NtQuerySystemInformation
14654 function  ZwQuerySystemInformation(
14655     SystemInformationClass : SYSTEM_INFORMATION_CLASS;
14656     SystemInformation : PVOID;
14657     SystemInformationLength : ULONG;
14658     ReturnLength : PULONG
14659   ): NTSTATUS; stdcall;
14660 begin
14661   GetProcedureAddress(_NtQuerySystemInformation, ntdll, 'NtQuerySystemInformation');
14662   Result := TFNNtQuerySystemInformation(_NtQuerySystemInformation)(
14663     SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength
14664   );
14665 end;
14666 
14667 {$IFNDEF JWA_INCLUDEMODE}
14668 // Dynamic version of NtQuerySystemTime
14669 function  NtQuerySystemTime(
14670     CurrentTime : PLARGE_INTEGER
14671   ): NTSTATUS; stdcall;
14672 begin
14673   GetProcedureAddress(_NtQuerySystemTime, ntdll, 'NtQuerySystemTime');
14674   Result := TFNNtQuerySystemTime(_NtQuerySystemTime)(
14675     CurrentTime
14676   );
14677 end;
14678 {$ENDIF JWA_INCLUDEMODE}
14679 
14680 // Dynamic version of NtQuerySystemTime
14681 function  ZwQuerySystemTime(
14682     CurrentTime : PLARGE_INTEGER
14683   ): NTSTATUS; stdcall;
14684 begin
14685   GetProcedureAddress(_NtQuerySystemTime, ntdll, 'NtQuerySystemTime');
14686   Result := TFNNtQuerySystemTime(_NtQuerySystemTime)(
14687     CurrentTime
14688   );
14689 end;
14690 
14691 // Dynamic version of NtQueryTimer
14692 function  NtQueryTimer(
14693     TimerHandle : HANDLE;
14694     TimerInformationClass : TIMER_INFORMATION_CLASS;
14695     TimerInformation : PVOID;
14696     TimerInformationLength : ULONG;
14697     ResultLength : PULONG
14698   ): NTSTATUS; stdcall;
14699 begin
14700   GetProcedureAddress(_NtQueryTimer, ntdll, 'NtQueryTimer');
14701   Result := TFNNtQueryTimer(_NtQueryTimer)(
14702     TimerHandle, TimerInformationClass, TimerInformation, TimerInformationLength, ResultLength
14703   );
14704 end;
14705 
14706 // Dynamic version of NtQueryTimer
14707 function  ZwQueryTimer(
14708     TimerHandle : HANDLE;
14709     TimerInformationClass : TIMER_INFORMATION_CLASS;
14710     TimerInformation : PVOID;
14711     TimerInformationLength : ULONG;
14712     ResultLength : PULONG
14713   ): NTSTATUS; stdcall;
14714 begin
14715   GetProcedureAddress(_NtQueryTimer, ntdll, 'NtQueryTimer');
14716   Result := TFNNtQueryTimer(_NtQueryTimer)(
14717     TimerHandle, TimerInformationClass, TimerInformation, TimerInformationLength, ResultLength
14718   );
14719 end;
14720 
14721 // Dynamic version of NtQueryTimerResolution
14722 function  NtQueryTimerResolution(
14723     CoarsestResolution : PULONG;
14724     FinestResolution : PULONG;
14725     ActualResolution : PULONG
14726   ): NTSTATUS; stdcall;
14727 begin
14728   GetProcedureAddress(_NtQueryTimerResolution, ntdll, 'NtQueryTimerResolution');
14729   Result := TFNNtQueryTimerResolution(_NtQueryTimerResolution)(
14730     CoarsestResolution, FinestResolution, ActualResolution
14731   );
14732 end;
14733 
14734 // Dynamic version of NtQueryTimerResolution
14735 function  ZwQueryTimerResolution(
14736     CoarsestResolution : PULONG;
14737     FinestResolution : PULONG;
14738     ActualResolution : PULONG
14739   ): NTSTATUS; stdcall;
14740 begin
14741   GetProcedureAddress(_NtQueryTimerResolution, ntdll, 'NtQueryTimerResolution');
14742   Result := TFNNtQueryTimerResolution(_NtQueryTimerResolution)(
14743     CoarsestResolution, FinestResolution, ActualResolution
14744   );
14745 end;
14746 
14747 // Dynamic version of NtQueryValueKey
14748 function  NtQueryValueKey(
14749     KeyHandle : HANDLE;
14750     ValueName : PUNICODE_STRING;
14751     KeyValueInformationClass : KEY_VALUE_INFORMATION_CLASS;
14752     KeyValueInformation : PVOID;
14753     KeyValueInformationLength : ULONG;
14754     ResultLength : PULONG
14755   ): NTSTATUS; stdcall;
14756 begin
14757   GetProcedureAddress(_NtQueryValueKey, ntdll, 'NtQueryValueKey');
14758   Result := TFNNtQueryValueKey(_NtQueryValueKey)(
14759     KeyHandle, ValueName, KeyValueInformationClass, KeyValueInformation, KeyValueInformationLength, ResultLength
14760   );
14761 end;
14762 
14763 // Dynamic version of NtQueryValueKey
14764 function  ZwQueryValueKey(
14765     KeyHandle : HANDLE;
14766     ValueName : PUNICODE_STRING;
14767     KeyValueInformationClass : KEY_VALUE_INFORMATION_CLASS;
14768     KeyValueInformation : PVOID;
14769     KeyValueInformationLength : ULONG;
14770     ResultLength : PULONG
14771   ): NTSTATUS; stdcall;
14772 begin
14773   GetProcedureAddress(_NtQueryValueKey, ntdll, 'NtQueryValueKey');
14774   Result := TFNNtQueryValueKey(_NtQueryValueKey)(
14775     KeyHandle, ValueName, KeyValueInformationClass, KeyValueInformation, KeyValueInformationLength, ResultLength
14776   );
14777 end;
14778 
14779 // Dynamic version of NtQueryVirtualMemory
14780 function  NtQueryVirtualMemory(
14781     ProcessHandle : HANDLE;
14782     BaseAddress : PVOID;
14783     MemoryInformationClass : MEMORY_INFORMATION_CLASS;
14784     MemoryInformation : PVOID;
14785     MemoryInformationLength : ULONG;
14786     ReturnLength : PULONG
14787   ): NTSTATUS; stdcall;
14788 begin
14789   GetProcedureAddress(_NtQueryVirtualMemory, ntdll, 'NtQueryVirtualMemory');
14790   Result := TFNNtQueryVirtualMemory(_NtQueryVirtualMemory)(
14791     ProcessHandle, BaseAddress, MemoryInformationClass, MemoryInformation, MemoryInformationLength, ReturnLength
14792   );
14793 end;
14794 
14795 // Dynamic version of NtQueryVirtualMemory
14796 function  ZwQueryVirtualMemory(
14797     ProcessHandle : HANDLE;
14798     BaseAddress : PVOID;
14799     MemoryInformationClass : MEMORY_INFORMATION_CLASS;
14800     MemoryInformation : PVOID;
14801     MemoryInformationLength : ULONG;
14802     ReturnLength : PULONG
14803   ): NTSTATUS; stdcall;
14804 begin
14805   GetProcedureAddress(_NtQueryVirtualMemory, ntdll, 'NtQueryVirtualMemory');
14806   Result := TFNNtQueryVirtualMemory(_NtQueryVirtualMemory)(
14807     ProcessHandle, BaseAddress, MemoryInformationClass, MemoryInformation, MemoryInformationLength, ReturnLength
14808   );
14809 end;
14810 
14811 // Dynamic version of NtQueryVolumeInformationFile
14812 function  NtQueryVolumeInformationFile(
14813     FileHandle : HANDLE;
14814     IoStatusBlock : PIO_STATUS_BLOCK;
14815     VolumeInformation : PVOID;
14816     VolumeInformationLength : ULONG;
14817     VolumeInformationClass : FS_INFORMATION_CLASS
14818   ): NTSTATUS; stdcall;
14819 begin
14820   GetProcedureAddress(_NtQueryVolumeInformationFile, ntdll, 'NtQueryVolumeInformationFile');
14821   Result := TFNNtQueryVolumeInformationFile(_NtQueryVolumeInformationFile)(
14822     FileHandle, IoStatusBlock, VolumeInformation, VolumeInformationLength, VolumeInformationClass
14823   );
14824 end;
14825 
14826 // Dynamic version of NtQueryVolumeInformationFile
14827 function  ZwQueryVolumeInformationFile(
14828     FileHandle : HANDLE;
14829     IoStatusBlock : PIO_STATUS_BLOCK;
14830     VolumeInformation : PVOID;
14831     VolumeInformationLength : ULONG;
14832     VolumeInformationClass : FS_INFORMATION_CLASS
14833   ): NTSTATUS; stdcall;
14834 begin
14835   GetProcedureAddress(_NtQueryVolumeInformationFile, ntdll, 'NtQueryVolumeInformationFile');
14836   Result := TFNNtQueryVolumeInformationFile(_NtQueryVolumeInformationFile)(
14837     FileHandle, IoStatusBlock, VolumeInformation, VolumeInformationLength, VolumeInformationClass
14838   );
14839 end;
14840 
14841 // Dynamic version of NtQueueApcThread
14842 function  NtQueueApcThread(
14843     ThreadHandle : HANDLE;
14844     ApcRoutine : PKNORMAL_ROUTINE;
14845     ApcContext : PVOID;
14846     Argument1 : PVOID;
14847     Argument2 : PVOID
14848   ): NTSTATUS; stdcall;
14849 begin
14850   GetProcedureAddress(_NtQueueApcThread, ntdll, 'NtQueueApcThread');
14851   Result := TFNNtQueueApcThread(_NtQueueApcThread)(
14852     ThreadHandle, ApcRoutine, ApcContext, Argument1, Argument2
14853   );
14854 end;
14855 
14856 // Dynamic version of NtQueueApcThread
14857 function  ZwQueueApcThread(
14858     ThreadHandle : HANDLE;
14859     ApcRoutine : PKNORMAL_ROUTINE;
14860     ApcContext : PVOID;
14861     Argument1 : PVOID;
14862     Argument2 : PVOID
14863   ): NTSTATUS; stdcall;
14864 begin
14865   GetProcedureAddress(_NtQueueApcThread, ntdll, 'NtQueueApcThread');
14866   Result := TFNNtQueueApcThread(_NtQueueApcThread)(
14867     ThreadHandle, ApcRoutine, ApcContext, Argument1, Argument2
14868   );
14869 end;
14870 
14871 // Dynamic version of NtRaiseException
14872 function  NtRaiseException(
14873     ExceptionRecord : PEXCEPTION_RECORD;
14874     Context : PCONTEXT;
14875     SearchFrames : BOOLEAN
14876   ): NTSTATUS; stdcall;
14877 begin
14878   GetProcedureAddress(_NtRaiseException, ntdll, 'NtRaiseException');
14879   Result := TFNNtRaiseException(_NtRaiseException)(
14880     ExceptionRecord, Context, SearchFrames
14881   );
14882 end;
14883 
14884 // Dynamic version of NtRaiseException
14885 function  ZwRaiseException(
14886     ExceptionRecord : PEXCEPTION_RECORD;
14887     Context : PCONTEXT;
14888     SearchFrames : BOOLEAN
14889   ): NTSTATUS; stdcall;
14890 begin
14891   GetProcedureAddress(_NtRaiseException, ntdll, 'NtRaiseException');
14892   Result := TFNNtRaiseException(_NtRaiseException)(
14893     ExceptionRecord, Context, SearchFrames
14894   );
14895 end;
14896 
14897 // Dynamic version of NtRaiseHardError
14898 function  NtRaiseHardError(
14899     Status : NTSTATUS;
14900     NumberOfArguments : ULONG;
14901     StringArgumentsMask : ULONG;
14902     Arguments : PULONG;
14903     MessageBoxType : ULONG;
14904     MessageBoxResult : PULONG
14905   ): NTSTATUS; stdcall;
14906 begin
14907   GetProcedureAddress(_NtRaiseHardError, ntdll, 'NtRaiseHardError');
14908   Result := TFNNtRaiseHardError(_NtRaiseHardError)(
14909     Status, NumberOfArguments, StringArgumentsMask, Arguments, MessageBoxType, MessageBoxResult
14910   );
14911 end;
14912 
14913 // Dynamic version of NtRaiseHardError
14914 function  ZwRaiseHardError(
14915     Status : NTSTATUS;
14916     NumberOfArguments : ULONG;
14917     StringArgumentsMask : ULONG;
14918     Arguments : PULONG;
14919     MessageBoxType : ULONG;
14920     MessageBoxResult : PULONG
14921   ): NTSTATUS; stdcall;
14922 begin
14923   GetProcedureAddress(_NtRaiseHardError, ntdll, 'NtRaiseHardError');
14924   Result := TFNNtRaiseHardError(_NtRaiseHardError)(
14925     Status, NumberOfArguments, StringArgumentsMask, Arguments, MessageBoxType, MessageBoxResult
14926   );
14927 end;
14928 
14929 // Dynamic version of NtReadFile
14930 function  NtReadFile(
14931     FileHandle : HANDLE;
14932     Event : HANDLE;
14933     ApcRoutine : PIO_APC_ROUTINE;
14934     ApcContext : PVOID;
14935     IoStatusBlock : PIO_STATUS_BLOCK;
14936     Buffer : PVOID;
14937     Length : ULONG;
14938     ByteOffset : PLARGE_INTEGER;
14939     Key : PULONG
14940   ): NTSTATUS; stdcall;
14941 begin
14942   GetProcedureAddress(_NtReadFile, ntdll, 'NtReadFile');
14943   Result := TFNNtReadFile(_NtReadFile)(
14944     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
14945   );
14946 end;
14947 
14948 // Dynamic version of NtReadFile
14949 function  ZwReadFile(
14950     FileHandle : HANDLE;
14951     Event : HANDLE;
14952     ApcRoutine : PIO_APC_ROUTINE;
14953     ApcContext : PVOID;
14954     IoStatusBlock : PIO_STATUS_BLOCK;
14955     Buffer : PVOID;
14956     Length : ULONG;
14957     ByteOffset : PLARGE_INTEGER;
14958     Key : PULONG
14959   ): NTSTATUS; stdcall;
14960 begin
14961   GetProcedureAddress(_NtReadFile, ntdll, 'NtReadFile');
14962   Result := TFNNtReadFile(_NtReadFile)(
14963     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
14964   );
14965 end;
14966 
14967 // Dynamic version of NtReadFileScatter
14968 function  NtReadFileScatter(
14969     FileHandle : HANDLE;
14970     Event : HANDLE;
14971     ApcRoutine : PIO_APC_ROUTINE;
14972     ApcContext : PVOID;
14973     IoStatusBlock : PIO_STATUS_BLOCK;
14974     Buffer : PFILE_SEGMENT_ELEMENT;
14975     Length : ULONG;
14976     ByteOffset : PLARGE_INTEGER;
14977     Key : PULONG
14978   ): NTSTATUS; stdcall;
14979 begin
14980   GetProcedureAddress(_NtReadFileScatter, ntdll, 'NtReadFileScatter');
14981   Result := TFNNtReadFileScatter(_NtReadFileScatter)(
14982     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
14983   );
14984 end;
14985 
14986 // Dynamic version of NtReadFileScatter
14987 function  ZwReadFileScatter(
14988     FileHandle : HANDLE;
14989     Event : HANDLE;
14990     ApcRoutine : PIO_APC_ROUTINE;
14991     ApcContext : PVOID;
14992     IoStatusBlock : PIO_STATUS_BLOCK;
14993     Buffer : PFILE_SEGMENT_ELEMENT;
14994     Length : ULONG;
14995     ByteOffset : PLARGE_INTEGER;
14996     Key : PULONG
14997   ): NTSTATUS; stdcall;
14998 begin
14999   GetProcedureAddress(_NtReadFileScatter, ntdll, 'NtReadFileScatter');
15000   Result := TFNNtReadFileScatter(_NtReadFileScatter)(
15001     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
15002   );
15003 end;
15004 
15005 // Dynamic version of NtReadRequestData
15006 function  NtReadRequestData(
15007     PortHandle : HANDLE;
15008     Message : PPORT_MESSAGE;
15009     Index : ULONG;
15010     Buffer : PVOID;
15011     BufferLength : ULONG;
15012     ReturnLength : PULONG
15013   ): NTSTATUS; stdcall;
15014 begin
15015   GetProcedureAddress(_NtReadRequestData, ntdll, 'NtReadRequestData');
15016   Result := TFNNtReadRequestData(_NtReadRequestData)(
15017     PortHandle, Message, Index, Buffer, BufferLength, ReturnLength
15018   );
15019 end;
15020 
15021 // Dynamic version of NtReadRequestData
15022 function  ZwReadRequestData(
15023     PortHandle : HANDLE;
15024     Message : PPORT_MESSAGE;
15025     Index : ULONG;
15026     Buffer : PVOID;
15027     BufferLength : ULONG;
15028     ReturnLength : PULONG
15029   ): NTSTATUS; stdcall;
15030 begin
15031   GetProcedureAddress(_NtReadRequestData, ntdll, 'NtReadRequestData');
15032   Result := TFNNtReadRequestData(_NtReadRequestData)(
15033     PortHandle, Message, Index, Buffer, BufferLength, ReturnLength
15034   );
15035 end;
15036 
15037 // Dynamic version of NtReadVirtualMemory
15038 function  NtReadVirtualMemory(
15039     ProcessHandle : HANDLE;
15040     BaseAddress : PVOID;
15041     Buffer : PVOID;
15042     BufferLength : ULONG;
15043     ReturnLength : PULONG
15044   ): NTSTATUS; stdcall;
15045 begin
15046   GetProcedureAddress(_NtReadVirtualMemory, ntdll, 'NtReadVirtualMemory');
15047   Result := TFNNtReadVirtualMemory(_NtReadVirtualMemory)(
15048     ProcessHandle, BaseAddress, Buffer, BufferLength, ReturnLength
15049   );
15050 end;
15051 
15052 // Dynamic version of NtReadVirtualMemory
15053 function  ZwReadVirtualMemory(
15054     ProcessHandle : HANDLE;
15055     BaseAddress : PVOID;
15056     Buffer : PVOID;
15057     BufferLength : ULONG;
15058     ReturnLength : PULONG
15059   ): NTSTATUS; stdcall;
15060 begin
15061   GetProcedureAddress(_NtReadVirtualMemory, ntdll, 'NtReadVirtualMemory');
15062   Result := TFNNtReadVirtualMemory(_NtReadVirtualMemory)(
15063     ProcessHandle, BaseAddress, Buffer, BufferLength, ReturnLength
15064   );
15065 end;
15066 
15067 // Dynamic version of NtRegisterThreadTerminatePort
15068 function  NtRegisterThreadTerminatePort(
15069     PortHandle : HANDLE
15070   ): NTSTATUS; stdcall;
15071 begin
15072   GetProcedureAddress(_NtRegisterThreadTerminatePort, ntdll, 'NtRegisterThreadTerminatePort');
15073   Result := TFNNtRegisterThreadTerminatePort(_NtRegisterThreadTerminatePort)(
15074     PortHandle
15075   );
15076 end;
15077 
15078 // Dynamic version of NtRegisterThreadTerminatePort
15079 function  ZwRegisterThreadTerminatePort(
15080     PortHandle : HANDLE
15081   ): NTSTATUS; stdcall;
15082 begin
15083   GetProcedureAddress(_NtRegisterThreadTerminatePort, ntdll, 'NtRegisterThreadTerminatePort');
15084   Result := TFNNtRegisterThreadTerminatePort(_NtRegisterThreadTerminatePort)(
15085     PortHandle
15086   );
15087 end;
15088 
15089 // Dynamic version of NtReleaseMutant
15090 function  NtReleaseMutant(
15091     MutantHandle : HANDLE;
15092     PreviousState : PULONG
15093   ): NTSTATUS; stdcall;
15094 begin
15095   GetProcedureAddress(_NtReleaseMutant, ntdll, 'NtReleaseMutant');
15096   Result := TFNNtReleaseMutant(_NtReleaseMutant)(
15097     MutantHandle, PreviousState
15098   );
15099 end;
15100 
15101 // Dynamic version of NtReleaseMutant
15102 function  ZwReleaseMutant(
15103     MutantHandle : HANDLE;
15104     PreviousState : PULONG
15105   ): NTSTATUS; stdcall;
15106 begin
15107   GetProcedureAddress(_NtReleaseMutant, ntdll, 'NtReleaseMutant');
15108   Result := TFNNtReleaseMutant(_NtReleaseMutant)(
15109     MutantHandle, PreviousState
15110   );
15111 end;
15112 
15113 // Dynamic version of NtReleaseSemaphore
15114 function  NtReleaseSemaphore(
15115     SemaphoreHandle : HANDLE;
15116     ReleaseCount : LONG;
15117     PreviousCount : PLONG
15118   ): NTSTATUS; stdcall;
15119 begin
15120   GetProcedureAddress(_NtReleaseSemaphore, ntdll, 'NtReleaseSemaphore');
15121   Result := TFNNtReleaseSemaphore(_NtReleaseSemaphore)(
15122     SemaphoreHandle, ReleaseCount, PreviousCount
15123   );
15124 end;
15125 
15126 // Dynamic version of NtReleaseSemaphore
15127 function  ZwReleaseSemaphore(
15128     SemaphoreHandle : HANDLE;
15129     ReleaseCount : LONG;
15130     PreviousCount : PLONG
15131   ): NTSTATUS; stdcall;
15132 begin
15133   GetProcedureAddress(_NtReleaseSemaphore, ntdll, 'NtReleaseSemaphore');
15134   Result := TFNNtReleaseSemaphore(_NtReleaseSemaphore)(
15135     SemaphoreHandle, ReleaseCount, PreviousCount
15136   );
15137 end;
15138 
15139 // Dynamic version of NtRemoveIoCompletion
15140 function  NtRemoveIoCompletion(
15141     IoCompletionHandle : HANDLE;
15142     CompletionKey : PULONG;
15143     CompletionValue : PULONG;
15144     IoStatusBlock : PIO_STATUS_BLOCK;
15145     Timeout : PLARGE_INTEGER
15146   ): NTSTATUS; stdcall;
15147 begin
15148   GetProcedureAddress(_NtRemoveIoCompletion, ntdll, 'NtRemoveIoCompletion');
15149   Result := TFNNtRemoveIoCompletion(_NtRemoveIoCompletion)(
15150     IoCompletionHandle, CompletionKey, CompletionValue, IoStatusBlock, Timeout
15151   );
15152 end;
15153 
15154 // Dynamic version of NtRemoveIoCompletion
15155 function  ZwRemoveIoCompletion(
15156     IoCompletionHandle : HANDLE;
15157     CompletionKey : PULONG;
15158     CompletionValue : PULONG;
15159     IoStatusBlock : PIO_STATUS_BLOCK;
15160     Timeout : PLARGE_INTEGER
15161   ): NTSTATUS; stdcall;
15162 begin
15163   GetProcedureAddress(_NtRemoveIoCompletion, ntdll, 'NtRemoveIoCompletion');
15164   Result := TFNNtRemoveIoCompletion(_NtRemoveIoCompletion)(
15165     IoCompletionHandle, CompletionKey, CompletionValue, IoStatusBlock, Timeout
15166   );
15167 end;
15168 
15169 // Dynamic version of NtRemoveProcessDebug
15170 function  NtRemoveProcessDebug(
15171     hProcess : HANDLE;
15172     hDebugObject : HANDLE
15173   ): NTSTATUS; stdcall;
15174 begin
15175   GetProcedureAddress(_NtRemoveProcessDebug, ntdll, 'NtRemoveProcessDebug');
15176   Result := TFNNtRemoveProcessDebug(_NtRemoveProcessDebug)(
15177     hProcess, hDebugObject
15178   );
15179 end;
15180 
15181 // Dynamic version of NtRemoveProcessDebug
15182 function  ZwRemoveProcessDebug(
15183     hProcess : HANDLE;
15184     hDebugObject : HANDLE
15185   ): NTSTATUS; stdcall;
15186 begin
15187   GetProcedureAddress(_NtRemoveProcessDebug, ntdll, 'NtRemoveProcessDebug');
15188   Result := TFNNtRemoveProcessDebug(_NtRemoveProcessDebug)(
15189     hProcess, hDebugObject
15190   );
15191 end;
15192 
15193 // Dynamic version of NtReplaceKey
15194 function  NtReplaceKey(
15195     NewFileObjectAttributes : POBJECT_ATTRIBUTES;
15196     KeyHandle : HANDLE;
15197     OldFileObjectAttributes : POBJECT_ATTRIBUTES
15198   ): NTSTATUS; stdcall;
15199 begin
15200   GetProcedureAddress(_NtReplaceKey, ntdll, 'NtReplaceKey');
15201   Result := TFNNtReplaceKey(_NtReplaceKey)(
15202     NewFileObjectAttributes, KeyHandle, OldFileObjectAttributes
15203   );
15204 end;
15205 
15206 // Dynamic version of NtReplaceKey
15207 function  ZwReplaceKey(
15208     NewFileObjectAttributes : POBJECT_ATTRIBUTES;
15209     KeyHandle : HANDLE;
15210     OldFileObjectAttributes : POBJECT_ATTRIBUTES
15211   ): NTSTATUS; stdcall;
15212 begin
15213   GetProcedureAddress(_NtReplaceKey, ntdll, 'NtReplaceKey');
15214   Result := TFNNtReplaceKey(_NtReplaceKey)(
15215     NewFileObjectAttributes, KeyHandle, OldFileObjectAttributes
15216   );
15217 end;
15218 
15219 // Dynamic version of NtReplyPort
15220 function  NtReplyPort(
15221     PortHandle : HANDLE;
15222     ReplyMessage : PPORT_MESSAGE
15223   ): NTSTATUS; stdcall;
15224 begin
15225   GetProcedureAddress(_NtReplyPort, ntdll, 'NtReplyPort');
15226   Result := TFNNtReplyPort(_NtReplyPort)(
15227     PortHandle, ReplyMessage
15228   );
15229 end;
15230 
15231 // Dynamic version of NtReplyPort
15232 function  ZwReplyPort(
15233     PortHandle : HANDLE;
15234     ReplyMessage : PPORT_MESSAGE
15235   ): NTSTATUS; stdcall;
15236 begin
15237   GetProcedureAddress(_NtReplyPort, ntdll, 'NtReplyPort');
15238   Result := TFNNtReplyPort(_NtReplyPort)(
15239     PortHandle, ReplyMessage
15240   );
15241 end;
15242 
15243 // Dynamic version of NtReplyWaitReceivePort
15244 function  NtReplyWaitReceivePort(
15245     PortHandle : HANDLE;
15246     PortIdentifier : PULONG;
15247     ReplyMessage : PPORT_MESSAGE;
15248     Message : PPORT_MESSAGE
15249   ): NTSTATUS; stdcall;
15250 begin
15251   GetProcedureAddress(_NtReplyWaitReceivePort, ntdll, 'NtReplyWaitReceivePort');
15252   Result := TFNNtReplyWaitReceivePort(_NtReplyWaitReceivePort)(
15253     PortHandle, PortIdentifier, ReplyMessage, Message
15254   );
15255 end;
15256 
15257 // Dynamic version of NtReplyWaitReceivePort
15258 function  ZwReplyWaitReceivePort(
15259     PortHandle : HANDLE;
15260     PortIdentifier : PULONG;
15261     ReplyMessage : PPORT_MESSAGE;
15262     Message : PPORT_MESSAGE
15263   ): NTSTATUS; stdcall;
15264 begin
15265   GetProcedureAddress(_NtReplyWaitReceivePort, ntdll, 'NtReplyWaitReceivePort');
15266   Result := TFNNtReplyWaitReceivePort(_NtReplyWaitReceivePort)(
15267     PortHandle, PortIdentifier, ReplyMessage, Message
15268   );
15269 end;
15270 
15271 // Dynamic version of NtReplyWaitReceivePortEx
15272 function  NtReplyWaitReceivePortEx(
15273     PortHandle : HANDLE;
15274     PortIdentifier : PULONG;
15275     ReplyMessage : PPORT_MESSAGE;
15276     Message : PPORT_MESSAGE;
15277     Timeout : PLARGE_INTEGER
15278   ): NTSTATUS; stdcall;
15279 begin
15280   GetProcedureAddress(_NtReplyWaitReceivePortEx, ntdll, 'NtReplyWaitReceivePortEx');
15281   Result := TFNNtReplyWaitReceivePortEx(_NtReplyWaitReceivePortEx)(
15282     PortHandle, PortIdentifier, ReplyMessage, Message, Timeout
15283   );
15284 end;
15285 
15286 // Dynamic version of NtReplyWaitReceivePortEx
15287 function  ZwReplyWaitReceivePortEx(
15288     PortHandle : HANDLE;
15289     PortIdentifier : PULONG;
15290     ReplyMessage : PPORT_MESSAGE;
15291     Message : PPORT_MESSAGE;
15292     Timeout : PLARGE_INTEGER
15293   ): NTSTATUS; stdcall;
15294 begin
15295   GetProcedureAddress(_NtReplyWaitReceivePortEx, ntdll, 'NtReplyWaitReceivePortEx');
15296   Result := TFNNtReplyWaitReceivePortEx(_NtReplyWaitReceivePortEx)(
15297     PortHandle, PortIdentifier, ReplyMessage, Message, Timeout
15298   );
15299 end;
15300 
15301 // Dynamic version of NtReplyWaitReplyPort
15302 function  NtReplyWaitReplyPort(
15303     PortHandle : HANDLE;
15304     ReplyMessage : PPORT_MESSAGE
15305   ): NTSTATUS; stdcall;
15306 begin
15307   GetProcedureAddress(_NtReplyWaitReplyPort, ntdll, 'NtReplyWaitReplyPort');
15308   Result := TFNNtReplyWaitReplyPort(_NtReplyWaitReplyPort)(
15309     PortHandle, ReplyMessage
15310   );
15311 end;
15312 
15313 // Dynamic version of NtReplyWaitReplyPort
15314 function  ZwReplyWaitReplyPort(
15315     PortHandle : HANDLE;
15316     ReplyMessage : PPORT_MESSAGE
15317   ): NTSTATUS; stdcall;
15318 begin
15319   GetProcedureAddress(_NtReplyWaitReplyPort, ntdll, 'NtReplyWaitReplyPort');
15320   Result := TFNNtReplyWaitReplyPort(_NtReplyWaitReplyPort)(
15321     PortHandle, ReplyMessage
15322   );
15323 end;
15324 
15325 // Dynamic version of NtReplyWaitSendChannel
15326 function  NtReplyWaitSendChannel(
15327     x : PVOID;
15328     y : PVOID;
15329     z : PVOID
15330   ): NTSTATUS; stdcall;
15331 begin
15332   GetProcedureAddress(_NtReplyWaitSendChannel, ntdll, 'NtReplyWaitSendChannel');
15333   Result := TFNNtReplyWaitSendChannel(_NtReplyWaitSendChannel)(
15334     x, y, z
15335   );
15336 end;
15337 
15338 // Dynamic version of NtReplyWaitSendChannel
15339 function  ZwReplyWaitSendChannel(
15340     x : PVOID;
15341     y : PVOID;
15342     z : PVOID
15343   ): NTSTATUS; stdcall;
15344 begin
15345   GetProcedureAddress(_NtReplyWaitSendChannel, ntdll, 'NtReplyWaitSendChannel');
15346   Result := TFNNtReplyWaitSendChannel(_NtReplyWaitSendChannel)(
15347     x, y, z
15348   );
15349 end;
15350 
15351 // Dynamic version of NtRequestDeviceWakeup
15352 function  NtRequestDeviceWakeup(
15353     DeviceHandle : HANDLE
15354   ): NTSTATUS; stdcall;
15355 begin
15356   GetProcedureAddress(_NtRequestDeviceWakeup, ntdll, 'NtRequestDeviceWakeup');
15357   Result := TFNNtRequestDeviceWakeup(_NtRequestDeviceWakeup)(
15358     DeviceHandle
15359   );
15360 end;
15361 
15362 // Dynamic version of NtRequestDeviceWakeup
15363 function  ZwRequestDeviceWakeup(
15364     DeviceHandle : HANDLE
15365   ): NTSTATUS; stdcall;
15366 begin
15367   GetProcedureAddress(_NtRequestDeviceWakeup, ntdll, 'NtRequestDeviceWakeup');
15368   Result := TFNNtRequestDeviceWakeup(_NtRequestDeviceWakeup)(
15369     DeviceHandle
15370   );
15371 end;
15372 
15373 // Dynamic version of NtRequestPort
15374 function  NtRequestPort(
15375     PortHandle : HANDLE;
15376     RequestMessage : PPORT_MESSAGE
15377   ): NTSTATUS; stdcall;
15378 begin
15379   GetProcedureAddress(_NtRequestPort, ntdll, 'NtRequestPort');
15380   Result := TFNNtRequestPort(_NtRequestPort)(
15381     PortHandle, RequestMessage
15382   );
15383 end;
15384 
15385 // Dynamic version of NtRequestPort
15386 function  ZwRequestPort(
15387     PortHandle : HANDLE;
15388     RequestMessage : PPORT_MESSAGE
15389   ): NTSTATUS; stdcall;
15390 begin
15391   GetProcedureAddress(_NtRequestPort, ntdll, 'NtRequestPort');
15392   Result := TFNNtRequestPort(_NtRequestPort)(
15393     PortHandle, RequestMessage
15394   );
15395 end;
15396 
15397 // Dynamic version of NtRequestWaitReplyPort
15398 function  NtRequestWaitReplyPort(
15399     PortHandle : HANDLE;
15400     RequestMessage : PPORT_MESSAGE;
15401     ReplyMessage : PPORT_MESSAGE
15402   ): NTSTATUS; stdcall;
15403 begin
15404   GetProcedureAddress(_NtRequestWaitReplyPort, ntdll, 'NtRequestWaitReplyPort');
15405   Result := TFNNtRequestWaitReplyPort(_NtRequestWaitReplyPort)(
15406     PortHandle, RequestMessage, ReplyMessage
15407   );
15408 end;
15409 
15410 // Dynamic version of NtRequestWaitReplyPort
15411 function  ZwRequestWaitReplyPort(
15412     PortHandle : HANDLE;
15413     RequestMessage : PPORT_MESSAGE;
15414     ReplyMessage : PPORT_MESSAGE
15415   ): NTSTATUS; stdcall;
15416 begin
15417   GetProcedureAddress(_NtRequestWaitReplyPort, ntdll, 'NtRequestWaitReplyPort');
15418   Result := TFNNtRequestWaitReplyPort(_NtRequestWaitReplyPort)(
15419     PortHandle, RequestMessage, ReplyMessage
15420   );
15421 end;
15422 
15423 // Dynamic version of NtRequestWakeupLatency
15424 function  NtRequestWakeupLatency(
15425     Latency : LATENCY_TIME
15426   ): NTSTATUS; stdcall;
15427 begin
15428   GetProcedureAddress(_NtRequestWakeupLatency, ntdll, 'NtRequestWakeupLatency');
15429   Result := TFNNtRequestWakeupLatency(_NtRequestWakeupLatency)(
15430     Latency
15431   );
15432 end;
15433 
15434 // Dynamic version of NtRequestWakeupLatency
15435 function  ZwRequestWakeupLatency(
15436     Latency : LATENCY_TIME
15437   ): NTSTATUS; stdcall;
15438 begin
15439   GetProcedureAddress(_NtRequestWakeupLatency, ntdll, 'NtRequestWakeupLatency');
15440   Result := TFNNtRequestWakeupLatency(_NtRequestWakeupLatency)(
15441     Latency
15442   );
15443 end;
15444 
15445 // Dynamic version of NtResetEvent
15446 function  NtResetEvent(
15447     EventHandle : HANDLE;
15448     PreviousState : PULONG
15449   ): NTSTATUS; stdcall;
15450 begin
15451   GetProcedureAddress(_NtResetEvent, ntdll, 'NtResetEvent');
15452   Result := TFNNtResetEvent(_NtResetEvent)(
15453     EventHandle, PreviousState
15454   );
15455 end;
15456 
15457 // Dynamic version of NtResetEvent
15458 function  ZwResetEvent(
15459     EventHandle : HANDLE;
15460     PreviousState : PULONG
15461   ): NTSTATUS; stdcall;
15462 begin
15463   GetProcedureAddress(_NtResetEvent, ntdll, 'NtResetEvent');
15464   Result := TFNNtResetEvent(_NtResetEvent)(
15465     EventHandle, PreviousState
15466   );
15467 end;
15468 
15469 // Dynamic version of NtResetWriteWatch
15470 function  NtResetWriteWatch(
15471     ProcessHandle : HANDLE;
15472     BaseAddress : PVOID;
15473     RegionSize : ULONG
15474   ): NTSTATUS; stdcall;
15475 begin
15476   GetProcedureAddress(_NtResetWriteWatch, ntdll, 'NtResetWriteWatch');
15477   Result := TFNNtResetWriteWatch(_NtResetWriteWatch)(
15478     ProcessHandle, BaseAddress, RegionSize
15479   );
15480 end;
15481 
15482 // Dynamic version of NtResetWriteWatch
15483 function  ZwResetWriteWatch(
15484     ProcessHandle : HANDLE;
15485     BaseAddress : PVOID;
15486     RegionSize : ULONG
15487   ): NTSTATUS; stdcall;
15488 begin
15489   GetProcedureAddress(_NtResetWriteWatch, ntdll, 'NtResetWriteWatch');
15490   Result := TFNNtResetWriteWatch(_NtResetWriteWatch)(
15491     ProcessHandle, BaseAddress, RegionSize
15492   );
15493 end;
15494 
15495 // Dynamic version of NtRestoreKey
15496 function  NtRestoreKey(
15497     KeyHandle : HANDLE;
15498     FileHandle : HANDLE;
15499     Flags : ULONG
15500   ): NTSTATUS; stdcall;
15501 begin
15502   GetProcedureAddress(_NtRestoreKey, ntdll, 'NtRestoreKey');
15503   Result := TFNNtRestoreKey(_NtRestoreKey)(
15504     KeyHandle, FileHandle, Flags
15505   );
15506 end;
15507 
15508 // Dynamic version of NtRestoreKey
15509 function  ZwRestoreKey(
15510     KeyHandle : HANDLE;
15511     FileHandle : HANDLE;
15512     Flags : ULONG
15513   ): NTSTATUS; stdcall;
15514 begin
15515   GetProcedureAddress(_NtRestoreKey, ntdll, 'NtRestoreKey');
15516   Result := TFNNtRestoreKey(_NtRestoreKey)(
15517     KeyHandle, FileHandle, Flags
15518   );
15519 end;
15520 
15521 // Dynamic version of NtResumeProcess
15522 function  NtResumeProcess(
15523     hProcess : HANDLE
15524   ): NTSTATUS; stdcall;
15525 begin
15526   GetProcedureAddress(_NtResumeProcess, ntdll, 'NtResumeProcess');
15527   Result := TFNNtResumeProcess(_NtResumeProcess)(
15528     hProcess
15529   );
15530 end;
15531 
15532 // Dynamic version of NtResumeProcess
15533 function  ZwResumeProcess(
15534     hProcess : HANDLE
15535   ): NTSTATUS; stdcall;
15536 begin
15537   GetProcedureAddress(_NtResumeProcess, ntdll, 'NtResumeProcess');
15538   Result := TFNNtResumeProcess(_NtResumeProcess)(
15539     hProcess
15540   );
15541 end;
15542 
15543 // Dynamic version of NtResumeThread
15544 function  NtResumeThread(
15545     hThread : HANDLE;
15546     dwResumeCount : PULONG
15547   ): NTSTATUS; stdcall;
15548 begin
15549   GetProcedureAddress(_NtResumeThread, ntdll, 'NtResumeThread');
15550   Result := TFNNtResumeThread(_NtResumeThread)(
15551     hThread, dwResumeCount
15552   );
15553 end;
15554 
15555 // Dynamic version of NtResumeThread
15556 function  ZwResumeThread(
15557     hThread : HANDLE;
15558     dwResumeCount : PULONG
15559   ): NTSTATUS; stdcall;
15560 begin
15561   GetProcedureAddress(_NtResumeThread, ntdll, 'NtResumeThread');
15562   Result := TFNNtResumeThread(_NtResumeThread)(
15563     hThread, dwResumeCount
15564   );
15565 end;
15566 
15567 // Dynamic version of NtSaveKey
15568 function  NtSaveKey(
15569     KeyHandle : HANDLE;
15570     FileHandle : HANDLE
15571   ): NTSTATUS; stdcall;
15572 begin
15573   GetProcedureAddress(_NtSaveKey, ntdll, 'NtSaveKey');
15574   Result := TFNNtSaveKey(_NtSaveKey)(
15575     KeyHandle, FileHandle
15576   );
15577 end;
15578 
15579 // Dynamic version of NtSaveKey
15580 function  ZwSaveKey(
15581     KeyHandle : HANDLE;
15582     FileHandle : HANDLE
15583   ): NTSTATUS; stdcall;
15584 begin
15585   GetProcedureAddress(_NtSaveKey, ntdll, 'NtSaveKey');
15586   Result := TFNNtSaveKey(_NtSaveKey)(
15587     KeyHandle, FileHandle
15588   );
15589 end;
15590 
15591 // Dynamic version of NtSaveKeyEx
15592 function  NtSaveKeyEx(
15593     KeyHandle : HANDLE;
15594     FileHandle : HANDLE;
15595     Flags : DWORD
15596   ): NTSTATUS; stdcall;
15597 begin
15598   GetProcedureAddress(_NtSaveKeyEx, ntdll, 'NtSaveKeyEx');
15599   Result := TFNNtSaveKeyEx(_NtSaveKeyEx)(
15600     KeyHandle, FileHandle, Flags
15601   );
15602 end;
15603 
15604 // Dynamic version of NtSaveKeyEx
15605 function  ZwSaveKeyEx(
15606     KeyHandle : HANDLE;
15607     FileHandle : HANDLE;
15608     Flags : DWORD
15609   ): NTSTATUS; stdcall;
15610 begin
15611   GetProcedureAddress(_NtSaveKeyEx, ntdll, 'NtSaveKeyEx');
15612   Result := TFNNtSaveKeyEx(_NtSaveKeyEx)(
15613     KeyHandle, FileHandle, Flags
15614   );
15615 end;
15616 
15617 // Dynamic version of NtSaveMergedKeys
15618 function  NtSaveMergedKeys(
15619     KeyHandle1 : HANDLE;
15620     KeyHandle2 : HANDLE;
15621     FileHandle : HANDLE
15622   ): NTSTATUS; stdcall;
15623 begin
15624   GetProcedureAddress(_NtSaveMergedKeys, ntdll, 'NtSaveMergedKeys');
15625   Result := TFNNtSaveMergedKeys(_NtSaveMergedKeys)(
15626     KeyHandle1, KeyHandle2, FileHandle
15627   );
15628 end;
15629 
15630 // Dynamic version of NtSaveMergedKeys
15631 function  ZwSaveMergedKeys(
15632     KeyHandle1 : HANDLE;
15633     KeyHandle2 : HANDLE;
15634     FileHandle : HANDLE
15635   ): NTSTATUS; stdcall;
15636 begin
15637   GetProcedureAddress(_NtSaveMergedKeys, ntdll, 'NtSaveMergedKeys');
15638   Result := TFNNtSaveMergedKeys(_NtSaveMergedKeys)(
15639     KeyHandle1, KeyHandle2, FileHandle
15640   );
15641 end;
15642 
15643 // Dynamic version of NtSecureConnectPort
15644 function  NtSecureConnectPort(
15645     PortHandle : PHANDLE;
15646     PortName : PUNICODE_STRING;
15647     SecurityQos : PSECURITY_QUALITY_OF_SERVICE;
15648     WriteSection : PPORT_SECTION_WRITE;
15649     ServerSid : PSID;
15650     ReadSection : PPORT_SECTION_READ;
15651     MaxMessageSize : PULONG;
15652     ConnectData : PVOID;
15653     ConnectDataLength : PULONG
15654   ): NTSTATUS; stdcall;
15655 begin
15656   GetProcedureAddress(_NtSecureConnectPort, ntdll, 'NtSecureConnectPort');
15657   Result := TFNNtSecureConnectPort(_NtSecureConnectPort)(
15658     PortHandle, PortName, SecurityQos, WriteSection, ServerSid, ReadSection, MaxMessageSize, ConnectData, ConnectDataLength
15659   );
15660 end;
15661 
15662 // Dynamic version of NtSecureConnectPort
15663 function  ZwSecureConnectPort(
15664     PortHandle : PHANDLE;
15665     PortName : PUNICODE_STRING;
15666     SecurityQos : PSECURITY_QUALITY_OF_SERVICE;
15667     WriteSection : PPORT_SECTION_WRITE;
15668     ServerSid : PSID;
15669     ReadSection : PPORT_SECTION_READ;
15670     MaxMessageSize : PULONG;
15671     ConnectData : PVOID;
15672     ConnectDataLength : PULONG
15673   ): NTSTATUS; stdcall;
15674 begin
15675   GetProcedureAddress(_NtSecureConnectPort, ntdll, 'NtSecureConnectPort');
15676   Result := TFNNtSecureConnectPort(_NtSecureConnectPort)(
15677     PortHandle, PortName, SecurityQos, WriteSection, ServerSid, ReadSection, MaxMessageSize, ConnectData, ConnectDataLength
15678   );
15679 end;
15680 
15681 // Dynamic version of NtSendWaitReplyChannel
15682 function  NtSendWaitReplyChannel(
15683     x : PVOID;
15684     y : PVOID;
15685     z : PVOID;
15686     z2 : PVOID
15687   ): NTSTATUS; stdcall;
15688 begin
15689   GetProcedureAddress(_NtSendWaitReplyChannel, ntdll, 'NtSendWaitReplyChannel');
15690   Result := TFNNtSendWaitReplyChannel(_NtSendWaitReplyChannel)(
15691     x, y, z, z2
15692   );
15693 end;
15694 
15695 // Dynamic version of NtSendWaitReplyChannel
15696 function  ZwSendWaitReplyChannel(
15697     x : PVOID;
15698     y : PVOID;
15699     z : PVOID;
15700     z2 : PVOID
15701   ): NTSTATUS; stdcall;
15702 begin
15703   GetProcedureAddress(_NtSendWaitReplyChannel, ntdll, 'NtSendWaitReplyChannel');
15704   Result := TFNNtSendWaitReplyChannel(_NtSendWaitReplyChannel)(
15705     x, y, z, z2
15706   );
15707 end;
15708 
15709 // Dynamic version of NtSetContextChannel
15710 function  NtSetContextChannel(
15711     x : PVOID
15712   ): NTSTATUS; stdcall;
15713 begin
15714   GetProcedureAddress(_NtSetContextChannel, ntdll, 'NtSetContextChannel');
15715   Result := TFNNtSetContextChannel(_NtSetContextChannel)(
15716     x
15717   );
15718 end;
15719 
15720 // Dynamic version of NtSetContextChannel
15721 function  ZwSetContextChannel(
15722     x : PVOID
15723   ): NTSTATUS; stdcall;
15724 begin
15725   GetProcedureAddress(_NtSetContextChannel, ntdll, 'NtSetContextChannel');
15726   Result := TFNNtSetContextChannel(_NtSetContextChannel)(
15727     x
15728   );
15729 end;
15730 
15731 // Dynamic version of NtSetContextThread
15732 function  NtSetContextThread(
15733     ThreadHandle : HANDLE;
15734     Context : PCONTEXT
15735   ): NTSTATUS; stdcall;
15736 begin
15737   GetProcedureAddress(_NtSetContextThread, ntdll, 'NtSetContextThread');
15738   Result := TFNNtSetContextThread(_NtSetContextThread)(
15739     ThreadHandle, Context
15740   );
15741 end;
15742 
15743 // Dynamic version of NtSetContextThread
15744 function  ZwSetContextThread(
15745     ThreadHandle : HANDLE;
15746     Context : PCONTEXT
15747   ): NTSTATUS; stdcall;
15748 begin
15749   GetProcedureAddress(_NtSetContextThread, ntdll, 'NtSetContextThread');
15750   Result := TFNNtSetContextThread(_NtSetContextThread)(
15751     ThreadHandle, Context
15752   );
15753 end;
15754 
15755 // Dynamic version of NtSetDefaultHardErrorPort
15756 function  NtSetDefaultHardErrorPort(
15757     PortHandle : HANDLE
15758   ): NTSTATUS; stdcall;
15759 begin
15760   GetProcedureAddress(_NtSetDefaultHardErrorPort, ntdll, 'NtSetDefaultHardErrorPort');
15761   Result := TFNNtSetDefaultHardErrorPort(_NtSetDefaultHardErrorPort)(
15762     PortHandle
15763   );
15764 end;
15765 
15766 // Dynamic version of NtSetDefaultHardErrorPort
15767 function  ZwSetDefaultHardErrorPort(
15768     PortHandle : HANDLE
15769   ): NTSTATUS; stdcall;
15770 begin
15771   GetProcedureAddress(_NtSetDefaultHardErrorPort, ntdll, 'NtSetDefaultHardErrorPort');
15772   Result := TFNNtSetDefaultHardErrorPort(_NtSetDefaultHardErrorPort)(
15773     PortHandle
15774   );
15775 end;
15776 
15777 // Dynamic version of NtSetDefaultLocale
15778 function  NtSetDefaultLocale(
15779     ThreadOrSystem : BOOLEAN;
15780     Locale : LCID
15781   ): NTSTATUS; stdcall;
15782 begin
15783   GetProcedureAddress(_NtSetDefaultLocale, ntdll, 'NtSetDefaultLocale');
15784   Result := TFNNtSetDefaultLocale(_NtSetDefaultLocale)(
15785     ThreadOrSystem, Locale
15786   );
15787 end;
15788 
15789 // Dynamic version of NtSetDefaultLocale
15790 function  ZwSetDefaultLocale(
15791     ThreadOrSystem : BOOLEAN;
15792     Locale : LCID
15793   ): NTSTATUS; stdcall;
15794 begin
15795   GetProcedureAddress(_NtSetDefaultLocale, ntdll, 'NtSetDefaultLocale');
15796   Result := TFNNtSetDefaultLocale(_NtSetDefaultLocale)(
15797     ThreadOrSystem, Locale
15798   );
15799 end;
15800 
15801 // Dynamic version of NtSetDefaultUILanguage
15802 function  NtSetDefaultUILanguage(
15803     LanguageId : LANGID
15804   ): NTSTATUS; stdcall;
15805 begin
15806   GetProcedureAddress(_NtSetDefaultUILanguage, ntdll, 'NtSetDefaultUILanguage');
15807   Result := TFNNtSetDefaultUILanguage(_NtSetDefaultUILanguage)(
15808     LanguageId
15809   );
15810 end;
15811 
15812 // Dynamic version of NtSetDefaultUILanguage
15813 function  ZwSetDefaultUILanguage(
15814     LanguageId : LANGID
15815   ): NTSTATUS; stdcall;
15816 begin
15817   GetProcedureAddress(_NtSetDefaultUILanguage, ntdll, 'NtSetDefaultUILanguage');
15818   Result := TFNNtSetDefaultUILanguage(_NtSetDefaultUILanguage)(
15819     LanguageId
15820   );
15821 end;
15822 
15823 // Dynamic version of NtSetEaFile
15824 function  NtSetEaFile(
15825     FileHandle : HANDLE;
15826     IoStatusBlock : PIO_STATUS_BLOCK;
15827     Buffer : PFILE_FULL_EA_INFORMATION;
15828     BufferLength : ULONG
15829   ): NTSTATUS; stdcall;
15830 begin
15831   GetProcedureAddress(_NtSetEaFile, ntdll, 'NtSetEaFile');
15832   Result := TFNNtSetEaFile(_NtSetEaFile)(
15833     FileHandle, IoStatusBlock, Buffer, BufferLength
15834   );
15835 end;
15836 
15837 // Dynamic version of NtSetEaFile
15838 function  ZwSetEaFile(
15839     FileHandle : HANDLE;
15840     IoStatusBlock : PIO_STATUS_BLOCK;
15841     Buffer : PFILE_FULL_EA_INFORMATION;
15842     BufferLength : ULONG
15843   ): NTSTATUS; stdcall;
15844 begin
15845   GetProcedureAddress(_NtSetEaFile, ntdll, 'NtSetEaFile');
15846   Result := TFNNtSetEaFile(_NtSetEaFile)(
15847     FileHandle, IoStatusBlock, Buffer, BufferLength
15848   );
15849 end;
15850 
15851 // Dynamic version of NtSetEvent
15852 function  NtSetEvent(
15853     EventHandle : HANDLE;
15854     PreviousState : PULONG
15855   ): NTSTATUS; stdcall;
15856 begin
15857   GetProcedureAddress(_NtSetEvent, ntdll, 'NtSetEvent');
15858   Result := TFNNtSetEvent(_NtSetEvent)(
15859     EventHandle, PreviousState
15860   );
15861 end;
15862 
15863 // Dynamic version of NtSetEvent
15864 function  ZwSetEvent(
15865     EventHandle : HANDLE;
15866     PreviousState : PULONG
15867   ): NTSTATUS; stdcall;
15868 begin
15869   GetProcedureAddress(_NtSetEvent, ntdll, 'NtSetEvent');
15870   Result := TFNNtSetEvent(_NtSetEvent)(
15871     EventHandle, PreviousState
15872   );
15873 end;
15874 
15875 // Dynamic version of NtSetHighEventPair
15876 function  NtSetHighEventPair(
15877     EventPairHandle : HANDLE
15878   ): NTSTATUS; stdcall;
15879 begin
15880   GetProcedureAddress(_NtSetHighEventPair, ntdll, 'NtSetHighEventPair');
15881   Result := TFNNtSetHighEventPair(_NtSetHighEventPair)(
15882     EventPairHandle
15883   );
15884 end;
15885 
15886 // Dynamic version of NtSetHighEventPair
15887 function  ZwSetHighEventPair(
15888     EventPairHandle : HANDLE
15889   ): NTSTATUS; stdcall;
15890 begin
15891   GetProcedureAddress(_NtSetHighEventPair, ntdll, 'NtSetHighEventPair');
15892   Result := TFNNtSetHighEventPair(_NtSetHighEventPair)(
15893     EventPairHandle
15894   );
15895 end;
15896 
15897 // Dynamic version of NtSetHighWaitLowEventPair
15898 function  NtSetHighWaitLowEventPair(
15899     EventPairHandle : HANDLE
15900   ): NTSTATUS; stdcall;
15901 begin
15902   GetProcedureAddress(_NtSetHighWaitLowEventPair, ntdll, 'NtSetHighWaitLowEventPair');
15903   Result := TFNNtSetHighWaitLowEventPair(_NtSetHighWaitLowEventPair)(
15904     EventPairHandle
15905   );
15906 end;
15907 
15908 // Dynamic version of NtSetHighWaitLowEventPair
15909 function  ZwSetHighWaitLowEventPair(
15910     EventPairHandle : HANDLE
15911   ): NTSTATUS; stdcall;
15912 begin
15913   GetProcedureAddress(_NtSetHighWaitLowEventPair, ntdll, 'NtSetHighWaitLowEventPair');
15914   Result := TFNNtSetHighWaitLowEventPair(_NtSetHighWaitLowEventPair)(
15915     EventPairHandle
15916   );
15917 end;
15918 
15919 // Dynamic version of NtSetHighWaitLowThread
15920 function  NtSetHighWaitLowThread(): NTSTATUS; stdcall;
15921 begin
15922   GetProcedureAddress(_NtSetHighWaitLowThread, ntdll, 'NtSetHighWaitLowThread');
15923   Result := TFNNtSetHighWaitLowThread(_NtSetHighWaitLowThread)();
15924 end;
15925 
15926 // Dynamic version of NtSetHighWaitLowThread
15927 function  ZwSetHighWaitLowThread(): NTSTATUS; stdcall;
15928 begin
15929   GetProcedureAddress(_NtSetHighWaitLowThread, ntdll, 'NtSetHighWaitLowThread');
15930   Result := TFNNtSetHighWaitLowThread(_NtSetHighWaitLowThread)();
15931 end;
15932 
15933 // Dynamic version of NtSetInformationFile
15934 function  NtSetInformationFile(
15935     FileHandle : HANDLE;
15936     IoStatusBlock : PIO_STATUS_BLOCK;
15937     FileInformation : PVOID;
15938     FileInformationLength : ULONG;
15939     FileInformationClass : FILE_INFORMATION_CLASS
15940   ): NTSTATUS; stdcall;
15941 begin
15942   GetProcedureAddress(_NtSetInformationFile, ntdll, 'NtSetInformationFile');
15943   Result := TFNNtSetInformationFile(_NtSetInformationFile)(
15944     FileHandle, IoStatusBlock, FileInformation, FileInformationLength, FileInformationClass
15945   );
15946 end;
15947 
15948 // Dynamic version of NtSetInformationFile
15949 function  ZwSetInformationFile(
15950     FileHandle : HANDLE;
15951     IoStatusBlock : PIO_STATUS_BLOCK;
15952     FileInformation : PVOID;
15953     FileInformationLength : ULONG;
15954     FileInformationClass : FILE_INFORMATION_CLASS
15955   ): NTSTATUS; stdcall;
15956 begin
15957   GetProcedureAddress(_NtSetInformationFile, ntdll, 'NtSetInformationFile');
15958   Result := TFNNtSetInformationFile(_NtSetInformationFile)(
15959     FileHandle, IoStatusBlock, FileInformation, FileInformationLength, FileInformationClass
15960   );
15961 end;
15962 
15963 // Dynamic version of NtSetInformationJobObject
15964 function  NtSetInformationJobObject(
15965     JobHandle : HANDLE;
15966     JobInformationClass : JOBOBJECTINFOCLASS;
15967     JobInformation : PVOID;
15968     JobInformationLength : ULONG
15969   ): NTSTATUS; stdcall;
15970 begin
15971   GetProcedureAddress(_NtSetInformationJobObject, ntdll, 'NtSetInformationJobObject');
15972   Result := TFNNtSetInformationJobObject(_NtSetInformationJobObject)(
15973     JobHandle, JobInformationClass, JobInformation, JobInformationLength
15974   );
15975 end;
15976 
15977 // Dynamic version of NtSetInformationJobObject
15978 function  ZwSetInformationJobObject(
15979     JobHandle : HANDLE;
15980     JobInformationClass : JOBOBJECTINFOCLASS;
15981     JobInformation : PVOID;
15982     JobInformationLength : ULONG
15983   ): NTSTATUS; stdcall;
15984 begin
15985   GetProcedureAddress(_NtSetInformationJobObject, ntdll, 'NtSetInformationJobObject');
15986   Result := TFNNtSetInformationJobObject(_NtSetInformationJobObject)(
15987     JobHandle, JobInformationClass, JobInformation, JobInformationLength
15988   );
15989 end;
15990 
15991 // Dynamic version of NtSetInformationKey
15992 function  NtSetInformationKey(
15993     KeyHandle : HANDLE;
15994     KeyInformationClass : KEY_SET_INFORMATION_CLASS;
15995     KeyInformation : PVOID;
15996     KeyInformationLength : ULONG
15997   ): NTSTATUS; stdcall;
15998 begin
15999   GetProcedureAddress(_NtSetInformationKey, ntdll, 'NtSetInformationKey');
16000   Result := TFNNtSetInformationKey(_NtSetInformationKey)(
16001     KeyHandle, KeyInformationClass, KeyInformation, KeyInformationLength
16002   );
16003 end;
16004 
16005 // Dynamic version of NtSetInformationKey
16006 function  ZwSetInformationKey(
16007     KeyHandle : HANDLE;
16008     KeyInformationClass : KEY_SET_INFORMATION_CLASS;
16009     KeyInformation : PVOID;
16010     KeyInformationLength : ULONG
16011   ): NTSTATUS; stdcall;
16012 begin
16013   GetProcedureAddress(_NtSetInformationKey, ntdll, 'NtSetInformationKey');
16014   Result := TFNNtSetInformationKey(_NtSetInformationKey)(
16015     KeyHandle, KeyInformationClass, KeyInformation, KeyInformationLength
16016   );
16017 end;
16018 
16019 // Dynamic version of NtSetInformationObject
16020 function  NtSetInformationObject(
16021     ObjectHandle : HANDLE;
16022     ObjectInformationClass : OBJECT_INFORMATION_CLASS;
16023     ObjectInformation : PVOID;
16024     ObjectInformationLength : ULONG
16025   ): NTSTATUS; stdcall;
16026 begin
16027   GetProcedureAddress(_NtSetInformationObject, ntdll, 'NtSetInformationObject');
16028   Result := TFNNtSetInformationObject(_NtSetInformationObject)(
16029     ObjectHandle, ObjectInformationClass, ObjectInformation, ObjectInformationLength
16030   );
16031 end;
16032 
16033 // Dynamic version of NtSetInformationObject
16034 function  ZwSetInformationObject(
16035     ObjectHandle : HANDLE;
16036     ObjectInformationClass : OBJECT_INFORMATION_CLASS;
16037     ObjectInformation : PVOID;
16038     ObjectInformationLength : ULONG
16039   ): NTSTATUS; stdcall;
16040 begin
16041   GetProcedureAddress(_NtSetInformationObject, ntdll, 'NtSetInformationObject');
16042   Result := TFNNtSetInformationObject(_NtSetInformationObject)(
16043     ObjectHandle, ObjectInformationClass, ObjectInformation, ObjectInformationLength
16044   );
16045 end;
16046 
16047 // Dynamic version of NtSetInformationProcess
16048 function  NtSetInformationProcess(
16049     ProcessHandle : HANDLE;
16050     ProcessInformationClass : PROCESSINFOCLASS;
16051     ProcessInformation : PVOID;
16052     ProcessInformationLength : ULONG
16053   ): NTSTATUS; stdcall;
16054 begin
16055   GetProcedureAddress(_NtSetInformationProcess, ntdll, 'NtSetInformationProcess');
16056   Result := TFNNtSetInformationProcess(_NtSetInformationProcess)(
16057     ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength
16058   );
16059 end;
16060 
16061 // Dynamic version of NtSetInformationProcess
16062 function  ZwSetInformationProcess(
16063     ProcessHandle : HANDLE;
16064     ProcessInformationClass : PROCESSINFOCLASS;
16065     ProcessInformation : PVOID;
16066     ProcessInformationLength : ULONG
16067   ): NTSTATUS; stdcall;
16068 begin
16069   GetProcedureAddress(_NtSetInformationProcess, ntdll, 'NtSetInformationProcess');
16070   Result := TFNNtSetInformationProcess(_NtSetInformationProcess)(
16071     ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength
16072   );
16073 end;
16074 
16075 // Dynamic version of NtSetInformationThread
16076 function  NtSetInformationThread(
16077     ThreadHandle : HANDLE;
16078     ThreadInformationClass : THREADINFOCLASS;
16079     ThreadInformation : PVOID;
16080     ThreadInformationLength : ULONG
16081   ): NTSTATUS; stdcall;
16082 begin
16083   GetProcedureAddress(_NtSetInformationThread, ntdll, 'NtSetInformationThread');
16084   Result := TFNNtSetInformationThread(_NtSetInformationThread)(
16085     ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength
16086   );
16087 end;
16088 
16089 // Dynamic version of NtSetInformationThread
16090 function  ZwSetInformationThread(
16091     ThreadHandle : HANDLE;
16092     ThreadInformationClass : THREADINFOCLASS;
16093     ThreadInformation : PVOID;
16094     ThreadInformationLength : ULONG
16095   ): NTSTATUS; stdcall;
16096 begin
16097   GetProcedureAddress(_NtSetInformationThread, ntdll, 'NtSetInformationThread');
16098   Result := TFNNtSetInformationThread(_NtSetInformationThread)(
16099     ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength
16100   );
16101 end;
16102 
16103 // Dynamic version of NtSetInformationToken
16104 function  NtSetInformationToken(
16105     TokenHandle : HANDLE;
16106     TokenInformationClass : TOKEN_INFORMATION_CLASS;
16107     TokenInformation : PVOID;
16108     TokenInformationLength : ULONG
16109   ): NTSTATUS; stdcall;
16110 begin
16111   GetProcedureAddress(_NtSetInformationToken, ntdll, 'NtSetInformationToken');
16112   Result := TFNNtSetInformationToken(_NtSetInformationToken)(
16113     TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength
16114   );
16115 end;
16116 
16117 // Dynamic version of NtSetInformationToken
16118 function  ZwSetInformationToken(
16119     TokenHandle : HANDLE;
16120     TokenInformationClass : TOKEN_INFORMATION_CLASS;
16121     TokenInformation : PVOID;
16122     TokenInformationLength : ULONG
16123   ): NTSTATUS; stdcall;
16124 begin
16125   GetProcedureAddress(_NtSetInformationToken, ntdll, 'NtSetInformationToken');
16126   Result := TFNNtSetInformationToken(_NtSetInformationToken)(
16127     TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength
16128   );
16129 end;
16130 
16131 // Dynamic version of NtSetIntervalProfile
16132 function  NtSetIntervalProfile(
16133     Interval : ULONG;
16134     Source : KPROFILE_SOURCE
16135   ): NTSTATUS; stdcall;
16136 begin
16137   GetProcedureAddress(_NtSetIntervalProfile, ntdll, 'NtSetIntervalProfile');
16138   Result := TFNNtSetIntervalProfile(_NtSetIntervalProfile)(
16139     Interval, Source
16140   );
16141 end;
16142 
16143 // Dynamic version of NtSetIntervalProfile
16144 function  ZwSetIntervalProfile(
16145     Interval : ULONG;
16146     Source : KPROFILE_SOURCE
16147   ): NTSTATUS; stdcall;
16148 begin
16149   GetProcedureAddress(_NtSetIntervalProfile, ntdll, 'NtSetIntervalProfile');
16150   Result := TFNNtSetIntervalProfile(_NtSetIntervalProfile)(
16151     Interval, Source
16152   );
16153 end;
16154 
16155 // Dynamic version of NtSetIoCompletion
16156 function  NtSetIoCompletion(
16157     IoCompletionHandle : HANDLE;
16158     CompletionKey : ULONG;
16159     CompletionValue : ULONG;
16160     Status : NTSTATUS;
16161     Information : ULONG
16162   ): NTSTATUS; stdcall;
16163 begin
16164   GetProcedureAddress(_NtSetIoCompletion, ntdll, 'NtSetIoCompletion');
16165   Result := TFNNtSetIoCompletion(_NtSetIoCompletion)(
16166     IoCompletionHandle, CompletionKey, CompletionValue, Status, Information
16167   );
16168 end;
16169 
16170 // Dynamic version of NtSetIoCompletion
16171 function  ZwSetIoCompletion(
16172     IoCompletionHandle : HANDLE;
16173     CompletionKey : ULONG;
16174     CompletionValue : ULONG;
16175     Status : NTSTATUS;
16176     Information : ULONG
16177   ): NTSTATUS; stdcall;
16178 begin
16179   GetProcedureAddress(_NtSetIoCompletion, ntdll, 'NtSetIoCompletion');
16180   Result := TFNNtSetIoCompletion(_NtSetIoCompletion)(
16181     IoCompletionHandle, CompletionKey, CompletionValue, Status, Information
16182   );
16183 end;
16184 
16185 // Dynamic version of NtSetLdtEntries
16186 function  NtSetLdtEntries(
16187     Selector1 : ULONG;
16188     LdtEntry1 : LDT_ENTRY;
16189     Selector2 : ULONG;
16190     LdtEntry2 : LDT_ENTRY
16191   ): NTSTATUS; stdcall;
16192 begin
16193   GetProcedureAddress(_NtSetLdtEntries, ntdll, 'NtSetLdtEntries');
16194   Result := TFNNtSetLdtEntries(_NtSetLdtEntries)(
16195     Selector1, LdtEntry1, Selector2, LdtEntry2
16196   );
16197 end;
16198 
16199 // Dynamic version of NtSetLdtEntries
16200 function  ZwSetLdtEntries(
16201     Selector1 : ULONG;
16202     LdtEntry1 : LDT_ENTRY;
16203     Selector2 : ULONG;
16204     LdtEntry2 : LDT_ENTRY
16205   ): NTSTATUS; stdcall;
16206 begin
16207   GetProcedureAddress(_NtSetLdtEntries, ntdll, 'NtSetLdtEntries');
16208   Result := TFNNtSetLdtEntries(_NtSetLdtEntries)(
16209     Selector1, LdtEntry1, Selector2, LdtEntry2
16210   );
16211 end;
16212 
16213 // Dynamic version of NtSetLowEventPair
16214 function  NtSetLowEventPair(
16215     EventPairHandle : HANDLE
16216   ): NTSTATUS; stdcall;
16217 begin
16218   GetProcedureAddress(_NtSetLowEventPair, ntdll, 'NtSetLowEventPair');
16219   Result := TFNNtSetLowEventPair(_NtSetLowEventPair)(
16220     EventPairHandle
16221   );
16222 end;
16223 
16224 // Dynamic version of NtSetLowEventPair
16225 function  ZwSetLowEventPair(
16226     EventPairHandle : HANDLE
16227   ): NTSTATUS; stdcall;
16228 begin
16229   GetProcedureAddress(_NtSetLowEventPair, ntdll, 'NtSetLowEventPair');
16230   Result := TFNNtSetLowEventPair(_NtSetLowEventPair)(
16231     EventPairHandle
16232   );
16233 end;
16234 
16235 // Dynamic version of NtSetLowWaitHighEventPair
16236 function  NtSetLowWaitHighEventPair(
16237     EventPairHandle : HANDLE
16238   ): NTSTATUS; stdcall;
16239 begin
16240   GetProcedureAddress(_NtSetLowWaitHighEventPair, ntdll, 'NtSetLowWaitHighEventPair');
16241   Result := TFNNtSetLowWaitHighEventPair(_NtSetLowWaitHighEventPair)(
16242     EventPairHandle
16243   );
16244 end;
16245 
16246 // Dynamic version of NtSetLowWaitHighEventPair
16247 function  ZwSetLowWaitHighEventPair(
16248     EventPairHandle : HANDLE
16249   ): NTSTATUS; stdcall;
16250 begin
16251   GetProcedureAddress(_NtSetLowWaitHighEventPair, ntdll, 'NtSetLowWaitHighEventPair');
16252   Result := TFNNtSetLowWaitHighEventPair(_NtSetLowWaitHighEventPair)(
16253     EventPairHandle
16254   );
16255 end;
16256 
16257 // Dynamic version of NtSetLowWaitHighThread
16258 function  NtSetLowWaitHighThread(): NTSTATUS; stdcall;
16259 begin
16260   GetProcedureAddress(_NtSetLowWaitHighThread, ntdll, 'NtSetLowWaitHighThread');
16261   Result := TFNNtSetLowWaitHighThread(_NtSetLowWaitHighThread)();
16262 end;
16263 
16264 // Dynamic version of NtSetLowWaitHighThread
16265 function  ZwSetLowWaitHighThread(): NTSTATUS; stdcall;
16266 begin
16267   GetProcedureAddress(_NtSetLowWaitHighThread, ntdll, 'NtSetLowWaitHighThread');
16268   Result := TFNNtSetLowWaitHighThread(_NtSetLowWaitHighThread)();
16269 end;
16270 
16271 // Dynamic version of NtSetQuotaInformationFile
16272 function  NtSetQuotaInformationFile(
16273     FileHandle : HANDLE;
16274     IoStatusBlock : PIO_STATUS_BLOCK;
16275     Buffer : PFILE_USER_QUOTA_INFORMATION;
16276     BufferLength : ULONG
16277   ): NTSTATUS; stdcall;
16278 begin
16279   GetProcedureAddress(_NtSetQuotaInformationFile, ntdll, 'NtSetQuotaInformationFile');
16280   Result := TFNNtSetQuotaInformationFile(_NtSetQuotaInformationFile)(
16281     FileHandle, IoStatusBlock, Buffer, BufferLength
16282   );
16283 end;
16284 
16285 // Dynamic version of NtSetQuotaInformationFile
16286 function  ZwSetQuotaInformationFile(
16287     FileHandle : HANDLE;
16288     IoStatusBlock : PIO_STATUS_BLOCK;
16289     Buffer : PFILE_USER_QUOTA_INFORMATION;
16290     BufferLength : ULONG
16291   ): NTSTATUS; stdcall;
16292 begin
16293   GetProcedureAddress(_NtSetQuotaInformationFile, ntdll, 'NtSetQuotaInformationFile');
16294   Result := TFNNtSetQuotaInformationFile(_NtSetQuotaInformationFile)(
16295     FileHandle, IoStatusBlock, Buffer, BufferLength
16296   );
16297 end;
16298 
16299 // Dynamic version of NtSetSecurityObject
16300 function  NtSetSecurityObject(
16301     Handle : HANDLE;
16302     SecurityInformation : SECURITY_INFORMATION;
16303     SecurityDescriptor : PSECURITY_DESCRIPTOR
16304   ): NTSTATUS; stdcall;
16305 begin
16306   GetProcedureAddress(_NtSetSecurityObject, ntdll, 'NtSetSecurityObject');
16307   Result := TFNNtSetSecurityObject(_NtSetSecurityObject)(
16308     Handle, SecurityInformation, SecurityDescriptor
16309   );
16310 end;
16311 
16312 // Dynamic version of NtSetSecurityObject
16313 function  ZwSetSecurityObject(
16314     Handle : HANDLE;
16315     SecurityInformation : SECURITY_INFORMATION;
16316     SecurityDescriptor : PSECURITY_DESCRIPTOR
16317   ): NTSTATUS; stdcall;
16318 begin
16319   GetProcedureAddress(_NtSetSecurityObject, ntdll, 'NtSetSecurityObject');
16320   Result := TFNNtSetSecurityObject(_NtSetSecurityObject)(
16321     Handle, SecurityInformation, SecurityDescriptor
16322   );
16323 end;
16324 
16325 // Dynamic version of NtSetSystemEnvironmentValue
16326 function  NtSetSystemEnvironmentValue(
16327     Name : PUNICODE_STRING;
16328     Value : PUNICODE_STRING
16329   ): NTSTATUS; stdcall;
16330 begin
16331   GetProcedureAddress(_NtSetSystemEnvironmentValue, ntdll, 'NtSetSystemEnvironmentValue');
16332   Result := TFNNtSetSystemEnvironmentValue(_NtSetSystemEnvironmentValue)(
16333     Name, Value
16334   );
16335 end;
16336 
16337 // Dynamic version of NtSetSystemEnvironmentValue
16338 function  ZwSetSystemEnvironmentValue(
16339     Name : PUNICODE_STRING;
16340     Value : PUNICODE_STRING
16341   ): NTSTATUS; stdcall;
16342 begin
16343   GetProcedureAddress(_NtSetSystemEnvironmentValue, ntdll, 'NtSetSystemEnvironmentValue');
16344   Result := TFNNtSetSystemEnvironmentValue(_NtSetSystemEnvironmentValue)(
16345     Name, Value
16346   );
16347 end;
16348 
16349 // Dynamic version of NtSetSystemInformation
16350 function  NtSetSystemInformation(
16351     SystemInformationClass : SYSTEM_INFORMATION_CLASS;
16352     SystemInformation : PVOID;
16353     SystemInformationLength : ULONG
16354   ): NTSTATUS; stdcall;
16355 begin
16356   GetProcedureAddress(_NtSetSystemInformation, ntdll, 'NtSetSystemInformation');
16357   Result := TFNNtSetSystemInformation(_NtSetSystemInformation)(
16358     SystemInformationClass, SystemInformation, SystemInformationLength
16359   );
16360 end;
16361 
16362 // Dynamic version of NtSetSystemInformation
16363 function  ZwSetSystemInformation(
16364     SystemInformationClass : SYSTEM_INFORMATION_CLASS;
16365     SystemInformation : PVOID;
16366     SystemInformationLength : ULONG
16367   ): NTSTATUS; stdcall;
16368 begin
16369   GetProcedureAddress(_NtSetSystemInformation, ntdll, 'NtSetSystemInformation');
16370   Result := TFNNtSetSystemInformation(_NtSetSystemInformation)(
16371     SystemInformationClass, SystemInformation, SystemInformationLength
16372   );
16373 end;
16374 
16375 // Dynamic version of NtSetSystemPowerState
16376 function  NtSetSystemPowerState(
16377     SystemAction : POWER_ACTION;
16378     MinSystemState : SYSTEM_POWER_STATE;
16379     Flags : ULONG
16380   ): NTSTATUS; stdcall;
16381 begin
16382   GetProcedureAddress(_NtSetSystemPowerState, ntdll, 'NtSetSystemPowerState');
16383   Result := TFNNtSetSystemPowerState(_NtSetSystemPowerState)(
16384     SystemAction, MinSystemState, Flags
16385   );
16386 end;
16387 
16388 // Dynamic version of NtSetSystemPowerState
16389 function  ZwSetSystemPowerState(
16390     SystemAction : POWER_ACTION;
16391     MinSystemState : SYSTEM_POWER_STATE;
16392     Flags : ULONG
16393   ): NTSTATUS; stdcall;
16394 begin
16395   GetProcedureAddress(_NtSetSystemPowerState, ntdll, 'NtSetSystemPowerState');
16396   Result := TFNNtSetSystemPowerState(_NtSetSystemPowerState)(
16397     SystemAction, MinSystemState, Flags
16398   );
16399 end;
16400 
16401 // Dynamic version of NtSetSystemTime
16402 function  NtSetSystemTime(
16403     NewTime : PLARGE_INTEGER;
16404     OldTime : PLARGE_INTEGER
16405   ): NTSTATUS; stdcall;
16406 begin
16407   GetProcedureAddress(_NtSetSystemTime, ntdll, 'NtSetSystemTime');
16408   Result := TFNNtSetSystemTime(_NtSetSystemTime)(
16409     NewTime, OldTime
16410   );
16411 end;
16412 
16413 // Dynamic version of NtSetSystemTime
16414 function  ZwSetSystemTime(
16415     NewTime : PLARGE_INTEGER;
16416     OldTime : PLARGE_INTEGER
16417   ): NTSTATUS; stdcall;
16418 begin
16419   GetProcedureAddress(_NtSetSystemTime, ntdll, 'NtSetSystemTime');
16420   Result := TFNNtSetSystemTime(_NtSetSystemTime)(
16421     NewTime, OldTime
16422   );
16423 end;
16424 
16425 // Dynamic version of NtSetThreadExecutionState
16426 function  NtSetThreadExecutionState(
16427     ExecutionState : EXECUTION_STATE;
16428     PreviousExecutionState : PEXECUTION_STATE
16429   ): NTSTATUS; stdcall;
16430 begin
16431   GetProcedureAddress(_NtSetThreadExecutionState, ntdll, 'NtSetThreadExecutionState');
16432   Result := TFNNtSetThreadExecutionState(_NtSetThreadExecutionState)(
16433     ExecutionState, PreviousExecutionState
16434   );
16435 end;
16436 
16437 // Dynamic version of NtSetThreadExecutionState
16438 function  ZwSetThreadExecutionState(
16439     ExecutionState : EXECUTION_STATE;
16440     PreviousExecutionState : PEXECUTION_STATE
16441   ): NTSTATUS; stdcall;
16442 begin
16443   GetProcedureAddress(_NtSetThreadExecutionState, ntdll, 'NtSetThreadExecutionState');
16444   Result := TFNNtSetThreadExecutionState(_NtSetThreadExecutionState)(
16445     ExecutionState, PreviousExecutionState
16446   );
16447 end;
16448 
16449 // Dynamic version of NtSetTimer
16450 function  NtSetTimer(
16451     TimerHandle : HANDLE;
16452     DueTime : PLARGE_INTEGER;
16453     TimerApcRoutine : PTIMER_APC_ROUTINE;
16454     TimerContext : PVOID;
16455     Resume : BOOLEAN;
16456     Period : LONG;
16457     PreviousState : PBOOLEAN
16458   ): NTSTATUS; stdcall;
16459 begin
16460   GetProcedureAddress(_NtSetTimer, ntdll, 'NtSetTimer');
16461   Result := TFNNtSetTimer(_NtSetTimer)(
16462     TimerHandle, DueTime, TimerApcRoutine, TimerContext, Resume, Period, PreviousState
16463   );
16464 end;
16465 
16466 // Dynamic version of NtSetTimer
16467 function  ZwSetTimer(
16468     TimerHandle : HANDLE;
16469     DueTime : PLARGE_INTEGER;
16470     TimerApcRoutine : PTIMER_APC_ROUTINE;
16471     TimerContext : PVOID;
16472     Resume : BOOLEAN;
16473     Period : LONG;
16474     PreviousState : PBOOLEAN
16475   ): NTSTATUS; stdcall;
16476 begin
16477   GetProcedureAddress(_NtSetTimer, ntdll, 'NtSetTimer');
16478   Result := TFNNtSetTimer(_NtSetTimer)(
16479     TimerHandle, DueTime, TimerApcRoutine, TimerContext, Resume, Period, PreviousState
16480   );
16481 end;
16482 
16483 // Dynamic version of NtSetTimerResolution
16484 function  NtSetTimerResolution(
16485     RequestedResolution : ULONG;
16486     Set_ : BOOLEAN;
16487     ActualResolution : PULONG
16488   ): NTSTATUS; stdcall;
16489 begin
16490   GetProcedureAddress(_NtSetTimerResolution, ntdll, 'NtSetTimerResolution');
16491   Result := TFNNtSetTimerResolution(_NtSetTimerResolution)(
16492     RequestedResolution, Set_, ActualResolution
16493   );
16494 end;
16495 
16496 // Dynamic version of NtSetTimerResolution
16497 function  ZwSetTimerResolution(
16498     RequestedResolution : ULONG;
16499     Set_ : BOOLEAN;
16500     ActualResolution : PULONG
16501   ): NTSTATUS; stdcall;
16502 begin
16503   GetProcedureAddress(_NtSetTimerResolution, ntdll, 'NtSetTimerResolution');
16504   Result := TFNNtSetTimerResolution(_NtSetTimerResolution)(
16505     RequestedResolution, Set_, ActualResolution
16506   );
16507 end;
16508 
16509 // Dynamic version of NtSetUuidSeed
16510 function  NtSetUuidSeed(
16511     UuidSeed : PUCHAR
16512   ): NTSTATUS; stdcall;
16513 begin
16514   GetProcedureAddress(_NtSetUuidSeed, ntdll, 'NtSetUuidSeed');
16515   Result := TFNNtSetUuidSeed(_NtSetUuidSeed)(
16516     UuidSeed
16517   );
16518 end;
16519 
16520 // Dynamic version of NtSetUuidSeed
16521 function  ZwSetUuidSeed(
16522     UuidSeed : PUCHAR
16523   ): NTSTATUS; stdcall;
16524 begin
16525   GetProcedureAddress(_NtSetUuidSeed, ntdll, 'NtSetUuidSeed');
16526   Result := TFNNtSetUuidSeed(_NtSetUuidSeed)(
16527     UuidSeed
16528   );
16529 end;
16530 
16531 // Dynamic version of NtSetValueKey
16532 function  NtSetValueKey(
16533     KeyHandle : HANDLE;
16534     ValueName : PUNICODE_STRING;
16535     TitleIndex : ULONG;
16536     Type_ : ULONG;
16537     Data : PVOID;
16538     DataSize : ULONG
16539   ): NTSTATUS; stdcall;
16540 begin
16541   GetProcedureAddress(_NtSetValueKey, ntdll, 'NtSetValueKey');
16542   Result := TFNNtSetValueKey(_NtSetValueKey)(
16543     KeyHandle, ValueName, TitleIndex, Type_, Data, DataSize
16544   );
16545 end;
16546 
16547 // Dynamic version of NtSetValueKey
16548 function  ZwSetValueKey(
16549     KeyHandle : HANDLE;
16550     ValueName : PUNICODE_STRING;
16551     TitleIndex : ULONG;
16552     Type_ : ULONG;
16553     Data : PVOID;
16554     DataSize : ULONG
16555   ): NTSTATUS; stdcall;
16556 begin
16557   GetProcedureAddress(_NtSetValueKey, ntdll, 'NtSetValueKey');
16558   Result := TFNNtSetValueKey(_NtSetValueKey)(
16559     KeyHandle, ValueName, TitleIndex, Type_, Data, DataSize
16560   );
16561 end;
16562 
16563 // Dynamic version of NtSetVolumeInformationFile
16564 function  NtSetVolumeInformationFile(
16565     FileHandle : HANDLE;
16566     IoStatusBlock : PIO_STATUS_BLOCK;
16567     Buffer : PVOID;
16568     BufferLength : ULONG;
16569     VolumeInformationClass : FS_INFORMATION_CLASS
16570   ): NTSTATUS; stdcall;
16571 begin
16572   GetProcedureAddress(_NtSetVolumeInformationFile, ntdll, 'NtSetVolumeInformationFile');
16573   Result := TFNNtSetVolumeInformationFile(_NtSetVolumeInformationFile)(
16574     FileHandle, IoStatusBlock, Buffer, BufferLength, VolumeInformationClass
16575   );
16576 end;
16577 
16578 // Dynamic version of NtSetVolumeInformationFile
16579 function  ZwSetVolumeInformationFile(
16580     FileHandle : HANDLE;
16581     IoStatusBlock : PIO_STATUS_BLOCK;
16582     Buffer : PVOID;
16583     BufferLength : ULONG;
16584     VolumeInformationClass : FS_INFORMATION_CLASS
16585   ): NTSTATUS; stdcall;
16586 begin
16587   GetProcedureAddress(_NtSetVolumeInformationFile, ntdll, 'NtSetVolumeInformationFile');
16588   Result := TFNNtSetVolumeInformationFile(_NtSetVolumeInformationFile)(
16589     FileHandle, IoStatusBlock, Buffer, BufferLength, VolumeInformationClass
16590   );
16591 end;
16592 
16593 // Dynamic version of NtShutdownSystem
16594 function  NtShutdownSystem(
16595     Action : SHUTDOWN_ACTION
16596   ): NTSTATUS; stdcall;
16597 begin
16598   GetProcedureAddress(_NtShutdownSystem, ntdll, 'NtShutdownSystem');
16599   Result := TFNNtShutdownSystem(_NtShutdownSystem)(
16600     Action
16601   );
16602 end;
16603 
16604 // Dynamic version of NtShutdownSystem
16605 function  ZwShutdownSystem(
16606     Action : SHUTDOWN_ACTION
16607   ): NTSTATUS; stdcall;
16608 begin
16609   GetProcedureAddress(_NtShutdownSystem, ntdll, 'NtShutdownSystem');
16610   Result := TFNNtShutdownSystem(_NtShutdownSystem)(
16611     Action
16612   );
16613 end;
16614 
16615 // Dynamic version of NtSignalAndWaitForSingleObject
16616 function  NtSignalAndWaitForSingleObject(
16617     HandleToSignal : HANDLE;
16618     HandleToWait : HANDLE;
16619     Alertable : BOOLEAN;
16620     Timeout : PLARGE_INTEGER
16621   ): NTSTATUS; stdcall;
16622 begin
16623   GetProcedureAddress(_NtSignalAndWaitForSingleObject, ntdll, 'NtSignalAndWaitForSingleObject');
16624   Result := TFNNtSignalAndWaitForSingleObject(_NtSignalAndWaitForSingleObject)(
16625     HandleToSignal, HandleToWait, Alertable, Timeout
16626   );
16627 end;
16628 
16629 // Dynamic version of NtSignalAndWaitForSingleObject
16630 function  ZwSignalAndWaitForSingleObject(
16631     HandleToSignal : HANDLE;
16632     HandleToWait : HANDLE;
16633     Alertable : BOOLEAN;
16634     Timeout : PLARGE_INTEGER
16635   ): NTSTATUS; stdcall;
16636 begin
16637   GetProcedureAddress(_NtSignalAndWaitForSingleObject, ntdll, 'NtSignalAndWaitForSingleObject');
16638   Result := TFNNtSignalAndWaitForSingleObject(_NtSignalAndWaitForSingleObject)(
16639     HandleToSignal, HandleToWait, Alertable, Timeout
16640   );
16641 end;
16642 
16643 // Dynamic version of NtStartProfile
16644 function  NtStartProfile(
16645     ProfileHandle : HANDLE
16646   ): NTSTATUS; stdcall;
16647 begin
16648   GetProcedureAddress(_NtStartProfile, ntdll, 'NtStartProfile');
16649   Result := TFNNtStartProfile(_NtStartProfile)(
16650     ProfileHandle
16651   );
16652 end;
16653 
16654 // Dynamic version of NtStartProfile
16655 function  ZwStartProfile(
16656     ProfileHandle : HANDLE
16657   ): NTSTATUS; stdcall;
16658 begin
16659   GetProcedureAddress(_NtStartProfile, ntdll, 'NtStartProfile');
16660   Result := TFNNtStartProfile(_NtStartProfile)(
16661     ProfileHandle
16662   );
16663 end;
16664 
16665 // Dynamic version of NtStopProfile
16666 function  NtStopProfile(
16667     ProfileHandle : HANDLE
16668   ): NTSTATUS; stdcall;
16669 begin
16670   GetProcedureAddress(_NtStopProfile, ntdll, 'NtStopProfile');
16671   Result := TFNNtStopProfile(_NtStopProfile)(
16672     ProfileHandle
16673   );
16674 end;
16675 
16676 // Dynamic version of NtStopProfile
16677 function  ZwStopProfile(
16678     ProfileHandle : HANDLE
16679   ): NTSTATUS; stdcall;
16680 begin
16681   GetProcedureAddress(_NtStopProfile, ntdll, 'NtStopProfile');
16682   Result := TFNNtStopProfile(_NtStopProfile)(
16683     ProfileHandle
16684   );
16685 end;
16686 
16687 // Dynamic version of NtSuspendProcess
16688 function  NtSuspendProcess(
16689     hProcess : HANDLE
16690   ): NTSTATUS; stdcall;
16691 begin
16692   GetProcedureAddress(_NtSuspendProcess, ntdll, 'NtSuspendProcess');
16693   Result := TFNNtSuspendProcess(_NtSuspendProcess)(
16694     hProcess
16695   );
16696 end;
16697 
16698 // Dynamic version of NtSuspendProcess
16699 function  ZwSuspendProcess(
16700     hProcess : HANDLE
16701   ): NTSTATUS; stdcall;
16702 begin
16703   GetProcedureAddress(_NtSuspendProcess, ntdll, 'NtSuspendProcess');
16704   Result := TFNNtSuspendProcess(_NtSuspendProcess)(
16705     hProcess
16706   );
16707 end;
16708 
16709 // Dynamic version of NtSuspendThread
16710 function  NtSuspendThread(
16711     hThread : HANDLE;
16712     dwLastResumeCount : PULONG
16713   ): NTSTATUS; stdcall;
16714 begin
16715   GetProcedureAddress(_NtSuspendThread, ntdll, 'NtSuspendThread');
16716   Result := TFNNtSuspendThread(_NtSuspendThread)(
16717     hThread, dwLastResumeCount
16718   );
16719 end;
16720 
16721 // Dynamic version of NtSuspendThread
16722 function  ZwSuspendThread(
16723     hThread : HANDLE;
16724     dwLastResumeCount : PULONG
16725   ): NTSTATUS; stdcall;
16726 begin
16727   GetProcedureAddress(_NtSuspendThread, ntdll, 'NtSuspendThread');
16728   Result := TFNNtSuspendThread(_NtSuspendThread)(
16729     hThread, dwLastResumeCount
16730   );
16731 end;
16732 
16733 // Dynamic version of NtSystemDebugControl
16734 function  NtSystemDebugControl(
16735     ControlCode : DEBUG_CONTROL_CODE;
16736     InputBuffer : PVOID;
16737     InputBufferLength : ULONG;
16738     OutputBuffer : PVOID;
16739     OutputBufferLength : ULONG;
16740     ReturnLength : PULONG
16741   ): NTSTATUS; stdcall;
16742 begin
16743   GetProcedureAddress(_NtSystemDebugControl, ntdll, 'NtSystemDebugControl');
16744   Result := TFNNtSystemDebugControl(_NtSystemDebugControl)(
16745     ControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength, ReturnLength
16746   );
16747 end;
16748 
16749 // Dynamic version of NtSystemDebugControl
16750 function  ZwSystemDebugControl(
16751     ControlCode : DEBUG_CONTROL_CODE;
16752     InputBuffer : PVOID;
16753     InputBufferLength : ULONG;
16754     OutputBuffer : PVOID;
16755     OutputBufferLength : ULONG;
16756     ReturnLength : PULONG
16757   ): NTSTATUS; stdcall;
16758 begin
16759   GetProcedureAddress(_NtSystemDebugControl, ntdll, 'NtSystemDebugControl');
16760   Result := TFNNtSystemDebugControl(_NtSystemDebugControl)(
16761     ControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength, ReturnLength
16762   );
16763 end;
16764 
16765 // Dynamic version of NtTerminateJobObject
16766 function  NtTerminateJobObject(
16767     JobHandle : HANDLE;
16768     ExitStatus : NTSTATUS
16769   ): NTSTATUS; stdcall;
16770 begin
16771   GetProcedureAddress(_NtTerminateJobObject, ntdll, 'NtTerminateJobObject');
16772   Result := TFNNtTerminateJobObject(_NtTerminateJobObject)(
16773     JobHandle, ExitStatus
16774   );
16775 end;
16776 
16777 // Dynamic version of NtTerminateJobObject
16778 function  ZwTerminateJobObject(
16779     JobHandle : HANDLE;
16780     ExitStatus : NTSTATUS
16781   ): NTSTATUS; stdcall;
16782 begin
16783   GetProcedureAddress(_NtTerminateJobObject, ntdll, 'NtTerminateJobObject');
16784   Result := TFNNtTerminateJobObject(_NtTerminateJobObject)(
16785     JobHandle, ExitStatus
16786   );
16787 end;
16788 
16789 // Dynamic version of NtTerminateProcess
16790 function  NtTerminateProcess(
16791     ProcessHandle : HANDLE;
16792     ExitStatus : NTSTATUS
16793   ): NTSTATUS; stdcall;
16794 begin
16795   GetProcedureAddress(_NtTerminateProcess, ntdll, 'NtTerminateProcess');
16796   Result := TFNNtTerminateProcess(_NtTerminateProcess)(
16797     ProcessHandle, ExitStatus
16798   );
16799 end;
16800 
16801 // Dynamic version of NtTerminateProcess
16802 function  ZwTerminateProcess(
16803     ProcessHandle : HANDLE;
16804     ExitStatus : NTSTATUS
16805   ): NTSTATUS; stdcall;
16806 begin
16807   GetProcedureAddress(_NtTerminateProcess, ntdll, 'NtTerminateProcess');
16808   Result := TFNNtTerminateProcess(_NtTerminateProcess)(
16809     ProcessHandle, ExitStatus
16810   );
16811 end;
16812 
16813 // Dynamic version of NtTerminateThread
16814 function  NtTerminateThread(
16815     ThreadHandle : HANDLE;
16816     ExitStatus : NTSTATUS
16817   ): NTSTATUS; stdcall;
16818 begin
16819   GetProcedureAddress(_NtTerminateThread, ntdll, 'NtTerminateThread');
16820   Result := TFNNtTerminateThread(_NtTerminateThread)(
16821     ThreadHandle, ExitStatus
16822   );
16823 end;
16824 
16825 // Dynamic version of NtTerminateThread
16826 function  ZwTerminateThread(
16827     ThreadHandle : HANDLE;
16828     ExitStatus : NTSTATUS
16829   ): NTSTATUS; stdcall;
16830 begin
16831   GetProcedureAddress(_NtTerminateThread, ntdll, 'NtTerminateThread');
16832   Result := TFNNtTerminateThread(_NtTerminateThread)(
16833     ThreadHandle, ExitStatus
16834   );
16835 end;
16836 
16837 // Dynamic version of NtTestAlert
16838 function  NtTestAlert(): NTSTATUS; stdcall;
16839 begin
16840   GetProcedureAddress(_NtTestAlert, ntdll, 'NtTestAlert');
16841   Result := TFNNtTestAlert(_NtTestAlert)();
16842 end;
16843 
16844 // Dynamic version of NtTestAlert
16845 function  ZwTestAlert(): NTSTATUS; stdcall;
16846 begin
16847   GetProcedureAddress(_NtTestAlert, ntdll, 'NtTestAlert');
16848   Result := TFNNtTestAlert(_NtTestAlert)();
16849 end;
16850 
16851 // Dynamic version of NtUnloadDriver
16852 function  NtUnloadDriver(
16853     DriverServiceName : PUNICODE_STRING
16854   ): NTSTATUS; stdcall;
16855 begin
16856   GetProcedureAddress(_NtUnloadDriver, ntdll, 'NtUnloadDriver');
16857   Result := TFNNtUnloadDriver(_NtUnloadDriver)(
16858     DriverServiceName
16859   );
16860 end;
16861 
16862 // Dynamic version of NtUnloadDriver
16863 function  ZwUnloadDriver(
16864     DriverServiceName : PUNICODE_STRING
16865   ): NTSTATUS; stdcall;
16866 begin
16867   GetProcedureAddress(_NtUnloadDriver, ntdll, 'NtUnloadDriver');
16868   Result := TFNNtUnloadDriver(_NtUnloadDriver)(
16869     DriverServiceName
16870   );
16871 end;
16872 
16873 // Dynamic version of NtUnloadKey
16874 function  NtUnloadKey(
16875     KeyObjectAttributes : POBJECT_ATTRIBUTES
16876   ): NTSTATUS; stdcall;
16877 begin
16878   GetProcedureAddress(_NtUnloadKey, ntdll, 'NtUnloadKey');
16879   Result := TFNNtUnloadKey(_NtUnloadKey)(
16880     KeyObjectAttributes
16881   );
16882 end;
16883 
16884 // Dynamic version of NtUnloadKey
16885 function  ZwUnloadKey(
16886     KeyObjectAttributes : POBJECT_ATTRIBUTES
16887   ): NTSTATUS; stdcall;
16888 begin
16889   GetProcedureAddress(_NtUnloadKey, ntdll, 'NtUnloadKey');
16890   Result := TFNNtUnloadKey(_NtUnloadKey)(
16891     KeyObjectAttributes
16892   );
16893 end;
16894 
16895 // Dynamic version of NtUnlockFile
16896 function  NtUnlockFile(
16897     FileHandle : HANDLE;
16898     IoStatusBlock : PIO_STATUS_BLOCK;
16899     LockOffset : PULARGE_INTEGER;
16900     LockLength : PULARGE_INTEGER;
16901     Key : ULONG
16902   ): NTSTATUS; stdcall;
16903 begin
16904   GetProcedureAddress(_NtUnlockFile, ntdll, 'NtUnlockFile');
16905   Result := TFNNtUnlockFile(_NtUnlockFile)(
16906     FileHandle, IoStatusBlock, LockOffset, LockLength, Key
16907   );
16908 end;
16909 
16910 // Dynamic version of NtUnlockFile
16911 function  ZwUnlockFile(
16912     FileHandle : HANDLE;
16913     IoStatusBlock : PIO_STATUS_BLOCK;
16914     LockOffset : PULARGE_INTEGER;
16915     LockLength : PULARGE_INTEGER;
16916     Key : ULONG
16917   ): NTSTATUS; stdcall;
16918 begin
16919   GetProcedureAddress(_NtUnlockFile, ntdll, 'NtUnlockFile');
16920   Result := TFNNtUnlockFile(_NtUnlockFile)(
16921     FileHandle, IoStatusBlock, LockOffset, LockLength, Key
16922   );
16923 end;
16924 
16925 // Dynamic version of NtUnlockVirtualMemory
16926 function  NtUnlockVirtualMemory(
16927     ProcessHandle : HANDLE;
16928     BaseAddress : PPVOID;
16929     LockSize : PULONG;
16930     LockType : ULONG
16931   ): NTSTATUS; stdcall;
16932 begin
16933   GetProcedureAddress(_NtUnlockVirtualMemory, ntdll, 'NtUnlockVirtualMemory');
16934   Result := TFNNtUnlockVirtualMemory(_NtUnlockVirtualMemory)(
16935     ProcessHandle, BaseAddress, LockSize, LockType
16936   );
16937 end;
16938 
16939 // Dynamic version of NtUnlockVirtualMemory
16940 function  ZwUnlockVirtualMemory(
16941     ProcessHandle : HANDLE;
16942     BaseAddress : PPVOID;
16943     LockSize : PULONG;
16944     LockType : ULONG
16945   ): NTSTATUS; stdcall;
16946 begin
16947   GetProcedureAddress(_NtUnlockVirtualMemory, ntdll, 'NtUnlockVirtualMemory');
16948   Result := TFNNtUnlockVirtualMemory(_NtUnlockVirtualMemory)(
16949     ProcessHandle, BaseAddress, LockSize, LockType
16950   );
16951 end;
16952 
16953 // Dynamic version of NtUnmapViewOfSection
16954 function  NtUnmapViewOfSection(
16955     ProcessHandle : HANDLE;
16956     BaseAddress : PVOID
16957   ): NTSTATUS; stdcall;
16958 begin
16959   GetProcedureAddress(_NtUnmapViewOfSection, ntdll, 'NtUnmapViewOfSection');
16960   Result := TFNNtUnmapViewOfSection(_NtUnmapViewOfSection)(
16961     ProcessHandle, BaseAddress
16962   );
16963 end;
16964 
16965 // Dynamic version of NtUnmapViewOfSection
16966 function  ZwUnmapViewOfSection(
16967     ProcessHandle : HANDLE;
16968     BaseAddress : PVOID
16969   ): NTSTATUS; stdcall;
16970 begin
16971   GetProcedureAddress(_NtUnmapViewOfSection, ntdll, 'NtUnmapViewOfSection');
16972   Result := TFNNtUnmapViewOfSection(_NtUnmapViewOfSection)(
16973     ProcessHandle, BaseAddress
16974   );
16975 end;
16976 
16977 // Dynamic version of NtVdmControl
16978 function  NtVdmControl(
16979     ControlCode : ULONG;
16980     ControlData : PVOID
16981   ): NTSTATUS; stdcall;
16982 begin
16983   GetProcedureAddress(_NtVdmControl, ntdll, 'NtVdmControl');
16984   Result := TFNNtVdmControl(_NtVdmControl)(
16985     ControlCode, ControlData
16986   );
16987 end;
16988 
16989 // Dynamic version of NtVdmControl
16990 function  ZwVdmControl(
16991     ControlCode : ULONG;
16992     ControlData : PVOID
16993   ): NTSTATUS; stdcall;
16994 begin
16995   GetProcedureAddress(_NtVdmControl, ntdll, 'NtVdmControl');
16996   Result := TFNNtVdmControl(_NtVdmControl)(
16997     ControlCode, ControlData
16998   );
16999 end;
17000 
17001 // Dynamic version of NtW32Call
17002 function  NtW32Call(
17003     RoutineIndex : ULONG;
17004     Argument : PVOID;
17005     ArgumentLength : ULONG;
17006     Result_ : PPVOID;
17007     ResultLength : PULONG
17008   ): NTSTATUS; stdcall;
17009 begin
17010   GetProcedureAddress(_NtW32Call, ntdll, 'NtW32Call');
17011   Result := TFNNtW32Call(_NtW32Call)(
17012     RoutineIndex, Argument, ArgumentLength, Result_, ResultLength
17013   );
17014 end;
17015 
17016 // Dynamic version of NtW32Call
17017 function  ZwW32Call(
17018     RoutineIndex : ULONG;
17019     Argument : PVOID;
17020     ArgumentLength : ULONG;
17021     Result_ : PPVOID;
17022     ResultLength : PULONG
17023   ): NTSTATUS; stdcall;
17024 begin
17025   GetProcedureAddress(_NtW32Call, ntdll, 'NtW32Call');
17026   Result := TFNNtW32Call(_NtW32Call)(
17027     RoutineIndex, Argument, ArgumentLength, Result_, ResultLength
17028   );
17029 end;
17030 
17031 // Dynamic version of NtWaitForMultipleObjects
17032 function  NtWaitForMultipleObjects(
17033     HandleCount : ULONG;
17034     Handles : PHANDLE;
17035     WaitType : WAIT_TYPE;
17036     Alertable : BOOLEAN;
17037     Timeout : PLARGE_INTEGER
17038   ): NTSTATUS; stdcall;
17039 begin
17040   GetProcedureAddress(_NtWaitForMultipleObjects, ntdll, 'NtWaitForMultipleObjects');
17041   Result := TFNNtWaitForMultipleObjects(_NtWaitForMultipleObjects)(
17042     HandleCount, Handles, WaitType, Alertable, Timeout
17043   );
17044 end;
17045 
17046 // Dynamic version of NtWaitForMultipleObjects
17047 function  ZwWaitForMultipleObjects(
17048     HandleCount : ULONG;
17049     Handles : PHANDLE;
17050     WaitType : WAIT_TYPE;
17051     Alertable : BOOLEAN;
17052     Timeout : PLARGE_INTEGER
17053   ): NTSTATUS; stdcall;
17054 begin
17055   GetProcedureAddress(_NtWaitForMultipleObjects, ntdll, 'NtWaitForMultipleObjects');
17056   Result := TFNNtWaitForMultipleObjects(_NtWaitForMultipleObjects)(
17057     HandleCount, Handles, WaitType, Alertable, Timeout
17058   );
17059 end;
17060 
17061 {$IFNDEF JWA_INCLUDEMODE}
17062 // Dynamic version of NtWaitForSingleObject
17063 function  NtWaitForSingleObject(
17064     Handle : HANDLE;
17065     Alertable : BOOLEAN;
17066     Timeout : PLARGE_INTEGER
17067   ): NTSTATUS; stdcall;
17068 begin
17069   GetProcedureAddress(_NtWaitForSingleObject, ntdll, 'NtWaitForSingleObject');
17070   Result := TFNNtWaitForSingleObject(_NtWaitForSingleObject)(
17071     Handle, Alertable, Timeout
17072   );
17073 end;
17074 {$ENDIF JWA_INCLUDEMODE}
17075 
17076 // Dynamic version of NtWaitForSingleObject
17077 function  ZwWaitForSingleObject(
17078     Handle : HANDLE;
17079     Alertable : BOOLEAN;
17080     Timeout : PLARGE_INTEGER
17081   ): NTSTATUS; stdcall;
17082 begin
17083   GetProcedureAddress(_NtWaitForSingleObject, ntdll, 'NtWaitForSingleObject');
17084   Result := TFNNtWaitForSingleObject(_NtWaitForSingleObject)(
17085     Handle, Alertable, Timeout
17086   );
17087 end;
17088 
17089 // Dynamic version of NtWaitHighEventPair
17090 function  NtWaitHighEventPair(
17091     EventPairHandle : HANDLE
17092   ): NTSTATUS; stdcall;
17093 begin
17094   GetProcedureAddress(_NtWaitHighEventPair, ntdll, 'NtWaitHighEventPair');
17095   Result := TFNNtWaitHighEventPair(_NtWaitHighEventPair)(
17096     EventPairHandle
17097   );
17098 end;
17099 
17100 // Dynamic version of NtWaitHighEventPair
17101 function  ZwWaitHighEventPair(
17102     EventPairHandle : HANDLE
17103   ): NTSTATUS; stdcall;
17104 begin
17105   GetProcedureAddress(_NtWaitHighEventPair, ntdll, 'NtWaitHighEventPair');
17106   Result := TFNNtWaitHighEventPair(_NtWaitHighEventPair)(
17107     EventPairHandle
17108   );
17109 end;
17110 
17111 // Dynamic version of NtWaitLowEventPair
17112 function  NtWaitLowEventPair(
17113     EventPairHandle : HANDLE
17114   ): NTSTATUS; stdcall;
17115 begin
17116   GetProcedureAddress(_NtWaitLowEventPair, ntdll, 'NtWaitLowEventPair');
17117   Result := TFNNtWaitLowEventPair(_NtWaitLowEventPair)(
17118     EventPairHandle
17119   );
17120 end;
17121 
17122 // Dynamic version of NtWaitLowEventPair
17123 function  ZwWaitLowEventPair(
17124     EventPairHandle : HANDLE
17125   ): NTSTATUS; stdcall;
17126 begin
17127   GetProcedureAddress(_NtWaitLowEventPair, ntdll, 'NtWaitLowEventPair');
17128   Result := TFNNtWaitLowEventPair(_NtWaitLowEventPair)(
17129     EventPairHandle
17130   );
17131 end;
17132 
17133 // Dynamic version of NtWriteFile
17134 function  NtWriteFile(
17135     FileHandle : HANDLE;
17136     Event : HANDLE;
17137     ApcRoutine : PIO_APC_ROUTINE;
17138     ApcContext : PVOID;
17139     IoStatusBlock : PIO_STATUS_BLOCK;
17140     Buffer : PVOID;
17141     Length : ULONG;
17142     ByteOffset : PLARGE_INTEGER;
17143     Key : PULONG
17144   ): NTSTATUS; stdcall;
17145 begin
17146   GetProcedureAddress(_NtWriteFile, ntdll, 'NtWriteFile');
17147   Result := TFNNtWriteFile(_NtWriteFile)(
17148     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
17149   );
17150 end;
17151 
17152 // Dynamic version of NtWriteFile
17153 function  ZwWriteFile(
17154     FileHandle : HANDLE;
17155     Event : HANDLE;
17156     ApcRoutine : PIO_APC_ROUTINE;
17157     ApcContext : PVOID;
17158     IoStatusBlock : PIO_STATUS_BLOCK;
17159     Buffer : PVOID;
17160     Length : ULONG;
17161     ByteOffset : PLARGE_INTEGER;
17162     Key : PULONG
17163   ): NTSTATUS; stdcall;
17164 begin
17165   GetProcedureAddress(_NtWriteFile, ntdll, 'NtWriteFile');
17166   Result := TFNNtWriteFile(_NtWriteFile)(
17167     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
17168   );
17169 end;
17170 
17171 // Dynamic version of NtWriteFileGather
17172 function  NtWriteFileGather(
17173     FileHandle : HANDLE;
17174     Event : HANDLE;
17175     ApcRoutine : PIO_APC_ROUTINE;
17176     ApcContext : PVOID;
17177     IoStatusBlock : PIO_STATUS_BLOCK;
17178     Buffer : PFILE_SEGMENT_ELEMENT;
17179     Length : ULONG;
17180     ByteOffset : PLARGE_INTEGER;
17181     Key : PULONG
17182   ): NTSTATUS; stdcall;
17183 begin
17184   GetProcedureAddress(_NtWriteFileGather, ntdll, 'NtWriteFileGather');
17185   Result := TFNNtWriteFileGather(_NtWriteFileGather)(
17186     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
17187   );
17188 end;
17189 
17190 // Dynamic version of NtWriteFileGather
17191 function  ZwWriteFileGather(
17192     FileHandle : HANDLE;
17193     Event : HANDLE;
17194     ApcRoutine : PIO_APC_ROUTINE;
17195     ApcContext : PVOID;
17196     IoStatusBlock : PIO_STATUS_BLOCK;
17197     Buffer : PFILE_SEGMENT_ELEMENT;
17198     Length : ULONG;
17199     ByteOffset : PLARGE_INTEGER;
17200     Key : PULONG
17201   ): NTSTATUS; stdcall;
17202 begin
17203   GetProcedureAddress(_NtWriteFileGather, ntdll, 'NtWriteFileGather');
17204   Result := TFNNtWriteFileGather(_NtWriteFileGather)(
17205     FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key
17206   );
17207 end;
17208 
17209 // Dynamic version of NtWriteRequestData
17210 function  NtWriteRequestData(
17211     PortHandle : HANDLE;
17212     Message : PPORT_MESSAGE;
17213     Index : ULONG;
17214     Buffer : PVOID;
17215     BufferLength : ULONG;
17216     ReturnLength : PULONG
17217   ): NTSTATUS; stdcall;
17218 begin
17219   GetProcedureAddress(_NtWriteRequestData, ntdll, 'NtWriteRequestData');
17220   Result := TFNNtWriteRequestData(_NtWriteRequestData)(
17221     PortHandle, Message, Index, Buffer, BufferLength, ReturnLength
17222   );
17223 end;
17224 
17225 // Dynamic version of NtWriteRequestData
17226 function  ZwWriteRequestData(
17227     PortHandle : HANDLE;
17228     Message : PPORT_MESSAGE;
17229     Index : ULONG;
17230     Buffer : PVOID;
17231     BufferLength : ULONG;
17232     ReturnLength : PULONG
17233   ): NTSTATUS; stdcall;
17234 begin
17235   GetProcedureAddress(_NtWriteRequestData, ntdll, 'NtWriteRequestData');
17236   Result := TFNNtWriteRequestData(_NtWriteRequestData)(
17237     PortHandle, Message, Index, Buffer, BufferLength, ReturnLength
17238   );
17239 end;
17240 
17241 // Dynamic version of NtWriteVirtualMemory
17242 function  NtWriteVirtualMemory(
17243     ProcessHandle : HANDLE;
17244     BaseAddress : PVOID;
17245     Buffer : PVOID;
17246     BufferLength : ULONG;
17247     ReturnLength : PULONG
17248   ): NTSTATUS; stdcall;
17249 begin
17250   GetProcedureAddress(_NtWriteVirtualMemory, ntdll, 'NtWriteVirtualMemory');
17251   Result := TFNNtWriteVirtualMemory(_NtWriteVirtualMemory)(
17252     ProcessHandle, BaseAddress, Buffer, BufferLength, ReturnLength
17253   );
17254 end;
17255 
17256 // Dynamic version of NtWriteVirtualMemory
17257 function  ZwWriteVirtualMemory(
17258     ProcessHandle : HANDLE;
17259     BaseAddress : PVOID;
17260     Buffer : PVOID;
17261     BufferLength : ULONG;
17262     ReturnLength : PULONG
17263   ): NTSTATUS; stdcall;
17264 begin
17265   GetProcedureAddress(_NtWriteVirtualMemory, ntdll, 'NtWriteVirtualMemory');
17266   Result := TFNNtWriteVirtualMemory(_NtWriteVirtualMemory)(
17267     ProcessHandle, BaseAddress, Buffer, BufferLength, ReturnLength
17268   );
17269 end;
17270 
17271 // Dynamic version of NtYieldExecution
17272 function  NtYieldExecution(): NTSTATUS; stdcall;
17273 begin
17274   GetProcedureAddress(_NtYieldExecution, ntdll, 'NtYieldExecution');
17275   Result := TFNNtYieldExecution(_NtYieldExecution)();
17276 end;
17277 
17278 // Dynamic version of NtYieldExecution
17279 function  ZwYieldExecution(): NTSTATUS; stdcall;
17280 begin
17281   GetProcedureAddress(_NtYieldExecution, ntdll, 'NtYieldExecution');
17282   Result := TFNNtYieldExecution(_NtYieldExecution)();
17283 end;
17284 
17285 // Dynamic version of RtlAbsoluteToSelfRelativeSD
17286 function  RtlAbsoluteToSelfRelativeSD(
17287     pAbsoluteSD : PSECURITY_DESCRIPTOR;
17288     pSelfRelativeSD : PSECURITY_DESCRIPTOR;
17289     lpdwBufferLength : LPDWORD
17290   ): NTSTATUS; stdcall;
17291 begin
17292   GetProcedureAddress(_RtlAbsoluteToSelfRelativeSD, ntdll, 'RtlAbsoluteToSelfRelativeSD');
17293   Result := TFNRtlAbsoluteToSelfRelativeSD(_RtlAbsoluteToSelfRelativeSD)(
17294     pAbsoluteSD, pSelfRelativeSD, lpdwBufferLength
17295   );
17296 end;
17297 
17298 // Dynamic version of RtlAcquirePebLock
17299 procedure RtlAcquirePebLock(); stdcall;
17300 begin
17301   GetProcedureAddress(_RtlAcquirePebLock, ntdll, 'RtlAcquirePebLock');
17302   TFNRtlAcquirePebLock(_RtlAcquirePebLock)();
17303 end;
17304 
17305 // Dynamic version of RtlAddAccessAllowedAce
17306 function  RtlAddAccessAllowedAce(
17307     pAcl : PACL;
17308     dwAceRevision : DWORD;
17309     AccessMask : ACCESS_MASK;
17310     pSid : PSID
17311   ): NTSTATUS; stdcall;
17312 begin
17313   GetProcedureAddress(_RtlAddAccessAllowedAce, ntdll, 'RtlAddAccessAllowedAce');
17314   Result := TFNRtlAddAccessAllowedAce(_RtlAddAccessAllowedAce)(
17315     pAcl, dwAceRevision, AccessMask, pSid
17316   );
17317 end;
17318 
17319 // Dynamic version of RtlAddAccessAllowedAceEx
17320 function  RtlAddAccessAllowedAceEx(
17321     pAcl : PACL;
17322     dwAceRevision : DWORD;
17323     AceFlags : DWORD;
17324     AccessMask : ACCESS_MASK;
17325     pSid : PSID
17326   ): NTSTATUS; stdcall;
17327 begin
17328   GetProcedureAddress(_RtlAddAccessAllowedAceEx, ntdll, 'RtlAddAccessAllowedAceEx');
17329   Result := TFNRtlAddAccessAllowedAceEx(_RtlAddAccessAllowedAceEx)(
17330     pAcl, dwAceRevision, AceFlags, AccessMask, pSid
17331   );
17332 end;
17333 
17334 // Dynamic version of RtlAddAccessDeniedAce
17335 function  RtlAddAccessDeniedAce(
17336     pAcl : PACL;
17337     dwAceRevision : DWORD;
17338     AccessMask : ACCESS_MASK;
17339     pSid : PSID
17340   ): NTSTATUS; stdcall;
17341 begin
17342   GetProcedureAddress(_RtlAddAccessDeniedAce, ntdll, 'RtlAddAccessDeniedAce');
17343   Result := TFNRtlAddAccessDeniedAce(_RtlAddAccessDeniedAce)(
17344     pAcl, dwAceRevision, AccessMask, pSid
17345   );
17346 end;
17347 
17348 // Dynamic version of RtlAddAccessDeniedAceEx
17349 function  RtlAddAccessDeniedAceEx(
17350     pAcl : PACL;
17351     dwAceRevision : DWORD;
17352     AceFlags : DWORD;
17353     AccessMask : ACCESS_MASK;
17354     pSid : PSID
17355   ): NTSTATUS; stdcall;
17356 begin
17357   GetProcedureAddress(_RtlAddAccessDeniedAceEx, ntdll, 'RtlAddAccessDeniedAceEx');
17358   Result := TFNRtlAddAccessDeniedAceEx(_RtlAddAccessDeniedAceEx)(
17359     pAcl, dwAceRevision, AceFlags, AccessMask, pSid
17360   );
17361 end;
17362 
17363 // Dynamic version of RtlAddAce
17364 function  RtlAddAce(
17365     pAcl : PACL;
17366     dwAceRevision : DWORD;
17367     dwStartingAceIndex : DWORD;
17368     pAceList : PVOID;
17369     nAceListLength : DWORD
17370   ): NTSTATUS; stdcall;
17371 begin
17372   GetProcedureAddress(_RtlAddAce, ntdll, 'RtlAddAce');
17373   Result := TFNRtlAddAce(_RtlAddAce)(
17374     pAcl, dwAceRevision, dwStartingAceIndex, pAceList, nAceListLength
17375   );
17376 end;
17377 
17378 // Dynamic version of RtlAddAuditAccessAce
17379 function  RtlAddAuditAccessAce(
17380     pAcl : PACL;
17381     dwAceRevision : DWORD;
17382     AccessMask : ACCESS_MASK;
17383     pSid : PSID;
17384     bAuditSuccess : BOOLEAN;
17385     bAuditFailure : BOOLEAN
17386   ): NTSTATUS; stdcall;
17387 begin
17388   GetProcedureAddress(_RtlAddAuditAccessAce, ntdll, 'RtlAddAuditAccessAce');
17389   Result := TFNRtlAddAuditAccessAce(_RtlAddAuditAccessAce)(
17390     pAcl, dwAceRevision, AccessMask, pSid, bAuditSuccess, bAuditFailure
17391   );
17392 end;
17393 
17394 // Dynamic version of RtlAddAuditAccessAceEx
17395 function  RtlAddAuditAccessAceEx(
17396     pAcl : PACL;
17397     dwAceRevision : DWORD;
17398     AceFlags : DWORD;
17399     AccessMask : ACCESS_MASK;
17400     pSid : PSID;
17401     bAuditSuccess : BOOLEAN;
17402     bAuditFailure : BOOLEAN
17403   ): NTSTATUS; stdcall;
17404 begin
17405   GetProcedureAddress(_RtlAddAuditAccessAceEx, ntdll, 'RtlAddAuditAccessAceEx');
17406   Result := TFNRtlAddAuditAccessAceEx(_RtlAddAuditAccessAceEx)(
17407     pAcl, dwAceRevision, AceFlags, AccessMask, pSid, bAuditSuccess, bAuditFailure
17408   );
17409 end;
17410 
17411 // Dynamic version of RtlAddRange
17412 function  RtlAddRange(
17413     RangeList : PRTL_RANGE_LIST;
17414     Start : ULONGLONG;
17415     End_ : ULONGLONG;
17416     Attributes : UCHAR;
17417     Flags : ULONG;
17418     UserData : PVOID;
17419     Owner : PVOID
17420   ): NTSTATUS; stdcall;
17421 begin
17422   GetProcedureAddress(_RtlAddRange, ntdll, 'RtlAddRange');
17423   Result := TFNRtlAddRange(_RtlAddRange)(
17424     RangeList, Start, End_, Attributes, Flags, UserData, Owner
17425   );
17426 end;
17427 
17428 // Dynamic version of RtlAddVectoredExceptionHandler
17429 function  RtlAddVectoredExceptionHandler(
17430     FirstHandler : ULONG;
17431     VectoredHandler : PVECTORED_EXCEPTION_HANDLER
17432   ): PVOID; stdcall;
17433 begin
17434   GetProcedureAddress(_RtlAddVectoredExceptionHandler, ntdll, 'RtlAddVectoredExceptionHandler');
17435   Result := TFNRtlAddVectoredExceptionHandler(_RtlAddVectoredExceptionHandler)(
17436     FirstHandler, VectoredHandler
17437   );
17438 end;
17439 
17440 // Dynamic version of RtlAdjustPrivilege
17441 function  RtlAdjustPrivilege(
17442     Privilege : ULONG;
17443     Enable : BOOLEAN;
17444     CurrentThread : BOOLEAN;
17445     Enabled : PBOOLEAN
17446   ): NTSTATUS; stdcall;
17447 begin
17448   GetProcedureAddress(_RtlAdjustPrivilege, ntdll, 'RtlAdjustPrivilege');
17449   Result := TFNRtlAdjustPrivilege(_RtlAdjustPrivilege)(
17450     Privilege, Enable, CurrentThread, Enabled
17451   );
17452 end;
17453 
17454 // Dynamic version of RtlAllocateAndInitializeSid
17455 function  RtlAllocateAndInitializeSid(
17456     pIdentifierAuthority : PSID_IDENTIFIER_AUTHORITY;
17457     SubAuthorityCount : BYTE;
17458     nSubAuthority0 : DWORD;
17459     nSubAuthority1 : DWORD;
17460     nSubAuthority2 : DWORD;
17461     nSubAuthority3 : DWORD;
17462     nSubAuthority4 : DWORD;
17463     nSubAuthority5 : DWORD;
17464     nSubAuthority6 : DWORD;
17465     nSubAuthority7 : DWORD;
17466     var pSid : PSID
17467   ): BOOL; stdcall;
17468 begin
17469   GetProcedureAddress(_RtlAllocateAndInitializeSid, ntdll, 'RtlAllocateAndInitializeSid');
17470   Result := TFNRtlAllocateAndInitializeSid(_RtlAllocateAndInitializeSid)(
17471     pIdentifierAuthority, SubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, pSid
17472   );
17473 end;
17474 
17475 // Dynamic version of RtlAllocateHeap
17476 function  RtlAllocateHeap(
17477     hHeap : HANDLE;
17478     dwFlags : ULONG;
17479     Size : ULONG
17480   ): PVOID; stdcall;
17481 begin
17482   GetProcedureAddress(_RtlAllocateHeap, ntdll, 'RtlAllocateHeap');
17483   Result := TFNRtlAllocateHeap(_RtlAllocateHeap)(
17484     hHeap, dwFlags, Size
17485   );
17486 end;
17487 
17488 // Dynamic version of RtlAnsiCharToUnicodeChar
17489 function  RtlAnsiCharToUnicodeChar(
17490     AnsiChar : CHAR
17491   ): WCHAR; stdcall;
17492 begin
17493   GetProcedureAddress(_RtlAnsiCharToUnicodeChar, ntdll, 'RtlAnsiCharToUnicodeChar');
17494   Result := TFNRtlAnsiCharToUnicodeChar(_RtlAnsiCharToUnicodeChar)(
17495     AnsiChar
17496   );
17497 end;
17498 
17499 // Dynamic version of RtlAnsiStringToUnicodeSize
17500 function  RtlAnsiStringToUnicodeSize(
17501     AnsiString : PANSI_STRING
17502   ): ULONG; stdcall;
17503 begin
17504   GetProcedureAddress(_RtlAnsiStringToUnicodeSize, ntdll, 'RtlAnsiStringToUnicodeSize');
17505   Result := TFNRtlAnsiStringToUnicodeSize(_RtlAnsiStringToUnicodeSize)(
17506     AnsiString
17507   );
17508 end;
17509 
17510 {$IFNDEF JWA_INCLUDEMODE}
17511 // Dynamic version of RtlAnsiStringToUnicodeString
17512 function  RtlAnsiStringToUnicodeString(
17513     DestinationString : PUNICODE_STRING;
17514     SourceString : PANSI_STRING;
17515     AllocateDestinationString : BOOLEAN
17516   ): NTSTATUS; stdcall;
17517 begin
17518   GetProcedureAddress(_RtlAnsiStringToUnicodeString, ntdll, 'RtlAnsiStringToUnicodeString');
17519   Result := TFNRtlAnsiStringToUnicodeString(_RtlAnsiStringToUnicodeString)(
17520     DestinationString, SourceString, AllocateDestinationString
17521   );
17522 end;
17523 {$ENDIF JWA_INCLUDEMODE}
17524 
17525 // Dynamic version of RtlAppendAsciizToString
17526 function  RtlAppendAsciizToString(
17527     DestinationString : PSTRING;
17528     AppendThisString : LPCSTR
17529   ): NTSTATUS; stdcall;
17530 begin
17531   GetProcedureAddress(_RtlAppendAsciizToString, ntdll, 'RtlAppendAsciizToString');
17532   Result := TFNRtlAppendAsciizToString(_RtlAppendAsciizToString)(
17533     DestinationString, AppendThisString
17534   );
17535 end;
17536 
17537 // Dynamic version of RtlAppendStringToString
17538 function  RtlAppendStringToString(
17539     DestinationString : PSTRING;
17540     AppendThisString : PSTRING
17541   ): NTSTATUS; stdcall;
17542 begin
17543   GetProcedureAddress(_RtlAppendStringToString, ntdll, 'RtlAppendStringToString');
17544   Result := TFNRtlAppendStringToString(_RtlAppendStringToString)(
17545     DestinationString, AppendThisString
17546   );
17547 end;
17548 
17549 // Dynamic version of RtlAppendUnicodeStringToString
17550 function  RtlAppendUnicodeStringToString(
17551     DestinationString : PUNICODE_STRING;
17552     SourceString : PUNICODE_STRING
17553   ): NTSTATUS; stdcall;
17554 begin
17555   GetProcedureAddress(_RtlAppendUnicodeStringToString, ntdll, 'RtlAppendUnicodeStringToString');
17556   Result := TFNRtlAppendUnicodeStringToString(_RtlAppendUnicodeStringToString)(
17557     DestinationString, SourceString
17558   );
17559 end;
17560 
17561 // Dynamic version of RtlAppendUnicodeToString
17562 function  RtlAppendUnicodeToString(
17563     Destination : PUNICODE_STRING;
17564     Source : LPCWSTR
17565   ): NTSTATUS; stdcall;
17566 begin
17567   GetProcedureAddress(_RtlAppendUnicodeToString, ntdll, 'RtlAppendUnicodeToString');
17568   Result := TFNRtlAppendUnicodeToString(_RtlAppendUnicodeToString)(
17569     Destination, Source
17570   );
17571 end;
17572 
17573 // Dynamic version of RtlAreAllAccessesGranted
17574 function  RtlAreAllAccessesGranted(
17575     GrantedAccess : ACCESS_MASK;
17576     WantedAccess : ACCESS_MASK
17577   ): BOOLEAN; stdcall;
17578 begin
17579   GetProcedureAddress(_RtlAreAllAccessesGranted, ntdll, 'RtlAreAllAccessesGranted');
17580   Result := TFNRtlAreAllAccessesGranted(_RtlAreAllAccessesGranted)(
17581     GrantedAccess, WantedAccess
17582   );
17583 end;
17584 
17585 // Dynamic version of RtlAreAnyAccessesGranted
17586 function  RtlAreAnyAccessesGranted(
17587     GrantedAccess : ACCESS_MASK;
17588     WantedAccess : ACCESS_MASK
17589   ): BOOLEAN; stdcall;
17590 begin
17591   GetProcedureAddress(_RtlAreAnyAccessesGranted, ntdll, 'RtlAreAnyAccessesGranted');
17592   Result := TFNRtlAreAnyAccessesGranted(_RtlAreAnyAccessesGranted)(
17593     GrantedAccess, WantedAccess
17594   );
17595 end;
17596 
17597 // Dynamic version of RtlAreBitsClear
17598 function  RtlAreBitsClear(
17599     BitMapHeader : PRTL_BITMAP;
17600     StartingIndex : ULONG;
17601     Length : ULONG
17602   ): BOOLEAN; stdcall;
17603 begin
17604   GetProcedureAddress(_RtlAreBitsClear, ntdll, 'RtlAreBitsClear');
17605   Result := TFNRtlAreBitsClear(_RtlAreBitsClear)(
17606     BitMapHeader, StartingIndex, Length
17607   );
17608 end;
17609 
17610 // Dynamic version of RtlAreBitsSet
17611 function  RtlAreBitsSet(
17612     BitMapHeader : PRTL_BITMAP;
17613     StartingIndex : ULONG;
17614     Length : ULONG
17615   ): BOOLEAN; stdcall;
17616 begin
17617   GetProcedureAddress(_RtlAreBitsSet, ntdll, 'RtlAreBitsSet');
17618   Result := TFNRtlAreBitsSet(_RtlAreBitsSet)(
17619     BitMapHeader, StartingIndex, Length
17620   );
17621 end;
17622 
17623 // Dynamic version of RtlAssert
17624 procedure RtlAssert(
17625     FailedAssertion : PVOID;
17626     FileName : PVOID;
17627     LineNumber : ULONG;
17628     Message : PCHAR
17629   ); stdcall;
17630 begin
17631   GetProcedureAddress(_RtlAssert, ntdll, 'RtlAssert');
17632   TFNRtlAssert(_RtlAssert)(
17633     FailedAssertion, FileName, LineNumber, Message
17634   );
17635 end;
17636 
17637 {$IFNDEF JWA_INCLUDEMODE}
17638 // Dynamic version of RtlCaptureContext
17639 procedure RtlCaptureContext(
17640     ContextRecord : PCONTEXT
17641   ); stdcall;
17642 begin
17643   GetProcedureAddress(_RtlCaptureContext, ntdll, 'RtlCaptureContext');
17644   TFNRtlCaptureContext(_RtlCaptureContext)(
17645     ContextRecord
17646   );
17647 end;
17648 
17649 
17650 // Dynamic version of RtlCharToInteger
17651 function  RtlCharToInteger(
17652     Str : PCSZ;
17653     Base : ULONG;
17654     Value : PULONG
17655   ): NTSTATUS; stdcall;
17656 begin
17657   GetProcedureAddress(_RtlCharToInteger, ntdll, 'RtlCharToInteger');
17658   Result := TFNRtlCharToInteger(_RtlCharToInteger)(
17659     Str, Base, Value
17660   );
17661 end;
17662 {$ENDIF JWA_INCLUDEMODE}
17663 
17664 // Dynamic version of RtlCheckForOrphanedCriticalSections
17665 procedure RtlCheckForOrphanedCriticalSections(
17666     hThread : HANDLE
17667   ); stdcall;
17668 begin
17669   GetProcedureAddress(_RtlCheckForOrphanedCriticalSections, ntdll, 'RtlCheckForOrphanedCriticalSections');
17670   TFNRtlCheckForOrphanedCriticalSections(_RtlCheckForOrphanedCriticalSections)(
17671     hThread
17672   );
17673 end;
17674 
17675 // Dynamic version of RtlCheckRegistryKey
17676 function  RtlCheckRegistryKey(
17677     RelativeTo : ULONG;
17678     Path : PWSTR
17679   ): NTSTATUS; stdcall;
17680 begin
17681   GetProcedureAddress(_RtlCheckRegistryKey, ntdll, 'RtlCheckRegistryKey');
17682   Result := TFNRtlCheckRegistryKey(_RtlCheckRegistryKey)(
17683     RelativeTo, Path
17684   );
17685 end;
17686 
17687 // Dynamic version of RtlClearAllBits
17688 procedure RtlClearAllBits(
17689     BitMapHeader : PRTL_BITMAP
17690   ); stdcall;
17691 begin
17692   GetProcedureAddress(_RtlClearAllBits, ntdll, 'RtlClearAllBits');
17693   TFNRtlClearAllBits(_RtlClearAllBits)(
17694     BitMapHeader
17695   );
17696 end;
17697 
17698 // Dynamic version of RtlClearBits
17699 procedure RtlClearBits(
17700     BitMapHeader : PRTL_BITMAP;
17701     StartingIndex : ULONG;
17702     NumberToClear : ULONG
17703   ); stdcall;
17704 begin
17705   GetProcedureAddress(_RtlClearBits, ntdll, 'RtlClearBits');
17706   TFNRtlClearBits(_RtlClearBits)(
17707     BitMapHeader, StartingIndex, NumberToClear
17708   );
17709 end;
17710 
17711 // Dynamic version of RtlCompactHeap
17712 function  RtlCompactHeap(
17713     hHeap : HANDLE;
17714     dwFlags : ULONG
17715   ): ULONG; stdcall;
17716 begin
17717   GetProcedureAddress(_RtlCompactHeap, ntdll, 'RtlCompactHeap');
17718   Result := TFNRtlCompactHeap(_RtlCompactHeap)(
17719     hHeap, dwFlags
17720   );
17721 end;
17722 
17723 {$IFNDEF JWA_INCLUDEMODE}
17724 // Dynamic version of RtlCompareMemory
17725 function  RtlCompareMemory(
17726     Source1 : PVOID;
17727     Source2 : PVOID;
17728     Length : SIZE_T
17729   ): SIZE_T; stdcall;
17730 begin
17731   GetProcedureAddress(_RtlCompareMemory, ntdll, 'RtlCompareMemory');
17732   Result := TFNRtlCompareMemory(_RtlCompareMemory)(
17733     Source1, Source2, Length
17734   );
17735 end;
17736 {$ENDIF JWA_INCLUDEMODE}
17737 
17738 // Dynamic version of RtlCompareMemoryUlong
17739 function  RtlCompareMemoryUlong(
17740     Source : PVOID;
17741     Length : ULONG;
17742     Value : ULONG
17743   ): ULONG; stdcall;
17744 begin
17745   GetProcedureAddress(_RtlCompareMemoryUlong, ntdll, 'RtlCompareMemoryUlong');
17746   Result := TFNRtlCompareMemoryUlong(_RtlCompareMemoryUlong)(
17747     Source, Length, Value
17748   );
17749 end;
17750 
17751 // Dynamic version of RtlCompareString
17752 function  RtlCompareString(
17753     String1 : PSTRING;
17754     String2 : PSTRING;
17755     CaseInsensitive : BOOLEAN
17756   ): LONG; stdcall;
17757 begin
17758   GetProcedureAddress(_RtlCompareString, ntdll, 'RtlCompareString');
17759   Result := TFNRtlCompareString(_RtlCompareString)(
17760     String1, String2, CaseInsensitive
17761   );
17762 end;
17763 
17764 // Dynamic version of RtlCompareUnicodeString
17765 function  RtlCompareUnicodeString(
17766     String1 : PUNICODE_STRING;
17767     String2 : PUNICODE_STRING;
17768     CaseInsensitive : BOOLEAN
17769   ): LONG; stdcall;
17770 begin
17771   GetProcedureAddress(_RtlCompareUnicodeString, ntdll, 'RtlCompareUnicodeString');
17772   Result := TFNRtlCompareUnicodeString(_RtlCompareUnicodeString)(
17773     String1, String2, CaseInsensitive
17774   );
17775 end;
17776 
17777 // Dynamic version of RtlConvertLongToLargeInteger
17778 function  RtlConvertLongToLargeInteger(
17779     SignedInteger : LONG
17780   ): LARGE_INTEGER; stdcall;
17781 begin
17782   GetProcedureAddress(_RtlConvertLongToLargeInteger, ntdll, 'RtlConvertLongToLargeInteger');
17783   Result := TFNRtlConvertLongToLargeInteger(_RtlConvertLongToLargeInteger)(
17784     SignedInteger
17785   );
17786 end;
17787 
17788 // Dynamic version of RtlConvertSidToUnicodeString
17789 function  RtlConvertSidToUnicodeString(
17790     UnicodeString : PUNICODE_STRING;
17791     Sid : PSID;
17792     AllocateDestinationString : BOOLEAN
17793   ): NTSTATUS; stdcall;
17794 begin
17795   GetProcedureAddress(_RtlConvertSidToUnicodeString, ntdll, 'RtlConvertSidToUnicodeString');
17796   Result := TFNRtlConvertSidToUnicodeString(_RtlConvertSidToUnicodeString)(
17797     UnicodeString, Sid, AllocateDestinationString
17798   );
17799 end;
17800 
17801 // Dynamic version of RtlConvertUlongToLargeInteger
17802 function  RtlConvertUlongToLargeInteger(
17803     UnsignedInteger : ULONG
17804   ): LARGE_INTEGER; stdcall;
17805 begin
17806   GetProcedureAddress(_RtlConvertUlongToLargeInteger, ntdll, 'RtlConvertUlongToLargeInteger');
17807   Result := TFNRtlConvertUlongToLargeInteger(_RtlConvertUlongToLargeInteger)(
17808     UnsignedInteger
17809   );
17810 end;
17811 
17812 // Dynamic version of RtlCopyLuid
17813 procedure RtlCopyLuid(
17814     Destination : PLUID;
17815     Source : PLUID
17816   ); stdcall;
17817 begin
17818   GetProcedureAddress(_RtlCopyLuid, ntdll, 'RtlCopyLuid');
17819   TFNRtlCopyLuid(_RtlCopyLuid)(
17820     Destination, Source
17821   );
17822 end;
17823 
17824 // Dynamic version of RtlCopyRangeList
17825 function  RtlCopyRangeList(
17826     CopyRangeList : PRTL_RANGE_LIST;
17827     RangeList : PRTL_RANGE_LIST
17828   ): NTSTATUS; stdcall;
17829 begin
17830   GetProcedureAddress(_RtlCopyRangeList, ntdll, 'RtlCopyRangeList');
17831   Result := TFNRtlCopyRangeList(_RtlCopyRangeList)(
17832     CopyRangeList, RangeList
17833   );
17834 end;
17835 
17836 // Dynamic version of RtlCopySecurityDescriptor
17837 function  RtlCopySecurityDescriptor(
17838     Source : PSECURITY_DESCRIPTOR;
17839     var Destination : PSECURITY_DESCRIPTOR
17840   ): NTSTATUS; stdcall;
17841 begin
17842   GetProcedureAddress(_RtlCopySecurityDescriptor, ntdll, 'RtlCopySecurityDescriptor');
17843   Result := TFNRtlCopySecurityDescriptor(_RtlCopySecurityDescriptor)(
17844     Source, Destination
17845   );
17846 end;
17847 
17848 // Dynamic version of RtlCopySid
17849 function  RtlCopySid(
17850     DestinationLength : ULONG;
17851     Destination : PSID;
17852     Source : PSID
17853   ): NTSTATUS; stdcall;
17854 begin
17855   GetProcedureAddress(_RtlCopySid, ntdll, 'RtlCopySid');
17856   Result := TFNRtlCopySid(_RtlCopySid)(
17857     DestinationLength, Destination, Source
17858   );
17859 end;
17860 
17861 // Dynamic version of RtlCopyString
17862 procedure RtlCopyString(
17863     DestinationString : PSTRING;
17864     SourceString : PSTRING
17865   ); stdcall;
17866 begin
17867   GetProcedureAddress(_RtlCopyString, ntdll, 'RtlCopyString');
17868   TFNRtlCopyString(_RtlCopyString)(
17869     DestinationString, SourceString
17870   );
17871 end;
17872 
17873 // Dynamic version of RtlCopyUnicodeString
17874 procedure RtlCopyUnicodeString(
17875     DestinationString : PUNICODE_STRING;
17876     SourceString : PUNICODE_STRING
17877   ); stdcall;
17878 begin
17879   GetProcedureAddress(_RtlCopyUnicodeString, ntdll, 'RtlCopyUnicodeString');
17880   TFNRtlCopyUnicodeString(_RtlCopyUnicodeString)(
17881     DestinationString, SourceString
17882   );
17883 end;
17884 
17885 // Dynamic version of RtlCreateAcl
17886 function  RtlCreateAcl(
17887     pAcl : PACL;
17888     nAclLength : DWORD;
17889     dwAclRevision : DWORD
17890   ): NTSTATUS; stdcall;
17891 begin
17892   GetProcedureAddress(_RtlCreateAcl, ntdll, 'RtlCreateAcl');
17893   Result := TFNRtlCreateAcl(_RtlCreateAcl)(
17894     pAcl, nAclLength, dwAclRevision
17895   );
17896 end;
17897 
17898 // Dynamic version of RtlCreateHeap
17899 function  RtlCreateHeap(
17900     dwOptions : ULONG;
17901     Base : PVOID;
17902     dwMaximumSize : SIZE_T;
17903     dwInitialSize : SIZE_T;
17904     UnknownOptional1 : PVOID;
17905     UnknownOptional2 : PVOID
17906   ): HANDLE; stdcall;
17907 begin
17908   GetProcedureAddress(_RtlCreateHeap, ntdll, 'RtlCreateHeap');
17909   Result := TFNRtlCreateHeap(_RtlCreateHeap)(
17910     dwOptions, Base, dwMaximumSize, dwInitialSize, UnknownOptional1, UnknownOptional2
17911   );
17912 end;
17913 
17914 // Dynamic version of RtlCreateProcessParameters
17915 function  RtlCreateProcessParameters(
17916     ProcessParameters : PPRTL_USER_PROCESS_PARAMETERS;
17917     ImageFile : PUNICODE_STRING;
17918     DllPath : PUNICODE_STRING;
17919     CurrentDirectory : PUNICODE_STRING;
17920     CommandLine : PUNICODE_STRING;
17921     CreationFlags : ULONG;
17922     WindowTitle : PUNICODE_STRING;
17923     Desktop : PUNICODE_STRING;
17924     Reserved : PUNICODE_STRING;
17925     Reserved2 : PUNICODE_STRING
17926   ): NTSTATUS; stdcall;
17927 begin
17928   GetProcedureAddress(_RtlCreateProcessParameters, ntdll, 'RtlCreateProcessParameters');
17929   Result := TFNRtlCreateProcessParameters(_RtlCreateProcessParameters)(
17930     ProcessParameters, ImageFile, DllPath, CurrentDirectory, CommandLine, CreationFlags, WindowTitle, Desktop, Reserved, Reserved2
17931   );
17932 end;
17933 
17934 // Dynamic version of RtlCreateQueryDebugBuffer
17935 function  RtlCreateQueryDebugBuffer(
17936     Size : ULONG;
17937     EventPair : BOOLEAN
17938   ): PDEBUG_BUFFER; stdcall;
17939 begin
17940   GetProcedureAddress(_RtlCreateQueryDebugBuffer, ntdll, 'RtlCreateQueryDebugBuffer');
17941   Result := TFNRtlCreateQueryDebugBuffer(_RtlCreateQueryDebugBuffer)(
17942     Size, EventPair
17943   );
17944 end;
17945 
17946 // Dynamic version of RtlCreateRegistryKey
17947 function  RtlCreateRegistryKey(
17948     RelativeTo : ULONG;
17949     Path : PWSTR
17950   ): NTSTATUS; stdcall;
17951 begin
17952   GetProcedureAddress(_RtlCreateRegistryKey, ntdll, 'RtlCreateRegistryKey');
17953   Result := TFNRtlCreateRegistryKey(_RtlCreateRegistryKey)(
17954     RelativeTo, Path
17955   );
17956 end;
17957 
17958 // Dynamic version of RtlCreateSecurityDescriptor
17959 function  RtlCreateSecurityDescriptor(
17960     SecurityDescriptor : PSECURITY_DESCRIPTOR;
17961     Revision : ULONG
17962   ): NTSTATUS; stdcall;
17963 begin
17964   GetProcedureAddress(_RtlCreateSecurityDescriptor, ntdll, 'RtlCreateSecurityDescriptor');
17965   Result := TFNRtlCreateSecurityDescriptor(_RtlCreateSecurityDescriptor)(
17966     SecurityDescriptor, Revision
17967   );
17968 end;
17969 
17970 // Dynamic version of RtlCreateUnicodeString
17971 function  RtlCreateUnicodeString(
17972     DestinationString : PUNICODE_STRING;
17973     SourceString : PWSTR
17974   ): BOOLEAN; stdcall;
17975 begin
17976   GetProcedureAddress(_RtlCreateUnicodeString, ntdll, 'RtlCreateUnicodeString');
17977   Result := TFNRtlCreateUnicodeString(_RtlCreateUnicodeString)(
17978     DestinationString, SourceString
17979   );
17980 end;
17981 
17982 // Dynamic version of RtlCreateUnicodeStringFromAsciiz
17983 function  RtlCreateUnicodeStringFromAsciiz(
17984     DestinationString : PUNICODE_STRING;
17985     SourceString : PCHAR
17986   ): BOOLEAN; stdcall;
17987 begin
17988   GetProcedureAddress(_RtlCreateUnicodeStringFromAsciiz, ntdll, 'RtlCreateUnicodeStringFromAsciiz');
17989   Result := TFNRtlCreateUnicodeStringFromAsciiz(_RtlCreateUnicodeStringFromAsciiz)(
17990     DestinationString, SourceString
17991   );
17992 end;
17993 
17994 // Dynamic version of RtlCreateUserProcess
17995 function  RtlCreateUserProcess(
17996     ImageFileName : PUNICODE_STRING;
17997     Attributes : ULONG;
17998     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS;
17999     ProcessSecurityDescriptor : PSECURITY_DESCRIPTOR;
18000     ThreadSecurityDescriptor : PSECURITY_DESCRIPTOR;
18001     ParentProcess : HANDLE;
18002     InheritHandles : BOOLEAN;
18003     DebugPort : HANDLE;
18004     ExceptionPort : HANDLE;
18005     ProcessInfo : PRTL_PROCESS_INFORMATION
18006   ): NTSTATUS; stdcall;
18007 begin
18008   GetProcedureAddress(_RtlCreateUserProcess, ntdll, 'RtlCreateUserProcess');
18009   Result := TFNRtlCreateUserProcess(_RtlCreateUserProcess)(
18010     ImageFileName, Attributes, ProcessParameters, ProcessSecurityDescriptor, ThreadSecurityDescriptor, ParentProcess, InheritHandles, DebugPort, ExceptionPort, ProcessInfo
18011   );
18012 end;
18013 
18014 // Dynamic version of RtlCreateUserThread
18015 function  RtlCreateUserThread(
18016     hProcess : HANDLE;
18017     SecurityDescriptor : PSECURITY_DESCRIPTOR;
18018     CreateSuspended : BOOLEAN;
18019     StackZeroBits : ULONG;
18020     StackReserve : ULONG;
18021     StackCommit : ULONG;
18022     lpStartAddress : PTHREAD_START_ROUTINE;
18023     lpParameter : PVOID;
18024     phThread : PHANDLE;
18025     ClientId : PCLIENT_ID
18026   ): NTSTATUS; stdcall;
18027 begin
18028   GetProcedureAddress(_RtlCreateUserThread, ntdll, 'RtlCreateUserThread');
18029   Result := TFNRtlCreateUserThread(_RtlCreateUserThread)(
18030     hProcess, SecurityDescriptor, CreateSuspended, StackZeroBits, StackReserve, StackCommit, lpStartAddress, lpParameter, phThread, ClientId
18031   );
18032 end;
18033 
18034 // Dynamic version of RtlCutoverTimeToSystemTime
18035 function  RtlCutoverTimeToSystemTime(
18036     TargetTimeFields : PTIME_FIELDS;
18037     Time : PLARGE_INTEGER;
18038     CurrentTime : PLARGE_INTEGER;
18039     bUnknown : BOOLEAN
18040   ): BOOLEAN; stdcall;
18041 begin
18042   GetProcedureAddress(_RtlCutoverTimeToSystemTime, ntdll, 'RtlCutoverTimeToSystemTime');
18043   Result := TFNRtlCutoverTimeToSystemTime(_RtlCutoverTimeToSystemTime)(
18044     TargetTimeFields, Time, CurrentTime, bUnknown
18045   );
18046 end;
18047 
18048 // Dynamic version of RtlDeNormalizeProcessParams
18049 function  RtlDeNormalizeProcessParams(
18050     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS
18051   ): PRTL_USER_PROCESS_PARAMETERS; stdcall;
18052 begin
18053   GetProcedureAddress(_RtlDeNormalizeProcessParams, ntdll, 'RtlDeNormalizeProcessParams');
18054   Result := TFNRtlDeNormalizeProcessParams(_RtlDeNormalizeProcessParams)(
18055     ProcessParameters
18056   );
18057 end;
18058 
18059 // Dynamic version of RtlDeleteAce
18060 function  RtlDeleteAce(
18061     pAcl : PACL;
18062     dwAceIndex : DWORD
18063   ): NTSTATUS; stdcall;
18064 begin
18065   GetProcedureAddress(_RtlDeleteAce, ntdll, 'RtlDeleteAce');
18066   Result := TFNRtlDeleteAce(_RtlDeleteAce)(
18067     pAcl, dwAceIndex
18068   );
18069 end;
18070 
18071 // Dynamic version of RtlDeleteCriticalSection
18072 procedure RtlDeleteCriticalSection(
18073     lpCriticalSection : PRTL_CRITICAL_SECTION
18074   ); stdcall;
18075 begin
18076   GetProcedureAddress(_RtlDeleteCriticalSection, ntdll, 'RtlDeleteCriticalSection');
18077   TFNRtlDeleteCriticalSection(_RtlDeleteCriticalSection)(
18078     lpCriticalSection
18079   );
18080 end;
18081 
18082 // Dynamic version of RtlDeleteOwnersRanges
18083 function  RtlDeleteOwnersRanges(
18084     RangeList : PRTL_RANGE_LIST;
18085     Owner : PVOID
18086   ): NTSTATUS; stdcall;
18087 begin
18088   GetProcedureAddress(_RtlDeleteOwnersRanges, ntdll, 'RtlDeleteOwnersRanges');
18089   Result := TFNRtlDeleteOwnersRanges(_RtlDeleteOwnersRanges)(
18090     RangeList, Owner
18091   );
18092 end;
18093 
18094 // Dynamic version of RtlDeleteRange
18095 function  RtlDeleteRange(
18096     RangeList : PRTL_RANGE_LIST;
18097     Start : ULONGLONG;
18098     End_ : ULONGLONG;
18099     Owner : PVOID
18100   ): NTSTATUS; stdcall;
18101 begin
18102   GetProcedureAddress(_RtlDeleteRange, ntdll, 'RtlDeleteRange');
18103   Result := TFNRtlDeleteRange(_RtlDeleteRange)(
18104     RangeList, Start, End_, Owner
18105   );
18106 end;
18107 
18108 // Dynamic version of RtlDeleteRegistryValue
18109 function  RtlDeleteRegistryValue(
18110     RelativeTo : ULONG;
18111     Path : LPCWSTR;
18112     ValueName : LPCWSTR
18113   ): NTSTATUS; stdcall;
18114 begin
18115   GetProcedureAddress(_RtlDeleteRegistryValue, ntdll, 'RtlDeleteRegistryValue');
18116   Result := TFNRtlDeleteRegistryValue(_RtlDeleteRegistryValue)(
18117     RelativeTo, Path, ValueName
18118   );
18119 end;
18120 
18121 // Dynamic version of RtlDestroyHeap
18122 function  RtlDestroyHeap(
18123     HeapHandle : HANDLE
18124   ): HANDLE; stdcall;
18125 begin
18126   GetProcedureAddress(_RtlDestroyHeap, ntdll, 'RtlDestroyHeap');
18127   Result := TFNRtlDestroyHeap(_RtlDestroyHeap)(
18128     HeapHandle
18129   );
18130 end;
18131 
18132 // Dynamic version of RtlDestroyProcessParameters
18133 function  RtlDestroyProcessParameters(
18134     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS
18135   ): NTSTATUS; stdcall;
18136 begin
18137   GetProcedureAddress(_RtlDestroyProcessParameters, ntdll, 'RtlDestroyProcessParameters');
18138   Result := TFNRtlDestroyProcessParameters(_RtlDestroyProcessParameters)(
18139     ProcessParameters
18140   );
18141 end;
18142 
18143 // Dynamic version of RtlDestroyQueryDebugBuffer
18144 function  RtlDestroyQueryDebugBuffer(
18145     DebugBuffer : PDEBUG_BUFFER
18146   ): NTSTATUS; stdcall;
18147 begin
18148   GetProcedureAddress(_RtlDestroyQueryDebugBuffer, ntdll, 'RtlDestroyQueryDebugBuffer');
18149   Result := TFNRtlDestroyQueryDebugBuffer(_RtlDestroyQueryDebugBuffer)(
18150     DebugBuffer
18151   );
18152 end;
18153 
18154 // Dynamic version of RtlDetermineDosPathNameType_U
18155 function  RtlDetermineDosPathNameType_U(
18156     wcsPathNameType : PWSTR
18157   ): ULONG; stdcall;
18158 begin
18159   GetProcedureAddress(_RtlDetermineDosPathNameType_U, ntdll, 'RtlDetermineDosPathNameType_U');
18160   Result := TFNRtlDetermineDosPathNameType_U(_RtlDetermineDosPathNameType_U)(
18161     wcsPathNameType
18162   );
18163 end;
18164 
18165 // Dynamic version of RtlDnsHostNameToComputerName
18166 function  RtlDnsHostNameToComputerName(
18167     ComputerName : PUNICODE_STRING;
18168     DnsName : PUNICODE_STRING;
18169     AllocateComputerNameString : BOOLEAN
18170   ): NTSTATUS; stdcall;
18171 begin
18172   GetProcedureAddress(_RtlDnsHostNameToComputerName, ntdll, 'RtlDnsHostNameToComputerName');
18173   Result := TFNRtlDnsHostNameToComputerName(_RtlDnsHostNameToComputerName)(
18174     ComputerName, DnsName, AllocateComputerNameString
18175   );
18176 end;
18177 
18178 // Dynamic version of RtlDoesFileExists_U
18179 function  RtlDoesFileExists_U(
18180     FileName : PWSTR
18181   ): BOOLEAN; stdcall;
18182 begin
18183   GetProcedureAddress(_RtlDoesFileExists_U, ntdll, 'RtlDoesFileExists_U');
18184   Result := TFNRtlDoesFileExists_U(_RtlDoesFileExists_U)(
18185     FileName
18186   );
18187 end;
18188 
18189 // Dynamic version of RtlDosPathNameToNtPathName_U
18190 function  RtlDosPathNameToNtPathName_U(
18191     DosName : PWSTR;
18192     var NtName : UNICODE_STRING;
18193     DosFilePath : PPWSTR;
18194     NtFilePath : PUNICODE_STRING
18195   ): BOOLEAN; stdcall;
18196 begin
18197   GetProcedureAddress(_RtlDosPathNameToNtPathName_U, ntdll, 'RtlDosPathNameToNtPathName_U');
18198   Result := TFNRtlDosPathNameToNtPathName_U(_RtlDosPathNameToNtPathName_U)(
18199     DosName, NtName, DosFilePath, NtFilePath
18200   );
18201 end;
18202 
18203 // Dynamic version of RtlDosSearchPath_U
18204 function  RtlDosSearchPath_U(
18205     SearchPath : PWSTR;
18206     Name : PWSTR;
18207     Ext : PWSTR;
18208     cbBuf : ULONG;
18209     Buffer : PWSTR;
18210     var Shortname : PWSTR
18211   ): ULONG; stdcall;
18212 begin
18213   GetProcedureAddress(_RtlDosSearchPath_U, ntdll, 'RtlDosSearchPath_U');
18214   Result := TFNRtlDosSearchPath_U(_RtlDosSearchPath_U)(
18215     SearchPath, Name, Ext, cbBuf, Buffer, Shortname
18216   );
18217 end;
18218 
18219 // Dynamic version of RtlDowncaseUnicodeChar
18220 function  RtlDowncaseUnicodeChar(
18221     Source : WCHAR
18222   ): WCHAR; stdcall;
18223 begin
18224   GetProcedureAddress(_RtlDowncaseUnicodeChar, ntdll, 'RtlDowncaseUnicodeChar');
18225   Result := TFNRtlDowncaseUnicodeChar(_RtlDowncaseUnicodeChar)(
18226     Source
18227   );
18228 end;
18229 
18230 // Dynamic version of RtlDowncaseUnicodeString
18231 function  RtlDowncaseUnicodeString(
18232     DestinationString : PUNICODE_STRING;
18233     SourceString : PUNICODE_STRING;
18234     AllocateDestinationString : BOOLEAN
18235   ): NTSTATUS; stdcall;
18236 begin
18237   GetProcedureAddress(_RtlDowncaseUnicodeString, ntdll, 'RtlDowncaseUnicodeString');
18238   Result := TFNRtlDowncaseUnicodeString(_RtlDowncaseUnicodeString)(
18239     DestinationString, SourceString, AllocateDestinationString
18240   );
18241 end;
18242 
18243 // Dynamic version of RtlDuplicateUnicodeString
18244 function  RtlDuplicateUnicodeString(
18245     AddTerminatingZero : ULONG;
18246     Source : PUNICODE_STRING;
18247     Destination : PUNICODE_STRING
18248   ): NTSTATUS; stdcall;
18249 begin
18250   GetProcedureAddress(_RtlDuplicateUnicodeString, ntdll, 'RtlDuplicateUnicodeString');
18251   Result := TFNRtlDuplicateUnicodeString(_RtlDuplicateUnicodeString)(
18252     AddTerminatingZero, Source, Destination
18253   );
18254 end;
18255 
18256 // Dynamic version of RtlEnableEarlyCriticalSectionEventCreation
18257 procedure RtlEnableEarlyCriticalSectionEventCreation(); stdcall;
18258 begin
18259   GetProcedureAddress(_RtlEnableEarlyCriticalSectionEventCreation, ntdll, 'RtlEnableEarlyCriticalSectionEventCreation');
18260   TFNRtlEnableEarlyCriticalSectionEventCreation(_RtlEnableEarlyCriticalSectionEventCreation)();
18261 end;
18262 
18263 // Dynamic version of RtlEnlargedIntegerMultiply
18264 function  RtlEnlargedIntegerMultiply(
18265     Multiplicand : LONG;
18266     Multiplier : LONG
18267   ): LARGE_INTEGER; stdcall;
18268 begin
18269   GetProcedureAddress(_RtlEnlargedIntegerMultiply, ntdll, 'RtlEnlargedIntegerMultiply');
18270   Result := TFNRtlEnlargedIntegerMultiply(_RtlEnlargedIntegerMultiply)(
18271     Multiplicand, Multiplier
18272   );
18273 end;
18274 
18275 // Dynamic version of RtlEnlargedUnsignedDivide
18276 function  RtlEnlargedUnsignedDivide(
18277     Dividend : ULARGE_INTEGER;
18278     Divisor : ULONG;
18279     Remainder : PULONG
18280   ): ULONG; stdcall;
18281 begin
18282   GetProcedureAddress(_RtlEnlargedUnsignedDivide, ntdll, 'RtlEnlargedUnsignedDivide');
18283   Result := TFNRtlEnlargedUnsignedDivide(_RtlEnlargedUnsignedDivide)(
18284     Dividend, Divisor, Remainder
18285   );
18286 end;
18287 
18288 // Dynamic version of RtlEnlargedUnsignedMultiply
18289 function  RtlEnlargedUnsignedMultiply(
18290     Multiplicand : ULONG;
18291     Multiplier : ULONG
18292   ): LARGE_INTEGER; stdcall;
18293 begin
18294   GetProcedureAddress(_RtlEnlargedUnsignedMultiply, ntdll, 'RtlEnlargedUnsignedMultiply');
18295   Result := TFNRtlEnlargedUnsignedMultiply(_RtlEnlargedUnsignedMultiply)(
18296     Multiplicand, Multiplier
18297   );
18298 end;
18299 
18300 // Dynamic version of RtlEnterCriticalSection
18301 procedure RtlEnterCriticalSection(
18302     lpCriticalSection : PRTL_CRITICAL_SECTION
18303   ); stdcall;
18304 begin
18305   GetProcedureAddress(_RtlEnterCriticalSection, ntdll, 'RtlEnterCriticalSection');
18306   TFNRtlEnterCriticalSection(_RtlEnterCriticalSection)(
18307     lpCriticalSection
18308   );
18309 end;
18310 
18311 // Dynamic version of RtlEqualComputerName
18312 function  RtlEqualComputerName(
18313     String1 : PUNICODE_STRING;
18314     String2 : PUNICODE_STRING
18315   ): BOOLEAN; stdcall;
18316 begin
18317   GetProcedureAddress(_RtlEqualComputerName, ntdll, 'RtlEqualComputerName');
18318   Result := TFNRtlEqualComputerName(_RtlEqualComputerName)(
18319     String1, String2
18320   );
18321 end;
18322 
18323 // Dynamic version of RtlEqualDomainName
18324 function  RtlEqualDomainName(
18325     String1 : PUNICODE_STRING;
18326     String2 : PUNICODE_STRING
18327   ): BOOLEAN; stdcall;
18328 begin
18329   GetProcedureAddress(_RtlEqualDomainName, ntdll, 'RtlEqualDomainName');
18330   Result := TFNRtlEqualDomainName(_RtlEqualDomainName)(
18331     String1, String2
18332   );
18333 end;
18334 
18335 // Dynamic version of RtlEqualLuid
18336 function  RtlEqualLuid(
18337     Luid1 : PLUID;
18338     Luid2 : PLUID
18339   ): BOOLEAN; stdcall;
18340 begin
18341   GetProcedureAddress(_RtlEqualLuid, ntdll, 'RtlEqualLuid');
18342   Result := TFNRtlEqualLuid(_RtlEqualLuid)(
18343     Luid1, Luid2
18344   );
18345 end;
18346 
18347 // Dynamic version of RtlEqualPrefixSid
18348 function  RtlEqualPrefixSid(
18349     pSid1 : PSID;
18350     pSid2 : PSID
18351   ): BOOLEAN; stdcall;
18352 begin
18353   GetProcedureAddress(_RtlEqualPrefixSid, ntdll, 'RtlEqualPrefixSid');
18354   Result := TFNRtlEqualPrefixSid(_RtlEqualPrefixSid)(
18355     pSid1, pSid2
18356   );
18357 end;
18358 
18359 // Dynamic version of RtlEqualSid
18360 function  RtlEqualSid(
18361     pSid1 : PSID;
18362     pSid2 : PSID
18363   ): BOOLEAN; stdcall;
18364 begin
18365   GetProcedureAddress(_RtlEqualSid, ntdll, 'RtlEqualSid');
18366   Result := TFNRtlEqualSid(_RtlEqualSid)(
18367     pSid1, pSid2
18368   );
18369 end;
18370 
18371 // Dynamic version of RtlEqualString
18372 function  RtlEqualString(
18373     String1 : PSTRING;
18374     String2 : PSTRING;
18375     CaseInsensitive : BOOLEAN
18376   ): BOOLEAN; stdcall;
18377 begin
18378   GetProcedureAddress(_RtlEqualString, ntdll, 'RtlEqualString');
18379   Result := TFNRtlEqualString(_RtlEqualString)(
18380     String1, String2, CaseInsensitive
18381   );
18382 end;
18383 
18384 // Dynamic version of RtlEqualUnicodeString
18385 function  RtlEqualUnicodeString(
18386     String1 : PUNICODE_STRING;
18387     String2 : PUNICODE_STRING;
18388     CaseInsensitive : BOOLEAN
18389   ): BOOLEAN; stdcall;
18390 begin
18391   GetProcedureAddress(_RtlEqualUnicodeString, ntdll, 'RtlEqualUnicodeString');
18392   Result := TFNRtlEqualUnicodeString(_RtlEqualUnicodeString)(
18393     String1, String2, CaseInsensitive
18394   );
18395 end;
18396 
18397 // Dynamic version of RtlEraseUnicodeString
18398 procedure RtlEraseUnicodeString(
18399     Str : PUNICODE_STRING
18400   ); stdcall;
18401 begin
18402   GetProcedureAddress(_RtlEraseUnicodeString, ntdll, 'RtlEraseUnicodeString');
18403   TFNRtlEraseUnicodeString(_RtlEraseUnicodeString)(
18404     Str
18405   );
18406 end;
18407 
18408 // Dynamic version of RtlExpandEnvironmentStrings_U
18409 function  RtlExpandEnvironmentStrings_U(
18410     Environment : PVOID;
18411     Source : PUNICODE_STRING;
18412     Destination : PUNICODE_STRING;
18413     ReturnedLength : PULONG
18414   ): NTSTATUS; stdcall;
18415 begin
18416   GetProcedureAddress(_RtlExpandEnvironmentStrings_U, ntdll, 'RtlExpandEnvironmentStrings_U');
18417   Result := TFNRtlExpandEnvironmentStrings_U(_RtlExpandEnvironmentStrings_U)(
18418     Environment, Source, Destination, ReturnedLength
18419   );
18420 end;
18421 
18422 // Dynamic version of RtlExtendedIntegerMultiply
18423 function  RtlExtendedIntegerMultiply(
18424     Multiplicand : LARGE_INTEGER;
18425     Multiplier : LONG
18426   ): LARGE_INTEGER; stdcall;
18427 begin
18428   GetProcedureAddress(_RtlExtendedIntegerMultiply, ntdll, 'RtlExtendedIntegerMultiply');
18429   Result := TFNRtlExtendedIntegerMultiply(_RtlExtendedIntegerMultiply)(
18430     Multiplicand, Multiplier
18431   );
18432 end;
18433 
18434 // Dynamic version of RtlExtendedLargeIntegerDivide
18435 function  RtlExtendedLargeIntegerDivide(
18436     Dividend : LARGE_INTEGER;
18437     Divisor : ULONG;
18438     Remainder : PULONG
18439   ): LARGE_INTEGER; stdcall;
18440 begin
18441   GetProcedureAddress(_RtlExtendedLargeIntegerDivide, ntdll, 'RtlExtendedLargeIntegerDivide');
18442   Result := TFNRtlExtendedLargeIntegerDivide(_RtlExtendedLargeIntegerDivide)(
18443     Dividend, Divisor, Remainder
18444   );
18445 end;
18446 
18447 // Dynamic version of RtlExtendedMagicDivide
18448 function  RtlExtendedMagicDivide(
18449     Dividend : LARGE_INTEGER;
18450     MagicDivisor : LARGE_INTEGER;
18451     ShiftCount : CCHAR
18452   ): LARGE_INTEGER; stdcall;
18453 begin
18454   GetProcedureAddress(_RtlExtendedMagicDivide, ntdll, 'RtlExtendedMagicDivide');
18455   Result := TFNRtlExtendedMagicDivide(_RtlExtendedMagicDivide)(
18456     Dividend, MagicDivisor, ShiftCount
18457   );
18458 end;
18459 
18460 // Dynamic version of RtlFillMemory
18461 procedure RtlFillMemory(
18462     Destination : PVOID;
18463     Length : SIZE_T;
18464     Fill : UCHAR
18465   ); stdcall;
18466 begin
18467   GetProcedureAddress(_RtlFillMemory, ntdll, 'RtlFillMemory');
18468   TFNRtlFillMemory(_RtlFillMemory)(
18469     Destination, Length, Fill
18470   );
18471 end;
18472 
18473 // Dynamic version of RtlFillMemoryUlong
18474 procedure RtlFillMemoryUlong(
18475     Destination : PVOID;
18476     Length : ULONG;
18477     Fill : ULONG
18478   ); stdcall;
18479 begin
18480   GetProcedureAddress(_RtlFillMemoryUlong, ntdll, 'RtlFillMemoryUlong');
18481   TFNRtlFillMemoryUlong(_RtlFillMemoryUlong)(
18482     Destination, Length, Fill
18483   );
18484 end;
18485 
18486 // Dynamic version of RtlFindCharInUnicodeString
18487 function  RtlFindCharInUnicodeString(
18488     dwFlags : ULONG;
18489     UnicodeString : PUNICODE_STRING;
18490     CharactersToFind : PUNICODE_STRING;
18491     Positions : PUSHORT
18492   ): NTSTATUS; stdcall;
18493 begin
18494   GetProcedureAddress(_RtlFindCharInUnicodeString, ntdll, 'RtlFindCharInUnicodeString');
18495   Result := TFNRtlFindCharInUnicodeString(_RtlFindCharInUnicodeString)(
18496     dwFlags, UnicodeString, CharactersToFind, Positions
18497   );
18498 end;
18499 
18500 // Dynamic version of RtlFindClearBits
18501 function  RtlFindClearBits(
18502     BitMapHeader : PRTL_BITMAP;
18503     NumberToFind : ULONG;
18504     HintIndex : ULONG
18505   ): ULONG; stdcall;
18506 begin
18507   GetProcedureAddress(_RtlFindClearBits, ntdll, 'RtlFindClearBits');
18508   Result := TFNRtlFindClearBits(_RtlFindClearBits)(
18509     BitMapHeader, NumberToFind, HintIndex
18510   );
18511 end;
18512 
18513 // Dynamic version of RtlFindClearBitsAndSet
18514 function  RtlFindClearBitsAndSet(
18515     BitMapHeader : PRTL_BITMAP;
18516     NumberToFind : ULONG;
18517     HintIndex : ULONG
18518   ): ULONG; stdcall;
18519 begin
18520   GetProcedureAddress(_RtlFindClearBitsAndSet, ntdll, 'RtlFindClearBitsAndSet');
18521   Result := TFNRtlFindClearBitsAndSet(_RtlFindClearBitsAndSet)(
18522     BitMapHeader, NumberToFind, HintIndex
18523   );
18524 end;
18525 
18526 // Dynamic version of RtlFindLastBackwardRunClear
18527 function  RtlFindLastBackwardRunClear(
18528     BitMapHeader : PRTL_BITMAP;
18529     FromIndex : ULONG;
18530     StartingRunIndex : PULONG
18531   ): ULONG; stdcall;
18532 begin
18533   GetProcedureAddress(_RtlFindLastBackwardRunClear, ntdll, 'RtlFindLastBackwardRunClear');
18534   Result := TFNRtlFindLastBackwardRunClear(_RtlFindLastBackwardRunClear)(
18535     BitMapHeader, FromIndex, StartingRunIndex
18536   );
18537 end;
18538 
18539 // Dynamic version of RtlFindLeastSignificantBit
18540 function  RtlFindLeastSignificantBit(
18541     Set_ : ULONGLONG
18542   ): CCHAR; stdcall;
18543 begin
18544   GetProcedureAddress(_RtlFindLeastSignificantBit, ntdll, 'RtlFindLeastSignificantBit');
18545   Result := TFNRtlFindLeastSignificantBit(_RtlFindLeastSignificantBit)(
18546     Set_
18547   );
18548 end;
18549 
18550 // Dynamic version of RtlFindLongestRunClear
18551 function  RtlFindLongestRunClear(
18552     BitMapHeader : PRTL_BITMAP;
18553     StartingIndex : PULONG
18554   ): ULONG; stdcall;
18555 begin
18556   GetProcedureAddress(_RtlFindLongestRunClear, ntdll, 'RtlFindLongestRunClear');
18557   Result := TFNRtlFindLongestRunClear(_RtlFindLongestRunClear)(
18558     BitMapHeader, StartingIndex
18559   );
18560 end;
18561 
18562 // Dynamic version of RtlFindMostSignificantBit
18563 function  RtlFindMostSignificantBit(
18564     Set_ : ULONGLONG
18565   ): CCHAR; stdcall;
18566 begin
18567   GetProcedureAddress(_RtlFindMostSignificantBit, ntdll, 'RtlFindMostSignificantBit');
18568   Result := TFNRtlFindMostSignificantBit(_RtlFindMostSignificantBit)(
18569     Set_
18570   );
18571 end;
18572 
18573 // Dynamic version of RtlFindNextForwardRunClear
18574 function  RtlFindNextForwardRunClear(
18575     BitMapHeader : PRTL_BITMAP;
18576     FromIndex : ULONG;
18577     StartingRunIndex : PULONG
18578   ): ULONG; stdcall;
18579 begin
18580   GetProcedureAddress(_RtlFindNextForwardRunClear, ntdll, 'RtlFindNextForwardRunClear');
18581   Result := TFNRtlFindNextForwardRunClear(_RtlFindNextForwardRunClear)(
18582     BitMapHeader, FromIndex, StartingRunIndex
18583   );
18584 end;
18585 
18586 // Dynamic version of RtlFindRange
18587 function  RtlFindRange(
18588     RangeList : PRTL_RANGE_LIST;
18589     Minimum : ULONGLONG;
18590     Maximum : ULONGLONG;
18591     Length : ULONG;
18592     Alignment : ULONG;
18593     Flags : ULONG;
18594     AttributeAvailableMask : UCHAR;
18595     Context : PVOID;
18596     Callback : PRTL_CONFLICT_RANGE_CALLBACK;
18597     Start : PULONGLONG
18598   ): NTSTATUS; stdcall;
18599 begin
18600   GetProcedureAddress(_RtlFindRange, ntdll, 'RtlFindRange');
18601   Result := TFNRtlFindRange(_RtlFindRange)(
18602     RangeList, Minimum, Maximum, Length, Alignment, Flags, AttributeAvailableMask, Context, Callback, Start
18603   );
18604 end;
18605 
18606 // Dynamic version of RtlFindSetBits
18607 function  RtlFindSetBits(
18608     BitMapHeader : PRTL_BITMAP;
18609     NumberToFind : ULONG;
18610     HintIndex : ULONG
18611   ): ULONG; stdcall;
18612 begin
18613   GetProcedureAddress(_RtlFindSetBits, ntdll, 'RtlFindSetBits');
18614   Result := TFNRtlFindSetBits(_RtlFindSetBits)(
18615     BitMapHeader, NumberToFind, HintIndex
18616   );
18617 end;
18618 
18619 // Dynamic version of RtlFindSetBitsAndClear
18620 function  RtlFindSetBitsAndClear(
18621     BitMapHeader : PRTL_BITMAP;
18622     NumberToFind : ULONG;
18623     HintIndex : ULONG
18624   ): ULONG; stdcall;
18625 begin
18626   GetProcedureAddress(_RtlFindSetBitsAndClear, ntdll, 'RtlFindSetBitsAndClear');
18627   Result := TFNRtlFindSetBitsAndClear(_RtlFindSetBitsAndClear)(
18628     BitMapHeader, NumberToFind, HintIndex
18629   );
18630 end;
18631 
18632 // Dynamic version of RtlFirstFreeAce
18633 function  RtlFirstFreeAce(
18634     pAcl : PACL;
18635     var pAce : PVOID
18636   ): BOOLEAN; stdcall;
18637 begin
18638   GetProcedureAddress(_RtlFirstFreeAce, ntdll, 'RtlFirstFreeAce');
18639   Result := TFNRtlFirstFreeAce(_RtlFirstFreeAce)(
18640     pAcl, pAce
18641   );
18642 end;
18643 
18644 // Dynamic version of RtlFormatCurrentUserKeyPath
18645 function  RtlFormatCurrentUserKeyPath(
18646     CurrentUserKeyPath : PUNICODE_STRING
18647   ): NTSTATUS; stdcall;
18648 begin
18649   GetProcedureAddress(_RtlFormatCurrentUserKeyPath, ntdll, 'RtlFormatCurrentUserKeyPath');
18650   Result := TFNRtlFormatCurrentUserKeyPath(_RtlFormatCurrentUserKeyPath)(
18651     CurrentUserKeyPath
18652   );
18653 end;
18654 
18655 // Dynamic version of RtlFreeAnsiString
18656 procedure RtlFreeAnsiString(
18657     AnsiString : PANSI_STRING
18658   ); stdcall;
18659 begin
18660   GetProcedureAddress(_RtlFreeAnsiString, ntdll, 'RtlFreeAnsiString');
18661   TFNRtlFreeAnsiString(_RtlFreeAnsiString)(
18662     AnsiString
18663   );
18664 end;
18665 
18666 // Dynamic version of RtlFreeHeap
18667 function  RtlFreeHeap(
18668     hHeap : HANDLE;
18669     dwFlags : ULONG;
18670     MemoryPointer : PVOID
18671   ): BOOLEAN; stdcall;
18672 begin
18673   GetProcedureAddress(_RtlFreeHeap, ntdll, 'RtlFreeHeap');
18674   Result := TFNRtlFreeHeap(_RtlFreeHeap)(
18675     hHeap, dwFlags, MemoryPointer
18676   );
18677 end;
18678 
18679 // Dynamic version of RtlFreeOemString
18680 procedure RtlFreeOemString(
18681     OemString : POEM_STRING
18682   ); stdcall;
18683 begin
18684   GetProcedureAddress(_RtlFreeOemString, ntdll, 'RtlFreeOemString');
18685   TFNRtlFreeOemString(_RtlFreeOemString)(
18686     OemString
18687   );
18688 end;
18689 
18690 // Dynamic version of RtlFreeRangeList
18691 procedure RtlFreeRangeList(
18692     RangeList : PRTL_RANGE_LIST
18693   ); stdcall;
18694 begin
18695   GetProcedureAddress(_RtlFreeRangeList, ntdll, 'RtlFreeRangeList');
18696   TFNRtlFreeRangeList(_RtlFreeRangeList)(
18697     RangeList
18698   );
18699 end;
18700 
18701 // Dynamic version of RtlFreeSid
18702 function  RtlFreeSid(
18703     pSid : PSID
18704   ): PVOID; stdcall;
18705 begin
18706   GetProcedureAddress(_RtlFreeSid, ntdll, 'RtlFreeSid');
18707   Result := TFNRtlFreeSid(_RtlFreeSid)(
18708     pSid
18709   );
18710 end;
18711 
18712 // Dynamic version of RtlFreeUnicodeString
18713 procedure RtlFreeUnicodeString(
18714     UnicodeString : PUNICODE_STRING
18715   ); stdcall;
18716 begin
18717   GetProcedureAddress(_RtlFreeUnicodeString, ntdll, 'RtlFreeUnicodeString');
18718   TFNRtlFreeUnicodeString(_RtlFreeUnicodeString)(
18719     UnicodeString
18720   );
18721 end;
18722 
18723 // Dynamic version of RtlGUIDFromString
18724 function  RtlGUIDFromString(
18725     GuidString : PUNICODE_STRING;
18726     Guid : LPGUID
18727   ): NTSTATUS; stdcall;
18728 begin
18729   GetProcedureAddress(_RtlGUIDFromString, ntdll, 'RtlGUIDFromString');
18730   Result := TFNRtlGUIDFromString(_RtlGUIDFromString)(
18731     GuidString, Guid
18732   );
18733 end;
18734 
18735 // Dynamic version of RtlGetAce
18736 function  RtlGetAce(
18737     pAcl : PACL;
18738     dwAceIndex : DWORD;
18739     var pAce : PVOID
18740   ): NTSTATUS; stdcall;
18741 begin
18742   GetProcedureAddress(_RtlGetAce, ntdll, 'RtlGetAce');
18743   Result := TFNRtlGetAce(_RtlGetAce)(
18744     pAcl, dwAceIndex, pAce
18745   );
18746 end;
18747 
18748 // Dynamic version of RtlGetCallersAddress
18749 procedure RtlGetCallersAddress(
18750     CallersAddress : PPVOID;
18751     CallersCaller : PPVOID
18752   ); stdcall;
18753 begin
18754   GetProcedureAddress(_RtlGetCallersAddress, ntdll, 'RtlGetCallersAddress');
18755   TFNRtlGetCallersAddress(_RtlGetCallersAddress)(
18756     CallersAddress, CallersCaller
18757   );
18758 end;
18759 
18760 // Dynamic version of RtlGetControlSecurityDescriptor
18761 function  RtlGetControlSecurityDescriptor(
18762     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
18763     var Control : SECURITY_DESCRIPTOR_CONTROL;
18764     var dwRevision : DWORD
18765   ): NTSTATUS; stdcall;
18766 begin
18767   GetProcedureAddress(_RtlGetControlSecurityDescriptor, ntdll, 'RtlGetControlSecurityDescriptor');
18768   Result := TFNRtlGetControlSecurityDescriptor(_RtlGetControlSecurityDescriptor)(
18769     pSecurityDescriptor, Control, dwRevision
18770   );
18771 end;
18772 
18773 // Dynamic version of RtlGetCurrentDirectory_U
18774 function  RtlGetCurrentDirectory_U(
18775     MaximumLength : ULONG;
18776     Buffer : PWSTR
18777   ): ULONG; stdcall;
18778 begin
18779   GetProcedureAddress(_RtlGetCurrentDirectory_U, ntdll, 'RtlGetCurrentDirectory_U');
18780   Result := TFNRtlGetCurrentDirectory_U(_RtlGetCurrentDirectory_U)(
18781     MaximumLength, Buffer
18782   );
18783 end;
18784 
18785 // Dynamic version of RtlGetCurrentPeb
18786 function  RtlGetCurrentPeb(): PPEB; stdcall;
18787 begin
18788   GetProcedureAddress(_RtlGetCurrentPeb, ntdll, 'RtlGetCurrentPeb');
18789   Result := TFNRtlGetCurrentPeb(_RtlGetCurrentPeb)();
18790 end;
18791 
18792 // Dynamic version of RtlGetDaclSecurityDescriptor
18793 function  RtlGetDaclSecurityDescriptor(
18794     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
18795     var bDaclPresent : BOOLEAN;
18796     var Dacl : PACL;
18797     var bDaclDefaulted : BOOLEAN
18798   ): NTSTATUS; stdcall;
18799 begin
18800   GetProcedureAddress(_RtlGetDaclSecurityDescriptor, ntdll, 'RtlGetDaclSecurityDescriptor');
18801   Result := TFNRtlGetDaclSecurityDescriptor(_RtlGetDaclSecurityDescriptor)(
18802     pSecurityDescriptor, bDaclPresent, Dacl, bDaclDefaulted
18803   );
18804 end;
18805 
18806 // Dynamic version of RtlGetFirstRange
18807 function  RtlGetFirstRange(
18808     RangeList : PRTL_RANGE_LIST;
18809     Iterator : PRTL_RANGE_LIST_ITERATOR;
18810     var Range : PRTL_RANGE
18811   ): NTSTATUS; stdcall;
18812 begin
18813   GetProcedureAddress(_RtlGetFirstRange, ntdll, 'RtlGetFirstRange');
18814   Result := TFNRtlGetFirstRange(_RtlGetFirstRange)(
18815     RangeList, Iterator, Range
18816   );
18817 end;
18818 
18819 // Dynamic version of RtlGetFullPathName_U
18820 function  RtlGetFullPathName_U(
18821     DosName : PWSTR;
18822     Size : ULONG;
18823     Buf : PWSTR;
18824     var Shortname : PWSTR
18825   ): ULONG; stdcall;
18826 begin
18827   GetProcedureAddress(_RtlGetFullPathName_U, ntdll, 'RtlGetFullPathName_U');
18828   Result := TFNRtlGetFullPathName_U(_RtlGetFullPathName_U)(
18829     DosName, Size, Buf, Shortname
18830   );
18831 end;
18832 
18833 // Dynamic version of RtlGetGroupSecurityDescriptor
18834 function  RtlGetGroupSecurityDescriptor(
18835     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
18836     var pGroup : PSID;
18837     var bGroupDefaulted : BOOLEAN
18838   ): NTSTATUS; stdcall;
18839 begin
18840   GetProcedureAddress(_RtlGetGroupSecurityDescriptor, ntdll, 'RtlGetGroupSecurityDescriptor');
18841   Result := TFNRtlGetGroupSecurityDescriptor(_RtlGetGroupSecurityDescriptor)(
18842     pSecurityDescriptor, pGroup, bGroupDefaulted
18843   );
18844 end;
18845 
18846 // Dynamic version of RtlGetLastNtStatus
18847 function  RtlGetLastNtStatus(): NTSTATUS; stdcall;
18848 begin
18849   GetProcedureAddress(_RtlGetLastNtStatus, ntdll, 'RtlGetLastNtStatus');
18850   Result := TFNRtlGetLastNtStatus(_RtlGetLastNtStatus)();
18851 end;
18852 
18853 // Dynamic version of RtlGetLongestNtPathLength
18854 function  RtlGetLongestNtPathLength(): ULONG; stdcall;
18855 begin
18856   GetProcedureAddress(_RtlGetLongestNtPathLength, ntdll, 'RtlGetLongestNtPathLength');
18857   Result := TFNRtlGetLongestNtPathLength(_RtlGetLongestNtPathLength)();
18858 end;
18859 
18860 // Dynamic version of RtlGetNextRange
18861 function  RtlGetNextRange(
18862     Iterator : PRTL_RANGE_LIST_ITERATOR;
18863     var Range : PRTL_RANGE;
18864     MoveForwards : BOOLEAN
18865   ): NTSTATUS; stdcall;
18866 begin
18867   GetProcedureAddress(_RtlGetNextRange, ntdll, 'RtlGetNextRange');
18868   Result := TFNRtlGetNextRange(_RtlGetNextRange)(
18869     Iterator, Range, MoveForwards
18870   );
18871 end;
18872 
18873 // Dynamic version of RtlGetNtGlobalFlags
18874 function  RtlGetNtGlobalFlags(): ULONG; stdcall;
18875 begin
18876   GetProcedureAddress(_RtlGetNtGlobalFlags, ntdll, 'RtlGetNtGlobalFlags');
18877   Result := TFNRtlGetNtGlobalFlags(_RtlGetNtGlobalFlags)();
18878 end;
18879 
18880 // Dynamic version of RtlGetNtProductType
18881 function  RtlGetNtProductType(
18882     var ProductType : ULONG
18883   ): BOOLEAN; stdcall;
18884 begin
18885   GetProcedureAddress(_RtlGetNtProductType, ntdll, 'RtlGetNtProductType');
18886   Result := TFNRtlGetNtProductType(_RtlGetNtProductType)(
18887     ProductType
18888   );
18889 end;
18890 
18891 // Dynamic version of RtlGetNtVersionNumbers
18892 procedure RtlGetNtVersionNumbers(
18893     var dwMajorVersion : ULONG;
18894     var dwMinorVersion : ULONG;
18895     UnknownCanBeNull : PDWORD
18896   ); stdcall;
18897 begin
18898   GetProcedureAddress(_RtlGetNtVersionNumbers, ntdll, 'RtlGetNtVersionNumbers');
18899   TFNRtlGetNtVersionNumbers(_RtlGetNtVersionNumbers)(
18900     dwMajorVersion, dwMinorVersion, UnknownCanBeNull
18901   );
18902 end;
18903 
18904 // Dynamic version of RtlGetOwnerSecurityDescriptor
18905 function  RtlGetOwnerSecurityDescriptor(
18906     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
18907     var pOwner : PSID;
18908     var OwnerDefaulted : BOOLEAN
18909   ): NTSTATUS; stdcall;
18910 begin
18911   GetProcedureAddress(_RtlGetOwnerSecurityDescriptor, ntdll, 'RtlGetOwnerSecurityDescriptor');
18912   Result := TFNRtlGetOwnerSecurityDescriptor(_RtlGetOwnerSecurityDescriptor)(
18913     pSecurityDescriptor, pOwner, OwnerDefaulted
18914   );
18915 end;
18916 
18917 // Dynamic version of RtlGetProcessHeaps
18918 function  RtlGetProcessHeaps(
18919     ArraySize : ULONG;
18920     HeapArray : PHANDLE
18921   ): ULONG; stdcall;
18922 begin
18923   GetProcedureAddress(_RtlGetProcessHeaps, ntdll, 'RtlGetProcessHeaps');
18924   Result := TFNRtlGetProcessHeaps(_RtlGetProcessHeaps)(
18925     ArraySize, HeapArray
18926   );
18927 end;
18928 
18929 // Dynamic version of RtlGetSaclSecurityDescriptor
18930 function  RtlGetSaclSecurityDescriptor(
18931     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
18932     var bSaclPresent : BOOLEAN;
18933     var Sacl : PACL;
18934     var bSaclDefaulted : BOOLEAN
18935   ): NTSTATUS; stdcall;
18936 begin
18937   GetProcedureAddress(_RtlGetSaclSecurityDescriptor, ntdll, 'RtlGetSaclSecurityDescriptor');
18938   Result := TFNRtlGetSaclSecurityDescriptor(_RtlGetSaclSecurityDescriptor)(
18939     pSecurityDescriptor, bSaclPresent, Sacl, bSaclDefaulted
18940   );
18941 end;
18942 
18943 // Dynamic version of RtlGetVersion
18944 function  RtlGetVersion(
18945     lpVersionInformation : PRTL_OSVERSIONINFOW
18946   ): NTSTATUS; stdcall;
18947 begin
18948   GetProcedureAddress(_RtlGetVersion, ntdll, 'RtlGetVersion');
18949   Result := TFNRtlGetVersion(_RtlGetVersion)(
18950     lpVersionInformation
18951   );
18952 end;
18953 
18954 // Dynamic version of RtlIdentifierAuthoritySid
18955 function  RtlIdentifierAuthoritySid(
18956     Sid : PSID
18957   ): PSID_IDENTIFIER_AUTHORITY; stdcall;
18958 begin
18959   GetProcedureAddress(_RtlIdentifierAuthoritySid, ntdll, 'RtlIdentifierAuthoritySid');
18960   Result := TFNRtlIdentifierAuthoritySid(_RtlIdentifierAuthoritySid)(
18961     Sid
18962   );
18963 end;
18964 
18965 // Dynamic version of RtlImageDirectoryEntryToData
18966 function  RtlImageDirectoryEntryToData(
18967     ImageBase : HMODULE;
18968     MappedAsImage : BOOLEAN;
18969     DirectoryEntry : USHORT;
18970     Size : PULONG
18971   ): PVOID; stdcall;
18972 begin
18973   GetProcedureAddress(_RtlImageDirectoryEntryToData, ntdll, 'RtlImageDirectoryEntryToData');
18974   Result := TFNRtlImageDirectoryEntryToData(_RtlImageDirectoryEntryToData)(
18975     ImageBase, MappedAsImage, DirectoryEntry, Size
18976   );
18977 end;
18978 
18979 // Dynamic version of RtlImageNtHeader
18980 function  RtlImageNtHeader(
18981     ImageBase : HMODULE
18982   ): PIMAGE_NT_HEADERS; stdcall;
18983 begin
18984   GetProcedureAddress(_RtlImageNtHeader, ntdll, 'RtlImageNtHeader');
18985   Result := TFNRtlImageNtHeader(_RtlImageNtHeader)(
18986     ImageBase
18987   );
18988 end;
18989 
18990 // Dynamic version of RtlImageNtHeaderEx
18991 function  RtlImageNtHeaderEx(
18992     dwFlags : DWORD;
18993     ImageBase : HMODULE
18994   ): PIMAGE_NT_HEADERS; stdcall;
18995 begin
18996   GetProcedureAddress(_RtlImageNtHeaderEx, ntdll, 'RtlImageNtHeaderEx');
18997   Result := TFNRtlImageNtHeaderEx(_RtlImageNtHeaderEx)(
18998     dwFlags, ImageBase
18999   );
19000 end;
19001 
19002 // Dynamic version of RtlImageRvaToSection
19003 function  RtlImageRvaToSection(
19004     NtHeaders : PIMAGE_NT_HEADERS;
19005     ImageBase : HMODULE;
19006     Rva : ULONG
19007   ): PIMAGE_SECTION_HEADER; stdcall;
19008 begin
19009   GetProcedureAddress(_RtlImageRvaToSection, ntdll, 'RtlImageRvaToSection');
19010   Result := TFNRtlImageRvaToSection(_RtlImageRvaToSection)(
19011     NtHeaders, ImageBase, Rva
19012   );
19013 end;
19014 
19015 // Dynamic version of RtlImageRvaToVa
19016 function  RtlImageRvaToVa(
19017     NtHeaders : PIMAGE_NT_HEADERS;
19018     ImageBase : HMODULE;
19019     Rva : ULONG;
19020     var LastRvaSection : PIMAGE_SECTION_HEADER
19021   ): PVOID; stdcall;
19022 begin
19023   GetProcedureAddress(_RtlImageRvaToVa, ntdll, 'RtlImageRvaToVa');
19024   Result := TFNRtlImageRvaToVa(_RtlImageRvaToVa)(
19025     NtHeaders, ImageBase, Rva, LastRvaSection
19026   );
19027 end;
19028 
19029 // Dynamic version of RtlImpersonateSelf
19030 function  RtlImpersonateSelf(
19031     ImpersonationLevel : SECURITY_IMPERSONATION_LEVEL
19032   ): NTSTATUS; stdcall;
19033 begin
19034   GetProcedureAddress(_RtlImpersonateSelf, ntdll, 'RtlImpersonateSelf');
19035   Result := TFNRtlImpersonateSelf(_RtlImpersonateSelf)(
19036     ImpersonationLevel
19037   );
19038 end;
19039 
19040 // Dynamic version of RtlInitAnsiString
19041 procedure RtlInitAnsiString(
19042     DestinationString : PANSI_STRING;
19043     SourceString : PCSZ
19044   ); stdcall;
19045 begin
19046   GetProcedureAddress(_RtlInitAnsiString, ntdll, 'RtlInitAnsiString');
19047   TFNRtlInitAnsiString(_RtlInitAnsiString)(
19048     DestinationString, SourceString
19049   );
19050 end;
19051 
19052 // Dynamic version of RtlInitAnsiStringEx
19053 function  RtlInitAnsiStringEx(
19054     DestinationString : PANSI_STRING;
19055     SourceString : PCSZ
19056   ): NTSTATUS; stdcall;
19057 begin
19058   GetProcedureAddress(_RtlInitAnsiStringEx, ntdll, 'RtlInitAnsiStringEx');
19059   Result := TFNRtlInitAnsiStringEx(_RtlInitAnsiStringEx)(
19060     DestinationString, SourceString
19061   );
19062 end;
19063 
19064 // Dynamic version of RtlInitString
19065 procedure RtlInitString(
19066     DestinationString : PSTRING;
19067     SourceString : PCSZ
19068   ); stdcall;
19069 begin
19070   GetProcedureAddress(_RtlInitString, ntdll, 'RtlInitString');
19071   TFNRtlInitString(_RtlInitString)(
19072     DestinationString, SourceString
19073   );
19074 end;
19075 
19076 // Dynamic version of RtlInitUnicodeString
19077 procedure RtlInitUnicodeString(
19078     DestinationString : PUNICODE_STRING;
19079     SourceString : LPCWSTR
19080   ); stdcall;
19081 begin
19082   GetProcedureAddress(_RtlInitUnicodeString, ntdll, 'RtlInitUnicodeString');
19083   TFNRtlInitUnicodeString(_RtlInitUnicodeString)(
19084     DestinationString, SourceString
19085   );
19086 end;
19087 
19088 // Dynamic version of RtlInitUnicodeStringEx
19089 function  RtlInitUnicodeStringEx(
19090     DestinationString : PUNICODE_STRING;
19091     SourceString : LPCWSTR
19092   ): NTSTATUS; stdcall;
19093 begin
19094   GetProcedureAddress(_RtlInitUnicodeStringEx, ntdll, 'RtlInitUnicodeStringEx');
19095   Result := TFNRtlInitUnicodeStringEx(_RtlInitUnicodeStringEx)(
19096     DestinationString, SourceString
19097   );
19098 end;
19099 
19100 // Dynamic version of RtlInitializeBitMap
19101 procedure RtlInitializeBitMap(
19102     BitMapHeader : PRTL_BITMAP;
19103     BitMapBuffer : PULONG;
19104     SizeOfBitMap : ULONG
19105   ); stdcall;
19106 begin
19107   GetProcedureAddress(_RtlInitializeBitMap, ntdll, 'RtlInitializeBitMap');
19108   TFNRtlInitializeBitMap(_RtlInitializeBitMap)(
19109     BitMapHeader, BitMapBuffer, SizeOfBitMap
19110   );
19111 end;
19112 
19113 // Dynamic version of RtlInitializeCriticalSection
19114 function  RtlInitializeCriticalSection(
19115     lpCriticalSection : PRTL_CRITICAL_SECTION
19116   ): NTSTATUS; stdcall;
19117 begin
19118   GetProcedureAddress(_RtlInitializeCriticalSection, ntdll, 'RtlInitializeCriticalSection');
19119   Result := TFNRtlInitializeCriticalSection(_RtlInitializeCriticalSection)(
19120     lpCriticalSection
19121   );
19122 end;
19123 
19124 // Dynamic version of RtlInitializeCriticalSectionAndSpinCount
19125 function  RtlInitializeCriticalSectionAndSpinCount(
19126     lpCriticalSection : PRTL_CRITICAL_SECTION;
19127     dwSpinCount : ULONG
19128   ): NTSTATUS; stdcall;
19129 begin
19130   GetProcedureAddress(_RtlInitializeCriticalSectionAndSpinCount, ntdll, 'RtlInitializeCriticalSectionAndSpinCount');
19131   Result := TFNRtlInitializeCriticalSectionAndSpinCount(_RtlInitializeCriticalSectionAndSpinCount)(
19132     lpCriticalSection, dwSpinCount
19133   );
19134 end;
19135 
19136 // Dynamic version of RtlInitializeRangeList
19137 procedure RtlInitializeRangeList(
19138     RangeList : PRTL_RANGE_LIST
19139   ); stdcall;
19140 begin
19141   GetProcedureAddress(_RtlInitializeRangeList, ntdll, 'RtlInitializeRangeList');
19142   TFNRtlInitializeRangeList(_RtlInitializeRangeList)(
19143     RangeList
19144   );
19145 end;
19146 
19147 {$IFNDEF JWA_INCLUDEMODE}
19148 // Dynamic version of RtlInitializeSListHead
19149 procedure RtlInitializeSListHead(
19150     ListHead : PSLIST_HEADER
19151   ); stdcall;
19152 begin
19153   GetProcedureAddress(_RtlInitializeSListHead, ntdll, 'RtlInitializeSListHead');
19154   TFNRtlInitializeSListHead(_RtlInitializeSListHead)(
19155     ListHead
19156   );
19157 end;
19158 {$ENDIF JWA_INCLUDEMODE}
19159 
19160 // Dynamic version of RtlInitializeSid
19161 function  RtlInitializeSid(
19162     pSid : PSID;
19163     pIdentifierAuthority : PSID_IDENTIFIER_AUTHORITY;
19164     nSubAuthorityCount : UCHAR
19165   ): NTSTATUS; stdcall;
19166 begin
19167   GetProcedureAddress(_RtlInitializeSid, ntdll, 'RtlInitializeSid');
19168   Result := TFNRtlInitializeSid(_RtlInitializeSid)(
19169     pSid, pIdentifierAuthority, nSubAuthorityCount
19170   );
19171 end;
19172 
19173 // Dynamic version of RtlInt64ToUnicodeString
19174 function  RtlInt64ToUnicodeString(
19175     Value : ULONGLONG;
19176     Base : ULONG;
19177     Str : PUNICODE_STRING
19178   ): NTSTATUS; stdcall;
19179 begin
19180   GetProcedureAddress(_RtlInt64ToUnicodeString, ntdll, 'RtlInt64ToUnicodeString');
19181   Result := TFNRtlInt64ToUnicodeString(_RtlInt64ToUnicodeString)(
19182     Value, Base, Str
19183   );
19184 end;
19185 
19186 // Dynamic version of RtlIntegerToChar
19187 function  RtlIntegerToChar(
19188     Value : ULONG;
19189     Base : ULONG;
19190     Length : ULONG;
19191     Str : PCHAR
19192   ): NTSTATUS; stdcall;
19193 begin
19194   GetProcedureAddress(_RtlIntegerToChar, ntdll, 'RtlIntegerToChar');
19195   Result := TFNRtlIntegerToChar(_RtlIntegerToChar)(
19196     Value, Base, Length, Str
19197   );
19198 end;
19199 
19200 // Dynamic version of RtlIntegerToUnicodeString
19201 function  RtlIntegerToUnicodeString(
19202     Value : ULONG;
19203     Base : ULONG;
19204     Str : PUNICODE_STRING
19205   ): NTSTATUS; stdcall;
19206 begin
19207   GetProcedureAddress(_RtlIntegerToUnicodeString, ntdll, 'RtlIntegerToUnicodeString');
19208   Result := TFNRtlIntegerToUnicodeString(_RtlIntegerToUnicodeString)(
19209     Value, Base, Str
19210   );
19211 end;
19212 
19213 {$IFNDEf JWA_INCLUDEMODE}
19214 // Dynamic version of RtlInterlockedFlushSList
19215 function  RtlInterlockedFlushSList(
19216     ListHead : PSLIST_HEADER
19217   ): PSLIST_ENTRY; stdcall;
19218 begin
19219   GetProcedureAddress(_RtlInterlockedFlushSList, ntdll, 'RtlInterlockedFlushSList');
19220   Result := TFNRtlInterlockedFlushSList(_RtlInterlockedFlushSList)(
19221     ListHead
19222   );
19223 end;
19224 
19225 
19226 // Dynamic version of RtlInterlockedPopEntrySList
19227 function  RtlInterlockedPopEntrySList(
19228     ListHead : PSLIST_HEADER
19229   ): PSLIST_ENTRY; stdcall;
19230 begin
19231   GetProcedureAddress(_RtlInterlockedPopEntrySList, ntdll, 'RtlInterlockedPopEntrySList');
19232   Result := TFNRtlInterlockedPopEntrySList(_RtlInterlockedPopEntrySList)(
19233     ListHead
19234   );
19235 end;
19236 {$ENDIF JWA_INCLUDEMODE}
19237 
19238 // Dynamic version of RtlInterlockedPushEntrySList
19239 function  RtlInterlockedPushEntrySList(
19240     ListHead : PSLIST_HEADER;
19241     ListEntry : PSLIST_ENTRY
19242   ): PSLIST_ENTRY; stdcall;
19243 begin
19244   GetProcedureAddress(_RtlInterlockedPushEntrySList, ntdll, 'RtlInterlockedPushEntrySList');
19245   Result := TFNRtlInterlockedPushEntrySList(_RtlInterlockedPushEntrySList)(
19246     ListHead, ListEntry
19247   );
19248 end;
19249 
19250 
19251 // Dynamic version of RtlInvertRangeList
19252 function  RtlInvertRangeList(
19253     InvertedRangeList : PRTL_RANGE_LIST;
19254     RangeList : PRTL_RANGE_LIST
19255   ): NTSTATUS; stdcall;
19256 begin
19257   GetProcedureAddress(_RtlInvertRangeList, ntdll, 'RtlInvertRangeList');
19258   Result := TFNRtlInvertRangeList(_RtlInvertRangeList)(
19259     InvertedRangeList, RangeList
19260   );
19261 end;
19262 
19263 // Dynamic version of RtlIpv4AddressToStringA
19264 function  RtlIpv4AddressToStringA(
19265     IP : PULONG;
19266     Buffer : LPSTR
19267   ): LPSTR; stdcall;
19268 begin
19269   GetProcedureAddress(_RtlIpv4AddressToStringA, ntdll, 'RtlIpv4AddressToStringA');
19270   Result := TFNRtlIpv4AddressToStringA(_RtlIpv4AddressToStringA)(
19271     IP, Buffer
19272   );
19273 end;
19274 
19275 // Dynamic version of RtlIpv4AddressToStringW
19276 function  RtlIpv4AddressToStringW(
19277     IP : PULONG;
19278     Buffer : LPWSTR
19279   ): LPWSTR; stdcall;
19280 begin
19281   GetProcedureAddress(_RtlIpv4AddressToStringW, ntdll, 'RtlIpv4AddressToStringW');
19282   Result := TFNRtlIpv4AddressToStringW(_RtlIpv4AddressToStringW)(
19283     IP, Buffer
19284   );
19285 end;
19286 
19287 // Dynamic version of RtlIsDosDeviceName_U
19288 function  RtlIsDosDeviceName_U(
19289     TestString : LPCWSTR
19290   ): ULONG; stdcall;
19291 begin
19292   GetProcedureAddress(_RtlIsDosDeviceName_U, ntdll, 'RtlIsDosDeviceName_U');
19293   Result := TFNRtlIsDosDeviceName_U(_RtlIsDosDeviceName_U)(
19294     TestString
19295   );
19296 end;
19297 
19298 {$IFNDEF JWA_INCLUDEMODE}
19299 // Dynamic version of RtlIsNameLegalDOS8Dot3
19300 function  RtlIsNameLegalDOS8Dot3(
19301     Name : PUNICODE_STRING;
19302     OemName : POEM_STRING;
19303     NameContainsSpaces : PBOOLEAN
19304   ): BOOLEAN; stdcall;
19305 begin
19306   GetProcedureAddress(_RtlIsNameLegalDOS8Dot3, ntdll, 'RtlIsNameLegalDOS8Dot3');
19307   Result := TFNRtlIsNameLegalDOS8Dot3(_RtlIsNameLegalDOS8Dot3)(
19308     Name, OemName, NameContainsSpaces
19309   );
19310 end;
19311 {$ENDIF JWA_INCLUDEMODE}
19312 
19313 // Dynamic version of RtlIsRangeAvailable
19314 function  RtlIsRangeAvailable(
19315     RangeList : PRTL_RANGE_LIST;
19316     Start : ULONGLONG;
19317     End_ : ULONGLONG;
19318     Flags : ULONG;
19319     AttributeAvailableMask : UCHAR;
19320     Context : PVOID;
19321     Callback : PRTL_CONFLICT_RANGE_CALLBACK;
19322     Available : PBOOLEAN
19323   ): NTSTATUS; stdcall;
19324 begin
19325   GetProcedureAddress(_RtlIsRangeAvailable, ntdll, 'RtlIsRangeAvailable');
19326   Result := TFNRtlIsRangeAvailable(_RtlIsRangeAvailable)(
19327     RangeList, Start, End_, Flags, AttributeAvailableMask, Context, Callback, Available
19328   );
19329 end;
19330 
19331 // Dynamic version of RtlIsTextUnicode
19332 function  RtlIsTextUnicode(
19333     lpBuffer : PVOID;
19334     cb : Integer;
19335     lpi : LPINT
19336   ): BOOLEAN; stdcall;
19337 begin
19338   GetProcedureAddress(_RtlIsTextUnicode, ntdll, 'RtlIsTextUnicode');
19339   Result := TFNRtlIsTextUnicode(_RtlIsTextUnicode)(
19340     lpBuffer, cb, lpi
19341   );
19342 end;
19343 
19344 // Dynamic version of RtlLargeIntegerAdd
19345 function  RtlLargeIntegerAdd(
19346     Addend1 : LARGE_INTEGER;
19347     Addend2 : LARGE_INTEGER
19348   ): LARGE_INTEGER; stdcall;
19349 begin
19350   GetProcedureAddress(_RtlLargeIntegerAdd, ntdll, 'RtlLargeIntegerAdd');
19351   Result := TFNRtlLargeIntegerAdd(_RtlLargeIntegerAdd)(
19352     Addend1, Addend2
19353   );
19354 end;
19355 
19356 // Dynamic version of RtlLargeIntegerArithmeticShift
19357 function  RtlLargeIntegerArithmeticShift(
19358     LargeInteger : LARGE_INTEGER;
19359     ShiftCount : CCHAR
19360   ): LARGE_INTEGER; stdcall;
19361 begin
19362   GetProcedureAddress(_RtlLargeIntegerArithmeticShift, ntdll, 'RtlLargeIntegerArithmeticShift');
19363   Result := TFNRtlLargeIntegerArithmeticShift(_RtlLargeIntegerArithmeticShift)(
19364     LargeInteger, ShiftCount
19365   );
19366 end;
19367 
19368 // Dynamic version of RtlLargeIntegerDivide
19369 function  RtlLargeIntegerDivide(
19370     Dividend : LARGE_INTEGER;
19371     Divisor : LARGE_INTEGER;
19372     Remainder : PLARGE_INTEGER
19373   ): LARGE_INTEGER; stdcall;
19374 begin
19375   GetProcedureAddress(_RtlLargeIntegerDivide, ntdll, 'RtlLargeIntegerDivide');
19376   Result := TFNRtlLargeIntegerDivide(_RtlLargeIntegerDivide)(
19377     Dividend, Divisor, Remainder
19378   );
19379 end;
19380 
19381 // Dynamic version of RtlLargeIntegerNegate
19382 function  RtlLargeIntegerNegate(
19383     NegateThis : LARGE_INTEGER
19384   ): LARGE_INTEGER; stdcall;
19385 begin
19386   GetProcedureAddress(_RtlLargeIntegerNegate, ntdll, 'RtlLargeIntegerNegate');
19387   Result := TFNRtlLargeIntegerNegate(_RtlLargeIntegerNegate)(
19388     NegateThis
19389   );
19390 end;
19391 
19392 // Dynamic version of RtlLargeIntegerShiftLeft
19393 function  RtlLargeIntegerShiftLeft(
19394     LargeInteger : LARGE_INTEGER;
19395     ShiftCount : CCHAR
19396   ): LARGE_INTEGER; stdcall;
19397 begin
19398   GetProcedureAddress(_RtlLargeIntegerShiftLeft, ntdll, 'RtlLargeIntegerShiftLeft');
19399   Result := TFNRtlLargeIntegerShiftLeft(_RtlLargeIntegerShiftLeft)(
19400     LargeInteger, ShiftCount
19401   );
19402 end;
19403 
19404 // Dynamic version of RtlLargeIntegerShiftRight
19405 function  RtlLargeIntegerShiftRight(
19406     LargeInteger : LARGE_INTEGER;
19407     ShiftCount : CCHAR
19408   ): LARGE_INTEGER; stdcall;
19409 begin
19410   GetProcedureAddress(_RtlLargeIntegerShiftRight, ntdll, 'RtlLargeIntegerShiftRight');
19411   Result := TFNRtlLargeIntegerShiftRight(_RtlLargeIntegerShiftRight)(
19412     LargeInteger, ShiftCount
19413   );
19414 end;
19415 
19416 // Dynamic version of RtlLargeIntegerSubtract
19417 function  RtlLargeIntegerSubtract(
19418     Number : LARGE_INTEGER;
19419     Subtrahend : LARGE_INTEGER
19420   ): LARGE_INTEGER; stdcall;
19421 begin
19422   GetProcedureAddress(_RtlLargeIntegerSubtract, ntdll, 'RtlLargeIntegerSubtract');
19423   Result := TFNRtlLargeIntegerSubtract(_RtlLargeIntegerSubtract)(
19424     Number, Subtrahend
19425   );
19426 end;
19427 
19428 // Dynamic version of RtlLargeIntegerToChar
19429 function  RtlLargeIntegerToChar(
19430     Value : PLARGE_INTEGER;
19431     Base : ULONG;
19432     BufferLength : ULONG;
19433     Buffer : PCHAR
19434   ): NTSTATUS; stdcall;
19435 begin
19436   GetProcedureAddress(_RtlLargeIntegerToChar, ntdll, 'RtlLargeIntegerToChar');
19437   Result := TFNRtlLargeIntegerToChar(_RtlLargeIntegerToChar)(
19438     Value, Base, BufferLength, Buffer
19439   );
19440 end;
19441 
19442 // Dynamic version of RtlLeaveCriticalSection
19443 procedure RtlLeaveCriticalSection(
19444     lpCriticalSection : PRTL_CRITICAL_SECTION
19445   ); stdcall;
19446 begin
19447   GetProcedureAddress(_RtlLeaveCriticalSection, ntdll, 'RtlLeaveCriticalSection');
19448   TFNRtlLeaveCriticalSection(_RtlLeaveCriticalSection)(
19449     lpCriticalSection
19450   );
19451 end;
19452 
19453 // Dynamic version of RtlLengthRequiredSid
19454 function  RtlLengthRequiredSid(
19455     nSubAuthorityCount : ULONG
19456   ): ULONG; stdcall;
19457 begin
19458   GetProcedureAddress(_RtlLengthRequiredSid, ntdll, 'RtlLengthRequiredSid');
19459   Result := TFNRtlLengthRequiredSid(_RtlLengthRequiredSid)(
19460     nSubAuthorityCount
19461   );
19462 end;
19463 
19464 // Dynamic version of RtlLengthSecurityDescriptor
19465 function  RtlLengthSecurityDescriptor(
19466     SecurityDescriptor : PSECURITY_DESCRIPTOR
19467   ): ULONG; stdcall;
19468 begin
19469   GetProcedureAddress(_RtlLengthSecurityDescriptor, ntdll, 'RtlLengthSecurityDescriptor');
19470   Result := TFNRtlLengthSecurityDescriptor(_RtlLengthSecurityDescriptor)(
19471     SecurityDescriptor
19472   );
19473 end;
19474 
19475 // Dynamic version of RtlLengthSid
19476 function  RtlLengthSid(
19477     pSid : PSID
19478   ): ULONG; stdcall;
19479 begin
19480   GetProcedureAddress(_RtlLengthSid, ntdll, 'RtlLengthSid');
19481   Result := TFNRtlLengthSid(_RtlLengthSid)(
19482     pSid
19483   );
19484 end;
19485 
19486 {$IFNDEF JWA_INCLUDEMODE}
19487 // Dynamic version of RtlLocalTimeToSystemTime
19488 function  RtlLocalTimeToSystemTime(
19489     LocalTime : PLARGE_INTEGER;
19490     SystemTime : PLARGE_INTEGER
19491   ): NTSTATUS; stdcall;
19492 begin
19493   GetProcedureAddress(_RtlLocalTimeToSystemTime, ntdll, 'RtlLocalTimeToSystemTime');
19494   Result := TFNRtlLocalTimeToSystemTime(_RtlLocalTimeToSystemTime)(
19495     LocalTime, SystemTime
19496   );
19497 end;
19498 {$ENDIF JWA_INCLUDEMODE}
19499 
19500 // Dynamic version of RtlLockHeap
19501 function  RtlLockHeap(
19502     hHeap : PVOID
19503   ): BOOLEAN; stdcall;
19504 begin
19505   GetProcedureAddress(_RtlLockHeap, ntdll, 'RtlLockHeap');
19506   Result := TFNRtlLockHeap(_RtlLockHeap)(
19507     hHeap
19508   );
19509 end;
19510 
19511 // Dynamic version of RtlMakeSelfRelativeSD
19512 function  RtlMakeSelfRelativeSD(
19513     pAbsoluteSD : PSECURITY_DESCRIPTOR;
19514     pSelfRelativeSD : PSECURITY_DESCRIPTOR;
19515     lpdwBufferLength : LPDWORD
19516   ): NTSTATUS; stdcall;
19517 begin
19518   GetProcedureAddress(_RtlMakeSelfRelativeSD, ntdll, 'RtlMakeSelfRelativeSD');
19519   Result := TFNRtlMakeSelfRelativeSD(_RtlMakeSelfRelativeSD)(
19520     pAbsoluteSD, pSelfRelativeSD, lpdwBufferLength
19521   );
19522 end;
19523 
19524 // Dynamic version of RtlMapGenericMask
19525 procedure RtlMapGenericMask(
19526     AccessMask : PACCESS_MASK;
19527     GenericMapping : PGENERIC_MAPPING
19528   ); stdcall;
19529 begin
19530   GetProcedureAddress(_RtlMapGenericMask, ntdll, 'RtlMapGenericMask');
19531   TFNRtlMapGenericMask(_RtlMapGenericMask)(
19532     AccessMask, GenericMapping
19533   );
19534 end;
19535 
19536 // Dynamic version of RtlMapSecurityErrorToNtStatus
19537 function  RtlMapSecurityErrorToNtStatus(
19538     SecurityError : DWORD
19539   ): NTSTATUS; stdcall;
19540 begin
19541   GetProcedureAddress(_RtlMapSecurityErrorToNtStatus, ntdll, 'RtlMapSecurityErrorToNtStatus');
19542   Result := TFNRtlMapSecurityErrorToNtStatus(_RtlMapSecurityErrorToNtStatus)(
19543     SecurityError
19544   );
19545 end;
19546 
19547 // Dynamic version of RtlMergeRangeLists
19548 function  RtlMergeRangeLists(
19549     MergedRangeList : PRTL_RANGE_LIST;
19550     RangeList1 : PRTL_RANGE_LIST;
19551     RangeList2 : PRTL_RANGE_LIST;
19552     Flags : ULONG
19553   ): NTSTATUS; stdcall;
19554 begin
19555   GetProcedureAddress(_RtlMergeRangeLists, ntdll, 'RtlMergeRangeLists');
19556   Result := TFNRtlMergeRangeLists(_RtlMergeRangeLists)(
19557     MergedRangeList, RangeList1, RangeList2, Flags
19558   );
19559 end;
19560 
19561 // Dynamic version of RtlMoveMemory
19562 procedure RtlMoveMemory(
19563     Destination : PVOID;
19564     Source : PVOID;
19565     Length : SIZE_T
19566   ); stdcall;
19567 begin
19568   GetProcedureAddress(_RtlMoveMemory, ntdll, 'RtlMoveMemory');
19569   TFNRtlMoveMemory(_RtlMoveMemory)(
19570     Destination, Source, Length
19571   );
19572 end;
19573 
19574 // Dynamic version of RtlNormalizeProcessParams
19575 function  RtlNormalizeProcessParams(
19576     ProcessParameters : PRTL_USER_PROCESS_PARAMETERS
19577   ): PRTL_USER_PROCESS_PARAMETERS; stdcall;
19578 begin
19579   GetProcedureAddress(_RtlNormalizeProcessParams, ntdll, 'RtlNormalizeProcessParams');
19580   Result := TFNRtlNormalizeProcessParams(_RtlNormalizeProcessParams)(
19581     ProcessParameters
19582   );
19583 end;
19584 
19585 
19586 // Dynamic version of RtlNtStatusToDosError
19587 function  RtlNtStatusToDosError(
19588     Status : NTSTATUS
19589   ): ULONG; stdcall;
19590 begin
19591   GetProcedureAddress(_RtlNtStatusToDosError, ntdll, 'RtlNtStatusToDosError');
19592   Result := TFNRtlNtStatusToDosError(_RtlNtStatusToDosError)(
19593     Status
19594   );
19595 end;
19596 
19597 
19598 // Dynamic version of RtlNtStatusToDosErrorNoTeb
19599 function  RtlNtStatusToDosErrorNoTeb(
19600     Status : NTSTATUS
19601   ): ULONG; stdcall;
19602 begin
19603   GetProcedureAddress(_RtlNtStatusToDosErrorNoTeb, ntdll, 'RtlNtStatusToDosErrorNoTeb');
19604   Result := TFNRtlNtStatusToDosErrorNoTeb(_RtlNtStatusToDosErrorNoTeb)(
19605     Status
19606   );
19607 end;
19608 
19609 // Dynamic version of RtlNumberOfClearBits
19610 function  RtlNumberOfClearBits(
19611     BitMapHeader : PRTL_BITMAP
19612   ): ULONG; stdcall;
19613 begin
19614   GetProcedureAddress(_RtlNumberOfClearBits, ntdll, 'RtlNumberOfClearBits');
19615   Result := TFNRtlNumberOfClearBits(_RtlNumberOfClearBits)(
19616     BitMapHeader
19617   );
19618 end;
19619 
19620 // Dynamic version of RtlNumberOfSetBits
19621 function  RtlNumberOfSetBits(
19622     BitMapHeader : PRTL_BITMAP
19623   ): ULONG; stdcall;
19624 begin
19625   GetProcedureAddress(_RtlNumberOfSetBits, ntdll, 'RtlNumberOfSetBits');
19626   Result := TFNRtlNumberOfSetBits(_RtlNumberOfSetBits)(
19627     BitMapHeader
19628   );
19629 end;
19630 
19631 // Dynamic version of RtlOemStringToUnicodeSize
19632 function  RtlOemStringToUnicodeSize(
19633     AnsiString : POEM_STRING
19634   ): ULONG; stdcall;
19635 begin
19636   GetProcedureAddress(_RtlOemStringToUnicodeSize, ntdll, 'RtlOemStringToUnicodeSize');
19637   Result := TFNRtlOemStringToUnicodeSize(_RtlOemStringToUnicodeSize)(
19638     AnsiString
19639   );
19640 end;
19641 
19642 // Dynamic version of RtlOemStringToUnicodeString
19643 function  RtlOemStringToUnicodeString(
19644     DestinationString : PUNICODE_STRING;
19645     SourceString : POEM_STRING;
19646     AllocateDestinationString : BOOLEAN
19647   ): NTSTATUS; stdcall;
19648 begin
19649   GetProcedureAddress(_RtlOemStringToUnicodeString, ntdll, 'RtlOemStringToUnicodeString');
19650   Result := TFNRtlOemStringToUnicodeString(_RtlOemStringToUnicodeString)(
19651     DestinationString, SourceString, AllocateDestinationString
19652   );
19653 end;
19654 
19655 // Dynamic version of RtlOemToUnicodeN
19656 function  RtlOemToUnicodeN(
19657     UnicodeString : PWSTR;
19658     UnicodeSize : ULONG;
19659     var ResultSize : ULONG;
19660     OemString : PCHAR;
19661     OemSize : ULONG
19662   ): NTSTATUS; stdcall;
19663 begin
19664   GetProcedureAddress(_RtlOemToUnicodeN, ntdll, 'RtlOemToUnicodeN');
19665   Result := TFNRtlOemToUnicodeN(_RtlOemToUnicodeN)(
19666     UnicodeString, UnicodeSize, ResultSize, OemString, OemSize
19667   );
19668 end;
19669 
19670 // Dynamic version of RtlOpenCurrentUser
19671 function  RtlOpenCurrentUser(
19672     samDesired : ACCESS_MASK;
19673     phkResult : PHKEY
19674   ): NTSTATUS; stdcall;
19675 begin
19676   GetProcedureAddress(_RtlOpenCurrentUser, ntdll, 'RtlOpenCurrentUser');
19677   Result := TFNRtlOpenCurrentUser(_RtlOpenCurrentUser)(
19678     samDesired, phkResult
19679   );
19680 end;
19681 
19682 // Dynamic version of RtlPrefixString
19683 function  RtlPrefixString(
19684     String1 : PANSI_STRING;
19685     String2 : PANSI_STRING;
19686     CaseInsensitive : BOOLEAN
19687   ): BOOLEAN; stdcall;
19688 begin
19689   GetProcedureAddress(_RtlPrefixString, ntdll, 'RtlPrefixString');
19690   Result := TFNRtlPrefixString(_RtlPrefixString)(
19691     String1, String2, CaseInsensitive
19692   );
19693 end;
19694 
19695 // Dynamic version of RtlPrefixUnicodeString
19696 function  RtlPrefixUnicodeString(
19697     String1 : PUNICODE_STRING;
19698     String2 : PUNICODE_STRING;
19699     CaseInsensitive : BOOLEAN
19700   ): BOOLEAN; stdcall;
19701 begin
19702   GetProcedureAddress(_RtlPrefixUnicodeString, ntdll, 'RtlPrefixUnicodeString');
19703   Result := TFNRtlPrefixUnicodeString(_RtlPrefixUnicodeString)(
19704     String1, String2, CaseInsensitive
19705   );
19706 end;
19707 
19708 // Dynamic version of RtlQueryDepthSList
19709 function  RtlQueryDepthSList(
19710     ListHead : PSLIST_HEADER
19711   ): USHORT; stdcall;
19712 begin
19713   GetProcedureAddress(_RtlQueryDepthSList, ntdll, 'RtlQueryDepthSList');
19714   Result := TFNRtlQueryDepthSList(_RtlQueryDepthSList)(
19715     ListHead
19716   );
19717 end;
19718 
19719 // Dynamic version of RtlQueryEnvironmentVariable_U
19720 function  RtlQueryEnvironmentVariable_U(
19721     Environment : PVOID;
19722     VarName : PUNICODE_STRING;
19723     VarValue : PUNICODE_STRING
19724   ): NTSTATUS; stdcall;
19725 begin
19726   GetProcedureAddress(_RtlQueryEnvironmentVariable_U, ntdll, 'RtlQueryEnvironmentVariable_U');
19727   Result := TFNRtlQueryEnvironmentVariable_U(_RtlQueryEnvironmentVariable_U)(
19728     Environment, VarName, VarValue
19729   );
19730 end;
19731 
19732 // Dynamic version of RtlQueryInformationAcl
19733 function  RtlQueryInformationAcl(
19734     pAcl : PACL;
19735     pAclInformation : PVOID;
19736     nAclInformationLength : DWORD;
19737     dwAclInformationClass : ACL_INFORMATION_CLASS
19738   ): NTSTATUS; stdcall;
19739 begin
19740   GetProcedureAddress(_RtlQueryInformationAcl, ntdll, 'RtlQueryInformationAcl');
19741   Result := TFNRtlQueryInformationAcl(_RtlQueryInformationAcl)(
19742     pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass
19743   );
19744 end;
19745 
19746 // Dynamic version of RtlQueryProcessDebugInformation
19747 function  RtlQueryProcessDebugInformation(
19748     ProcessId : ULONG;
19749     DebugInfoClassMask : ULONG;
19750     DebugBuffer : PDEBUG_BUFFER
19751   ): NTSTATUS; stdcall;
19752 begin
19753   GetProcedureAddress(_RtlQueryProcessDebugInformation, ntdll, 'RtlQueryProcessDebugInformation');
19754   Result := TFNRtlQueryProcessDebugInformation(_RtlQueryProcessDebugInformation)(
19755     ProcessId, DebugInfoClassMask, DebugBuffer
19756   );
19757 end;
19758 
19759 // Dynamic version of RtlQueryRegistryValues
19760 function  RtlQueryRegistryValues(
19761     RelativeTo : ULONG;
19762     Path : LPCWSTR;
19763     QueryTable : PRTL_QUERY_REGISTRY_TABLE;
19764     Context : PVOID;
19765     Environment : PVOID
19766   ): NTSTATUS; stdcall;
19767 begin
19768   GetProcedureAddress(_RtlQueryRegistryValues, ntdll, 'RtlQueryRegistryValues');
19769   Result := TFNRtlQueryRegistryValues(_RtlQueryRegistryValues)(
19770     RelativeTo, Path, QueryTable, Context, Environment
19771   );
19772 end;
19773 
19774 // Dynamic version of RtlRaiseStatus
19775 procedure RtlRaiseStatus(
19776     Status : NTSTATUS
19777   ); stdcall;
19778 begin
19779   GetProcedureAddress(_RtlRaiseStatus, ntdll, 'RtlRaiseStatus');
19780   TFNRtlRaiseStatus(_RtlRaiseStatus)(
19781     Status
19782   );
19783 end;
19784 
19785 // Dynamic version of RtlRandom
19786 function  RtlRandom(
19787     Seed : PULONG
19788   ): ULONG; stdcall;
19789 begin
19790   GetProcedureAddress(_RtlRandom, ntdll, 'RtlRandom');
19791   Result := TFNRtlRandom(_RtlRandom)(
19792     Seed
19793   );
19794 end;
19795 
19796 // Dynamic version of RtlRandomEx
19797 function  RtlRandomEx(
19798     Seed : PULONG
19799   ): ULONG; stdcall;
19800 begin
19801   GetProcedureAddress(_RtlRandomEx, ntdll, 'RtlRandomEx');
19802   Result := TFNRtlRandomEx(_RtlRandomEx)(
19803     Seed
19804   );
19805 end;
19806 
19807 // Dynamic version of RtlReAllocateHeap
19808 function  RtlReAllocateHeap(
19809     hHeap : HANDLE;
19810     dwFlags : ULONG;
19811     lpMem : PVOID;
19812     dwBytes : SIZE_T
19813   ): PVOID; stdcall;
19814 begin
19815   GetProcedureAddress(_RtlReAllocateHeap, ntdll, 'RtlReAllocateHeap');
19816   Result := TFNRtlReAllocateHeap(_RtlReAllocateHeap)(
19817     hHeap, dwFlags, lpMem, dwBytes
19818   );
19819 end;
19820 
19821 // Dynamic version of RtlReleasePebLock
19822 procedure RtlReleasePebLock(); stdcall;
19823 begin
19824   GetProcedureAddress(_RtlReleasePebLock, ntdll, 'RtlReleasePebLock');
19825   TFNRtlReleasePebLock(_RtlReleasePebLock)();
19826 end;
19827 
19828 // Dynamic version of RtlRemoveVectoredExceptionHandler
19829 function  RtlRemoveVectoredExceptionHandler(
19830     VectoredHandlerHandle : PVOID
19831   ): ULONG; stdcall;
19832 begin
19833   GetProcedureAddress(_RtlRemoveVectoredExceptionHandler, ntdll, 'RtlRemoveVectoredExceptionHandler');
19834   Result := TFNRtlRemoveVectoredExceptionHandler(_RtlRemoveVectoredExceptionHandler)(
19835     VectoredHandlerHandle
19836   );
19837 end;
19838 
19839 // Dynamic version of RtlRestoreLastWin32Error
19840 procedure RtlRestoreLastWin32Error(
19841     dwErrCode : DWORD
19842   ); stdcall;
19843 begin
19844   GetProcedureAddress(_RtlRestoreLastWin32Error, ntdll, 'RtlRestoreLastWin32Error');
19845   TFNRtlRestoreLastWin32Error(_RtlRestoreLastWin32Error)(
19846     dwErrCode
19847   );
19848 end;
19849 
19850 // Dynamic version of RtlRunDecodeUnicodeString
19851 procedure RtlRunDecodeUnicodeString(
19852     CodeSeed : UCHAR;
19853     StringToDecode : PUNICODE_STRING
19854   ); stdcall;
19855 begin
19856   GetProcedureAddress(_RtlRunDecodeUnicodeString, ntdll, 'RtlRunDecodeUnicodeString');
19857   TFNRtlRunDecodeUnicodeString(_RtlRunDecodeUnicodeString)(
19858     CodeSeed, StringToDecode
19859   );
19860 end;
19861 
19862 // Dynamic version of RtlRunEncodeUnicodeString
19863 procedure RtlRunEncodeUnicodeString(
19864     var CodeSeed : UCHAR;
19865     StringToEncode : PUNICODE_STRING
19866   ); stdcall;
19867 begin
19868   GetProcedureAddress(_RtlRunEncodeUnicodeString, ntdll, 'RtlRunEncodeUnicodeString');
19869   TFNRtlRunEncodeUnicodeString(_RtlRunEncodeUnicodeString)(
19870     CodeSeed, StringToEncode
19871   );
19872 end;
19873 
19874 // Dynamic version of RtlSecondsSince1970ToTime
19875 procedure RtlSecondsSince1970ToTime(
19876     SecondsSince1970 : ULONG;
19877     Time : PLARGE_INTEGER
19878   ); stdcall;
19879 begin
19880   GetProcedureAddress(_RtlSecondsSince1970ToTime, ntdll, 'RtlSecondsSince1970ToTime');
19881   TFNRtlSecondsSince1970ToTime(_RtlSecondsSince1970ToTime)(
19882     SecondsSince1970, Time
19883   );
19884 end;
19885 
19886 // Dynamic version of RtlSecondsSince1980ToTime
19887 procedure RtlSecondsSince1980ToTime(
19888     SecondsSince1980 : ULONG;
19889     Time : PLARGE_INTEGER
19890   ); stdcall;
19891 begin
19892   GetProcedureAddress(_RtlSecondsSince1980ToTime, ntdll, 'RtlSecondsSince1980ToTime');
19893   TFNRtlSecondsSince1980ToTime(_RtlSecondsSince1980ToTime)(
19894     SecondsSince1980, Time
19895   );
19896 end;
19897 
19898 // Dynamic version of RtlSelfRelativeToAbsoluteSD
19899 function  RtlSelfRelativeToAbsoluteSD(
19900     pSelfRelativeSD : PSECURITY_DESCRIPTOR;
19901     pAbsoluteSD : PSECURITY_DESCRIPTOR;
19902     lpdwAbsoluteSDSize : LPDWORD;
19903     pDacl : PACL;
19904     lpdwDaclSize : LPDWORD;
19905     pSacl : PACL;
19906     lpdwSaclSize : LPDWORD;
19907     pOwner : PSID;
19908     lpdwOwnerSize : LPDWORD;
19909     pPrimaryGroup : PSID;
19910     lpdwPrimaryGroupSize : LPDWORD
19911   ): NTSTATUS; stdcall;
19912 begin
19913   GetProcedureAddress(_RtlSelfRelativeToAbsoluteSD, ntdll, 'RtlSelfRelativeToAbsoluteSD');
19914   Result := TFNRtlSelfRelativeToAbsoluteSD(_RtlSelfRelativeToAbsoluteSD)(
19915     pSelfRelativeSD, pAbsoluteSD, lpdwAbsoluteSDSize, pDacl, lpdwDaclSize, pSacl, lpdwSaclSize, pOwner, lpdwOwnerSize, pPrimaryGroup, lpdwPrimaryGroupSize
19916   );
19917 end;
19918 
19919 // Dynamic version of RtlSetAllBits
19920 procedure RtlSetAllBits(
19921     BitMapHeader : PRTL_BITMAP
19922   ); stdcall;
19923 begin
19924   GetProcedureAddress(_RtlSetAllBits, ntdll, 'RtlSetAllBits');
19925   TFNRtlSetAllBits(_RtlSetAllBits)(
19926     BitMapHeader
19927   );
19928 end;
19929 
19930 // Dynamic version of RtlSetBits
19931 procedure RtlSetBits(
19932     BitMapHeader : PRTL_BITMAP;
19933     StartingIndex : ULONG;
19934     NumberToSet : ULONG
19935   ); stdcall;
19936 begin
19937   GetProcedureAddress(_RtlSetBits, ntdll, 'RtlSetBits');
19938   TFNRtlSetBits(_RtlSetBits)(
19939     BitMapHeader, StartingIndex, NumberToSet
19940   );
19941 end;
19942 
19943 // Dynamic version of RtlSetControlSecurityDescriptor
19944 function  RtlSetControlSecurityDescriptor(
19945     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
19946     ControlBitsOfInterest : SECURITY_DESCRIPTOR_CONTROL;
19947     ControlBitsToSet : SECURITY_DESCRIPTOR_CONTROL
19948   ): NTSTATUS; stdcall;
19949 begin
19950   GetProcedureAddress(_RtlSetControlSecurityDescriptor, ntdll, 'RtlSetControlSecurityDescriptor');
19951   Result := TFNRtlSetControlSecurityDescriptor(_RtlSetControlSecurityDescriptor)(
19952     pSecurityDescriptor, ControlBitsOfInterest, ControlBitsToSet
19953   );
19954 end;
19955 
19956 // Dynamic version of RtlSetCriticalSectionSpinCount
19957 function  RtlSetCriticalSectionSpinCount(
19958     lpCriticalSection : PRTL_CRITICAL_SECTION;
19959     dwSpinCount : ULONG
19960   ): DWORD; stdcall;
19961 begin
19962   GetProcedureAddress(_RtlSetCriticalSectionSpinCount, ntdll, 'RtlSetCriticalSectionSpinCount');
19963   Result := TFNRtlSetCriticalSectionSpinCount(_RtlSetCriticalSectionSpinCount)(
19964     lpCriticalSection, dwSpinCount
19965   );
19966 end;
19967 
19968 // Dynamic version of RtlSetCurrentDirectory_U
19969 function  RtlSetCurrentDirectory_U(
19970     NewCurrentDirectory : PUNICODE_STRING
19971   ): NTSTATUS; stdcall;
19972 begin
19973   GetProcedureAddress(_RtlSetCurrentDirectory_U, ntdll, 'RtlSetCurrentDirectory_U');
19974   Result := TFNRtlSetCurrentDirectory_U(_RtlSetCurrentDirectory_U)(
19975     NewCurrentDirectory
19976   );
19977 end;
19978 
19979 // Dynamic version of RtlSetDaclSecurityDescriptor
19980 function  RtlSetDaclSecurityDescriptor(
19981     SecurityDescriptor : PSECURITY_DESCRIPTOR;
19982     DaclPresent : BOOLEAN;
19983     Dacl : PACL;
19984     DaclDefaulted : BOOLEAN
19985   ): NTSTATUS; stdcall;
19986 begin
19987   GetProcedureAddress(_RtlSetDaclSecurityDescriptor, ntdll, 'RtlSetDaclSecurityDescriptor');
19988   Result := TFNRtlSetDaclSecurityDescriptor(_RtlSetDaclSecurityDescriptor)(
19989     SecurityDescriptor, DaclPresent, Dacl, DaclDefaulted
19990   );
19991 end;
19992 
19993 // Dynamic version of RtlSetGroupSecurityDescriptor
19994 function  RtlSetGroupSecurityDescriptor(
19995     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
19996     pGroup : PSID;
19997     bGroupDefaulted : BOOLEAN
19998   ): NTSTATUS; stdcall;
19999 begin
20000   GetProcedureAddress(_RtlSetGroupSecurityDescriptor, ntdll, 'RtlSetGroupSecurityDescriptor');
20001   Result := TFNRtlSetGroupSecurityDescriptor(_RtlSetGroupSecurityDescriptor)(
20002     pSecurityDescriptor, pGroup, bGroupDefaulted
20003   );
20004 end;
20005 
20006 // Dynamic version of RtlSetInformationAcl
20007 function  RtlSetInformationAcl(
20008     pAcl : PACL;
20009     pAclInformation : PVOID;
20010     nInformationLength : DWORD;
20011     dwAclInformationClass : ACL_INFORMATION_CLASS
20012   ): NTSTATUS; stdcall;
20013 begin
20014   GetProcedureAddress(_RtlSetInformationAcl, ntdll, 'RtlSetInformationAcl');
20015   Result := TFNRtlSetInformationAcl(_RtlSetInformationAcl)(
20016     pAcl, pAclInformation, nInformationLength, dwAclInformationClass
20017   );
20018 end;
20019 
20020 // Dynamic version of RtlSetLastWin32ErrorAndNtStatusFromNtStatus
20021 function  RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
20022     Status : NTSTATUS
20023   ): ULONG; stdcall;
20024 begin
20025   GetProcedureAddress(_RtlSetLastWin32ErrorAndNtStatusFromNtStatus, ntdll, 'RtlSetLastWin32ErrorAndNtStatusFromNtStatus');
20026   Result := TFNRtlSetLastWin32ErrorAndNtStatusFromNtStatus(_RtlSetLastWin32ErrorAndNtStatusFromNtStatus)(
20027     Status
20028   );
20029 end;
20030 
20031 // Dynamic version of RtlSetOwnerSecurityDescriptor
20032 function  RtlSetOwnerSecurityDescriptor(
20033     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
20034     pOwner : PSID;
20035     bOwnerDefaulted : BOOLEAN
20036   ): NTSTATUS; stdcall;
20037 begin
20038   GetProcedureAddress(_RtlSetOwnerSecurityDescriptor, ntdll, 'RtlSetOwnerSecurityDescriptor');
20039   Result := TFNRtlSetOwnerSecurityDescriptor(_RtlSetOwnerSecurityDescriptor)(
20040     pSecurityDescriptor, pOwner, bOwnerDefaulted
20041   );
20042 end;
20043 
20044 // Dynamic version of RtlSetProcessIsCritical
20045 function  RtlSetProcessIsCritical(
20046     bIsCritical : BOOLEAN;
20047     pbOldIsCriticalValue : PBOOLEAN;
20048     bUnknownCanBeFalse : BOOLEAN
20049   ): NTSTATUS; stdcall;
20050 begin
20051   GetProcedureAddress(_RtlSetProcessIsCritical, ntdll, 'RtlSetProcessIsCritical');
20052   Result := TFNRtlSetProcessIsCritical(_RtlSetProcessIsCritical)(
20053     bIsCritical, pbOldIsCriticalValue, bUnknownCanBeFalse
20054   );
20055 end;
20056 
20057 // Dynamic version of RtlSetSaclSecurityDescriptor
20058 function  RtlSetSaclSecurityDescriptor(
20059     pSecurityDescriptor : PSECURITY_DESCRIPTOR;
20060     bSaclPresent : BOOLEAN;
20061     pSacl : PACL;
20062     SaclDefaulted : BOOLEAN
20063   ): NTSTATUS; stdcall;
20064 begin
20065   GetProcedureAddress(_RtlSetSaclSecurityDescriptor, ntdll, 'RtlSetSaclSecurityDescriptor');
20066   Result := TFNRtlSetSaclSecurityDescriptor(_RtlSetSaclSecurityDescriptor)(
20067     pSecurityDescriptor, bSaclPresent, pSacl, SaclDefaulted
20068   );
20069 end;
20070 
20071 // Dynamic version of RtlSetThreadIsCritical
20072 function  RtlSetThreadIsCritical(
20073     bIsCritical : BOOLEAN;
20074     pbOldIsCriticalValue : PBOOLEAN;
20075     bUnknownCanBeFalse : BOOLEAN
20076   ): NTSTATUS; stdcall;
20077 begin
20078   GetProcedureAddress(_RtlSetThreadIsCritical, ntdll, 'RtlSetThreadIsCritical');
20079   Result := TFNRtlSetThreadIsCritical(_RtlSetThreadIsCritical)(
20080     bIsCritical, pbOldIsCriticalValue, bUnknownCanBeFalse
20081   );
20082 end;
20083 
20084 // Dynamic version of RtlSizeHeap
20085 function  RtlSizeHeap(
20086     hHeap : HANDLE;
20087     dwFlags : ULONG;
20088     lpMem : PVOID
20089   ): SIZE_T; stdcall;
20090 begin
20091   GetProcedureAddress(_RtlSizeHeap, ntdll, 'RtlSizeHeap');
20092   Result := TFNRtlSizeHeap(_RtlSizeHeap)(
20093     hHeap, dwFlags, lpMem
20094   );
20095 end;
20096 
20097 // Dynamic version of RtlStringFromGUID
20098 function  RtlStringFromGUID(
20099     Guid : REFGUID;
20100     GuidString : PUNICODE_STRING
20101   ): NTSTATUS; stdcall;
20102 begin
20103   GetProcedureAddress(_RtlStringFromGUID, ntdll, 'RtlStringFromGUID');
20104   Result := TFNRtlStringFromGUID(_RtlStringFromGUID)(
20105     Guid, GuidString
20106   );
20107 end;
20108 
20109 // Dynamic version of RtlSubAuthorityCountSid
20110 function  RtlSubAuthorityCountSid(
20111     pSid : PSID
20112   ): PUCHAR; stdcall;
20113 begin
20114   GetProcedureAddress(_RtlSubAuthorityCountSid, ntdll, 'RtlSubAuthorityCountSid');
20115   Result := TFNRtlSubAuthorityCountSid(_RtlSubAuthorityCountSid)(
20116     pSid
20117   );
20118 end;
20119 
20120 // Dynamic version of RtlSubAuthoritySid
20121 function  RtlSubAuthoritySid(
20122     pSid : PSID;
20123     nSubAuthority : DWORD
20124   ): PDWORD; stdcall;
20125 begin
20126   GetProcedureAddress(_RtlSubAuthoritySid, ntdll, 'RtlSubAuthoritySid');
20127   Result := TFNRtlSubAuthoritySid(_RtlSubAuthoritySid)(
20128     pSid, nSubAuthority
20129   );
20130 end;
20131 
20132 // Dynamic version of RtlSystemTimeToLocalTime
20133 function  RtlSystemTimeToLocalTime(
20134     SystemTime : PLARGE_INTEGER;
20135     LocalTime : PLARGE_INTEGER
20136   ): NTSTATUS; stdcall;
20137 begin
20138   GetProcedureAddress(_RtlSystemTimeToLocalTime, ntdll, 'RtlSystemTimeToLocalTime');
20139   Result := TFNRtlSystemTimeToLocalTime(_RtlSystemTimeToLocalTime)(
20140     SystemTime, LocalTime
20141   );
20142 end;
20143 
20144 // Dynamic version of RtlTimeFieldsToTime
20145 function  RtlTimeFieldsToTime(
20146     TimeFields : PTIME_FIELDS;
20147     Time : PLARGE_INTEGER
20148   ): BOOLEAN; stdcall;
20149 begin
20150   GetProcedureAddress(_RtlTimeFieldsToTime, ntdll, 'RtlTimeFieldsToTime');
20151   Result := TFNRtlTimeFieldsToTime(_RtlTimeFieldsToTime)(
20152     TimeFields, Time
20153   );
20154 end;
20155 
20156 // Dynamic version of RtlTimeToElapsedTimeFields
20157 procedure RtlTimeToElapsedTimeFields(
20158     Time : PLARGE_INTEGER;
20159     TimeFields : PTIME_FIELDS
20160   ); stdcall;
20161 begin
20162   GetProcedureAddress(_RtlTimeToElapsedTimeFields, ntdll, 'RtlTimeToElapsedTimeFields');
20163   TFNRtlTimeToElapsedTimeFields(_RtlTimeToElapsedTimeFields)(
20164     Time, TimeFields
20165   );
20166 end;
20167 
20168 {$IFNDEF JWA_INCLUDEMODE}
20169 // Dynamic version of RtlTimeToSecondsSince1970
20170 function  RtlTimeToSecondsSince1970(
20171     Time : PLARGE_INTEGER;
20172     ElapsedSeconds : PULONG
20173   ): BOOLEAN; stdcall;
20174 begin
20175   GetProcedureAddress(_RtlTimeToSecondsSince1970, ntdll, 'RtlTimeToSecondsSince1970');
20176   Result := TFNRtlTimeToSecondsSince1970(_RtlTimeToSecondsSince1970)(
20177     Time, ElapsedSeconds
20178   );
20179 end;
20180 {$ENDIF JWA_INCLUDEMODE}
20181 
20182 // Dynamic version of RtlTimeToSecondsSince1980
20183 function  RtlTimeToSecondsSince1980(
20184     Time : PLARGE_INTEGER;
20185     ElapsedSeconds : PULONG
20186   ): BOOLEAN; stdcall;
20187 begin
20188   GetProcedureAddress(_RtlTimeToSecondsSince1980, ntdll, 'RtlTimeToSecondsSince1980');
20189   Result := TFNRtlTimeToSecondsSince1980(_RtlTimeToSecondsSince1980)(
20190     Time, ElapsedSeconds
20191   );
20192 end;
20193 
20194 // Dynamic version of RtlTimeToTimeFields
20195 procedure RtlTimeToTimeFields(
20196     Time : PLARGE_INTEGER;
20197     TimeFields : PTIME_FIELDS
20198   ); stdcall;
20199 begin
20200   GetProcedureAddress(_RtlTimeToTimeFields, ntdll, 'RtlTimeToTimeFields');
20201   TFNRtlTimeToTimeFields(_RtlTimeToTimeFields)(
20202     Time, TimeFields
20203   );
20204 end;
20205 
20206 // Dynamic version of RtlTryEnterCriticalSection
20207 function  RtlTryEnterCriticalSection(
20208     lpCriticalSection : PRTL_CRITICAL_SECTION
20209   ): BOOL; stdcall;
20210 begin
20211   GetProcedureAddress(_RtlTryEnterCriticalSection, ntdll, 'RtlTryEnterCriticalSection');
20212   Result := TFNRtlTryEnterCriticalSection(_RtlTryEnterCriticalSection)(
20213     lpCriticalSection
20214   );
20215 end;
20216 
20217 // Dynamic version of RtlUnicodeStringToAnsiSize
20218 function  RtlUnicodeStringToAnsiSize(
20219     UnicodeString : PUNICODE_STRING
20220   ): ULONG; stdcall;
20221 begin
20222   GetProcedureAddress(_RtlUnicodeStringToAnsiSize, ntdll, 'RtlUnicodeStringToAnsiSize');
20223   Result := TFNRtlUnicodeStringToAnsiSize(_RtlUnicodeStringToAnsiSize)(
20224     UnicodeString
20225   );
20226 end;
20227 
20228 {$IFNDEF JWA_INCLUDEMODE}
20229 // Dynamic version of RtlUnicodeStringToAnsiString
20230 function  RtlUnicodeStringToAnsiString(
20231     DestinationString : PANSI_STRING;
20232     SourceString : PUNICODE_STRING;
20233     AllocateDestinationString : BOOLEAN
20234   ): NTSTATUS; stdcall;
20235 begin
20236   GetProcedureAddress(_RtlUnicodeStringToAnsiString, ntdll, 'RtlUnicodeStringToAnsiString');
20237   Result := TFNRtlUnicodeStringToAnsiString(_RtlUnicodeStringToAnsiString)(
20238     DestinationString, SourceString, AllocateDestinationString
20239   );
20240 end;
20241 {$ENDIF JWA_INCLUDEMODE}
20242 
20243 // Dynamic version of RtlUnicodeStringToCountedOemString
20244 function  RtlUnicodeStringToCountedOemString(
20245     DestinationString : POEM_STRING;
20246     SourceString : PUNICODE_STRING;
20247     AllocateDestinationString : BOOLEAN
20248   ): NTSTATUS; stdcall;
20249 begin
20250   GetProcedureAddress(_RtlUnicodeStringToCountedOemString, ntdll, 'RtlUnicodeStringToCountedOemString');
20251   Result := TFNRtlUnicodeStringToCountedOemString(_RtlUnicodeStringToCountedOemString)(
20252     DestinationString, SourceString, AllocateDestinationString
20253   );
20254 end;
20255 
20256 // Dynamic version of RtlUnicodeStringToInteger
20257 function  RtlUnicodeStringToInteger(
20258     Str : PUNICODE_STRING;
20259     Base : ULONG;
20260     Value : PULONG
20261   ): NTSTATUS; stdcall;
20262 begin
20263   GetProcedureAddress(_RtlUnicodeStringToInteger, ntdll, 'RtlUnicodeStringToInteger');
20264   Result := TFNRtlUnicodeStringToInteger(_RtlUnicodeStringToInteger)(
20265     Str, Base, Value
20266   );
20267 end;
20268 
20269 // Dynamic version of RtlUnicodeStringToOemSize
20270 function  RtlUnicodeStringToOemSize(
20271     UnicodeString : PUNICODE_STRING
20272   ): ULONG; stdcall;
20273 begin
20274   GetProcedureAddress(_RtlUnicodeStringToOemSize, ntdll, 'RtlUnicodeStringToOemSize');
20275   Result := TFNRtlUnicodeStringToOemSize(_RtlUnicodeStringToOemSize)(
20276     UnicodeString
20277   );
20278 end;
20279 
20280 {$IFNDEF JWA_INCLUDEMODE}
20281 // Dynamic version of RtlUnicodeStringToOemString
20282 function  RtlUnicodeStringToOemString(
20283     DestinationString : POEM_STRING;
20284     SourceString : PCUNICODE_STRING;
20285     AllocateDestinationString : BOOLEAN
20286   ): NTSTATUS; stdcall;
20287 begin
20288   GetProcedureAddress(_RtlUnicodeStringToOemString, ntdll, 'RtlUnicodeStringToOemString');
20289   Result := TFNRtlUnicodeStringToOemString(_RtlUnicodeStringToOemString)(
20290     DestinationString, SourceString, AllocateDestinationString
20291   );
20292 end;
20293 
20294 
20295 // Dynamic version of RtlUnicodeToMultiByteSize
20296 function  RtlUnicodeToMultiByteSize(
20297     BytesInMultiByteString : PULONG;
20298     UnicodeString : PWSTR;
20299     BytesInUnicodeString : ULONG
20300   ): NTSTATUS; stdcall;
20301 begin
20302   GetProcedureAddress(_RtlUnicodeToMultiByteSize, ntdll, 'RtlUnicodeToMultiByteSize');
20303   Result := TFNRtlUnicodeToMultiByteSize(_RtlUnicodeToMultiByteSize)(
20304     BytesInMultiByteString, UnicodeString, BytesInUnicodeString
20305   );
20306 end;
20307 {$ENDIF JWA_INCLUDEMODE}
20308 
20309 // Dynamic version of RtlUniform
20310 function  RtlUniform(
20311     Seed : PULONG
20312   ): ULONG; stdcall;
20313 begin
20314   GetProcedureAddress(_RtlUniform, ntdll, 'RtlUniform');
20315   Result := TFNRtlUniform(_RtlUniform)(
20316     Seed
20317   );
20318 end;
20319 
20320 // Dynamic version of RtlUnwind
20321 procedure RtlUnwind(
20322     TargetFrame : PVOID;
20323     TargetIp : PVOID;
20324     ExceptionRecord : PEXCEPTION_RECORD;
20325     ReturnValue : PVOID
20326   ); stdcall;
20327 begin
20328   GetProcedureAddress(_RtlUnwind, ntdll, 'RtlUnwind');
20329   TFNRtlUnwind(_RtlUnwind)(
20330     TargetFrame, TargetIp, ExceptionRecord, ReturnValue
20331   );
20332 end;
20333 
20334 // Dynamic version of RtlUpcaseUnicodeChar
20335 function  RtlUpcaseUnicodeChar(
20336     SourceCharacter : WCHAR
20337   ): WCHAR; stdcall;
20338 begin
20339   GetProcedureAddress(_RtlUpcaseUnicodeChar, ntdll, 'RtlUpcaseUnicodeChar');
20340   Result := TFNRtlUpcaseUnicodeChar(_RtlUpcaseUnicodeChar)(
20341     SourceCharacter
20342   );
20343 end;
20344 
20345 // Dynamic version of RtlUpcaseUnicodeString
20346 function  RtlUpcaseUnicodeString(
20347     DestinationString : PUNICODE_STRING;
20348     SourceString : PUNICODE_STRING;
20349     AllocateDestinationString : BOOLEAN
20350   ): NTSTATUS; stdcall;
20351 begin
20352   GetProcedureAddress(_RtlUpcaseUnicodeString, ntdll, 'RtlUpcaseUnicodeString');
20353   Result := TFNRtlUpcaseUnicodeString(_RtlUpcaseUnicodeString)(
20354     DestinationString, SourceString, AllocateDestinationString
20355   );
20356 end;
20357 
20358 // Dynamic version of RtlUpcaseUnicodeStringToAnsiString
20359 function  RtlUpcaseUnicodeStringToAnsiString(
20360     DestinationString : PSTRING;
20361     SourceString : PUNICODE_STRING;
20362     AllocateDestinationString : BOOLEAN
20363   ): NTSTATUS; stdcall;
20364 begin
20365   GetProcedureAddress(_RtlUpcaseUnicodeStringToAnsiString, ntdll, 'RtlUpcaseUnicodeStringToAnsiString');
20366   Result := TFNRtlUpcaseUnicodeStringToAnsiString(_RtlUpcaseUnicodeStringToAnsiString)(
20367     DestinationString, SourceString, AllocateDestinationString
20368   );
20369 end;
20370 
20371 // Dynamic version of RtlUpcaseUnicodeStringToCountedOemString
20372 function  RtlUpcaseUnicodeStringToCountedOemString(
20373     DestinationString : PSTRING;
20374     SourceString : PUNICODE_STRING;
20375     AllocateDestinationString : BOOLEAN
20376   ): NTSTATUS; stdcall;
20377 begin
20378   GetProcedureAddress(_RtlUpcaseUnicodeStringToCountedOemString, ntdll, 'RtlUpcaseUnicodeStringToCountedOemString');
20379   Result := TFNRtlUpcaseUnicodeStringToCountedOemString(_RtlUpcaseUnicodeStringToCountedOemString)(
20380     DestinationString, SourceString, AllocateDestinationString
20381   );
20382 end;
20383 
20384 // Dynamic version of RtlUpcaseUnicodeStringToOemString
20385 function  RtlUpcaseUnicodeStringToOemString(
20386     DestinationString : PSTRING;
20387     SourceString : PUNICODE_STRING;
20388     AllocateDestinationString : BOOLEAN
20389   ): NTSTATUS; stdcall;
20390 begin
20391   GetProcedureAddress(_RtlUpcaseUnicodeStringToOemString, ntdll, 'RtlUpcaseUnicodeStringToOemString');
20392   Result := TFNRtlUpcaseUnicodeStringToOemString(_RtlUpcaseUnicodeStringToOemString)(
20393     DestinationString, SourceString, AllocateDestinationString
20394   );
20395 end;
20396 
20397 // Dynamic version of RtlUpcaseUnicodeToMultiByteN
20398 function  RtlUpcaseUnicodeToMultiByteN(
20399     MbString : PCHAR;
20400     MbSize : ULONG;
20401     var ResultSize : ULONG;
20402     UnicodeString : PWSTR;
20403     UnicodeSize : ULONG
20404   ): NTSTATUS; stdcall;
20405 begin
20406   GetProcedureAddress(_RtlUpcaseUnicodeToMultiByteN, ntdll, 'RtlUpcaseUnicodeToMultiByteN');
20407   Result := TFNRtlUpcaseUnicodeToMultiByteN(_RtlUpcaseUnicodeToMultiByteN)(
20408     MbString, MbSize, ResultSize, UnicodeString, UnicodeSize
20409   );
20410 end;
20411 
20412 // Dynamic version of RtlUpcaseUnicodeToOemN
20413 function  RtlUpcaseUnicodeToOemN(
20414     OemString : PCHAR;
20415     OemSize : ULONG;
20416     var ResultSize : ULONG;
20417     UnicodeString : PWSTR;
20418     UnicodeSize : ULONG
20419   ): NTSTATUS; stdcall;
20420 begin
20421   GetProcedureAddress(_RtlUpcaseUnicodeToOemN, ntdll, 'RtlUpcaseUnicodeToOemN');
20422   Result := TFNRtlUpcaseUnicodeToOemN(_RtlUpcaseUnicodeToOemN)(
20423     OemString, OemSize, ResultSize, UnicodeString, UnicodeSize
20424   );
20425 end;
20426 
20427 // Dynamic version of RtlUpperChar
20428 function  RtlUpperChar(
20429     Character : CHAR
20430   ): CHAR; stdcall;
20431 begin
20432   GetProcedureAddress(_RtlUpperChar, ntdll, 'RtlUpperChar');
20433   Result := TFNRtlUpperChar(_RtlUpperChar)(
20434     Character
20435   );
20436 end;
20437 
20438 // Dynamic version of RtlUpperString
20439 procedure RtlUpperString(
20440     DestinationString : PSTRING;
20441     SourceString : PSTRING
20442   ); stdcall;
20443 begin
20444   GetProcedureAddress(_RtlUpperString, ntdll, 'RtlUpperString');
20445   TFNRtlUpperString(_RtlUpperString)(
20446     DestinationString, SourceString
20447   );
20448 end;
20449 
20450 // Dynamic version of RtlValidAcl
20451 function  RtlValidAcl(
20452     Acl : PACL
20453   ): BOOLEAN; stdcall;
20454 begin
20455   GetProcedureAddress(_RtlValidAcl, ntdll, 'RtlValidAcl');
20456   Result := TFNRtlValidAcl(_RtlValidAcl)(
20457     Acl
20458   );
20459 end;
20460 
20461 // Dynamic version of RtlValidRelativeSecurityDescriptor
20462 function  RtlValidRelativeSecurityDescriptor(
20463     SecurityDescriptorInput : PSECURITY_DESCRIPTOR;
20464     SecurityDescriptorLength : ULONG;
20465     RequiredInformation : SECURITY_INFORMATION
20466   ): BOOLEAN; stdcall;
20467 begin
20468   GetProcedureAddress(_RtlValidRelativeSecurityDescriptor, ntdll, 'RtlValidRelativeSecurityDescriptor');
20469   Result := TFNRtlValidRelativeSecurityDescriptor(_RtlValidRelativeSecurityDescriptor)(
20470     SecurityDescriptorInput, SecurityDescriptorLength, RequiredInformation
20471   );
20472 end;
20473 
20474 // Dynamic version of RtlValidSecurityDescriptor
20475 function  RtlValidSecurityDescriptor(
20476     SecurityDescriptor : PSECURITY_DESCRIPTOR
20477   ): BOOLEAN; stdcall;
20478 begin
20479   GetProcedureAddress(_RtlValidSecurityDescriptor, ntdll, 'RtlValidSecurityDescriptor');
20480   Result := TFNRtlValidSecurityDescriptor(_RtlValidSecurityDescriptor)(
20481     SecurityDescriptor
20482   );
20483 end;
20484 
20485 // Dynamic version of RtlValidSid
20486 function  RtlValidSid(
20487     pSid : PSID
20488   ): BOOLEAN; stdcall;
20489 begin
20490   GetProcedureAddress(_RtlValidSid, ntdll, 'RtlValidSid');
20491   Result := TFNRtlValidSid(_RtlValidSid)(
20492     pSid
20493   );
20494 end;
20495 
20496 // Dynamic version of RtlValidateHeap
20497 function  RtlValidateHeap(
20498     hHeap : HANDLE;
20499     dwFlags : ULONG;
20500     lpMem : LPCVOID
20501   ): BOOL; stdcall;
20502 begin
20503   GetProcedureAddress(_RtlValidateHeap, ntdll, 'RtlValidateHeap');
20504   Result := TFNRtlValidateHeap(_RtlValidateHeap)(
20505     hHeap, dwFlags, lpMem
20506   );
20507 end;
20508 
20509 // Dynamic version of RtlValidateUnicodeString
20510 function  RtlValidateUnicodeString(
20511     dwMustBeNull : ULONG;
20512     ValidateThis : PUNICODE_STRING
20513   ): NTSTATUS; stdcall;
20514 begin
20515   GetProcedureAddress(_RtlValidateUnicodeString, ntdll, 'RtlValidateUnicodeString');
20516   Result := TFNRtlValidateUnicodeString(_RtlValidateUnicodeString)(
20517     dwMustBeNull, ValidateThis
20518   );
20519 end;
20520 
20521 // Dynamic version of RtlVerifyVersionInfo
20522 function  RtlVerifyVersionInfo(
20523     VersionInfo : PRTL_OSVERSIONINFOEXW;
20524     TypeMask : ULONG;
20525     ConditionMask : ULONGLONG
20526   ): NTSTATUS; stdcall;
20527 begin
20528   GetProcedureAddress(_RtlVerifyVersionInfo, ntdll, 'RtlVerifyVersionInfo');
20529   Result := TFNRtlVerifyVersionInfo(_RtlVerifyVersionInfo)(
20530     VersionInfo, TypeMask, ConditionMask
20531   );
20532 end;
20533 
20534 // Dynamic version of RtlVolumeDeviceToDosName
20535 function  RtlVolumeDeviceToDosName(
20536     VolumeDeviceObject : PVOID;
20537     DosName : PUNICODE_STRING
20538   ): NTSTATUS; stdcall;
20539 begin
20540   GetProcedureAddress(_RtlVolumeDeviceToDosName, ntdll, 'RtlVolumeDeviceToDosName');
20541   Result := TFNRtlVolumeDeviceToDosName(_RtlVolumeDeviceToDosName)(
20542     VolumeDeviceObject, DosName
20543   );
20544 end;
20545 
20546 // Dynamic version of RtlWriteRegistryValue
20547 function  RtlWriteRegistryValue(
20548     RelativeTo : ULONG;
20549     Path : LPCWSTR;
20550     ValueName : LPCWSTR;
20551     ValueType : ULONG;
20552     ValueData : PVOID;
20553     ValueLength : ULONG
20554   ): NTSTATUS; stdcall;
20555 begin
20556   GetProcedureAddress(_RtlWriteRegistryValue, ntdll, 'RtlWriteRegistryValue');
20557   Result := TFNRtlWriteRegistryValue(_RtlWriteRegistryValue)(
20558     RelativeTo, Path, ValueName, ValueType, ValueData, ValueLength
20559   );
20560 end;
20561 
20562 // Dynamic version of RtlZeroHeap
20563 function  RtlZeroHeap(
20564     hHeap : HANDLE;
20565     dwFlags : ULONG
20566   ): BOOLEAN; stdcall;
20567 begin
20568   GetProcedureAddress(_RtlZeroHeap, ntdll, 'RtlZeroHeap');
20569   Result := TFNRtlZeroHeap(_RtlZeroHeap)(
20570     hHeap, dwFlags
20571   );
20572 end;
20573 
20574 // Dynamic version of RtlZeroMemory
20575 procedure RtlZeroMemory(
20576     Destination : PVOID;
20577     Length : SIZE_T
20578   ); stdcall;
20579 begin
20580   GetProcedureAddress(_RtlZeroMemory, ntdll, 'RtlZeroMemory');
20581   TFNRtlZeroMemory(_RtlZeroMemory)(
20582     Destination, Length
20583   );
20584 end;
20585 
20586 // Dynamic version of RtlpNotOwnerCriticalSection
20587 function  RtlpNotOwnerCriticalSection(
20588     lpCriticalSection : PRTL_CRITICAL_SECTION
20589   ): BOOLEAN; stdcall;
20590 begin
20591   GetProcedureAddress(_RtlpNotOwnerCriticalSection, ntdll, 'RtlpNotOwnerCriticalSection');
20592   Result := TFNRtlpNotOwnerCriticalSection(_RtlpNotOwnerCriticalSection)(
20593     lpCriticalSection
20594   );
20595 end;
20596 
20597 // Dynamic version of RtlpNtCreateKey
20598 function  RtlpNtCreateKey(
20599     KeyHandle : PHANDLE;
20600     DesiredAccess : ACCESS_MASK;
20601     ObjectAttributes : POBJECT_ATTRIBUTES;
20602     Unused1 : ULONG;
20603     Unused2 : ULONG;
20604     Disposition : PULONG
20605   ): NTSTATUS; stdcall;
20606 begin
20607   GetProcedureAddress(_RtlpNtCreateKey, ntdll, 'RtlpNtCreateKey');
20608   Result := TFNRtlpNtCreateKey(_RtlpNtCreateKey)(
20609     KeyHandle, DesiredAccess, ObjectAttributes, Unused1, Unused2, Disposition
20610   );
20611 end;
20612 
20613 // Dynamic version of RtlpNtEnumerateSubKey
20614 function  RtlpNtEnumerateSubKey(
20615     KeyHandle : HANDLE;
20616     SubKeyName : PUNICODE_STRING;
20617     Index : ULONG;
20618     Unused1 : ULONG
20619   ): NTSTATUS; stdcall;
20620 begin
20621   GetProcedureAddress(_RtlpNtEnumerateSubKey, ntdll, 'RtlpNtEnumerateSubKey');
20622   Result := TFNRtlpNtEnumerateSubKey(_RtlpNtEnumerateSubKey)(
20623     KeyHandle, SubKeyName, Index, Unused1
20624   );
20625 end;
20626 
20627 // Dynamic version of RtlpNtMakeTemporaryKey
20628 function  RtlpNtMakeTemporaryKey(
20629     KeyHandle : HANDLE
20630   ): NTSTATUS; stdcall;
20631 begin
20632   GetProcedureAddress(_RtlpNtMakeTemporaryKey, ntdll, 'RtlpNtMakeTemporaryKey');
20633   Result := TFNRtlpNtMakeTemporaryKey(_RtlpNtMakeTemporaryKey)(
20634     KeyHandle
20635   );
20636 end;
20637 
20638 // Dynamic version of RtlpNtOpenKey
20639 function  RtlpNtOpenKey(
20640     KeyHandle : HANDLE;
20641     DesiredAccess : ACCESS_MASK;
20642     ObjectAttributes : POBJECT_ATTRIBUTES;
20643     Unused : ULONG
20644   ): NTSTATUS; stdcall;
20645 begin
20646   GetProcedureAddress(_RtlpNtOpenKey, ntdll, 'RtlpNtOpenKey');
20647   Result := TFNRtlpNtOpenKey(_RtlpNtOpenKey)(
20648     KeyHandle, DesiredAccess, ObjectAttributes, Unused
20649   );
20650 end;
20651 
20652 // Dynamic version of RtlpNtQueryValueKey
20653 function  RtlpNtQueryValueKey(
20654     KeyHandle : HANDLE;
20655     Type_ : PULONG;
20656     Data : PVOID;
20657     DataSize : PULONG;
20658     Unused : ULONG
20659   ): NTSTATUS; stdcall;
20660 begin
20661   GetProcedureAddress(_RtlpNtQueryValueKey, ntdll, 'RtlpNtQueryValueKey');
20662   Result := TFNRtlpNtQueryValueKey(_RtlpNtQueryValueKey)(
20663     KeyHandle, Type_, Data, DataSize, Unused
20664   );
20665 end;
20666 
20667 // Dynamic version of RtlpNtSetValueKey
20668 function  RtlpNtSetValueKey(
20669     KeyHandle : HANDLE;
20670     Type_ : ULONG;
20671     Data : PVOID;
20672     DataSize : ULONG
20673   ): NTSTATUS; stdcall;
20674 begin
20675   GetProcedureAddress(_RtlpNtSetValueKey, ntdll, 'RtlpNtSetValueKey');
20676   Result := TFNRtlpNtSetValueKey(_RtlpNtSetValueKey)(
20677     KeyHandle, Type_, Data, DataSize
20678   );
20679 end;
20680 
20681 // Dynamic version of RtlxAnsiStringToUnicodeSize
20682 function  RtlxAnsiStringToUnicodeSize(
20683     AnsiString : PANSI_STRING
20684   ): ULONG; stdcall;
20685 begin
20686   GetProcedureAddress(_RtlxAnsiStringToUnicodeSize, ntdll, 'RtlxAnsiStringToUnicodeSize');
20687   Result := TFNRtlxAnsiStringToUnicodeSize(_RtlxAnsiStringToUnicodeSize)(
20688     AnsiString
20689   );
20690 end;
20691 
20692 // Dynamic version of RtlxOemStringToUnicodeSize
20693 function  RtlxOemStringToUnicodeSize(
20694     AnsiString : POEM_STRING
20695   ): ULONG; stdcall;
20696 begin
20697   GetProcedureAddress(_RtlxOemStringToUnicodeSize, ntdll, 'RtlxOemStringToUnicodeSize');
20698   Result := TFNRtlxOemStringToUnicodeSize(_RtlxOemStringToUnicodeSize)(
20699     AnsiString
20700   );
20701 end;
20702 
20703 // Dynamic version of RtlxUnicodeStringToAnsiSize
20704 function  RtlxUnicodeStringToAnsiSize(
20705     UnicodeString : PUNICODE_STRING
20706   ): ULONG; stdcall;
20707 begin
20708   GetProcedureAddress(_RtlxUnicodeStringToAnsiSize, ntdll, 'RtlxUnicodeStringToAnsiSize');
20709   Result := TFNRtlxUnicodeStringToAnsiSize(_RtlxUnicodeStringToAnsiSize)(
20710     UnicodeString
20711   );
20712 end;
20713 
20714 // Dynamic version of RtlxUnicodeStringToOemSize
20715 function  RtlxUnicodeStringToOemSize(
20716     UnicodeString : PUNICODE_STRING
20717   ): ULONG; stdcall;
20718 begin
20719   GetProcedureAddress(_RtlxUnicodeStringToOemSize, ntdll, 'RtlxUnicodeStringToOemSize');
20720   Result := TFNRtlxUnicodeStringToOemSize(_RtlxUnicodeStringToOemSize)(
20721     UnicodeString
20722   );
20723 end;
20724 
20725 {$IFNDEF JWA_INCLUDEMODE}
20726 // Dynamic version of VerSetConditionMask
20727 function  VerSetConditionMask(
20728     ConditionMask : ULONGLONG;
20729     dwTypeMask : DWORD;
20730     Condition : BYTE
20731   ): ULONGLONG; stdcall;
20732 begin
20733   GetProcedureAddress(_VerSetConditionMask, ntdll, 'VerSetConditionMask');
20734   Result := TFNVerSetConditionMask(_VerSetConditionMask)(
20735     ConditionMask, dwTypeMask, Condition
20736   );
20737 end;
20738 {$ENDIF JWA_INCLUDEMODE}
20739 
20740 {$ENDIF RTDL}
20741 
20742 (*
20743 Function forwarders which are not implemented by this unit
20744 because they are available only on the 64bit editions of
20745 Windows XP and Windows 2003 Server.
20746 
20747 [KERNEL32.dll]RtlCaptureContext -> NTDLL.RtlCaptureContext
20748 [KERNEL32.dll]RtlCaptureStackBackTrace -> NTDLL.RtlCaptureStackBackTrace
20749 
20750 Usually the Kernel32 functions are documented in the Platform SDK, so knowing
20751 of these function forwarders gives you the chance to find out the prototype of
20752 the respective Native API to which the call is forwarded.
20753 
20754 The following usermode Native APIs are not included in this unit:
20755 -----------------------------------------------------------------
20756 CsrAllocateCaptureBuffer [NT3, NT4, W2K, WXP, 2K3]
20757 CsrAllocateMessagePointer [NT3, NT4, W2K, WXP, 2K3]
20758 CsrCaptureMessageBuffer [NT3, NT4, W2K, WXP, 2K3]
20759 CsrCaptureMessageMultiUnicodeStringsInPlace [WXP, 2K3]
20760 CsrCaptureMessageString [NT3, NT4, W2K, WXP, 2K3]
20761 CsrCaptureTimeout [NT3, NT4, W2K, WXP, 2K3]
20762 CsrClientCallServer [NT3, NT4, W2K, WXP, 2K3]
20763 CsrClientConnectToServer [NT3, NT4, W2K, WXP, 2K3]
20764 CsrFreeCaptureBuffer [NT3, NT4, W2K, WXP, 2K3]
20765 CsrIdentifyAlertableThread [NT3, NT4, W2K, WXP, 2K3]
20766 CsrNewThread [NT3, NT4, W2K, WXP, 2K3]
20767 CsrProbeForRead [NT3, NT4, W2K, WXP, 2K3]
20768 CsrProbeForWrite [NT3, NT4, W2K, WXP, 2K3]
20769 CsrSetPriorityClass [NT3, NT4, W2K, WXP, 2K3]
20770 DbgPrintEx [WXP, 2K3]
20771 DbgPrintReturnControlC [W2K, WXP, 2K3]
20772 DbgPrompt [NT3, NT4, W2K, WXP, 2K3]
20773 DbgSsHandleKmApiMsg [NT3, NT4, W2K]
20774 DbgSsInitialize [NT3, NT4, W2K]
20775 DbgUiConnectToDbg [NT3, NT4, W2K, WXP, 2K3]
20776 DbgUiContinue [NT3, NT4, W2K, WXP, 2K3]
20777 DbgUiConvertStateChangeStructure [WXP, 2K3]
20778 DbgUiDebugActiveProcess [WXP, 2K3]
20779 DbgUiGetThreadDebugObject [WXP, 2K3]
20780 DbgUiIssueRemoteBreakin [WXP, 2K3]
20781 DbgUiRemoteBreakin [WXP, 2K3]
20782 DbgUiSetThreadDebugObject [WXP, 2K3]
20783 DbgUiStopDebugging [WXP, 2K3]
20784 DbgUiWaitStateChange [NT3, NT4, W2K, WXP, 2K3]
20785 DbgUserBreakPoint [NT3, NT4, W2K, WXP, 2K3]
20786 EtwControlTraceA [2K3]
20787 EtwControlTraceW [2K3]
20788 EtwCreateTraceInstanceId [2K3]
20789 EtwEnableTrace [2K3]
20790 EtwEnumerateTraceGuids [2K3]
20791 EtwFlushTraceA [2K3]
20792 EtwFlushTraceW [2K3]
20793 EtwGetTraceEnableFlags [2K3]
20794 EtwGetTraceEnableLevel [2K3]
20795 EtwGetTraceLoggerHandle [2K3]
20796 EtwNotificationRegistrationA [2K3]
20797 EtwNotificationRegistrationW [2K3]
20798 EtwQueryAllTracesA [2K3]
20799 EtwQueryAllTracesW [2K3]
20800 EtwQueryTraceA [2K3]
20801 EtwQueryTraceW [2K3]
20802 EtwReceiveNotificationsA [2K3]
20803 EtwReceiveNotificationsW [2K3]
20804 EtwRegisterTraceGuidsA [2K3]
20805 EtwRegisterTraceGuidsW [2K3]
20806 EtwStartTraceA [2K3]
20807 EtwStartTraceW [2K3]
20808 EtwStopTraceA [2K3]
20809 EtwStopTraceW [2K3]
20810 EtwTraceEvent [2K3]
20811 EtwTraceEventInstance [2K3]
20812 EtwTraceMessage [2K3]
20813 EtwTraceMessageVa [2K3]
20814 EtwUnregisterTraceGuids [2K3]
20815 EtwUpdateTraceA [2K3]
20816 EtwUpdateTraceW [2K3]
20817 EtwpGetTraceBuffer [2K3]
20818 EtwpSetHWConfigFunction [2K3]
20819 KiUserApcDispatcher [NT3, NT4, W2K, WXP, 2K3]
20820 KiUserCallbackDispatcher [NT3, NT4, W2K, WXP, 2K3]
20821 KiUserExceptionDispatcher [NT3, NT4, W2K, WXP, 2K3]
20822 LdrAccessOutOfProcessResource [WXP, 2K3]
20823 LdrAddRefDll [WXP, 2K3]
20824 LdrCreateOutOfProcessImage [WXP, 2K3]
20825 LdrDestroyOutOfProcessImage [WXP, 2K3]
20826 LdrEnumResources [NT3, NT4, W2K, WXP, 2K3]
20827 LdrEnumerateLoadedModules [WXP, 2K3]
20828 LdrFindCreateProcessManifest [WXP, 2K3]
20829 LdrFindEntryForAddress [NT3, NT4, W2K, WXP, 2K3]
20830 LdrFindResourceDirectory_U [NT3, NT4, W2K, WXP, 2K3]
20831 LdrFindResourceEx_U [WXP, 2K3]
20832 LdrFindResource_U [NT3, NT4, W2K, WXP, 2K3]
20833 LdrFlushAlternateResourceModules [W2K, WXP, 2K3]
20834 LdrGetDllHandleEx [WXP, 2K3]
20835 LdrHotPatchRoutine [2K3]
20836 LdrInitShimEngineDynamic [WXP, 2K3]
20837 LdrInitializeThunk [NT3, NT4, W2K, WXP, 2K3]
20838 LdrLoadAlternateResourceModule [W2K, WXP, 2K3]
20839 LdrLockLoaderLock [WXP, 2K3]
20840 LdrProcessRelocationBlock [NT3, NT4, W2K, WXP, 2K3]
20841 LdrQueryImageFileExecutionOptionsEx [2K3]
20842 LdrSetAppCompatDllRedirectionCallback [WXP, 2K3]
20843 LdrSetDllManifestProber [WXP, 2K3]
20844 LdrUnloadAlternateResourceModule [W2K, WXP, 2K3]
20845 LdrUnlockLoaderLock [WXP, 2K3]
20846 LdrVerifyImageMatchesChecksum [NT3, NT4, W2K, WXP, 2K3]
20847 NPXEMULATORTABLE [NT3, NT4, W2K]
20848 NlsAnsiCodePage [NT4, W2K, WXP, 2K3]
20849 NlsMbCodePageTag [NT3, NT4, W2K, WXP, 2K3]
20850 NlsMbOemCodePageTag [NT3, NT4, W2K, WXP, 2K3]
20851 NtAddBootEntry [WXP, 2K3]
20852 NtAddDriverEntry [2K3]
20853 NtApphelpCacheControl [2K3]
20854 NtCompactKeys [WXP, 2K3]
20855 NtCompareTokens [WXP, 2K3]
20856 NtCompressKey [WXP, 2K3]
20857 NtCreateDebugObject [WXP, 2K3]
20858 NtCreateJobSet [WXP, 2K3]
20859 NtCreateKeyedEvent [WXP, 2K3]
20860 NtCreateProcessEx [WXP, 2K3]
20861 NtDebugContinue [WXP, 2K3]
20862 NtDeleteBootEntry [WXP, 2K3]
20863 NtDeleteDriverEntry [2K3]
20864 NtEnumerateBootEntries [WXP, 2K3]
20865 NtEnumerateDriverEntries [2K3]
20866 NtEnumerateSystemEnvironmentValuesEx [WXP, 2K3]
20867 NtIsProcessInJob [WXP, 2K3]
20868 NtLoadKeyEx [2K3]
20869 NtLockProductActivationKeys [WXP, 2K3]
20870 NtLockRegistryKey [WXP, 2K3]
20871 NtModifyBootEntry [WXP, 2K3]
20872 NtModifyDriverEntry [2K3]
20873 NtOpenKeyedEvent [WXP, 2K3]
20874 NtOpenProcessTokenEx [WXP, 2K3]
20875 NtOpenThreadTokenEx [WXP, 2K3]
20876 NtQueryBootEntryOrder [WXP, 2K3]
20877 NtQueryBootOptions [WXP, 2K3]
20878 NtQueryDebugFilterState [WXP, 2K3]
20879 NtQueryDriverEntryOrder [2K3]
20880 NtQueryOpenSubKeysEx [2K3]
20881 NtQuerySystemEnvironmentValueEx [WXP, 2K3]
20882 NtReleaseKeyedEvent [WXP, 2K3]
20883 NtRenameKey [WXP, 2K3]
20884 NtSetBootEntryOrder [WXP, 2K3]
20885 NtSetBootOptions [WXP, 2K3]
20886 NtSetDebugFilterState [WXP, 2K3]
20887 NtSetDriverEntryOrder [2K3]
20888 NtSetEventBoostPriority [WXP, 2K3]
20889 NtSetInformationDebugObject [WXP, 2K3]
20890 NtSetSystemEnvironmentValueEx [WXP, 2K3]
20891 NtTraceEvent [WXP, 2K3]
20892 NtTranslateFilePath [WXP, 2K3]
20893 NtUnloadKey2 [2K3]
20894 NtUnloadKeyEx [WXP, 2K3]
20895 NtWaitForDebugEvent [WXP, 2K3]
20896 NtWaitForKeyedEvent [WXP, 2K3]
20897 PfxFindPrefix [NT3, NT4, W2K, WXP, 2K3]
20898 PfxInitialize [NT3, NT4, W2K, WXP, 2K3]
20899 PfxInsertPrefix [NT3, NT4, W2K, WXP, 2K3]
20900 PfxRemovePrefix [NT3, NT4, W2K, WXP, 2K3]
20901 PropertyLengthAsVariant [NT4, W2K, WXP, 2K3]
20902 RestoreEm87Context [NT3, NT4, W2K, WXP, 2K3]
20903 RtlAbortRXact [NT3, NT4, W2K, WXP, 2K3]
20904 RtlAcquireResourceExclusive [NT3, NT4, W2K, WXP, 2K3]
20905 RtlAcquireResourceShared [NT3, NT4, W2K, WXP, 2K3]
20906 RtlActivateActivationContext [WXP, 2K3]
20907 RtlActivateActivationContextEx [WXP, 2K3]
20908 RtlActivateActivationContextUnsafeFast [WXP, 2K3]
20909 RtlAddAccessAllowedObjectAce [W2K, WXP, 2K3]
20910 RtlAddAccessDeniedObjectAce [W2K, WXP, 2K3]
20911 RtlAddActionToRXact [NT3, NT4, W2K, WXP, 2K3]
20912 RtlAddAtomToAtomTable [NT4, W2K, WXP, 2K3]
20913 RtlAddAttributeActionToRXact [NT3, NT4, W2K, WXP, 2K3]
20914 RtlAddAuditAccessObjectAce [W2K, WXP, 2K3]
20915 RtlAddCompoundAce [NT4, W2K, WXP, 2K3]
20916 RtlAddRefActivationContext [WXP, 2K3]
20917 RtlAddRefMemoryStream [WXP, 2K3]
20918 RtlAddressInSectionTable [WXP, 2K3]
20919 RtlAllocateHandle [NT4, W2K, WXP, 2K3]
20920 RtlAppendPathElement [WXP, 2K3]
20921 RtlApplicationVerifierStop [WXP, 2K3]
20922 RtlApplyRXact [NT3, NT4, W2K, WXP, 2K3]
20923 RtlApplyRXactNoFlush [NT3, NT4, W2K, WXP, 2K3]
20924 RtlAssert2 [WXP]
20925 RtlCallbackLpcClient [W2K]
20926 RtlCancelTimer [W2K, WXP, 2K3]
20927 RtlCaptureStackBackTrace [NT3, NT4, W2K, WXP, 2K3]
20928 RtlCaptureStackContext [WXP, 2K3]
20929 RtlCheckProcessParameters [WXP, 2K3]
20930 RtlCloneMemoryStream [WXP, 2K3]
20931 RtlCommitMemoryStream [WXP, 2K3]
20932 RtlCompressBuffer [NT3, NT4, W2K, WXP, 2K3]
20933 RtlComputeCrc32 [WXP, 2K3]
20934 RtlComputeImportTableHash [WXP, 2K3]
20935 RtlComputePrivatizedDllName_U [WXP, 2K3]
20936 RtlConsoleMultiByteToUnicodeN [NT3, NT4, W2K, WXP, 2K3]
20937 RtlConvertExclusiveToShared [NT3, NT4, W2K, WXP, 2K3]
20938 RtlConvertPropertyToVariant [NT4, W2K, WXP, 2K3]
20939 RtlConvertSharedToExclusive [NT3, NT4, W2K, WXP, 2K3]
20940 RtlConvertToAutoInheritSecurityObject [W2K, WXP, 2K3]
20941 RtlConvertUiListToApiList [NT3, NT4, W2K, WXP, 2K3]
20942 RtlConvertVariantToProperty [NT4, W2K, WXP, 2K3]
20943 RtlCopyLuidAndAttributesArray [NT3, NT4, W2K, WXP, 2K3]
20944 RtlCopyMappedMemory [2K3]
20945 RtlCopyMemoryStreamTo [WXP, 2K3]
20946 RtlCopyOutOfProcessMemoryStreamTo [WXP, 2K3]
20947 RtlCopySidAndAttributesArray [NT3, NT4, W2K, WXP, 2K3]
20948 RtlCreateActivationContext [WXP, 2K3]
20949 RtlCreateAndSetSD [NT3, NT4, W2K, WXP, 2K3]
20950 RtlCreateAtomTable [NT4, W2K, WXP, 2K3]
20951 RtlCreateBootStatusDataFile [WXP, 2K3]
20952 RtlCreateEnvironment [NT3, NT4, W2K, WXP, 2K3]
20953 RtlCreateLpcServer [W2K]
20954 RtlCreateSystemVolumeInformationFolder [WXP, 2K3]
20955 RtlCreateTagHeap [NT3, NT4, W2K, WXP, 2K3]
20956 RtlCreateTimer [W2K, WXP, 2K3]
20957 RtlCreateTimerQueue [W2K, WXP, 2K3]
20958 RtlCreateUserSecurityObject [NT3, NT4, W2K, WXP, 2K3]
20959 RtlCustomCPToUnicodeN [NT3, NT4, W2K, WXP, 2K3]
20960 RtlDeactivateActivationContext [WXP, 2K3]
20961 RtlDeactivateActivationContextUnsafeFast [WXP, 2K3]
20962 RtlDebugPrintTimes [W2K, WXP, 2K3]
20963 RtlDecompressBuffer [NT3, NT4, W2K, WXP, 2K3]
20964 RtlDecompressFragment [NT3, NT4, W2K, WXP, 2K3]
20965 RtlDefaultNpAcl [W2K, WXP, 2K3]
20966 RtlDeleteAtomFromAtomTable [NT4, W2K, WXP, 2K3]
20967 RtlDeleteElementGenericTable [NT3, NT4, W2K, WXP, 2K3]
20968 RtlDeleteElementGenericTableAvl [WXP, 2K3]
20969 RtlDeleteNoSplay [NT4, W2K, WXP, 2K3]
20970 RtlDeleteResource [NT3, NT4, W2K, WXP, 2K3]
20971 RtlDeleteSecurityObject [NT3, NT4, W2K, WXP, 2K3]
20972 RtlDeleteTimer [W2K, WXP, 2K3]
20973 RtlDeleteTimerQueue [W2K, WXP, 2K3]
20974 RtlDeleteTimerQueueEx [W2K, WXP, 2K3]
20975 RtlDeregisterWait [W2K, WXP, 2K3]
20976 RtlDeregisterWaitEx [W2K, WXP, 2K3]
20977 RtlDestroyAtomTable [NT4, W2K, WXP, 2K3]
20978 RtlDestroyEnvironment [NT3, NT4, W2K, WXP, 2K3]
20979 RtlDestroyHandleTable [NT4, W2K, WXP, 2K3]
20980 RtlDllShutdownInProgress [WXP, 2K3]
20981 RtlDosApplyFileIsolationRedirection_Ustr [WXP, 2K3]
20982 RtlDosPathNameToRelativeNtPathName_U [2K3]
20983 RtlDosSearchPath_Ustr [WXP, 2K3]
20984 RtlDumpResource [NT3, NT4, W2K, WXP, 2K3]
20985 RtlEmptyAtomTable [NT4, W2K, WXP, 2K3]
20986 RtlEnumProcessHeaps [NT3, NT4, W2K, WXP, 2K3]
20987 RtlEnumerateGenericTable [NT3, NT4, W2K, WXP, 2K3]
20988 RtlEnumerateGenericTableAvl [WXP, 2K3]
20989 RtlEnumerateGenericTableLikeADirectory [WXP, 2K3]
20990 RtlEnumerateGenericTableWithoutSplaying [NT3, NT4, W2K, WXP, 2K3]
20991 RtlEnumerateGenericTableWithoutSplayingAvl [WXP, 2K3]
20992 RtlExitUserThread [WXP, 2K3]
20993 RtlExtendHeap [NT3, NT4, W2K, WXP, 2K3]
20994 RtlFinalReleaseOutOfProcessMemoryStream [WXP, 2K3]
20995 RtlFindActivationContextSectionGuid [WXP, 2K3]
20996 RtlFindActivationContextSectionString [WXP, 2K3]
20997 RtlFindClearRuns [WXP, 2K3]
20998 RtlFindMessage [NT3, NT4, W2K, WXP, 2K3]
20999 RtlFirstEntrySList [WXP, 2K3]
21000 RtlFlushSecureMemoryCache [WXP, 2K3]
21001 RtlFormatMessage [NT3, NT4, W2K, WXP, 2K3]
21002 RtlFreeHandle [NT4, W2K, WXP, 2K3]
21003 RtlFreeThreadActivationContextStack [WXP, 2K3]
21004 RtlFreeUserThreadStack [NT4, W2K, WXP, 2K3]
21005 RtlGenerate8dot3Name [NT3, NT4, W2K, WXP, 2K3]
21006 RtlGetActiveActivationContext [WXP, 2K3]
21007 RtlGetCompressionWorkSpaceSize [NT3, NT4, W2K, WXP, 2K3]
21008 RtlGetElementGenericTable [NT3, NT4, W2K, WXP, 2K3]
21009 RtlGetElementGenericTableAvl [WXP, 2K3]
21010 RtlGetFrame [WXP, 2K3]
21011 RtlGetFullPathName_UstrEx [2K3]
21012 RtlGetLengthWithoutLastFullDosOrNtPathElement [WXP, 2K3]
21013 RtlGetLengthWithoutTrailingPathSeperators [WXP, 2K3]
21014 RtlGetNativeSystemInformation [WXP, 2K3]
21015 RtlGetSecurityDescriptorRMControl [W2K, WXP, 2K3]
21016 RtlGetSetBootStatusData [WXP, 2K3]
21017 RtlGetThreadErrorMode [2K3]
21018 RtlGetUnloadEventTrace [2K3]
21019 RtlGetUserInfoHeap [NT3, NT4, W2K, WXP, 2K3]
21020 RtlHashUnicodeString [WXP, 2K3]
21021 RtlImpersonateLpcClient [W2K]
21022 RtlInitCodePageTable [NT3, NT4, W2K, WXP, 2K3]
21023 RtlInitMemoryStream [WXP, 2K3]
21024 RtlInitNlsTables [NT3, NT4, W2K, WXP, 2K3]
21025 RtlInitOutOfProcessMemoryStream [WXP, 2K3]
21026 RtlInitializeAtomPackage [NT4, W2K, WXP, 2K3]
21027 RtlInitializeContext [NT3, NT4, W2K, WXP, 2K3]
21028 RtlInitializeGenericTable [NT3, NT4, W2K, WXP, 2K3]
21029 RtlInitializeGenericTableAvl [WXP, 2K3]
21030 RtlInitializeHandleTable [NT4, W2K, WXP, 2K3]
21031 RtlInitializeRXact [NT3, NT4, W2K, WXP, 2K3]
21032 RtlInitializeResource [NT3, NT4, W2K, WXP, 2K3]
21033 RtlInsertElementGenericTable [NT3, NT4, W2K, WXP, 2K3]
21034 RtlInsertElementGenericTableAvl [WXP, 2K3]
21035 RtlInsertElementGenericTableFull [2K3]
21036 RtlInsertElementGenericTableFullAvl [2K3]
21037 RtlInterlockedCompareExchange64 [2K3]
21038 RtlInterlockedPushListSList [WXP, 2K3]
21039 RtlIpv4AddressToStringExA [2K3]
21040 RtlIpv4AddressToStringExW [2K3]
21041 RtlIpv4StringToAddressA [WXP, 2K3]
21042 RtlIpv4StringToAddressExA [2K3]
21043 RtlIpv4StringToAddressExW [2K3]
21044 RtlIpv4StringToAddressW [WXP, 2K3]
21045 RtlIpv6AddressToStringA [WXP, 2K3]
21046 RtlIpv6AddressToStringExA [2K3]
21047 RtlIpv6AddressToStringExW [2K3]
21048 RtlIpv6AddressToStringW [WXP, 2K3]
21049 RtlIpv6StringToAddressA [WXP, 2K3]
21050 RtlIpv6StringToAddressExA [2K3]
21051 RtlIpv6StringToAddressExW [2K3]
21052 RtlIpv6StringToAddressW [WXP, 2K3]
21053 RtlIsActivationContextActive [WXP, 2K3]
21054 RtlIsGenericTableEmpty [NT3, NT4, W2K, WXP, 2K3]
21055 RtlIsGenericTableEmptyAvl [WXP, 2K3]
21056 RtlIsThreadWithinLoaderCallout [WXP, 2K3]
21057 RtlIsValidHandle [NT4, W2K, WXP, 2K3]
21058 RtlIsValidIndexHandle [NT4, W2K, WXP, 2K3]
21059 RtlLockBootStatusData [WXP, 2K3]
21060 RtlLockMemoryStreamRegion [WXP, 2K3]
21061 RtlLogStackBackTrace [WXP, 2K3]
21062 RtlLookupAtomInAtomTable [NT4, W2K, WXP, 2K3]
21063 RtlLookupElementGenericTable [NT3, NT4, W2K, WXP, 2K3]
21064 RtlLookupElementGenericTableAvl [WXP, 2K3]
21065 RtlLookupElementGenericTableFull [2K3]
21066 RtlLookupElementGenericTableFullAvl [2K3]
21067 RtlMultiAppendUnicodeStringBuffer [WXP, 2K3]
21068 RtlMultiByteToUnicodeN [NT3, NT4, W2K, WXP, 2K3]
21069 RtlMultiByteToUnicodeSize [NT3, NT4, W2K, WXP, 2K3]
21070 RtlMultipleAllocateHeap [2K3]
21071 RtlMultipleFreeHeap [2K3]
21072 RtlNewInstanceSecurityObject [NT3, NT4, W2K, WXP, 2K3]
21073 RtlNewSecurityGrantedAccess [NT3, NT4, W2K, WXP, 2K3]
21074 RtlNewSecurityObject [NT3, NT4, W2K, WXP, 2K3]
21075 RtlNewSecurityObjectEx [W2K, WXP, 2K3]
21076 RtlNewSecurityObjectWithMultipleInheritance [WXP, 2K3]
21077 RtlNtPathNameToDosPathName [WXP, 2K3]
21078 RtlNumberGenericTableElements [NT3, NT4, W2K, WXP, 2K3]
21079 RtlNumberGenericTableElementsAvl [WXP, 2K3]
21080 RtlPcToFileHeader [NT3, NT4, W2K, WXP, 2K3]
21081 RtlPinAtomInAtomTable [NT4, W2K, WXP, 2K3]
21082 RtlPopFrame [WXP, 2K3]
21083 RtlProtectHeap [NT3, NT4, W2K, WXP, 2K3]
21084 RtlPushFrame [WXP, 2K3]
21085 RtlQueryAtomInAtomTable [NT4, W2K, WXP, 2K3]
21086 RtlQueryHeapInformation [W2K, WXP, 2K3]
21087 RtlQueryInformationActivationContext [WXP, 2K3]
21088 RtlQueryInformationActiveActivationContext [WXP, 2K3]
21089 RtlQueryInterfaceMemoryStream [WXP, 2K3]
21090 RtlQueryProcessBackTraceInformation [NT3, NT4, W2K, WXP, 2K3]
21091 RtlQueryProcessHeapInformation [NT3, NT4, W2K, WXP, 2K3]
21092 RtlQueryProcessLockInformation [NT3, NT4, W2K, WXP, 2K3]
21093 RtlQuerySecurityObject [NT3, NT4, W2K, WXP, 2K3]
21094 RtlQueryTagHeap [NT3, NT4, W2K, WXP, 2K3]
21095 RtlQueryTimeZoneInformation [NT3, NT4, W2K, WXP, 2K3]
21096 RtlQueueApcWow64Thread [WXP, 2K3]
21097 RtlQueueWorkItem [W2K, WXP, 2K3]
21098 RtlRaiseException [NT3, NT4, W2K, WXP, 2K3]
21099 RtlReadMemoryStream [WXP, 2K3]
21100 RtlReadOutOfProcessMemoryStream [WXP, 2K3]
21101 RtlRealPredecessor [NT3, NT4, W2K, WXP, 2K3]
21102 RtlRealSuccessor [NT3, NT4, W2K, WXP, 2K3]
21103 RtlRegisterSecureMemoryCacheCallback [WXP, 2K3]
21104 RtlRegisterWait [W2K, WXP, 2K3]
21105 RtlReleaseActivationContext [WXP, 2K3]
21106 RtlReleaseMemoryStream [WXP, 2K3]
21107 RtlReleaseRelativeName [2K3]
21108 RtlReleaseResource [NT3, NT4, W2K, WXP, 2K3]
21109 RtlRemoteCall [NT3, NT4, W2K, WXP, 2K3]
21110 RtlResetRtlTranslations [NT3, NT4, W2K, WXP, 2K3]
21111 RtlRevertMemoryStream [WXP, 2K3]
21112 RtlSeekMemoryStream [WXP, 2K3]
21113 RtlSelfRelativeToAbsoluteSD2 [W2K, WXP, 2K3]
21114 RtlSetAttributesSecurityDescriptor [NT4, W2K, WXP, 2K3]
21115 RtlSetCurrentEnvironment [NT3, NT4, W2K, WXP, 2K3]
21116 RtlSetEnvironmentStrings [2K3]
21117 RtlSetEnvironmentVariable [NT3, NT4, W2K, WXP, 2K3]
21118 RtlSetHeapInformation [W2K, WXP, 2K3]
21119 RtlSetIoCompletionCallback [W2K, WXP, 2K3]
21120 RtlSetMemoryStreamSize [WXP, 2K3]
21121 RtlSetSecurityDescriptorRMControl [W2K, WXP, 2K3]
21122 RtlSetSecurityObject [NT3, NT4, W2K, WXP, 2K3]
21123 RtlSetSecurityObjectEx [W2K, WXP, 2K3]
21124 RtlSetThreadErrorMode [2K3]
21125 RtlSetThreadPoolStartFunc [W2K, WXP, 2K3]
21126 RtlSetTimeZoneInformation [NT3, NT4, W2K, WXP, 2K3]
21127 RtlSetTimer [W2K, WXP, 2K3]
21128 RtlSetUnicodeCallouts [NT4, W2K, WXP, 2K3]
21129 RtlSetUserFlagsHeap [NT3, NT4, W2K, WXP, 2K3]
21130 RtlSetUserValueHeap [NT3, NT4, W2K, WXP, 2K3]
21131 RtlShutdownLpcServer [W2K]
21132 RtlSplay [NT3, NT4, W2K, WXP, 2K3]
21133 RtlStartRXact [NT3, NT4, W2K, WXP, 2K3]
21134 RtlStatMemoryStream [WXP, 2K3]
21135 RtlSubtreePredecessor [NT3, NT4, W2K, WXP, 2K3]
21136 RtlSubtreeSuccessor [NT3, NT4, W2K, WXP, 2K3]
21137 RtlTraceDatabaseAdd [W2K, WXP, 2K3]
21138 RtlTraceDatabaseCreate [W2K, WXP, 2K3]
21139 RtlTraceDatabaseDestroy [W2K, WXP, 2K3]
21140 RtlTraceDatabaseEnumerate [W2K, WXP, 2K3]
21141 RtlTraceDatabaseFind [W2K, WXP, 2K3]
21142 RtlTraceDatabaseLock [W2K, WXP, 2K3]
21143 RtlTraceDatabaseUnlock [W2K, WXP, 2K3]
21144 RtlTraceDatabaseValidate [W2K, WXP, 2K3]
21145 RtlUnhandledExceptionFilter [WXP, 2K3]
21146 RtlUnhandledExceptionFilter2 [WXP, 2K3]
21147 RtlUnicodeToCustomCPN [NT3, NT4, W2K, WXP, 2K3]
21148 RtlUnicodeToMultiByteN [NT3, NT4, W2K, WXP, 2K3]
21149 RtlUnicodeToOemN [NT3, NT4, W2K, WXP, 2K3]
21150 RtlUnlockBootStatusData [WXP, 2K3]
21151 RtlUnlockHeap [NT3, NT4, W2K, WXP, 2K3]
21152 RtlUnlockMemoryStreamRegion [WXP, 2K3]
21153 RtlUpcaseUnicodeToCustomCPN [NT3, NT4, W2K, WXP, 2K3]
21154 RtlUpdateTimer [W2K, WXP, 2K3]
21155 RtlUsageHeap [NT3, NT4, W2K, WXP, 2K3]
21156 RtlValidateProcessHeaps [NT3, NT4, W2K, WXP, 2K3]
21157 RtlWalkFrameChain [W2K, WXP, 2K3]
21158 RtlWalkHeap [NT3, NT4, W2K, WXP, 2K3]
21159 RtlWow64EnableFsRedirection [2K3]
21160 RtlWriteMemoryStream [WXP, 2K3]
21161 RtlZombifyActivationContext [WXP, 2K3]
21162 RtlpApplyLengthFunction [WXP, 2K3]
21163 RtlpEnsureBufferSize [WXP, 2K3]
21164 RtlpUnWaitCriticalSection [NT3, NT4, W2K, WXP, 2K3]
21165 RtlpWaitForCriticalSection [NT3, NT4, W2K, WXP, 2K3]
21166 SaveEm87Context [NT3, NT4, W2K, WXP, 2K3]
21167 ZwAddBootEntry [WXP, 2K3]
21168 ZwAddDriverEntry [2K3]
21169 ZwApphelpCacheControl [2K3]
21170 ZwCompactKeys [WXP, 2K3]
21171 ZwCompareTokens [WXP, 2K3]
21172 ZwCompressKey [WXP, 2K3]
21173 ZwCreateDebugObject [WXP, 2K3]
21174 ZwCreateJobSet [WXP, 2K3]
21175 ZwCreateKeyedEvent [WXP, 2K3]
21176 ZwCreateProcessEx [WXP, 2K3]
21177 ZwDebugContinue [WXP, 2K3]
21178 ZwDeleteBootEntry [WXP, 2K3]
21179 ZwDeleteDriverEntry [2K3]
21180 ZwEnumerateBootEntries [WXP, 2K3]
21181 ZwEnumerateDriverEntries [2K3]
21182 ZwEnumerateSystemEnvironmentValuesEx [WXP, 2K3]
21183 ZwIsProcessInJob [WXP, 2K3]
21184 ZwLoadKeyEx [2K3]
21185 ZwLockProductActivationKeys [WXP, 2K3]
21186 ZwLockRegistryKey [WXP, 2K3]
21187 ZwModifyBootEntry [WXP, 2K3]
21188 ZwModifyDriverEntry [2K3]
21189 ZwOpenKeyedEvent [WXP, 2K3]
21190 ZwOpenProcessTokenEx [WXP, 2K3]
21191 ZwOpenThreadTokenEx [WXP, 2K3]
21192 ZwQueryBootEntryOrder [WXP, 2K3]
21193 ZwQueryBootOptions [WXP, 2K3]
21194 ZwQueryDebugFilterState [WXP, 2K3]
21195 ZwQueryDriverEntryOrder [2K3]
21196 ZwQueryOpenSubKeysEx [2K3]
21197 ZwQuerySystemEnvironmentValueEx [WXP, 2K3]
21198 ZwReleaseKeyedEvent [WXP, 2K3]
21199 ZwRenameKey [WXP, 2K3]
21200 ZwSetBootEntryOrder [WXP, 2K3]
21201 ZwSetBootOptions [WXP, 2K3]
21202 ZwSetDebugFilterState [WXP, 2K3]
21203 ZwSetDriverEntryOrder [2K3]
21204 ZwSetEventBoostPriority [WXP, 2K3]
21205 ZwSetInformationDebugObject [WXP, 2K3]
21206 ZwSetSystemEnvironmentValueEx [WXP, 2K3]
21207 ZwTraceEvent [WXP, 2K3]
21208 ZwTranslateFilePath [WXP, 2K3]
21209 ZwUnloadKey2 [2K3]
21210 ZwUnloadKeyEx [WXP, 2K3]
21211 ZwWaitForDebugEvent [WXP, 2K3]
21212 ZwWaitForKeyedEvent [WXP, 2K3]
21213 
21214  +  457 (35.90%) not yet declared
21215  +  816 (64.10%) declared already
21216  = 1273 (100.00%) relevant functions overall
21217 
21218 
21219 The following usermode Native APIs are considered deprecated
21220 since they are only available in NT3 or NT4 only or in NT3/NT4
21221 only. Hence they are considered irrelevant. These are:
21222 -----------------------------------------------------------------
21223 CsrAllocateCapturePointer [NT3, NT4]
21224 CsrClientMaxMessage [NT3]
21225 CsrClientSendMessage [NT3]
21226 CsrClientThreadConnect [NT3]
21227 CsrpProcessCallbackRequest [NT3]
21228 NtEnumerateBus [NT3]
21229 NtQueryOleDirectoryFile [NT4]
21230 NtRegisterNewDevice [NT3]
21231 NtReleaseProcessMutant [NT3]
21232 NtWaitForProcessMutant [NT3]
21233 RtlClosePropertySet [NT4]
21234 RtlCompareVariants [NT4]
21235 RtlCreatePropertySet [NT4]
21236 RtlEnumerateProperties [NT4]
21237 RtlFindLongestRunSet [NT3, NT4]
21238 RtlFlushPropertySet [NT4]
21239 RtlGuidToPropertySetName [NT4]
21240 RtlOnMappedStreamEvent [NT4]
21241 RtlPropertySetNameToGuid [NT4]
21242 RtlQueryProperties [NT4]
21243 RtlQueryPropertyNames [NT4]
21244 RtlQueryPropertySet [NT4]
21245 RtlSetProperties [NT4]
21246 RtlSetPropertyNames [NT4]
21247 RtlSetPropertySetClassId [NT4]
21248 RtlpInitializeRtl [NT3]
21249 ZwEnumerateBus [NT3]
21250 ZwQueryOleDirectoryFile [NT4]
21251 ZwRegisterNewDevice [NT3]
21252 ZwReleaseProcessMutant [NT3]
21253 ZwWaitForProcessMutant [NT3]
21254 
21255  = 31 deprecated functions
21256 *)
21257 {$ENDIF JWA_INTERFACESECTION}
21258 
21259 {$IFNDEF JWA_OMIT_SECTIONS}
21260 end.
21261 {$ENDIF JWA_OMIT_SECTIONS}
21262 
21263