Fixed definition of MAX_COMPUTERNAME_LENGTH (spotted by Mike
[wine/multimedia.git] / include / winternl.h
blobf1f6c0bfd5f0ee5451bfc1ff85229a6ad8e23503
1 /*
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_WINTERNL_H
22 #define __WINE_WINTERNL_H
24 #include <windef.h>
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* defined(__cplusplus) */
31 /**********************************************************************
32 * Fundamental types and data structures
35 typedef LONG NTSTATUS;
37 typedef CONST char *PCSZ;
39 typedef short CSHORT;
40 typedef CSHORT *PCSHORT;
42 typedef struct _STRING {
43 USHORT Length;
44 USHORT MaximumLength;
45 PCHAR Buffer;
46 } STRING, *PSTRING;
48 typedef STRING ANSI_STRING;
49 typedef PSTRING PANSI_STRING;
50 typedef const STRING *PCANSI_STRING;
52 typedef STRING OEM_STRING;
53 typedef PSTRING POEM_STRING;
54 typedef const STRING *PCOEM_STRING;
56 typedef struct _UNICODE_STRING {
57 USHORT Length; /* bytes */
58 USHORT MaximumLength; /* bytes */
59 PWSTR Buffer;
60 } UNICODE_STRING, *PUNICODE_STRING;
62 typedef const UNICODE_STRING *PCUNICODE_STRING;
64 typedef struct _CLIENT_ID
66 HANDLE UniqueProcess;
67 HANDLE UniqueThread;
68 } CLIENT_ID, *PCLIENT_ID;
70 typedef struct _CURDIR
72 UNICODE_STRING DosPath;
73 PVOID Handle;
74 } CURDIR, *PCURDIR;
76 typedef struct RTL_DRIVE_LETTER_CURDIR
78 USHORT Flags;
79 USHORT Length;
80 ULONG TimeStamp;
81 UNICODE_STRING DosPath;
82 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
84 typedef struct tagRTL_BITMAP {
85 ULONG SizeOfBitMap; /* Number of bits in the bitmap */
86 PULONG Buffer; /* Bitmap data, assumed sized to a DWORD boundary */
87 } RTL_BITMAP, *PRTL_BITMAP;
89 typedef const RTL_BITMAP *PCRTL_BITMAP;
91 typedef struct tagRTL_BITMAP_RUN {
92 ULONG StartingIndex; /* Bit position at which run starts */
93 ULONG NumberOfBits; /* Size of the run in bits */
94 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
96 typedef const RTL_BITMAP_RUN *PCRTL_BITMAP_RUN;
98 typedef struct _RTL_USER_PROCESS_PARAMETERS
100 ULONG AllocationSize;
101 ULONG Size;
102 ULONG Flags;
103 ULONG DebugFlags;
104 HANDLE ConsoleHandle;
105 ULONG ConsoleFlags;
106 HANDLE hStdInput;
107 HANDLE hStdOutput;
108 HANDLE hStdError;
109 CURDIR CurrentDirectory;
110 UNICODE_STRING DllPath;
111 UNICODE_STRING ImagePathName;
112 UNICODE_STRING CommandLine;
113 PWSTR Environment;
114 ULONG dwX;
115 ULONG dwY;
116 ULONG dwXSize;
117 ULONG dwYSize;
118 ULONG dwXCountChars;
119 ULONG dwYCountChars;
120 ULONG dwFillAttribute;
121 ULONG dwFlags;
122 ULONG wShowWindow;
123 UNICODE_STRING WindowTitle;
124 UNICODE_STRING Desktop;
125 UNICODE_STRING ShellInfo;
126 UNICODE_STRING RuntimeInfo;
127 RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20];
128 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
130 /* value for Flags field (FIXME: not the correct name) */
131 #define PROCESS_PARAMS_FLAG_NORMALIZED 1
133 typedef struct _PEB_LDR_DATA
135 ULONG Length;
136 BOOLEAN Initialized;
137 PVOID SsHandle;
138 LIST_ENTRY InLoadOrderModuleList;
139 LIST_ENTRY InMemoryOrderModuleList;
140 LIST_ENTRY InInitializationOrderModuleList;
141 } PEB_LDR_DATA, *PPEB_LDR_DATA;
143 /***********************************************************************
144 * PEB data structure
146 typedef struct _PEB
148 BOOLEAN InheritedAddressSpace; /* 00 */
149 BOOLEAN ReadImageFileExecOptions; /* 01 */
150 BOOLEAN BeingDebugged; /* 02 */
151 BOOLEAN SpareBool; /* 03 */
152 HANDLE Mutant; /* 04 */
153 HMODULE ImageBaseAddress; /* 08 */
154 PPEB_LDR_DATA LdrData; /* 0c */
155 RTL_USER_PROCESS_PARAMETERS *ProcessParameters; /* 10 */
156 PVOID SubSystemData; /* 14 */
157 HANDLE ProcessHeap; /* 18 */
158 PRTL_CRITICAL_SECTION FastPebLock; /* 1c */
159 PVOID /*PPEBLOCKROUTINE*/ FastPebLockRoutine; /* 20 */
160 PVOID /*PPEBLOCKROUTINE*/ FastPebUnlockRoutine; /* 24 */
161 ULONG EnvironmentUpdateCount; /* 28 */
162 PVOID KernelCallbackTable; /* 2c */
163 PVOID EventLogSection; /* 30 */
164 PVOID EventLog; /* 34 */
165 PVOID /*PPEB_FREE_BLOCK*/ FreeList; /* 38 */
166 ULONG TlsExpansionCounter; /* 3c */
167 PRTL_BITMAP TlsBitmap; /* 40 */
168 ULONG TlsBitmapBits[2]; /* 44 */
169 PVOID ReadOnlySharedMemoryBase; /* 4c */
170 PVOID ReadOnlySharedMemoryHeap; /* 50 */
171 PVOID *ReadOnlyStaticServerData; /* 54 */
172 PVOID AnsiCodePageData; /* 58 */
173 PVOID OemCodePageData; /* 5c */
174 PVOID UnicodeCaseTableData; /* 60 */
175 ULONG NumberOfProcessors; /* 64 */
176 ULONG NtGlobalFlag; /* 68 */
177 BYTE Spare2[4]; /* 6c */
178 LARGE_INTEGER CriticalSectionTimeout; /* 70 */
179 ULONG HeapSegmentReserve; /* 78 */
180 ULONG HeapSegmentCommit; /* 7c */
181 ULONG HeapDeCommitTotalFreeThreshold; /* 80 */
182 ULONG HeapDeCommitFreeBlockThreshold; /* 84 */
183 ULONG NumberOfHeaps; /* 88 */
184 ULONG MaximumNumberOfHeaps; /* 8c */
185 PVOID *ProcessHeaps; /* 90 */
186 PVOID GdiSharedHandleTable; /* 94 */
187 PVOID ProcessStarterHelper; /* 98 */
188 PVOID GdiDCAttributeList; /* 9c */
189 PVOID LoaderLock; /* a0 */
190 ULONG OSMajorVersion; /* a4 */
191 ULONG OSMinorVersion; /* a8 */
192 ULONG OSBuildNumber; /* ac */
193 ULONG OSPlatformId; /* b0 */
194 ULONG ImageSubSystem; /* b4 */
195 ULONG ImageSubSystemMajorVersion; /* b8 */
196 ULONG ImageSubSystemMinorVersion; /* bc */
197 ULONG ImageProcessAffinityMask; /* c0 */
198 ULONG GdiHandleBuffer[34]; /* c4 */
199 ULONG PostProcessInitRoutine; /* 14c */
200 ULONG TlsExpansionBitmap; /* 150 */
201 ULONG TlsExpansionBitmapBits[32]; /* 154 */
202 ULONG SessionId; /* 1d4 */
203 } PEB, *PPEB;
206 /***********************************************************************
207 * TEB data structure
209 #if defined(_NTSYSTEM_) || defined(_KERNEL32_) /* hack, should go away */
210 # define WINE_NO_TEB
211 #endif
213 #ifndef WINE_NO_TEB /* don't define TEB if included from thread.h */
214 # ifndef WINE_TEB_DEFINED
215 # define WINE_TEB_DEFINED
216 typedef struct _TEB
218 NT_TIB Tib; /* 000 */
219 PVOID EnvironmentPointer; /* 01c */
220 CLIENT_ID ClientId; /* 020 */
221 PVOID ActiveRpcHandle; /* 028 */
222 PVOID ThreadLocalStoragePointer; /* 02c */
223 PPEB Peb; /* 030 */
224 ULONG LastErrorValue; /* 034 */
225 BYTE __pad038[140]; /* 038 */
226 ULONG CurrentLocale; /* 0c4 */
227 BYTE __pad0c8[1752]; /* 0c8 */
228 PVOID Reserved2[278]; /* 7a0 */
229 UNICODE_STRING StaticUnicodeString; /* bf8 used by advapi32 */
230 WCHAR StaticUnicodeBuffer[261]; /* c00 used by advapi32 */
231 PVOID DeallocationStack; /* e0c */
232 PVOID TlsSlots[64]; /* e10 */
233 LIST_ENTRY TlsLinks; /* f10 */
234 PVOID Reserved4[26]; /* f18 */
235 PVOID ReservedForOle; /* f80 Windows 2000 only */
236 PVOID Reserved5[4]; /* f84 */
237 PVOID TlsExpansionSlots; /* f94 */
238 } TEB, *PTEB;
239 # endif /* WINE_TEB_DEFINED */
240 #endif /* WINE_NO_TEB */
242 /***********************************************************************
243 * Enums
246 typedef enum _FILE_INFORMATION_CLASS {
247 FileDirectoryInformation = 1,
248 FileFullDirectoryInformation,
249 FileBothDirectoryInformation,
250 FileBasicInformation,
251 FileStandardInformation,
252 FileInternalInformation,
253 FileEaInformation,
254 FileAccessInformation,
255 FileNameInformation,
256 FileRenameInformation,
257 FileLinkInformation,
258 FileNamesInformation,
259 FileDispositionInformation,
260 FilePositionInformation,
261 FileFullEaInformation,
262 FileModeInformation,
263 FileAlignmentInformation,
264 FileAllInformation,
265 FileAllocationInformation,
266 FileEndOfFileInformation,
267 FileAlternateNameInformation,
268 FileStreamInformation,
269 FilePipeInformation,
270 FilePipeLocalInformation,
271 FilePipeRemoteInformation,
272 FileMailslotQueryInformation,
273 FileMailslotSetInformation,
274 FileCompressionInformation,
275 FileObjectIdInformation,
276 FileCompletionInformation,
277 FileMoveClusterInformation,
278 FileQuotaInformation,
279 FileReparsePointInformation,
280 FileNetworkOpenInformation,
281 FileAttributeTagInformation,
282 FileTrackingInformation,
283 FileMaximumInformation
284 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
286 typedef struct _FILE_DIRECTORY_INFORMATION {
287 ULONG NextEntryOffset;
288 ULONG FileIndex;
289 LARGE_INTEGER CreationTime;
290 LARGE_INTEGER LastAccessTime;
291 LARGE_INTEGER LastWriteTime;
292 LARGE_INTEGER ChangeTime;
293 LARGE_INTEGER EndOfFile;
294 LARGE_INTEGER AllocationSize;
295 ULONG FileAttributes;
296 ULONG FileNameLength;
297 WCHAR FileName[ANYSIZE_ARRAY];
298 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
300 typedef struct _FILE_FULL_DIRECTORY_INFORMATION {
301 ULONG NextEntryOffset;
302 ULONG FileIndex;
303 LARGE_INTEGER CreationTime;
304 LARGE_INTEGER LastAccessTime;
305 LARGE_INTEGER LastWriteTime;
306 LARGE_INTEGER ChangeTime;
307 LARGE_INTEGER EndOfFile;
308 LARGE_INTEGER AllocationSize;
309 ULONG FileAttributes;
310 ULONG FileNameLength;
311 ULONG EaSize;
312 WCHAR FileName[ANYSIZE_ARRAY];
313 } FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION,
314 FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
316 typedef struct _FILE_BOTH_DIRECTORY_INFORMATION {
317 ULONG NextEntryOffset;
318 ULONG FileIndex;
319 LARGE_INTEGER CreationTime;
320 LARGE_INTEGER LastAccessTime;
321 LARGE_INTEGER LastWriteTime;
322 LARGE_INTEGER ChangeTime;
323 LARGE_INTEGER EndOfFile;
324 LARGE_INTEGER AllocationSize;
325 ULONG FileAttributes;
326 ULONG FileNameLength;
327 ULONG EaSize;
328 CHAR ShortNameLength;
329 WCHAR ShortName[12];
330 WCHAR FileName[ANYSIZE_ARRAY];
331 } FILE_BOTH_DIRECTORY_INFORMATION, *PFILE_BOTH_DIRECTORY_INFORMATION,
332 FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
334 typedef struct _FILE_BASIC_INFORMATION {
335 LARGE_INTEGER CreationTime;
336 LARGE_INTEGER LastAccessTime;
337 LARGE_INTEGER LastWriteTime;
338 LARGE_INTEGER ChangeTime;
339 ULONG FileAttributes;
340 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
342 typedef struct _FILE_STANDARD_INFORMATION {
343 LARGE_INTEGER AllocationSize;
344 LARGE_INTEGER EndOfFile;
345 ULONG NumberOfLinks;
346 BOOLEAN DeletePending;
347 BOOLEAN Directory;
348 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
350 typedef struct _FILE_INTERNAL_INFORMATION {
351 LARGE_INTEGER IndexNumber;
352 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
354 typedef struct _FILE_EA_INFORMATION {
355 ULONG EaSize;
356 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
358 typedef struct _FILE_ACCESS_INFORMATION {
359 ACCESS_MASK AccessFlags;
360 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
362 typedef struct _FILE_NAME_INFORMATION {
363 ULONG FileNameLength;
364 WCHAR FileName[1];
365 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
367 typedef struct _FILE_RENAME_INFORMATION {
368 BOOLEAN Replace;
369 HANDLE RootDir;
370 ULONG FileNameLength;
371 WCHAR FileName[1];
372 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
374 typedef struct _FILE_NAMES_INFORMATION {
375 ULONG NextEntryOffset;
376 ULONG FileIndex;
377 ULONG FileNameLength;
378 WCHAR FileName[1];
379 } FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
381 typedef struct _FILE_DISPOSITION_INFORMATION {
382 BOOLEAN DoDeleteFile;
383 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
385 typedef struct _FILE_POSITION_INFORMATION {
386 LARGE_INTEGER CurrentByteOffset;
387 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
389 typedef struct _FILE_ALIGNMENT_INFORMATION {
390 ULONG AlignmentRequirement;
391 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
393 typedef struct _FILE_ALLOCATION_INFORMATION {
394 LARGE_INTEGER AllocationSize;
395 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
397 typedef struct _FILE_END_OF_FILE_INFORMATION {
398 LARGE_INTEGER EndOfFile;
399 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
401 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
402 LARGE_INTEGER CreationTime;
403 LARGE_INTEGER LastAccessTime;
404 LARGE_INTEGER LastWriteTime;
405 LARGE_INTEGER ChangeTime;
406 LARGE_INTEGER AllocationSize;
407 LARGE_INTEGER EndOfFile;
408 ULONG FileAttributes;
409 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
411 typedef struct _FILE_FULL_EA_INFORMATION {
412 ULONG NextEntryOffset;
413 UCHAR Flags;
414 UCHAR EaNameLength;
415 USHORT EaValueLength;
416 CHAR EaName[1];
417 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
419 typedef struct _FILE_MODE_INFORMATION {
420 ULONG Mode;
421 } FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
423 typedef struct _FILE_STREAM_INFORMATION
425 ULONG NextEntryOffset;
426 ULONG StreamNameLength;
427 LARGE_INTEGER StreamSize;
428 LARGE_INTEGER StreamAllocationSize;
429 WCHAR StreamName[1];
430 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
432 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION
434 ULONG FileAttributes;
435 ULONG ReparseTag;
436 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
438 typedef struct _FILE_ALL_INFORMATION
440 FILE_BASIC_INFORMATION BasicInformation;
441 FILE_STANDARD_INFORMATION StandardInformation;
442 FILE_INTERNAL_INFORMATION InternalInformation;
443 FILE_EA_INFORMATION EaInformation;
444 FILE_ACCESS_INFORMATION AccessInformation;
445 FILE_POSITION_INFORMATION PositionInformation;
446 FILE_MODE_INFORMATION ModeInformation;
447 FILE_ALIGNMENT_INFORMATION AlignmentInformation;
448 FILE_NAME_INFORMATION NameInformation;
449 } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
451 typedef enum _FSINFOCLASS {
452 FileFsVolumeInformation = 1,
453 FileFsLabelInformation,
454 FileFsSizeInformation,
455 FileFsDeviceInformation,
456 FileFsAttributeInformation,
457 FileFsControlInformation,
458 FileFsFullSizeInformation,
459 FileFsObjectIdInformation,
460 FileFsMaximumInformation
461 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
463 typedef enum _KEY_INFORMATION_CLASS {
464 KeyBasicInformation,
465 KeyNodeInformation,
466 KeyFullInformation
467 } KEY_INFORMATION_CLASS;
469 typedef enum _KEY_VALUE_INFORMATION_CLASS {
470 KeyValueBasicInformation,
471 KeyValueFullInformation,
472 KeyValuePartialInformation,
473 KeyValueFullInformationAlign64,
474 KeyValuePartialInformationAlign64
475 } KEY_VALUE_INFORMATION_CLASS;
477 typedef enum _OBJECT_INFORMATION_CLASS {
478 ObjectBasicInformation,
479 ObjectNameInformation,
480 ObjectTypeInformation,
481 ObjectAllInformation,
482 ObjectDataInformation
483 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
485 typedef enum _PROCESSINFOCLASS {
486 ProcessBasicInformation = 0,
487 ProcessQuotaLimits = 1,
488 ProcessIoCounters = 2,
489 ProcessVmCounters = 3,
490 ProcessTimes = 4,
491 ProcessBasePriority = 5,
492 ProcessRaisePriority = 6,
493 ProcessDebugPort = 7,
494 ProcessExceptionPort = 8,
495 ProcessAccessToken = 9,
496 ProcessLdtInformation = 10,
497 ProcessLdtSize = 11,
498 ProcessDefaultHardErrorMode = 12,
499 ProcessIoPortHandlers = 13,
500 ProcessPooledUsageAndLimits = 14,
501 ProcessWorkingSetWatch = 15,
502 ProcessUserModeIOPL = 16,
503 ProcessEnableAlignmentFaultFixup = 17,
504 ProcessPriorityClass = 18,
505 ProcessWx86Information = 19,
506 ProcessHandleCount = 20,
507 ProcessAffinityMask = 21,
508 ProcessPriorityBoost = 22,
509 ProcessDeviceMap = 23,
510 ProcessSessionInformation = 24,
511 ProcessForegroundInformation = 25,
512 ProcessWow64Information = 26,
513 MaxProcessInfoClass
514 } PROCESSINFOCLASS;
516 typedef enum _SECTION_INHERIT {
517 ViewShare = 1,
518 ViewUnmap = 2
519 } SECTION_INHERIT;
521 typedef enum _SYSTEM_INFORMATION_CLASS {
522 SystemBasicInformation = 0,
523 Unknown1,
524 SystemPerformanceInformation = 2,
525 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
526 Unknown4,
527 SystemProcessInformation = 5,
528 Unknown6,
529 Unknown7,
530 SystemProcessorPerformanceInformation = 8,
531 Unknown9,
532 Unknown10,
533 SystemDriverInformation,
534 Unknown12,
535 Unknown13,
536 Unknown14,
537 Unknown15,
538 SystemHandleList,
539 Unknown17,
540 Unknown18,
541 Unknown19,
542 Unknown20,
543 SystemCacheInformation,
544 Unknown22,
545 SystemInterruptInformation = 23,
546 SystemDpcBehaviourInformation = 24,
547 SystemFullMemoryInformation = 25,
548 SystemNotImplemented6 = 25,
549 SystemLoadImage = 26,
550 SystemUnloadImage = 27,
551 SystemTimeAdjustmentInformation = 28,
552 SystemTimeAdjustment = 28,
553 SystemSummaryMemoryInformation = 29,
554 SystemNotImplemented7 = 29,
555 SystemNextEventIdInformation = 30,
556 SystemNotImplemented8 = 30,
557 SystemEventIdsInformation = 31,
558 SystemCrashDumpInformation = 32,
559 SystemExceptionInformation = 33,
560 SystemCrashDumpStateInformation = 34,
561 SystemKernelDebuggerInformation = 35,
562 SystemContextSwitchInformation = 36,
563 SystemRegistryQuotaInformation = 37,
564 SystemCurrentTimeZoneInformation = 44,
565 SystemTimeZoneInformation = 44,
566 SystemLookasideInformation = 45,
567 SystemSetTimeSlipEvent = 46,
568 SystemCreateSession = 47,
569 SystemDeleteSession = 48,
570 SystemInvalidInfoClass4 = 49,
571 SystemRangeStartInformation = 50,
572 SystemVerifierInformation = 51,
573 SystemAddVerifier = 52,
574 SystemSessionProcessesInformation = 53,
575 SystemInformationClassMax
576 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
578 typedef enum _TIMER_TYPE {
579 NotificationTimer,
580 SynchronizationTimer
581 } TIMER_TYPE;
583 typedef enum _THREADINFOCLASS {
584 ThreadBasicInformation,
585 ThreadTimes,
586 ThreadPriority,
587 ThreadBasePriority,
588 ThreadAffinityMask,
589 ThreadImpersonationToken,
590 ThreadDescriptorTableEntry,
591 ThreadEnableAlignmentFaultFixup,
592 ThreadEventPair_Reusable,
593 ThreadQuerySetWin32StartAddress,
594 ThreadZeroTlsCell,
595 ThreadPerformanceCount,
596 ThreadAmILastThread,
597 ThreadIdealProcessor,
598 ThreadPriorityBoost,
599 ThreadSetTlsArrayAddress,
600 ThreadIsIoPending,
601 MaxThreadInfoClass
602 } THREADINFOCLASS;
604 typedef struct _THREAD_BASIC_INFORMATION
606 NTSTATUS ExitStatus;
607 PVOID TebBaseAddress;
608 CLIENT_ID ClientId;
609 ULONG AffinityMask;
610 LONG Priority;
611 LONG BasePriority;
612 } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
615 typedef enum _WINSTATIONINFOCLASS {
616 WinStationInformation = 8
617 } WINSTATIONINFOCLASS;
619 typedef enum
621 MemoryBasicInformation = 0
622 } MEMORY_INFORMATION_CLASS;
624 /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
625 typedef enum
627 INVALID_PATH = 0,
628 UNC_PATH, /* "//foo" */
629 ABSOLUTE_DRIVE_PATH, /* "c:/foo" */
630 RELATIVE_DRIVE_PATH, /* "c:foo" */
631 ABSOLUTE_PATH, /* "/foo" */
632 RELATIVE_PATH, /* "foo" */
633 DEVICE_PATH, /* "//./foo" */
634 UNC_DOT_PATH /* "//." */
635 } DOS_PATHNAME_TYPE;
637 /***********************************************************************
638 * IA64 specific types and data structures
641 #ifdef __ia64__
643 typedef struct _FRAME_POINTERS {
644 ULONGLONG MemoryStackFp;
645 ULONGLONG BackingStoreFp;
646 } FRAME_POINTERS, *PFRAME_POINTERS;
648 #define UNWIND_HISTORY_TABLE_SIZE 12
650 typedef struct _RUNTIME_FUNCTION {
651 ULONG BeginAddress;
652 ULONG EndAddress;
653 ULONG UnwindInfoAddress;
654 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
656 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
657 ULONG64 ImageBase;
658 ULONG64 Gp;
659 PRUNTIME_FUNCTION FunctionEntry;
660 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
662 typedef struct _UNWIND_HISTORY_TABLE {
663 ULONG Count;
664 UCHAR Search;
665 ULONG64 LowAddress;
666 ULONG64 HighAddress;
667 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
668 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
670 #endif /* defined(__ia64__) */
672 /***********************************************************************
673 * Types and data structures
676 /* This is used by NtQuerySystemInformation */
677 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
678 typedef struct {
679 FILETIME ftKernelTime;
680 FILETIME ftUserTime;
681 FILETIME ftCreateTime;
682 DWORD dwTickCount;
683 DWORD dwStartAddress;
684 DWORD dwOwningPID;
685 DWORD dwThreadID;
686 DWORD dwCurrentPriority;
687 DWORD dwBasePriority;
688 DWORD dwContextSwitches;
689 DWORD dwThreadState;
690 DWORD dwWaitReason;
691 } THREADINFO, *PTHREADINFO;
693 /* FIXME: Isn't THREAD_INFO and THREADINFO the same structure? */
694 typedef struct _THREAD_INFO{
695 DWORD Unknown1[6];
696 DWORD ThreadID;
697 DWORD Unknown2[3];
698 DWORD Status;
699 DWORD WaitReason;
700 DWORD Unknown3[4];
701 } THREAD_INFO, PTHREAD_INFO;
703 /***********************************************************************
704 * Types and data structures
707 typedef struct _IO_STATUS_BLOCK {
708 union {
709 NTSTATUS Status;
710 PVOID Pointer;
711 } DUMMYUNIONNAME;
713 ULONG_PTR Information;
714 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
716 typedef void (WINAPI * PIO_APC_ROUTINE)(PVOID,PIO_STATUS_BLOCK,ULONG);
718 typedef struct _KEY_BASIC_INFORMATION {
719 LARGE_INTEGER LastWriteTime;
720 ULONG TitleIndex;
721 ULONG NameLength;
722 WCHAR Name[1];
723 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
725 typedef struct _KEY_NODE_INFORMATION
727 LARGE_INTEGER LastWriteTime;
728 ULONG TitleIndex;
729 ULONG ClassOffset;
730 ULONG ClassLength;
731 ULONG NameLength;
732 WCHAR Name[1];
733 /* Class[1]; */
734 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
736 typedef struct _KEY_FULL_INFORMATION
738 LARGE_INTEGER LastWriteTime;
739 ULONG TitleIndex;
740 ULONG ClassOffset;
741 ULONG ClassLength;
742 ULONG SubKeys;
743 ULONG MaxNameLen;
744 ULONG MaxClassLen;
745 ULONG Values;
746 ULONG MaxValueNameLen;
747 ULONG MaxValueDataLen;
748 WCHAR Class[1];
749 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
751 typedef struct _KEY_VALUE_ENTRY
753 PUNICODE_STRING ValueName;
754 ULONG DataLength;
755 ULONG DataOffset;
756 ULONG Type;
757 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
759 typedef struct _KEY_VALUE_BASIC_INFORMATION {
760 ULONG TitleIndex;
761 ULONG Type;
762 ULONG NameLength;
763 WCHAR Name[1];
764 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
766 typedef struct _KEY_VALUE_FULL_INFORMATION {
767 ULONG TitleIndex;
768 ULONG Type;
769 ULONG DataOffset;
770 ULONG DataLength;
771 ULONG NameLength;
772 WCHAR Name[1];
773 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
775 typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
776 ULONG TitleIndex;
777 ULONG Type;
778 ULONG DataLength;
779 UCHAR Data[1];
780 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
782 typedef struct _OBJECT_ATTRIBUTES {
783 ULONG Length;
784 HANDLE RootDirectory;
785 PUNICODE_STRING ObjectName;
786 ULONG Attributes;
787 PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */
788 PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
789 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
791 typedef struct _OBJECT_DATA_INFORMATION {
792 BOOLEAN InheritHandle;
793 BOOLEAN ProtectFromClose;
794 } OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION;
796 typedef struct _PROCESS_BASIC_INFORMATION {
797 #ifdef __WINESRC__
798 DWORD ExitStatus;
799 DWORD PebBaseAddress;
800 DWORD AffinityMask;
801 DWORD BasePriority;
802 ULONG UniqueProcessId;
803 ULONG InheritedFromUniqueProcessId;
804 #else
805 PVOID Reserved1;
806 PPEB PebBaseAddress;
807 PVOID Reserved2[2];
808 ULONG_PTR UniqueProcessId;
809 PVOID Reserved3;
810 #endif
811 } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
813 typedef struct _PROCESS_INFO {
814 DWORD Offset; /* 00 offset to next PROCESS_INFO ok*/
815 DWORD ThreadCount; /* 04 number of ThreadInfo member ok */
816 DWORD Unknown1[6];
817 FILETIME CreationTime; /* 20 */
818 DWORD Unknown2[5];
819 PWCHAR ProcessName; /* 3c ok */
820 DWORD BasePriority;
821 DWORD ProcessID; /* 44 ok*/
822 DWORD ParentProcessID;
823 DWORD HandleCount;
824 DWORD Unknown3[2]; /* 50 */
825 ULONG PeakVirtualSize;
826 ULONG VirtualSize;
827 ULONG PageFaultCount;
828 ULONG PeakWorkingSetSize;
829 ULONG WorkingSetSize;
830 ULONG QuotaPeakPagedPoolUsage;
831 ULONG QuotaPagedPoolUsage;
832 ULONG QuotaPeakNonPagedPoolUsage;
833 ULONG QuotaNonPagedPoolUsage;
834 ULONG PagefileUsage;
835 ULONG PeakPagefileUsage;
836 DWORD PrivateBytes;
837 DWORD Unknown6[4];
838 THREAD_INFO ati[ANYSIZE_ARRAY]; /* 94 size=0x40*/
839 } PROCESS_INFO, PPROCESS_INFO;
841 typedef struct _RTL_HEAP_DEFINITION {
842 ULONG Length; /* = sizeof(RTL_HEAP_DEFINITION) */
844 ULONG Unknown[11];
845 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
847 typedef struct _RTL_RWLOCK {
848 RTL_CRITICAL_SECTION rtlCS;
850 HANDLE hSharedReleaseSemaphore;
851 UINT uSharedWaiters;
853 HANDLE hExclusiveReleaseSemaphore;
854 UINT uExclusiveWaiters;
856 INT iNumberActive;
857 HANDLE hOwningThreadId;
858 DWORD dwTimeoutBoost;
859 PVOID pDebugInfo;
860 } RTL_RWLOCK, *LPRTL_RWLOCK;
862 /* System Information Class 0x00 */
863 typedef struct _SYSTEM_BASIC_INFORMATION {
864 #ifdef __WINESRC__
865 DWORD dwUnknown1;
866 ULONG uKeMaximumIncrement;
867 ULONG uPageSize;
868 ULONG uMmNumberOfPhysicalPages;
869 ULONG uMmLowestPhysicalPage;
870 ULONG uMmHighestPhysicalPage;
871 ULONG uAllocationGranularity;
872 PVOID pLowestUserAddress;
873 PVOID pMmHighestUserAddress;
874 ULONG uKeActiveProcessors;
875 BYTE bKeNumberProcessors;
876 BYTE bUnknown2;
877 WORD wUnknown3;
878 #else
879 BYTE Reserved1[24];
880 PVOID Reserved2[4];
881 CCHAR NumberOfProcessors;
882 #endif
883 } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
885 /* System Information Class 0x15 */
886 typedef struct {
887 ULONG CurrentSize;
888 ULONG PeakSize;
889 ULONG PageFaultCount;
890 ULONG MinimumWorkingSet;
891 ULONG MaximumWorkingSet;
892 ULONG unused[4];
893 } SYSTEM_CACHE_INFORMATION;
895 typedef struct _SYSTEM_CONFIGURATION_INFO {
896 union {
897 ULONG OemId;
898 struct {
899 WORD ProcessorArchitecture;
900 WORD Reserved;
901 } tag1;
902 } tag2;
903 ULONG PageSize;
904 PVOID MinimumApplicationAddress;
905 PVOID MaximumApplicationAddress;
906 ULONG ActiveProcessorMask;
907 ULONG NumberOfProcessors;
908 ULONG ProcessorType;
909 ULONG AllocationGranularity;
910 WORD ProcessorLevel;
911 WORD ProcessorRevision;
912 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
914 /* System Information Class 0x0b */
915 typedef struct {
916 PVOID pvAddress;
917 DWORD dwUnknown1;
918 DWORD dwUnknown2;
919 DWORD dwEntryIndex;
920 DWORD dwUnknown3;
921 char szName[MAX_PATH + 1];
922 } SYSTEM_DRIVER_INFORMATION;
924 typedef struct _SYSTEM_EXCEPTION_INFORMATION {
925 BYTE Reserved1[16];
926 } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
928 typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
929 BYTE Reserved1[32];
930 } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
932 typedef struct _SYSTEM_INTERRUPT_INFORMATION {
933 BYTE Reserved1[24];
934 } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
936 typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION {
937 BOOLEAN DebuggerEnabled;
938 BOOLEAN DebuggerNotPresent;
939 } SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
941 /* System Information Class 0x10 */
942 typedef struct {
943 USHORT dwPID;
944 USHORT dwCreatorBackTraceIndex;
945 BYTE bObjectType;
946 BYTE bHandleAttributes;
947 USHORT usHandleOffset;
948 DWORD dwKeObject;
949 ULONG ulGrantedAccess;
950 } HANDLEINFO, *PHANDLEINFO; /* FIXME: SYSTEM_HANDLE_INFORMATION? */
952 typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
953 BYTE Reserved1[312];
954 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
956 /* System Information Class 0x02 */
957 typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
958 #ifdef __WINESRC__
959 LARGE_INTEGER liIdleTime;
960 DWORD dwSpare[10];
961 #else
962 LARGE_INTEGER IdleTime;
963 LARGE_INTEGER KernelTime;
964 LARGE_INTEGER UserTime;
965 LARGE_INTEGER Reserved1[2];
966 ULONG Reserved2;
967 #endif
968 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
970 /* System Information Class 0x05 */
971 typedef struct _SYSTEM_PROCESS_INFORMATION {
972 #ifdef __WINESRC__
973 DWORD dwOffset;
974 DWORD dwThreadCount;
975 DWORD dwUnknown1[6];
976 FILETIME ftCreationTime;
977 DWORD dwUnknown2[5];
978 WCHAR *pszProcessName;
979 DWORD dwBasePriority;
980 DWORD dwProcessID;
981 DWORD dwParentProcessID;
982 DWORD dwHandleCount;
983 DWORD dwUnknown3;
984 DWORD dwUnknown4;
985 DWORD dwVirtualBytesPeak;
986 DWORD dwVirtualBytes;
987 DWORD dwPageFaults;
988 DWORD dwWorkingSetPeak;
989 DWORD dwWorkingSet;
990 DWORD dwUnknown5;
991 DWORD dwPagedPool;
992 DWORD dwUnknown6;
993 DWORD dwNonPagedPool;
994 DWORD dwPageFileBytesPeak;
995 DWORD dwPrivateBytes;
996 DWORD dwPageFileBytes;
997 DWORD dwUnknown7[4];
998 THREADINFO ti[1];
999 #else
1000 ULONG NextEntryOffset;
1001 BYTE Reserved1[52];
1002 PVOID Reserved2[3];
1003 HANDLE UniqueProcessId;
1004 PVOID Reserved3;
1005 ULONG HandleCount;
1006 BYTE Reserved4[4];
1007 PVOID Reserved5[11];
1008 SIZE_T PeakPagefileUsage;
1009 SIZE_T PrivatePageCount;
1010 LARGE_INTEGER Reserved6[6];
1011 #endif
1012 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
1014 typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
1015 ULONG RegistryQuotaAllowed;
1016 ULONG RegistryQuotaUsed;
1017 PVOID Reserved1;
1018 } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
1020 typedef struct _SYSTEM_TIME_ADJUSTMENT {
1021 ULONG TimeAdjustment;
1022 BOOLEAN TimeAdjustmentDisabled;
1023 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
1025 /* System Information Class 0x03 */
1026 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
1027 #ifdef __WINESRC__
1028 LARGE_INTEGER liKeBootTime;
1029 LARGE_INTEGER liKeSystemTime;
1030 LARGE_INTEGER liExpTimeZoneBias;
1031 ULONG uCurrentTimeZoneId;
1032 DWORD dwReserved;
1033 #else
1034 BYTE Reserved1[48];
1035 #endif
1036 } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION; /* was SYSTEM_TIME_INFORMATION */
1038 typedef struct _TIME_FIELDS
1039 { CSHORT Year;
1040 CSHORT Month;
1041 CSHORT Day;
1042 CSHORT Hour;
1043 CSHORT Minute;
1044 CSHORT Second;
1045 CSHORT Milliseconds;
1046 CSHORT Weekday;
1047 } TIME_FIELDS, *PTIME_FIELDS;
1049 typedef struct _WINSTATIONINFORMATIONW {
1050 BYTE Reserved2[70];
1051 ULONG LogonId;
1052 BYTE Reserved3[1140];
1053 } WINSTATIONINFORMATIONW, *PWINSTATIONINFORMATIONW;
1055 typedef struct _VM_COUNTERS_ {
1056 SIZE_T PeakVirtualSize;
1057 SIZE_T VirtualSize;
1058 ULONG PageFaultCount;
1059 SIZE_T PeakWorkingSetSize;
1060 SIZE_T WorkingSetSize;
1061 SIZE_T QuotaPeakPagedPoolUsage;
1062 SIZE_T QuotaPagedPoolUsage;
1063 SIZE_T QuotaPeakNonPagedPoolUsage;
1064 SIZE_T QuotaNonPagedPoolUsage;
1065 SIZE_T PagefileUsage;
1066 SIZE_T PeakPagefileUsage;
1067 } VM_COUNTERS, *PVM_COUNTERS;
1069 typedef BOOLEAN (WINAPI * PWINSTATIONQUERYINFORMATIONW)(HANDLE,ULONG,WINSTATIONINFOCLASS,PVOID,ULONG,PULONG);
1071 typedef struct _LDR_RESOURCE_INFO
1073 ULONG Type;
1074 ULONG Name;
1075 ULONG Language;
1076 } LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
1079 /* debug buffer definitions */
1081 typedef struct _DEBUG_BUFFER {
1082 HANDLE SectionHandle;
1083 PVOID SectionBase;
1084 PVOID RemoteSectionBase;
1085 ULONG SectionBaseDelta;
1086 HANDLE EventPairHandle;
1087 ULONG Unknown[2];
1088 HANDLE RemoteThreadHandle;
1089 ULONG InfoClassMask;
1090 ULONG SizeOfInfo;
1091 ULONG AllocatedSize;
1092 ULONG SectionSize;
1093 PVOID ModuleInformation;
1094 PVOID BackTraceInformation;
1095 PVOID HeapInformation;
1096 PVOID LockInformation;
1097 PVOID Reserved[8];
1098 } DEBUG_BUFFER, *PDEBUG_BUFFER;
1100 #define PDI_MODULES 0x01
1101 #define PDI_BACKTRACE 0x02
1102 #define PDI_HEAPS 0x04
1103 #define PDI_HEAP_TAGS 0x08
1104 #define PDI_HEAP_BLOCKS 0x10
1105 #define PDI_LOCKS 0x20
1107 typedef struct _DEBUG_MODULE_INFORMATION {
1108 ULONG Reserved[2];
1109 ULONG Base;
1110 ULONG Size;
1111 ULONG Flags;
1112 USHORT Index;
1113 USHORT Unknown;
1114 USHORT LoadCount;
1115 USHORT ModuleNameOffset;
1116 CHAR ImageName[256];
1117 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
1119 typedef struct _DEBUG_HEAP_INFORMATION {
1120 ULONG Base;
1121 ULONG Flags;
1122 USHORT Granularity;
1123 USHORT Unknown;
1124 ULONG Allocated;
1125 ULONG Committed;
1126 ULONG TagCount;
1127 ULONG BlockCount;
1128 ULONG Reserved[7];
1129 PVOID Tags;
1130 PVOID Blocks;
1131 } DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
1133 typedef struct _DEBUG_LOCK_INFORMATION {
1134 PVOID Address;
1135 USHORT Type;
1136 USHORT CreatorBackTraceIndex;
1137 ULONG OwnerThreadId;
1138 ULONG ActiveCount;
1139 ULONG ContentionCount;
1140 ULONG EntryCount;
1141 ULONG RecursionCount;
1142 ULONG NumberOfSharedWaiters;
1143 ULONG NumberOfExclusiveWaiters;
1144 } DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
1146 typedef struct _PORT_MESSAGE_HEADER {
1147 USHORT DataSize;
1148 USHORT MessageSize;
1149 USHORT MessageType;
1150 USHORT VirtualRangesOffset;
1151 CLIENT_ID ClientId;
1152 ULONG MessageId;
1153 ULONG SectionSize;
1154 } PORT_MESSAGE_HEADER, *PPORT_MESSAGE_HEADER, PORT_MESSAGE, *PPORT_MESSAGE;
1156 /***********************************************************************
1157 * Defines
1160 /* flags for NtCreateFile and NtOpenFile */
1161 #define FILE_DIRECTORY_FILE 0x00000001
1162 #define FILE_WRITE_THROUGH 0x00000002
1163 #define FILE_SEQUENTIAL_ONLY 0x00000004
1164 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
1165 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
1166 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
1167 #define FILE_NON_DIRECTORY_FILE 0x00000040
1168 #define FILE_CREATE_TREE_CONNECTION 0x00000080
1169 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
1170 #define FILE_NO_EA_KNOWLEDGE 0x00000200
1171 #define FILE_OPEN_FOR_RECOVERY 0x00000400
1172 #define FILE_RANDOM_ACCESS 0x00000800
1173 #define FILE_DELETE_ON_CLOSE 0x00001000
1174 #define FILE_OPEN_BY_FILE_ID 0x00002000
1175 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
1176 #define FILE_NO_COMPRESSION 0x00008000
1177 #define FILE_RESERVE_OPFILTER 0x00100000
1178 #define FILE_TRANSACTED_MODE 0x00200000
1179 #define FILE_OPEN_OFFLINE_FILE 0x00400000
1180 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
1182 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
1183 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
1185 /* status for NtCreateFile or NtOpenFile */
1186 #define FILE_SUPERSEDED 0
1187 #define FILE_OPENED 1
1188 #define FILE_CREATED 2
1189 #define FILE_OVERWRITTEN 3
1190 #define FILE_EXISTS 4
1191 #define FILE_DOES_NOT_EXIST 5
1193 /* disposition for NtCreateFile */
1194 #define FILE_SUPERSEDE 0
1195 #define FILE_OPEN 1
1196 #define FILE_CREATE 2
1197 #define FILE_OPEN_IF 3
1198 #define FILE_OVERWRITE 4
1199 #define FILE_OVERWRITE_IF 5
1200 #define FILE_MAXIMUM_DISPOSITION 5
1202 /* Characteristics of a File System */
1203 #define FILE_REMOVABLE_MEDIA 0x00000001
1204 #define FILE_READ_ONLY_DEVICE 0x00000002
1205 #define FILE_FLOPPY_DISKETTE 0x00000004
1206 #define FILE_WRITE_ONE_MEDIA 0x00000008
1207 #define FILE_REMOTE_DEVICE 0x00000010
1208 #define FILE_DEVICE_IS_MOUNTED 0x00000020
1209 #define FILE_VIRTUAL_VOLUME 0x00000040
1210 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
1211 #define FILE_DEVICE_SECURE_OPEN 0x00000100
1213 #if (_WIN32_WINNT >= 0x0501)
1214 #define INTERNAL_TS_ACTIVE_CONSOLE_ID ( *((volatile ULONG*)(0x7ffe02d8)) )
1215 #endif /* (_WIN32_WINNT >= 0x0501) */
1217 #define LOGONID_CURRENT ((ULONG)-1)
1219 #define OBJ_INHERIT 0x00000002L
1220 #define OBJ_PERMANENT 0x00000010L
1221 #define OBJ_EXCLUSIVE 0x00000020L
1222 #define OBJ_CASE_INSENSITIVE 0x00000040L
1223 #define OBJ_OPENIF 0x00000080L
1224 #define OBJ_OPENLINK 0x00000100L
1225 #define OBJ_KERNEL_HANDLE 0x00000200L
1226 #define OBJ_VALID_ATTRIBUTES 0x000003F2L
1228 #define SERVERNAME_CURRENT ((HANDLE)NULL)
1230 typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR); /* FIXME: not the right name */
1231 typedef void (CALLBACK *PRTL_THREAD_START_ROUTINE)(LPVOID); /* FIXME: not the right name */
1234 /* DbgPrintEx default levels */
1235 #define DPFLTR_ERROR_LEVEL 0
1236 #define DPFLTR_WARNING_LEVEL 1
1237 #define DPFLTR_TRACE_LEVEL 2
1238 #define DPFLTR_INFO_LEVEL 3
1239 #define DPFLTR_MASK 0x8000000
1241 /***********************************************************************
1242 * Function declarations
1245 extern LPSTR _strlwr(LPSTR str); /* FIXME: Doesn't belong here */
1246 extern LPSTR _strupr(LPSTR str); /* FIXME: Doesn't belong here */
1248 #if defined(__i386__) && defined(__GNUC__)
1249 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
1250 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
1251 #else /* __i386__ && __GNUC__ */
1252 void WINAPI DbgBreakPoint(void);
1253 void WINAPI DbgUserBreakPoint(void);
1254 #endif /* __i386__ && __GNUC__ */
1255 NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...);
1256 NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...);
1258 NTSTATUS WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void**,PULONG);
1259 NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);
1260 NTSTATUS WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
1261 NTSTATUS WINAPI LdrGetDllHandle(ULONG, ULONG, const UNICODE_STRING*, HMODULE*);
1262 NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
1263 void WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG);
1264 NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
1265 void WINAPI LdrShutdownProcess(void);
1266 void WINAPI LdrShutdownThread(void);
1267 NTSTATUS WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_MAPPING,PPRIVILEGE_SET,PULONG,PULONG,PBOOLEAN);
1268 NTSTATUS WINAPI NtAdjustGroupsToken(HANDLE,BOOLEAN,PTOKEN_GROUPS,ULONG,PTOKEN_GROUPS,PULONG);
1269 NTSTATUS WINAPI NtAdjustPrivilegesToken(HANDLE,BOOLEAN,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
1270 NTSTATUS WINAPI NtAlertThread(HANDLE ThreadHandle);
1271 NTSTATUS WINAPI NtAllocateVirtualMemory(HANDLE,PVOID*,ULONG,ULONG*,ULONG,ULONG);
1272 NTSTATUS WINAPI NtCancelIoFile(HANDLE,PIO_STATUS_BLOCK);
1273 NTSTATUS WINAPI NtCancelTimer(HANDLE, BOOLEAN*);
1274 NTSTATUS WINAPI NtClearEvent(HANDLE);
1275 NTSTATUS WINAPI NtClose(HANDLE);
1276 NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1277 NTSTATUS WINAPI NtCreateFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,PLARGE_INTEGER,ULONG,ULONG,ULONG,ULONG,PVOID,ULONG);
1278 NTSTATUS WINAPI NtCreateIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,ULONG);
1279 NTSTATUS WINAPI NtCreateKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
1280 NTSTATUS WINAPI NtCreateNamedPipeFile(PHANDLE,ULONG,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,PLARGE_INTEGER);
1281 NTSTATUS WINAPI NtCreateSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
1282 NTSTATUS WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,ULONG);
1283 NTSTATUS WINAPI NtCreateTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*, TIMER_TYPE);
1284 NTSTATUS WINAPI NtDelayExecution(BOOLEAN,const LARGE_INTEGER*);
1285 NTSTATUS WINAPI NtDeleteFile(POBJECT_ATTRIBUTES);
1286 NTSTATUS WINAPI NtDeleteKey(HKEY);
1287 NTSTATUS WINAPI NtDeleteValueKey(HKEY,const UNICODE_STRING *);
1288 NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
1289 NTSTATUS WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
1290 NTSTATUS WINAPI NtEnumerateKey(HKEY,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1291 NTSTATUS WINAPI NtEnumerateValueKey(HKEY,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1292 NTSTATUS WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
1293 NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,ULONG);
1294 NTSTATUS WINAPI NtFlushKey(HKEY);
1295 NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,ULONG*,ULONG);
1296 NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1297 NTSTATUS WINAPI NtGetContextThread(HANDLE,CONTEXT*);
1298 NTSTATUS WINAPI NtImpersonateAnonymousToken(HANDLE);
1299 NTSTATUS WINAPI NtImpersonateClientOfPort(HANDLE,PPORT_MESSAGE);
1300 NTSTATUS WINAPI NtImpersonateThread(HANDLE,HANDLE,PSECURITY_QUALITY_OF_SERVICE);
1301 NTSTATUS WINAPI NtLoadKey(const OBJECT_ATTRIBUTES *,const OBJECT_ATTRIBUTES *);
1302 NTSTATUS WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
1303 NTSTATUS WINAPI NtLockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1304 NTSTATUS WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,ULONG,const LARGE_INTEGER*,ULONG*,SECTION_INHERIT,ULONG,ULONG);
1305 NTSTATUS WINAPI NtNotifyChangeKey(HKEY,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,BOOLEAN,PVOID,ULONG,BOOLEAN);
1306 NTSTATUS WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1307 NTSTATUS WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG);
1308 NTSTATUS WINAPI NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
1309 NTSTATUS WINAPI NtOpenKey(PHKEY,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
1310 NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
1311 NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
1312 NTSTATUS WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
1313 NTSTATUS WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
1314 NTSTATUS WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
1315 NTSTATUS WINAPI NtProtectVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG,ULONG*);
1316 NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG);
1317 NTSTATUS WINAPI NtQueueApcThread(HANDLE,PNTAPCFUNC,ULONG_PTR,ULONG_PTR,ULONG_PTR);
1318 NTSTATUS WINAPI NtQueryAttributesFile(const OBJECT_ATTRIBUTES*,FILE_BASIC_INFORMATION*);
1319 NTSTATUS WINAPI NtQueryDefaultLocale(BOOLEAN,LCID*);
1320 NTSTATUS WINAPI NtQueryDefaultUILanguage(LANGID*);
1321 NTSTATUS WINAPI NtQueryDirectoryFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
1322 NTSTATUS WINAPI NtQueryEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,BOOLEAN,PVOID,ULONG,PVOID,BOOLEAN);
1323 NTSTATUS WINAPI NtQueryFullAttributesFile(const OBJECT_ATTRIBUTES*,FILE_NETWORK_OPEN_INFORMATION*);
1324 NTSTATUS WINAPI NtQueryInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,LONG,FILE_INFORMATION_CLASS);
1325 NTSTATUS WINAPI NtQueryInformationProcess(HANDLE,PROCESSINFOCLASS,PVOID,ULONG,PULONG);
1326 NTSTATUS WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PULONG);
1327 NTSTATUS WINAPI NtQueryInformationToken(HANDLE,DWORD,LPVOID,DWORD,LPDWORD);
1328 NTSTATUS WINAPI NtQueryInstallUILanguage(LANGID*);
1329 NTSTATUS WINAPI NtQueryKey(HKEY,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
1330 NTSTATUS WINAPI NtQueryMultipleValueKey(HKEY,PVALENTW,ULONG,PVOID,ULONG,PULONG);
1331 NTSTATUS WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
1332 NTSTATUS WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG);
1333 NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
1334 NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER);
1335 NTSTATUS WINAPI NtQueryValueKey(HKEY,const UNICODE_STRING *,KEY_VALUE_INFORMATION_CLASS,void *,DWORD,DWORD *);
1336 NTSTATUS WINAPI NtQueryVirtualMemory(HANDLE,LPCVOID,MEMORY_INFORMATION_CLASS,PVOID,ULONG,ULONG*);
1337 NTSTATUS WINAPI NtQueryVolumeInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
1338 void WINAPI NtRaiseException(PEXCEPTION_RECORD,PCONTEXT,BOOL);
1339 NTSTATUS WINAPI NtReadFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,PVOID,ULONG,PLARGE_INTEGER,PULONG);
1340 NTSTATUS WINAPI NtReadVirtualMemory(HANDLE,const void*,void*,SIZE_T,SIZE_T*);
1341 NTSTATUS WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
1342 NTSTATUS WINAPI NtRemoveIoCompletion(HANDLE,PULONG,PULONG,PIO_STATUS_BLOCK,PLARGE_INTEGER);
1343 NTSTATUS WINAPI NtReplaceKey(POBJECT_ATTRIBUTES,HKEY,POBJECT_ATTRIBUTES);
1344 NTSTATUS WINAPI NtResetEvent(HANDLE,PULONG);
1345 NTSTATUS WINAPI NtRestoreKey(HKEY,HANDLE,ULONG);
1346 NTSTATUS WINAPI NtResumeThread(HANDLE,PULONG);
1347 NTSTATUS WINAPI NtSaveKey(HKEY,HANDLE);
1348 NTSTATUS WINAPI NtSetContextThread(HANDLE,const CONTEXT*);
1349 NTSTATUS WINAPI NtSetDefaultLocale(BOOLEAN,LCID);
1350 NTSTATUS WINAPI NtSetDefaultUILanguage(LANGID);
1351 NTSTATUS WINAPI NtSetEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG);
1352 NTSTATUS WINAPI NtSetEvent(HANDLE,PULONG);
1353 NTSTATUS WINAPI NtSetInformationFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FILE_INFORMATION_CLASS);
1354 NTSTATUS WINAPI NtSetInformationKey(HKEY,const int,PVOID,ULONG);
1355 NTSTATUS WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
1356 NTSTATUS WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
1357 NTSTATUS WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG);
1358 NTSTATUS WINAPI NtSetIoCompletion(HANDLE,ULONG,ULONG,NTSTATUS,ULONG);
1359 NTSTATUS WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1360 NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*);
1361 NTSTATUS WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMERAPCROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);
1362 NTSTATUS WINAPI NtSetValueKey(HKEY,const UNICODE_STRING *,ULONG,ULONG,const void *,ULONG);
1363 NTSTATUS WINAPI NtSuspendThread(HANDLE,PULONG);
1364 NTSTATUS WINAPI NtTerminateProcess(HANDLE,LONG);
1365 NTSTATUS WINAPI NtTerminateThread(HANDLE,LONG);
1366 NTSTATUS WINAPI NtUnloadKey(HKEY);
1367 NTSTATUS WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG);
1368 NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
1369 NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PVOID);
1370 NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*);
1371 NTSTATUS WINAPI NtWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
1372 NTSTATUS WINAPI NtWriteFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,const void*,ULONG,PLARGE_INTEGER,PULONG);
1373 NTSTATUS WINAPI NtWriteVirtualMemory(HANDLE,void*,const void*,SIZE_T,SIZE_T*);
1374 NTSTATUS WINAPI NtYieldExecution(void);
1376 void WINAPI RtlAcquirePebLock(void);
1377 BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK,BYTE);
1378 BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK,BYTE);
1379 NTSTATUS WINAPI RtlAddAce(PACL,DWORD,DWORD,PACE_HEADER,DWORD);
1380 NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
1381 NTSTATUS WINAPI RtlAddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1382 NTSTATUS WINAPI RtlAddAccessDeniedAce(PACL,DWORD,DWORD,PSID);
1383 NTSTATUS WINAPI RtlAddAccessDeniedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
1384 PVOID WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTION_HANDLER);
1385 DWORD WINAPI RtlAdjustPrivilege(DWORD,DWORD,DWORD,DWORD);
1386 BOOLEAN WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
1387 PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,ULONG);
1388 DWORD WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
1389 NTSTATUS WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
1390 NTSTATUS WINAPI RtlAppendAsciizToString(STRING *,LPCSTR);
1391 NTSTATUS WINAPI RtlAppendStringToString(STRING *,const STRING *);
1392 NTSTATUS WINAPI RtlAppendUnicodeStringToString(UNICODE_STRING *,const UNICODE_STRING *);
1393 NTSTATUS WINAPI RtlAppendUnicodeToString(UNICODE_STRING *,LPCWSTR);
1394 BOOLEAN WINAPI RtlAreAllAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1395 BOOLEAN WINAPI RtlAreAnyAccessesGranted(ACCESS_MASK,ACCESS_MASK);
1396 BOOLEAN WINAPI RtlAreBitsSet(PCRTL_BITMAP,ULONG,ULONG);
1397 BOOLEAN WINAPI RtlAreBitsClear(PCRTL_BITMAP,ULONG,ULONG);
1399 NTSTATUS WINAPI RtlCharToInteger(PCSZ,ULONG,PULONG);
1400 void WINAPI RtlClearAllBits(PRTL_BITMAP);
1401 void WINAPI RtlClearBits(PRTL_BITMAP,ULONG,ULONG);
1402 ULONG WINAPI RtlCompactHeap(HANDLE,ULONG);
1403 LONG WINAPI RtlCompareString(const STRING*,const STRING*,BOOLEAN);
1404 LONG WINAPI RtlCompareUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1405 DWORD WINAPI RtlComputeCrc32(DWORD,PBYTE,INT);
1406 NTSTATUS WINAPI RtlConvertSidToUnicodeString(PUNICODE_STRING,PSID,BOOLEAN);
1407 LONGLONG WINAPI RtlConvertLongToLargeInteger(LONG);
1408 ULONGLONG WINAPI RtlConvertUlongToLargeInteger(ULONG);
1409 void WINAPI RtlCopyLuid(PLUID,const LUID*);
1410 void WINAPI RtlCopyLuidAndAttributesArray(ULONG,const LUID_AND_ATTRIBUTES*,PLUID_AND_ATTRIBUTES);
1411 DWORD WINAPI RtlCopySid(DWORD,PSID,PSID);
1412 void WINAPI RtlCopyString(STRING*,const STRING*);
1413 void WINAPI RtlCopyUnicodeString(UNICODE_STRING*,const UNICODE_STRING*);
1414 NTSTATUS WINAPI RtlCreateAcl(PACL,DWORD,DWORD);
1415 NTSTATUS WINAPI RtlCreateEnvironment(BOOLEAN, PWSTR*);
1416 HANDLE WINAPI RtlCreateHeap(ULONG,PVOID,ULONG,ULONG,PVOID,PRTL_HEAP_DEFINITION);
1417 NTSTATUS WINAPI RtlCreateProcessParameters(RTL_USER_PROCESS_PARAMETERS**,const UNICODE_STRING*,
1418 const UNICODE_STRING*,const UNICODE_STRING*,
1419 const UNICODE_STRING*,PWSTR,const UNICODE_STRING*,
1420 const UNICODE_STRING*,const UNICODE_STRING*,
1421 const UNICODE_STRING*);
1422 NTSTATUS WINAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
1423 BOOLEAN WINAPI RtlCreateUnicodeString(PUNICODE_STRING,LPCWSTR);
1424 BOOLEAN WINAPI RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING,LPCSTR);
1425 NTSTATUS WINAPI RtlCreateUserThread(HANDLE,const SECURITY_DESCRIPTOR*,BOOLEAN,PVOID,SIZE_T,SIZE_T,PRTL_THREAD_START_ROUTINE,void*,HANDLE*,CLIENT_ID*);
1427 NTSTATUS WINAPI RtlDeleteAce(PACL,DWORD);
1428 NTSTATUS WINAPI RtlDeleteCriticalSection(RTL_CRITICAL_SECTION *);
1429 void WINAPI RtlDeleteResource(LPRTL_RWLOCK);
1430 DWORD WINAPI RtlDeleteSecurityObject(DWORD);
1431 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlDeNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
1432 NTSTATUS WINAPI RtlDestroyEnvironment(PWSTR);
1433 HANDLE WINAPI RtlDestroyHeap(HANDLE);
1434 void WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*);
1435 DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR);
1436 BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR);
1437 BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR,PUNICODE_STRING,PWSTR*,CURDIR*);
1438 ULONG WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*);
1439 WCHAR WINAPI RtlDowncaseUnicodeChar(WCHAR);
1440 NTSTATUS WINAPI RtlDowncaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1441 void WINAPI RtlDumpResource(LPRTL_RWLOCK);
1442 NTSTATUS WINAPI RtlDuplicateUnicodeString(int,const UNICODE_STRING*,UNICODE_STRING*);
1444 LONGLONG WINAPI RtlEnlargedIntegerMultiply(INT,INT);
1445 ULONGLONG WINAPI RtlEnlargedUnsignedMultiply(UINT,UINT);
1446 UINT WINAPI RtlEnlargedUnsignedDivide(ULONGLONG,UINT,UINT *);
1447 NTSTATUS WINAPI RtlEnterCriticalSection(RTL_CRITICAL_SECTION *);
1448 void WINAPI RtlEraseUnicodeString(UNICODE_STRING*);
1449 NTSTATUS WINAPI RtlEqualComputerName(const UNICODE_STRING*,const UNICODE_STRING*);
1450 NTSTATUS WINAPI RtlEqualDomainName(const UNICODE_STRING*,const UNICODE_STRING*);
1451 BOOLEAN WINAPI RtlEqualLuid(const LUID*,const LUID*);
1452 BOOL WINAPI RtlEqualPrefixSid(PSID,PSID);
1453 BOOL WINAPI RtlEqualSid(PSID,PSID);
1454 BOOLEAN WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN);
1455 BOOLEAN WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1456 NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*);
1457 LONGLONG WINAPI RtlExtendedMagicDivide(LONGLONG,LONGLONG,INT);
1458 LONGLONG WINAPI RtlExtendedIntegerMultiply(LONGLONG,INT);
1459 LONGLONG WINAPI RtlExtendedLargeIntegerDivide(LONGLONG,INT,INT *);
1461 NTSTATUS WINAPI RtlFindCharInUnicodeString(int,const UNICODE_STRING*,const UNICODE_STRING*,USHORT*);
1462 ULONG WINAPI RtlFindClearBits(PCRTL_BITMAP,ULONG,ULONG);
1463 ULONG WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP,ULONG,ULONG);
1464 ULONG WINAPI RtlFindClearRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
1465 ULONG WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
1466 ULONG WINAPI RtlFindLastBackwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
1467 CCHAR WINAPI RtlFindLeastSignificantBit(ULONGLONG);
1468 ULONG WINAPI RtlFindLongestRunSet(PCRTL_BITMAP,PULONG);
1469 ULONG WINAPI RtlFindLongestRunClear(PCRTL_BITMAP,PULONG);
1470 NTSTATUS WINAPI RtlFindMessage(HMODULE,ULONG,ULONG,ULONG,const MESSAGE_RESOURCE_ENTRY**);
1471 CCHAR WINAPI RtlFindMostSignificantBit(ULONGLONG);
1472 ULONG WINAPI RtlFindNextForwardRunSet(PCRTL_BITMAP,ULONG,PULONG);
1473 ULONG WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP,ULONG,PULONG);
1474 ULONG WINAPI RtlFindSetBits(PCRTL_BITMAP,ULONG,ULONG);
1475 ULONG WINAPI RtlFindSetBitsAndClear(PRTL_BITMAP,ULONG,ULONG);
1476 ULONG WINAPI RtlFindSetRuns(PCRTL_BITMAP,PRTL_BITMAP_RUN,ULONG,BOOLEAN);
1477 BOOLEAN WINAPI RtlFirstFreeAce(PACL,PACE_HEADER *);
1478 NTSTATUS WINAPI RtlFormatCurrentUserKeyPath(PUNICODE_STRING);
1479 NTSTATUS WINAPI RtlFormatMessage(LPWSTR,UCHAR,BOOLEAN,BOOLEAN,BOOLEAN,va_list *,LPWSTR,ULONG);
1480 void WINAPI RtlFreeAnsiString(PANSI_STRING);
1481 BOOLEAN WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
1482 void WINAPI RtlFreeOemString(POEM_STRING);
1483 DWORD WINAPI RtlFreeSid(PSID);
1484 void WINAPI RtlFreeUnicodeString(PUNICODE_STRING);
1486 DWORD WINAPI RtlGetAce(PACL,DWORD,LPVOID *);
1487 NTSTATUS WINAPI RtlGetControlSecurityDescriptor(PSECURITY_DESCRIPTOR, PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
1488 NTSTATUS WINAPI RtlGetCurrentDirectory_U(ULONG, LPWSTR);
1489 NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
1490 ULONG WINAPI RtlGetFullPathName_U(PCWSTR,ULONG,PWSTR,PWSTR*);
1491 NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
1492 DWORD WINAPI RtlGetLastWin32Error(void);
1493 DWORD WINAPI RtlGetLongestNtPathLength(void);
1494 BOOLEAN WINAPI RtlGetNtProductType(LPDWORD);
1495 NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN);
1496 ULONG WINAPI RtlGetProcessHeaps(ULONG,HANDLE*);
1497 NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN);
1498 NTSTATUS WINAPI RtlGetVersion(RTL_OSVERSIONINFOEXW*);
1500 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(PSID);
1501 PVOID WINAPI RtlImageDirectoryEntryToData(HMODULE,BOOL,WORD,ULONG *);
1502 PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE);
1503 PIMAGE_SECTION_HEADER WINAPI RtlImageRvaToSection(const IMAGE_NT_HEADERS *,HMODULE,DWORD);
1504 PVOID WINAPI RtlImageRvaToVa(const IMAGE_NT_HEADERS *,HMODULE,DWORD,IMAGE_SECTION_HEADER **);
1505 BOOL WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
1506 void WINAPI RtlInitString(PSTRING,PCSZ);
1507 void WINAPI RtlInitAnsiString(PANSI_STRING,PCSZ);
1508 void WINAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
1509 NTSTATUS WINAPI RtlInitUnicodeStringEx(PUNICODE_STRING,PCWSTR);
1510 NTSTATUS WINAPI RtlInitializeCriticalSection(RTL_CRITICAL_SECTION *);
1511 NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount(RTL_CRITICAL_SECTION *,DWORD);
1512 void WINAPI RtlInitializeBitMap(PRTL_BITMAP,PULONG,ULONG);
1513 void WINAPI RtlInitializeResource(LPRTL_RWLOCK);
1514 BOOL WINAPI RtlInitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
1516 NTSTATUS WINAPI RtlInt64ToUnicodeString(ULONGLONG,ULONG,UNICODE_STRING *);
1517 NTSTATUS WINAPI RtlIntegerToChar(ULONG,ULONG,ULONG,PCHAR);
1518 NTSTATUS WINAPI RtlIntegerToUnicodeString(ULONG,ULONG,UNICODE_STRING *);
1519 ULONG WINAPI RtlIsDosDeviceName_U(PCWSTR);
1520 BOOLEAN WINAPI RtlIsNameLegalDOS8Dot3(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
1521 DWORD WINAPI RtlIsTextUnicode(LPVOID,DWORD,DWORD *);
1523 LONGLONG WINAPI RtlLargeIntegerAdd(LONGLONG,LONGLONG);
1524 LONGLONG WINAPI RtlLargeIntegerArithmeticShift(LONGLONG,INT);
1525 ULONGLONG WINAPI RtlLargeIntegerDivide( ULONGLONG,ULONGLONG,ULONGLONG *);
1526 LONGLONG WINAPI RtlLargeIntegerNegate(LONGLONG);
1527 LONGLONG WINAPI RtlLargeIntegerShiftLeft(LONGLONG,INT);
1528 LONGLONG WINAPI RtlLargeIntegerShiftRight(LONGLONG,INT);
1529 LONGLONG WINAPI RtlLargeIntegerSubtract(LONGLONG,LONGLONG);
1530 NTSTATUS WINAPI RtlLargeIntegerToChar(const ULONGLONG *,ULONG,ULONG,PCHAR);
1531 NTSTATUS WINAPI RtlLeaveCriticalSection(RTL_CRITICAL_SECTION *);
1532 DWORD WINAPI RtlLengthRequiredSid(DWORD);
1533 ULONG WINAPI RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR);
1534 DWORD WINAPI RtlLengthSid(PSID);
1535 NTSTATUS WINAPI RtlLocalTimeToSystemTime(const LARGE_INTEGER*,PLARGE_INTEGER);
1536 BOOLEAN WINAPI RtlLockHeap(HANDLE);
1538 NTSTATUS WINAPI RtlMakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
1539 void WINAPI RtlMapGenericMask(PACCESS_MASK,const GENERIC_MAPPING*);
1540 NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
1541 NTSTATUS WINAPI RtlMultiByteToUnicodeSize(DWORD*,LPCSTR,UINT);
1543 DWORD WINAPI RtlNewSecurityObject(DWORD,DWORD,DWORD,DWORD,DWORD,DWORD);
1544 PRTL_USER_PROCESS_PARAMETERS WINAPI RtlNormalizeProcessParams(RTL_USER_PROCESS_PARAMETERS*);
1545 ULONG WINAPI RtlNtStatusToDosError(NTSTATUS);
1546 ULONG WINAPI RtlNtStatusToDosErrorNoTeb(NTSTATUS);
1547 ULONG WINAPI RtlNumberOfSetBits(PCRTL_BITMAP);
1548 ULONG WINAPI RtlNumberOfClearBits(PCRTL_BITMAP);
1550 UINT WINAPI RtlOemStringToUnicodeSize(const STRING*);
1551 NTSTATUS WINAPI RtlOemStringToUnicodeString(UNICODE_STRING*,const STRING*,BOOLEAN);
1552 NTSTATUS WINAPI RtlOemToUnicodeN(LPWSTR,DWORD,LPDWORD,LPCSTR,DWORD);
1553 DWORD WINAPI RtlOpenCurrentUser(ACCESS_MASK,PHKEY);
1555 BOOLEAN WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN);
1556 BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN);
1558 NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR,PUNICODE_STRING,PUNICODE_STRING);
1559 NTSTATUS WINAPI RtlQueryInformationAcl(PACL,LPVOID,DWORD,ACL_INFORMATION_CLASS);
1560 NTSTATUS WINAPI RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION);
1562 void WINAPI RtlRaiseException(PEXCEPTION_RECORD);
1563 void WINAPI RtlRaiseStatus(NTSTATUS);
1564 ULONG WINAPI RtlRandom(PULONG);
1565 PVOID WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,ULONG);
1566 void WINAPI RtlReleasePebLock(void);
1567 void WINAPI RtlReleaseResource(LPRTL_RWLOCK);
1568 ULONG WINAPI RtlRemoveVectoredExceptionHandler(PVOID);
1569 void WINAPI RtlRestoreLastWin32Error(DWORD);
1571 void WINAPI RtlSecondsSince1970ToTime(DWORD,LARGE_INTEGER *);
1572 void WINAPI RtlSecondsSince1980ToTime(DWORD,LARGE_INTEGER *);
1573 NTSTATUS WINAPI RtlSelfRelativeToAbsoluteSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,
1574 PDWORD,PACL,PDWORD,PACL,PDWORD,PSID,PDWORD,PSID,PDWORD);
1575 void WINAPI RtlSetAllBits(PRTL_BITMAP);
1576 void WINAPI RtlSetBits(PRTL_BITMAP,ULONG,ULONG);
1577 ULONG WINAPI RtlSetCriticalSectionSpinCount(RTL_CRITICAL_SECTION*,ULONG);
1578 NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING*);
1579 void WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR*);
1580 NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
1581 NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR*,PUNICODE_STRING,PUNICODE_STRING);
1582 NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
1583 NTSTATUS WINAPI RtlSetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID,BOOLEAN);
1584 void WINAPI RtlSetLastWin32Error(DWORD);
1585 NTSTATUS WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN);
1586 NTSTATUS WINAPI RtlSetTimeZoneInformation(const TIME_ZONE_INFORMATION*);
1587 ULONG WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
1588 LPDWORD WINAPI RtlSubAuthoritySid(PSID,DWORD);
1589 LPBYTE WINAPI RtlSubAuthorityCountSid(PSID);
1590 NTSTATUS WINAPI RtlSystemTimeToLocalTime(const LARGE_INTEGER*,PLARGE_INTEGER);
1592 void WINAPI RtlTimeToTimeFields(const LARGE_INTEGER*,PTIME_FIELDS);
1593 BOOLEAN WINAPI RtlTimeFieldsToTime(PTIME_FIELDS,PLARGE_INTEGER);
1594 void WINAPI RtlTimeToElapsedTimeFields(const LARGE_INTEGER *,PTIME_FIELDS);
1595 BOOLEAN WINAPI RtlTimeToSecondsSince1970(const LARGE_INTEGER *,LPDWORD);
1596 BOOLEAN WINAPI RtlTimeToSecondsSince1980(const LARGE_INTEGER *,LPDWORD);
1597 BOOL WINAPI RtlTryEnterCriticalSection(RTL_CRITICAL_SECTION *);
1599 ULONGLONG __cdecl RtlUlonglongByteSwap(ULONGLONG);
1600 DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING*);
1601 NTSTATUS WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING,PCUNICODE_STRING,BOOLEAN);
1602 NTSTATUS WINAPI RtlUnicodeStringToInteger(const UNICODE_STRING *,ULONG,ULONG *);
1603 DWORD WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING*);
1604 NTSTATUS WINAPI RtlUnicodeStringToOemString(POEM_STRING,PCUNICODE_STRING,BOOLEAN);
1605 NTSTATUS WINAPI RtlUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1606 NTSTATUS WINAPI RtlUnicodeToMultiByteSize(PULONG,PCWSTR,ULONG);
1607 NTSTATUS WINAPI RtlUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1608 ULONG WINAPI RtlUniform(PULONG);
1609 BOOLEAN WINAPI RtlUnlockHeap(HANDLE);
1610 void WINAPI RtlUnwind(PVOID,PVOID,PEXCEPTION_RECORD,PVOID);
1611 #ifdef __ia64__
1612 void WINAPI RtlUnwind2(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT);
1613 void WINAPI RtlUnwindEx(FRAME_POINTERS,PVOID,PEXCEPTION_RECORD,PVOID,PCONTEXT,PUNWIND_HISTORY_TABLE);
1614 #endif
1615 WCHAR WINAPI RtlUpcaseUnicodeChar(WCHAR);
1616 NTSTATUS WINAPI RtlUpcaseUnicodeString(UNICODE_STRING*,const UNICODE_STRING *,BOOLEAN);
1617 NTSTATUS WINAPI RtlUpcaseUnicodeStringToAnsiString(STRING*,const UNICODE_STRING*,BOOLEAN);
1618 NTSTATUS WINAPI RtlUpcaseUnicodeStringToCountedOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
1619 NTSTATUS WINAPI RtlUpcaseUnicodeStringToOemString(STRING*,const UNICODE_STRING*,BOOLEAN);
1620 NTSTATUS WINAPI RtlUpcaseUnicodeToMultiByteN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1621 NTSTATUS WINAPI RtlUpcaseUnicodeToOemN(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
1622 CHAR WINAPI RtlUpperChar(CHAR);
1623 void WINAPI RtlUpperString(STRING *,const STRING *);
1625 NTSTATUS WINAPI RtlValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
1626 BOOLEAN WINAPI RtlValidAcl(PACL);
1627 BOOLEAN WINAPI RtlValidSid(PSID);
1628 BOOLEAN WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
1629 NTSTATUS WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
1631 NTSTATUS WINAPI RtlWalkHeap(HANDLE,PVOID);
1633 NTSTATUS WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *);
1634 NTSTATUS WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
1636 /* Wine internal functions */
1638 extern NTSTATUS wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
1639 UINT disposition, BOOLEAN check_case );
1641 /***********************************************************************
1642 * Inline functions
1645 #define InitializeObjectAttributes(p,n,a,r,s) \
1646 do { \
1647 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
1648 (p)->RootDirectory = r; \
1649 (p)->Attributes = a; \
1650 (p)->ObjectName = n; \
1651 (p)->SecurityDescriptor = s; \
1652 (p)->SecurityQualityOfService = NULL; \
1653 } while (0)
1655 #define NtCurrentProcess() ((HANDLE)-1)
1657 #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
1658 #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
1659 #define RtlStoreUlong(p,v) do { ULONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1660 #define RtlStoreUlonglong(p,v) do { ULONGLONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1661 #define RtlRetrieveUlong(p,s) memcpy((p), (s), sizeof(ULONG))
1662 #define RtlRetrieveUlonglong(p,s) memcpy((p), (s), sizeof(ULONGLONG))
1663 #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
1665 inline static BOOLEAN RtlCheckBit(PCRTL_BITMAP lpBits, ULONG ulBit)
1667 if (lpBits && ulBit < lpBits->SizeOfBitMap &&
1668 lpBits->Buffer[ulBit >> 5] & (1 << (ulBit & 31)))
1669 return TRUE;
1670 return FALSE;
1673 /* These are implemented as __fastcall, so we can't let Winelib apps link with them */
1674 inline static USHORT RtlUshortByteSwap(USHORT s)
1676 return (s >> 8) | (s << 8);
1678 inline static ULONG RtlUlongByteSwap(ULONG i)
1680 #if defined(__i386__) && defined(__GNUC__)
1681 ULONG ret;
1682 __asm__("bswap %0" : "=r" (ret) : "0" (i) );
1683 return ret;
1684 #else
1685 return ((ULONG)RtlUshortByteSwap((USHORT)i) << 16) | RtlUshortByteSwap((USHORT)(i >> 16));
1686 #endif
1689 /*************************************************************************
1690 * Loader functions and structures.
1692 * Those are not part of standard Winternl.h
1694 typedef struct _LDR_MODULE
1696 LIST_ENTRY InLoadOrderModuleList;
1697 LIST_ENTRY InMemoryOrderModuleList;
1698 LIST_ENTRY InInitializationOrderModuleList;
1699 void* BaseAddress;
1700 void* EntryPoint;
1701 ULONG SizeOfImage;
1702 UNICODE_STRING FullDllName;
1703 UNICODE_STRING BaseDllName;
1704 ULONG Flags;
1705 SHORT LoadCount;
1706 SHORT TlsIndex;
1707 HANDLE SectionHandle;
1708 ULONG CheckSum;
1709 ULONG TimeDateStamp;
1710 } LDR_MODULE, *PLDR_MODULE;
1712 /* those defines are (some of the) regular LDR_MODULE.Flags values */
1713 #define LDR_IMAGE_IS_DLL 0x00000004
1714 #define LDR_LOAD_IN_PROGRESS 0x00001000
1715 #define LDR_UNLOAD_IN_PROGRESS 0x00002000
1716 #define LDR_NO_DLL_CALLS 0x00040000
1717 #define LDR_PROCESS_ATTACHED 0x00080000
1718 #define LDR_MODULE_REBASED 0x00200000
1720 /* these ones is Wine specific */
1721 #define LDR_DONT_RESOLVE_REFS 0x40000000
1722 #define LDR_WINE_INTERNAL 0x80000000
1724 /* FIXME: to be checked */
1725 #define MAXIMUM_FILENAME_LENGTH 256
1727 typedef struct _SYSTEM_MODULE
1729 ULONG Reserved1;
1730 ULONG Reserved2;
1731 PVOID ImageBaseAddress;
1732 ULONG ImageSize;
1733 ULONG Flags;
1734 WORD Id;
1735 WORD Rank;
1736 WORD Unknown;
1737 WORD NameOffset;
1738 BYTE Name[MAXIMUM_FILENAME_LENGTH];
1739 } SYSTEM_MODULE, *PSYSTEM_MODULE;
1741 typedef struct _SYSTEM_MODULE_INFORMATION
1743 ULONG ModulesCount;
1744 SYSTEM_MODULE Modules[1]; /* FIXME: should be Modules[0] */
1745 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
1747 NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
1748 NTSTATUS WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
1749 NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
1750 NTSTATUS WINAPI LdrQueryProcessModuleInformation(SYSTEM_MODULE_INFORMATION*, ULONG, ULONG*);
1751 NTSTATUS WINAPI LdrUnloadDll(HMODULE);
1752 NTSTATUS WINAPI LdrUnlockLoaderLock(ULONG,ULONG);
1754 /* list manipulation macros */
1755 #define InitializeListHead(le) (void)((le)->Flink = (le)->Blink = (le))
1756 #define InsertHeadList(le,e) do { PLIST_ENTRY f = (le)->Flink; (e)->Flink = f; (e)->Blink = (le); f->Blink = (e); (le)->Flink = (e); } while (0)
1757 #define InsertTailList(le,e) do { PLIST_ENTRY b = (le)->Blink; (e)->Flink = (le); (e)->Blink = b; b->Flink = (e); (le)->Blink = (e); } while (0)
1758 #define IsListEmpty(le) ((le)->Flink == (le))
1759 #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)
1760 static inline PLIST_ENTRY RemoveHeadList(PLIST_ENTRY le)
1762 PLIST_ENTRY f, b, e;
1764 e = le->Flink;
1765 f = le->Flink->Flink;
1766 b = le->Flink->Blink;
1767 f->Blink = b;
1768 b->Flink = f;
1770 if (e != le) e->Flink = e->Blink = NULL;
1771 return e;
1773 static inline PLIST_ENTRY RemoveTailList(PLIST_ENTRY le)
1775 PLIST_ENTRY f, b, e;
1777 e = le->Blink;
1778 f = le->Blink->Flink;
1779 b = le->Blink->Blink;
1780 f->Blink = b;
1781 b->Flink = f;
1783 if (e != le) e->Flink = e->Blink = NULL;
1784 return e;
1787 #ifdef __cplusplus
1788 } /* extern "C" */
1789 #endif /* defined(__cplusplus) */
1791 #endif /* __WINE_WINTERNL_H */