2 * Internal NT APIs and data structures
4 * Copyright (C) the Wine project
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.
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.
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
21 #ifndef __WINE_WINTERNAL_H
22 #define __WINE_WINTERNAL_H
30 #endif /* defined(__cplusplus) */
33 /***********************************************************************
43 PVOID ReservedForOle; /* Windows 2000 only */
45 PVOID TlsExpansionSlots;
49 /**********************************************************************
50 * Fundamental types and data structures
53 typedef LONG NTSTATUS;
55 typedef CONST char *PCSZ;
58 typedef CSHORT *PCSHORT;
60 typedef struct _STRING {
66 typedef STRING ANSI_STRING;
67 typedef PSTRING PANSI_STRING;
68 typedef const STRING *PCANSI_STRING;
70 typedef STRING OEM_STRING;
71 typedef PSTRING POEM_STRING;
72 typedef const STRING *PCOEM_STRING;
74 typedef struct _UNICODE_STRING {
75 USHORT Length; /* bytes */
76 USHORT MaximumLength; /* bytes */
78 } UNICODE_STRING, *PUNICODE_STRING;
80 typedef const UNICODE_STRING *PCUNICODE_STRING;
82 typedef struct _CLIENT_ID
86 } CLIENT_ID, *PCLIENT_ID;
88 typedef struct _CURDIR
90 UNICODE_STRING DosPath;
94 typedef struct RTL_DRIVE_LETTER_CURDIR
99 UNICODE_STRING DosPath;
100 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
102 typedef struct _RTL_USER_PROCESS_PARAMETERS
104 ULONG AllocationSize;
113 UNICODE_STRING CurrentDirectoryName;
114 HANDLE CurrentDirectoryHandle;
115 UNICODE_STRING DllPath;
116 UNICODE_STRING ImagePathName;
117 UNICODE_STRING CommandLine;
125 ULONG dwFillAttribute;
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;
136 typedef struct _PEB_LDR_DATA
141 LIST_ENTRY InLoadOrderModuleList;
142 LIST_ENTRY InMemoryOrderModuleList;
143 LIST_ENTRY InInitializationOrderModuleList;
144 } PEB_LDR_DATA, *PPEB_LDR_DATA;
146 /***********************************************************************
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 */
165 /***********************************************************************
169 typedef enum _FILE_INFORMATION_CLASS {
170 FileDirectoryInformation = 1,
171 FileFullDirectoryInformation,
172 FileBothDirectoryInformation,
173 FileBasicInformation,
174 FileStandardInformation,
175 FileInternalInformation,
177 FileAccessInformation,
179 FileRenameInformation,
181 FileNamesInformation,
182 FileDispositionInformation,
183 FilePositionInformation,
184 FileFullEaInformation,
186 FileAlignmentInformation,
188 FileAllocationInformation,
189 FileEndOfFileInformation,
190 FileAlternateNameInformation,
191 FileStreamInformation,
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;
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;
217 typedef struct _FILE_STANDARD_INFORMATION {
218 LARGE_INTEGER AllocationSize;
219 LARGE_INTEGER EndOfFile;
221 BOOLEAN DeletePending;
223 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
225 typedef struct _FILE_POSITION_INFORMATION {
226 LARGE_INTEGER CurrentByteOffset;
227 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
229 typedef struct _FILE_ALIGNMENT_INFORMATION {
230 ULONG AlignmentRequirement;
231 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
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;
243 typedef struct _FILE_FULL_EA_INFORMATION {
244 ULONG NextEntryOffset;
247 USHORT EaValueLength;
249 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
251 typedef struct _FILE_STREAM_INFORMATION
253 ULONG NextEntryOffset;
254 ULONG StreamNameLength;
255 LARGE_INTEGER StreamSize;
256 LARGE_INTEGER StreamAllocationSize;
258 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
260 struct _FILE_ATTRIBUTE_TAG_INFORMATION
262 ULONG FileAttributes;
264 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
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;
278 typedef enum _KEY_INFORMATION_CLASS {
282 } KEY_INFORMATION_CLASS;
284 typedef enum _KEY_VALUE_INFORMATION_CLASS {
285 KeyValueBasicInformation,
286 KeyValueFullInformation,
287 KeyValuePartialInformation,
288 KeyValueFullInformationAlign64,
289 KeyValuePartialInformationAlign64
290 } KEY_VALUE_INFORMATION_CLASS;
292 typedef enum _OBJECT_INFORMATION_CLASS {
293 ObjectBasicInformation,
294 ObjectNameInformation,
295 ObjectTypeInformation,
296 ObjectAllInformation,
297 ObjectDataInformation
298 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
300 typedef enum _PROCESSINFOCLASS {
301 ProcessBasicInformation = 0,
302 ProcessQuotaLimits = 1,
303 ProcessIoCounters = 2,
304 ProcessVmCounters = 3,
306 ProcessBasePriority = 5,
307 ProcessRaisePriority = 6,
308 ProcessDebugPort = 7,
309 ProcessExceptionPort = 8,
310 ProcessAccessToken = 9,
311 ProcessLdtInformation = 10,
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,
331 typedef enum _SECTION_INHERIT {
336 typedef enum SYSTEM_INFORMATION_CLASS {
337 SystemBasicInformation = 0,
339 SystemPerformanceInformation = 2,
340 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
342 SystemProcessInformation = 5,
345 SystemProcessorPerformanceInformation = 8,
348 SystemDriverInformation,
358 SystemCacheInformation,
360 SystemInterruptInformation = 23,
361 SystemExceptionInformation = 33,
362 SystemRegistryQuotaInformation = 37,
363 SystemLookasideInformation = 45
364 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
366 typedef enum _TIMER_TYPE {
371 typedef enum _THREADINFOCLASS {
372 ThreadBasicInformation,
377 ThreadImpersonationToken,
378 ThreadDescriptorTableEntry,
379 ThreadEnableAlignmentFaultFixup,
380 ThreadEventPair_Reusable,
381 ThreadQuerySetWin32StartAddress,
383 ThreadPerformanceCount,
385 ThreadIdealProcessor,
387 ThreadSetTlsArrayAddress,
392 typedef struct _THREAD_BASIC_INFORMATION
395 PVOID TebBaseAddress;
400 } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
403 typedef enum _WINSTATIONINFOCLASS {
404 WinStationInformation = 8
405 } WINSTATIONINFOCLASS;
409 MemoryBasicInformation = 0
410 } MEMORY_INFORMATION_CLASS;
412 /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
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 /* "//." */
425 /***********************************************************************
426 * IA64 specific types and data structures
431 typedef struct _FRAME_POINTERS {
432 ULONGLONG MemoryStackFp;
433 ULONGLONG BackingStoreFp;
434 } FRAME_POINTERS, *PFRAME_POINTERS;
436 #define UNWIND_HISTORY_TABLE_SIZE 12
438 typedef struct _RUNTIME_FUNCTION {
441 ULONG UnwindInfoAddress;
442 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
444 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
447 PRUNTIME_FUNCTION FunctionEntry;
448 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
450 typedef struct _UNWIND_HISTORY_TABLE {
455 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
456 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
458 #endif /* defined(__ia64__) */
460 /***********************************************************************
461 * Types and data structures
464 /* This is used by NtQuerySystemInformation */
465 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
467 FILETIME ftCreationTime;
469 DWORD dwStartAddress;
472 DWORD dwCurrentPriority;
473 DWORD dwBasePriority;
474 DWORD dwContextSwitches;
478 } THREADINFO, *PTHREADINFO;
480 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
481 typedef struct _THREAD_INFO{
488 } THREAD_INFO, PTHREAD_INFO;
490 /***********************************************************************
491 * Types and data structures
494 typedef struct _IO_STATUS_BLOCK {
500 ULONG_PTR Information;
501 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
503 typedef void (WINAPI * PIO_APC_ROUTINE)(PVOID,PIO_STATUS_BLOCK,ULONG);
505 typedef struct _KEY_BASIC_INFORMATION {
506 LARGE_INTEGER LastWriteTime;
510 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
512 typedef struct _KEY_NODE_INFORMATION
514 LARGE_INTEGER LastWriteTime;
521 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
523 typedef struct _KEY_FULL_INFORMATION
525 LARGE_INTEGER LastWriteTime;
533 ULONG MaxValueNameLen;
534 ULONG MaxValueDataLen;
536 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
538 typedef struct _KEY_VALUE_ENTRY
540 PUNICODE_STRING ValueName;
544 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
546 typedef struct _KEY_VALUE_BASIC_INFORMATION {
551 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
553 typedef struct _KEY_VALUE_FULL_INFORMATION {
560 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
562 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
567 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
569 typedef struct _OBJECT_ATTRIBUTES {
571 HANDLE RootDirectory;
572 PUNICODE_STRING ObjectName;
574 PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */
575 PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
576 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
578 typedef struct _OBJECT_DATA_INFORMATION {
579 BOOLEAN InheritHandle;
580 BOOLEAN ProtectFromClose;
581 } OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION;
583 typedef struct _PROCESS_BASIC_INFORMATION {
586 DWORD PebBaseAddress;
589 ULONG UniqueProcessId;
590 ULONG InheritedFromUniqueProcessId;
595 ULONG_PTR UniqueProcessId;
598 } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
600 typedef struct _PROCESS_INFO {
601 DWORD Offset; /* 00 offset to next PROCESS_INFO ok*/
602 DWORD ThreadCount; /* 04 number of ThreadInfo member ok */
604 FILETIME CreationTime; /* 20 */
606 PWCHAR ProcessName; /* 3c ok */
608 DWORD ProcessID; /* 44 ok*/
609 DWORD ParentProcessID;
611 DWORD Unknown3[2]; /* 50 */
612 ULONG PeakVirtualSize;
614 ULONG PageFaultCount;
615 ULONG PeakWorkingSetSize;
616 ULONG WorkingSetSize;
617 ULONG QuotaPeakPagedPoolUsage;
618 ULONG QuotaPagedPoolUsage;
619 ULONG QuotaPeakNonPagedPoolUsage;
620 ULONG QuotaNonPagedPoolUsage;
622 ULONG PeakPagefileUsage;
625 THREAD_INFO ati[ANYSIZE_ARRAY]; /* 94 size=0x40*/
626 } PROCESS_INFO, PPROCESS_INFO;
628 typedef struct _RTL_HEAP_DEFINITION {
629 ULONG Length; /* = sizeof(RTL_HEAP_DEFINITION) */
632 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
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;
639 typedef const RTL_BITMAP *PCRTL_BITMAP;
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;
646 typedef const RTL_BITMAP_RUN *PCRTL_BITMAP_RUN;
648 typedef struct _RTL_RWLOCK {
649 RTL_CRITICAL_SECTION rtlCS;
651 HANDLE hSharedReleaseSemaphore;
654 HANDLE hExclusiveReleaseSemaphore;
655 UINT uExclusiveWaiters;
658 HANDLE hOwningThreadId;
659 DWORD dwTimeoutBoost;
661 } RTL_RWLOCK, *LPRTL_RWLOCK;
663 /* System Information Class 0x00 */
664 typedef struct _SYSTEM_BASIC_INFORMATION {
667 ULONG uKeMaximumIncrement;
669 ULONG uMmNumberOfPhysicalPages;
670 ULONG uMmLowestPhysicalPage;
671 ULONG uMmHighestPhysicalPage;
672 ULONG uAllocationGranularity;
673 PVOID pLowestUserAddress;
674 PVOID pMmHighestUserAddress;
675 ULONG uKeActiveProcessors;
676 BYTE bKeNumberProcessors;
682 CCHAR NumberOfProcessors;
684 } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
686 /* System Information Class 0x15 */
690 ULONG PageFaultCount;
691 ULONG MinimumWorkingSet;
692 ULONG MaximumWorkingSet;
694 } SYSTEM_CACHE_INFORMATION;
696 typedef struct _SYSTEM_CONFIGURATION_INFO {
700 WORD ProcessorArchitecture;
705 PVOID MinimumApplicationAddress;
706 PVOID MaximumApplicationAddress;
707 ULONG ActiveProcessorMask;
708 ULONG NumberOfProcessors;
710 ULONG AllocationGranularity;
712 WORD ProcessorRevision;
713 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
715 /* System Information Class 0x0b */
722 char szName[MAX_PATH + 1];
723 } SYSTEM_DRIVER_INFORMATION;
725 typedef struct _SYSTEM_EXCEPTION_INFORMATION {
727 } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
729 typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
731 } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
733 typedef struct _SYSTEM_INTERRUPT_INFORMATION {
735 } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
737 /* System Information Class 0x10 */
740 USHORT dwCreatorBackTraceIndex;
742 BYTE bHandleAttributes;
743 USHORT usHandleOffset;
745 ULONG ulGrantedAccess;
746 } HANDLEINFO, *PHANDLEINFO; /* FIXME: SYSTEM_HANDLE_INFORMATION? */
748 typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
750 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
752 /* System Information Class 0x02 */
753 typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
755 LARGE_INTEGER liIdleTime;
758 LARGE_INTEGER IdleTime;
759 LARGE_INTEGER KernelTime;
760 LARGE_INTEGER UserTime;
761 LARGE_INTEGER Reserved1[2];
764 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
766 /* System Information Class 0x05 */
767 typedef struct _SYSTEM_PROCESS_INFORMATION {
772 FILETIME ftCreationTime;
774 WCHAR *pszProcessName;
775 DWORD dwBasePriority;
777 DWORD dwParentProcessID;
781 DWORD dwVirtualBytesPeak;
782 DWORD dwVirtualBytes;
784 DWORD dwWorkingSetPeak;
789 DWORD dwNonPagedPool;
790 DWORD dwPageFileBytesPeak;
791 DWORD dwPrivateBytes;
792 DWORD dwPageFileBytes;
796 ULONG NextEntryOffset;
799 HANDLE UniqueProcessId;
804 SIZE_T PeakPagefileUsage;
805 SIZE_T PrivatePageCount;
806 LARGE_INTEGER Reserved6[6];
808 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
810 typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
811 ULONG RegistryQuotaAllowed;
812 ULONG RegistryQuotaUsed;
814 } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
816 typedef struct _SYSTEM_TIME_ADJUSTMENT {
817 ULONG TimeAdjustment;
818 BOOLEAN TimeAdjustmentDisabled;
819 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
821 /* System Information Class 0x03 */
822 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
824 LARGE_INTEGER liKeBootTime;
825 LARGE_INTEGER liKeSystemTime;
826 LARGE_INTEGER liExpTimeZoneBias;
827 ULONG uCurrentTimeZoneId;
832 } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION; /* was SYSTEM_TIME_INFORMATION */
834 typedef struct _TIME_FIELDS
843 } TIME_FIELDS, *PTIME_FIELDS;
845 typedef struct _WINSTATIONINFORMATIONW {
848 BYTE Reserved3[1140];
849 } WINSTATIONINFORMATIONW, *PWINSTATIONINFORMATIONW;
851 typedef struct _VM_COUNTERS_ {
852 ULONG PeakVirtualSize;
854 ULONG PageFaultCount;
855 ULONG PeakWorkingSetSize;
856 ULONG WorkingSetSize;
857 ULONG QuotaPeakPagedPoolUsage;
858 ULONG QuotaPagedPoolUsage;
859 ULONG QuotaPeakNonPagedPoolUsage;
860 ULONG QuotaNonPagedPoolUsage;
862 ULONG PeakPagefileUsage;
863 } VM_COUNTERS, *PVM_COUNTERS;
865 typedef BOOLEAN (WINAPI * PWINSTATIONQUERYINFORMATIONW)(HANDLE,ULONG,WINSTATIONINFOCLASS,PVOID,ULONG,PULONG);
867 typedef struct _LDR_RESOURCE_INFO
872 } LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
874 /***********************************************************************
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
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
896 #if (_WIN32_WINNT >= 0x0501)
897 #define INTERNAL_TS_ACTIVE_CONSOLE_ID ( *((volatile ULONG*)(0x7ffe02d8)) )
898 #endif /* (_WIN32_WINNT >= 0x0501) */
900 #define LOGONID_CURRENT ((ULONG)-1)
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
911 #define SERVERNAME_CURRENT ((HANDLE)NULL)
913 typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR); /* FIXME: not the right name */
915 /***********************************************************************
916 * Function declarations
919 extern LPSTR _strlwr(LPSTR str); /* FIXME: Doesn't belong here */
920 extern LPSTR _strupr(LPSTR str); /* FIXME: Doesn't belong here */
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, ...);
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*);
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);
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);
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*);
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 *);
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);
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);
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);
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 *);
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);
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);
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);
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);
1185 BOOLEAN WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
1186 BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1188 NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
1189 NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION);
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);
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);
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 *);
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);
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);
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 *);
1248 NTSTATUS WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
1249 BOOLEAN WINAPI RtlValidAcl(PACL);
1250 BOOLEAN WINAPI RtlValidSid(PSID);
1251 BOOLEAN WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
1253 NTSTATUS WINAPI RtlWalkHeap(HANDLE,PVOID);
1255 NTSTATUS WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);
1256 NTSTATUS WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
1258 /***********************************************************************
1262 #define InitializeObjectAttributes(p,n,a,r,s) \
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; \
1272 #define NtCurrentProcess() ((HANDLE)-1)
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))
1282 inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
1284 if (lpBits && ulBit < lpBits->SizeOfBitMap &&
1285 lpBits->BitMapBuffer[ulBit >> 3] & (1 << (ulBit & 7)))
1290 #define RtlClearAllBits(p) \
1292 PRTL_BITMAP _p = (p); \
1293 memset(_p->BitMapBuffer,0,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1296 #define RtlInitializeBitMap(p,b,s) \
1298 PRTL_BITMAP _p = (p); \
1299 _p->SizeOfBitMap = (s); \
1300 _p->BitMapBuffer = (b); \
1303 #define RtlSetAllBits(p) \
1305 PRTL_BITMAP _p = (p); \
1306 memset(_p->BitMapBuffer,0xff,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1309 /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
1310 inline static USHORT RtlUshortByteSwap(USHORT s)
1312 return (s >> 8) | (s << 8);
1314 inline static ULONG RtlUlongByteSwap(ULONG i)
1316 #if defined(__i386__) && defined(__GNUC__)
1318 __asm__("bswap %0" : "=r" (ret) : "0" (i) );
1321 return ((ULONG)RtlUshortByteSwap((USHORT)i) << 16) | RtlUshortByteSwap((USHORT)(i >> 16));
1325 /*************************************************************************
1326 * Loader functions and structures.
1328 * Those are not part of standard Winternl.h
1330 typedef struct _LDR_MODULE
1332 LIST_ENTRY InLoadOrderModuleList;
1333 LIST_ENTRY InMemoryOrderModuleList;
1334 LIST_ENTRY InInitializationOrderModuleList;
1338 UNICODE_STRING FullDllName;
1339 UNICODE_STRING BaseDllName;
1343 HANDLE SectionHandle;
1345 ULONG TimeDateStamp;
1346 } LDR_MODULE, *PLDR_MODULE;
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
1356 /* these ones is Wine specific */
1357 #define LDR_DONT_RESOLVE_REFS 0x40000000
1358 #define LDR_WINE_INTERNAL 0x80000000
1360 /* FIXME: to be checked */
1361 #define MAXIMUM_FILENAME_LENGTH 256
1363 typedef struct _SYSTEM_MODULE
1367 PVOID ImageBaseAddress;
1374 BYTE Name[MAXIMUM_FILENAME_LENGTH];
1375 } SYSTEM_MODULE, *PSYSTEM_MODULE;
1377 typedef struct _SYSTEM_MODULE_INFORMATION
1380 SYSTEM_MODULE Modules[1]; /* FIXME: should be Modules[0] */
1381 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
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);
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)
1401 PLIST_ENTRY f, b, e;
1404 f = le->Flink->Flink;
1405 b = le->Flink->Blink;
1409 if (e != le) e->Flink = e->Blink = NULL;
1412 static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
1414 PLIST_ENTRY f, b, e;
1417 f = le->Blink->Flink;
1418 b = le->Blink->Blink;
1422 if (e != le) e->Flink = e->Blink = NULL;
1428 #endif /* defined(__cplusplus) */
1430 #endif /* __WINE_WINTERNAL_H */