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