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