rpcrt4: Fix some memory leaks in the cstub tests.
[wine] / include / winternl.h
1 /*
2  * Internal NT APIs and data structures
3  *
4  * Copyright (C) the Wine project
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_WINTERNL_H
22 #define __WINE_WINTERNL_H
23
24 #include <windef.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* defined(__cplusplus) */
29
30
31 /**********************************************************************
32  * Fundamental types and data structures
33  */
34
35 #ifndef WINE_NTSTATUS_DECLARED
36 #define WINE_NTSTATUS_DECLARED
37 typedef LONG NTSTATUS;
38 #endif
39
40 typedef CONST char *PCSZ;
41
42 typedef short CSHORT;
43 typedef CSHORT *PCSHORT;
44
45 #ifndef __STRING_DEFINED__
46 #define __STRING_DEFINED__
47 typedef struct _STRING {
48   USHORT Length;
49   USHORT MaximumLength;
50   PCHAR Buffer;
51 } STRING, *PSTRING;
52 #endif
53
54 typedef STRING ANSI_STRING;
55 typedef PSTRING PANSI_STRING;
56 typedef const STRING *PCANSI_STRING;
57
58 typedef STRING OEM_STRING;
59 typedef PSTRING POEM_STRING;
60 typedef const STRING *PCOEM_STRING;
61
62 #ifndef __UNICODE_STRING_DEFINED__
63 #define __UNICODE_STRING_DEFINED__
64 typedef struct _UNICODE_STRING {
65   USHORT Length;        /* bytes */
66   USHORT MaximumLength; /* bytes */
67   PWSTR  Buffer;
68 } UNICODE_STRING, *PUNICODE_STRING;
69 #endif
70
71 typedef const UNICODE_STRING *PCUNICODE_STRING;
72
73 #ifndef _FILETIME_
74 #define _FILETIME_
75 /* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */
76 typedef struct _FILETIME
77 {
78 #ifdef WORDS_BIGENDIAN
79   DWORD  dwHighDateTime;
80   DWORD  dwLowDateTime;
81 #else
82   DWORD  dwLowDateTime;
83   DWORD  dwHighDateTime;
84 #endif
85 } FILETIME, *PFILETIME, *LPFILETIME;
86 #endif /* _FILETIME_ */
87
88 /*
89  * RTL_SYSTEM_TIME and RTL_TIME_ZONE_INFORMATION are the same as
90  * the SYSTEMTIME and TIME_ZONE_INFORMATION structures defined
91  * in winbase.h, however we need to define them separately so
92  * winternl.h doesn't depend on winbase.h.  They are used by
93  * RtlQueryTimeZoneInformation and RtlSetTimeZoneInformation.
94  * The names are guessed; if anybody knows the real names, let me know.
95  */
96 typedef struct _RTL_SYSTEM_TIME {
97     WORD wYear;
98     WORD wMonth;
99     WORD wDayOfWeek;
100     WORD wDay;
101     WORD wHour;
102     WORD wMinute;
103     WORD wSecond;
104     WORD wMilliseconds;
105 } RTL_SYSTEM_TIME, *PRTL_SYSTEM_TIME;
106
107 typedef struct _RTL_TIME_ZONE_INFORMATION {
108     LONG Bias;
109     WCHAR StandardName[32];
110     RTL_SYSTEM_TIME StandardDate;
111     LONG StandardBias;
112     WCHAR DaylightName[32];
113     RTL_SYSTEM_TIME DaylightDate;
114     LONG DaylightBias;
115 } RTL_TIME_ZONE_INFORMATION, *PRTL_TIME_ZONE_INFORMATION;
116
117 typedef struct _CLIENT_ID
118 {
119    HANDLE UniqueProcess;
120    HANDLE UniqueThread;
121 } CLIENT_ID, *PCLIENT_ID;
122
123 typedef struct _CURDIR
124 {
125     UNICODE_STRING DosPath;
126     PVOID Handle;
127 } CURDIR, *PCURDIR;
128
129 typedef struct RTL_DRIVE_LETTER_CURDIR
130 {
131     USHORT              Flags;
132     USHORT              Length;
133     ULONG               TimeStamp;
134     UNICODE_STRING      DosPath;
135 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
136
137 typedef struct tagRTL_BITMAP {
138     ULONG  SizeOfBitMap; /* Number of bits in the bitmap */
139     PULONG Buffer; /* Bitmap data, assumed sized to a DWORD boundary */
140 } RTL_BITMAP, *PRTL_BITMAP;
141
142 typedef const RTL_BITMAP *PCRTL_BITMAP;
143
144 typedef struct tagRTL_BITMAP_RUN {
145     ULONG StartingIndex; /* Bit position at which run starts */
146     ULONG NumberOfBits;  /* Size of the run in bits */
147 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
148
149 typedef const RTL_BITMAP_RUN *PCRTL_BITMAP_RUN;
150
151 typedef struct _RTL_USER_PROCESS_PARAMETERS
152 {
153     ULONG               AllocationSize;
154     ULONG               Size;
155     ULONG               Flags;
156     ULONG               DebugFlags;
157     HANDLE              ConsoleHandle;
158     ULONG               ConsoleFlags;
159     HANDLE              hStdInput;
160     HANDLE              hStdOutput;
161     HANDLE              hStdError;
162     CURDIR              CurrentDirectory;
163     UNICODE_STRING      DllPath;
164     UNICODE_STRING      ImagePathName;
165     UNICODE_STRING      CommandLine;
166     PWSTR               Environment;
167     ULONG               dwX;
168     ULONG               dwY;
169     ULONG               dwXSize;
170     ULONG               dwYSize;
171     ULONG               dwXCountChars;
172     ULONG               dwYCountChars;
173     ULONG               dwFillAttribute;
174     ULONG               dwFlags;
175     ULONG               wShowWindow;
176     UNICODE_STRING      WindowTitle;
177     UNICODE_STRING      Desktop;
178     UNICODE_STRING      ShellInfo;
179     UNICODE_STRING      RuntimeInfo;
180     RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
181 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
182
183 /* value for Flags field (FIXME: not the correct name) */
184 #define PROCESS_PARAMS_FLAG_NORMALIZED 1
185
186 typedef struct _PEB_LDR_DATA
187 {
188     ULONG               Length;
189     BOOLEAN             Initialized;
190     PVOID               SsHandle;
191     LIST_ENTRY          InLoadOrderModuleList;
192     LIST_ENTRY          InMemoryOrderModuleList;
193     LIST_ENTRY          InInitializationOrderModuleList;
194 } PEB_LDR_DATA, *PPEB_LDR_DATA;
195
196 typedef struct _GDI_TEB_BATCH
197 {
198     ULONG  Offset;
199     HANDLE HDC;
200     ULONG  Buffer[0x136];
201 } GDI_TEB_BATCH;
202
203 typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME
204 {
205     struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME *Previous;
206     struct _ACTIVATION_CONTEXT                 *ActivationContext;
207     ULONG                                       Flags;
208 } RTL_ACTIVATION_CONTEXT_STACK_FRAME, *PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
209
210 typedef struct _ACTIVATION_CONTEXT_STACK
211 {
212     ULONG                               Flags;
213     ULONG                               NextCookieSequenceNumber;
214     RTL_ACTIVATION_CONTEXT_STACK_FRAME *ActiveFrame;
215     LIST_ENTRY                          FrameListCache;
216 } ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK;
217
218 /***********************************************************************
219  * PEB data structure
220  */
221 typedef struct _PEB
222 {                                                                 /* win32/win64 */
223     BOOLEAN                      InheritedAddressSpace;             /* 000/000 */
224     BOOLEAN                      ReadImageFileExecOptions;          /* 001/001 */
225     BOOLEAN                      BeingDebugged;                     /* 002/002 */
226     BOOLEAN                      SpareBool;                         /* 003/003 */
227     HANDLE                       Mutant;                            /* 004/008 */
228     HMODULE                      ImageBaseAddress;                  /* 008/010 */
229     PPEB_LDR_DATA                LdrData;                           /* 00c/018 */
230     RTL_USER_PROCESS_PARAMETERS *ProcessParameters;                 /* 010/020 */
231     PVOID                        SubSystemData;                     /* 014/028 */
232     HANDLE                       ProcessHeap;                       /* 018/030 */
233     PRTL_CRITICAL_SECTION        FastPebLock;                       /* 01c/038 */
234     PVOID /*PPEBLOCKROUTINE*/    FastPebLockRoutine;                /* 020/040 */
235     PVOID /*PPEBLOCKROUTINE*/    FastPebUnlockRoutine;              /* 024/048 */
236     ULONG                        EnvironmentUpdateCount;            /* 028/050 */
237     PVOID                        KernelCallbackTable;               /* 02c/058 */
238     ULONG                        Reserved[2];                       /* 030/060 */
239     PVOID /*PPEB_FREE_BLOCK*/    FreeList;                          /* 038/068 */
240     ULONG                        TlsExpansionCounter;               /* 03c/070 */
241     PRTL_BITMAP                  TlsBitmap;                         /* 040/078 */
242     ULONG                        TlsBitmapBits[2];                  /* 044/080 */
243     PVOID                        ReadOnlySharedMemoryBase;          /* 04c/088 */
244     PVOID                        ReadOnlySharedMemoryHeap;          /* 050/090 */
245     PVOID                       *ReadOnlyStaticServerData;          /* 054/098 */
246     PVOID                        AnsiCodePageData;                  /* 058/0a0 */
247     PVOID                        OemCodePageData;                   /* 05c/0a8 */
248     PVOID                        UnicodeCaseTableData;              /* 060/0b0 */
249     ULONG                        NumberOfProcessors;                /* 064/0b8 */
250     ULONG                        NtGlobalFlag;                      /* 068/0bc */
251     LARGE_INTEGER                CriticalSectionTimeout;            /* 070/0c0 */
252     SIZE_T                       HeapSegmentReserve;                /* 078/0c8 */
253     SIZE_T                       HeapSegmentCommit;                 /* 07c/0d0 */
254     SIZE_T                       HeapDeCommitTotalFreeThreshold;    /* 080/0d8 */
255     SIZE_T                       HeapDeCommitFreeBlockThreshold;    /* 084/0e0 */
256     ULONG                        NumberOfHeaps;                     /* 088/0e8 */
257     ULONG                        MaximumNumberOfHeaps;              /* 08c/0ec */
258     PVOID                       *ProcessHeaps;                      /* 090/0f0 */
259     PVOID                        GdiSharedHandleTable;              /* 094/0f8 */
260     PVOID                        ProcessStarterHelper;              /* 098/100 */
261     PVOID                        GdiDCAttributeList;                /* 09c/108 */
262     PVOID                        LoaderLock;                        /* 0a0/110 */
263     ULONG                        OSMajorVersion;                    /* 0a4/118 */
264     ULONG                        OSMinorVersion;                    /* 0a8/11c */
265     ULONG                        OSBuildNumber;                     /* 0ac/120 */
266     ULONG                        OSPlatformId;                      /* 0b0/124 */
267     ULONG                        ImageSubSystem;                    /* 0b4/128 */
268     ULONG                        ImageSubSystemMajorVersion;        /* 0b8/12c */
269     ULONG                        ImageSubSystemMinorVersion;        /* 0bc/130 */
270     ULONG                        ImageProcessAffinityMask;          /* 0c0/134 */
271     HANDLE                       GdiHandleBuffer[28];               /* 0c4/138 */
272     ULONG                        unknown[6];                        /* 134/218 */
273     PVOID                        PostProcessInitRoutine;            /* 14c/230 */
274     PRTL_BITMAP                  TlsExpansionBitmap;                /* 150/238 */
275     ULONG                        TlsExpansionBitmapBits[32];        /* 154/240 */
276     ULONG                        SessionId;                         /* 1d4/2c0 */
277     ULARGE_INTEGER               AppCompatFlags;                    /* 1d8/2c8 */
278     ULARGE_INTEGER               AppCompatFlagsUser;                /* 1e0/2d0 */
279     PVOID                        ShimData;                          /* 1e8/2d8 */
280     PVOID                        AppCompatInfo;                     /* 1ec/2e0 */
281     UNICODE_STRING               CSDVersion;                        /* 1f0/2e8 */
282     PVOID                        ActivationContextData;             /* 1f8/2f8 */
283     PVOID                        ProcessAssemblyStorageMap;         /* 1fc/300 */
284     PVOID                        SystemDefaultActivationData;       /* 200/308 */
285     PVOID                        SystemAssemblyStorageMap;          /* 204/310 */
286     SIZE_T                       MinimumStackCommit;                /* 208/318 */
287     PVOID                       *FlsCallback;                       /* 20c/320 */
288     LIST_ENTRY                   FlsListHead;                       /* 210/328 */
289     PRTL_BITMAP                  FlsBitmap;                         /* 218/338 */
290     ULONG                        FlsBitmapBits[4];                  /* 21c/340 */
291 } PEB, *PPEB;
292
293
294 /***********************************************************************
295  * TEB data structure
296  */
297 typedef struct _TEB
298 {                                                                 /* win32/win64 */
299     NT_TIB                       Tib;                               /* 000/0000 */
300     PVOID                        EnvironmentPointer;                /* 01c/0038 */
301     CLIENT_ID                    ClientId;                          /* 020/0040 */
302     PVOID                        ActiveRpcHandle;                   /* 028/0050 */
303     PVOID                        ThreadLocalStoragePointer;         /* 02c/0058 */
304     PPEB                         Peb;                               /* 030/0060 */
305     ULONG                        LastErrorValue;                    /* 034/0068 */
306     ULONG                        CountOfOwnedCriticalSections;      /* 038/006c */
307     PVOID                        CsrClientThread;                   /* 03c/0070 */
308     PVOID                        Win32ThreadInfo;                   /* 040/0078 */
309     ULONG                        Win32ClientInfo[31];               /* 044/0080 used for user32 private data in Wine */
310     PVOID                        WOW32Reserved;                     /* 0c0/0100 */
311     ULONG                        CurrentLocale;                     /* 0c4/0108 */
312     ULONG                        FpSoftwareStatusRegister;          /* 0c8/010c */
313     PVOID                        SystemReserved1[54];               /* 0cc/0110 used for kernel32 private data in Wine */
314     LONG                         ExceptionCode;                     /* 1a4/02c0 */
315     ACTIVATION_CONTEXT_STACK     ActivationContextStack;            /* 1a8/02c8 */
316     BYTE                         SpareBytes1[24];                   /* 1bc/02e8 used for ntdll private data in Wine */
317     PVOID                        SystemReserved2[10];               /* 1d4/0300 used for ntdll private data in Wine */
318     GDI_TEB_BATCH                GdiTebBatch;                       /* 1fc/0350 used for vm86 private data in Wine */
319     HANDLE                       gdiRgn;                            /* 6dc/0838 */
320     HANDLE                       gdiPen;                            /* 6e0/0840 */
321     HANDLE                       gdiBrush;                          /* 6e4/0848 */
322     CLIENT_ID                    RealClientId;                      /* 6e8/0850 */
323     HANDLE                       GdiCachedProcessHandle;            /* 6f0/0860 */
324     ULONG                        GdiClientPID;                      /* 6f4/0868 */
325     ULONG                        GdiClientTID;                      /* 6f8/086c */
326     PVOID                        GdiThreadLocaleInfo;               /* 6fc/0870 */
327     ULONG                        UserReserved[5];                   /* 700/0878 */
328     PVOID                        glDispachTable[280];               /* 714/0890 */
329     PVOID                        glReserved1[26];                   /* b74/1150 */
330     PVOID                        glReserved2;                       /* bdc/1220 */
331     PVOID                        glSectionInfo;                     /* be0/1228 */
332     PVOID                        glSection;                         /* be4/1230 */
333     PVOID                        glTable;                           /* be8/1238 */
334     PVOID                        glCurrentRC;                       /* bec/1240 */
335     PVOID                        glContext;                         /* bf0/1248 */
336     ULONG                        LastStatusValue;                   /* bf4/1250 */
337     UNICODE_STRING               StaticUnicodeString;               /* bf8/1258 used by advapi32 */
338     WCHAR                        StaticUnicodeBuffer[261];          /* c00/1268 used by advapi32 */
339     PVOID                        DeallocationStack;                 /* e0c/1478 */
340     PVOID                        TlsSlots[64];                      /* e10/1480 */
341     LIST_ENTRY                   TlsLinks;                          /* f10/1680 */
342     PVOID                        Vdm;                               /* f18/1690 */
343     PVOID                        ReservedForNtRpc;                  /* f1c/1698 */
344     PVOID                        DbgSsReserved[2];                  /* f20/16a0 */
345     ULONG                        HardErrorDisabled;                 /* f28/16b0 */
346     PVOID                        Instrumentation[16];               /* f2c/16b8 */
347     PVOID                        WinSockData;                       /* f6c/1738 */
348     ULONG                        GdiBatchCount;                     /* f70/1740 */
349     ULONG                        Spare2;                            /* f74/1744 */
350     PVOID                        Spare3;                            /* f78/1748 */
351     PVOID                        Spare4;                            /* f7c/1750 */
352     PVOID                        ReservedForOle;                    /* f80/1758 */
353     ULONG                        WaitingOnLoaderLock;               /* f84/1760 */
354     PVOID                        Reserved5[3];                      /* f88/1768 */
355     PVOID                       *TlsExpansionSlots;                 /* f94/1780 */
356     ULONG                        ImpersonationLocale;               /* f98/1788 */
357     ULONG                        IsImpersonating;                   /* f9c/178c */
358     PVOID                        NlsCache;                          /* fa0/1790 */
359     PVOID                        ShimData;                          /* fa4/1798 */
360     ULONG                        HeapVirtualAffinity;               /* fa8/17a0 */
361     PVOID                        CurrentTransactionHandle;          /* fac/17a8 */
362     PVOID                        ActiveFrame;                       /* fb0/17b0 */
363 #ifdef _WIN64
364     PVOID                        unknown[2];                        /*     17b8 */
365 #endif
366     PVOID                       *FlsSlots;                          /* fb4/17c8 */
367 } TEB, *PTEB;
368
369 /***********************************************************************
370  * Enums
371  */
372
373 typedef enum _FILE_INFORMATION_CLASS {
374     FileDirectoryInformation = 1,
375     FileFullDirectoryInformation,
376     FileBothDirectoryInformation,
377     FileBasicInformation,
378     FileStandardInformation,
379     FileInternalInformation,
380     FileEaInformation,
381     FileAccessInformation,
382     FileNameInformation,
383     FileRenameInformation,
384     FileLinkInformation,
385     FileNamesInformation,
386     FileDispositionInformation,
387     FilePositionInformation,
388     FileFullEaInformation,
389     FileModeInformation,
390     FileAlignmentInformation,
391     FileAllInformation,
392     FileAllocationInformation,
393     FileEndOfFileInformation,
394     FileAlternateNameInformation,
395     FileStreamInformation,
396     FilePipeInformation,
397     FilePipeLocalInformation,
398     FilePipeRemoteInformation,
399     FileMailslotQueryInformation,
400     FileMailslotSetInformation,
401     FileCompressionInformation,
402     FileObjectIdInformation,
403     FileCompletionInformation,
404     FileMoveClusterInformation,
405     FileQuotaInformation,
406     FileReparsePointInformation,
407     FileNetworkOpenInformation,
408     FileAttributeTagInformation,
409     FileTrackingInformation,
410     FileIdBothDirectoryInformation,
411     FileIdFullDirectoryInformation,
412     FileValidDataLengthInformation,
413     FileShortNameInformation = 40,
414     /* 41, 42, 43 undocumented */
415     FileSfioReserveInformation = 44,
416     FileSfioVolumeInformation = 45,
417     FileHardLinkInformation = 46,
418     /* 47 undocumented */
419     FileNormalizedNameInformation = 48,
420     /* 49 undocumented */
421     FileIdGlobalTxDirectoryInformation = 50,
422     /* 51, 52, 53 undocumented */
423     FileStandardLinkInformation = 54,
424     FileMaximumInformation
425 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
426
427 typedef struct _FILE_DIRECTORY_INFORMATION {
428     ULONG               NextEntryOffset;
429     ULONG               FileIndex;
430     LARGE_INTEGER       CreationTime;
431     LARGE_INTEGER       LastAccessTime;
432     LARGE_INTEGER       LastWriteTime;
433     LARGE_INTEGER       ChangeTime;
434     LARGE_INTEGER       EndOfFile;
435     LARGE_INTEGER       AllocationSize;
436     ULONG               FileAttributes;
437     ULONG               FileNameLength;
438     WCHAR               FileName[ANYSIZE_ARRAY];
439 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
440
441 typedef struct _FILE_FULL_DIRECTORY_INFORMATION {
442     ULONG               NextEntryOffset;
443     ULONG               FileIndex;
444     LARGE_INTEGER       CreationTime;
445     LARGE_INTEGER       LastAccessTime;
446     LARGE_INTEGER       LastWriteTime;
447     LARGE_INTEGER       ChangeTime;
448     LARGE_INTEGER       EndOfFile;
449     LARGE_INTEGER       AllocationSize;
450     ULONG               FileAttributes;
451     ULONG               FileNameLength;
452     ULONG               EaSize;
453     WCHAR               FileName[ANYSIZE_ARRAY];
454 } FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION,
455   FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
456
457 typedef struct _FILE_ID_FULL_DIRECTORY_INFORMATION {
458     ULONG               NextEntryOffset;
459     ULONG               FileIndex;
460     LARGE_INTEGER       CreationTime;
461     LARGE_INTEGER       LastAccessTime;
462     LARGE_INTEGER       LastWriteTime;
463     LARGE_INTEGER       ChangeTime;
464     LARGE_INTEGER       EndOfFile;
465     LARGE_INTEGER       AllocationSize;
466     ULONG               FileAttributes;
467     ULONG               FileNameLength;
468     ULONG               EaSize;
469     LARGE_INTEGER       FileId;
470     WCHAR               FileName[ANYSIZE_ARRAY];
471 } FILE_ID_FULL_DIRECTORY_INFORMATION, *PFILE_ID_FULL_DIRECTORY_INFORMATION;
472
473 typedef struct _FILE_BOTH_DIRECTORY_INFORMATION {
474     ULONG               NextEntryOffset;
475     ULONG               FileIndex;
476     LARGE_INTEGER       CreationTime;
477     LARGE_INTEGER       LastAccessTime;
478     LARGE_INTEGER       LastWriteTime;
479     LARGE_INTEGER       ChangeTime;
480     LARGE_INTEGER       EndOfFile;
481     LARGE_INTEGER       AllocationSize;
482     ULONG               FileAttributes;
483     ULONG               FileNameLength;
484     ULONG               EaSize;
485     CHAR                ShortNameLength;
486     WCHAR               ShortName[12];
487     WCHAR               FileName[ANYSIZE_ARRAY];
488 } FILE_BOTH_DIRECTORY_INFORMATION, *PFILE_BOTH_DIRECTORY_INFORMATION,
489   FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
490
491 typedef struct _FILE_ID_BOTH_DIRECTORY_INFORMATION {
492     ULONG               NextEntryOffset;
493     ULONG               FileIndex;
494     LARGE_INTEGER       CreationTime;
495     LARGE_INTEGER       LastAccessTime;
496     LARGE_INTEGER       LastWriteTime;
497     LARGE_INTEGER       ChangeTime;
498     LARGE_INTEGER       EndOfFile;
499     LARGE_INTEGER       AllocationSize;
500     ULONG               FileAttributes;
501     ULONG               FileNameLength;
502     ULONG               EaSize;
503     CHAR                ShortNameLength;
504     WCHAR               ShortName[12];
505     LARGE_INTEGER       FileId;
506     WCHAR               FileName[ANYSIZE_ARRAY];
507 } FILE_ID_BOTH_DIRECTORY_INFORMATION, *PFILE_ID_BOTH_DIRECTORY_INFORMATION;
508
509 typedef struct _FILE_BASIC_INFORMATION {
510     LARGE_INTEGER CreationTime;
511     LARGE_INTEGER LastAccessTime;
512     LARGE_INTEGER LastWriteTime;
513     LARGE_INTEGER ChangeTime;
514     ULONG FileAttributes;
515 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
516
517 typedef struct _FILE_STANDARD_INFORMATION {
518     LARGE_INTEGER AllocationSize;
519     LARGE_INTEGER EndOfFile;
520     ULONG NumberOfLinks;
521     BOOLEAN DeletePending;
522     BOOLEAN Directory;
523 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
524
525 typedef struct _FILE_INTERNAL_INFORMATION {
526     LARGE_INTEGER IndexNumber;
527 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
528
529 typedef struct _FILE_EA_INFORMATION {
530     ULONG EaSize;
531 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
532
533 typedef struct _FILE_ACCESS_INFORMATION {
534     ACCESS_MASK AccessFlags;
535 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
536
537 typedef struct _FILE_NAME_INFORMATION {
538     ULONG FileNameLength;
539     WCHAR FileName[1];
540 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
541
542 typedef struct _FILE_RENAME_INFORMATION {
543     BOOLEAN Replace;
544     HANDLE RootDir;
545     ULONG FileNameLength;
546     WCHAR FileName[1];
547 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
548
549 typedef struct _FILE_NAMES_INFORMATION {
550     ULONG NextEntryOffset;
551     ULONG FileIndex;
552     ULONG FileNameLength;
553     WCHAR FileName[1];
554 } FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
555
556 typedef struct _FILE_DISPOSITION_INFORMATION {
557     BOOLEAN DoDeleteFile;
558 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
559
560 typedef struct _FILE_POSITION_INFORMATION {
561     LARGE_INTEGER CurrentByteOffset;
562 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
563
564 typedef struct _FILE_ALIGNMENT_INFORMATION {
565     ULONG AlignmentRequirement;
566 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
567
568 typedef struct _FILE_ALLOCATION_INFORMATION {
569     LARGE_INTEGER AllocationSize;
570 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
571
572 typedef struct _FILE_END_OF_FILE_INFORMATION {
573     LARGE_INTEGER EndOfFile;
574 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
575
576 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
577     LARGE_INTEGER CreationTime;
578     LARGE_INTEGER LastAccessTime;
579     LARGE_INTEGER LastWriteTime;
580     LARGE_INTEGER ChangeTime;
581     LARGE_INTEGER AllocationSize;
582     LARGE_INTEGER EndOfFile;
583     ULONG FileAttributes;
584 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
585
586 typedef struct _FILE_FULL_EA_INFORMATION {
587     ULONG NextEntryOffset;
588     UCHAR Flags;
589     UCHAR EaNameLength;
590     USHORT EaValueLength;
591     CHAR EaName[1];
592 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
593
594 typedef struct _FILE_MODE_INFORMATION {
595     ULONG Mode;
596 } FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
597
598 typedef struct _FILE_STREAM_INFORMATION
599 {
600     ULONG NextEntryOffset;
601     ULONG StreamNameLength;
602     LARGE_INTEGER StreamSize;
603     LARGE_INTEGER StreamAllocationSize;
604     WCHAR StreamName[1];
605 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
606
607 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION
608 {
609     ULONG FileAttributes;
610     ULONG ReparseTag;
611 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
612
613 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
614     ULONG MaximumMessageSize;
615     ULONG MailslotQuota;
616     ULONG NextMessageSize;
617     ULONG MessagesAvailable;
618     LARGE_INTEGER ReadTimeout;
619 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
620
621 typedef struct _FILE_MAILSLOT_SET_INFORMATION {
622     LARGE_INTEGER ReadTimeout;
623 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
624
625 typedef struct _FILE_PIPE_LOCAL_INFORMATION {
626     ULONG NamedPipeType;
627     ULONG NamedPipeConfiguration;
628     ULONG MaximumInstances;
629     ULONG CurrentInstances;
630     ULONG InboundQuota;
631     ULONG ReadDataAvailable;
632     ULONG OutboundQuota;
633     ULONG WriteQuotaAvailable;
634     ULONG NamedPipeState;
635     ULONG NamedPipeEnd;
636 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
637
638 typedef struct _FILE_ALL_INFORMATION {
639     FILE_BASIC_INFORMATION     BasicInformation;
640     FILE_STANDARD_INFORMATION  StandardInformation;
641     FILE_INTERNAL_INFORMATION  InternalInformation;
642     FILE_EA_INFORMATION        EaInformation;
643     FILE_ACCESS_INFORMATION    AccessInformation;
644     FILE_POSITION_INFORMATION  PositionInformation;
645     FILE_MODE_INFORMATION      ModeInformation;
646     FILE_ALIGNMENT_INFORMATION AlignmentInformation;
647     FILE_NAME_INFORMATION      NameInformation;
648 } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
649
650 typedef enum _FSINFOCLASS {
651     FileFsVolumeInformation = 1,
652     FileFsLabelInformation,
653     FileFsSizeInformation,
654     FileFsDeviceInformation,
655     FileFsAttributeInformation,
656     FileFsControlInformation,
657     FileFsFullSizeInformation,
658     FileFsObjectIdInformation,
659     FileFsMaximumInformation
660 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
661
662 typedef enum _KEY_INFORMATION_CLASS {
663     KeyBasicInformation,
664     KeyNodeInformation,
665     KeyFullInformation,
666     KeyNameInformation
667 } KEY_INFORMATION_CLASS;
668
669 typedef enum _KEY_VALUE_INFORMATION_CLASS {
670     KeyValueBasicInformation,
671     KeyValueFullInformation,
672     KeyValuePartialInformation,
673     KeyValueFullInformationAlign64,
674     KeyValuePartialInformationAlign64
675 } KEY_VALUE_INFORMATION_CLASS;
676
677 typedef enum _OBJECT_INFORMATION_CLASS {
678     ObjectBasicInformation,
679     ObjectNameInformation,
680     ObjectTypeInformation,
681     ObjectAllInformation,
682     ObjectDataInformation
683 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
684
685 typedef enum _PROCESSINFOCLASS {
686     ProcessBasicInformation = 0,
687     ProcessQuotaLimits = 1,
688     ProcessIoCounters = 2,
689     ProcessVmCounters = 3,
690     ProcessTimes = 4,
691     ProcessBasePriority = 5,
692     ProcessRaisePriority = 6,
693     ProcessDebugPort = 7,
694     ProcessExceptionPort = 8,
695     ProcessAccessToken = 9,
696     ProcessLdtInformation = 10,
697     ProcessLdtSize = 11,
698     ProcessDefaultHardErrorMode = 12,
699     ProcessIoPortHandlers = 13,
700     ProcessPooledUsageAndLimits = 14,
701     ProcessWorkingSetWatch = 15,
702     ProcessUserModeIOPL = 16,
703     ProcessEnableAlignmentFaultFixup = 17,
704     ProcessPriorityClass = 18,
705     ProcessWx86Information = 19,
706     ProcessHandleCount = 20,
707     ProcessAffinityMask = 21,
708     ProcessPriorityBoost = 22,
709     ProcessDeviceMap = 23,
710     ProcessSessionInformation = 24,
711     ProcessForegroundInformation = 25,
712     ProcessWow64Information = 26,
713     ProcessImageFileName = 27,
714     ProcessLUIDDeviceMapsEnabled = 28,
715     ProcessBreakOnTermination = 29,
716     ProcessDebugObjectHandle = 30,
717     ProcessDebugFlags = 31,
718     ProcessHandleTracing = 32,
719     ProcessExecuteFlags = 34,
720     MaxProcessInfoClass
721 } PROCESSINFOCLASS, PROCESS_INFORMATION_CLASS;
722
723 #define MEM_EXECUTE_OPTION_DISABLE   0x01
724 #define MEM_EXECUTE_OPTION_ENABLE    0x02
725 #define MEM_EXECUTE_OPTION_PERMANENT 0x08
726
727 typedef enum _SECTION_INHERIT {
728     ViewShare = 1,
729     ViewUnmap = 2
730 } SECTION_INHERIT;
731
732 typedef enum _SYSTEM_INFORMATION_CLASS {
733     SystemBasicInformation = 0,
734     SystemCpuInformation = 1,
735     SystemPerformanceInformation = 2,
736     SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
737     Unknown4,
738     SystemProcessInformation = 5,
739     Unknown6,
740     Unknown7,
741     SystemProcessorPerformanceInformation = 8,
742     Unknown9,
743     Unknown10,
744     SystemModuleInformation = 11,
745     Unknown12,
746     Unknown13,
747     Unknown14,
748     Unknown15,
749     SystemHandleInformation = 16,
750     Unknown17,
751     SystemPageFileInformation = 18,
752     Unknown19,
753     Unknown20,
754     SystemCacheInformation = 21,
755     Unknown22,
756     SystemInterruptInformation = 23,
757     SystemDpcBehaviourInformation = 24,
758     SystemFullMemoryInformation = 25,
759     SystemNotImplemented6 = 25,
760     SystemLoadImage = 26,
761     SystemUnloadImage = 27,
762     SystemTimeAdjustmentInformation = 28,
763     SystemTimeAdjustment = 28,
764     SystemSummaryMemoryInformation = 29,
765     SystemNotImplemented7 = 29,
766     SystemNextEventIdInformation = 30,
767     SystemNotImplemented8 = 30,
768     SystemEventIdsInformation = 31,
769     SystemCrashDumpInformation = 32,
770     SystemExceptionInformation = 33,
771     SystemCrashDumpStateInformation = 34,
772     SystemKernelDebuggerInformation = 35,
773     SystemContextSwitchInformation = 36,
774     SystemRegistryQuotaInformation = 37,
775     SystemCurrentTimeZoneInformation = 44,
776     SystemTimeZoneInformation = 44,
777     SystemLookasideInformation = 45,
778     SystemSetTimeSlipEvent = 46,
779     SystemCreateSession = 47,
780     SystemDeleteSession = 48,
781     SystemInvalidInfoClass4 = 49,
782     SystemRangeStartInformation = 50,
783     SystemVerifierInformation = 51,
784     SystemAddVerifier = 52,
785     SystemSessionProcessesInformation   = 53,
786     SystemInformationClassMax
787 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
788
789 typedef enum _TIMER_TYPE {
790     NotificationTimer,
791     SynchronizationTimer
792 } TIMER_TYPE;
793
794 typedef enum _THREADINFOCLASS {
795     ThreadBasicInformation,
796     ThreadTimes,
797     ThreadPriority,
798     ThreadBasePriority,
799     ThreadAffinityMask,
800     ThreadImpersonationToken,
801     ThreadDescriptorTableEntry,
802     ThreadEnableAlignmentFaultFixup,
803     ThreadEventPair_Reusable,
804     ThreadQuerySetWin32StartAddress,
805     ThreadZeroTlsCell,
806     ThreadPerformanceCount,
807     ThreadAmILastThread,
808     ThreadIdealProcessor,
809     ThreadPriorityBoost,
810     ThreadSetTlsArrayAddress,
811     ThreadIsIoPending,
812     ThreadHideFromDebugger,
813     MaxThreadInfoClass
814 } THREADINFOCLASS;
815
816 typedef struct _THREAD_BASIC_INFORMATION
817 {
818     NTSTATUS  ExitStatus;
819     PVOID     TebBaseAddress;
820     CLIENT_ID ClientId;
821     ULONG_PTR AffinityMask;
822     LONG      Priority;
823     LONG      BasePriority;
824 } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
825
826 typedef struct _THREAD_DESCRIPTOR_INFORMATION
827 {
828     DWORD       Selector;
829     LDT_ENTRY   Entry;
830 } THREAD_DESCRIPTOR_INFORMATION, *PTHREAD_DESCRIPTOR_INFORMATION;
831
832 typedef struct _KERNEL_USER_TIMES {
833     LARGE_INTEGER  CreateTime;
834     LARGE_INTEGER  ExitTime;
835     LARGE_INTEGER  KernelTime;
836     LARGE_INTEGER  UserTime;
837 } KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
838
839 typedef enum _WINSTATIONINFOCLASS {
840     WinStationInformation = 8
841 } WINSTATIONINFOCLASS;
842
843 typedef enum _MEMORY_INFORMATION_CLASS {
844     MemoryBasicInformation,
845     MemoryWorkingSetList,
846     MemorySectionName,
847     MemoryBasicVlmInformation
848 } MEMORY_INFORMATION_CLASS;
849
850 typedef enum _MUTANT_INFORMATION_CLASS
851 {
852     MutantBasicInformation
853 } MUTANT_INFORMATION_CLASS, *PMUTANT_INFORMATION_CLASS;
854
855 typedef struct _MUTANT_BASIC_INFORMATION {
856     LONG        CurrentCount;
857     BOOLEAN     OwnedByCaller;
858     BOOLEAN     AbandonedState;
859 } MUTANT_BASIC_INFORMATION, *PMUTANT_BASIC_INFORMATION;
860
861 typedef enum _TIMER_INFORMATION_CLASS
862 {
863     TimerBasicInformation = 0
864 } TIMER_INFORMATION_CLASS;
865
866 typedef struct _TIMER_BASIC_INFORMATION
867 {
868     LARGE_INTEGER RemainingTime;
869     BOOLEAN       TimerState;
870 } TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
871
872
873 /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
874 typedef enum
875 {
876     INVALID_PATH = 0,
877     UNC_PATH,              /* "//foo" */
878     ABSOLUTE_DRIVE_PATH,   /* "c:/foo" */
879     RELATIVE_DRIVE_PATH,   /* "c:foo" */
880     ABSOLUTE_PATH,         /* "/foo" */
881     RELATIVE_PATH,         /* "foo" */
882     DEVICE_PATH,           /* "//./foo" */
883     UNC_DOT_PATH           /* "//." */
884 } DOS_PATHNAME_TYPE;
885
886
887 /***********************************************************************
888  * Types and data structures
889  */
890
891 /* This is used by NtQuerySystemInformation */
892 typedef struct _SYSTEM_THREAD_INFORMATION
893 {                                    /* win32/win64 */
894     LARGE_INTEGER KernelTime;          /* 00/00 */
895     LARGE_INTEGER UserTime;            /* 08/08 */
896     LARGE_INTEGER CreateTime;          /* 10/10 */
897     DWORD         dwTickCount;         /* 18/18 */
898     LPVOID        StartAddress;        /* 1c/20 */
899     CLIENT_ID     ClientId;            /* 20/28 */
900     DWORD         dwCurrentPriority;   /* 28/38 */
901     DWORD         dwBasePriority;      /* 2c/3c */
902     DWORD         dwContextSwitches;   /* 30/40 */
903     DWORD         dwThreadState;       /* 34/44 */
904     DWORD         dwWaitReason;        /* 38/48 */
905     DWORD         dwUnknown;           /* 3c/4c */
906 } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
907
908 typedef struct _IO_STATUS_BLOCK {
909   union {
910     NTSTATUS Status;
911     PVOID Pointer;
912   } DUMMYUNIONNAME;
913
914   ULONG_PTR Information;
915 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
916
917 typedef void (WINAPI * PIO_APC_ROUTINE)(PVOID,PIO_STATUS_BLOCK,ULONG);
918
919 typedef struct _KEY_BASIC_INFORMATION {
920     LARGE_INTEGER LastWriteTime;
921     ULONG         TitleIndex;
922     ULONG         NameLength;
923     WCHAR         Name[1];
924 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
925
926 typedef struct _KEY_NODE_INFORMATION
927 {
928     LARGE_INTEGER LastWriteTime;
929     ULONG         TitleIndex;
930     ULONG         ClassOffset;
931     ULONG         ClassLength;
932     ULONG         NameLength;
933     WCHAR         Name[1];
934    /* Class[1]; */
935 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
936
937 typedef struct _KEY_FULL_INFORMATION
938 {
939     LARGE_INTEGER LastWriteTime;
940     ULONG         TitleIndex;
941     ULONG         ClassOffset;
942     ULONG         ClassLength;
943     ULONG         SubKeys;
944     ULONG         MaxNameLen;
945     ULONG         MaxClassLen;
946     ULONG         Values;
947     ULONG         MaxValueNameLen;
948     ULONG         MaxValueDataLen;
949     WCHAR         Class[1];
950 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
951
952 typedef struct _KEY_NAME_INFORMATION {
953     ULONG         NameLength;
954     WCHAR         Name[1];
955 } KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
956
957 typedef struct _KEY_VALUE_ENTRY
958 {
959     PUNICODE_STRING ValueName;
960     ULONG           DataLength;
961     ULONG           DataOffset;
962     ULONG           Type;
963 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
964
965 typedef struct _KEY_VALUE_BASIC_INFORMATION {
966     ULONG TitleIndex;
967     ULONG Type;
968     ULONG NameLength;
969     WCHAR Name[1];
970 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
971
972 typedef struct _KEY_VALUE_FULL_INFORMATION {
973     ULONG TitleIndex;
974     ULONG Type;
975     ULONG DataOffset;
976     ULONG DataLength;
977     ULONG NameLength;
978     WCHAR Name[1];
979 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
980
981 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
982     ULONG TitleIndex;
983     ULONG Type;
984     ULONG DataLength;
985     UCHAR Data[1];
986 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
987
988 #ifndef __OBJECT_ATTRIBUTES_DEFINED__
989 #define __OBJECT_ATTRIBUTES_DEFINED__
990 typedef struct _OBJECT_ATTRIBUTES {
991   ULONG Length;
992   HANDLE RootDirectory;
993   PUNICODE_STRING ObjectName;
994   ULONG Attributes;
995   PVOID SecurityDescriptor;       /* type SECURITY_DESCRIPTOR */
996   PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
997 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
998 #endif
999
1000 typedef struct _OBJECT_DATA_INFORMATION {
1001     BOOLEAN InheritHandle;
1002     BOOLEAN ProtectFromClose;
1003 } OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION;
1004
1005 typedef struct _OBJECT_BASIC_INFORMATION {
1006     ULONG  Attributes;
1007     ACCESS_MASK  GrantedAccess;
1008     ULONG  HandleCount;
1009     ULONG  PointerCount;
1010     ULONG  PagedPoolUsage;
1011     ULONG  NonPagedPoolUsage;
1012     ULONG  Reserved[3];
1013     ULONG  NameInformationLength;
1014     ULONG  TypeInformationLength;
1015     ULONG  SecurityDescriptorLength;
1016     LARGE_INTEGER  CreateTime;
1017 } OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
1018
1019 typedef struct _OBJECT_NAME_INFORMATION {
1020     UNICODE_STRING Name;
1021 } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
1022
1023 typedef struct _PROCESS_BASIC_INFORMATION {
1024 #ifdef __WINESRC__
1025     DWORD_PTR ExitStatus;
1026     PPEB PebBaseAddress;
1027     DWORD_PTR AffinityMask;
1028     DWORD_PTR BasePriority;
1029     ULONG_PTR UniqueProcessId;
1030     ULONG_PTR InheritedFromUniqueProcessId;
1031 #else
1032     PVOID Reserved1;
1033     PPEB PebBaseAddress;
1034     PVOID Reserved2[2];
1035     ULONG_PTR UniqueProcessId;
1036     PVOID Reserved3;
1037 #endif
1038 } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
1039
1040 #define PROCESS_PRIOCLASS_IDLE          1
1041 #define PROCESS_PRIOCLASS_NORMAL        2
1042 #define PROCESS_PRIOCLASS_HIGH          3
1043 #define PROCESS_PRIOCLASS_REALTIME      4
1044 #define PROCESS_PRIOCLASS_BELOW_NORMAL  5
1045 #define PROCESS_PRIOCLASS_ABOVE_NORMAL  6
1046
1047 typedef struct _PROCESS_PRIORITY_CLASS {
1048     BOOLEAN     Foreground;
1049     UCHAR       PriorityClass;
1050 } PROCESS_PRIORITY_CLASS, *PPROCESS_PRIORITY_CLASS;
1051
1052 typedef struct _RTL_HEAP_DEFINITION {
1053     ULONG Length; /* = sizeof(RTL_HEAP_DEFINITION) */
1054
1055     ULONG Unknown[11];
1056 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
1057
1058 typedef struct _RTL_RWLOCK {
1059     RTL_CRITICAL_SECTION rtlCS;
1060
1061     HANDLE hSharedReleaseSemaphore;
1062     UINT   uSharedWaiters;
1063
1064     HANDLE hExclusiveReleaseSemaphore;
1065     UINT   uExclusiveWaiters;
1066
1067     INT    iNumberActive;
1068     HANDLE hOwningThreadId;
1069     DWORD  dwTimeoutBoost;
1070     PVOID  pDebugInfo;
1071 } RTL_RWLOCK, *LPRTL_RWLOCK;
1072
1073 /* System Information Class 0x00 */
1074
1075 typedef struct _SYSTEM_BASIC_INFORMATION {
1076 #ifdef __WINESRC__
1077     DWORD     unknown;
1078     ULONG     KeMaximumIncrement;
1079     ULONG     PageSize;
1080     ULONG     MmNumberOfPhysicalPages;
1081     ULONG     MmLowestPhysicalPage;
1082     ULONG     MmHighestPhysicalPage;
1083     ULONG_PTR AllocationGranularity;
1084     PVOID     LowestUserAddress;
1085     PVOID     HighestUserAddress;
1086     ULONG_PTR ActiveProcessorsAffinityMask;
1087     BYTE      NumberOfProcessors;
1088 #else
1089     BYTE Reserved1[24];
1090     PVOID Reserved2[4];
1091     CCHAR NumberOfProcessors;
1092 #endif
1093 } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
1094
1095 /* System Information Class 0x01 */
1096
1097 typedef struct _SYSTEM_CPU_INFORMATION {
1098     WORD Architecture;
1099     WORD Level;
1100     WORD Revision;       /* combination of CPU model and stepping */
1101     WORD Reserved;       /* always zero */
1102     DWORD FeatureSet;    /* see bit flags below */
1103 } SYSTEM_CPU_INFORMATION, *PSYSTEM_CPU_INFORMATION;
1104
1105 /* definitions of bits in the Feature set for the x86 processors */
1106 #define CPU_FEATURE_VME    0x00000005   /* Virtual 86 Mode Extensions */
1107 #define CPU_FEATURE_TSC    0x00000002   /* Time Stamp Counter available */
1108 #define CPU_FEATURE_CMOV   0x00000008   /* Conditional Move instruction*/
1109 #define CPU_FEATURE_PGE    0x00000014   /* Page table Entry Global bit */ 
1110 #define CPU_FEATURE_PSE    0x00000024   /* Page Size Extension */
1111 #define CPU_FEATURE_MTRR   0x00000040   /* Memory Type Range Registers */
1112 #define CPU_FEATURE_CX8    0x00000080   /* Compare and eXchange 8 byte instr. */
1113 #define CPU_FEATURE_MMX    0x00000100   /* Multi Media eXtensions */
1114 #define CPU_FEATURE_X86    0x00000200   /* seems to be always ON, on the '86 */
1115 #define CPU_FEATURE_PAT    0x00000400   /* Page Attribute Table */
1116 #define CPU_FEATURE_FXSR   0x00000800   /* FXSAVE and FXSTORE instructions */
1117 #define CPU_FEATURE_SEP    0x00001000   /* SYSENTER and SYSEXIT instructions */
1118 #define CPU_FEATURE_SSE    0x00002000   /* SSE extensions (ext. MMX) */
1119 #define CPU_FEATURE_3DNOW  0x00008000   /* 3DNOW instructions available 
1120                                            (FIXME: needs to be confirmed) */
1121 #define CPU_FEATURE_SSE2   0x00010000   /* SSE2 extensions (XMMI64) */
1122 #define CPU_FEATURE_DS     0x00020000   /* Debug Store */
1123 #define CPU_FEATURE_HTT    0x00040000   /* Hyper Threading Technology */
1124
1125 /* System Information Class 0x02 */
1126
1127 typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
1128     BYTE Reserved1[312];
1129 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
1130
1131 /* System Information Class 0x03 */
1132
1133 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
1134 #ifdef __WINESRC__
1135     LARGE_INTEGER liKeBootTime;
1136     LARGE_INTEGER liKeSystemTime;
1137     LARGE_INTEGER liExpTimeZoneBias;
1138     ULONG uCurrentTimeZoneId;
1139     DWORD dwUnknown1[5];
1140 #else
1141     BYTE Reserved1[48];
1142 #endif
1143 } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION; /* was SYSTEM_TIME_INFORMATION */
1144
1145 /* System Information Class 0x08 */
1146
1147 typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
1148     LARGE_INTEGER IdleTime;
1149     LARGE_INTEGER KernelTime;
1150     LARGE_INTEGER UserTime;
1151     LARGE_INTEGER Reserved1[2];
1152     ULONG Reserved2;
1153 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
1154
1155 /* System Information Class 0x0b */
1156
1157 typedef struct _SYSTEM_DRIVER_INFORMATION {
1158     PVOID pvAddress;
1159     DWORD dwUnknown1;
1160     DWORD dwUnknown2;
1161     DWORD dwEntryIndex;
1162     DWORD dwUnknown3;
1163     char szName[MAX_PATH + 1];
1164 } SYSTEM_DRIVER_INFORMATION, *PSYSTEM_DRIVER_INFORMATION;
1165
1166 /* System Information Class 0x10 */
1167
1168 typedef struct _SYSTEM_HANDLE_ENTRY {
1169     ULONG  OwnerPid;
1170     BYTE   ObjectType;
1171     BYTE   HandleFlags;
1172     USHORT HandleValue;
1173     PVOID  ObjectPointer;
1174     ULONG  AccessMask;
1175 } SYSTEM_HANDLE_ENTRY, *PSYSTEM_HANDLE_ENTRY;
1176
1177 typedef struct _SYSTEM_HANDLE_INFORMATION {
1178     ULONG               Count;
1179     SYSTEM_HANDLE_ENTRY Handle[1];
1180 } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
1181
1182 /* System Information Class 0x15 */
1183
1184 typedef struct _SYSTEM_CACHE_INFORMATION {
1185     ULONG CurrentSize;
1186     ULONG PeakSize;
1187     ULONG PageFaultCount;
1188 #ifndef _WIN64
1189     ULONG MinimumWorkingSet;
1190     ULONG MaximumWorkingSet;
1191     ULONG unused[4];
1192 #endif
1193 } SYSTEM_CACHE_INFORMATION, *PSYSTEM_CACHE_INFORMATION;
1194
1195 /* System Information Class 0x17 */
1196
1197 typedef struct _SYSTEM_INTERRUPT_INFORMATION {
1198     BYTE Reserved1[24];
1199 } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
1200
1201 typedef struct _SYSTEM_CONFIGURATION_INFO {
1202     union {
1203         ULONG   OemId;
1204         struct {
1205             WORD ProcessorArchitecture;
1206             WORD Reserved;
1207         } tag1;
1208     } tag2;
1209     ULONG PageSize;
1210     PVOID MinimumApplicationAddress;
1211     PVOID MaximumApplicationAddress;
1212     ULONG ActiveProcessorMask;
1213     ULONG NumberOfProcessors;
1214     ULONG ProcessorType;
1215     ULONG AllocationGranularity;
1216     WORD  ProcessorLevel;
1217     WORD  ProcessorRevision;
1218 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
1219
1220 typedef struct _SYSTEM_EXCEPTION_INFORMATION {
1221     BYTE Reserved1[16];
1222 } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
1223
1224 typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
1225     BYTE Reserved1[32];
1226 } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
1227
1228 typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION {
1229         BOOLEAN  DebuggerEnabled;
1230         BOOLEAN  DebuggerNotPresent;
1231 } SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
1232
1233 /* System Information Class 0x05 */
1234
1235 typedef struct _VM_COUNTERS_ {
1236     SIZE_T PeakVirtualSize;
1237     SIZE_T VirtualSize;
1238     ULONG  PageFaultCount;
1239     SIZE_T PeakWorkingSetSize;
1240     SIZE_T WorkingSetSize;
1241     SIZE_T QuotaPeakPagedPoolUsage;
1242     SIZE_T QuotaPagedPoolUsage;
1243     SIZE_T QuotaPeakNonPagedPoolUsage;
1244     SIZE_T QuotaNonPagedPoolUsage;
1245     SIZE_T PagefileUsage;
1246     SIZE_T PeakPagefileUsage;
1247     SIZE_T PrivatePageCount;
1248 } VM_COUNTERS, *PVM_COUNTERS;
1249
1250 typedef struct _SYSTEM_PROCESS_INFORMATION {
1251 #ifdef __WINESRC__                  /* win32/win64 */
1252     ULONG NextEntryOffset;             /* 00/00 */
1253     DWORD dwThreadCount;               /* 04/04 */
1254     DWORD dwUnknown1[6];               /* 08/08 */
1255     LARGE_INTEGER CreationTime;        /* 20/20 */
1256     LARGE_INTEGER UserTime;            /* 28/28 */
1257     LARGE_INTEGER KernelTime;          /* 30/30 */
1258     UNICODE_STRING ProcessName;        /* 38/38 */
1259     DWORD dwBasePriority;              /* 40/48 */
1260     HANDLE UniqueProcessId;            /* 44/50 */
1261     HANDLE ParentProcessId;            /* 48/58 */
1262     ULONG HandleCount;                 /* 4c/60 */
1263     DWORD dwUnknown3;                  /* 50/64 */
1264     DWORD dwUnknown4;                  /* 54/68 */
1265     VM_COUNTERS vmCounters;            /* 58/70 */
1266     IO_COUNTERS ioCounters;            /* 88/d0 */
1267     SYSTEM_THREAD_INFORMATION ti[1];   /* b8/100 */
1268 #else
1269     ULONG NextEntryOffset;             /* 00/00 */
1270     BYTE Reserved1[52];                /* 04/04 */
1271     PVOID Reserved2[3];                /* 38/38 */
1272     HANDLE UniqueProcessId;            /* 44/50 */
1273     PVOID Reserved3;                   /* 48/58 */
1274     ULONG HandleCount;                 /* 4c/60 */
1275     BYTE Reserved4[4];                 /* 50/64 */
1276     PVOID Reserved5[11];               /* 54/68 */
1277     SIZE_T PeakPagefileUsage;          /* 80/c0 */
1278     SIZE_T PrivatePageCount;           /* 84/c8 */
1279     LARGE_INTEGER Reserved6[6];        /* 88/d0 */
1280 #endif
1281 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
1282
1283 typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
1284     ULONG RegistryQuotaAllowed;
1285     ULONG RegistryQuotaUsed;
1286     PVOID Reserved1;
1287 } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
1288
1289 typedef struct _SYSTEM_TIME_ADJUSTMENT {
1290     ULONG   TimeAdjustment;
1291     BOOLEAN TimeAdjustmentDisabled;
1292 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
1293
1294 typedef struct _TIME_FIELDS
1295 {   CSHORT Year;
1296     CSHORT Month;
1297     CSHORT Day;
1298     CSHORT Hour;
1299     CSHORT Minute;
1300     CSHORT Second;
1301     CSHORT Milliseconds;
1302     CSHORT Weekday;
1303 } TIME_FIELDS, *PTIME_FIELDS;
1304
1305 typedef struct _WINSTATIONINFORMATIONW {
1306   BYTE Reserved2[70];
1307   ULONG LogonId;
1308   BYTE Reserved3[1140];
1309 } WINSTATIONINFORMATIONW, *PWINSTATIONINFORMATIONW;
1310
1311 typedef BOOLEAN (WINAPI * PWINSTATIONQUERYINFORMATIONW)(HANDLE,ULONG,WINSTATIONINFOCLASS,PVOID,ULONG,PULONG);
1312
1313 typedef struct _LDR_RESOURCE_INFO
1314 {
1315     ULONG_PTR Type;
1316     ULONG_PTR Name;
1317     ULONG Language;
1318 } LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
1319
1320
1321 /* debug buffer definitions */
1322
1323 typedef struct _DEBUG_BUFFER {
1324   HANDLE SectionHandle;
1325   PVOID  SectionBase;
1326   PVOID  RemoteSectionBase;
1327   ULONG  SectionBaseDelta;
1328   HANDLE EventPairHandle;
1329   ULONG  Unknown[2];
1330   HANDLE RemoteThreadHandle;
1331   ULONG  InfoClassMask;
1332   ULONG  SizeOfInfo;
1333   ULONG  AllocatedSize;
1334   ULONG  SectionSize;
1335   PVOID  ModuleInformation;
1336   PVOID  BackTraceInformation;
1337   PVOID  HeapInformation;
1338   PVOID  LockInformation;
1339   PVOID  Reserved[8];
1340 } DEBUG_BUFFER, *PDEBUG_BUFFER;
1341
1342 #define PDI_MODULES                       0x01
1343 #define PDI_BACKTRACE                     0x02
1344 #define PDI_HEAPS                         0x04
1345 #define PDI_HEAP_TAGS                     0x08
1346 #define PDI_HEAP_BLOCKS                   0x10
1347 #define PDI_LOCKS                         0x20
1348
1349 typedef struct _DEBUG_MODULE_INFORMATION {
1350   ULONG  Reserved[2];
1351   ULONG  Base;
1352   ULONG  Size;
1353   ULONG  Flags;
1354   USHORT Index;
1355   USHORT Unknown;
1356   USHORT LoadCount;
1357   USHORT ModuleNameOffset;
1358   CHAR   ImageName[256];
1359 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
1360
1361 typedef struct _DEBUG_HEAP_INFORMATION {
1362   ULONG  Base;
1363   ULONG  Flags;
1364   USHORT Granularity;
1365   USHORT Unknown;
1366   ULONG  Allocated;
1367   ULONG  Committed;
1368   ULONG  TagCount;
1369   ULONG  BlockCount;
1370   ULONG  Reserved[7];
1371   PVOID  Tags;
1372   PVOID  Blocks;
1373 } DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
1374
1375 typedef struct _DEBUG_LOCK_INFORMATION {
1376   PVOID  Address;
1377   USHORT Type;
1378   USHORT CreatorBackTraceIndex;
1379   ULONG  OwnerThreadId;
1380   ULONG  ActiveCount;
1381   ULONG  ContentionCount;
1382   ULONG  EntryCount;
1383   ULONG  RecursionCount;
1384   ULONG  NumberOfSharedWaiters;
1385   ULONG  NumberOfExclusiveWaiters;
1386 } DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
1387
1388 typedef struct _PORT_MESSAGE_HEADER {
1389   USHORT DataSize;
1390   USHORT MessageSize;
1391   USHORT MessageType;
1392   USHORT VirtualRangesOffset;
1393   CLIENT_ID ClientId;
1394   ULONG MessageId;
1395   ULONG SectionSize;
1396 } PORT_MESSAGE_HEADER, *PPORT_MESSAGE_HEADER, PORT_MESSAGE, *PPORT_MESSAGE;
1397
1398 typedef unsigned short RTL_ATOM, *PRTL_ATOM;
1399
1400 /* Wine doesn't implement atom table as NT does:
1401  * - in NT, atom tables are user space tables, which ntdll directly accesses
1402  * - on Wine, (even local) atom tables are wineserver objects, hence a HANDLE
1403  */
1404 typedef struct atom_table *RTL_ATOM_TABLE, **PRTL_ATOM_TABLE;
1405
1406 typedef enum _ATOM_INFORMATION_CLASS {
1407    AtomBasicInformation         = 0,
1408    AtomTableInformation         = 1,
1409 } ATOM_INFORMATION_CLASS;
1410
1411 typedef struct _ATOM_BASIC_INFORMATION {
1412    USHORT       ReferenceCount;
1413    USHORT       Pinned;
1414    USHORT       NameLength;
1415    WCHAR        Name[1];
1416 } ATOM_BASIC_INFORMATION, *PATOM_BASIC_INFORMATION;
1417
1418 /* FIXME: names probably not correct */
1419 typedef struct _RTL_HANDLE
1420 {
1421     struct _RTL_HANDLE * Next;
1422 } RTL_HANDLE;
1423
1424 /* FIXME: names probably not correct */
1425 typedef struct _RTL_HANDLE_TABLE
1426 {
1427     ULONG MaxHandleCount;  /* 0x00 */
1428     ULONG HandleSize;      /* 0x04 */
1429     ULONG Unused[2];       /* 0x08-0x0c */
1430     PVOID NextFree;        /* 0x10 */
1431     PVOID FirstHandle;     /* 0x14 */
1432     PVOID ReservedMemory;  /* 0x18 */
1433     PVOID MaxHandle;       /* 0x1c */
1434 } RTL_HANDLE_TABLE;
1435
1436 /***********************************************************************
1437  * Defines
1438  */
1439
1440 /* flags for NtCreateFile and NtOpenFile */
1441 #define FILE_DIRECTORY_FILE             0x00000001
1442 #define FILE_WRITE_THROUGH              0x00000002
1443 #define FILE_SEQUENTIAL_ONLY            0x00000004
1444 #define FILE_NO_INTERMEDIATE_BUFFERING  0x00000008
1445 #define FILE_SYNCHRONOUS_IO_ALERT       0x00000010
1446 #define FILE_SYNCHRONOUS_IO_NONALERT    0x00000020
1447 #define FILE_NON_DIRECTORY_FILE         0x00000040
1448 #define FILE_CREATE_TREE_CONNECTION     0x00000080
1449 #define FILE_COMPLETE_IF_OPLOCKED       0x00000100
1450 #define FILE_NO_EA_KNOWLEDGE            0x00000200
1451 #define FILE_OPEN_FOR_RECOVERY          0x00000400
1452 #define FILE_RANDOM_ACCESS              0x00000800
1453 #define FILE_DELETE_ON_CLOSE            0x00001000
1454 #define FILE_OPEN_BY_FILE_ID            0x00002000
1455 #define FILE_OPEN_FOR_BACKUP_INTENT     0x00004000
1456 #define FILE_NO_COMPRESSION             0x00008000
1457 #define FILE_RESERVE_OPFILTER           0x00100000
1458 #define FILE_TRANSACTED_MODE            0x00200000
1459 #define FILE_OPEN_OFFLINE_FILE          0x00400000
1460 #define FILE_OPEN_FOR_FREE_SPACE_QUERY  0x00800000
1461
1462 #define FILE_ATTRIBUTE_VALID_FLAGS      0x00007fb7
1463 #define FILE_ATTRIBUTE_VALID_SET_FLAGS  0x000031a7
1464
1465 /* status for NtCreateFile or NtOpenFile */
1466 #define FILE_SUPERSEDED                 0
1467 #define FILE_OPENED                     1
1468 #define FILE_CREATED                    2
1469 #define FILE_OVERWRITTEN                3
1470 #define FILE_EXISTS                     4
1471 #define FILE_DOES_NOT_EXIST             5
1472
1473 /* disposition for NtCreateFile */
1474 #define FILE_SUPERSEDE                  0
1475 #define FILE_OPEN                       1
1476 #define FILE_CREATE                     2
1477 #define FILE_OPEN_IF                    3
1478 #define FILE_OVERWRITE                  4
1479 #define FILE_OVERWRITE_IF               5
1480 #define FILE_MAXIMUM_DISPOSITION        5
1481
1482 /* Characteristics of a File System */
1483 #define FILE_REMOVABLE_MEDIA            0x00000001
1484 #define FILE_READ_ONLY_DEVICE           0x00000002
1485 #define FILE_FLOPPY_DISKETTE            0x00000004
1486 #define FILE_WRITE_ONE_MEDIA            0x00000008
1487 #define FILE_REMOTE_DEVICE              0x00000010
1488 #define FILE_DEVICE_IS_MOUNTED          0x00000020
1489 #define FILE_VIRTUAL_VOLUME             0x00000040
1490 #define FILE_AUTOGENERATED_DEVICE_NAME  0x00000080
1491 #define FILE_DEVICE_SECURE_OPEN         0x00000100
1492
1493 /* options for NtCreateNamedPipeFile */
1494 #define FILE_PIPE_INBOUND               0x00000000
1495 #define FILE_PIPE_OUTBOUND              0x00000001
1496 #define FILE_PIPE_FULL_DUPLEX           0x00000002
1497
1498 /* options for pipe's type */
1499 #define FILE_PIPE_TYPE_MESSAGE          0x00000001
1500 #define FILE_PIPE_TYPE_BYTE             0x00000000
1501 /* and client / server end */
1502 #define FILE_PIPE_SERVER_END            0x00000001
1503 #define FILE_PIPE_CLIENT_END            0x00000000
1504
1505 #define INTERNAL_TS_ACTIVE_CONSOLE_ID ( *((volatile ULONG*)(0x7ffe02d8)) )
1506
1507 #define LOGONID_CURRENT    ((ULONG)-1)
1508
1509 #define OBJ_INHERIT          0x00000002L
1510 #define OBJ_PERMANENT        0x00000010L
1511 #define OBJ_EXCLUSIVE        0x00000020L
1512 #define OBJ_CASE_INSENSITIVE 0x00000040L
1513 #define OBJ_OPENIF           0x00000080L
1514 #define OBJ_OPENLINK         0x00000100L
1515 #define OBJ_KERNEL_HANDLE    0x00000200L
1516 #define OBJ_VALID_ATTRIBUTES 0x000003F2L
1517
1518 #define SERVERNAME_CURRENT ((HANDLE)NULL)
1519
1520 typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR); /* FIXME: not the right name */
1521 typedef void (CALLBACK *PRTL_THREAD_START_ROUTINE)(LPVOID); /* FIXME: not the right name */
1522 typedef DWORD (CALLBACK *PRTL_WORK_ITEM_ROUTINE)(LPVOID); /* FIXME: not the right name */
1523 typedef void (NTAPI *RTL_WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN); /* FIXME: not the right name */
1524
1525
1526 /* DbgPrintEx default levels */
1527 #define DPFLTR_ERROR_LEVEL     0
1528 #define DPFLTR_WARNING_LEVEL   1
1529 #define DPFLTR_TRACE_LEVEL     2
1530 #define DPFLTR_INFO_LEVEL      3
1531 #define DPFLTR_MASK    0x8000000
1532
1533 /* Well-known LUID values */
1534 #define SE_MIN_WELL_KNOWN_PRIVILEGE       2L
1535 #define SE_CREATE_TOKEN_PRIVILEGE         2L
1536 #define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE   3L
1537 #define SE_LOCK_MEMORY_PRIVILEGE          4L
1538 #define SE_INCREASE_QUOTA_PRIVILEGE       5L
1539 #define SE_UNSOLICITED_INPUT_PRIVILEGE    6L /* obsolete */
1540 #define SE_MACHINE_ACCOUNT_PRIVILEGE      6L
1541 #define SE_TCB_PRIVILEGE                  7L
1542 #define SE_SECURITY_PRIVILEGE             8L
1543 #define SE_TAKE_OWNERSHIP_PRIVILEGE       9L
1544 #define SE_LOAD_DRIVER_PRIVILEGE         10L
1545 #define SE_SYSTEM_PROFILE_PRIVILEGE      11L
1546 #define SE_SYSTEMTIME_PRIVILEGE          12L
1547 #define SE_PROF_SINGLE_PROCESS_PRIVILEGE 13L
1548 #define SE_INC_BASE_PRIORITY_PRIVILEGE   14L
1549 #define SE_CREATE_PAGEFILE_PRIVILEGE     15L
1550 #define SE_CREATE_PERMANENT_PRIVILEGE    16L
1551 #define SE_BACKUP_PRIVILEGE              17L
1552 #define SE_RESTORE_PRIVILEGE             18L
1553 #define SE_SHUTDOWN_PRIVILEGE            19L
1554 #define SE_DEBUG_PRIVILEGE               20L
1555 #define SE_AUDIT_PRIVILEGE               21L
1556 #define SE_SYSTEM_ENVIRONMENT_PRIVILEGE  22L
1557 #define SE_CHANGE_NOTIFY_PRIVILEGE       23L
1558 #define SE_REMOTE_SHUTDOWN_PRIVILEGE     24L
1559 #define SE_UNDOCK_PRIVILEGE              25L
1560 #define SE_SYNC_AGENT_PRIVILEGE          26L
1561 #define SE_ENABLE_DELEGATION_PRIVILEGE   27L
1562 #define SE_MANAGE_VOLUME_PRIVILEGE       28L
1563 #define SE_IMPERSONATE_PRIVILEGE         29L
1564 #define SE_CREATE_GLOBAL_PRIVILEGE       30L
1565 #define SE_MAX_WELL_KNOWN_PRIVILEGE      SE_CREATE_GLOBAL_PRIVILEGE
1566
1567 /* NtGlobalFlag bits */
1568 #define FLG_HEAP_ENABLE_TAIL_CHECK       0x00000010
1569 #define FLG_HEAP_ENABLE_FREE_CHECK       0x00000020
1570 #define FLG_HEAP_DISABLE_COALESCING      0x00200000
1571
1572 /* Rtl*Registry* functions structs and defines */
1573 #define RTL_REGISTRY_ABSOLUTE             0
1574 #define RTL_REGISTRY_SERVICES             1
1575 #define RTL_REGISTRY_CONTROL              2
1576 #define RTL_REGISTRY_WINDOWS_NT           3
1577 #define RTL_REGISTRY_DEVICEMAP            4
1578 #define RTL_REGISTRY_USER                 5
1579
1580 #define RTL_REGISTRY_HANDLE       0x40000000
1581 #define RTL_REGISTRY_OPTIONAL     0x80000000
1582
1583 #define RTL_QUERY_REGISTRY_SUBKEY         0x00000001
1584 #define RTL_QUERY_REGISTRY_TOPKEY         0x00000002
1585 #define RTL_QUERY_REGISTRY_REQUIRED       0x00000004
1586 #define RTL_QUERY_REGISTRY_NOVALUE        0x00000008
1587 #define RTL_QUERY_REGISTRY_NOEXPAND       0x00000010
1588 #define RTL_QUERY_REGISTRY_DIRECT         0x00000020
1589 #define RTL_QUERY_REGISTRY_DELETE         0x00000040
1590
1591 typedef NTSTATUS (WINAPI *PRTL_QUERY_REGISTRY_ROUTINE)( PCWSTR ValueName,
1592                                                         ULONG  ValueType,
1593                                                         PVOID  ValueData,
1594                                                         ULONG  ValueLength,
1595                                                         PVOID  Context,
1596                                                         PVOID  EntryContext);
1597
1598 typedef struct _RTL_QUERY_REGISTRY_TABLE
1599 {
1600   PRTL_QUERY_REGISTRY_ROUTINE  QueryRoutine;
1601   ULONG  Flags;
1602   PWSTR  Name;
1603   PVOID  EntryContext;
1604   ULONG  DefaultType;
1605   PVOID  DefaultData;
1606   ULONG  DefaultLength;
1607 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
1608
1609 typedef struct _KEY_MULTIPLE_VALUE_INFORMATION
1610 {
1611   PUNICODE_STRING ValueName;
1612   ULONG DataLength;
1613   ULONG DataOffset;
1614   ULONG Type;
1615 } KEY_MULTIPLE_VALUE_INFORMATION, *PKEY_MULTIPLE_VALUE_INFORMATION;
1616
1617 typedef VOID (CALLBACK *PRTL_OVERLAPPED_COMPLETION_ROUTINE)(DWORD,DWORD,LPVOID);
1618
1619 typedef VOID (CALLBACK *PTIMER_APC_ROUTINE) ( PVOID, ULONG, LONG );
1620
1621 typedef enum _EVENT_TYPE {
1622   NotificationEvent,
1623   SynchronizationEvent
1624 } EVENT_TYPE, *PEVENT_TYPE;
1625
1626 typedef enum _EVENT_INFORMATION_CLASS {
1627   EventBasicInformation
1628 } EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS;
1629
1630 typedef struct _EVENT_BASIC_INFORMATION {
1631   EVENT_TYPE EventType;
1632   LONG EventState;
1633 } EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
1634
1635 typedef enum _SEMAPHORE_INFORMATION_CLASS {
1636   SemaphoreBasicInformation
1637 } SEMAPHORE_INFORMATION_CLASS, *PSEMAPHORE_INFORMATION_CLASS;
1638
1639 typedef struct _SEMAPHORE_BASIC_INFORMATION {
1640   ULONG CurrentCount;
1641   ULONG MaximumCount;
1642 } SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
1643
1644 typedef enum _SECTION_INFORMATION_CLASS
1645 {
1646   SectionBasicInformation,
1647   SectionImageInformation,
1648 } SECTION_INFORMATION_CLASS;
1649
1650 typedef struct _SECTION_BASIC_INFORMATION {
1651   ULONG BaseAddress;
1652   ULONG Attributes;
1653   LARGE_INTEGER Size;
1654 } SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
1655
1656 typedef struct _SECTION_IMAGE_INFORMATION {
1657   PVOID EntryPoint;
1658   ULONG StackZeroBits;
1659   ULONG StackReserved;
1660   ULONG StackCommit;
1661   ULONG ImageSubsystem;
1662   WORD SubsystemVersionLow;
1663   WORD SubsystemVersionHigh;
1664   ULONG Unknown1;
1665   ULONG ImageCharacteristics;
1666   ULONG ImageMachineType;
1667   ULONG Unknown2[3];
1668 } SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
1669
1670 typedef struct _LPC_SECTION_WRITE {
1671   ULONG Length;
1672   HANDLE SectionHandle;
1673   ULONG SectionOffset;
1674   ULONG ViewSize;
1675   PVOID ViewBase;
1676   PVOID TargetViewBase;
1677 } LPC_SECTION_WRITE, *PLPC_SECTION_WRITE;
1678
1679 typedef struct _LPC_SECTION_READ {
1680   ULONG Length;
1681   ULONG ViewSize;
1682   PVOID ViewBase;
1683 } LPC_SECTION_READ, *PLPC_SECTION_READ;
1684
1685 typedef struct _LPC_MESSAGE {
1686   USHORT DataSize;
1687   USHORT MessageSize;
1688   USHORT MessageType;
1689   USHORT VirtualRangesOffset;
1690   CLIENT_ID ClientId;
1691   ULONG_PTR MessageId;
1692   ULONG_PTR SectionSize;
1693   UCHAR Data[ANYSIZE_ARRAY];
1694 } LPC_MESSAGE, *PLPC_MESSAGE;
1695
1696 typedef enum _SHUTDOWN_ACTION {
1697   ShutdownNoReboot,
1698   ShutdownReboot,
1699   ShutdownPowerOff
1700 } SHUTDOWN_ACTION, *PSHUTDOWN_ACTION;
1701
1702 typedef enum _KPROFILE_SOURCE {
1703   ProfileTime,
1704   ProfileAlignmentFixup,
1705   ProfileTotalIssues,
1706   ProfilePipelineDry,
1707   ProfileLoadInstructions,
1708   ProfilePipelineFrozen,
1709   ProfileBranchInstructions,
1710   ProfileTotalNonissues,
1711   ProfileDcacheMisses,
1712   ProfileIcacheMisses,
1713   ProfileCacheMisses,
1714   ProfileBranchMispredictions,
1715   ProfileStoreInstructions,
1716   ProfileFpInstructions,
1717   ProfileIntegerInstructions,
1718   Profile2Issue,
1719   Profile3Issue,
1720   Profile4Issue,
1721   ProfileSpecialInstructions,
1722   ProfileTotalCycles,
1723   ProfileIcacheIssues,
1724   ProfileDcacheAccesses,
1725   ProfileMemoryBarrierCycles,
1726   ProfileLoadLinkedIssues,
1727   ProfileMaximum
1728 } KPROFILE_SOURCE, *PKPROFILE_SOURCE;
1729
1730 typedef struct _DIRECTORY_BASIC_INFORMATION {
1731   UNICODE_STRING ObjectName;
1732   UNICODE_STRING ObjectTypeName;
1733 } DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
1734
1735 typedef struct _INITIAL_TEB {
1736   PVOID StackBase;
1737   PVOID StackLimit;
1738   PVOID StackCommit;
1739   PVOID StackCommitMax;
1740   PVOID StackReserved;
1741 } INITIAL_TEB, *PINITIAL_TEB;
1742
1743 typedef enum _PORT_INFORMATION_CLASS {
1744   PortNoInformation
1745 } PORT_INFORMATION_CLASS, *PPORT_INFORMATION_CLASS;
1746
1747 typedef enum _IO_COMPLETION_INFORMATION_CLASS {
1748   IoCompletionBasicInformation
1749 } IO_COMPLETION_INFORMATION_CLASS, *PIO_COMPLETION_INFORMATION_CLASS;
1750
1751 typedef struct _FILE_COMPLETION_INFORMATION {
1752     HANDLE CompletionPort;
1753     ULONG_PTR CompletionKey;
1754 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
1755
1756 #define IO_COMPLETION_QUERY_STATE  0x0001
1757 #define IO_COMPLETION_MODIFY_STATE 0x0002
1758 #define IO_COMPLETION_ALL_ACCESS   (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
1759
1760 typedef enum _HARDERROR_RESPONSE_OPTION {
1761   OptionAbortRetryIgnore,
1762   OptionOk,
1763   OptionOkCancel,
1764   OptionRetryCancel,
1765   OptionYesNo,
1766   OptionYesNoCancel,
1767   OptionShutdownSystem
1768 } HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION;
1769
1770 typedef enum _HARDERROR_RESPONSE {
1771   ResponseReturnToCaller,
1772   ResponseNotHandled,
1773   ResponseAbort,
1774   ResponseCancel,
1775   ResponseIgnore,
1776   ResponseNo,
1777   ResponseOk,
1778   ResponseRetry,
1779   ResponseYes
1780 } HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
1781
1782 typedef enum _SYSDBG_COMMAND {
1783   SysDbgQueryModuleInformation,
1784   SysDbgQueryTraceInformation,
1785   SysDbgSetTracepoint,
1786   SysDbgSetSpecialCall,
1787   SysDbgClearSpecialCalls,
1788   SysDbgQuerySpecialCalls
1789 } SYSDBG_COMMAND, *PSYSDBG_COMMAND;
1790
1791
1792 /*************************************************************************
1793  * Loader structures
1794  *
1795  * Those are not part of standard Winternl.h
1796  */
1797 typedef struct _LDR_MODULE
1798 {
1799     LIST_ENTRY          InLoadOrderModuleList;
1800     LIST_ENTRY          InMemoryOrderModuleList;
1801     LIST_ENTRY          InInitializationOrderModuleList;
1802     void*               BaseAddress;
1803     void*               EntryPoint;
1804     ULONG               SizeOfImage;
1805     UNICODE_STRING      FullDllName;
1806     UNICODE_STRING      BaseDllName;
1807     ULONG               Flags;
1808     SHORT               LoadCount;
1809     SHORT               TlsIndex;
1810     HANDLE              SectionHandle;
1811     ULONG               CheckSum;
1812     ULONG               TimeDateStamp;
1813     HANDLE              ActivationContext;
1814 } LDR_MODULE, *PLDR_MODULE;
1815
1816 /* those defines are (some of the) regular LDR_MODULE.Flags values */
1817 #define LDR_IMAGE_IS_DLL                0x00000004
1818 #define LDR_LOAD_IN_PROGRESS            0x00001000
1819 #define LDR_UNLOAD_IN_PROGRESS          0x00002000
1820 #define LDR_NO_DLL_CALLS                0x00040000
1821 #define LDR_PROCESS_ATTACHED            0x00080000
1822 #define LDR_MODULE_REBASED              0x00200000
1823
1824 /* these ones is Wine specific */
1825 #define LDR_DONT_RESOLVE_REFS           0x40000000
1826 #define LDR_WINE_INTERNAL               0x80000000
1827
1828 /* FIXME: to be checked */
1829 #define MAXIMUM_FILENAME_LENGTH 256
1830
1831 typedef struct _SYSTEM_MODULE
1832 {
1833     PVOID               Reserved1;                      /* 00/00 */
1834     PVOID               Reserved2;                      /* 04/08 */
1835     PVOID               ImageBaseAddress;               /* 08/10 */
1836     ULONG               ImageSize;                      /* 0c/18 */
1837     ULONG               Flags;                          /* 10/1c */
1838     WORD                Id;                             /* 14/20 */
1839     WORD                Rank;                           /* 16/22 */
1840     WORD                Unknown;                        /* 18/24 */
1841     WORD                NameOffset;                     /* 1a/26 */
1842     BYTE                Name[MAXIMUM_FILENAME_LENGTH];  /* 1c/28 */
1843 } SYSTEM_MODULE, *PSYSTEM_MODULE;
1844
1845 typedef struct _SYSTEM_MODULE_INFORMATION
1846 {
1847     ULONG               ModulesCount;
1848     SYSTEM_MODULE       Modules[1]; /* FIXME: should be Modules[0] */
1849 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
1850
1851 /***********************************************************************
1852  * Function declarations
1853  */
1854
1855 #if defined(__i386__) && defined(__GNUC__)
1856 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
1857 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
1858 #else  /* __i386__ && __GNUC__ */
1859 NTSYSAPI void WINAPI DbgBreakPoint(void);
1860 NTSYSAPI void WINAPI DbgUserBreakPoint(void);
1861 #endif  /* __i386__ && __GNUC__ */
1862 NTSYSAPI NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...);
1863 NTSYSAPI NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...);
1864 NTSYSAPI NTSTATUS  WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void**,PULONG);
1865 NTSYSAPI NTSTATUS  WINAPI LdrAddRefDll(ULONG,HMODULE);
1866 NTSYSAPI NTSTATUS  WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);
1867 NTSYSAPI NTSTATUS  WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
1868 NTSYSAPI NTSTATUS  WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
1869 NTSYSAPI NTSTATUS  WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
1870 NTSYSAPI NTSTATUS  WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*, HMODULE*);
1871 NTSYSAPI NTSTATUS  WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
1872 NTSYSAPI void      WINAPI LdrInitializeThunk(void*,ULONG_PTR,ULONG_PTR,ULONG_PTR);
1873 NTSYSAPI NTSTATUS  WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
1874 NTSYSAPI NTSTATUS  WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
1875 IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT_PTR);
1876 NTSYSAPI NTSTATUS  WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
1877 NTSYSAPI void      WINAPI LdrShutdownProcess(void);
1878 NTSYSAPI void      WINAPI LdrShutdownThread(void);
1879 NTSYSAPI NTSTATUS  WINAPI LdrUnloadDll(HMODULE);
1880 NTSYSAPI NTSTATUS  WINAPI LdrUnlockLoaderLock(ULONG,ULONG);
1881 NTSYSAPI NTSTATUS  WINAPI NtAcceptConnectPort(PHANDLE,ULONG,PLPC_MESSAGE,BOOLEAN,PLPC_SECTION_WRITE,PLPC_SECTION_READ);
1882 NTSYSAPI NTSTATUS  WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,NTSTATUS*);
1883 NTSYSAPI NTSTATUS  WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING,HANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,ACCESS_MASK,PGENERIC_MAPPING,BOOLEAN,PACCESS_MASK,PBOOLEAN,PBOOLEAN);
1884 NTSYSAPI NTSTATUS  WINAPI NtAddAtom(const WCHAR*,ULONG,RTL_ATOM*);
1885 NTSYSAPI NTSTATUS  WINAPI NtAdjustGroupsToken(HANDLE,BOOLEAN,PTOKEN_GROUPS,ULONG,PTOKEN_GROUPS,PULONG);
1886 NTSYSAPI NTSTATUS  WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
1887 NTSYSAPI NTSTATUS  WINAPI NtAlertResumeThread(HANDLE,PULONG);
1888 NTSYSAPI NTSTATUS  WINAPI NtAlertThread(HANDLE ThreadHandle);
1889 NTSYSAPI NTSTATUS  WINAPI NtAllocateLocallyUniqueId(PLUID lpLuid);
1890 NTSYSAPI NTSTATUS  WINAPI NtAllocateUuids(PULARGE_INTEGER,PULONG,PULONG);
1891 NTSYSAPI NTSTATUS  WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG,SIZE_T*,ULONG,ULONG);
1892 NTSYSAPI NTSTATUS  WINAPI NtAreMappedFilesTheSame(PVOID,PVOID);
1893 NTSYSAPI NTSTATUS  WINAPI NtAssignProcessToJobObject(HANDLE,HANDLE);
1894 NTSYSAPI NTSTATUS  WINAPI NtCallbackReturn(PVOID,ULONG,NTSTATUS);
1895 NTSYSAPI NTSTATUS  WINAPI NtCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
1896 NTSYSAPI NTSTATUS  WINAPI NtCancelIoFileEx(HANDLE,PIO_STATUS_BLOCK,PIO_STATUS_BLOCK);
1897 NTSYSAPI NTSTATUS  WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
1898 NTSYSAPI NTSTATUS  WINAPI NtClearEvent(HANDLE);
1899 NTSYSAPI NTSTATUS  WINAPI NtClose(HANDLE);
1900 NTSYSAPI NTSTATUS  WINAPI NtCloseObjectAuditAlarm(PUNICODE_STRING,HANDLE,BOOLEAN);
1901 NTSYSAPI NTSTATUS  WINAPI NtCompleteConnectPort(HANDLE);
1902 NTSYSAPI NTSTATUS  WINAPI NtConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1903 NTSYSAPI NTSTATUS  WINAPI NtContinue(PCONTEXT,BOOLEAN);
1904 NTSYSAPI NTSTATUS  WINAPI NtCreateDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1905 NTSYSAPI NTSTATUS  WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1906 NTSYSAPI NTSTATUS  WINAPI NtCreateEventPair(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1907 NTSYSAPI NTSTATUS  WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1908 NTSYSAPI NTSTATUS  WINAPI NtCreateIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,ULONG);
1909 NTSYSAPI NTSTATUS  WINAPI NtCreateJobObject(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1910 NTSYSAPI NTSTATUS  WINAPI NtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1911 NTSYSAPI NTSTATUS  WINAPI NtCreateMailslotFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,PLARGE_INTEGER);
1912 NTSYSAPI NTSTATUS  WINAPI NtCreateMutant(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,BOOLEAN);
1913 NTSYSAPI NTSTATUS  WINAPI NtCreateNamedPipeFile(PHANDLE,ULONG,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,PLARGE_INTEGER);
1914 NTSYSAPI NTSTATUS  WINAPI NtCreatePagingFile(PUNICODE_STRING,PLARGE_INTEGER,PLARGE_INTEGER,PLARGE_INTEGER);
1915 NTSYSAPI NTSTATUS  WINAPI NtCreatePort(PHANDLE,POBJECT_ATTRIBUTES,ULONG,ULONG,PULONG);
1916 NTSYSAPI NTSTATUS  WINAPI NtCreateProcess(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,BOOLEAN,HANDLE,HANDLE,HANDLE);
1917 NTSYSAPI NTSTATUS  WINAPI NtCreateProfile(PHANDLE,HANDLE,PVOID,ULONG,ULONG,PVOID,ULONG,KPROFILE_SOURCE,KAFFINITY);
1918 NTSYSAPI NTSTATUS  WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1919 NTSYSAPI NTSTATUS  WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,LONG,LONG);
1920 NTSYSAPI NTSTATUS  WINAPI NtCreateSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PUNICODE_STRING);
1921 NTSYSAPI NTSTATUS  WINAPI NtCreateThread(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PCONTEXT,PINITIAL_TEB,BOOLEAN);
1922 NTSYSAPI NTSTATUS  WINAPI NtCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1923 NTSYSAPI NTSTATUS  WINAPI NtCreateToken(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,TOKEN_TYPE,PLUID,PLARGE_INTEGER,PTOKEN_USER,PTOKEN_GROUPS,PTOKEN_PRIVILEGES,PTOKEN_OWNER,PTOKEN_PRIMARY_GROUP,PTOKEN_DEFAULT_DACL,PTOKEN_SOURCE);
1924 NTSYSAPI NTSTATUS  WINAPI NtDelayExecution(BOOLEAN,const LARGE_INTEGER*);
1925 NTSYSAPI NTSTATUS  WINAPI NtDeleteAtom(RTL_ATOM);
1926 NTSYSAPI NTSTATUS  WINAPI NtDeleteFile(POBJECT_ATTRIBUTES);
1927 NTSYSAPI NTSTATUS  WINAPI NtDeleteKey(HANDLE);
1928 NTSYSAPI NTSTATUS  WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING *);
1929 NTSYSAPI NTSTATUS  WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1930 NTSYSAPI NTSTATUS  WINAPI NtDisplayString(PUNICODE_STRING);
1931 NTSYSAPI NTSTATUS  WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1932 NTSYSAPI NTSTATUS  WINAPI NtDuplicateToken(HANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,PHANDLE);
1933 NTSYSAPI NTSTATUS  WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1934 NTSYSAPI NTSTATUS  WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1935 NTSYSAPI NTSTATUS  WINAPI NtExtendSection(HANDLE,PLARGE_INTEGER);
1936 NTSYSAPI NTSTATUS  WINAPI NtFindAtom(const WCHAR*,ULONG,RTL_ATOM*);
1937 NTSYSAPI NTSTATUS  WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
1938 NTSYSAPI NTSTATUS  WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
1939 NTSYSAPI NTSTATUS  WINAPI NtFlushKey(HANDLE);
1940 NTSYSAPI NTSTATUS  WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
1941 NTSYSAPI NTSTATUS  WINAPI NtFlushWriteBuffer(VOID);
1942 NTSYSAPI NTSTATUS  WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1943 NTSYSAPI NTSTATUS  WINAPI NtFsControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1944 NTSYSAPI NTSTATUS  WINAPI NtGetContextThread(HANDLE,CONTEXT*);
1945 NTSYSAPI NTSTATUS  WINAPI NtGetPlugPlayEvent(ULONG,ULONG,PVOID,ULONG);
1946 NTSYSAPI ULONG     WINAPI NtGetTickCount(VOID);
1947 NTSYSAPI NTSTATUS  WINAPI NtGetWriteWatch(HANDLE,ULONG,PVOID,SIZE_T,PVOID*,ULONG_PTR*,ULONG*);
1948 NTSYSAPI NTSTATUS  WINAPI NtImpersonateAnonymousToken(HANDLE);
1949 NTSYSAPI NTSTATUS  WINAPI NtImpersonateClientOfPort(HANDLE,PPORT_MESSAGE);
1950 NTSYSAPI NTSTATUS  WINAPI NtImpersonateThread(HANDLE,HANDLE,PSECURITY_QUALITY_OF_SERVICE);
1951 NTSYSAPI NTSTATUS  WINAPI NtInitializeRegistry(BOOLEAN);
1952 NTSYSAPI NTSTATUS  WINAPI NtInitiatePowerAction(POWER_ACTION,SYSTEM_POWER_STATE,ULONG,BOOLEAN);
1953 NTSYSAPI NTSTATUS  WINAPI NtIsProcessInJob(HANDLE,HANDLE);
1954 NTSYSAPI NTSTATUS  WINAPI NtListenPort(HANDLE,PLPC_MESSAGE);
1955 NTSYSAPI NTSTATUS  WINAPI NtLoadDriver(const UNICODE_STRING *);
1956 NTSYSAPI NTSTATUS  WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES *);
1957 NTSYSAPI NTSTATUS  WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
1958 NTSYSAPI NTSTATUS  WINAPI NtLockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1959 NTSYSAPI NTSTATUS  WINAPI NtMakeTemporaryObject(HANDLE);
1960 NTSYSAPI NTSTATUS  WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
1961 NTSYSAPI NTSTATUS  WINAPI NtNotifyChangeDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,ULONG,BOOLEAN);
1962 NTSYSAPI NTSTATUS  WINAPI NtNotifyChangeKey(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1963 NTSYSAPI NTSTATUS  WINAPI NtOpenDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1964 NTSYSAPI NTSTATUS  WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1965 NTSYSAPI NTSTATUS  WINAPI NtOpenEventPair(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1966 NTSYSAPI NTSTATUS  WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1967 NTSYSAPI NTSTATUS  WINAPI NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1968 NTSYSAPI NTSTATUS  WINAPI NtOpenJobObject(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1969 NTSYSAPI NTSTATUS  WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1970 NTSYSAPI NTSTATUS  WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1971 NTSYSAPI NTSTATUS  WINAPI NtOpenObjectAuditAlarm(PUNICODE_STRING,PHANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,ACCESS_MASK,PPRIVILEGE_SET,BOOLEAN,BOOLEAN,PBOOLEAN);
1972 NTSYSAPI NTSTATUS  WINAPI NtOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1973 NTSYSAPI NTSTATUS  WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
1974 NTSYSAPI NTSTATUS  WINAPI NtOpenProcessTokenEx(HANDLE,DWORD,DWORD,HANDLE *);
1975 NTSYSAPI NTSTATUS  WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1976 NTSYSAPI NTSTATUS  WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1977 NTSYSAPI NTSTATUS  WINAPI NtOpenSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1978 NTSYSAPI NTSTATUS  WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1979 NTSYSAPI NTSTATUS  WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1980 NTSYSAPI NTSTATUS  WINAPI NtOpenThreadTokenEx(HANDLE,DWORD,BOOLEAN,DWORD,HANDLE *);
1981 NTSYSAPI NTSTATUS  WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1982 NTSYSAPI NTSTATUS  WINAPI NtPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG);
1983 NTSYSAPI NTSTATUS  WINAPI NtPrivilegeCheck(HANDLE,PPRIVILEGE_SET,PBOOLEAN);
1984 NTSYSAPI NTSTATUS  WINAPI NtPrivilegeObjectAuditAlarm(PUNICODE_STRING,HANDLE,HANDLE,ULONG,PPRIVILEGE_SET,BOOLEAN);
1985 NTSYSAPI NTSTATUS  WINAPI NtPrivilegedServiceAuditAlarm(PUNICODE_STRING,PUNICODE_STRING,HANDLE,PPRIVILEGE_SET,BOOLEAN);
1986 NTSYSAPI NTSTATUS  WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG,ULONG*);
1987 NTSYSAPI NTSTATUS  WINAPI NtPulseEvent(HANDLE,PULONG);
1988 NTSYSAPI NTSTATUS  WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
1989 NTSYSAPI NTSTATUS  WINAPI NtQueryAttributesFile(const OBJECT_ATTRIBUTES*,FILE_BASIC_INFORMATION*);
1990 NTSYSAPI NTSTATUS  WINAPI NtQueryDefaultLocale(BOOLEAN,LCID*);
1991 NTSYSAPI NTSTATUS  WINAPI NtQueryDefaultUILanguage(LANGID*);
1992 NTSYSAPI NTSTATUS  WINAPI NtQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
1993 NTSYSAPI NTSTATUS  WINAPI NtQueryDirectoryObject(HANDLE,PDIRECTORY_BASIC_INFORMATION,ULONG,BOOLEAN,BOOLEAN,PULONG,PULONG);
1994 NTSYSAPI NTSTATUS  WINAPI NtQueryEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PULONG,BOOLEAN);
1995 NTSYSAPI NTSTATUS  WINAPI NtQueryEvent(HANDLE,EVENT_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1996 NTSYSAPI NTSTATUS  WINAPI NtQueryFullAttributesFile(const OBJECT_ATTRIBUTES*,FILE_NETWORK_OPEN_INFORMATION*);
1997 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationAtom(RTL_ATOM,ATOM_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
1998 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1999 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationJobObject(HANDLE,JOBOBJECTINFOCLASS,PVOID,ULONG,PULONG);
2000 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationPort(HANDLE,PORT_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2001 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
2002 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
2003 NTSYSAPI NTSTATUS  WINAPI NtQueryInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2004 NTSYSAPI NTSTATUS  WINAPI NtQueryInstallUILanguage(LANGID*);
2005 NTSYSAPI NTSTATUS  WINAPI NtQueryIntervalProfile(KPROFILE_SOURCE,PULONG);
2006 NTSYSAPI NTSTATUS  WINAPI NtQueryIoCompletion(HANDLE,IO_COMPLETION_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2007 NTSYSAPI NTSTATUS  WINAPI NtQueryKey(HANDLE,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
2008 NTSYSAPI NTSTATUS  WINAPI NtQueryMultipleValueKey(HANDLE,PKEY_MULTIPLE_VALUE_INFORMATION,ULONG,PVOID,ULONG,PULONG);
2009 NTSYSAPI NTSTATUS  WINAPI NtQueryMutant(HANDLE,MUTANT_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2010 NTSYSAPI NTSTATUS  WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
2011 NTSYSAPI NTSTATUS  WINAPI NtQueryOpenSubKeys(POBJECT_ATTRIBUTES,PULONG);
2012 NTSYSAPI NTSTATUS  WINAPI NtQueryPerformanceCounter(PLARGE_INTEGER, PLARGE_INTEGER);
2013 NTSYSAPI NTSTATUS  WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
2014 NTSYSAPI NTSTATUS  WINAPI NtQuerySection(HANDLE,SECTION_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2015 NTSYSAPI NTSTATUS  WINAPI NtQuerySemaphore(HANDLE,SEMAPHORE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2016 NTSYSAPI NTSTATUS  WINAPI NtQuerySymbolicLinkObject(HANDLE,PUNICODE_STRING,PULONG);
2017 NTSYSAPI NTSTATUS  WINAPI NtQuerySystemEnvironmentValue(PUNICODE_STRING,PWCHAR,ULONG,PULONG);
2018 NTSYSAPI NTSTATUS  WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2019 NTSYSAPI NTSTATUS  WINAPI NtQuerySystemTime(PLARGE_INTEGER);
2020 NTSYSAPI NTSTATUS  WINAPI NtQueryTimer(HANDLE,TIMER_INFORMATION_CLASS,PVOID,ULONG,PULONG);
2021 NTSYSAPI NTSTATUS  WINAPI NtQueryTimerResolution(PULONG,PULONG,PULONG);
2022 NTSYSAPI NTSTATUS  WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
2023 NTSYSAPI NTSTATUS  WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,SIZE_T,SIZE_T*);
2024 NTSYSAPI NTSTATUS  WINAPI NtQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
2025 NTSYSAPI NTSTATUS  WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
2026 NTSYSAPI NTSTATUS  WINAPI NtRaiseHardError(NTSTATUS,ULONG,PUNICODE_STRING,PVOID*,HARDERROR_RESPONSE_OPTION,PHARDERROR_RESPONSE);
2027 NTSYSAPI NTSTATUS  WINAPI NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
2028 NTSYSAPI NTSTATUS  WINAPI NtReadFileScatter(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,FILE_SEGMENT_ELEMENT*,ULONG,PLARGE_INTEGER,PULONG);
2029 NTSYSAPI NTSTATUS  WINAPI NtReadRequestData(HANDLE,PLPC_MESSAGE,ULONG,PVOID,ULONG,PULONG);
2030 NTSYSAPI NTSTATUS  WINAPI NtReadVirtualMemory(HANDLE,const void*,void*,SIZE_T,SIZE_T*);
2031 NTSYSAPI NTSTATUS  WINAPI NtRegisterThreadTerminatePort(HANDLE);
2032 NTSYSAPI NTSTATUS  WINAPI NtReleaseMutant(HANDLE,PLONG);
2033 NTSYSAPI NTSTATUS  WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
2034 NTSYSAPI NTSTATUS  WINAPI NtRemoveIoCompletion(HANDLE,PULONG_PTR,PULONG_PTR,PIO_STATUS_BLOCK,PLARGE_INTEGER);
2035 NTSYSAPI NTSTATUS  WINAPI NtReplaceKey(POBJECT_ATTRIBUTES,HANDLE,POBJECT_ATTRIBUTES);
2036 NTSYSAPI NTSTATUS  WINAPI NtReplyPort(HANDLE,PLPC_MESSAGE);
2037 NTSYSAPI NTSTATUS  WINAPI NtReplyWaitReceivePort(HANDLE,PULONG,PLPC_MESSAGE,PLPC_MESSAGE);
2038 NTSYSAPI NTSTATUS  WINAPI NtReplyWaitReceivePortEx(HANDLE,PVOID*,PPORT_MESSAGE,PPORT_MESSAGE,PLARGE_INTEGER);
2039 NTSYSAPI NTSTATUS  WINAPI NtReplyWaitReplyPort(HANDLE,PLPC_MESSAGE);
2040 NTSYSAPI NTSTATUS  WINAPI NtRequestPort(HANDLE,PLPC_MESSAGE);
2041 NTSYSAPI NTSTATUS  WINAPI NtRequestWaitReplyPort(HANDLE,PLPC_MESSAGE,PLPC_MESSAGE);
2042 NTSYSAPI NTSTATUS  WINAPI NtResetEvent(HANDLE,PULONG);
2043 NTSYSAPI NTSTATUS  WINAPI NtResetWriteWatch(HANDLE,PVOID,SIZE_T);
2044 NTSYSAPI NTSTATUS  WINAPI NtRestoreKey(HANDLE,HANDLE,ULONG);
2045 NTSYSAPI NTSTATUS  WINAPI NtResumeThread(HANDLE,PULONG);
2046 NTSYSAPI NTSTATUS  WINAPI NtSaveKey(HANDLE,HANDLE);
2047 NTSYSAPI NTSTATUS  WINAPI NtSecureConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PSID,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
2048 NTSYSAPI NTSTATUS  WINAPI NtSetContextThread(HANDLE,const CONTEXT*);
2049 NTSYSAPI NTSTATUS  WINAPI NtSetDefaultHardErrorPort(HANDLE);
2050 NTSYSAPI NTSTATUS  WINAPI NtSetDefaultLocale(BOOLEAN,LCID);
2051 NTSYSAPI NTSTATUS  WINAPI NtSetDefaultUILanguage(LANGID);
2052 NTSYSAPI NTSTATUS  WINAPI NtSetEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG);
2053 NTSYSAPI NTSTATUS  WINAPI NtSetEvent(HANDLE,PULONG);
2054 NTSYSAPI NTSTATUS  WINAPI NtSetHighEventPair(HANDLE);
2055 NTSYSAPI NTSTATUS  WINAPI NtSetHighWaitLowEventPair(HANDLE);
2056 NTSYSAPI NTSTATUS  WINAPI NtSetHighWaitLowThread(VOID);
2057 NTSYSAPI NTSTATUS  WINAPI NtSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
2058 NTSYSAPI NTSTATUS  WINAPI NtSetInformationJobObject(HANDLE,JOBOBJECTINFOCLASS,PVOID,ULONG);
2059 NTSYSAPI NTSTATUS  WINAPI NtSetInformationKey(HANDLE,const int,PVOID,ULONG);
2060 NTSYSAPI NTSTATUS  WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
2061 NTSYSAPI NTSTATUS  WINAPI NtSetInformationProcess(HANDLE,PROCESS_INFORMATION_CLASS,PVOID,ULONG);
2062 NTSYSAPI NTSTATUS  WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
2063 NTSYSAPI NTSTATUS  WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG);
2064 NTSYSAPI NTSTATUS  WINAPI NtSetIntervalProfile(ULONG,KPROFILE_SOURCE);
2065 NTSYSAPI NTSTATUS  WINAPI NtSetIoCompletion(HANDLE,ULONG_PTR,ULONG_PTR,NTSTATUS,ULONG);
2066 NTSYSAPI NTSTATUS  WINAPI NtSetLdtEntries(ULONG,LDT_ENTRY,ULONG,LDT_ENTRY);
2067 NTSYSAPI NTSTATUS  WINAPI NtSetLowEventPair(HANDLE);
2068 NTSYSAPI NTSTATUS  WINAPI NtSetLowWaitHighEventPair(HANDLE);
2069 NTSYSAPI NTSTATUS  WINAPI NtSetLowWaitHighThread(VOID);
2070 NTSYSAPI NTSTATUS  WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
2071 NTSYSAPI NTSTATUS  WINAPI NtSetSystemEnvironmentValue(PUNICODE_STRING,PUNICODE_STRING);
2072 NTSYSAPI NTSTATUS  WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG);
2073 NTSYSAPI NTSTATUS  WINAPI NtSetSystemPowerState(POWER_ACTION,SYSTEM_POWER_STATE,ULONG);
2074 NTSYSAPI NTSTATUS  WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
2075 NTSYSAPI NTSTATUS  WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMER_APC_ROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
2076 NTSYSAPI NTSTATUS  WINAPI NtSetTimerResolution(ULONG,BOOLEAN,PULONG);
2077 NTSYSAPI NTSTATUS  WINAPI NtSetValueKey(HANDLE,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
2078 NTSYSAPI NTSTATUS  WINAPI NtSetVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
2079 NTSYSAPI NTSTATUS  WINAPI NtSignalAndWaitForSingleObject(HANDLE,HANDLE,BOOLEAN,const LARGE_INTEGER*);
2080 NTSYSAPI NTSTATUS  WINAPI NtShutdownSystem(SHUTDOWN_ACTION);
2081 NTSYSAPI NTSTATUS  WINAPI NtStartProfile(HANDLE);
2082 NTSYSAPI NTSTATUS  WINAPI NtStopProfile(HANDLE);
2083 NTSYSAPI NTSTATUS  WINAPI NtSuspendThread(HANDLE,PULONG);
2084 NTSYSAPI NTSTATUS  WINAPI NtSystemDebugControl(SYSDBG_COMMAND,PVOID,ULONG,PVOID,ULONG,PULONG);
2085 NTSYSAPI NTSTATUS  WINAPI NtTerminateJobObject(HANDLE,NTSTATUS);
2086 NTSYSAPI NTSTATUS  WINAPI NtTerminateProcess(HANDLE,LONG);
2087 NTSYSAPI NTSTATUS  WINAPI NtTerminateThread(HANDLE,LONG);
2088 NTSYSAPI NTSTATUS  WINAPI NtTestAlert(VOID);
2089 NTSYSAPI NTSTATUS  WINAPI NtUnloadDriver(const UNICODE_STRING *);
2090 NTSYSAPI NTSTATUS  WINAPI NtUnloadKey(POBJECT_ATTRIBUTES);
2091 NTSYSAPI NTSTATUS  WINAPI NtUnloadKeyEx(POBJECT_ATTRIBUTES,HANDLE);
2092 NTSYSAPI NTSTATUS  WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG);
2093 NTSYSAPI NTSTATUS  WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
2094 NTSYSAPI NTSTATUS  WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
2095 NTSYSAPI NTSTATUS  WINAPI NtVdmControl(ULONG,PVOID);
2096 NTSYSAPI NTSTATUS  WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
2097 NTSYSAPI NTSTATUS  WINAPI NtWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
2098 NTSYSAPI NTSTATUS  WINAPI NtWaitHighEventPair(HANDLE);
2099 NTSYSAPI NTSTATUS  WINAPI NtWaitLowEventPair(HANDLE);
2100 NTSYSAPI NTSTATUS  WINAPI NtWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
2101 NTSYSAPI NTSTATUS  WINAPI NtWriteFileGather(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,FILE_SEGMENT_ELEMENT*,ULONG,PLARGE_INTEGER,PULONG);
2102 NTSYSAPI NTSTATUS  WINAPI NtWriteRequestData(HANDLE,PLPC_MESSAGE,ULONG,PVOID,ULONG,PULONG);
2103 NTSYSAPI NTSTATUS  WINAPI NtWriteVirtualMemory(HANDLE,void*,const void*,SIZE_T,SIZE_T*);
2104 NTSYSAPI NTSTATUS  WINAPI NtYieldExecution(void);
2105
2106 NTSYSAPI void      WINAPI RtlAcquirePebLock(void);
2107 NTSYSAPI BYTE      WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK,BYTE);
2108 NTSYSAPI BYTE      WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK,BYTE);
2109 NTSYSAPI NTSTATUS  WINAPI RtlActivateActivationContext(DWORD,HANDLE,ULONG_PTR*);
2110 NTSYSAPI NTSTATUS  WINAPI RtlAddAce(PACL,DWORD,DWORD,PACE_HEADER,DWORD);
2111 NTSYSAPI NTSTATUS  WINAPI RtlAddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
2112 NTSYSAPI NTSTATUS  WINAPI RtlAddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
2113 NTSYSAPI NTSTATUS  WINAPI RtlAddAccessDeniedAce(PACL,DWORD,DWORD,PSID);
2114 NTSYSAPI NTSTATUS  WINAPI RtlAddAccessDeniedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
2115 NTSYSAPI NTSTATUS  WINAPI RtlAddAtomToAtomTable(RTL_ATOM_TABLE,const WCHAR*,RTL_ATOM*);
2116 NTSYSAPI NTSTATUS  WINAPI RtlAddAuditAccessAce(PACL,DWORD,DWORD,PSID,BOOL,BOOL);
2117 NTSYSAPI NTSTATUS  WINAPI RtlAddAuditAccessAceEx(PACL,DWORD,DWORD,DWORD,PSID,BOOL,BOOL);
2118 NTSYSAPI void      WINAPI RtlAddRefActivationContext(HANDLE);
2119 NTSYSAPI PVOID     WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER);
2120 NTSYSAPI NTSTATUS  WINAPI RtlAdjustPrivilege(ULONG,BOOLEAN,BOOLEAN,PBOOLEAN);
2121 NTSYSAPI NTSTATUS  WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
2122 NTSYSAPI RTL_HANDLE * WINAPI RtlAllocateHandle(RTL_HANDLE_TABLE *,ULONG *);
2123 NTSYSAPI PVOID     WINAPI RtlAllocateHeap(HANDLE,ULONG,SIZE_T) __WINE_ALLOC_SIZE(3);
2124 NTSYSAPI WCHAR     WINAPI RtlAnsiCharToUnicodeChar(LPSTR *);
2125 NTSYSAPI DWORD     WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
2126 NTSYSAPI NTSTATUS  WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
2127 NTSYSAPI NTSTATUS  WINAPI RtlAppendAsciizToString(STRING *,LPCSTR);
2128 NTSYSAPI NTSTATUS  WINAPI RtlAppendStringToString(STRING *,const STRING *);
2129 NTSYSAPI NTSTATUS  WINAPI RtlAppendUnicodeStringToString(UNICODE_STRING *,const UNICODE_STRING *);
2130 NTSYSAPI NTSTATUS  WINAPI RtlAppendUnicodeToString(UNICODE_STRING *,LPCWSTR);
2131 NTSYSAPI BOOLEAN   WINAPI RtlAreAllAccessesGranted(ACCESS_MASK,ACCESS_MASK);
2132 NTSYSAPI BOOLEAN   WINAPI RtlAreAnyAccessesGranted(ACCESS_MASK,ACCESS_MASK);
2133 NTSYSAPI BOOLEAN   WINAPI RtlAreBitsSet(PCRTL_BITMAP,ULONG,ULONG);
2134 NTSYSAPI BOOLEAN   WINAPI RtlAreBitsClear(PCRTL_BITMAP,ULONG,ULONG);
2135 NTSYSAPI NTSTATUS  WINAPI RtlCharToInteger(PCSZ,ULONG,PULONG);
2136 NTSYSAPI NTSTATUS  WINAPI RtlCheckRegistryKey(ULONG, PWSTR);
2137 NTSYSAPI void      WINAPI RtlClearAllBits(PRTL_BITMAP);
2138 NTSYSAPI void      WINAPI RtlClearBits(PRTL_BITMAP,ULONG,ULONG);
2139 NTSYSAPI NTSTATUS  WINAPI RtlCreateActivationContext(HANDLE*,const void*);
2140 NTSYSAPI PDEBUG_BUFFER WINAPI RtlCreateQueryDebugBuffer(ULONG,BOOLEAN);
2141 NTSYSAPI ULONG     WINAPI RtlCompactHeap(HANDLE,ULONG);
2142 NTSYSAPI LONG      WINAPI RtlCompareString(const STRING*,const STRING*,BOOLEAN);
2143 NTSYSAPI LONG      WINAPI RtlCompareUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2144 NTSYSAPI NTSTATUS  WINAPI RtlCompressBuffer(USHORT,PUCHAR,ULONG,PUCHAR,ULONG,ULONG,PULONG,PVOID);
2145 NTSYSAPI DWORD     WINAPI RtlComputeCrc32(DWORD,const BYTE*,INT);
2146 NTSYSAPI NTSTATUS  WINAPI RtlConvertSidToUnicodeString(PUNICODE_STRING,PSID,BOOLEAN);
2147 NTSYSAPI void      WINAPI RtlCopyLuid(PLUID,const LUID*);
2148 NTSYSAPI void      WINAPI RtlCopyLuidAndAttributesArray(ULONG,const LUID_AND_ATTRIBUTES*,PLUID_AND_ATTRIBUTES);
2149 NTSYSAPI BOOLEAN   WINAPI RtlCopySid(DWORD,PSID,PSID);
2150 NTSYSAPI NTSTATUS  WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR);
2151 NTSYSAPI void      WINAPI RtlCopyString(STRING*,const STRING*);
2152 NTSYSAPI void      WINAPI RtlCopyUnicodeString(UNICODE_STRING*,const UNICODE_STRING*);
2153 NTSYSAPI NTSTATUS  WINAPI RtlCreateAcl(PACL,DWORD,DWORD);
2154 NTSYSAPI NTSTATUS  WINAPI RtlCreateAtomTable(ULONG,RTL_ATOM_TABLE*);
2155 NTSYSAPI NTSTATUS  WINAPI RtlCreateEnvironment(BOOLEAN, PWSTR*);
2156 NTSYSAPI HANDLE    WINAPI RtlCreateHeap(ULONG,PVOID,SIZE_T,SIZE_T,PVOID,PRTL_HEAP_DEFINITION);
2157 NTSYSAPI NTSTATUS  WINAPI RtlCreateProcessParameters(RTL_USER_PROCESS_PARAMETERS**,const UNICODE_STRING*,const UNICODE_STRING*,const UNICODE_STRING*,const UNICODE_STRING*,PWSTR,const UNICODE_STRING*,const UNICODE_STRING*,const UNICODE_STRING*,const UNICODE_STRING*);
2158 NTSYSAPI NTSTATUS  WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
2159 NTSYSAPI NTSTATUS  WINAPI RtlCreateTimerQueue(PHANDLE);
2160 NTSYSAPI NTSTATUS  WINAPI RtlCreateTimer(PHANDLE, HANDLE, RTL_WAITORTIMERCALLBACKFUNC, PVOID, DWORD, DWORD, ULONG);
2161 NTSYSAPI BOOLEAN   WINAPI RtlCreateUnicodeString(PUNICODE_STRING,LPCWSTR);
2162 NTSYSAPI BOOLEAN   WINAPI RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING,LPCSTR);
2163 NTSYSAPI NTSTATUS  WINAPI RtlCreateUserThread(HANDLE,const SECURITY_DESCRIPTOR*,BOOLEAN,PVOID,SIZE_T,SIZE_T,PRTL_THREAD_START_ROUTINE,void*,HANDLE*,CLIENT_ID*);
2164 NTSYSAPI void      WINAPI RtlDeactivateActivationContext(DWORD,ULONG_PTR);
2165 NTSYSAPI NTSTATUS  WINAPI RtlDecompressBuffer(USHORT,PUCHAR,ULONG,PUCHAR,ULONG,PULONG);
2166 NTSYSAPI NTSTATUS  WINAPI RtlDeleteAce(PACL,DWORD);
2167 NTSYSAPI NTSTATUS  WINAPI RtlDeleteAtomFromAtomTable(RTL_ATOM_TABLE,RTL_ATOM);
2168 NTSYSAPI NTSTATUS  WINAPI RtlDeleteCriticalSection(RTL_CRITICAL_SECTION *);
2169 NTSYSAPI NTSTATUS  WINAPI RtlDeleteRegistryValue(ULONG, PCWSTR, PCWSTR);
2170 NTSYSAPI void      WINAPI RtlDeleteResource(LPRTL_RWLOCK);
2171 NTSYSAPI NTSTATUS  WINAPI RtlDeleteSecurityObject(PSECURITY_DESCRIPTOR*);
2172 NTSYSAPI NTSTATUS  WINAPI RtlDeleteTimer(HANDLE, HANDLE, HANDLE);
2173 NTSYSAPI NTSTATUS  WINAPI RtlDeleteTimerQueueEx(HANDLE, HANDLE);
2174 NTSYSAPI PRTL_USER_PROCESS_PARAMETERS WINAPI RtlDeNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
2175 NTSYSAPI NTSTATUS  WINAPI RtlDeregisterWait(HANDLE);
2176 NTSYSAPI NTSTATUS  WINAPI RtlDeregisterWaitEx(HANDLE,HANDLE);
2177 NTSYSAPI NTSTATUS  WINAPI RtlDestroyAtomTable(RTL_ATOM_TABLE);
2178 NTSYSAPI NTSTATUS  WINAPI RtlDestroyEnvironment(PWSTR);
2179 NTSYSAPI NTSTATUS  WINAPI RtlDestroyHandleTable(RTL_HANDLE_TABLE *);
2180 NTSYSAPI HANDLE    WINAPI RtlDestroyHeap(HANDLE);
2181 NTSYSAPI void      WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*);
2182 NTSYSAPI NTSTATUS  WINAPI RtlDestroyQueryDebugBuffer(PDEBUG_BUFFER);
2183 NTSYSAPI DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR);
2184 NTSYSAPI BOOLEAN   WINAPI RtlDllShutdownInProgress(void);
2185 NTSYSAPI BOOLEAN   WINAPI RtlDoesFileExists_U(LPCWSTR);
2186 NTSYSAPI BOOLEAN   WINAPI RtlDosPathNameToNtPathName_U(PCWSTR,PUNICODE_STRING,PWSTR*,CURDIR*);
2187 NTSYSAPI ULONG     WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*);
2188 NTSYSAPI WCHAR     WINAPI RtlDowncaseUnicodeChar(WCHAR);
2189 NTSYSAPI NTSTATUS  WINAPI RtlDowncaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2190 NTSYSAPI void      WINAPI RtlDumpResource(LPRTL_RWLOCK);
2191 NTSYSAPI NTSTATUS  WINAPI RtlDuplicateUnicodeString(int,const UNICODE_STRING*,UNICODE_STRING*);
2192 NTSYSAPI NTSTATUS  WINAPI RtlEmptyAtomTable(RTL_ATOM_TABLE,BOOLEAN);
2193 NTSYSAPI NTSTATUS  WINAPI RtlEnterCriticalSection(RTL_CRITICAL_SECTION *);
2194 NTSYSAPI void      WINAPI RtlEraseUnicodeString(UNICODE_STRING*);
2195 NTSYSAPI NTSTATUS  WINAPI RtlEqualComputerName(const UNICODE_STRING*,const UNICODE_STRING*);
2196 NTSYSAPI NTSTATUS  WINAPI RtlEqualDomainName(const UNICODE_STRING*,const UNICODE_STRING*);
2197 NTSYSAPI BOOLEAN   WINAPI RtlEqualLuid(const LUID*,const LUID*);
2198 NTSYSAPI BOOL      WINAPI RtlEqualPrefixSid(PSID,PSID);
2199 NTSYSAPI BOOL      WINAPI RtlEqualSid(PSID,PSID);
2200 NTSYSAPI BOOLEAN   WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN);
2201 NTSYSAPI BOOLEAN   WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2202 NTSYSAPI void      DECLSPEC_NORETURN WINAPI RtlExitUserThread(ULONG);
2203 NTSYSAPI NTSTATUS  WINAPI RtlExpandEnvironmentStrings_U(PCWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*);
2204 NTSYSAPI NTSTATUS  WINAPI RtlFindActivationContextSectionString(ULONG,const GUID*,ULONG,const UNICODE_STRING*,PVOID);
2205 NTSYSAPI NTSTATUS  WINAPI RtlFindCharInUnicodeString(int,const UNICODE_STRING*,const UNICODE_STRING*,USHORT*);
2206 NTSYSAPI ULONG     WINAPI RtlFindClearBits(PCRTL_BITMAP,ULONG,ULONG);
2207 NTSYSAPI ULONG     WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP,ULONG,ULONG);
2208 NTSYSAPI ULONG     WINAPI RtlFindClearRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
2209 NTSYSAPI ULONG     WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
2210 NTSYSAPI ULONG     WINAPI RtlFindLastBackwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
2211 NTSYSAPI CCHAR     WINAPI RtlFindLeastSignificantBit(ULONGLONG);
2212 NTSYSAPI ULONG     WINAPI RtlFindLongestRunSet(PCRTL_BITMAP,PULONG);
2213 NTSYSAPI ULONG     WINAPI RtlFindLongestRunClear(PCRTL_BITMAP,PULONG);
2214 NTSYSAPI NTSTATUS  WINAPI RtlFindMessage(HMODULE,ULONG,ULONG,ULONG,const MESSAGE_RESOURCE_ENTRY**);
2215 NTSYSAPI CCHAR     WINAPI RtlFindMostSignificantBit(ULONGLONG);
2216 NTSYSAPI ULONG     WINAPI RtlFindNextForwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
2217 NTSYSAPI ULONG     WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
2218 NTSYSAPI ULONG     WINAPI RtlFindSetBits(PCRTL_BITMAP,ULONG,ULONG);
2219 NTSYSAPI ULONG     WINAPI RtlFindSetBitsAndClear(PRTL_BITMAP,ULONG,ULONG);
2220 NTSYSAPI ULONG     WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
2221 NTSYSAPI BOOLEAN   WINAPI RtlFirstFreeAce(PACL,PACE_HEADER *);
2222 NTSYSAPI NTSTATUS  WINAPI RtlFormatCurrentUserKeyPath(PUNICODE_STRING);
2223 NTSYSAPI NTSTATUS  WINAPI RtlFormatMessage(LPWSTR,UCHAR,BOOLEAN,BOOLEAN,BOOLEAN,__ms_va_list *,LPWSTR,ULONG);
2224 NTSYSAPI void      WINAPI RtlFreeAnsiString(PANSI_STRING);
2225 NTSYSAPI BOOLEAN   WINAPI RtlFreeHandle(RTL_HANDLE_TABLE *,RTL_HANDLE *);
2226 NTSYSAPI BOOLEAN   WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
2227 NTSYSAPI void      WINAPI RtlFreeOemString(POEM_STRING);
2228 NTSYSAPI DWORD     WINAPI RtlFreeSid(PSID);
2229 NTSYSAPI void      WINAPI RtlFreeThreadActivationContextStack(void);
2230 NTSYSAPI void      WINAPI RtlFreeUnicodeString(PUNICODE_STRING);
2231 NTSYSAPI NTSTATUS  WINAPI RtlGetAce(PACL,DWORD,LPVOID *);
2232 NTSYSAPI NTSTATUS  WINAPI RtlGetActiveActivationContext(HANDLE*);
2233 NTSYSAPI NTSTATUS  WINAPI RtlGetCompressionWorkSpaceSize(USHORT,PULONG,PULONG);
2234 NTSYSAPI NTSTATUS  WINAPI RtlGetControlSecurityDescriptor(PSECURITY_DESCRIPTOR, PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
2235 NTSYSAPI NTSTATUS  WINAPI RtlGetCurrentDirectory_U(ULONG, LPWSTR);
2236 NTSYSAPI PEB *     WINAPI RtlGetCurrentPeb(void);
2237 NTSYSAPI NTSTATUS  WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
2238 NTSYSAPI ULONG     WINAPI RtlGetFullPathName_U(PCWSTR,ULONG,PWSTR,PWSTR*);
2239 NTSYSAPI NTSTATUS  WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
2240 NTSYSAPI NTSTATUS  WINAPI RtlGetLastNtStatus(void);
2241 NTSYSAPI DWORD     WINAPI RtlGetLastWin32Error(void);
2242 NTSYSAPI DWORD     WINAPI RtlGetLongestNtPathLength(void);
2243 NTSYSAPI ULONG     WINAPI RtlGetNtGlobalFlags(void);
2244 NTSYSAPI BOOLEAN   WINAPI RtlGetNtProductType(LPDWORD);
2245 NTSYSAPI NTSTATUS  WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
2246 NTSYSAPI ULONG     WINAPI RtlGetProcessHeaps(ULONG,HANDLE*);
2247 NTSYSAPI NTSTATUS  WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
2248 NTSYSAPI NTSTATUS  WINAPI RtlGetVersion(RTL_OSVERSIONINFOEXW*);
2249 NTSYSAPI NTSTATUS  WINAPI RtlGUIDFromString(PUNICODE_STRING,GUID*);
2250 NTSYSAPI PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(PSID);
2251 NTSYSAPI PVOID     WINAPI RtlImageDirectoryEntryToData(HMODULE,BOOL,WORD,ULONG *);
2252 NTSYSAPI PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE);
2253 NTSYSAPI PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection(const IMAGE_NT_HEADERS *,HMODULE,DWORD);
2254 NTSYSAPI PVOID     WINAPI RtlImageRvaToVa(const IMAGE_NT_HEADERS *,HMODULE,DWORD,IMAGE_SECTION_HEADER **);
2255 NTSYSAPI NTSTATUS  WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
2256 NTSYSAPI void      WINAPI RtlInitString(PSTRING,PCSZ);
2257 NTSYSAPI void      WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
2258 NTSYSAPI NTSTATUS  WINAPI RtlInitAnsiStringEx(PANSI_STRING,PCSZ);
2259 NTSYSAPI void      WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
2260 NTSYSAPI NTSTATUS  WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
2261 NTSYSAPI NTSTATUS  WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *);
2262 NTSYSAPI NTSTATUS  WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,ULONG);
2263 NTSYSAPI NTSTATUS  WINAPI RtlInitializeCriticalSectionEx(RTL_CRITICAL_SECTION *,ULONG,ULONG);
2264 NTSYSAPI void      WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);
2265 NTSYSAPI void      WINAPI RtlInitializeHandleTable(ULONG,ULONG,RTL_HANDLE_TABLE *);
2266 NTSYSAPI void      WINAPI RtlInitializeResource(LPRTL_RWLOCK);
2267 NTSYSAPI BOOL      WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
2268 NTSYSAPI NTSTATUS  WINAPI RtlInt64ToUnicodeString(ULONGLONG,ULONG,UNICODE_STRING *);
2269 NTSYSAPI NTSTATUS  WINAPI RtlIntegerToChar(ULONG,ULONG,ULONG,PCHAR);
2270 NTSYSAPI NTSTATUS  WINAPI RtlIntegerToUnicodeString(ULONG,ULONG,UNICODE_STRING *);
2271 NTSYSAPI BOOLEAN   WINAPI RtlIsActivationContextActive(HANDLE);
2272 NTSYSAPI ULONG     WINAPI RtlIsDosDeviceName_U(PCWSTR);
2273 NTSYSAPI BOOLEAN   WINAPI RtlIsNameLegalDOS8Dot3(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
2274 NTSYSAPI BOOLEAN   WINAPI RtlIsTextUnicode(LPCVOID,INT,INT *);
2275 NTSYSAPI BOOLEAN   WINAPI RtlIsValidHandle(const RTL_HANDLE_TABLE *, const RTL_HANDLE *);
2276 NTSYSAPI BOOLEAN   WINAPI RtlIsValidIndexHandle(const RTL_HANDLE_TABLE *, ULONG Index, RTL_HANDLE **);
2277 NTSYSAPI NTSTATUS  WINAPI RtlLeaveCriticalSection(RTL_CRITICAL_SECTION *);
2278 NTSYSAPI DWORD     WINAPI RtlLengthRequiredSid(DWORD);
2279 NTSYSAPI ULONG     WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR);
2280 NTSYSAPI DWORD     WINAPI RtlLengthSid(PSID);
2281 NTSYSAPI NTSTATUS  WINAPI RtlLocalTimeToSystemTime(const LARGE_INTEGER*,PLARGE_INTEGER);
2282 NTSYSAPI BOOLEAN   WINAPI RtlLockHeap(HANDLE);
2283 NTSYSAPI NTSTATUS  WINAPI RtlLookupAtomInAtomTable(RTL_ATOM_TABLE,const WCHAR*,RTL_ATOM*);
2284 NTSYSAPI NTSTATUS  WINAPI RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
2285 NTSYSAPI void      WINAPI RtlMapGenericMask(PACCESS_MASK,const GENERIC_MAPPING*);
2286 NTSYSAPI NTSTATUS  WINAPI RtlMultiByteToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
2287 NTSYSAPI NTSTATUS  WINAPI RtlMultiByteToUnicodeSize(DWORD*,LPCSTR,UINT);
2288 NTSYSAPI NTSTATUS  WINAPI RtlNewSecurityObject(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,BOOLEAN,HANDLE,PGENERIC_MAPPING);
2289 NTSYSAPI PRTL_USER_PROCESS_PARAMETERS WINAPI RtlNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
2290 NTSYSAPI ULONG     WINAPI RtlNtStatusToDosError(NTSTATUS);
2291 NTSYSAPI ULONG     WINAPI RtlNtStatusToDosErrorNoTeb(NTSTATUS);
2292 NTSYSAPI ULONG     WINAPI RtlNumberOfSetBits(PCRTL_BITMAP);
2293 NTSYSAPI ULONG     WINAPI RtlNumberOfClearBits(PCRTL_BITMAP);
2294 NTSYSAPI UINT      WINAPI RtlOemStringToUnicodeSize(const STRING*);
2295 NTSYSAPI NTSTATUS  WINAPI RtlOemStringToUnicodeString(UNICODE_STRING*,const STRING*,BOOLEAN);
2296 NTSYSAPI NTSTATUS  WINAPI RtlOemToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
2297 NTSYSAPI NTSTATUS  WINAPI RtlOpenCurrentUser(ACCESS_MASK,PHANDLE);
2298 NTSYSAPI PVOID     WINAPI RtlPcToFileHeader(PVOID,PVOID*);
2299 NTSYSAPI NTSTATUS  WINAPI RtlPinAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM);
2300 NTSYSAPI BOOLEAN   WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
2301 NTSYSAPI BOOLEAN   WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2302 NTSYSAPI NTSTATUS  WINAPI RtlQueryAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM,ULONG*,ULONG*,WCHAR*,ULONG*);
2303 NTSYSAPI NTSTATUS  WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
2304 NTSYSAPI NTSTATUS  WINAPI RtlQueryHeapInformation(HANDLE,HEAP_INFORMATION_CLASS,PVOID,SIZE_T,PSIZE_T);
2305 NTSYSAPI NTSTATUS  WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
2306 NTSYSAPI NTSTATUS  WINAPI RtlQueryInformationActivationContext(ULONG,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
2307 NTSYSAPI NTSTATUS  WINAPI RtlQueryProcessDebugInformation(ULONG,ULONG,PDEBUG_BUFFER);
2308 NTSYSAPI NTSTATUS  WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID);
2309 NTSYSAPI NTSTATUS  WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*);
2310 NTSYSAPI NTSTATUS  WINAPI RtlQueueWorkItem(PRTL_WORK_ITEM_ROUTINE,PVOID,ULONG);
2311 NTSYSAPI void      WINAPI RtlRaiseException(PEXCEPTION_RECORD);
2312 NTSYSAPI void      WINAPI RtlRaiseStatus(NTSTATUS);
2313 NTSYSAPI ULONG     WINAPI RtlRandom(PULONG);
2314 NTSYSAPI PVOID     WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,SIZE_T);
2315 NTSYSAPI NTSTATUS  WINAPI RtlRegisterWait(PHANDLE,HANDLE,RTL_WAITORTIMERCALLBACKFUNC,PVOID,ULONG,ULONG);
2316 NTSYSAPI void      WINAPI RtlReleaseActivationContext(HANDLE);
2317 NTSYSAPI void      WINAPI RtlReleasePebLock(void);
2318 NTSYSAPI void      WINAPI RtlReleaseResource(LPRTL_RWLOCK);
2319 NTSYSAPI ULONG     WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
2320 NTSYSAPI void      WINAPI RtlRestoreLastWin32Error(DWORD);
2321 NTSYSAPI void      WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *);
2322 NTSYSAPI void      WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);
2323 NTSYSAPI NTSTATUS  WINAPI RtlSelfRelativeToAbsoluteSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PDWORD,PACL,PDWORD,PACL,PDWORD,PSID,PDWORD,PSID,PDWORD);
2324 NTSYSAPI void      WINAPI RtlSetAllBits(PRTL_BITMAP);
2325 NTSYSAPI void      WINAPI RtlSetBits(PRTL_BITMAP,ULONG,ULONG);
2326 NTSYSAPI ULONG     WINAPI RtlSetCriticalSectionSpinCount(RTL_CRITICAL_SECTION*,ULONG);
2327 NTSYSAPI NTSTATUS  WINAPI RtlSetControlSecurityDescriptor(PSECURITY_DESCRIPTOR,SECURITY_DESCRIPTOR_CONTROL,SECURITY_DESCRIPTOR_CONTROL);
2328 NTSYSAPI NTSTATUS  WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING*);
2329 NTSYSAPI void      WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR*);
2330 NTSYSAPI NTSTATUS  WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
2331 NTSYSAPI NTSTATUS  WINAPI RtlSetEnvironmentVariable(PWSTR*,PUNICODE_STRING,PUNICODE_STRING);
2332 NTSYSAPI NTSTATUS  WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
2333 NTSYSAPI NTSTATUS  WINAPI RtlSetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
2334 NTSYSAPI NTSTATUS  WINAPI RtlSetIoCompletionCallback(HANDLE,PRTL_OVERLAPPED_COMPLETION_ROUTINE,ULONG);
2335 NTSYSAPI void      WINAPI RtlSetLastWin32Error(DWORD);
2336 NTSYSAPI void      WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus(NTSTATUS);
2337 NTSYSAPI NTSTATUS  WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
2338 NTSYSAPI NTSTATUS  WINAPI RtlSetTimeZoneInformation(const RTL_TIME_ZONE_INFORMATION*);
2339 NTSYSAPI SIZE_T    WINAPI RtlSizeHeap(HANDLE,ULONG,const void*);
2340 NTSYSAPI NTSTATUS  WINAPI RtlStringFromGUID(REFGUID,PUNICODE_STRING);
2341 NTSYSAPI LPDWORD   WINAPI RtlSubAuthoritySid(PSID,DWORD);
2342 NTSYSAPI LPBYTE    WINAPI RtlSubAuthorityCountSid(PSID);
2343 NTSYSAPI NTSTATUS  WINAPI RtlSystemTimeToLocalTime(const LARGE_INTEGER*,PLARGE_INTEGER);
2344 NTSYSAPI void      WINAPI RtlTimeToTimeFields(const LARGE_INTEGER*,PTIME_FIELDS);
2345 NTSYSAPI BOOLEAN   WINAPI RtlTimeFieldsToTime(PTIME_FIELDS,PLARGE_INTEGER);
2346 NTSYSAPI void      WINAPI RtlTimeToElapsedTimeFields(const LARGE_INTEGER *,PTIME_FIELDS);
2347 NTSYSAPI BOOLEAN   WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *,LPDWORD);
2348 NTSYSAPI BOOLEAN   WINAPI RtlTimeToSecondsSince1980(const LARGE_INTEGER *,LPDWORD);
2349 NTSYSAPI BOOL      WINAPI RtlTryEnterCriticalSection(RTL_CRITICAL_SECTION *);
2350 NTSYSAPI ULONGLONG __cdecl RtlUlonglongByteSwap(ULONGLONG);
2351 NTSYSAPI DWORD     WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING*);
2352 NTSYSAPI NTSTATUS  WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING,PCUNICODE_STRING,BOOLEAN);
2353 NTSYSAPI NTSTATUS  WINAPI RtlUnicodeStringToInteger(const UNICODE_STRING *,ULONG,ULONG *);
2354 NTSYSAPI DWORD     WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING*);
2355 NTSYSAPI NTSTATUS  WINAPI RtlUnicodeStringToOemString(POEM_STRING,PCUNICODE_STRING,BOOLEAN);
2356 NTSYSAPI NTSTATUS  WINAPI RtlUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2357 NTSYSAPI NTSTATUS  WINAPI RtlUnicodeToMultiByteSize(PULONG,PCWSTR,ULONG);
2358 NTSYSAPI NTSTATUS  WINAPI RtlUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2359 NTSYSAPI ULONG     WINAPI RtlUniform(PULONG);
2360 NTSYSAPI BOOLEAN   WINAPI RtlUnlockHeap(HANDLE);
2361 NTSYSAPI void      WINAPI RtlUnwind(PVOID,PVOID,PEXCEPTION_RECORD,PVOID);
2362 #ifdef __ia64__
2363 NTSYSAPI void      WINAPI RtlUnwind2(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT);
2364 NTSYSAPI void      WINAPI RtlUnwindEx(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT,PUNWIND_HISTORY_TABLE);
2365 #endif
2366 NTSYSAPI WCHAR     WINAPI RtlUpcaseUnicodeChar(WCHAR);
2367 NTSYSAPI NTSTATUS  WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING *,BOOLEAN);
2368 NTSYSAPI NTSTATUS  WINAPI RtlUpcaseUnicodeStringToAnsiString(STRING*,const UNICODE_STRING*,BOOLEAN);
2369 NTSYSAPI NTSTATUS  WINAPI RtlUpcaseUnicodeStringToCountedOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
2370 NTSYSAPI NTSTATUS  WINAPI RtlUpcaseUnicodeStringToOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
2371 NTSYSAPI NTSTATUS  WINAPI RtlUpcaseUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2372 NTSYSAPI NTSTATUS  WINAPI RtlUpcaseUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2373 NTSYSAPI NTSTATUS  WINAPI RtlUpdateTimer(HANDLE, HANDLE, DWORD, DWORD);
2374 NTSYSAPI CHAR      WINAPI RtlUpperChar(CHAR);
2375 NTSYSAPI void      WINAPI RtlUpperString(STRING *,const STRING *);
2376 NTSYSAPI NTSTATUS  WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
2377 NTSYSAPI BOOLEAN   WINAPI RtlValidAcl(PACL);
2378 NTSYSAPI BOOLEAN   WINAPI RtlValidSid(PSID);
2379 NTSYSAPI BOOLEAN   WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
2380 NTSYSAPI NTSTATUS  WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
2381 NTSYSAPI NTSTATUS  WINAPI RtlWalkHeap(HANDLE,PVOID);
2382 NTSYSAPI NTSTATUS  WINAPI RtlWow64EnableFsRedirection(BOOLEAN);
2383 NTSYSAPI NTSTATUS  WINAPI RtlWow64EnableFsRedirectionEx(ULONG,ULONG*);
2384 NTSYSAPI NTSTATUS  WINAPI RtlWriteRegistryValue(ULONG,PCWSTR,PCWSTR,ULONG,PVOID,ULONG);
2385 NTSYSAPI NTSTATUS  WINAPI RtlpNtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
2386 NTSYSAPI NTSTATUS  WINAPI RtlpNtEnumerateSubKey(HANDLE,UNICODE_STRING *, ULONG);
2387 NTSYSAPI NTSTATUS  WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);
2388 NTSYSAPI NTSTATUS  WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
2389 NTSYSAPI NTSTATUS  WINAPI vDbgPrintEx(ULONG,ULONG,LPCSTR,__ms_va_list);
2390 NTSYSAPI NTSTATUS  WINAPI vDbgPrintExWithPrefix(LPCSTR,ULONG,ULONG,LPCSTR,__ms_va_list);
2391
2392 /* 32-bit only functions */
2393
2394 #ifndef _WIN64
2395 NTSYSAPI LONGLONG  WINAPI RtlConvertLongToLargeInteger(LONG);
2396 NTSYSAPI ULONGLONG WINAPI RtlConvertUlongToLargeInteger(ULONG);
2397 NTSYSAPI LONGLONG  WINAPI RtlEnlargedIntegerMultiply(INT,INT);
2398 NTSYSAPI ULONGLONG WINAPI RtlEnlargedUnsignedMultiply(UINT,UINT);
2399 NTSYSAPI UINT      WINAPI RtlEnlargedUnsignedDivide(ULONGLONG,UINT,UINT *);
2400 NTSYSAPI LONGLONG  WINAPI RtlExtendedMagicDivide(LONGLONG,LONGLONG,INT);
2401 NTSYSAPI LONGLONG  WINAPI RtlExtendedIntegerMultiply(LONGLONG,INT);
2402 NTSYSAPI LONGLONG  WINAPI RtlExtendedLargeIntegerDivide(LONGLONG,INT,INT *);
2403 NTSYSAPI LONGLONG  WINAPI RtlLargeIntegerAdd(LONGLONG,LONGLONG);
2404 NTSYSAPI LONGLONG  WINAPI RtlLargeIntegerArithmeticShift(LONGLONG,INT);
2405 NTSYSAPI ULONGLONG WINAPI RtlLargeIntegerDivide( ULONGLONG,ULONGLONG,ULONGLONG *);
2406 NTSYSAPI LONGLONG  WINAPI RtlLargeIntegerNegate(LONGLONG);
2407 NTSYSAPI LONGLONG  WINAPI RtlLargeIntegerShiftLeft(LONGLONG,INT);
2408 NTSYSAPI LONGLONG  WINAPI RtlLargeIntegerShiftRight(LONGLONG,INT);
2409 NTSYSAPI LONGLONG  WINAPI RtlLargeIntegerSubtract(LONGLONG,LONGLONG);
2410 NTSYSAPI NTSTATUS  WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PCHAR);
2411 #endif
2412
2413 /* Wine internal functions */
2414
2415 NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
2416                                                    UINT disposition, BOOLEAN check_case );
2417 NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt );
2418
2419
2420 /***********************************************************************
2421  * Inline functions
2422  */
2423
2424 #define InitializeObjectAttributes(p,n,a,r,s) \
2425     do { \
2426         (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
2427         (p)->RootDirectory = r; \
2428         (p)->Attributes = a; \
2429         (p)->ObjectName = n; \
2430         (p)->SecurityDescriptor = s; \
2431         (p)->SecurityQualityOfService = NULL; \
2432     } while (0)
2433
2434 #define NtCurrentProcess() ((HANDLE)-1)
2435
2436 #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
2437 #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
2438 #define RtlStoreUlong(p,v)  do { ULONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
2439 #define RtlStoreUlonglong(p,v) do { ULONGLONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
2440 #define RtlRetrieveUlong(p,s) memcpy((p), (s), sizeof(ULONG))
2441 #define RtlRetrieveUlonglong(p,s) memcpy((p), (s), sizeof(ULONGLONG))
2442 #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
2443
2444 static inline BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
2445 {
2446     if (lpBits && ulBit < lpBits->SizeOfBitMap &&
2447         lpBits->Buffer[ulBit >> 5] & (1 << (ulBit & 31)))
2448         return TRUE;
2449     return FALSE;
2450 }
2451
2452 /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
2453 static inline USHORT RtlUshortByteSwap(USHORT s)
2454 {
2455     return (s >> 8) | (s << 8);
2456 }
2457 static inline ULONG RtlUlongByteSwap(ULONG i)
2458 {
2459 #if defined(__i386__) && defined(__GNUC__)
2460     ULONG ret;
2461     __asm__("bswap %0" : "=r" (ret) : "0" (i) );
2462     return ret;
2463 #else
2464     return ((ULONG)RtlUshortByteSwap((USHORT)i) << 16) | RtlUshortByteSwap((USHORT)(i >> 16));
2465 #endif
2466 }
2467
2468 /* list manipulation macros */
2469 #define InitializeListHead(le)  (void)((le)->Flink = (le)->Blink = (le))
2470 #define InsertHeadList(le,e)    do { PLIST_ENTRY f = (le)->Flink; (e)->Flink = f; (e)->Blink = (le); f->Blink = (e); (le)->Flink = (e); } while (0)
2471 #define InsertTailList(le,e)    do { PLIST_ENTRY b = (le)->Blink; (e)->Flink = (le); (e)->Blink = b; b->Flink = (e); (le)->Blink = (e); } while (0)
2472 #define IsListEmpty(le)         ((le)->Flink == (le))
2473 #define RemoveEntryList(e)      do { PLIST_ENTRY f = (e)->Flink, b = (e)->Blink; f->Blink = b; b->Flink = f; (e)->Flink = (e)->Blink = NULL; } while (0)
2474 static inline PLIST_ENTRY RemoveHeadList(PLIST_ENTRY le)
2475 {
2476     PLIST_ENTRY f, b, e;
2477
2478     e = le->Flink;
2479     f = le->Flink->Flink;
2480     b = le->Flink->Blink;
2481     f->Blink = b;
2482     b->Flink = f;
2483
2484     if (e != le) e->Flink = e->Blink = NULL;
2485     return e;
2486 }
2487 static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
2488 {
2489     PLIST_ENTRY f, b, e;
2490
2491     e = le->Blink;
2492     f = le->Blink->Flink;
2493     b = le->Blink->Blink;
2494     f->Blink = b;
2495     b->Flink = f;
2496
2497     if (e != le) e->Flink = e->Blink = NULL;
2498     return e;
2499 }
2500
2501
2502 #ifdef __WINESRC__
2503
2504 /* FIXME: private structure for vm86 mode, stored in teb->GdiTebBatch */
2505 typedef struct
2506 {
2507     DWORD        dpmi_vif;
2508     DWORD        vm86_pending;
2509 } WINE_VM86_TEB_INFO;
2510
2511 static inline WINE_VM86_TEB_INFO *get_vm86_teb_info(void)
2512 {
2513     return (WINE_VM86_TEB_INFO *)&NtCurrentTeb()->GdiTebBatch;
2514 }
2515
2516 /* The thread information for 16-bit threads */
2517 /* NtCurrentTeb()->SubSystemTib points to this */
2518 typedef struct
2519 {
2520     void           *unknown;    /* 00 unknown */
2521     UNICODE_STRING *exe_name;   /* 04 exe module name */
2522
2523     /* the following fields do not exist under Windows */
2524     UNICODE_STRING  exe_str;    /* exe name string pointed to by exe_name */
2525     CURDIR          curdir;     /* current directory */
2526     WCHAR           curdir_buffer[MAX_PATH];
2527 } WIN16_SUBSYSTEM_TIB;
2528
2529 #endif /* __WINESRC__ */
2530
2531 #ifdef __cplusplus
2532 } /* extern "C" */
2533 #endif /* defined(__cplusplus) */
2534
2535 #endif  /* __WINE_WINTERNL_H */