gdiplus: Added GdipFillPath.
[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_PTR 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_PTR ExitStatus;
962     PPEB PebBaseAddress;
963     DWORD_PTR AffinityMask;
964     DWORD_PTR BasePriority;
965     ULONG_PTR UniqueProcessId;
966     ULONG_PTR 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 struct _FILE_COMPLETION_INFORMATION {
1689     HANDLE CompletionPort;
1690     ULONG_PTR CompletionKey;
1691 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
1692
1693 #define IO_COMPLETION_QUERY_STATE  0x0001
1694 #define IO_COMPLETION_MODIFY_STATE 0x0002
1695 #define IO_COMPLETION_ALL_ACCESS   (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
1696
1697 typedef enum _HARDERROR_RESPONSE_OPTION {
1698   OptionAbortRetryIgnore,
1699   OptionOk,
1700   OptionOkCancel,
1701   OptionRetryCancel,
1702   OptionYesNo,
1703   OptionYesNoCancel,
1704   OptionShutdownSystem
1705 } HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION;
1706
1707 typedef enum _HARDERROR_RESPONSE {
1708   ResponseReturnToCaller,
1709   ResponseNotHandled,
1710   ResponseAbort,
1711   ResponseCancel,
1712   ResponseIgnore,
1713   ResponseNo,
1714   ResponseOk,
1715   ResponseRetry,
1716   ResponseYes
1717 } HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
1718
1719 typedef enum _SYSDBG_COMMAND {
1720   SysDbgQueryModuleInformation,
1721   SysDbgQueryTraceInformation,
1722   SysDbgSetTracepoint,
1723   SysDbgSetSpecialCall,
1724   SysDbgClearSpecialCalls,
1725   SysDbgQuerySpecialCalls
1726 } SYSDBG_COMMAND, *PSYSDBG_COMMAND;
1727  
1728 /***********************************************************************
1729  * Function declarations
1730  */
1731
1732 #if defined(__i386__) && defined(__GNUC__)
1733 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
1734 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
1735 #else  /* __i386__ && __GNUC__ */
1736 void WINAPI DbgBreakPoint(void);
1737 void WINAPI DbgUserBreakPoint(void);
1738 #endif  /* __i386__ && __GNUC__ */
1739 NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...);
1740 NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...);
1741
1742 NTSTATUS  WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void**,PULONG);
1743 NTSTATUS  WINAPI LdrAddRefDll(ULONG,HMODULE);
1744 NTSTATUS  WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);
1745 NTSTATUS  WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
1746 NTSTATUS  WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*, HMODULE*);
1747 NTSTATUS  WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
1748 void      WINAPI LdrInitializeThunk(ULONG,ULONG,ULONG,ULONG);
1749 NTSTATUS  WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
1750 void      WINAPI LdrShutdownProcess(void);
1751 void      WINAPI LdrShutdownThread(void);
1752 NTSTATUS  WINAPI NtAcceptConnectPort(PHANDLE,ULONG,PLPC_MESSAGE,BOOLEAN,PLPC_SECTION_WRITE,PLPC_SECTION_READ);
1753 NTSTATUS  WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,NTSTATUS*);
1754 NTSTATUS  WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING,HANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,ACCESS_MASK,PGENERIC_MAPPING,BOOLEAN,PACCESS_MASK,PBOOLEAN,PBOOLEAN);
1755 NTSTATUS  WINAPI NtAddAtom(const WCHAR*,ULONG,RTL_ATOM*);
1756 NTSTATUS  WINAPI NtAdjustGroupsToken(HANDLE,BOOLEAN,PTOKEN_GROUPS,ULONG,PTOKEN_GROUPS,PULONG);
1757 NTSTATUS  WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
1758 NTSTATUS  WINAPI NtAlertResumeThread(HANDLE,PULONG);
1759 NTSTATUS  WINAPI NtAlertThread(HANDLE ThreadHandle);
1760 NTSTATUS  WINAPI NtAllocateLocallyUniqueId(PLUID lpLuid);
1761 NTSTATUS  WINAPI NtAllocateUuids(PULARGE_INTEGER,PULONG,PULONG);
1762 NTSTATUS  WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG,SIZE_T*,ULONG,ULONG);
1763 NTSTATUS  WINAPI NtCallbackReturn(PVOID,ULONG,NTSTATUS);
1764 NTSTATUS  WINAPI NtCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
1765 NTSTATUS  WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
1766 NTSTATUS  WINAPI NtClearEvent(HANDLE);
1767 NTSTATUS  WINAPI NtClose(HANDLE);
1768 NTSTATUS  WINAPI NtCloseObjectAuditAlarm(PUNICODE_STRING,HANDLE,BOOLEAN);
1769 NTSTATUS  WINAPI NtCompleteConnectPort(HANDLE);
1770 NTSTATUS  WINAPI NtConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1771 NTSTATUS  WINAPI NtContinue(PCONTEXT,BOOLEAN); 
1772 NTSTATUS  WINAPI NtCreateDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1773 NTSTATUS  WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1774 NTSTATUS  WINAPI NtCreateEventPair(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1775 NTSTATUS  WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1776 NTSTATUS  WINAPI NtCreateIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,ULONG);
1777 NTSTATUS  WINAPI NtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1778 NTSTATUS  WINAPI NtCreateMailslotFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,PLARGE_INTEGER);
1779 NTSTATUS  WINAPI NtCreateMutant(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,BOOLEAN);
1780 NTSTATUS  WINAPI NtCreateNamedPipeFile(PHANDLE,ULONG,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,PLARGE_INTEGER);
1781 NTSTATUS  WINAPI NtCreatePagingFile(PUNICODE_STRING,PLARGE_INTEGER,PLARGE_INTEGER,PLARGE_INTEGER);
1782 NTSTATUS  WINAPI NtCreatePort(PHANDLE,POBJECT_ATTRIBUTES,ULONG,ULONG,PULONG);
1783 NTSTATUS  WINAPI NtCreateProcess(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,BOOLEAN,HANDLE,HANDLE,HANDLE);
1784 NTSTATUS  WINAPI NtCreateProfile(PHANDLE,HANDLE,PVOID,ULONG,ULONG,PVOID,ULONG,KPROFILE_SOURCE,KAFFINITY);
1785 NTSTATUS  WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1786 NTSTATUS  WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,LONG,LONG);
1787 NTSTATUS  WINAPI NtCreateSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PUNICODE_STRING);
1788 NTSTATUS  WINAPI NtCreateThread(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PCONTEXT,PINITIAL_TEB,BOOLEAN);
1789 NTSTATUS  WINAPI NtCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1790 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);
1791 NTSTATUS  WINAPI NtDelayExecution(BOOLEAN,const LARGE_INTEGER*);
1792 NTSTATUS  WINAPI NtDeleteAtom(RTL_ATOM);
1793 NTSTATUS  WINAPI NtDeleteFile(POBJECT_ATTRIBUTES);
1794 NTSTATUS  WINAPI NtDeleteKey(HANDLE);
1795 NTSTATUS  WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING *);
1796 NTSTATUS  WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1797 NTSTATUS  WINAPI NtDisplayString(PUNICODE_STRING); 
1798 NTSTATUS  WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1799 NTSTATUS  WINAPI NtDuplicateToken(HANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,PHANDLE);
1800 NTSTATUS  WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1801 NTSTATUS  WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1802 NTSTATUS  WINAPI NtExtendSection(HANDLE,PLARGE_INTEGER); 
1803 NTSTATUS  WINAPI NtFindAtom(const WCHAR*,ULONG,RTL_ATOM*);
1804 NTSTATUS  WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
1805 NTSTATUS  WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
1806 NTSTATUS  WINAPI NtFlushKey(HANDLE);
1807 NTSTATUS  WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
1808 NTSTATUS  WINAPI NtFlushWriteBuffer(VOID);
1809 NTSTATUS  WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1810 NTSTATUS  WINAPI NtFsControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1811 NTSTATUS  WINAPI NtGetContextThread(HANDLE,CONTEXT*);
1812 NTSTATUS  WINAPI NtGetPlugPlayEvent(ULONG,ULONG,PVOID,ULONG);
1813 ULONG     WINAPI NtGetTickCount(VOID);
1814 NTSTATUS  WINAPI NtImpersonateAnonymousToken(HANDLE);
1815 NTSTATUS  WINAPI NtImpersonateClientOfPort(HANDLE,PPORT_MESSAGE);
1816 NTSTATUS  WINAPI NtImpersonateThread(HANDLE,HANDLE,PSECURITY_QUALITY_OF_SERVICE);
1817 NTSTATUS  WINAPI NtInitializeRegistry(BOOLEAN);
1818 NTSTATUS  WINAPI NtInitiatePowerAction(POWER_ACTION,SYSTEM_POWER_STATE,ULONG,BOOLEAN);
1819 NTSTATUS  WINAPI NtListenPort(HANDLE,PLPC_MESSAGE);
1820 NTSTATUS  WINAPI NtLoadDriver(const UNICODE_STRING *);
1821 NTSTATUS  WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES *);
1822 NTSTATUS  WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
1823 NTSTATUS  WINAPI NtLockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1824 NTSTATUS  WINAPI NtMakeTemporaryObject(HANDLE); 
1825 NTSTATUS  WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
1826 NTSTATUS  WINAPI NtNotifyChangeDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,ULONG,BOOLEAN);
1827 NTSTATUS  WINAPI NtNotifyChangeKey(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1828 NTSTATUS  WINAPI NtOpenDirectoryObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1829 NTSTATUS  WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1830 NTSTATUS  WINAPI NtOpenEventPair(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1831 NTSTATUS  WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1832 NTSTATUS  WINAPI NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1833 NTSTATUS  WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1834 NTSTATUS  WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1835 NTSTATUS  WINAPI NtOpenObjectAuditAlarm(PUNICODE_STRING,PHANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,ACCESS_MASK,PPRIVILEGE_SET,BOOLEAN,BOOLEAN,PBOOLEAN);
1836 NTSTATUS  WINAPI NtOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1837 NTSTATUS  WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
1838 NTSTATUS  WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1839 NTSTATUS  WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1840 NTSTATUS  WINAPI NtOpenSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1841 NTSTATUS  WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1842 NTSTATUS  WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1843 NTSTATUS  WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1844 NTSTATUS  WINAPI NtPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG);
1845 NTSTATUS  WINAPI NtPrivilegeCheck(HANDLE,PPRIVILEGE_SET,PBOOLEAN);
1846 NTSTATUS  WINAPI NtPrivilegeObjectAuditAlarm(PUNICODE_STRING,HANDLE,HANDLE,ULONG,PPRIVILEGE_SET,BOOLEAN);
1847 NTSTATUS  WINAPI NtPrivilegedServiceAuditAlarm(PUNICODE_STRING,PUNICODE_STRING,HANDLE,PPRIVILEGE_SET,BOOLEAN);
1848 NTSTATUS  WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG,ULONG*);
1849 NTSTATUS  WINAPI NtPulseEvent(HANDLE,PULONG);
1850 NTSTATUS  WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
1851 NTSTATUS  WINAPI NtQueryAttributesFile(const OBJECT_ATTRIBUTES*,FILE_BASIC_INFORMATION*);
1852 NTSTATUS  WINAPI NtQueryDefaultLocale(BOOLEAN,LCID*);
1853 NTSTATUS  WINAPI NtQueryDefaultUILanguage(LANGID*);
1854 NTSTATUS  WINAPI NtQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
1855 NTSTATUS  WINAPI NtQueryDirectoryObject(HANDLE,PDIRECTORY_BASIC_INFORMATION,ULONG,BOOLEAN,BOOLEAN,PULONG,PULONG);
1856 NTSTATUS  WINAPI NtQueryEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PVOID,BOOLEAN);
1857 NTSTATUS  WINAPI NtQueryEvent(HANDLE,EVENT_INFORMATION_CLASS,PVOID,ULONG,PULONG); 
1858 NTSTATUS  WINAPI NtQueryFullAttributesFile(const OBJECT_ATTRIBUTES*,FILE_NETWORK_OPEN_INFORMATION*);
1859 NTSTATUS  WINAPI NtQueryInformationAtom(RTL_ATOM,ATOM_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
1860 NTSTATUS  WINAPI NtQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1861 NTSTATUS  WINAPI NtQueryInformationPort(HANDLE,PORT_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1862 NTSTATUS  WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
1863 NTSTATUS  WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
1864 NTSTATUS  WINAPI NtQueryInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1865 NTSTATUS  WINAPI NtQueryInstallUILanguage(LANGID*);
1866 NTSTATUS  WINAPI NtQueryIntervalProfile(KPROFILE_SOURCE,PULONG);
1867 NTSTATUS  WINAPI NtQueryIoCompletion(HANDLE,IO_COMPLETION_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1868 NTSTATUS  WINAPI NtQueryKey(HANDLE,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1869 NTSTATUS  WINAPI NtQueryMultipleValueKey(HANDLE,PKEY_MULTIPLE_VALUE_INFORMATION,ULONG,PVOID,ULONG,PULONG);
1870 NTSTATUS  WINAPI NtQueryMutant(HANDLE,MUTANT_INFORMATION_CLASS,PVOID,ULONG,PULONG); 
1871 NTSTATUS  WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
1872 NTSTATUS  WINAPI NtQueryOpenSubKeys(POBJECT_ATTRIBUTES,PULONG);
1873 NTSTATUS  WINAPI NtQueryPerformanceCounter(PLARGE_INTEGER, PLARGE_INTEGER);
1874 NTSTATUS  WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
1875 NTSTATUS  WINAPI NtQuerySection(HANDLE,SECTION_INFORMATION_CLASS,PVOID,ULONG,PULONG); 
1876 NTSTATUS  WINAPI NtQuerySemaphore(HANDLE,SEMAPHORE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1877 NTSTATUS  WINAPI NtQuerySymbolicLinkObject(HANDLE,PUNICODE_STRING,PULONG);
1878 NTSTATUS  WINAPI NtQuerySystemEnvironmentValue(PUNICODE_STRING,PWCHAR,ULONG,PULONG);
1879 NTSTATUS  WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1880 NTSTATUS  WINAPI NtQuerySystemTime(PLARGE_INTEGER);
1881 NTSTATUS  WINAPI NtQueryTimer(HANDLE,TIMER_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1882 NTSTATUS  WINAPI NtQueryTimerResolution(PULONG,PULONG,PULONG);
1883 NTSTATUS  WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
1884 NTSTATUS  WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,SIZE_T,SIZE_T*);
1885 NTSTATUS  WINAPI NtQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1886 NTSTATUS  WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
1887 NTSTATUS  WINAPI NtRaiseHardError(NTSTATUS,ULONG,PUNICODE_STRING,PVOID*,HARDERROR_RESPONSE_OPTION,PHARDERROR_RESPONSE);
1888 NTSTATUS  WINAPI NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
1889 NTSTATUS  WINAPI NtReadFileScatter(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,FILE_SEGMENT_ELEMENT,ULONG,PLARGE_INTEGER,PULONG);
1890 NTSTATUS  WINAPI NtReadRequestData(HANDLE,PLPC_MESSAGE,ULONG,PVOID,ULONG,PULONG);
1891 NTSTATUS  WINAPI NtReadVirtualMemory(HANDLE,const void*,void*,SIZE_T,SIZE_T*);
1892 NTSTATUS  WINAPI NtRegisterThreadTerminatePort(HANDLE); 
1893 NTSTATUS  WINAPI NtReleaseMutant(HANDLE,PLONG);
1894 NTSTATUS  WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
1895 NTSTATUS  WINAPI NtRemoveIoCompletion(HANDLE,PULONG_PTR,PULONG_PTR,PIO_STATUS_BLOCK,PLARGE_INTEGER);
1896 NTSTATUS  WINAPI NtReplaceKey(POBJECT_ATTRIBUTES,HANDLE,POBJECT_ATTRIBUTES);
1897 NTSTATUS  WINAPI NtReplyPort(HANDLE,PLPC_MESSAGE);
1898 NTSTATUS  WINAPI NtReplyWaitReceivePort(HANDLE,PULONG,PLPC_MESSAGE,PLPC_MESSAGE);
1899 NTSTATUS  WINAPI NtReplyWaitReceivePortEx(HANDLE,PVOID*,PPORT_MESSAGE,PPORT_MESSAGE,PLARGE_INTEGER);
1900 NTSTATUS  WINAPI NtReplyWaitReplyPort(HANDLE,PLPC_MESSAGE);
1901 NTSTATUS  WINAPI NtRequestPort(HANDLE,PLPC_MESSAGE);
1902 NTSTATUS  WINAPI NtRequestWaitReplyPort(HANDLE,PLPC_MESSAGE,PLPC_MESSAGE);
1903 NTSTATUS  WINAPI NtResetEvent(HANDLE,PULONG);
1904 NTSTATUS  WINAPI NtRestoreKey(HANDLE,HANDLE,ULONG);
1905 NTSTATUS  WINAPI NtResumeThread(HANDLE,PULONG);
1906 NTSTATUS  WINAPI NtSaveKey(HANDLE,HANDLE);
1907 NTSTATUS  WINAPI NtSecureConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PSID,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
1908 NTSTATUS  WINAPI NtSetContextThread(HANDLE,const CONTEXT*);
1909 NTSTATUS  WINAPI NtSetDefaultHardErrorPort(HANDLE); 
1910 NTSTATUS  WINAPI NtSetDefaultLocale(BOOLEAN,LCID);
1911 NTSTATUS  WINAPI NtSetDefaultUILanguage(LANGID);
1912 NTSTATUS  WINAPI NtSetEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG);
1913 NTSTATUS  WINAPI NtSetEvent(HANDLE,PULONG);
1914 NTSTATUS  WINAPI NtSetHighEventPair(HANDLE); 
1915 NTSTATUS  WINAPI NtSetHighWaitLowEventPair(HANDLE); 
1916 NTSTATUS  WINAPI NtSetHighWaitLowThread(VOID);
1917 NTSTATUS  WINAPI NtSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
1918 NTSTATUS  WINAPI NtSetInformationKey(HANDLE,const int,PVOID,ULONG);
1919 NTSTATUS  WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
1920 NTSTATUS  WINAPI NtSetInformationProcess(HANDLE,PROCESS_INFORMATION_CLASS,PVOID,ULONG);
1921 NTSTATUS  WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
1922 NTSTATUS  WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG);
1923 NTSTATUS  WINAPI NtSetIntervalProfile(ULONG,KPROFILE_SOURCE);
1924 NTSTATUS  WINAPI NtSetIoCompletion(HANDLE,ULONG_PTR,ULONG_PTR,NTSTATUS,ULONG);
1925 NTSTATUS  WINAPI NtSetLdtEntries(ULONG,LDT_ENTRY,ULONG,LDT_ENTRY);
1926 NTSTATUS  WINAPI NtSetLowEventPair(HANDLE); 
1927 NTSTATUS  WINAPI NtSetLowWaitHighEventPair(HANDLE); 
1928 NTSTATUS  WINAPI NtSetLowWaitHighThread(VOID); 
1929 NTSTATUS  WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1930 NTSTATUS  WINAPI NtSetSystemEnvironmentValue(PUNICODE_STRING,PUNICODE_STRING);
1931 NTSTATUS  WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG);
1932 NTSTATUS  WINAPI NtSetSystemPowerState(POWER_ACTION,SYSTEM_POWER_STATE,ULONG);
1933 NTSTATUS  WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
1934 NTSTATUS  WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMER_APC_ROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
1935 NTSTATUS  WINAPI NtSetTimerResolution(ULONG,BOOLEAN,PULONG); 
1936 NTSTATUS  WINAPI NtSetValueKey(HANDLE,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
1937 NTSTATUS  WINAPI NtSetVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1938 NTSTATUS  WINAPI NtSignalAndWaitForSingleObject(HANDLE,HANDLE,BOOLEAN,const LARGE_INTEGER*);
1939 NTSTATUS  WINAPI NtShutdownSystem(SHUTDOWN_ACTION); 
1940 NTSTATUS  WINAPI NtStartProfile(HANDLE); 
1941 NTSTATUS  WINAPI NtStopProfile(HANDLE); 
1942 NTSTATUS  WINAPI NtSuspendThread(HANDLE,PULONG);
1943 NTSTATUS  WINAPI NtSystemDebugControl(SYSDBG_COMMAND,PVOID,ULONG,PVOID,ULONG,PULONG);
1944 NTSTATUS  WINAPI NtTerminateProcess(HANDLE,LONG);
1945 NTSTATUS  WINAPI NtTerminateThread(HANDLE,LONG);
1946 NTSTATUS  WINAPI NtTestAlert(VOID); 
1947 NTSTATUS  WINAPI NtUnloadDriver(const UNICODE_STRING *);
1948 NTSTATUS  WINAPI NtUnloadKey(POBJECT_ATTRIBUTES);
1949 NTSTATUS  WINAPI NtUnloadKeyEx(POBJECT_ATTRIBUTES,HANDLE);
1950 NTSTATUS  WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG);
1951 NTSTATUS  WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
1952 NTSTATUS  WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
1953 NTSTATUS  WINAPI NtVdmControl(ULONG,PVOID); 
1954 NTSTATUS  WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
1955 NTSTATUS  WINAPI NtWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
1956 NTSTATUS  WINAPI NtWaitHighEventPair(HANDLE); 
1957 NTSTATUS  WINAPI NtWaitLowEventPair(HANDLE); 
1958 NTSTATUS  WINAPI NtWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
1959 NTSTATUS  WINAPI NtWriteFileGather(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,FILE_SEGMENT_ELEMENT,ULONG,PLARGE_INTEGER,PULONG);
1960 NTSTATUS  WINAPI NtWriteRequestData(HANDLE,PLPC_MESSAGE,ULONG,PVOID,ULONG,PULONG);
1961 NTSTATUS  WINAPI NtWriteVirtualMemory(HANDLE,void*,const void*,SIZE_T,SIZE_T*);
1962 NTSTATUS  WINAPI NtYieldExecution(void);
1963
1964 void      WINAPI RtlAcquirePebLock(void);
1965 BYTE      WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK,BYTE);
1966 BYTE      WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK,BYTE);
1967 NTSTATUS  WINAPI RtlAddAce(PACL,DWORD,DWORD,PACE_HEADER,DWORD);
1968 NTSTATUS  WINAPI RtlAddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
1969 NTSTATUS  WINAPI RtlAddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1970 NTSTATUS  WINAPI RtlAddAccessDeniedAce(PACL,DWORD,DWORD,PSID);
1971 NTSTATUS  WINAPI RtlAddAccessDeniedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1972 NTSTATUS  WINAPI RtlAddAtomToAtomTable(RTL_ATOM_TABLE,const WCHAR*,RTL_ATOM*);
1973 NTSTATUS  WINAPI RtlAddAuditAccessAce(PACL,DWORD,DWORD,PSID,BOOL,BOOL); 
1974 PVOID     WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER);
1975 NTSTATUS  WINAPI RtlAdjustPrivilege(ULONG,BOOLEAN,BOOLEAN,PBOOLEAN);
1976 NTSTATUS  WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
1977 RTL_HANDLE * WINAPI RtlAllocateHandle(RTL_HANDLE_TABLE *,ULONG *);
1978 PVOID     WINAPI RtlAllocateHeap(HANDLE,ULONG,SIZE_T);
1979 WCHAR     WINAPI RtlAnsiCharToUnicodeChar(LPSTR *);
1980 DWORD     WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
1981 NTSTATUS  WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
1982 NTSTATUS  WINAPI RtlAppendAsciizToString(STRING *,LPCSTR);
1983 NTSTATUS  WINAPI RtlAppendStringToString(STRING *,const STRING *);
1984 NTSTATUS  WINAPI RtlAppendUnicodeStringToString(UNICODE_STRING *,const UNICODE_STRING *);
1985 NTSTATUS  WINAPI RtlAppendUnicodeToString(UNICODE_STRING *,LPCWSTR);
1986 BOOLEAN   WINAPI RtlAreAllAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1987 BOOLEAN   WINAPI RtlAreAnyAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1988 BOOLEAN   WINAPI RtlAreBitsSet(PCRTL_BITMAP,ULONG,ULONG);
1989 BOOLEAN   WINAPI RtlAreBitsClear(PCRTL_BITMAP,ULONG,ULONG);
1990
1991 NTSTATUS  WINAPI RtlCharToInteger(PCSZ,ULONG,PULONG);
1992 NTSTATUS  WINAPI RtlCheckRegistryKey(ULONG, PWSTR);
1993 void      WINAPI RtlClearAllBits(PRTL_BITMAP);
1994 void      WINAPI RtlClearBits(PRTL_BITMAP,ULONG,ULONG);
1995 PDEBUG_BUFFER WINAPI RtlCreateQueryDebugBuffer(ULONG,BOOLEAN);
1996 ULONG     WINAPI RtlCompactHeap(HANDLE,ULONG);
1997 LONG      WINAPI RtlCompareString(const STRING*,const STRING*,BOOLEAN);
1998 LONG      WINAPI RtlCompareUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1999 DWORD     WINAPI RtlComputeCrc32(DWORD,const BYTE*,INT);
2000 NTSTATUS  WINAPI RtlConvertSidToUnicodeString(PUNICODE_STRING,PSID,BOOLEAN);
2001 LONGLONG  WINAPI RtlConvertLongToLargeInteger(LONG);
2002 ULONGLONG WINAPI RtlConvertUlongToLargeInteger(ULONG);
2003 void      WINAPI RtlCopyLuid(PLUID,const LUID*);
2004 void      WINAPI RtlCopyLuidAndAttributesArray(ULONG,const LUID_AND_ATTRIBUTES*,PLUID_AND_ATTRIBUTES);
2005 BOOLEAN   WINAPI RtlCopySid(DWORD,PSID,PSID);
2006 NTSTATUS  WINAPI RtlCopySecurityDescriptor(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR);
2007 void      WINAPI RtlCopyString(STRING*,const STRING*);
2008 void      WINAPI RtlCopyUnicodeString(UNICODE_STRING*,const UNICODE_STRING*);
2009 NTSTATUS  WINAPI RtlCreateAcl(PACL,DWORD,DWORD);
2010 NTSTATUS  WINAPI RtlCreateAtomTable(ULONG,RTL_ATOM_TABLE*);
2011 NTSTATUS  WINAPI RtlCreateEnvironment(BOOLEAN, PWSTR*);
2012 HANDLE    WINAPI RtlCreateHeap(ULONG,PVOID,SIZE_T,SIZE_T,PVOID,PRTL_HEAP_DEFINITION);
2013 NTSTATUS  WINAPI RtlCreateProcessParameters(RTL_USER_PROCESS_PARAMETERS**,const UNICODE_STRING*,
2014                                             const UNICODE_STRING*,const UNICODE_STRING*,
2015                                             const UNICODE_STRING*,PWSTR,const UNICODE_STRING*,
2016                                             const UNICODE_STRING*,const UNICODE_STRING*,
2017                                             const UNICODE_STRING*);
2018 NTSTATUS  WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
2019 BOOLEAN   WINAPI RtlCreateUnicodeString(PUNICODE_STRING,LPCWSTR);
2020 BOOLEAN   WINAPI RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING,LPCSTR);
2021 NTSTATUS  WINAPI RtlCreateUserThread(HANDLE,const SECURITY_DESCRIPTOR*,BOOLEAN,PVOID,SIZE_T,SIZE_T,PRTL_THREAD_START_ROUTINE,void*,HANDLE*,CLIENT_ID*);
2022
2023 NTSTATUS  WINAPI RtlDeleteAce(PACL,DWORD);
2024 NTSTATUS  WINAPI RtlDeleteAtomFromAtomTable(RTL_ATOM_TABLE,RTL_ATOM);
2025 NTSTATUS  WINAPI RtlDeleteCriticalSection(RTL_CRITICAL_SECTION *);
2026 NTSTATUS  WINAPI RtlDeleteRegistryValue(ULONG, PCWSTR, PCWSTR);
2027 void      WINAPI RtlDeleteResource(LPRTL_RWLOCK);
2028 NTSTATUS  WINAPI RtlDeleteSecurityObject(PSECURITY_DESCRIPTOR*);
2029 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlDeNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
2030 NTSTATUS  WINAPI RtlDestroyAtomTable(RTL_ATOM_TABLE);
2031 NTSTATUS  WINAPI RtlDestroyEnvironment(PWSTR);
2032 NTSTATUS  WINAPI RtlDestroyHandleTable(RTL_HANDLE_TABLE *);
2033 HANDLE    WINAPI RtlDestroyHeap(HANDLE);
2034 void      WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*);
2035 NTSTATUS  WINAPI RtlDestroyQueryDebugBuffer(PDEBUG_BUFFER);
2036 DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR);
2037 BOOLEAN   WINAPI RtlDllShutdownInProgress(void);
2038 BOOLEAN   WINAPI RtlDoesFileExists_U(LPCWSTR);
2039 BOOLEAN   WINAPI RtlDosPathNameToNtPathName_U(PCWSTR,PUNICODE_STRING,PWSTR*,CURDIR*);
2040 ULONG     WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*);
2041 WCHAR     WINAPI RtlDowncaseUnicodeChar(WCHAR);
2042 NTSTATUS  WINAPI RtlDowncaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2043 void      WINAPI RtlDumpResource(LPRTL_RWLOCK);
2044 NTSTATUS  WINAPI RtlDuplicateUnicodeString(int,const UNICODE_STRING*,UNICODE_STRING*);
2045
2046 NTSTATUS  WINAPI RtlEmptyAtomTable(RTL_ATOM_TABLE,BOOLEAN);
2047 LONGLONG  WINAPI RtlEnlargedIntegerMultiply(INT,INT);
2048 ULONGLONG WINAPI RtlEnlargedUnsignedMultiply(UINT,UINT);
2049 UINT      WINAPI RtlEnlargedUnsignedDivide(ULONGLONG,UINT,UINT *);
2050 NTSTATUS  WINAPI RtlEnterCriticalSection(RTL_CRITICAL_SECTION *);
2051 void      WINAPI RtlEraseUnicodeString(UNICODE_STRING*);
2052 NTSTATUS  WINAPI RtlEqualComputerName(const UNICODE_STRING*,const UNICODE_STRING*);
2053 NTSTATUS  WINAPI RtlEqualDomainName(const UNICODE_STRING*,const UNICODE_STRING*);
2054 BOOLEAN   WINAPI RtlEqualLuid(const LUID*,const LUID*);
2055 BOOL      WINAPI RtlEqualPrefixSid(PSID,PSID);
2056 BOOL      WINAPI RtlEqualSid(PSID,PSID);
2057 BOOLEAN   WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN);
2058 BOOLEAN   WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2059 void      DECLSPEC_NORETURN WINAPI RtlExitUserThread(ULONG);
2060 NTSTATUS  WINAPI RtlExpandEnvironmentStrings_U(PCWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*);
2061 LONGLONG  WINAPI RtlExtendedMagicDivide(LONGLONG,LONGLONG,INT);
2062 LONGLONG  WINAPI RtlExtendedIntegerMultiply(LONGLONG,INT);
2063 LONGLONG  WINAPI RtlExtendedLargeIntegerDivide(LONGLONG,INT,INT *);
2064
2065 NTSTATUS  WINAPI RtlFindCharInUnicodeString(int,const UNICODE_STRING*,const UNICODE_STRING*,USHORT*);
2066 ULONG     WINAPI RtlFindClearBits(PCRTL_BITMAP,ULONG,ULONG);
2067 ULONG     WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP,ULONG,ULONG);
2068 ULONG     WINAPI RtlFindClearRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
2069 ULONG     WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
2070 ULONG     WINAPI RtlFindLastBackwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
2071 CCHAR     WINAPI RtlFindLeastSignificantBit(ULONGLONG);
2072 ULONG     WINAPI RtlFindLongestRunSet(PCRTL_BITMAP,PULONG);
2073 ULONG     WINAPI RtlFindLongestRunClear(PCRTL_BITMAP,PULONG);
2074 NTSTATUS  WINAPI RtlFindMessage(HMODULE,ULONG,ULONG,ULONG,const MESSAGE_RESOURCE_ENTRY**);
2075 CCHAR     WINAPI RtlFindMostSignificantBit(ULONGLONG);
2076 ULONG     WINAPI RtlFindNextForwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
2077 ULONG     WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
2078 ULONG     WINAPI RtlFindSetBits(PCRTL_BITMAP,ULONG,ULONG);
2079 ULONG     WINAPI RtlFindSetBitsAndClear(PRTL_BITMAP,ULONG,ULONG);
2080 ULONG     WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
2081 BOOLEAN   WINAPI RtlFirstFreeAce(PACL,PACE_HEADER *);
2082 NTSTATUS  WINAPI RtlFormatCurrentUserKeyPath(PUNICODE_STRING);
2083 NTSTATUS  WINAPI RtlFormatMessage(LPWSTR,UCHAR,BOOLEAN,BOOLEAN,BOOLEAN,va_list *,LPWSTR,ULONG);
2084 void      WINAPI RtlFreeAnsiString(PANSI_STRING);
2085 BOOLEAN   WINAPI RtlFreeHandle(RTL_HANDLE_TABLE *,RTL_HANDLE *);
2086 BOOLEAN   WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
2087 void      WINAPI RtlFreeOemString(POEM_STRING);
2088 DWORD     WINAPI RtlFreeSid(PSID);
2089 void      WINAPI RtlFreeUnicodeString(PUNICODE_STRING);
2090
2091 NTSTATUS  WINAPI RtlGetAce(PACL,DWORD,LPVOID *);
2092 NTSTATUS  WINAPI RtlGetControlSecurityDescriptor(PSECURITY_DESCRIPTOR, PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
2093 NTSTATUS  WINAPI RtlGetCurrentDirectory_U(ULONG, LPWSTR);
2094 PEB *     WINAPI RtlGetCurrentPeb(void);
2095 NTSTATUS  WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
2096 ULONG     WINAPI RtlGetFullPathName_U(PCWSTR,ULONG,PWSTR,PWSTR*);
2097 NTSTATUS  WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
2098 NTSTATUS  WINAPI RtlGetLastNtStatus(void);
2099 DWORD     WINAPI RtlGetLastWin32Error(void);
2100 DWORD     WINAPI RtlGetLongestNtPathLength(void);
2101 BOOLEAN   WINAPI RtlGetNtProductType(LPDWORD);
2102 NTSTATUS  WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
2103 ULONG     WINAPI RtlGetProcessHeaps(ULONG,HANDLE*);
2104 NTSTATUS  WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
2105 NTSTATUS  WINAPI RtlGetVersion(RTL_OSVERSIONINFOEXW*);
2106 NTSTATUS  WINAPI RtlGUIDFromString(PUNICODE_STRING,GUID*);
2107
2108 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(PSID);
2109 PVOID     WINAPI RtlImageDirectoryEntryToData(HMODULE,BOOL,WORD,ULONG *);
2110 PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE);
2111 PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection(const IMAGE_NT_HEADERS *,HMODULE,DWORD);
2112 PVOID     WINAPI RtlImageRvaToVa(const IMAGE_NT_HEADERS *,HMODULE,DWORD,IMAGE_SECTION_HEADER **);
2113 NTSTATUS  WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
2114 void      WINAPI RtlInitString(PSTRING,PCSZ);
2115 void      WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
2116 NTSTATUS  WINAPI RtlInitAnsiStringEx(PANSI_STRING,PCSZ);
2117 void      WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
2118 NTSTATUS  WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
2119 NTSTATUS  WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *);
2120 NTSTATUS  WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,DWORD);
2121 void      WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);
2122 void      WINAPI RtlInitializeHandleTable(ULONG,ULONG,RTL_HANDLE_TABLE *);
2123 void      WINAPI RtlInitializeResource(LPRTL_RWLOCK);
2124 BOOL      WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
2125
2126 NTSTATUS  WINAPI RtlInt64ToUnicodeString(ULONGLONG,ULONG,UNICODE_STRING *);
2127 NTSTATUS  WINAPI RtlIntegerToChar(ULONG,ULONG,ULONG,PCHAR);
2128 NTSTATUS  WINAPI RtlIntegerToUnicodeString(ULONG,ULONG,UNICODE_STRING *);
2129 ULONG     WINAPI RtlIsDosDeviceName_U(PCWSTR);
2130 BOOLEAN   WINAPI RtlIsNameLegalDOS8Dot3(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
2131 BOOLEAN   WINAPI RtlIsTextUnicode(LPCVOID,INT,INT *);
2132 BOOLEAN   WINAPI RtlIsValidHandle(const RTL_HANDLE_TABLE *, const RTL_HANDLE *);
2133 BOOLEAN   WINAPI RtlIsValidIndexHandle(const RTL_HANDLE_TABLE *, ULONG Index, RTL_HANDLE **);
2134
2135 LONGLONG  WINAPI RtlLargeIntegerAdd(LONGLONG,LONGLONG);
2136 LONGLONG  WINAPI RtlLargeIntegerArithmeticShift(LONGLONG,INT);
2137 ULONGLONG WINAPI RtlLargeIntegerDivide( ULONGLONG,ULONGLONG,ULONGLONG *);
2138 LONGLONG  WINAPI RtlLargeIntegerNegate(LONGLONG);
2139 LONGLONG  WINAPI RtlLargeIntegerShiftLeft(LONGLONG,INT);
2140 LONGLONG  WINAPI RtlLargeIntegerShiftRight(LONGLONG,INT);
2141 LONGLONG  WINAPI RtlLargeIntegerSubtract(LONGLONG,LONGLONG);
2142 NTSTATUS  WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PCHAR);
2143 NTSTATUS  WINAPI RtlLeaveCriticalSection(RTL_CRITICAL_SECTION *);
2144 DWORD     WINAPI RtlLengthRequiredSid(DWORD);
2145 ULONG     WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR);
2146 DWORD     WINAPI RtlLengthSid(PSID);
2147 NTSTATUS  WINAPI RtlLocalTimeToSystemTime(const LARGE_INTEGER*,PLARGE_INTEGER);
2148 BOOLEAN   WINAPI RtlLockHeap(HANDLE);
2149 NTSTATUS  WINAPI RtlLookupAtomInAtomTable(RTL_ATOM_TABLE,const WCHAR*,RTL_ATOM*);
2150
2151 NTSTATUS  WINAPI RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
2152 void      WINAPI RtlMapGenericMask(PACCESS_MASK,const GENERIC_MAPPING*);
2153 NTSTATUS  WINAPI RtlMultiByteToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
2154 NTSTATUS  WINAPI RtlMultiByteToUnicodeSize(DWORD*,LPCSTR,UINT);
2155
2156 NTSTATUS  WINAPI RtlNewSecurityObject(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,BOOLEAN,HANDLE,PGENERIC_MAPPING);
2157 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
2158 ULONG     WINAPI RtlNtStatusToDosError(NTSTATUS);
2159 ULONG     WINAPI RtlNtStatusToDosErrorNoTeb(NTSTATUS);
2160 ULONG     WINAPI RtlNumberOfSetBits(PCRTL_BITMAP);
2161 ULONG     WINAPI RtlNumberOfClearBits(PCRTL_BITMAP);
2162
2163 UINT      WINAPI RtlOemStringToUnicodeSize(const STRING*);
2164 NTSTATUS  WINAPI RtlOemStringToUnicodeString(UNICODE_STRING*,const STRING*,BOOLEAN);
2165 NTSTATUS  WINAPI RtlOemToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
2166 NTSTATUS  WINAPI RtlOpenCurrentUser(ACCESS_MASK,PHANDLE);
2167
2168 PVOID     WINAPI RtlPcToFileHeader(PVOID,PVOID*);
2169 NTSTATUS  WINAPI RtlPinAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM);
2170 BOOLEAN   WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
2171 BOOLEAN   WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
2172
2173 NTSTATUS  WINAPI RtlQueryAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM,ULONG*,ULONG*,WCHAR*,ULONG*);
2174 NTSTATUS  WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
2175 NTSTATUS  WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
2176 NTSTATUS  WINAPI RtlQueryProcessDebugInformation(ULONG,ULONG,PDEBUG_BUFFER);
2177 NTSTATUS  WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID);
2178 NTSTATUS  WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*);
2179 NTSTATUS  WINAPI RtlQueueWorkItem(PRTL_WORK_ITEM_ROUTINE,PVOID,ULONG);
2180 void      WINAPI RtlRaiseException(PEXCEPTION_RECORD);
2181 void      WINAPI RtlRaiseStatus(NTSTATUS);
2182 ULONG     WINAPI RtlRandom(PULONG);
2183 PVOID     WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,SIZE_T);
2184 void      WINAPI RtlReleasePebLock(void);
2185 void      WINAPI RtlReleaseResource(LPRTL_RWLOCK);
2186 ULONG     WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
2187 void      WINAPI RtlRestoreLastWin32Error(DWORD);
2188
2189 void      WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *);
2190 void      WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);
2191 NTSTATUS  WINAPI RtlSelfRelativeToAbsoluteSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,
2192                                              PDWORD,PACL,PDWORD,PACL,PDWORD,PSID,PDWORD,PSID,PDWORD);
2193 void      WINAPI RtlSetAllBits(PRTL_BITMAP);
2194 void      WINAPI RtlSetBits(PRTL_BITMAP,ULONG,ULONG);
2195 ULONG     WINAPI RtlSetCriticalSectionSpinCount(RTL_CRITICAL_SECTION*,ULONG);
2196 NTSTATUS  WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING*);
2197 void      WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR*);
2198 NTSTATUS  WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
2199 NTSTATUS  WINAPI RtlSetEnvironmentVariable(PWSTR*,PUNICODE_STRING,PUNICODE_STRING);
2200 NTSTATUS  WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
2201 NTSTATUS  WINAPI RtlSetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
2202 void      WINAPI RtlSetLastWin32Error(DWORD);
2203 void      WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus(NTSTATUS);
2204 NTSTATUS  WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
2205 NTSTATUS  WINAPI RtlSetTimeZoneInformation(const RTL_TIME_ZONE_INFORMATION*);
2206 SIZE_T    WINAPI RtlSizeHeap(HANDLE,ULONG,const void*);
2207 NTSTATUS  WINAPI RtlStringFromGUID(REFGUID,PUNICODE_STRING);
2208 LPDWORD   WINAPI RtlSubAuthoritySid(PSID,DWORD);
2209 LPBYTE    WINAPI RtlSubAuthorityCountSid(PSID);
2210 NTSTATUS  WINAPI RtlSystemTimeToLocalTime(const LARGE_INTEGER*,PLARGE_INTEGER);
2211
2212 void      WINAPI RtlTimeToTimeFields(const LARGE_INTEGER*,PTIME_FIELDS);
2213 BOOLEAN   WINAPI RtlTimeFieldsToTime(PTIME_FIELDS,PLARGE_INTEGER);
2214 void      WINAPI RtlTimeToElapsedTimeFields(const LARGE_INTEGER *,PTIME_FIELDS);
2215 BOOLEAN   WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *,LPDWORD);
2216 BOOLEAN   WINAPI RtlTimeToSecondsSince1980(const LARGE_INTEGER *,LPDWORD);
2217 BOOL      WINAPI RtlTryEnterCriticalSection(RTL_CRITICAL_SECTION *);
2218
2219 ULONGLONG __cdecl RtlUlonglongByteSwap(ULONGLONG);
2220 DWORD     WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING*);
2221 NTSTATUS  WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING,PCUNICODE_STRING,BOOLEAN);
2222 NTSTATUS  WINAPI RtlUnicodeStringToInteger(const UNICODE_STRING *,ULONG,ULONG *);
2223 DWORD     WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING*);
2224 NTSTATUS  WINAPI RtlUnicodeStringToOemString(POEM_STRING,PCUNICODE_STRING,BOOLEAN);
2225 NTSTATUS  WINAPI RtlUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2226 NTSTATUS  WINAPI RtlUnicodeToMultiByteSize(PULONG,PCWSTR,ULONG);
2227 NTSTATUS  WINAPI RtlUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2228 ULONG     WINAPI RtlUniform(PULONG);
2229 BOOLEAN   WINAPI RtlUnlockHeap(HANDLE);
2230 void      WINAPI RtlUnwind(PVOID,PVOID,PEXCEPTION_RECORD,PVOID);
2231 #ifdef __ia64__
2232 void      WINAPI RtlUnwind2(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT);
2233 void      WINAPI RtlUnwindEx(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT,PUNWIND_HISTORY_TABLE);
2234 #endif
2235 WCHAR     WINAPI RtlUpcaseUnicodeChar(WCHAR);
2236 NTSTATUS  WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING *,BOOLEAN);
2237 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToAnsiString(STRING*,const UNICODE_STRING*,BOOLEAN);
2238 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToCountedOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
2239 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
2240 NTSTATUS  WINAPI RtlUpcaseUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2241 NTSTATUS  WINAPI RtlUpcaseUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
2242 CHAR      WINAPI RtlUpperChar(CHAR);
2243 void      WINAPI RtlUpperString(STRING *,const STRING *);
2244
2245 NTSTATUS  WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
2246 BOOLEAN   WINAPI RtlValidAcl(PACL);
2247 BOOLEAN   WINAPI RtlValidSid(PSID);
2248 BOOLEAN   WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
2249 NTSTATUS  WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
2250
2251 NTSTATUS  WINAPI RtlWalkHeap(HANDLE,PVOID);
2252 NTSTATUS  WINAPI RtlWriteRegistryValue(ULONG,PCWSTR,PCWSTR,ULONG,PVOID,ULONG);
2253
2254 NTSTATUS  WINAPI RtlpNtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
2255 NTSTATUS  WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);
2256 NTSTATUS  WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
2257
2258 NTSTATUS WINAPI vDbgPrintEx(ULONG,ULONG,LPCSTR,va_list);
2259 NTSTATUS WINAPI vDbgPrintExWithPrefix(LPCSTR,ULONG,ULONG,LPCSTR,va_list);
2260
2261 /* Wine internal functions */
2262
2263 extern NTSTATUS wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
2264                                            UINT disposition, BOOLEAN check_case );
2265 extern NTSTATUS wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt );
2266
2267
2268 /***********************************************************************
2269  * Inline functions
2270  */
2271
2272 #define InitializeObjectAttributes(p,n,a,r,s) \
2273     do { \
2274         (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
2275         (p)->RootDirectory = r; \
2276         (p)->Attributes = a; \
2277         (p)->ObjectName = n; \
2278         (p)->SecurityDescriptor = s; \
2279         (p)->SecurityQualityOfService = NULL; \
2280     } while (0)
2281
2282 #define NtCurrentProcess() ((HANDLE)-1)
2283
2284 #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
2285 #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
2286 #define RtlStoreUlong(p,v)  do { ULONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
2287 #define RtlStoreUlonglong(p,v) do { ULONGLONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
2288 #define RtlRetrieveUlong(p,s) memcpy((p), (s), sizeof(ULONG))
2289 #define RtlRetrieveUlonglong(p,s) memcpy((p), (s), sizeof(ULONGLONG))
2290 #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
2291
2292 static inline BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
2293 {
2294     if (lpBits && ulBit < lpBits->SizeOfBitMap &&
2295         lpBits->Buffer[ulBit >> 5] & (1 << (ulBit & 31)))
2296         return TRUE;
2297     return FALSE;
2298 }
2299
2300 /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
2301 static inline USHORT RtlUshortByteSwap(USHORT s)
2302 {
2303     return (s >> 8) | (s << 8);
2304 }
2305 static inline ULONG RtlUlongByteSwap(ULONG i)
2306 {
2307 #if defined(__i386__) && defined(__GNUC__)
2308     ULONG ret;
2309     __asm__("bswap %0" : "=r" (ret) : "0" (i) );
2310     return ret;
2311 #else
2312     return ((ULONG)RtlUshortByteSwap((USHORT)i) << 16) | RtlUshortByteSwap((USHORT)(i >> 16));
2313 #endif
2314 }
2315
2316 /*************************************************************************
2317  * Loader functions and structures.
2318  *
2319  * Those are not part of standard Winternl.h
2320  */
2321 typedef struct _LDR_MODULE
2322 {
2323     LIST_ENTRY          InLoadOrderModuleList;
2324     LIST_ENTRY          InMemoryOrderModuleList;
2325     LIST_ENTRY          InInitializationOrderModuleList;
2326     void*               BaseAddress;
2327     void*               EntryPoint;
2328     ULONG               SizeOfImage;
2329     UNICODE_STRING      FullDllName;
2330     UNICODE_STRING      BaseDllName;
2331     ULONG               Flags;
2332     SHORT               LoadCount;
2333     SHORT               TlsIndex;
2334     HANDLE              SectionHandle;
2335     ULONG               CheckSum;
2336     ULONG               TimeDateStamp;
2337 } LDR_MODULE, *PLDR_MODULE;
2338
2339 /* those defines are (some of the) regular LDR_MODULE.Flags values */
2340 #define LDR_IMAGE_IS_DLL                0x00000004
2341 #define LDR_LOAD_IN_PROGRESS            0x00001000
2342 #define LDR_UNLOAD_IN_PROGRESS          0x00002000
2343 #define LDR_NO_DLL_CALLS                0x00040000
2344 #define LDR_PROCESS_ATTACHED            0x00080000
2345 #define LDR_MODULE_REBASED              0x00200000
2346
2347 /* these ones is Wine specific */
2348 #define LDR_DONT_RESOLVE_REFS           0x40000000
2349 #define LDR_WINE_INTERNAL               0x80000000
2350
2351 /* FIXME: to be checked */
2352 #define MAXIMUM_FILENAME_LENGTH 256
2353
2354 typedef struct _SYSTEM_MODULE
2355 {
2356     ULONG               Reserved1;
2357     ULONG               Reserved2;
2358     PVOID               ImageBaseAddress;
2359     ULONG               ImageSize;
2360     ULONG               Flags;
2361     WORD                Id;
2362     WORD                Rank;
2363     WORD                Unknown;
2364     WORD                NameOffset;
2365     BYTE                Name[MAXIMUM_FILENAME_LENGTH];
2366 } SYSTEM_MODULE, *PSYSTEM_MODULE;
2367
2368 typedef struct _SYSTEM_MODULE_INFORMATION
2369 {
2370     ULONG               ModulesCount;
2371     SYSTEM_MODULE       Modules[1]; /* FIXME: should be Modules[0] */
2372 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
2373
2374 NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
2375 NTSTATUS WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
2376 NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
2377 NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
2378 NTSTATUS WINAPI LdrUnloadDll(HMODULE);
2379 NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG);
2380
2381 /* list manipulation macros */
2382 #define InitializeListHead(le)  (void)((le)->Flink = (le)->Blink = (le))
2383 #define InsertHeadList(le,e)    do { PLIST_ENTRY f = (le)->Flink; (e)->Flink = f; (e)->Blink = (le); f->Blink = (e); (le)->Flink = (e); } while (0)
2384 #define InsertTailList(le,e)    do { PLIST_ENTRY b = (le)->Blink; (e)->Flink = (le); (e)->Blink = b; b->Flink = (e); (le)->Blink = (e); } while (0)
2385 #define IsListEmpty(le)         ((le)->Flink == (le))
2386 #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)
2387 static inline PLIST_ENTRY RemoveHeadList(PLIST_ENTRY le)
2388 {
2389     PLIST_ENTRY f, b, e;
2390
2391     e = le->Flink;
2392     f = le->Flink->Flink;
2393     b = le->Flink->Blink;
2394     f->Blink = b;
2395     b->Flink = f;
2396
2397     if (e != le) e->Flink = e->Blink = NULL;
2398     return e;
2399 }
2400 static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
2401 {
2402     PLIST_ENTRY f, b, e;
2403
2404     e = le->Blink;
2405     f = le->Blink->Flink;
2406     b = le->Blink->Blink;
2407     f->Blink = b;
2408     b->Flink = f;
2409
2410     if (e != le) e->Flink = e->Blink = NULL;
2411     return e;
2412 }
2413
2414 #ifdef __cplusplus
2415 } /* extern "C" */
2416 #endif /* defined(__cplusplus) */
2417
2418 #endif  /* __WINE_WINTERNL_H */