The beginnings of math.h and float.h.
[wine] / include / winternl.h
1 /*
2  * Internal NT APIs and data structures
3  *
4  * Copyright (C) the Wine project
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_WINTERNAL_H
22 #define __WINE_WINTERNAL_H
23
24 #include <windef.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* defined(__cplusplus) */
29
30
31 /**********************************************************************
32  * Fundamental types and data structures
33  */
34
35 typedef LONG NTSTATUS;
36
37 typedef CONST char *PCSZ;
38
39 typedef short CSHORT;
40 typedef CSHORT *PCSHORT;
41
42 typedef struct _STRING {
43   USHORT Length;
44   USHORT MaximumLength;
45   PCHAR Buffer;
46 } STRING, *PSTRING;
47
48 typedef STRING ANSI_STRING;
49 typedef PSTRING PANSI_STRING;
50 typedef const STRING *PCANSI_STRING;
51
52 typedef STRING OEM_STRING;
53 typedef PSTRING POEM_STRING;
54 typedef const STRING *PCOEM_STRING;
55
56 typedef struct _UNICODE_STRING {
57   USHORT Length;        /* bytes */
58   USHORT MaximumLength; /* bytes */
59   PWSTR  Buffer;
60 } UNICODE_STRING, *PUNICODE_STRING;
61
62 typedef const UNICODE_STRING *PCUNICODE_STRING;
63
64 typedef struct _CLIENT_ID
65 {
66    HANDLE UniqueProcess;
67    HANDLE UniqueThread;
68 } CLIENT_ID, *PCLIENT_ID;
69
70 typedef struct _CURDIR
71 {
72     UNICODE_STRING DosPath;
73     PVOID Handle;
74 } CURDIR, *PCURDIR;
75
76 typedef struct RTL_DRIVE_LETTER_CURDIR
77 {
78     USHORT              Flags;
79     USHORT              Length;
80     ULONG               TimeStamp;
81     UNICODE_STRING      DosPath;
82 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
83
84 typedef struct tagRTL_BITMAP {
85     ULONG  SizeOfBitMap; /* Number of bits in the bitmap */
86     LPBYTE BitMapBuffer; /* Bitmap data, assumed sized to a DWORD boundary */
87 } RTL_BITMAP, *PRTL_BITMAP;
88
89 typedef const RTL_BITMAP *PCRTL_BITMAP;
90
91 typedef struct tagRTL_BITMAP_RUN {
92     ULONG StartOfRun; /* Bit position at which run starts - FIXME: Name? */
93     ULONG SizeOfRun;  /* Size of the run in bits - FIXME: Name? */
94 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
95
96 typedef const RTL_BITMAP_RUN *PCRTL_BITMAP_RUN;
97
98 typedef struct _RTL_USER_PROCESS_PARAMETERS
99 {
100     ULONG               AllocationSize;
101     ULONG               Size;
102     ULONG               Flags;
103     ULONG               DebugFlags;
104     HANDLE              hConsole;
105     ULONG               ProcessGroup;
106     HANDLE              hStdInput;
107     HANDLE              hStdOutput;
108     HANDLE              hStdError;
109     UNICODE_STRING      CurrentDirectoryName;
110     HANDLE              CurrentDirectoryHandle;
111     UNICODE_STRING      DllPath;
112     UNICODE_STRING      ImagePathName;
113     UNICODE_STRING      CommandLine;
114     PWSTR               Environment;
115     ULONG               dwX;
116     ULONG               dwY;
117     ULONG               dwXSize;
118     ULONG               dwYSize;
119     ULONG               dwXCountChars;
120     ULONG               dwYCountChars;
121     ULONG               dwFillAttribute;
122     ULONG               dwFlags;
123     ULONG               wShowWindow;
124     UNICODE_STRING      WindowTitle;
125     UNICODE_STRING      Desktop;
126     UNICODE_STRING      ShellInfo;
127     UNICODE_STRING      RuntimeInfo;
128     RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
129 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
130
131 /* value for Flags field (FIXME: not the correct name) */
132 #define PROCESS_PARAMS_FLAG_NORMALIZED 1
133
134 typedef struct _PEB_LDR_DATA
135 {
136     ULONG               Length;
137     BOOLEAN             Initialized;
138     PVOID               SsHandle;
139     LIST_ENTRY          InLoadOrderModuleList;
140     LIST_ENTRY          InMemoryOrderModuleList;
141     LIST_ENTRY          InInitializationOrderModuleList;
142 } PEB_LDR_DATA, *PPEB_LDR_DATA;
143
144 /***********************************************************************
145  * PEB data structure
146  */
147 typedef struct _PEB
148 {
149     BYTE                         Reserved1[2];       /*  00 */
150     BYTE                         BeingDebugged;      /*  02 */
151     BYTE                         Reserved2[5];       /*  03 */
152     HMODULE                      ImageBaseAddress;   /*  08 */
153     PPEB_LDR_DATA                LdrData;            /*  0c */
154     RTL_USER_PROCESS_PARAMETERS *ProcessParameters;  /*  10 */
155     PVOID                        __pad_14;           /*  14 */
156     HANDLE                       ProcessHeap;        /*  18 */
157     BYTE                         __pad_1c[36];       /*  1c */
158     PRTL_BITMAP                  TlsBitmap;          /*  40 */
159     ULONG                        TlsBitmapBits[2];   /*  44 */
160     BYTE                         __pad_4c[156];      /*  4c */
161     PVOID                        Reserved3[59];      /*  e8 */
162     ULONG                        SessionId;          /* 1d4 */
163 } PEB, *PPEB;
164
165
166 /***********************************************************************
167  * TEB data structure
168  */
169 #if defined(_NTSYSTEM_) || defined(_KERNEL32_)  /* hack, should go away */
170 # define WINE_NO_TEB
171 #endif
172
173 #ifndef WINE_NO_TEB  /* don't define TEB if included from thread.h */
174 # ifndef WINE_TEB_DEFINED
175 # define WINE_TEB_DEFINED
176 typedef struct _TEB
177 {
178     NT_TIB          Tib;                        /* 000 */
179     PVOID           EnvironmentPointer;         /* 01c */
180     CLIENT_ID       ClientId;                   /* 020 */
181     PVOID           ActiveRpcHandle;            /* 028 */
182     PVOID           ThreadLocalStoragePointer;  /* 02c */
183     PPEB            Peb;                        /* 030 */
184     ULONG           LastErrorValue;             /* 034 */
185     BYTE            __pad038[140];              /* 038 */
186     ULONG           CurrentLocale;              /* 0c4 */
187     BYTE            __pad0c8[1752];             /* 0c8 */
188     PVOID           Reserved2[278];             /* 7a0 */
189     UNICODE_STRING  StaticUnicodeString;        /* bf8 used by advapi32 */
190     WCHAR           StaticUnicodeBuffer[261];   /* c00 used by advapi32 */
191     PVOID           DeallocationStack;          /* e0c */
192     PVOID           TlsSlots[64];               /* e10 */
193     LIST_ENTRY      TlsLinks;                   /* f10 */
194     PVOID           Reserved4[26];              /* f18 */
195     PVOID           ReservedForOle;             /* f80 Windows 2000 only */
196     PVOID           Reserved5[4];               /* f84 */
197     PVOID           TlsExpansionSlots;          /* f94 */
198 } TEB, *PTEB;
199 # endif /* WINE_TEB_DEFINED */
200 #endif  /* WINE_NO_TEB */
201
202 /***********************************************************************
203  * Enums
204  */
205
206 typedef enum _FILE_INFORMATION_CLASS {
207     FileDirectoryInformation = 1,
208     FileFullDirectoryInformation,
209     FileBothDirectoryInformation,
210     FileBasicInformation,
211     FileStandardInformation,
212     FileInternalInformation,
213     FileEaInformation,
214     FileAccessInformation,
215     FileNameInformation,
216     FileRenameInformation,
217     FileLinkInformation,
218     FileNamesInformation,
219     FileDispositionInformation,
220     FilePositionInformation,
221     FileFullEaInformation,
222     FileModeInformation,
223     FileAlignmentInformation,
224     FileAllInformation,
225     FileAllocationInformation,
226     FileEndOfFileInformation,
227     FileAlternateNameInformation,
228     FileStreamInformation,
229     FilePipeInformation,
230     FilePipeLocalInformation,
231     FilePipeRemoteInformation,
232     FileMailslotQueryInformation,
233     FileMailslotSetInformation,
234     FileCompressionInformation,
235     FileObjectIdInformation,
236     FileCompletionInformation,
237     FileMoveClusterInformation,
238     FileQuotaInformation,
239     FileReparsePointInformation,
240     FileNetworkOpenInformation,
241     FileAttributeTagInformation,
242     FileTrackingInformation,
243     FileMaximumInformation
244 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
245
246 typedef struct _FILE_BASIC_INFORMATION {
247     LARGE_INTEGER CreationTime;
248     LARGE_INTEGER LastAccessTime;
249     LARGE_INTEGER LastWriteTime;
250     LARGE_INTEGER ChangeTime;
251     ULONG FileAttributes;
252 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
253
254 typedef struct _FILE_STANDARD_INFORMATION {
255     LARGE_INTEGER AllocationSize;
256     LARGE_INTEGER EndOfFile;
257     ULONG NumberOfLinks;
258     BOOLEAN DeletePending;
259     BOOLEAN Directory;
260 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
261
262 typedef struct _FILE_POSITION_INFORMATION {
263     LARGE_INTEGER CurrentByteOffset;
264 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
265
266 typedef struct _FILE_ALIGNMENT_INFORMATION {
267     ULONG AlignmentRequirement;
268 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
269
270 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
271     LARGE_INTEGER CreationTime;
272     LARGE_INTEGER LastAccessTime;
273     LARGE_INTEGER LastWriteTime;
274     LARGE_INTEGER ChangeTime;
275     LARGE_INTEGER AllocationSize;
276     LARGE_INTEGER EndOfFile;
277     ULONG FileAttributes;
278 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
279
280 typedef struct _FILE_FULL_EA_INFORMATION {
281     ULONG NextEntryOffset;
282     UCHAR Flags;
283     UCHAR EaNameLength;
284     USHORT EaValueLength;
285     CHAR EaName[1];
286 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
287
288 typedef struct _FILE_STREAM_INFORMATION
289 {
290     ULONG NextEntryOffset;
291     ULONG StreamNameLength;
292     LARGE_INTEGER StreamSize;
293     LARGE_INTEGER StreamAllocationSize;
294     WCHAR StreamName[1];
295 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
296
297 struct _FILE_ATTRIBUTE_TAG_INFORMATION
298 {
299     ULONG FileAttributes;
300     ULONG ReparseTag;
301 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
302
303 typedef enum _FSINFOCLASS {
304     FileFsVolumeInformation = 1,
305     FileFsLabelInformation,
306     FileFsSizeInformation,
307     FileFsDeviceInformation,
308     FileFsAttributeInformation,
309     FileFsControlInformation,
310     FileFsFullSizeInformation,
311     FileFsObjectIdInformation,
312     FileFsMaximumInformation
313 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
314
315 typedef enum _KEY_INFORMATION_CLASS {
316     KeyBasicInformation,
317     KeyNodeInformation,
318     KeyFullInformation
319 } KEY_INFORMATION_CLASS;
320
321 typedef enum _KEY_VALUE_INFORMATION_CLASS {
322     KeyValueBasicInformation,
323     KeyValueFullInformation,
324     KeyValuePartialInformation,
325     KeyValueFullInformationAlign64,
326     KeyValuePartialInformationAlign64
327 } KEY_VALUE_INFORMATION_CLASS;
328
329 typedef enum _OBJECT_INFORMATION_CLASS {
330     ObjectBasicInformation,
331     ObjectNameInformation,
332     ObjectTypeInformation,
333     ObjectAllInformation,
334     ObjectDataInformation
335 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
336
337 typedef enum _PROCESSINFOCLASS {
338     ProcessBasicInformation = 0,
339     ProcessQuotaLimits = 1,
340     ProcessIoCounters = 2,
341     ProcessVmCounters = 3,
342     ProcessTimes = 4,
343     ProcessBasePriority = 5,
344     ProcessRaisePriority = 6,
345     ProcessDebugPort = 7,
346     ProcessExceptionPort = 8,
347     ProcessAccessToken = 9,
348     ProcessLdtInformation = 10,
349     ProcessLdtSize = 11,
350     ProcessDefaultHardErrorMode = 12,
351     ProcessIoPortHandlers = 13,
352     ProcessPooledUsageAndLimits = 14,
353     ProcessWorkingSetWatch = 15,
354     ProcessUserModeIOPL = 16,
355     ProcessEnableAlignmentFaultFixup = 17,
356     ProcessPriorityClass = 18,
357     ProcessWx86Information = 19,
358     ProcessHandleCount = 20,
359     ProcessAffinityMask = 21,
360     ProcessPriorityBoost = 22,
361     ProcessDeviceMap = 23,
362     ProcessSessionInformation = 24,
363     ProcessForegroundInformation = 25,
364     ProcessWow64Information = 26,
365     MaxProcessInfoClass
366 } PROCESSINFOCLASS;
367
368 typedef enum _SECTION_INHERIT {
369     ViewShare = 1,
370     ViewUnmap = 2
371 } SECTION_INHERIT;
372
373 typedef enum SYSTEM_INFORMATION_CLASS {
374     SystemBasicInformation = 0,
375     Unknown1,
376     SystemPerformanceInformation = 2,
377     SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
378     Unknown4,
379     SystemProcessInformation = 5,
380     Unknown6,
381     Unknown7,
382     SystemProcessorPerformanceInformation = 8,
383     Unknown9,
384     Unknown10,
385     SystemDriverInformation,
386     Unknown12,
387     Unknown13,
388     Unknown14,
389     Unknown15,
390     SystemHandleList,
391     Unknown17,
392     Unknown18,
393     Unknown19,
394     Unknown20,
395     SystemCacheInformation,
396     Unknown22,
397     SystemInterruptInformation = 23,
398     SystemExceptionInformation = 33,
399     SystemRegistryQuotaInformation = 37,
400     SystemLookasideInformation = 45
401 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
402
403 typedef enum _TIMER_TYPE {
404     NotificationTimer,
405     SynchronizationTimer
406 } TIMER_TYPE;
407
408 typedef enum _THREADINFOCLASS {
409     ThreadBasicInformation,
410     ThreadTimes,
411     ThreadPriority,
412     ThreadBasePriority,
413     ThreadAffinityMask,
414     ThreadImpersonationToken,
415     ThreadDescriptorTableEntry,
416     ThreadEnableAlignmentFaultFixup,
417     ThreadEventPair_Reusable,
418     ThreadQuerySetWin32StartAddress,
419     ThreadZeroTlsCell,
420     ThreadPerformanceCount,
421     ThreadAmILastThread,
422     ThreadIdealProcessor,
423     ThreadPriorityBoost,
424     ThreadSetTlsArrayAddress,
425     ThreadIsIoPending,
426     MaxThreadInfoClass
427 } THREADINFOCLASS;
428
429 typedef struct _THREAD_BASIC_INFORMATION
430 {
431     NTSTATUS  ExitStatus;
432     PVOID     TebBaseAddress;
433     CLIENT_ID ClientId;
434     ULONG     AffinityMask;
435     LONG      Priority;
436     LONG      BasePriority;
437 } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
438
439
440 typedef enum _WINSTATIONINFOCLASS {
441     WinStationInformation = 8
442 } WINSTATIONINFOCLASS;
443
444 typedef enum
445 {
446     MemoryBasicInformation = 0
447 } MEMORY_INFORMATION_CLASS;
448
449 /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
450 typedef enum
451 {
452     INVALID_PATH = 0,
453     UNC_PATH,              /* "//foo" */
454     ABSOLUTE_DRIVE_PATH,   /* "c:/foo" */
455     RELATIVE_DRIVE_PATH,   /* "c:foo" */
456     ABSOLUTE_PATH,         /* "/foo" */
457     RELATIVE_PATH,         /* "foo" */
458     DEVICE_PATH,           /* "//./foo" */
459     UNC_DOT_PATH           /* "//." */
460 } DOS_PATHNAME_TYPE;
461
462 /***********************************************************************
463  * IA64 specific types and data structures
464  */
465
466 #ifdef __ia64__
467
468 typedef struct _FRAME_POINTERS {
469   ULONGLONG MemoryStackFp;
470   ULONGLONG BackingStoreFp;
471 } FRAME_POINTERS, *PFRAME_POINTERS;
472
473 #define UNWIND_HISTORY_TABLE_SIZE 12
474
475 typedef struct _RUNTIME_FUNCTION {
476   ULONG BeginAddress;
477   ULONG EndAddress;
478   ULONG UnwindInfoAddress;
479 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
480
481 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
482   ULONG64 ImageBase;
483   ULONG64 Gp;
484   PRUNTIME_FUNCTION FunctionEntry;
485 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
486
487 typedef struct _UNWIND_HISTORY_TABLE {
488   ULONG Count;
489   UCHAR Search;
490   ULONG64 LowAddress;
491   ULONG64 HighAddress;
492   UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
493 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
494
495 #endif /* defined(__ia64__) */
496
497 /***********************************************************************
498  * Types and data structures
499  */
500
501 /* This is used by NtQuerySystemInformation */
502 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
503 typedef struct {
504     FILETIME    ftKernelTime;
505     FILETIME    ftUserTime;
506     FILETIME    ftCreateTime;
507     DWORD       dwTickCount;
508     DWORD       dwStartAddress;
509     DWORD       dwOwningPID;
510     DWORD       dwThreadID;
511     DWORD       dwCurrentPriority;
512     DWORD       dwBasePriority;
513     DWORD       dwContextSwitches;
514     DWORD       dwThreadState;
515     DWORD       dwWaitReason;
516 } THREADINFO, *PTHREADINFO;
517
518 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
519 typedef struct _THREAD_INFO{
520     DWORD Unknown1[6];
521     DWORD ThreadID;
522     DWORD Unknown2[3];
523     DWORD Status;
524     DWORD WaitReason;
525     DWORD Unknown3[4];
526 } THREAD_INFO, PTHREAD_INFO;
527
528 /***********************************************************************
529  * Types and data structures
530  */
531
532 typedef struct _IO_STATUS_BLOCK {
533   union {
534     NTSTATUS Status;
535     PVOID Pointer;
536   } DUMMYUNIONNAME;
537
538   ULONG_PTR Information;
539 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
540
541 typedef void (WINAPI * PIO_APC_ROUTINE)(PVOID,PIO_STATUS_BLOCK,ULONG);
542
543 typedef struct _KEY_BASIC_INFORMATION {
544     LARGE_INTEGER LastWriteTime;
545     ULONG         TitleIndex;
546     ULONG         NameLength;
547     WCHAR         Name[1];
548 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
549
550 typedef struct _KEY_NODE_INFORMATION
551 {
552     LARGE_INTEGER LastWriteTime;
553     ULONG         TitleIndex;
554     ULONG         ClassOffset;
555     ULONG         ClassLength;
556     ULONG         NameLength;
557     WCHAR         Name[1];
558    /* Class[1]; */
559 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
560
561 typedef struct _KEY_FULL_INFORMATION
562 {
563     LARGE_INTEGER LastWriteTime;
564     ULONG         TitleIndex;
565     ULONG         ClassOffset;
566     ULONG         ClassLength;
567     ULONG         SubKeys;
568     ULONG         MaxNameLen;
569     ULONG         MaxClassLen;
570     ULONG         Values;
571     ULONG         MaxValueNameLen;
572     ULONG         MaxValueDataLen;
573     WCHAR         Class[1];
574 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
575
576 typedef struct _KEY_VALUE_ENTRY
577 {
578     PUNICODE_STRING ValueName;
579     ULONG           DataLength;
580     ULONG           DataOffset;
581     ULONG           Type;
582 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
583
584 typedef struct _KEY_VALUE_BASIC_INFORMATION {
585     ULONG TitleIndex;
586     ULONG Type;
587     ULONG NameLength;
588     WCHAR Name[1];
589 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
590
591 typedef struct _KEY_VALUE_FULL_INFORMATION {
592     ULONG TitleIndex;
593     ULONG Type;
594     ULONG DataOffset;
595     ULONG DataLength;
596     ULONG NameLength;
597     WCHAR Name[1];
598 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
599
600 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
601     ULONG TitleIndex;
602     ULONG Type;
603     ULONG DataLength;
604     UCHAR Data[1];
605 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
606
607 typedef struct _OBJECT_ATTRIBUTES {
608   ULONG Length;
609   HANDLE RootDirectory;
610   PUNICODE_STRING ObjectName;
611   ULONG Attributes;
612   PVOID SecurityDescriptor;       /* type SECURITY_DESCRIPTOR */
613   PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
614 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
615
616 typedef struct _OBJECT_DATA_INFORMATION {
617     BOOLEAN InheritHandle;
618     BOOLEAN ProtectFromClose;
619 } OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION;
620
621 typedef struct _PROCESS_BASIC_INFORMATION {
622 #ifdef __WINESRC__
623     DWORD ExitStatus;
624     DWORD PebBaseAddress;
625     DWORD AffinityMask;
626     DWORD BasePriority;
627     ULONG UniqueProcessId;
628     ULONG InheritedFromUniqueProcessId;
629 #else
630     PVOID Reserved1;
631     PPEB PebBaseAddress;
632     PVOID Reserved2[2];
633     ULONG_PTR UniqueProcessId;
634     PVOID Reserved3;
635 #endif
636 } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
637
638 typedef struct _PROCESS_INFO {
639     DWORD    Offset;             /* 00 offset to next PROCESS_INFO ok*/
640     DWORD    ThreadCount;        /* 04 number of ThreadInfo member ok */
641     DWORD    Unknown1[6];
642     FILETIME CreationTime;       /* 20 */
643     DWORD    Unknown2[5];
644     PWCHAR   ProcessName;        /* 3c ok */
645     DWORD    BasePriority;
646     DWORD    ProcessID;          /* 44 ok*/
647     DWORD    ParentProcessID;
648     DWORD    HandleCount;
649     DWORD    Unknown3[2];        /* 50 */
650     ULONG    PeakVirtualSize;
651     ULONG    VirtualSize;
652     ULONG    PageFaultCount;
653     ULONG    PeakWorkingSetSize;
654     ULONG    WorkingSetSize;
655     ULONG    QuotaPeakPagedPoolUsage;
656     ULONG    QuotaPagedPoolUsage;
657     ULONG    QuotaPeakNonPagedPoolUsage;
658     ULONG    QuotaNonPagedPoolUsage;
659     ULONG    PagefileUsage;
660     ULONG    PeakPagefileUsage;
661     DWORD    PrivateBytes;
662     DWORD    Unknown6[4];
663     THREAD_INFO ati[ANYSIZE_ARRAY]; /* 94 size=0x40*/
664 } PROCESS_INFO, PPROCESS_INFO;
665
666 typedef struct _RTL_HEAP_DEFINITION {
667     ULONG Length; /* = sizeof(RTL_HEAP_DEFINITION) */
668
669     ULONG Unknown[11];
670 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
671
672 typedef struct _RTL_RWLOCK {
673     RTL_CRITICAL_SECTION rtlCS;
674
675     HANDLE hSharedReleaseSemaphore;
676     UINT   uSharedWaiters;
677
678     HANDLE hExclusiveReleaseSemaphore;
679     UINT   uExclusiveWaiters;
680
681     INT    iNumberActive;
682     HANDLE hOwningThreadId;
683     DWORD  dwTimeoutBoost;
684     PVOID  pDebugInfo;
685 } RTL_RWLOCK, *LPRTL_RWLOCK;
686
687 /* System Information Class 0x00 */
688 typedef struct _SYSTEM_BASIC_INFORMATION {
689 #ifdef __WINESRC__
690     DWORD dwUnknown1;
691     ULONG uKeMaximumIncrement;
692     ULONG uPageSize;
693     ULONG uMmNumberOfPhysicalPages;
694     ULONG uMmLowestPhysicalPage;
695     ULONG uMmHighestPhysicalPage;
696     ULONG uAllocationGranularity;
697     PVOID pLowestUserAddress;
698     PVOID pMmHighestUserAddress;
699     ULONG uKeActiveProcessors;
700     BYTE bKeNumberProcessors;
701     BYTE bUnknown2;
702     WORD wUnknown3;
703 #else
704     BYTE Reserved1[24];
705     PVOID Reserved2[4];
706     CCHAR NumberOfProcessors;
707 #endif
708 } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
709
710 /* System Information Class 0x15 */
711 typedef struct {
712     ULONG CurrentSize;
713     ULONG PeakSize;
714     ULONG PageFaultCount;
715     ULONG MinimumWorkingSet;
716     ULONG MaximumWorkingSet;
717     ULONG unused[4];
718 } SYSTEM_CACHE_INFORMATION;
719
720 typedef struct _SYSTEM_CONFIGURATION_INFO {
721     union {
722         ULONG   OemId;
723         struct {
724             WORD ProcessorArchitecture;
725             WORD Reserved;
726         } tag1;
727     } tag2;
728     ULONG PageSize;
729     PVOID MinimumApplicationAddress;
730     PVOID MaximumApplicationAddress;
731     ULONG ActiveProcessorMask;
732     ULONG NumberOfProcessors;
733     ULONG ProcessorType;
734     ULONG AllocationGranularity;
735     WORD  ProcessorLevel;
736     WORD  ProcessorRevision;
737 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
738
739 /* System Information Class 0x0b */
740 typedef struct {
741     PVOID pvAddress;
742     DWORD dwUnknown1;
743     DWORD dwUnknown2;
744     DWORD dwEntryIndex;
745     DWORD dwUnknown3;
746     char szName[MAX_PATH + 1];
747 } SYSTEM_DRIVER_INFORMATION;
748
749 typedef struct _SYSTEM_EXCEPTION_INFORMATION {
750     BYTE Reserved1[16];
751 } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
752
753 typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
754     BYTE Reserved1[32];
755 } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
756
757 typedef struct _SYSTEM_INTERRUPT_INFORMATION {
758     BYTE Reserved1[24];
759 } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
760
761 /* System Information Class 0x10 */
762 typedef struct {
763     USHORT dwPID;
764     USHORT dwCreatorBackTraceIndex;
765     BYTE bObjectType;
766     BYTE bHandleAttributes;
767     USHORT usHandleOffset;
768     DWORD dwKeObject;
769     ULONG ulGrantedAccess;
770 } HANDLEINFO, *PHANDLEINFO; /* FIXME: SYSTEM_HANDLE_INFORMATION? */
771
772 typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
773     BYTE Reserved1[312];
774 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
775
776 /* System Information Class 0x02 */
777 typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
778 #ifdef __WINESRC__
779     LARGE_INTEGER liIdleTime;
780     DWORD dwSpare[10];
781 #else
782     LARGE_INTEGER IdleTime;
783     LARGE_INTEGER KernelTime;
784     LARGE_INTEGER UserTime;
785     LARGE_INTEGER Reserved1[2];
786     ULONG Reserved2;
787 #endif
788 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
789
790 /* System Information Class 0x05 */
791 typedef struct _SYSTEM_PROCESS_INFORMATION {
792 #ifdef __WINESRC__
793     DWORD dwOffset;
794     DWORD dwThreadCount;
795     DWORD dwUnknown1[6];
796     FILETIME ftCreationTime;
797     DWORD dwUnknown2[5];
798     WCHAR *pszProcessName;
799     DWORD dwBasePriority;
800     DWORD dwProcessID;
801     DWORD dwParentProcessID;
802     DWORD dwHandleCount;
803     DWORD dwUnknown3;
804     DWORD dwUnknown4;
805     DWORD dwVirtualBytesPeak;
806     DWORD dwVirtualBytes;
807     DWORD dwPageFaults;
808     DWORD dwWorkingSetPeak;
809     DWORD dwWorkingSet;
810     DWORD dwUnknown5;
811     DWORD dwPagedPool;
812     DWORD dwUnknown6;
813     DWORD dwNonPagedPool;
814     DWORD dwPageFileBytesPeak;
815     DWORD dwPrivateBytes;
816     DWORD dwPageFileBytes;
817     DWORD dwUnknown7[4];
818     THREADINFO ti[1];
819 #else
820     ULONG NextEntryOffset;
821     BYTE Reserved1[52];
822     PVOID Reserved2[3];
823     HANDLE UniqueProcessId;
824     PVOID Reserved3;
825     ULONG HandleCount;
826     BYTE Reserved4[4];
827     PVOID Reserved5[11];
828     SIZE_T PeakPagefileUsage;
829     SIZE_T PrivatePageCount;
830     LARGE_INTEGER Reserved6[6];
831 #endif
832 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
833
834 typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
835     ULONG RegistryQuotaAllowed;
836     ULONG RegistryQuotaUsed;
837     PVOID Reserved1;
838 } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
839
840 typedef struct _SYSTEM_TIME_ADJUSTMENT {
841     ULONG   TimeAdjustment;
842     BOOLEAN TimeAdjustmentDisabled;
843 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
844
845 /* System Information Class 0x03 */
846 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
847 #ifdef __WINESRC__
848     LARGE_INTEGER liKeBootTime;
849     LARGE_INTEGER liKeSystemTime;
850     LARGE_INTEGER liExpTimeZoneBias;
851     ULONG uCurrentTimeZoneId;
852     DWORD dwReserved;
853 #else
854     BYTE Reserved1[48];
855 #endif
856 } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION; /* was SYSTEM_TIME_INFORMATION */
857
858 typedef struct _TIME_FIELDS
859 {   CSHORT Year;
860     CSHORT Month;
861     CSHORT Day;
862     CSHORT Hour;
863     CSHORT Minute;
864     CSHORT Second;
865     CSHORT Milliseconds;
866     CSHORT Weekday;
867 } TIME_FIELDS, *PTIME_FIELDS;
868
869 typedef struct _WINSTATIONINFORMATIONW {
870   BYTE Reserved2[70];
871   ULONG LogonId;
872   BYTE Reserved3[1140];
873 } WINSTATIONINFORMATIONW, *PWINSTATIONINFORMATIONW;
874
875 typedef struct _VM_COUNTERS_ {
876     ULONG PeakVirtualSize;
877     ULONG VirtualSize;
878     ULONG PageFaultCount;
879     ULONG PeakWorkingSetSize;
880     ULONG WorkingSetSize;
881     ULONG QuotaPeakPagedPoolUsage;
882     ULONG QuotaPagedPoolUsage;
883     ULONG QuotaPeakNonPagedPoolUsage;
884     ULONG QuotaNonPagedPoolUsage;
885     ULONG PagefileUsage;
886     ULONG PeakPagefileUsage;
887 } VM_COUNTERS, *PVM_COUNTERS;
888
889 typedef BOOLEAN (WINAPI * PWINSTATIONQUERYINFORMATIONW)(HANDLE,ULONG,WINSTATIONINFOCLASS,PVOID,ULONG,PULONG);
890
891 typedef struct _LDR_RESOURCE_INFO
892 {
893     ULONG Type;
894     ULONG Name;
895     ULONG Language;
896 } LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
897
898 /***********************************************************************
899  * Defines
900  */
901
902 /* flags for NtCreateFile and NtOpenFile */
903 #define FILE_DIRECTORY_FILE             0x00000001
904 #define FILE_WRITE_THROUGH              0x00000002
905 #define FILE_SEQUENTIAL_ONLY            0x00000004
906 #define FILE_NO_INTERMEDIATE_BUFFERING  0x00000008
907 #define FILE_SYNCHRONOUS_IO_ALERT       0x00000010
908 #define FILE_SYNCHRONOUS_IO_NONALERT    0x00000020
909 #define FILE_NON_DIRECTORY_FILE         0x00000040
910 #define FILE_CREATE_TREE_CONNECTION     0x00000080
911 #define FILE_COMPLETE_IF_OPLOCKED       0x00000100
912 #define FILE_NO_EA_KNOWLEDGE            0x00000200
913 #define FILE_OPEN_FOR_RECOVERY          0x00000400
914 #define FILE_RANDOM_ACCESS              0x00000800
915 #define FILE_DELETE_ON_CLOSE            0x00001000
916 #define FILE_OPEN_BY_FILE_ID            0x00002000
917 #define FILE_OPEN_FOR_BACKUP_INTENT     0x00004000
918 #define FILE_NO_COMPRESSION             0x00008000
919 #define FILE_RESERVE_OPFILTER           0x00100000
920 #define FILE_TRANSACTED_MODE            0x00200000
921 #define FILE_OPEN_OFFLINE_FILE          0x00400000
922
923 #define FILE_ATTRIBUTE_VALID_FLAGS      0x00007fb7
924 #define FILE_ATTRIBUTE_VALID_SET_FLAGS  0x000031a7
925
926 /* status for NtCreateFile or NtOpenFile */
927 #define FILE_SUPERSEDED                 0
928 #define FILE_OPENED                     1
929 #define FILE_CREATED                    2
930 #define FILE_OVERWRITTEN                3
931 #define FILE_EXISTS                     4
932 #define FILE_DOES_NOT_EXIST             5
933
934 /* disposition for NtCreateFile */
935 #define FILE_SUPERSEDE                  0
936 #define FILE_OPEN                       1
937 #define FILE_CREATE                     2
938 #define FILE_OPEN_IF                    3
939 #define FILE_OVERWRITE                  4
940 #define FILE_OVERWRITE_IF               5
941 #define FILE_MAXIMUM_DISPOSITION        5
942
943 /* Characteristics of a File System */
944 #define FILE_REMOVABLE_MEDIA            0x00000001
945 #define FILE_READ_ONLY_DEVICE           0x00000002
946 #define FILE_FLOPPY_DISKETTE            0x00000004
947 #define FILE_WRITE_ONE_MEDIA            0x00000008
948 #define FILE_REMOTE_DEVICE              0x00000010
949 #define FILE_DEVICE_IS_MOUNTED          0x00000020
950 #define FILE_VIRTUAL_VOLUME             0x00000040
951
952 #if (_WIN32_WINNT >= 0x0501)
953 #define INTERNAL_TS_ACTIVE_CONSOLE_ID ( *((volatile ULONG*)(0x7ffe02d8)) )
954 #endif /* (_WIN32_WINNT >= 0x0501) */
955
956 #define LOGONID_CURRENT    ((ULONG)-1)
957
958 #define OBJ_INHERIT          0x00000002L
959 #define OBJ_PERMANENT        0x00000010L
960 #define OBJ_EXCLUSIVE        0x00000020L
961 #define OBJ_CASE_INSENSITIVE 0x00000040L
962 #define OBJ_OPENIF           0x00000080L
963 #define OBJ_OPENLINK         0x00000100L
964 #define OBJ_KERNEL_HANDLE    0x00000200L
965 #define OBJ_VALID_ATTRIBUTES 0x000003F2L
966
967 #define SERVERNAME_CURRENT ((HANDLE)NULL)
968
969 typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR); /* FIXME: not the right name */
970 typedef void (CALLBACK *PRTL_THREAD_START_ROUTINE)(LPVOID); /* FIXME: not the right name */
971
972 /***********************************************************************
973  * Function declarations
974  */
975
976 extern LPSTR _strlwr(LPSTR str); /* FIXME: Doesn't belong here */
977 extern LPSTR _strupr(LPSTR str); /* FIXME: Doesn't belong here */
978
979 #if defined(__i386__) && defined(__GNUC__)
980 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
981 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
982 #else  /* __i386__ && __GNUC__ */
983 void WINAPI DbgBreakPoint(void);
984 void WINAPI DbgUserBreakPoint(void);
985 #endif  /* __i386__ && __GNUC__ */
986 void WINAPIV DbgPrint(LPCSTR fmt, ...);
987
988 NTSTATUS  WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void**,PULONG);
989 NTSTATUS  WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);
990 NTSTATUS  WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
991 NTSTATUS  WINAPI LdrGetDllHandle(ULONG, ULONG, const UNICODE_STRING*, HMODULE*);
992 NTSTATUS  WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
993 void      WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG);
994 NTSTATUS  WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
995 void      WINAPI LdrShutdownProcess(void);
996 void      WINAPI LdrShutdownThread(void);
997 NTSTATUS  WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,PBOOLEAN);
998 NTSTATUS  WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
999 NTSTATUS  WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,PVOID,ULONG*,ULONG,ULONG);
1000 NTSTATUS  WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
1001 NTSTATUS  WINAPI NtClearEvent(HANDLE);
1002 NTSTATUS  WINAPI NtClose(HANDLE);
1003 NTSTATUS  WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1004 NTSTATUS  WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1005 NTSTATUS  WINAPI NtCreateKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1006 NTSTATUS  WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1007 NTSTATUS  WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,ULONG);
1008 NTSTATUS  WINAPI NtCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1009 NTSTATUS  WINAPI NtDelayExecution(BOOLEAN,const LARGE_INTEGER*);
1010 NTSTATUS  WINAPI NtDeleteKey(HKEY);
1011 NTSTATUS  WINAPI NtDeleteValueKey(HKEY,const UNICODE_STRING *);
1012 NTSTATUS  WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1013 NTSTATUS  WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1014 NTSTATUS  WINAPI NtEnumerateKey(HKEY,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1015 NTSTATUS  WINAPI NtEnumerateValueKey(HKEY,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1016 NTSTATUS  WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
1017 NTSTATUS  WINAPI NtFlushKey(HKEY);
1018 NTSTATUS  WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,ULONG*,ULONG);
1019 NTSTATUS  WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1020 NTSTATUS  WINAPI NtGetContextThread(HANDLE,CONTEXT*);
1021 NTSTATUS  WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,const OBJECT_ATTRIBUTES *);
1022 NTSTATUS  WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
1023 NTSTATUS  WINAPI NtLockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1024 NTSTATUS  WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,ULONG,const LARGE_INTEGER*,ULONG*,SECTION_INHERIT,ULONG,ULONG);
1025 NTSTATUS  WINAPI NtNotifyChangeKey(HKEY,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1026 NTSTATUS  WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1027 NTSTATUS  WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1028 NTSTATUS  WINAPI NtOpenKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1029 NTSTATUS  WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
1030 NTSTATUS  WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1031 NTSTATUS  WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1032 NTSTATUS  WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1033 NTSTATUS  WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1034 NTSTATUS  WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG,ULONG*);
1035 NTSTATUS  WINAPI NtPulseEvent(HANDLE,PULONG);
1036 NTSTATUS  WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
1037 NTSTATUS  WINAPI NtQueryDefaultLocale(BOOLEAN,LCID*);
1038 NTSTATUS  WINAPI NtQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1039 NTSTATUS  WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
1040 NTSTATUS  WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
1041 NTSTATUS  WINAPI NtQueryInformationToken(HANDLE,DWORD,LPVOID,DWORD,LPDWORD);
1042 NTSTATUS  WINAPI NtQueryKey(HKEY,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1043 NTSTATUS  WINAPI NtQueryMultipleValueKey(HKEY,PVALENTW,ULONG,PVOID,ULONG,PULONG);
1044 NTSTATUS  WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
1045 NTSTATUS  WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
1046 NTSTATUS  WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1047 NTSTATUS  WINAPI NtQuerySystemTime(PLARGE_INTEGER);
1048 NTSTATUS  WINAPI NtQueryValueKey(HKEY,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
1049 NTSTATUS  WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
1050 void      WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
1051 NTSTATUS  WINAPI NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
1052 NTSTATUS  WINAPI NtReadVirtualMemory(HANDLE,const void*,void*,SIZE_T,SIZE_T*);
1053 NTSTATUS  WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
1054 NTSTATUS  WINAPI NtReplaceKey(POBJECT_ATTRIBUTES,HKEY,POBJECT_ATTRIBUTES);
1055 NTSTATUS  WINAPI NtResetEvent(HANDLE,PULONG);
1056 NTSTATUS  WINAPI NtRestoreKey(HKEY,HANDLE,ULONG);
1057 NTSTATUS  WINAPI NtResumeThread(HANDLE,PULONG);
1058 NTSTATUS  WINAPI NtSaveKey(HKEY,HANDLE);
1059 NTSTATUS  WINAPI NtSetContextThread(HANDLE,const CONTEXT*);
1060 NTSTATUS  WINAPI NtSetDefaultLocale(BOOLEAN,LCID);
1061 NTSTATUS  WINAPI NtSetEvent(HANDLE,PULONG);
1062 NTSTATUS  WINAPI NtSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
1063 NTSTATUS  WINAPI NtSetInformationKey(HKEY,const int,PVOID,ULONG);
1064 NTSTATUS  WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
1065 NTSTATUS  WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
1066 NTSTATUS  WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1067 NTSTATUS  WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
1068 NTSTATUS  WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMERAPCROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
1069 NTSTATUS  WINAPI NtSetValueKey(HKEY,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
1070 NTSTATUS  WINAPI NtSuspendThread(HANDLE,PULONG);
1071 NTSTATUS  WINAPI NtTerminateProcess(HANDLE,LONG);
1072 NTSTATUS  WINAPI NtTerminateThread(HANDLE,LONG);
1073 NTSTATUS  WINAPI NtUnloadKey(HKEY);
1074 NTSTATUS  WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG);
1075 NTSTATUS  WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1076 NTSTATUS  WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
1077 NTSTATUS  WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
1078 NTSTATUS  WINAPI NtWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
1079 NTSTATUS  WINAPI NtWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
1080 NTSTATUS  WINAPI NtWriteVirtualMemory(HANDLE,void*,const void*,SIZE_T,SIZE_T*);
1081
1082 void      WINAPI RtlAcquirePebLock(void);
1083 BYTE      WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK,BYTE);
1084 BYTE      WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK,BYTE);
1085 NTSTATUS  WINAPI RtlAddAce(PACL,DWORD,DWORD,PACE_HEADER,DWORD);
1086 NTSTATUS  WINAPI RtlAddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
1087 NTSTATUS  WINAPI RtlAddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1088 NTSTATUS  WINAPI RtlAddAccessDeniedAce(PACL,DWORD,DWORD,PSID);
1089 NTSTATUS  WINAPI RtlAddAccessDeniedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1090 PVOID     WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER);
1091 DWORD     WINAPI RtlAdjustPrivilege(DWORD,DWORD,DWORD,DWORD);
1092 BOOLEAN   WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
1093 PVOID     WINAPI RtlAllocateHeap(HANDLE,ULONG,ULONG);
1094 DWORD     WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
1095 NTSTATUS  WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
1096 NTSTATUS  WINAPI RtlAppendAsciizToString(STRING *,LPCSTR);
1097 NTSTATUS  WINAPI RtlAppendStringToString(STRING *,const STRING *);
1098 NTSTATUS  WINAPI RtlAppendUnicodeStringToString(UNICODE_STRING *,const UNICODE_STRING *);
1099 NTSTATUS  WINAPI RtlAppendUnicodeToString(UNICODE_STRING *,LPCWSTR);
1100 BOOLEAN   WINAPI RtlAreAllAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1101 BOOLEAN   WINAPI RtlAreAnyAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1102 BOOLEAN   WINAPI RtlAreBitsSet(PCRTL_BITMAP,ULONG,ULONG);
1103 BOOLEAN   WINAPI RtlAreBitsClear(PCRTL_BITMAP,ULONG,ULONG);
1104
1105 NTSTATUS  WINAPI RtlCharToInteger(PCSZ,ULONG,PULONG);
1106 void      WINAPI RtlClearAllBits(PRTL_BITMAP);
1107 void      WINAPI RtlClearBits(PRTL_BITMAP,ULONG,ULONG);
1108 ULONG     WINAPI RtlCompactHeap(HANDLE,ULONG);
1109 LONG      WINAPI RtlCompareString(const STRING*,const STRING*,BOOLEAN);
1110 LONG      WINAPI RtlCompareUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1111 DWORD     WINAPI RtlComputeCrc32(DWORD,PBYTE,INT);
1112 NTSTATUS  WINAPI RtlConvertSidToUnicodeString(PUNICODE_STRING,PSID,BOOLEAN);
1113 LONGLONG  WINAPI RtlConvertLongToLargeInteger(LONG);
1114 ULONGLONG WINAPI RtlConvertUlongToLargeInteger(ULONG);
1115 void      WINAPI RtlCopyLuid(PLUID,const LUID*);
1116 void      WINAPI RtlCopyLuidAndAttributesArray(ULONG,const LUID_AND_ATTRIBUTES*,PLUID_AND_ATTRIBUTES);
1117 DWORD     WINAPI RtlCopySid(DWORD,PSID,PSID);
1118 void      WINAPI RtlCopyString(STRING*,const STRING*);
1119 void      WINAPI RtlCopyUnicodeString(UNICODE_STRING*,const UNICODE_STRING*);
1120 NTSTATUS  WINAPI RtlCreateAcl(PACL,DWORD,DWORD);
1121 NTSTATUS  WINAPI RtlCreateEnvironment(BOOLEAN, PWSTR*);
1122 HANDLE    WINAPI RtlCreateHeap(ULONG,PVOID,ULONG,ULONG,PVOID,PRTL_HEAP_DEFINITION);
1123 NTSTATUS  WINAPI RtlCreateProcessParameters(RTL_USER_PROCESS_PARAMETERS**,const UNICODE_STRING*,
1124                                             const UNICODE_STRING*,const UNICODE_STRING*,
1125                                             const UNICODE_STRING*,PWSTR,const UNICODE_STRING*,
1126                                             const UNICODE_STRING*,const UNICODE_STRING*,
1127                                             const UNICODE_STRING*);
1128 NTSTATUS  WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
1129 BOOLEAN   WINAPI RtlCreateUnicodeString(PUNICODE_STRING,LPCWSTR);
1130 BOOLEAN   WINAPI RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING,LPCSTR);
1131 NTSTATUS  WINAPI RtlCreateUserThread(HANDLE,const SECURITY_DESCRIPTOR*,BOOLEAN,PVOID,SIZE_T,SIZE_T,PRTL_THREAD_START_ROUTINE,void*,HANDLE*,CLIENT_ID*);
1132
1133 NTSTATUS  WINAPI RtlDeleteAce(PACL,DWORD);
1134 NTSTATUS  WINAPI RtlDeleteCriticalSection(RTL_CRITICAL_SECTION *);
1135 void      WINAPI RtlDeleteResource(LPRTL_RWLOCK);
1136 DWORD     WINAPI RtlDeleteSecurityObject(DWORD);
1137 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlDeNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
1138 NTSTATUS  WINAPI RtlDestroyEnvironment(PWSTR);
1139 HANDLE    WINAPI RtlDestroyHeap(HANDLE);
1140 void      WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*);
1141 DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR);
1142 BOOLEAN   WINAPI RtlDoesFileExists_U(LPCWSTR);
1143 BOOLEAN   WINAPI RtlDosPathNameToNtPathName_U(LPWSTR,PUNICODE_STRING,PWSTR*,CURDIR*);
1144 ULONG     WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*);
1145 WCHAR     WINAPI RtlDowncaseUnicodeChar(WCHAR);
1146 NTSTATUS  WINAPI RtlDowncaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1147 void      WINAPI RtlDumpResource(LPRTL_RWLOCK);
1148 NTSTATUS  WINAPI RtlDuplicateUnicodeString(int,const UNICODE_STRING*,UNICODE_STRING*);
1149
1150 LONGLONG  WINAPI RtlEnlargedIntegerMultiply(INT,INT);
1151 ULONGLONG WINAPI RtlEnlargedUnsignedMultiply(UINT,UINT);
1152 UINT      WINAPI RtlEnlargedUnsignedDivide(ULONGLONG,UINT,UINT *);
1153 NTSTATUS  WINAPI RtlEnterCriticalSection(RTL_CRITICAL_SECTION *);
1154 void      WINAPI RtlEraseUnicodeString(UNICODE_STRING*);
1155 NTSTATUS  WINAPI RtlEqualComputerName(const UNICODE_STRING*,const UNICODE_STRING*);
1156 NTSTATUS  WINAPI RtlEqualDomainName(const UNICODE_STRING*,const UNICODE_STRING*);
1157 BOOLEAN   WINAPI RtlEqualLuid(const LUID*,const LUID*);
1158 BOOL      WINAPI RtlEqualPrefixSid(PSID,PSID);
1159 BOOL      WINAPI RtlEqualSid(PSID,PSID);
1160 BOOLEAN   WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN);
1161 BOOLEAN   WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1162 NTSTATUS  WINAPI RtlExpandEnvironmentStrings_U(PWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*);
1163 LONGLONG  WINAPI RtlExtendedMagicDivide(LONGLONG,LONGLONG,INT);
1164 LONGLONG  WINAPI RtlExtendedIntegerMultiply(LONGLONG,INT);
1165 LONGLONG  WINAPI RtlExtendedLargeIntegerDivide(LONGLONG,INT,INT *);
1166
1167 NTSTATUS  WINAPI RtlFindCharInUnicodeString(int,const UNICODE_STRING*,const UNICODE_STRING*,USHORT*);
1168 ULONG     WINAPI RtlFindClearBits(PCRTL_BITMAP,ULONG,ULONG);
1169 ULONG     WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP,ULONG,ULONG);
1170 ULONG     WINAPI RtlFindClearRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
1171 ULONG     WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
1172 ULONG     WINAPI RtlFindLastBackwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
1173 CCHAR     WINAPI RtlFindLeastSignificantBit(ULONGLONG);
1174 ULONG     WINAPI RtlFindLongestRunSet(PCRTL_BITMAP,PULONG);
1175 ULONG     WINAPI RtlFindLongestRunClear(PCRTL_BITMAP,PULONG);
1176 NTSTATUS  WINAPI RtlFindMessage(HMODULE,ULONG,ULONG,ULONG,const MESSAGE_RESOURCE_ENTRY**);
1177 CCHAR     WINAPI RtlFindMostSignificantBit(ULONGLONG);
1178 ULONG     WINAPI RtlFindNextForwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
1179 ULONG     WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
1180 ULONG     WINAPI RtlFindSetBits(PCRTL_BITMAP,ULONG,ULONG);
1181 ULONG     WINAPI RtlFindSetBitsAndClear(PRTL_BITMAP,ULONG,ULONG);
1182 ULONG     WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
1183 BOOLEAN   WINAPI RtlFirstFreeAce(PACL,PACE_HEADER *);
1184 NTSTATUS  WINAPI RtlFormatCurrentUserKeyPath(PUNICODE_STRING);
1185 void      WINAPI RtlFreeAnsiString(PANSI_STRING);
1186 BOOLEAN   WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
1187 void      WINAPI RtlFreeOemString(POEM_STRING);
1188 DWORD     WINAPI RtlFreeSid(PSID);
1189 void      WINAPI RtlFreeUnicodeString(PUNICODE_STRING);
1190
1191 DWORD     WINAPI RtlGetAce(PACL,DWORD,LPVOID *);
1192 NTSTATUS  WINAPI RtlGetControlSecurityDescriptor(PSECURITY_DESCRIPTOR, PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
1193 NTSTATUS  WINAPI RtlGetCurrentDirectory_U(ULONG, LPWSTR);
1194 NTSTATUS  WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
1195 ULONG     WINAPI RtlGetFullPathName_U(PCWSTR,ULONG,PWSTR,PWSTR*);
1196 NTSTATUS  WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
1197 DWORD     WINAPI RtlGetLastWin32Error(void);
1198 DWORD     WINAPI RtlGetLongestNtPathLength(void);
1199 BOOLEAN   WINAPI RtlGetNtProductType(LPDWORD);
1200 NTSTATUS  WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
1201 ULONG     WINAPI RtlGetProcessHeaps(ULONG,HANDLE*);
1202 NTSTATUS  WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
1203 NTSTATUS  WINAPI RtlGetVersion(RTL_OSVERSIONINFOEXW*);
1204
1205 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(PSID);
1206 PVOID     WINAPI RtlImageDirectoryEntryToData(HMODULE,BOOL,WORD,ULONG *);
1207 PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE);
1208 PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection(const IMAGE_NT_HEADERS *,HMODULE,DWORD);
1209 PVOID     WINAPI RtlImageRvaToVa(const IMAGE_NT_HEADERS *,HMODULE,DWORD,IMAGE_SECTION_HEADER **);
1210 BOOL      WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
1211 void      WINAPI RtlInitString(PSTRING,PCSZ);
1212 void      WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
1213 void      WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
1214 NTSTATUS  WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
1215 NTSTATUS  WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *);
1216 NTSTATUS  WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,DWORD);
1217 void      WINAPI RtlInitializeBitMap(PRTL_BITMAP,LPBYTE,ULONG);
1218 void      WINAPI RtlInitializeResource(LPRTL_RWLOCK);
1219 BOOL      WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
1220
1221 NTSTATUS  WINAPI RtlInt64ToUnicodeString(ULONGLONG,ULONG,UNICODE_STRING *);
1222 NTSTATUS  WINAPI RtlIntegerToChar(ULONG,ULONG,ULONG,PCHAR);
1223 NTSTATUS  WINAPI RtlIntegerToUnicodeString(ULONG,ULONG,UNICODE_STRING *);
1224 ULONG     WINAPI RtlIsDosDeviceName_U(PCWSTR);
1225 BOOLEAN   WINAPI RtlIsNameLegalDOS8Dot3(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
1226 DWORD     WINAPI RtlIsTextUnicode(LPVOID,DWORD,DWORD *);
1227
1228 LONGLONG  WINAPI RtlLargeIntegerAdd(LONGLONG,LONGLONG);
1229 LONGLONG  WINAPI RtlLargeIntegerArithmeticShift(LONGLONG,INT);
1230 ULONGLONG WINAPI RtlLargeIntegerDivide( ULONGLONG,ULONGLONG,ULONGLONG *);
1231 LONGLONG  WINAPI RtlLargeIntegerNegate(LONGLONG);
1232 LONGLONG  WINAPI RtlLargeIntegerShiftLeft(LONGLONG,INT);
1233 LONGLONG  WINAPI RtlLargeIntegerShiftRight(LONGLONG,INT);
1234 LONGLONG  WINAPI RtlLargeIntegerSubtract(LONGLONG,LONGLONG);
1235 NTSTATUS  WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PCHAR);
1236 NTSTATUS  WINAPI RtlLeaveCriticalSection(RTL_CRITICAL_SECTION *);
1237 DWORD     WINAPI RtlLengthRequiredSid(DWORD);
1238 ULONG     WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR);
1239 DWORD     WINAPI RtlLengthSid(PSID);
1240 NTSTATUS  WINAPI RtlLocalTimeToSystemTime(const LARGE_INTEGER*,PLARGE_INTEGER);
1241 BOOLEAN   WINAPI RtlLockHeap(HANDLE);
1242
1243 NTSTATUS  WINAPI RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
1244 void      WINAPI RtlMapGenericMask(PACCESS_MASK,const GENERIC_MAPPING*);
1245 NTSTATUS  WINAPI RtlMultiByteToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
1246 NTSTATUS  WINAPI RtlMultiByteToUnicodeSize(DWORD*,LPCSTR,UINT);
1247
1248 DWORD     WINAPI RtlNewSecurityObject(DWORD,DWORD,DWORD,DWORD,DWORD,DWORD);
1249 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
1250 ULONG     WINAPI RtlNtStatusToDosError(NTSTATUS);
1251 ULONG     WINAPI RtlNtStatusToDosErrorNoTeb(NTSTATUS);
1252 ULONG     WINAPI RtlNumberOfSetBits(PCRTL_BITMAP);
1253 ULONG     WINAPI RtlNumberOfClearBits(PCRTL_BITMAP);
1254
1255 UINT      WINAPI RtlOemStringToUnicodeSize(const STRING*);
1256 NTSTATUS  WINAPI RtlOemStringToUnicodeString(UNICODE_STRING*,const STRING*,BOOLEAN);
1257 NTSTATUS  WINAPI RtlOemToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
1258 DWORD     WINAPI RtlOpenCurrentUser(ACCESS_MASK,PHKEY);
1259
1260 BOOLEAN   WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
1261 BOOLEAN   WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1262
1263 NTSTATUS  WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
1264 NTSTATUS  WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
1265 NTSTATUS  WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION);
1266
1267 void      WINAPI RtlRaiseException(PEXCEPTION_RECORD);
1268 void      WINAPI RtlRaiseStatus(NTSTATUS);
1269 ULONG     WINAPI RtlRandom(PULONG);
1270 PVOID     WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,ULONG);
1271 void      WINAPI RtlReleasePebLock(void);
1272 void      WINAPI RtlReleaseResource(LPRTL_RWLOCK);
1273 ULONG     WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
1274 void      WINAPI RtlRestoreLastWin32Error(DWORD);
1275
1276 void      WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *);
1277 void      WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);
1278 NTSTATUS  WINAPI RtlSelfRelativeToAbsoluteSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,
1279                                              PDWORD,PACL,PDWORD,PACL,PDWORD,PSID,PDWORD,PSID,PDWORD);
1280 void      WINAPI RtlSetAllBits(PRTL_BITMAP);
1281 void      WINAPI RtlSetBits(PRTL_BITMAP,ULONG,ULONG);
1282 NTSTATUS  WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING*);
1283 void      WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR*);
1284 NTSTATUS  WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
1285 NTSTATUS  WINAPI RtlSetEnvironmentVariable(PWSTR*,PUNICODE_STRING,PUNICODE_STRING);
1286 NTSTATUS  WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
1287 NTSTATUS  WINAPI RtlSetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
1288 void      WINAPI RtlSetLastWin32Error(DWORD);
1289 NTSTATUS  WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
1290 NTSTATUS  WINAPI RtlSetTimeZoneInformation(const TIME_ZONE_INFORMATION*);
1291 ULONG     WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
1292 LPDWORD   WINAPI RtlSubAuthoritySid(PSID,DWORD);
1293 LPBYTE    WINAPI RtlSubAuthorityCountSid(PSID);
1294 NTSTATUS  WINAPI RtlSystemTimeToLocalTime(const LARGE_INTEGER*,PLARGE_INTEGER);
1295
1296 void      WINAPI RtlTimeToTimeFields(const LARGE_INTEGER*,PTIME_FIELDS);
1297 BOOLEAN   WINAPI RtlTimeFieldsToTime(PTIME_FIELDS,PLARGE_INTEGER);
1298 void      WINAPI RtlTimeToElapsedTimeFields(const LARGE_INTEGER *,PTIME_FIELDS);
1299 BOOLEAN   WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *,LPDWORD);
1300 BOOLEAN   WINAPI RtlTimeToSecondsSince1980(const LARGE_INTEGER *,LPDWORD);
1301 BOOL      WINAPI RtlTryEnterCriticalSection(RTL_CRITICAL_SECTION *);
1302
1303 ULONGLONG __cdecl RtlUlonglongByteSwap(ULONGLONG);
1304 DWORD     WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING*);
1305 NTSTATUS  WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING,PCUNICODE_STRING,BOOLEAN);
1306 NTSTATUS  WINAPI RtlUnicodeStringToInteger(const UNICODE_STRING *,ULONG,ULONG *);
1307 DWORD     WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING*);
1308 NTSTATUS  WINAPI RtlUnicodeStringToOemString(POEM_STRING,PCUNICODE_STRING,BOOLEAN);
1309 NTSTATUS  WINAPI RtlUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1310 NTSTATUS  WINAPI RtlUnicodeToMultiByteSize(PULONG,PCWSTR,ULONG);
1311 NTSTATUS  WINAPI RtlUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1312 ULONG     WINAPI RtlUniform(PULONG);
1313 BOOLEAN   WINAPI RtlUnlockHeap(HANDLE);
1314 void      WINAPI RtlUnwind(PVOID,PVOID,PEXCEPTION_RECORD,PVOID);
1315 #ifdef __ia64__
1316 void      WINAPI RtlUnwind2(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT);
1317 void      WINAPI RtlUnwindEx(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT,PUNWIND_HISTORY_TABLE);
1318 #endif
1319 WCHAR     WINAPI RtlUpcaseUnicodeChar(WCHAR);
1320 NTSTATUS  WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING *,BOOLEAN);
1321 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToAnsiString(STRING*,const UNICODE_STRING*,BOOLEAN);
1322 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToCountedOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
1323 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
1324 NTSTATUS  WINAPI RtlUpcaseUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1325 NTSTATUS  WINAPI RtlUpcaseUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1326 CHAR      WINAPI RtlUpperChar(CHAR);
1327 void      WINAPI RtlUpperString(STRING *,const STRING *);
1328
1329 NTSTATUS  WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
1330 BOOLEAN   WINAPI RtlValidAcl(PACL);
1331 BOOLEAN   WINAPI RtlValidSid(PSID);
1332 BOOLEAN   WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
1333 NTSTATUS  WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
1334
1335 NTSTATUS  WINAPI RtlWalkHeap(HANDLE,PVOID);
1336
1337 NTSTATUS  WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);
1338 NTSTATUS  WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
1339
1340 /***********************************************************************
1341  * Inline functions
1342  */
1343
1344 #define InitializeObjectAttributes(p,n,a,r,s) \
1345     do { \
1346         (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
1347         (p)->RootDirectory = r; \
1348         (p)->Attributes = a; \
1349         (p)->ObjectName = n; \
1350         (p)->SecurityDescriptor = s; \
1351         (p)->SecurityQualityOfService = NULL; \
1352     } while (0)
1353
1354 #define NtCurrentProcess() ((HANDLE)-1)
1355
1356 #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
1357 #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
1358 #define RtlStoreUlong(p,v)  do { ULONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1359 #define RtlStoreUlonglong(p,v) do { ULONGLONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1360 #define RtlRetrieveUlong(p,s) memcpy((p), (s), sizeof(ULONG))
1361 #define RtlRetrieveUlonglong(p,s) memcpy((p), (s), sizeof(ULONGLONG))
1362 #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
1363
1364 inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
1365 {
1366     if (lpBits && ulBit < lpBits->SizeOfBitMap &&
1367         lpBits->BitMapBuffer[ulBit >> 3] & (1 << (ulBit & 7)))
1368         return TRUE;
1369     return FALSE;
1370 }
1371
1372 #define RtlClearAllBits(p) \
1373     do { \
1374         PRTL_BITMAP _p = (p); \
1375         memset(_p->BitMapBuffer,0,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1376     } while (0)
1377
1378 #define RtlInitializeBitMap(p,b,s) \
1379     do { \
1380         PRTL_BITMAP _p = (p); \
1381         _p->SizeOfBitMap = (s); \
1382         _p->BitMapBuffer = (b); \
1383     } while (0)
1384
1385 #define RtlSetAllBits(p) \
1386     do { \
1387         PRTL_BITMAP _p = (p); \
1388         memset(_p->BitMapBuffer,0xff,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1389     } while (0)
1390
1391 /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
1392 inline static USHORT RtlUshortByteSwap(USHORT s)
1393 {
1394     return (s >> 8) | (s << 8);
1395 }
1396 inline static ULONG RtlUlongByteSwap(ULONG i)
1397 {
1398 #if defined(__i386__) && defined(__GNUC__)
1399     ULONG ret;
1400     __asm__("bswap %0" : "=r" (ret) : "0" (i) );
1401     return ret;
1402 #else
1403     return ((ULONG)RtlUshortByteSwap((USHORT)i) << 16) | RtlUshortByteSwap((USHORT)(i >> 16));
1404 #endif
1405 }
1406
1407 /*************************************************************************
1408  * Loader functions and structures.
1409  *
1410  * Those are not part of standard Winternl.h
1411  */
1412 typedef struct _LDR_MODULE
1413 {
1414     LIST_ENTRY          InLoadOrderModuleList;
1415     LIST_ENTRY          InMemoryOrderModuleList;
1416     LIST_ENTRY          InInitializationOrderModuleList;
1417     void*               BaseAddress;
1418     void*               EntryPoint;
1419     ULONG               SizeOfImage;
1420     UNICODE_STRING      FullDllName;
1421     UNICODE_STRING      BaseDllName;
1422     ULONG               Flags;
1423     SHORT               LoadCount;
1424     SHORT               TlsIndex;
1425     HANDLE              SectionHandle;
1426     ULONG               CheckSum;
1427     ULONG               TimeDateStamp;
1428 } LDR_MODULE, *PLDR_MODULE;
1429
1430 /* those defines are (some of the) regular LDR_MODULE.Flags values */
1431 #define LDR_IMAGE_IS_DLL                0x00000004
1432 #define LDR_LOAD_IN_PROGRESS            0x00001000
1433 #define LDR_UNLOAD_IN_PROGRESS          0x00002000
1434 #define LDR_NO_DLL_CALLS                0x00040000
1435 #define LDR_PROCESS_ATTACHED            0x00080000
1436 #define LDR_MODULE_REBASED              0x00200000
1437
1438 /* these ones is Wine specific */
1439 #define LDR_DONT_RESOLVE_REFS           0x40000000
1440 #define LDR_WINE_INTERNAL               0x80000000
1441
1442 /* FIXME: to be checked */
1443 #define MAXIMUM_FILENAME_LENGTH 256
1444
1445 typedef struct _SYSTEM_MODULE
1446 {
1447     ULONG               Reserved1;
1448     ULONG               Reserved2;
1449     PVOID               ImageBaseAddress;
1450     ULONG               ImageSize;
1451     ULONG               Flags;
1452     WORD                Id;
1453     WORD                Rank;
1454     WORD                Unknown;
1455     WORD                NameOffset;
1456     BYTE                Name[MAXIMUM_FILENAME_LENGTH];
1457 } SYSTEM_MODULE, *PSYSTEM_MODULE;
1458
1459 typedef struct _SYSTEM_MODULE_INFORMATION
1460 {
1461     ULONG               ModulesCount;
1462     SYSTEM_MODULE       Modules[1]; /* FIXME: should be Modules[0] */
1463 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
1464
1465 NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
1466 NTSTATUS WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
1467 NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
1468 NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
1469 NTSTATUS WINAPI LdrUnloadDll(HMODULE);
1470 NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG);
1471
1472 /* list manipulation macros */
1473 #define InitializeListHead(le)  (void)((le)->Flink = (le)->Blink = (le))
1474 #define InsertHeadList(le,e)    do { PLIST_ENTRY f = (le)->Flink; (e)->Flink = f; (e)->Blink = (le); f->Blink = (e); (le)->Flink = (e); } while (0)
1475 #define InsertTailList(le,e)    do { PLIST_ENTRY b = (le)->Blink; (e)->Flink = (le); (e)->Blink = b; b->Flink = (e); (le)->Blink = (e); } while (0)
1476 #define IsListEmpty(le)         ((le)->Flink == (le))
1477 #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)
1478 static inline PLIST_ENTRY RemoveHeadList(PLIST_ENTRY le)
1479 {
1480     PLIST_ENTRY f, b, e;
1481
1482     e = le->Flink;
1483     f = le->Flink->Flink;
1484     b = le->Flink->Blink;
1485     f->Blink = b;
1486     b->Flink = f;
1487
1488     if (e != le) e->Flink = e->Blink = NULL;
1489     return e;
1490 }
1491 static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
1492 {
1493     PLIST_ENTRY f, b, e;
1494
1495     e = le->Blink;
1496     f = le->Blink->Flink;
1497     b = le->Blink->Blink;
1498     f->Blink = b;
1499     b->Flink = f;
1500
1501     if (e != le) e->Flink = e->Blink = NULL;
1502     return e;
1503 }
1504
1505 #ifdef __cplusplus
1506 } /* extern "C" */
1507 #endif /* defined(__cplusplus) */
1508
1509 #endif  /* __WINE_WINTERNAL_H */