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