Get icons for shell link files.
[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_DIRECTORY_INFORMATION {
247     ULONG               NextEntryOffset;
248     ULONG               FileIndex;
249     LARGE_INTEGER       CreationTime;
250     LARGE_INTEGER       LastAccessTime;
251     LARGE_INTEGER       LastWriteTime;
252     LARGE_INTEGER       ChangeTime;
253     LARGE_INTEGER       EndOfFile;
254     LARGE_INTEGER       AllocationSize;
255     ULONG               FileAttributes;
256     ULONG               FileNameLength;
257     WCHAR               FileName[ANYSIZE_ARRAY];
258 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
259
260 typedef struct _FILE_FULL_DIRECTORY_INFORMATION {
261     ULONG               NextEntryOffset;
262     ULONG               FileIndex;
263     LARGE_INTEGER       CreationTime;
264     LARGE_INTEGER       LastAccessTime;
265     LARGE_INTEGER       LastWriteTime;
266     LARGE_INTEGER       ChangeTime;
267     LARGE_INTEGER       EndOfFile;
268     LARGE_INTEGER       AllocationSize;
269     ULONG               FileAttributes;
270     ULONG               FileNameLength;
271     ULONG               EaSize;
272     WCHAR               FileName[ANYSIZE_ARRAY];
273 } FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION,
274   FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
275
276 typedef struct _FILE_BOTH_DIRECTORY_INFORMATION {
277     ULONG               NextEntryOffset;
278     ULONG               FileIndex;
279     LARGE_INTEGER       CreationTime;
280     LARGE_INTEGER       LastAccessTime;
281     LARGE_INTEGER       LastWriteTime;
282     LARGE_INTEGER       ChangeTime;
283     LARGE_INTEGER       EndOfFile;
284     LARGE_INTEGER       AllocationSize;
285     ULONG               FileAttributes;
286     ULONG               FileNameLength;
287     ULONG               EaSize;
288     CHAR                ShortNameLength;
289     WCHAR               ShortName[12];
290     WCHAR               FileName[ANYSIZE_ARRAY];
291 } FILE_BOTH_DIRECTORY_INFORMATION, *PFILE_BOTH_DIRECTORY_INFORMATION,
292   FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
293
294 typedef struct _FILE_BASIC_INFORMATION {
295     LARGE_INTEGER CreationTime;
296     LARGE_INTEGER LastAccessTime;
297     LARGE_INTEGER LastWriteTime;
298     LARGE_INTEGER ChangeTime;
299     ULONG FileAttributes;
300 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
301
302 typedef struct _FILE_STANDARD_INFORMATION {
303     LARGE_INTEGER AllocationSize;
304     LARGE_INTEGER EndOfFile;
305     ULONG NumberOfLinks;
306     BOOLEAN DeletePending;
307     BOOLEAN Directory;
308 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
309
310 typedef struct _FILE_POSITION_INFORMATION {
311     LARGE_INTEGER CurrentByteOffset;
312 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
313
314 typedef struct _FILE_ALIGNMENT_INFORMATION {
315     ULONG AlignmentRequirement;
316 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
317
318 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
319     LARGE_INTEGER CreationTime;
320     LARGE_INTEGER LastAccessTime;
321     LARGE_INTEGER LastWriteTime;
322     LARGE_INTEGER ChangeTime;
323     LARGE_INTEGER AllocationSize;
324     LARGE_INTEGER EndOfFile;
325     ULONG FileAttributes;
326 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
327
328 typedef struct _FILE_FULL_EA_INFORMATION {
329     ULONG NextEntryOffset;
330     UCHAR Flags;
331     UCHAR EaNameLength;
332     USHORT EaValueLength;
333     CHAR EaName[1];
334 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
335
336 typedef struct _FILE_STREAM_INFORMATION
337 {
338     ULONG NextEntryOffset;
339     ULONG StreamNameLength;
340     LARGE_INTEGER StreamSize;
341     LARGE_INTEGER StreamAllocationSize;
342     WCHAR StreamName[1];
343 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
344
345 struct _FILE_ATTRIBUTE_TAG_INFORMATION
346 {
347     ULONG FileAttributes;
348     ULONG ReparseTag;
349 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
350
351 typedef enum _FSINFOCLASS {
352     FileFsVolumeInformation = 1,
353     FileFsLabelInformation,
354     FileFsSizeInformation,
355     FileFsDeviceInformation,
356     FileFsAttributeInformation,
357     FileFsControlInformation,
358     FileFsFullSizeInformation,
359     FileFsObjectIdInformation,
360     FileFsMaximumInformation
361 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
362
363 typedef enum _KEY_INFORMATION_CLASS {
364     KeyBasicInformation,
365     KeyNodeInformation,
366     KeyFullInformation
367 } KEY_INFORMATION_CLASS;
368
369 typedef enum _KEY_VALUE_INFORMATION_CLASS {
370     KeyValueBasicInformation,
371     KeyValueFullInformation,
372     KeyValuePartialInformation,
373     KeyValueFullInformationAlign64,
374     KeyValuePartialInformationAlign64
375 } KEY_VALUE_INFORMATION_CLASS;
376
377 typedef enum _OBJECT_INFORMATION_CLASS {
378     ObjectBasicInformation,
379     ObjectNameInformation,
380     ObjectTypeInformation,
381     ObjectAllInformation,
382     ObjectDataInformation
383 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
384
385 typedef enum _PROCESSINFOCLASS {
386     ProcessBasicInformation = 0,
387     ProcessQuotaLimits = 1,
388     ProcessIoCounters = 2,
389     ProcessVmCounters = 3,
390     ProcessTimes = 4,
391     ProcessBasePriority = 5,
392     ProcessRaisePriority = 6,
393     ProcessDebugPort = 7,
394     ProcessExceptionPort = 8,
395     ProcessAccessToken = 9,
396     ProcessLdtInformation = 10,
397     ProcessLdtSize = 11,
398     ProcessDefaultHardErrorMode = 12,
399     ProcessIoPortHandlers = 13,
400     ProcessPooledUsageAndLimits = 14,
401     ProcessWorkingSetWatch = 15,
402     ProcessUserModeIOPL = 16,
403     ProcessEnableAlignmentFaultFixup = 17,
404     ProcessPriorityClass = 18,
405     ProcessWx86Information = 19,
406     ProcessHandleCount = 20,
407     ProcessAffinityMask = 21,
408     ProcessPriorityBoost = 22,
409     ProcessDeviceMap = 23,
410     ProcessSessionInformation = 24,
411     ProcessForegroundInformation = 25,
412     ProcessWow64Information = 26,
413     MaxProcessInfoClass
414 } PROCESSINFOCLASS;
415
416 typedef enum _SECTION_INHERIT {
417     ViewShare = 1,
418     ViewUnmap = 2
419 } SECTION_INHERIT;
420
421 typedef enum SYSTEM_INFORMATION_CLASS {
422     SystemBasicInformation = 0,
423     Unknown1,
424     SystemPerformanceInformation = 2,
425     SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
426     Unknown4,
427     SystemProcessInformation = 5,
428     Unknown6,
429     Unknown7,
430     SystemProcessorPerformanceInformation = 8,
431     Unknown9,
432     Unknown10,
433     SystemDriverInformation,
434     Unknown12,
435     Unknown13,
436     Unknown14,
437     Unknown15,
438     SystemHandleList,
439     Unknown17,
440     Unknown18,
441     Unknown19,
442     Unknown20,
443     SystemCacheInformation,
444     Unknown22,
445     SystemInterruptInformation = 23,
446     SystemExceptionInformation = 33,
447     SystemRegistryQuotaInformation = 37,
448     SystemLookasideInformation = 45
449 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
450
451 typedef enum _TIMER_TYPE {
452     NotificationTimer,
453     SynchronizationTimer
454 } TIMER_TYPE;
455
456 typedef enum _THREADINFOCLASS {
457     ThreadBasicInformation,
458     ThreadTimes,
459     ThreadPriority,
460     ThreadBasePriority,
461     ThreadAffinityMask,
462     ThreadImpersonationToken,
463     ThreadDescriptorTableEntry,
464     ThreadEnableAlignmentFaultFixup,
465     ThreadEventPair_Reusable,
466     ThreadQuerySetWin32StartAddress,
467     ThreadZeroTlsCell,
468     ThreadPerformanceCount,
469     ThreadAmILastThread,
470     ThreadIdealProcessor,
471     ThreadPriorityBoost,
472     ThreadSetTlsArrayAddress,
473     ThreadIsIoPending,
474     MaxThreadInfoClass
475 } THREADINFOCLASS;
476
477 typedef struct _THREAD_BASIC_INFORMATION
478 {
479     NTSTATUS  ExitStatus;
480     PVOID     TebBaseAddress;
481     CLIENT_ID ClientId;
482     ULONG     AffinityMask;
483     LONG      Priority;
484     LONG      BasePriority;
485 } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
486
487
488 typedef enum _WINSTATIONINFOCLASS {
489     WinStationInformation = 8
490 } WINSTATIONINFOCLASS;
491
492 typedef enum
493 {
494     MemoryBasicInformation = 0
495 } MEMORY_INFORMATION_CLASS;
496
497 /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
498 typedef enum
499 {
500     INVALID_PATH = 0,
501     UNC_PATH,              /* "//foo" */
502     ABSOLUTE_DRIVE_PATH,   /* "c:/foo" */
503     RELATIVE_DRIVE_PATH,   /* "c:foo" */
504     ABSOLUTE_PATH,         /* "/foo" */
505     RELATIVE_PATH,         /* "foo" */
506     DEVICE_PATH,           /* "//./foo" */
507     UNC_DOT_PATH           /* "//." */
508 } DOS_PATHNAME_TYPE;
509
510 /***********************************************************************
511  * IA64 specific types and data structures
512  */
513
514 #ifdef __ia64__
515
516 typedef struct _FRAME_POINTERS {
517   ULONGLONG MemoryStackFp;
518   ULONGLONG BackingStoreFp;
519 } FRAME_POINTERS, *PFRAME_POINTERS;
520
521 #define UNWIND_HISTORY_TABLE_SIZE 12
522
523 typedef struct _RUNTIME_FUNCTION {
524   ULONG BeginAddress;
525   ULONG EndAddress;
526   ULONG UnwindInfoAddress;
527 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
528
529 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
530   ULONG64 ImageBase;
531   ULONG64 Gp;
532   PRUNTIME_FUNCTION FunctionEntry;
533 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
534
535 typedef struct _UNWIND_HISTORY_TABLE {
536   ULONG Count;
537   UCHAR Search;
538   ULONG64 LowAddress;
539   ULONG64 HighAddress;
540   UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
541 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
542
543 #endif /* defined(__ia64__) */
544
545 /***********************************************************************
546  * Types and data structures
547  */
548
549 /* This is used by NtQuerySystemInformation */
550 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
551 typedef struct {
552     FILETIME    ftKernelTime;
553     FILETIME    ftUserTime;
554     FILETIME    ftCreateTime;
555     DWORD       dwTickCount;
556     DWORD       dwStartAddress;
557     DWORD       dwOwningPID;
558     DWORD       dwThreadID;
559     DWORD       dwCurrentPriority;
560     DWORD       dwBasePriority;
561     DWORD       dwContextSwitches;
562     DWORD       dwThreadState;
563     DWORD       dwWaitReason;
564 } THREADINFO, *PTHREADINFO;
565
566 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
567 typedef struct _THREAD_INFO{
568     DWORD Unknown1[6];
569     DWORD ThreadID;
570     DWORD Unknown2[3];
571     DWORD Status;
572     DWORD WaitReason;
573     DWORD Unknown3[4];
574 } THREAD_INFO, PTHREAD_INFO;
575
576 /***********************************************************************
577  * Types and data structures
578  */
579
580 typedef struct _IO_STATUS_BLOCK {
581   union {
582     NTSTATUS Status;
583     PVOID Pointer;
584   } DUMMYUNIONNAME;
585
586   ULONG_PTR Information;
587 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
588
589 typedef void (WINAPI * PIO_APC_ROUTINE)(PVOID,PIO_STATUS_BLOCK,ULONG);
590
591 typedef struct _KEY_BASIC_INFORMATION {
592     LARGE_INTEGER LastWriteTime;
593     ULONG         TitleIndex;
594     ULONG         NameLength;
595     WCHAR         Name[1];
596 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
597
598 typedef struct _KEY_NODE_INFORMATION
599 {
600     LARGE_INTEGER LastWriteTime;
601     ULONG         TitleIndex;
602     ULONG         ClassOffset;
603     ULONG         ClassLength;
604     ULONG         NameLength;
605     WCHAR         Name[1];
606    /* Class[1]; */
607 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
608
609 typedef struct _KEY_FULL_INFORMATION
610 {
611     LARGE_INTEGER LastWriteTime;
612     ULONG         TitleIndex;
613     ULONG         ClassOffset;
614     ULONG         ClassLength;
615     ULONG         SubKeys;
616     ULONG         MaxNameLen;
617     ULONG         MaxClassLen;
618     ULONG         Values;
619     ULONG         MaxValueNameLen;
620     ULONG         MaxValueDataLen;
621     WCHAR         Class[1];
622 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
623
624 typedef struct _KEY_VALUE_ENTRY
625 {
626     PUNICODE_STRING ValueName;
627     ULONG           DataLength;
628     ULONG           DataOffset;
629     ULONG           Type;
630 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
631
632 typedef struct _KEY_VALUE_BASIC_INFORMATION {
633     ULONG TitleIndex;
634     ULONG Type;
635     ULONG NameLength;
636     WCHAR Name[1];
637 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
638
639 typedef struct _KEY_VALUE_FULL_INFORMATION {
640     ULONG TitleIndex;
641     ULONG Type;
642     ULONG DataOffset;
643     ULONG DataLength;
644     ULONG NameLength;
645     WCHAR Name[1];
646 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
647
648 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
649     ULONG TitleIndex;
650     ULONG Type;
651     ULONG DataLength;
652     UCHAR Data[1];
653 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
654
655 typedef struct _OBJECT_ATTRIBUTES {
656   ULONG Length;
657   HANDLE RootDirectory;
658   PUNICODE_STRING ObjectName;
659   ULONG Attributes;
660   PVOID SecurityDescriptor;       /* type SECURITY_DESCRIPTOR */
661   PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
662 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
663
664 typedef struct _OBJECT_DATA_INFORMATION {
665     BOOLEAN InheritHandle;
666     BOOLEAN ProtectFromClose;
667 } OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION;
668
669 typedef struct _PROCESS_BASIC_INFORMATION {
670 #ifdef __WINESRC__
671     DWORD ExitStatus;
672     DWORD PebBaseAddress;
673     DWORD AffinityMask;
674     DWORD BasePriority;
675     ULONG UniqueProcessId;
676     ULONG InheritedFromUniqueProcessId;
677 #else
678     PVOID Reserved1;
679     PPEB PebBaseAddress;
680     PVOID Reserved2[2];
681     ULONG_PTR UniqueProcessId;
682     PVOID Reserved3;
683 #endif
684 } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
685
686 typedef struct _PROCESS_INFO {
687     DWORD    Offset;             /* 00 offset to next PROCESS_INFO ok*/
688     DWORD    ThreadCount;        /* 04 number of ThreadInfo member ok */
689     DWORD    Unknown1[6];
690     FILETIME CreationTime;       /* 20 */
691     DWORD    Unknown2[5];
692     PWCHAR   ProcessName;        /* 3c ok */
693     DWORD    BasePriority;
694     DWORD    ProcessID;          /* 44 ok*/
695     DWORD    ParentProcessID;
696     DWORD    HandleCount;
697     DWORD    Unknown3[2];        /* 50 */
698     ULONG    PeakVirtualSize;
699     ULONG    VirtualSize;
700     ULONG    PageFaultCount;
701     ULONG    PeakWorkingSetSize;
702     ULONG    WorkingSetSize;
703     ULONG    QuotaPeakPagedPoolUsage;
704     ULONG    QuotaPagedPoolUsage;
705     ULONG    QuotaPeakNonPagedPoolUsage;
706     ULONG    QuotaNonPagedPoolUsage;
707     ULONG    PagefileUsage;
708     ULONG    PeakPagefileUsage;
709     DWORD    PrivateBytes;
710     DWORD    Unknown6[4];
711     THREAD_INFO ati[ANYSIZE_ARRAY]; /* 94 size=0x40*/
712 } PROCESS_INFO, PPROCESS_INFO;
713
714 typedef struct _RTL_HEAP_DEFINITION {
715     ULONG Length; /* = sizeof(RTL_HEAP_DEFINITION) */
716
717     ULONG Unknown[11];
718 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
719
720 typedef struct _RTL_RWLOCK {
721     RTL_CRITICAL_SECTION rtlCS;
722
723     HANDLE hSharedReleaseSemaphore;
724     UINT   uSharedWaiters;
725
726     HANDLE hExclusiveReleaseSemaphore;
727     UINT   uExclusiveWaiters;
728
729     INT    iNumberActive;
730     HANDLE hOwningThreadId;
731     DWORD  dwTimeoutBoost;
732     PVOID  pDebugInfo;
733 } RTL_RWLOCK, *LPRTL_RWLOCK;
734
735 /* System Information Class 0x00 */
736 typedef struct _SYSTEM_BASIC_INFORMATION {
737 #ifdef __WINESRC__
738     DWORD dwUnknown1;
739     ULONG uKeMaximumIncrement;
740     ULONG uPageSize;
741     ULONG uMmNumberOfPhysicalPages;
742     ULONG uMmLowestPhysicalPage;
743     ULONG uMmHighestPhysicalPage;
744     ULONG uAllocationGranularity;
745     PVOID pLowestUserAddress;
746     PVOID pMmHighestUserAddress;
747     ULONG uKeActiveProcessors;
748     BYTE bKeNumberProcessors;
749     BYTE bUnknown2;
750     WORD wUnknown3;
751 #else
752     BYTE Reserved1[24];
753     PVOID Reserved2[4];
754     CCHAR NumberOfProcessors;
755 #endif
756 } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
757
758 /* System Information Class 0x15 */
759 typedef struct {
760     ULONG CurrentSize;
761     ULONG PeakSize;
762     ULONG PageFaultCount;
763     ULONG MinimumWorkingSet;
764     ULONG MaximumWorkingSet;
765     ULONG unused[4];
766 } SYSTEM_CACHE_INFORMATION;
767
768 typedef struct _SYSTEM_CONFIGURATION_INFO {
769     union {
770         ULONG   OemId;
771         struct {
772             WORD ProcessorArchitecture;
773             WORD Reserved;
774         } tag1;
775     } tag2;
776     ULONG PageSize;
777     PVOID MinimumApplicationAddress;
778     PVOID MaximumApplicationAddress;
779     ULONG ActiveProcessorMask;
780     ULONG NumberOfProcessors;
781     ULONG ProcessorType;
782     ULONG AllocationGranularity;
783     WORD  ProcessorLevel;
784     WORD  ProcessorRevision;
785 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
786
787 /* System Information Class 0x0b */
788 typedef struct {
789     PVOID pvAddress;
790     DWORD dwUnknown1;
791     DWORD dwUnknown2;
792     DWORD dwEntryIndex;
793     DWORD dwUnknown3;
794     char szName[MAX_PATH + 1];
795 } SYSTEM_DRIVER_INFORMATION;
796
797 typedef struct _SYSTEM_EXCEPTION_INFORMATION {
798     BYTE Reserved1[16];
799 } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
800
801 typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
802     BYTE Reserved1[32];
803 } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
804
805 typedef struct _SYSTEM_INTERRUPT_INFORMATION {
806     BYTE Reserved1[24];
807 } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
808
809 /* System Information Class 0x10 */
810 typedef struct {
811     USHORT dwPID;
812     USHORT dwCreatorBackTraceIndex;
813     BYTE bObjectType;
814     BYTE bHandleAttributes;
815     USHORT usHandleOffset;
816     DWORD dwKeObject;
817     ULONG ulGrantedAccess;
818 } HANDLEINFO, *PHANDLEINFO; /* FIXME: SYSTEM_HANDLE_INFORMATION? */
819
820 typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
821     BYTE Reserved1[312];
822 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
823
824 /* System Information Class 0x02 */
825 typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
826 #ifdef __WINESRC__
827     LARGE_INTEGER liIdleTime;
828     DWORD dwSpare[10];
829 #else
830     LARGE_INTEGER IdleTime;
831     LARGE_INTEGER KernelTime;
832     LARGE_INTEGER UserTime;
833     LARGE_INTEGER Reserved1[2];
834     ULONG Reserved2;
835 #endif
836 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
837
838 /* System Information Class 0x05 */
839 typedef struct _SYSTEM_PROCESS_INFORMATION {
840 #ifdef __WINESRC__
841     DWORD dwOffset;
842     DWORD dwThreadCount;
843     DWORD dwUnknown1[6];
844     FILETIME ftCreationTime;
845     DWORD dwUnknown2[5];
846     WCHAR *pszProcessName;
847     DWORD dwBasePriority;
848     DWORD dwProcessID;
849     DWORD dwParentProcessID;
850     DWORD dwHandleCount;
851     DWORD dwUnknown3;
852     DWORD dwUnknown4;
853     DWORD dwVirtualBytesPeak;
854     DWORD dwVirtualBytes;
855     DWORD dwPageFaults;
856     DWORD dwWorkingSetPeak;
857     DWORD dwWorkingSet;
858     DWORD dwUnknown5;
859     DWORD dwPagedPool;
860     DWORD dwUnknown6;
861     DWORD dwNonPagedPool;
862     DWORD dwPageFileBytesPeak;
863     DWORD dwPrivateBytes;
864     DWORD dwPageFileBytes;
865     DWORD dwUnknown7[4];
866     THREADINFO ti[1];
867 #else
868     ULONG NextEntryOffset;
869     BYTE Reserved1[52];
870     PVOID Reserved2[3];
871     HANDLE UniqueProcessId;
872     PVOID Reserved3;
873     ULONG HandleCount;
874     BYTE Reserved4[4];
875     PVOID Reserved5[11];
876     SIZE_T PeakPagefileUsage;
877     SIZE_T PrivatePageCount;
878     LARGE_INTEGER Reserved6[6];
879 #endif
880 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
881
882 typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
883     ULONG RegistryQuotaAllowed;
884     ULONG RegistryQuotaUsed;
885     PVOID Reserved1;
886 } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
887
888 typedef struct _SYSTEM_TIME_ADJUSTMENT {
889     ULONG   TimeAdjustment;
890     BOOLEAN TimeAdjustmentDisabled;
891 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
892
893 /* System Information Class 0x03 */
894 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
895 #ifdef __WINESRC__
896     LARGE_INTEGER liKeBootTime;
897     LARGE_INTEGER liKeSystemTime;
898     LARGE_INTEGER liExpTimeZoneBias;
899     ULONG uCurrentTimeZoneId;
900     DWORD dwReserved;
901 #else
902     BYTE Reserved1[48];
903 #endif
904 } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION; /* was SYSTEM_TIME_INFORMATION */
905
906 typedef struct _TIME_FIELDS
907 {   CSHORT Year;
908     CSHORT Month;
909     CSHORT Day;
910     CSHORT Hour;
911     CSHORT Minute;
912     CSHORT Second;
913     CSHORT Milliseconds;
914     CSHORT Weekday;
915 } TIME_FIELDS, *PTIME_FIELDS;
916
917 typedef struct _WINSTATIONINFORMATIONW {
918   BYTE Reserved2[70];
919   ULONG LogonId;
920   BYTE Reserved3[1140];
921 } WINSTATIONINFORMATIONW, *PWINSTATIONINFORMATIONW;
922
923 typedef struct _VM_COUNTERS_ {
924     ULONG PeakVirtualSize;
925     ULONG VirtualSize;
926     ULONG PageFaultCount;
927     ULONG PeakWorkingSetSize;
928     ULONG WorkingSetSize;
929     ULONG QuotaPeakPagedPoolUsage;
930     ULONG QuotaPagedPoolUsage;
931     ULONG QuotaPeakNonPagedPoolUsage;
932     ULONG QuotaNonPagedPoolUsage;
933     ULONG PagefileUsage;
934     ULONG PeakPagefileUsage;
935 } VM_COUNTERS, *PVM_COUNTERS;
936
937 typedef BOOLEAN (WINAPI * PWINSTATIONQUERYINFORMATIONW)(HANDLE,ULONG,WINSTATIONINFOCLASS,PVOID,ULONG,PULONG);
938
939 typedef struct _LDR_RESOURCE_INFO
940 {
941     ULONG Type;
942     ULONG Name;
943     ULONG Language;
944 } LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
945
946
947 /* debug buffer definitions */
948
949 typedef struct _DEBUG_BUFFER {
950   HANDLE SectionHandle;
951   PVOID  SectionBase;
952   PVOID  RemoteSectionBase;
953   ULONG  SectionBaseDelta;
954   HANDLE EventPairHandle;
955   ULONG  Unknown[2];
956   HANDLE RemoteThreadHandle;
957   ULONG  InfoClassMask;
958   ULONG  SizeOfInfo;
959   ULONG  AllocatedSize;
960   ULONG  SectionSize;
961   PVOID  ModuleInformation;
962   PVOID  BackTraceInformation;
963   PVOID  HeapInformation;
964   PVOID  LockInformation;
965   PVOID  Reserved[8];
966 } DEBUG_BUFFER, *PDEBUG_BUFFER;
967
968 #define PDI_MODULES                       0x01
969 #define PDI_BACKTRACE                     0x02
970 #define PDI_HEAPS                         0x04
971 #define PDI_HEAP_TAGS                     0x08
972 #define PDI_HEAP_BLOCKS                   0x10
973 #define PDI_LOCKS                         0x20
974
975 typedef struct _DEBUG_MODULE_INFORMATION {
976   ULONG  Reserved[2];
977   ULONG  Base;
978   ULONG  Size;
979   ULONG  Flags;
980   USHORT Index;
981   USHORT Unknown;
982   USHORT LoadCount;
983   USHORT ModuleNameOffset;
984   CHAR   ImageName[256];
985 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
986
987 typedef struct _DEBUG_HEAP_INFORMATION {
988   ULONG  Base;
989   ULONG  Flags;
990   USHORT Granularity;
991   USHORT Unknown;
992   ULONG  Allocated;
993   ULONG  Committed;
994   ULONG  TagCount;
995   ULONG  BlockCount;
996   ULONG  Reserved[7];
997   PVOID  Tags;
998   PVOID  Blocks;
999 } DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
1000
1001 typedef struct _DEBUG_LOCK_INFORMATION {
1002   PVOID  Address;
1003   USHORT Type;
1004   USHORT CreatorBackTraceIndex;
1005   ULONG  OwnerThreadId;
1006   ULONG  ActiveCount;
1007   ULONG  ContentionCount;
1008   ULONG  EntryCount;
1009   ULONG  RecursionCount;
1010   ULONG  NumberOfSharedWaiters;
1011   ULONG  NumberOfExclusiveWaiters;
1012 } DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
1013
1014
1015 /***********************************************************************
1016  * Defines
1017  */
1018
1019 /* flags for NtCreateFile and NtOpenFile */
1020 #define FILE_DIRECTORY_FILE             0x00000001
1021 #define FILE_WRITE_THROUGH              0x00000002
1022 #define FILE_SEQUENTIAL_ONLY            0x00000004
1023 #define FILE_NO_INTERMEDIATE_BUFFERING  0x00000008
1024 #define FILE_SYNCHRONOUS_IO_ALERT       0x00000010
1025 #define FILE_SYNCHRONOUS_IO_NONALERT    0x00000020
1026 #define FILE_NON_DIRECTORY_FILE         0x00000040
1027 #define FILE_CREATE_TREE_CONNECTION     0x00000080
1028 #define FILE_COMPLETE_IF_OPLOCKED       0x00000100
1029 #define FILE_NO_EA_KNOWLEDGE            0x00000200
1030 #define FILE_OPEN_FOR_RECOVERY          0x00000400
1031 #define FILE_RANDOM_ACCESS              0x00000800
1032 #define FILE_DELETE_ON_CLOSE            0x00001000
1033 #define FILE_OPEN_BY_FILE_ID            0x00002000
1034 #define FILE_OPEN_FOR_BACKUP_INTENT     0x00004000
1035 #define FILE_NO_COMPRESSION             0x00008000
1036 #define FILE_RESERVE_OPFILTER           0x00100000
1037 #define FILE_TRANSACTED_MODE            0x00200000
1038 #define FILE_OPEN_OFFLINE_FILE          0x00400000
1039
1040 #define FILE_ATTRIBUTE_VALID_FLAGS      0x00007fb7
1041 #define FILE_ATTRIBUTE_VALID_SET_FLAGS  0x000031a7
1042
1043 /* status for NtCreateFile or NtOpenFile */
1044 #define FILE_SUPERSEDED                 0
1045 #define FILE_OPENED                     1
1046 #define FILE_CREATED                    2
1047 #define FILE_OVERWRITTEN                3
1048 #define FILE_EXISTS                     4
1049 #define FILE_DOES_NOT_EXIST             5
1050
1051 /* disposition for NtCreateFile */
1052 #define FILE_SUPERSEDE                  0
1053 #define FILE_OPEN                       1
1054 #define FILE_CREATE                     2
1055 #define FILE_OPEN_IF                    3
1056 #define FILE_OVERWRITE                  4
1057 #define FILE_OVERWRITE_IF               5
1058 #define FILE_MAXIMUM_DISPOSITION        5
1059
1060 /* Characteristics of a File System */
1061 #define FILE_REMOVABLE_MEDIA            0x00000001
1062 #define FILE_READ_ONLY_DEVICE           0x00000002
1063 #define FILE_FLOPPY_DISKETTE            0x00000004
1064 #define FILE_WRITE_ONE_MEDIA            0x00000008
1065 #define FILE_REMOTE_DEVICE              0x00000010
1066 #define FILE_DEVICE_IS_MOUNTED          0x00000020
1067 #define FILE_VIRTUAL_VOLUME             0x00000040
1068
1069 #if (_WIN32_WINNT >= 0x0501)
1070 #define INTERNAL_TS_ACTIVE_CONSOLE_ID ( *((volatile ULONG*)(0x7ffe02d8)) )
1071 #endif /* (_WIN32_WINNT >= 0x0501) */
1072
1073 #define LOGONID_CURRENT    ((ULONG)-1)
1074
1075 #define OBJ_INHERIT          0x00000002L
1076 #define OBJ_PERMANENT        0x00000010L
1077 #define OBJ_EXCLUSIVE        0x00000020L
1078 #define OBJ_CASE_INSENSITIVE 0x00000040L
1079 #define OBJ_OPENIF           0x00000080L
1080 #define OBJ_OPENLINK         0x00000100L
1081 #define OBJ_KERNEL_HANDLE    0x00000200L
1082 #define OBJ_VALID_ATTRIBUTES 0x000003F2L
1083
1084 #define SERVERNAME_CURRENT ((HANDLE)NULL)
1085
1086 typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR); /* FIXME: not the right name */
1087 typedef void (CALLBACK *PRTL_THREAD_START_ROUTINE)(LPVOID); /* FIXME: not the right name */
1088
1089 /***********************************************************************
1090  * Function declarations
1091  */
1092
1093 extern LPSTR _strlwr(LPSTR str); /* FIXME: Doesn't belong here */
1094 extern LPSTR _strupr(LPSTR str); /* FIXME: Doesn't belong here */
1095
1096 #if defined(__i386__) && defined(__GNUC__)
1097 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
1098 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
1099 #else  /* __i386__ && __GNUC__ */
1100 void WINAPI DbgBreakPoint(void);
1101 void WINAPI DbgUserBreakPoint(void);
1102 #endif  /* __i386__ && __GNUC__ */
1103 void WINAPIV DbgPrint(LPCSTR fmt, ...);
1104
1105 NTSTATUS  WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void**,PULONG);
1106 NTSTATUS  WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);
1107 NTSTATUS  WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
1108 NTSTATUS  WINAPI LdrGetDllHandle(ULONG, ULONG, const UNICODE_STRING*, HMODULE*);
1109 NTSTATUS  WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
1110 void      WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG);
1111 NTSTATUS  WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
1112 void      WINAPI LdrShutdownProcess(void);
1113 void      WINAPI LdrShutdownThread(void);
1114 NTSTATUS  WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,PBOOLEAN);
1115 NTSTATUS  WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
1116 NTSTATUS  WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,PVOID,ULONG*,ULONG,ULONG);
1117 NTSTATUS  WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
1118 NTSTATUS  WINAPI NtClearEvent(HANDLE);
1119 NTSTATUS  WINAPI NtClose(HANDLE);
1120 NTSTATUS  WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1121 NTSTATUS  WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1122 NTSTATUS  WINAPI NtCreateKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1123 NTSTATUS  WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1124 NTSTATUS  WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,ULONG);
1125 NTSTATUS  WINAPI NtCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1126 NTSTATUS  WINAPI NtDelayExecution(BOOLEAN,const LARGE_INTEGER*);
1127 NTSTATUS  WINAPI NtDeleteKey(HKEY);
1128 NTSTATUS  WINAPI NtDeleteValueKey(HKEY,const UNICODE_STRING *);
1129 NTSTATUS  WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1130 NTSTATUS  WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1131 NTSTATUS  WINAPI NtEnumerateKey(HKEY,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1132 NTSTATUS  WINAPI NtEnumerateValueKey(HKEY,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1133 NTSTATUS  WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
1134 NTSTATUS  WINAPI NtFlushKey(HKEY);
1135 NTSTATUS  WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,ULONG*,ULONG);
1136 NTSTATUS  WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1137 NTSTATUS  WINAPI NtGetContextThread(HANDLE,CONTEXT*);
1138 NTSTATUS  WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,const OBJECT_ATTRIBUTES *);
1139 NTSTATUS  WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
1140 NTSTATUS  WINAPI NtLockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1141 NTSTATUS  WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,ULONG,const LARGE_INTEGER*,ULONG*,SECTION_INHERIT,ULONG,ULONG);
1142 NTSTATUS  WINAPI NtNotifyChangeKey(HKEY,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1143 NTSTATUS  WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1144 NTSTATUS  WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1145 NTSTATUS  WINAPI NtOpenKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1146 NTSTATUS  WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
1147 NTSTATUS  WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1148 NTSTATUS  WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1149 NTSTATUS  WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1150 NTSTATUS  WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1151 NTSTATUS  WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG,ULONG*);
1152 NTSTATUS  WINAPI NtPulseEvent(HANDLE,PULONG);
1153 NTSTATUS  WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
1154 NTSTATUS  WINAPI NtQueryDefaultLocale(BOOLEAN,LCID*);
1155 NTSTATUS  WINAPI NtQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
1156 NTSTATUS  WINAPI NtQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1157 NTSTATUS  WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
1158 NTSTATUS  WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
1159 NTSTATUS  WINAPI NtQueryInformationToken(HANDLE,DWORD,LPVOID,DWORD,LPDWORD);
1160 NTSTATUS  WINAPI NtQueryKey(HKEY,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1161 NTSTATUS  WINAPI NtQueryMultipleValueKey(HKEY,PVALENTW,ULONG,PVOID,ULONG,PULONG);
1162 NTSTATUS  WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
1163 NTSTATUS  WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
1164 NTSTATUS  WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1165 NTSTATUS  WINAPI NtQuerySystemTime(PLARGE_INTEGER);
1166 NTSTATUS  WINAPI NtQueryValueKey(HKEY,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
1167 NTSTATUS  WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
1168 void      WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
1169 NTSTATUS  WINAPI NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
1170 NTSTATUS  WINAPI NtReadVirtualMemory(HANDLE,const void*,void*,SIZE_T,SIZE_T*);
1171 NTSTATUS  WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
1172 NTSTATUS  WINAPI NtReplaceKey(POBJECT_ATTRIBUTES,HKEY,POBJECT_ATTRIBUTES);
1173 NTSTATUS  WINAPI NtResetEvent(HANDLE,PULONG);
1174 NTSTATUS  WINAPI NtRestoreKey(HKEY,HANDLE,ULONG);
1175 NTSTATUS  WINAPI NtResumeThread(HANDLE,PULONG);
1176 NTSTATUS  WINAPI NtSaveKey(HKEY,HANDLE);
1177 NTSTATUS  WINAPI NtSetContextThread(HANDLE,const CONTEXT*);
1178 NTSTATUS  WINAPI NtSetDefaultLocale(BOOLEAN,LCID);
1179 NTSTATUS  WINAPI NtSetEvent(HANDLE,PULONG);
1180 NTSTATUS  WINAPI NtSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
1181 NTSTATUS  WINAPI NtSetInformationKey(HKEY,const int,PVOID,ULONG);
1182 NTSTATUS  WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
1183 NTSTATUS  WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
1184 NTSTATUS  WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1185 NTSTATUS  WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
1186 NTSTATUS  WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMERAPCROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
1187 NTSTATUS  WINAPI NtSetValueKey(HKEY,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
1188 NTSTATUS  WINAPI NtSuspendThread(HANDLE,PULONG);
1189 NTSTATUS  WINAPI NtTerminateProcess(HANDLE,LONG);
1190 NTSTATUS  WINAPI NtTerminateThread(HANDLE,LONG);
1191 NTSTATUS  WINAPI NtUnloadKey(HKEY);
1192 NTSTATUS  WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG);
1193 NTSTATUS  WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1194 NTSTATUS  WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
1195 NTSTATUS  WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
1196 NTSTATUS  WINAPI NtWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
1197 NTSTATUS  WINAPI NtWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
1198 NTSTATUS  WINAPI NtWriteVirtualMemory(HANDLE,void*,const void*,SIZE_T,SIZE_T*);
1199
1200 void      WINAPI RtlAcquirePebLock(void);
1201 BYTE      WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK,BYTE);
1202 BYTE      WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK,BYTE);
1203 NTSTATUS  WINAPI RtlAddAce(PACL,DWORD,DWORD,PACE_HEADER,DWORD);
1204 NTSTATUS  WINAPI RtlAddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
1205 NTSTATUS  WINAPI RtlAddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1206 NTSTATUS  WINAPI RtlAddAccessDeniedAce(PACL,DWORD,DWORD,PSID);
1207 NTSTATUS  WINAPI RtlAddAccessDeniedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1208 PVOID     WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER);
1209 DWORD     WINAPI RtlAdjustPrivilege(DWORD,DWORD,DWORD,DWORD);
1210 BOOLEAN   WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
1211 PVOID     WINAPI RtlAllocateHeap(HANDLE,ULONG,ULONG);
1212 DWORD     WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
1213 NTSTATUS  WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
1214 NTSTATUS  WINAPI RtlAppendAsciizToString(STRING *,LPCSTR);
1215 NTSTATUS  WINAPI RtlAppendStringToString(STRING *,const STRING *);
1216 NTSTATUS  WINAPI RtlAppendUnicodeStringToString(UNICODE_STRING *,const UNICODE_STRING *);
1217 NTSTATUS  WINAPI RtlAppendUnicodeToString(UNICODE_STRING *,LPCWSTR);
1218 BOOLEAN   WINAPI RtlAreAllAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1219 BOOLEAN   WINAPI RtlAreAnyAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1220 BOOLEAN   WINAPI RtlAreBitsSet(PCRTL_BITMAP,ULONG,ULONG);
1221 BOOLEAN   WINAPI RtlAreBitsClear(PCRTL_BITMAP,ULONG,ULONG);
1222
1223 NTSTATUS  WINAPI RtlCharToInteger(PCSZ,ULONG,PULONG);
1224 void      WINAPI RtlClearAllBits(PRTL_BITMAP);
1225 void      WINAPI RtlClearBits(PRTL_BITMAP,ULONG,ULONG);
1226 ULONG     WINAPI RtlCompactHeap(HANDLE,ULONG);
1227 LONG      WINAPI RtlCompareString(const STRING*,const STRING*,BOOLEAN);
1228 LONG      WINAPI RtlCompareUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1229 DWORD     WINAPI RtlComputeCrc32(DWORD,PBYTE,INT);
1230 NTSTATUS  WINAPI RtlConvertSidToUnicodeString(PUNICODE_STRING,PSID,BOOLEAN);
1231 LONGLONG  WINAPI RtlConvertLongToLargeInteger(LONG);
1232 ULONGLONG WINAPI RtlConvertUlongToLargeInteger(ULONG);
1233 void      WINAPI RtlCopyLuid(PLUID,const LUID*);
1234 void      WINAPI RtlCopyLuidAndAttributesArray(ULONG,const LUID_AND_ATTRIBUTES*,PLUID_AND_ATTRIBUTES);
1235 DWORD     WINAPI RtlCopySid(DWORD,PSID,PSID);
1236 void      WINAPI RtlCopyString(STRING*,const STRING*);
1237 void      WINAPI RtlCopyUnicodeString(UNICODE_STRING*,const UNICODE_STRING*);
1238 NTSTATUS  WINAPI RtlCreateAcl(PACL,DWORD,DWORD);
1239 NTSTATUS  WINAPI RtlCreateEnvironment(BOOLEAN, PWSTR*);
1240 HANDLE    WINAPI RtlCreateHeap(ULONG,PVOID,ULONG,ULONG,PVOID,PRTL_HEAP_DEFINITION);
1241 NTSTATUS  WINAPI RtlCreateProcessParameters(RTL_USER_PROCESS_PARAMETERS**,const UNICODE_STRING*,
1242                                             const UNICODE_STRING*,const UNICODE_STRING*,
1243                                             const UNICODE_STRING*,PWSTR,const UNICODE_STRING*,
1244                                             const UNICODE_STRING*,const UNICODE_STRING*,
1245                                             const UNICODE_STRING*);
1246 NTSTATUS  WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
1247 BOOLEAN   WINAPI RtlCreateUnicodeString(PUNICODE_STRING,LPCWSTR);
1248 BOOLEAN   WINAPI RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING,LPCSTR);
1249 NTSTATUS  WINAPI RtlCreateUserThread(HANDLE,const SECURITY_DESCRIPTOR*,BOOLEAN,PVOID,SIZE_T,SIZE_T,PRTL_THREAD_START_ROUTINE,void*,HANDLE*,CLIENT_ID*);
1250
1251 NTSTATUS  WINAPI RtlDeleteAce(PACL,DWORD);
1252 NTSTATUS  WINAPI RtlDeleteCriticalSection(RTL_CRITICAL_SECTION *);
1253 void      WINAPI RtlDeleteResource(LPRTL_RWLOCK);
1254 DWORD     WINAPI RtlDeleteSecurityObject(DWORD);
1255 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlDeNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
1256 NTSTATUS  WINAPI RtlDestroyEnvironment(PWSTR);
1257 HANDLE    WINAPI RtlDestroyHeap(HANDLE);
1258 void      WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*);
1259 DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR);
1260 BOOLEAN   WINAPI RtlDoesFileExists_U(LPCWSTR);
1261 BOOLEAN   WINAPI RtlDosPathNameToNtPathName_U(PCWSTR,PUNICODE_STRING,PWSTR*,CURDIR*);
1262 ULONG     WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*);
1263 WCHAR     WINAPI RtlDowncaseUnicodeChar(WCHAR);
1264 NTSTATUS  WINAPI RtlDowncaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1265 void      WINAPI RtlDumpResource(LPRTL_RWLOCK);
1266 NTSTATUS  WINAPI RtlDuplicateUnicodeString(int,const UNICODE_STRING*,UNICODE_STRING*);
1267
1268 LONGLONG  WINAPI RtlEnlargedIntegerMultiply(INT,INT);
1269 ULONGLONG WINAPI RtlEnlargedUnsignedMultiply(UINT,UINT);
1270 UINT      WINAPI RtlEnlargedUnsignedDivide(ULONGLONG,UINT,UINT *);
1271 NTSTATUS  WINAPI RtlEnterCriticalSection(RTL_CRITICAL_SECTION *);
1272 void      WINAPI RtlEraseUnicodeString(UNICODE_STRING*);
1273 NTSTATUS  WINAPI RtlEqualComputerName(const UNICODE_STRING*,const UNICODE_STRING*);
1274 NTSTATUS  WINAPI RtlEqualDomainName(const UNICODE_STRING*,const UNICODE_STRING*);
1275 BOOLEAN   WINAPI RtlEqualLuid(const LUID*,const LUID*);
1276 BOOL      WINAPI RtlEqualPrefixSid(PSID,PSID);
1277 BOOL      WINAPI RtlEqualSid(PSID,PSID);
1278 BOOLEAN   WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN);
1279 BOOLEAN   WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1280 NTSTATUS  WINAPI RtlExpandEnvironmentStrings_U(PWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*);
1281 LONGLONG  WINAPI RtlExtendedMagicDivide(LONGLONG,LONGLONG,INT);
1282 LONGLONG  WINAPI RtlExtendedIntegerMultiply(LONGLONG,INT);
1283 LONGLONG  WINAPI RtlExtendedLargeIntegerDivide(LONGLONG,INT,INT *);
1284
1285 NTSTATUS  WINAPI RtlFindCharInUnicodeString(int,const UNICODE_STRING*,const UNICODE_STRING*,USHORT*);
1286 ULONG     WINAPI RtlFindClearBits(PCRTL_BITMAP,ULONG,ULONG);
1287 ULONG     WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP,ULONG,ULONG);
1288 ULONG     WINAPI RtlFindClearRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
1289 ULONG     WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
1290 ULONG     WINAPI RtlFindLastBackwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
1291 CCHAR     WINAPI RtlFindLeastSignificantBit(ULONGLONG);
1292 ULONG     WINAPI RtlFindLongestRunSet(PCRTL_BITMAP,PULONG);
1293 ULONG     WINAPI RtlFindLongestRunClear(PCRTL_BITMAP,PULONG);
1294 NTSTATUS  WINAPI RtlFindMessage(HMODULE,ULONG,ULONG,ULONG,const MESSAGE_RESOURCE_ENTRY**);
1295 CCHAR     WINAPI RtlFindMostSignificantBit(ULONGLONG);
1296 ULONG     WINAPI RtlFindNextForwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
1297 ULONG     WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
1298 ULONG     WINAPI RtlFindSetBits(PCRTL_BITMAP,ULONG,ULONG);
1299 ULONG     WINAPI RtlFindSetBitsAndClear(PRTL_BITMAP,ULONG,ULONG);
1300 ULONG     WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
1301 BOOLEAN   WINAPI RtlFirstFreeAce(PACL,PACE_HEADER *);
1302 NTSTATUS  WINAPI RtlFormatCurrentUserKeyPath(PUNICODE_STRING);
1303 void      WINAPI RtlFreeAnsiString(PANSI_STRING);
1304 BOOLEAN   WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
1305 void      WINAPI RtlFreeOemString(POEM_STRING);
1306 DWORD     WINAPI RtlFreeSid(PSID);
1307 void      WINAPI RtlFreeUnicodeString(PUNICODE_STRING);
1308
1309 DWORD     WINAPI RtlGetAce(PACL,DWORD,LPVOID *);
1310 NTSTATUS  WINAPI RtlGetControlSecurityDescriptor(PSECURITY_DESCRIPTOR, PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
1311 NTSTATUS  WINAPI RtlGetCurrentDirectory_U(ULONG, LPWSTR);
1312 NTSTATUS  WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
1313 ULONG     WINAPI RtlGetFullPathName_U(PCWSTR,ULONG,PWSTR,PWSTR*);
1314 NTSTATUS  WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
1315 DWORD     WINAPI RtlGetLastWin32Error(void);
1316 DWORD     WINAPI RtlGetLongestNtPathLength(void);
1317 BOOLEAN   WINAPI RtlGetNtProductType(LPDWORD);
1318 NTSTATUS  WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
1319 ULONG     WINAPI RtlGetProcessHeaps(ULONG,HANDLE*);
1320 NTSTATUS  WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
1321 NTSTATUS  WINAPI RtlGetVersion(RTL_OSVERSIONINFOEXW*);
1322
1323 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(PSID);
1324 PVOID     WINAPI RtlImageDirectoryEntryToData(HMODULE,BOOL,WORD,ULONG *);
1325 PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE);
1326 PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection(const IMAGE_NT_HEADERS *,HMODULE,DWORD);
1327 PVOID     WINAPI RtlImageRvaToVa(const IMAGE_NT_HEADERS *,HMODULE,DWORD,IMAGE_SECTION_HEADER **);
1328 BOOL      WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
1329 void      WINAPI RtlInitString(PSTRING,PCSZ);
1330 void      WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
1331 void      WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
1332 NTSTATUS  WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
1333 NTSTATUS  WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *);
1334 NTSTATUS  WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,DWORD);
1335 void      WINAPI RtlInitializeBitMap(PRTL_BITMAP,LPBYTE,ULONG);
1336 void      WINAPI RtlInitializeResource(LPRTL_RWLOCK);
1337 BOOL      WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
1338
1339 NTSTATUS  WINAPI RtlInt64ToUnicodeString(ULONGLONG,ULONG,UNICODE_STRING *);
1340 NTSTATUS  WINAPI RtlIntegerToChar(ULONG,ULONG,ULONG,PCHAR);
1341 NTSTATUS  WINAPI RtlIntegerToUnicodeString(ULONG,ULONG,UNICODE_STRING *);
1342 ULONG     WINAPI RtlIsDosDeviceName_U(PCWSTR);
1343 BOOLEAN   WINAPI RtlIsNameLegalDOS8Dot3(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
1344 DWORD     WINAPI RtlIsTextUnicode(LPVOID,DWORD,DWORD *);
1345
1346 LONGLONG  WINAPI RtlLargeIntegerAdd(LONGLONG,LONGLONG);
1347 LONGLONG  WINAPI RtlLargeIntegerArithmeticShift(LONGLONG,INT);
1348 ULONGLONG WINAPI RtlLargeIntegerDivide( ULONGLONG,ULONGLONG,ULONGLONG *);
1349 LONGLONG  WINAPI RtlLargeIntegerNegate(LONGLONG);
1350 LONGLONG  WINAPI RtlLargeIntegerShiftLeft(LONGLONG,INT);
1351 LONGLONG  WINAPI RtlLargeIntegerShiftRight(LONGLONG,INT);
1352 LONGLONG  WINAPI RtlLargeIntegerSubtract(LONGLONG,LONGLONG);
1353 NTSTATUS  WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PCHAR);
1354 NTSTATUS  WINAPI RtlLeaveCriticalSection(RTL_CRITICAL_SECTION *);
1355 DWORD     WINAPI RtlLengthRequiredSid(DWORD);
1356 ULONG     WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR);
1357 DWORD     WINAPI RtlLengthSid(PSID);
1358 NTSTATUS  WINAPI RtlLocalTimeToSystemTime(const LARGE_INTEGER*,PLARGE_INTEGER);
1359 BOOLEAN   WINAPI RtlLockHeap(HANDLE);
1360
1361 NTSTATUS  WINAPI RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
1362 void      WINAPI RtlMapGenericMask(PACCESS_MASK,const GENERIC_MAPPING*);
1363 NTSTATUS  WINAPI RtlMultiByteToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
1364 NTSTATUS  WINAPI RtlMultiByteToUnicodeSize(DWORD*,LPCSTR,UINT);
1365
1366 DWORD     WINAPI RtlNewSecurityObject(DWORD,DWORD,DWORD,DWORD,DWORD,DWORD);
1367 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
1368 ULONG     WINAPI RtlNtStatusToDosError(NTSTATUS);
1369 ULONG     WINAPI RtlNtStatusToDosErrorNoTeb(NTSTATUS);
1370 ULONG     WINAPI RtlNumberOfSetBits(PCRTL_BITMAP);
1371 ULONG     WINAPI RtlNumberOfClearBits(PCRTL_BITMAP);
1372
1373 UINT      WINAPI RtlOemStringToUnicodeSize(const STRING*);
1374 NTSTATUS  WINAPI RtlOemStringToUnicodeString(UNICODE_STRING*,const STRING*,BOOLEAN);
1375 NTSTATUS  WINAPI RtlOemToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
1376 DWORD     WINAPI RtlOpenCurrentUser(ACCESS_MASK,PHKEY);
1377
1378 BOOLEAN   WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
1379 BOOLEAN   WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1380
1381 NTSTATUS  WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
1382 NTSTATUS  WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
1383 NTSTATUS  WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION);
1384
1385 void      WINAPI RtlRaiseException(PEXCEPTION_RECORD);
1386 void      WINAPI RtlRaiseStatus(NTSTATUS);
1387 ULONG     WINAPI RtlRandom(PULONG);
1388 PVOID     WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,ULONG);
1389 void      WINAPI RtlReleasePebLock(void);
1390 void      WINAPI RtlReleaseResource(LPRTL_RWLOCK);
1391 ULONG     WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
1392 void      WINAPI RtlRestoreLastWin32Error(DWORD);
1393
1394 void      WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *);
1395 void      WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);
1396 NTSTATUS  WINAPI RtlSelfRelativeToAbsoluteSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,
1397                                              PDWORD,PACL,PDWORD,PACL,PDWORD,PSID,PDWORD,PSID,PDWORD);
1398 void      WINAPI RtlSetAllBits(PRTL_BITMAP);
1399 void      WINAPI RtlSetBits(PRTL_BITMAP,ULONG,ULONG);
1400 NTSTATUS  WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING*);
1401 void      WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR*);
1402 NTSTATUS  WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
1403 NTSTATUS  WINAPI RtlSetEnvironmentVariable(PWSTR*,PUNICODE_STRING,PUNICODE_STRING);
1404 NTSTATUS  WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
1405 NTSTATUS  WINAPI RtlSetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
1406 void      WINAPI RtlSetLastWin32Error(DWORD);
1407 NTSTATUS  WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
1408 NTSTATUS  WINAPI RtlSetTimeZoneInformation(const TIME_ZONE_INFORMATION*);
1409 ULONG     WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
1410 LPDWORD   WINAPI RtlSubAuthoritySid(PSID,DWORD);
1411 LPBYTE    WINAPI RtlSubAuthorityCountSid(PSID);
1412 NTSTATUS  WINAPI RtlSystemTimeToLocalTime(const LARGE_INTEGER*,PLARGE_INTEGER);
1413
1414 void      WINAPI RtlTimeToTimeFields(const LARGE_INTEGER*,PTIME_FIELDS);
1415 BOOLEAN   WINAPI RtlTimeFieldsToTime(PTIME_FIELDS,PLARGE_INTEGER);
1416 void      WINAPI RtlTimeToElapsedTimeFields(const LARGE_INTEGER *,PTIME_FIELDS);
1417 BOOLEAN   WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *,LPDWORD);
1418 BOOLEAN   WINAPI RtlTimeToSecondsSince1980(const LARGE_INTEGER *,LPDWORD);
1419 BOOL      WINAPI RtlTryEnterCriticalSection(RTL_CRITICAL_SECTION *);
1420
1421 ULONGLONG __cdecl RtlUlonglongByteSwap(ULONGLONG);
1422 DWORD     WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING*);
1423 NTSTATUS  WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING,PCUNICODE_STRING,BOOLEAN);
1424 NTSTATUS  WINAPI RtlUnicodeStringToInteger(const UNICODE_STRING *,ULONG,ULONG *);
1425 DWORD     WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING*);
1426 NTSTATUS  WINAPI RtlUnicodeStringToOemString(POEM_STRING,PCUNICODE_STRING,BOOLEAN);
1427 NTSTATUS  WINAPI RtlUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1428 NTSTATUS  WINAPI RtlUnicodeToMultiByteSize(PULONG,PCWSTR,ULONG);
1429 NTSTATUS  WINAPI RtlUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1430 ULONG     WINAPI RtlUniform(PULONG);
1431 BOOLEAN   WINAPI RtlUnlockHeap(HANDLE);
1432 void      WINAPI RtlUnwind(PVOID,PVOID,PEXCEPTION_RECORD,PVOID);
1433 #ifdef __ia64__
1434 void      WINAPI RtlUnwind2(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT);
1435 void      WINAPI RtlUnwindEx(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT,PUNWIND_HISTORY_TABLE);
1436 #endif
1437 WCHAR     WINAPI RtlUpcaseUnicodeChar(WCHAR);
1438 NTSTATUS  WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING *,BOOLEAN);
1439 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToAnsiString(STRING*,const UNICODE_STRING*,BOOLEAN);
1440 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToCountedOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
1441 NTSTATUS  WINAPI RtlUpcaseUnicodeStringToOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
1442 NTSTATUS  WINAPI RtlUpcaseUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1443 NTSTATUS  WINAPI RtlUpcaseUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1444 CHAR      WINAPI RtlUpperChar(CHAR);
1445 void      WINAPI RtlUpperString(STRING *,const STRING *);
1446
1447 NTSTATUS  WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
1448 BOOLEAN   WINAPI RtlValidAcl(PACL);
1449 BOOLEAN   WINAPI RtlValidSid(PSID);
1450 BOOLEAN   WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
1451 NTSTATUS  WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
1452
1453 NTSTATUS  WINAPI RtlWalkHeap(HANDLE,PVOID);
1454
1455 NTSTATUS  WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);
1456 NTSTATUS  WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
1457
1458 /***********************************************************************
1459  * Inline functions
1460  */
1461
1462 #define InitializeObjectAttributes(p,n,a,r,s) \
1463     do { \
1464         (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
1465         (p)->RootDirectory = r; \
1466         (p)->Attributes = a; \
1467         (p)->ObjectName = n; \
1468         (p)->SecurityDescriptor = s; \
1469         (p)->SecurityQualityOfService = NULL; \
1470     } while (0)
1471
1472 #define NtCurrentProcess() ((HANDLE)-1)
1473
1474 #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
1475 #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
1476 #define RtlStoreUlong(p,v)  do { ULONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1477 #define RtlStoreUlonglong(p,v) do { ULONGLONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1478 #define RtlRetrieveUlong(p,s) memcpy((p), (s), sizeof(ULONG))
1479 #define RtlRetrieveUlonglong(p,s) memcpy((p), (s), sizeof(ULONGLONG))
1480 #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
1481
1482 inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
1483 {
1484     if (lpBits && ulBit < lpBits->SizeOfBitMap &&
1485         lpBits->BitMapBuffer[ulBit >> 3] & (1 << (ulBit & 7)))
1486         return TRUE;
1487     return FALSE;
1488 }
1489
1490 #define RtlClearAllBits(p) \
1491     do { \
1492         PRTL_BITMAP _p = (p); \
1493         memset(_p->BitMapBuffer,0,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1494     } while (0)
1495
1496 #define RtlInitializeBitMap(p,b,s) \
1497     do { \
1498         PRTL_BITMAP _p = (p); \
1499         _p->SizeOfBitMap = (s); \
1500         _p->BitMapBuffer = (b); \
1501     } while (0)
1502
1503 #define RtlSetAllBits(p) \
1504     do { \
1505         PRTL_BITMAP _p = (p); \
1506         memset(_p->BitMapBuffer,0xff,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1507     } while (0)
1508
1509 /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
1510 inline static USHORT RtlUshortByteSwap(USHORT s)
1511 {
1512     return (s >> 8) | (s << 8);
1513 }
1514 inline static ULONG RtlUlongByteSwap(ULONG i)
1515 {
1516 #if defined(__i386__) && defined(__GNUC__)
1517     ULONG ret;
1518     __asm__("bswap %0" : "=r" (ret) : "0" (i) );
1519     return ret;
1520 #else
1521     return ((ULONG)RtlUshortByteSwap((USHORT)i) << 16) | RtlUshortByteSwap((USHORT)(i >> 16));
1522 #endif
1523 }
1524
1525 /*************************************************************************
1526  * Loader functions and structures.
1527  *
1528  * Those are not part of standard Winternl.h
1529  */
1530 typedef struct _LDR_MODULE
1531 {
1532     LIST_ENTRY          InLoadOrderModuleList;
1533     LIST_ENTRY          InMemoryOrderModuleList;
1534     LIST_ENTRY          InInitializationOrderModuleList;
1535     void*               BaseAddress;
1536     void*               EntryPoint;
1537     ULONG               SizeOfImage;
1538     UNICODE_STRING      FullDllName;
1539     UNICODE_STRING      BaseDllName;
1540     ULONG               Flags;
1541     SHORT               LoadCount;
1542     SHORT               TlsIndex;
1543     HANDLE              SectionHandle;
1544     ULONG               CheckSum;
1545     ULONG               TimeDateStamp;
1546 } LDR_MODULE, *PLDR_MODULE;
1547
1548 /* those defines are (some of the) regular LDR_MODULE.Flags values */
1549 #define LDR_IMAGE_IS_DLL                0x00000004
1550 #define LDR_LOAD_IN_PROGRESS            0x00001000
1551 #define LDR_UNLOAD_IN_PROGRESS          0x00002000
1552 #define LDR_NO_DLL_CALLS                0x00040000
1553 #define LDR_PROCESS_ATTACHED            0x00080000
1554 #define LDR_MODULE_REBASED              0x00200000
1555
1556 /* these ones is Wine specific */
1557 #define LDR_DONT_RESOLVE_REFS           0x40000000
1558 #define LDR_WINE_INTERNAL               0x80000000
1559
1560 /* FIXME: to be checked */
1561 #define MAXIMUM_FILENAME_LENGTH 256
1562
1563 typedef struct _SYSTEM_MODULE
1564 {
1565     ULONG               Reserved1;
1566     ULONG               Reserved2;
1567     PVOID               ImageBaseAddress;
1568     ULONG               ImageSize;
1569     ULONG               Flags;
1570     WORD                Id;
1571     WORD                Rank;
1572     WORD                Unknown;
1573     WORD                NameOffset;
1574     BYTE                Name[MAXIMUM_FILENAME_LENGTH];
1575 } SYSTEM_MODULE, *PSYSTEM_MODULE;
1576
1577 typedef struct _SYSTEM_MODULE_INFORMATION
1578 {
1579     ULONG               ModulesCount;
1580     SYSTEM_MODULE       Modules[1]; /* FIXME: should be Modules[0] */
1581 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
1582
1583 NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
1584 NTSTATUS WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
1585 NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
1586 NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
1587 NTSTATUS WINAPI LdrUnloadDll(HMODULE);
1588 NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG);
1589
1590 /* list manipulation macros */
1591 #define InitializeListHead(le)  (void)((le)->Flink = (le)->Blink = (le))
1592 #define InsertHeadList(le,e)    do { PLIST_ENTRY f = (le)->Flink; (e)->Flink = f; (e)->Blink = (le); f->Blink = (e); (le)->Flink = (e); } while (0)
1593 #define InsertTailList(le,e)    do { PLIST_ENTRY b = (le)->Blink; (e)->Flink = (le); (e)->Blink = b; b->Flink = (e); (le)->Blink = (e); } while (0)
1594 #define IsListEmpty(le)         ((le)->Flink == (le))
1595 #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)
1596 static inline PLIST_ENTRY RemoveHeadList(PLIST_ENTRY le)
1597 {
1598     PLIST_ENTRY f, b, e;
1599
1600     e = le->Flink;
1601     f = le->Flink->Flink;
1602     b = le->Flink->Blink;
1603     f->Blink = b;
1604     b->Flink = f;
1605
1606     if (e != le) e->Flink = e->Blink = NULL;
1607     return e;
1608 }
1609 static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
1610 {
1611     PLIST_ENTRY f, b, e;
1612
1613     e = le->Blink;
1614     f = le->Blink->Flink;
1615     b = le->Blink->Blink;
1616     f->Blink = b;
1617     b->Flink = f;
1618
1619     if (e != le) e->Flink = e->Blink = NULL;
1620     return e;
1621 }
1622
1623 #ifdef __cplusplus
1624 } /* extern "C" */
1625 #endif /* defined(__cplusplus) */
1626
1627 #endif  /* __WINE_WINTERNAL_H */