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