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