ReactOS 0.4.16-dev-250-g3ecd236
winternl.h
Go to the documentation of this file.
1/*
2 * Internal NT APIs and data structures
3 *
4 * Copyright (C) the Wine project
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#ifndef __WINE_WINTERNL_H
22#define __WINE_WINTERNL_H
23
24#ifndef __REACTOS__
25#include <ntdef.h>
26#endif /* __REACTOS__ */
27#include <windef.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* defined(__cplusplus) */
32
33#ifdef __REACTOS__
34typedef enum _TIMER_TYPE {
38typedef enum _EVENT_TYPE {
41} EVENT_TYPE, *PEVENT_TYPE;
42#define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
43#endif /* __REACTOS__ */
44
45/**********************************************************************
46 * Fundamental types and data structures
47 */
48
49#ifndef WINE_NTSTATUS_DECLARED
50#define WINE_NTSTATUS_DECLARED
51typedef LONG NTSTATUS;
52#ifdef __REACTOS__
53typedef NTSTATUS *PNTSTATUS;
54#endif /* __REACTOS__ */
55#endif
56
57typedef const char *PCSZ;
58
59typedef short CSHORT;
60typedef CSHORT *PCSHORT;
61
62#ifndef __STRING_DEFINED__
63#define __STRING_DEFINED__
64typedef struct _STRING {
69#endif
70
73typedef const STRING *PCANSI_STRING;
74
77typedef const STRING *PCOEM_STRING;
78
79#ifndef __UNICODE_STRING_DEFINED__
80#define __UNICODE_STRING_DEFINED__
81typedef struct _UNICODE_STRING {
82 USHORT Length; /* bytes */
83 USHORT MaximumLength; /* bytes */
86#endif
87
89
90#ifndef _FILETIME_
91#define _FILETIME_
92/* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */
93typedef struct _FILETIME
94{
95#ifdef WORDS_BIGENDIAN
98#else
101#endif
103#endif /* _FILETIME_ */
104
105#if 0
106/*
107 * RTL_SYSTEM_TIME and RTL_TIME_ZONE_INFORMATION are the same as
108 * the SYSTEMTIME and TIME_ZONE_INFORMATION structures defined
109 * in winbase.h, however we need to define them separately so
110 * winternl.h doesn't depend on winbase.h. They are used by
111 * RtlQueryTimeZoneInformation and RtlSetTimeZoneInformation.
112 * The names are guessed; if anybody knows the real names, let me know.
113 */
114typedef struct _RTL_SYSTEM_TIME {
115 WORD wYear;
116 WORD wMonth;
117 WORD wDayOfWeek;
118 WORD wDay;
119 WORD wHour;
120 WORD wMinute;
121 WORD wSecond;
122 WORD wMilliseconds;
123} RTL_SYSTEM_TIME, *PRTL_SYSTEM_TIME;
124#endif
125
126typedef struct _TIME_FIELDS {
127 CSHORT Year;
129 CSHORT Day;
130 CSHORT Hour;
136
137typedef struct _RTL_TIME_ZONE_INFORMATION {
138 LONG Bias;
146
148{
159
160typedef struct _CLIENT_ID
161{
165
166typedef struct _CURDIR
167{
171
173{
179
180typedef struct tagRTL_BITMAP {
181 ULONG SizeOfBitMap; /* Number of bits in the bitmap */
182 PULONG Buffer; /* Bitmap data, assumed sized to a DWORD boundary */
184
186
187typedef struct tagRTL_BITMAP_RUN {
188 ULONG StartingIndex; /* Bit position at which run starts */
189 ULONG NumberOfBits; /* Size of the run in bits */
191
193
194typedef struct _RTL_USER_PROCESS_PARAMETERS
195{
198 ULONG Flags;
225
226/* value for Flags field (FIXME: not the correct name) */
227#define PROCESS_PARAMS_FLAG_NORMALIZED 1
228
229typedef struct _PEB_LDR_DATA
230{
239
240typedef struct _GDI_TEB_BATCH
241{
243 HANDLE HDC;
244 ULONG Buffer[0x136];
246
248{
253
254typedef struct _ACTIVATION_CONTEXT_STACK
255{
256 ULONG Flags;
261
262typedef struct _TEB_ACTIVE_FRAME_CONTEXT
263{
264 ULONG Flags;
265 const char *FrameName;
267
268typedef struct _TEB_ACTIVE_FRAME_CONTEXT_EX
269{
271 const char *SourceLocation;
273
274typedef struct _TEB_ACTIVE_FRAME
275{
276 ULONG Flags;
280
281typedef struct _TEB_ACTIVE_FRAME_EX
282{
286
287#define TEB_ACTIVE_FRAME_CONTEXT_FLAG_EXTENDED 0x00000001
288#define TEB_ACTIVE_FRAME_FLAG_EXTENDED 0x00000001
289
290/***********************************************************************
291 * PEB data structure
292 */
293typedef struct _PEB
294{ /* win32/win64 */
295 BOOLEAN InheritedAddressSpace; /* 000/000 */
296 BOOLEAN ReadImageFileExecOptions; /* 001/001 */
297 BOOLEAN BeingDebugged; /* 002/002 */
298 BOOLEAN SpareBool; /* 003/003 */
299 HANDLE Mutant; /* 004/008 */
301 PPEB_LDR_DATA LdrData; /* 00c/018 */
303 PVOID SubSystemData; /* 014/028 */
304 HANDLE ProcessHeap; /* 018/030 */
306 PVOID /*PPEBLOCKROUTINE*/ FastPebLockRoutine; /* 020/040 */
307 PVOID /*PPEBLOCKROUTINE*/ FastPebUnlockRoutine; /* 024/048 */
308 ULONG EnvironmentUpdateCount; /* 028/050 */
309 PVOID KernelCallbackTable; /* 02c/058 */
310 ULONG Reserved[2]; /* 030/060 */
311 PVOID /*PPEB_FREE_BLOCK*/ FreeList; /* 038/068 */
312 ULONG TlsExpansionCounter; /* 03c/070 */
313 PRTL_BITMAP TlsBitmap; /* 040/078 */
314 ULONG TlsBitmapBits[2]; /* 044/080 */
315 PVOID ReadOnlySharedMemoryBase; /* 04c/088 */
316 PVOID ReadOnlySharedMemoryHeap; /* 050/090 */
317 PVOID *ReadOnlyStaticServerData; /* 054/098 */
318 PVOID AnsiCodePageData; /* 058/0a0 */
319 PVOID OemCodePageData; /* 05c/0a8 */
320 PVOID UnicodeCaseTableData; /* 060/0b0 */
321 ULONG NumberOfProcessors; /* 064/0b8 */
322 ULONG NtGlobalFlag; /* 068/0bc */
328 ULONG NumberOfHeaps; /* 088/0e8 */
329 ULONG MaximumNumberOfHeaps; /* 08c/0ec */
330 PVOID *ProcessHeaps; /* 090/0f0 */
331 PVOID GdiSharedHandleTable; /* 094/0f8 */
332 PVOID ProcessStarterHelper; /* 098/100 */
333 PVOID GdiDCAttributeList; /* 09c/108 */
334 PVOID LoaderLock; /* 0a0/110 */
335 ULONG OSMajorVersion; /* 0a4/118 */
336 ULONG OSMinorVersion; /* 0a8/11c */
337 ULONG OSBuildNumber; /* 0ac/120 */
338 ULONG OSPlatformId; /* 0b0/124 */
339 ULONG ImageSubSystem; /* 0b4/128 */
342 ULONG ImageProcessAffinityMask; /* 0c0/134 */
343 HANDLE GdiHandleBuffer[28]; /* 0c4/138 */
344 ULONG unknown[6]; /* 134/218 */
347 ULONG TlsExpansionBitmapBits[32]; /* 154/240 */
348 ULONG SessionId; /* 1d4/2c0 */
351 PVOID ShimData; /* 1e8/2d8 */
352 PVOID AppCompatInfo; /* 1ec/2e0 */
359 PVOID *FlsCallback; /* 20c/320 */
360 LIST_ENTRY FlsListHead; /* 210/328 */
361 PRTL_BITMAP FlsBitmap; /* 218/338 */
362 ULONG FlsBitmapBits[4]; /* 21c/340 */
364
365
366/***********************************************************************
367 * TEB data structure
368 */
369typedef struct _TEB
370{ /* win32/win64 */
371 NT_TIB Tib; /* 000/0000 */
372 PVOID EnvironmentPointer; /* 01c/0038 */
373 CLIENT_ID ClientId; /* 020/0040 */
374 PVOID ActiveRpcHandle; /* 028/0050 */
375 PVOID ThreadLocalStoragePointer; /* 02c/0058 */
376 PPEB Peb; /* 030/0060 */
377 ULONG LastErrorValue; /* 034/0068 */
378 ULONG CountOfOwnedCriticalSections; /* 038/006c */
379 PVOID CsrClientThread; /* 03c/0070 */
380 PVOID Win32ThreadInfo; /* 040/0078 */
381 ULONG Win32ClientInfo[31]; /* 044/0080 used for user32 private data in Wine */
382 PVOID WOW32Reserved; /* 0c0/0100 used for ntdll syscall thunks */
383 ULONG CurrentLocale; /* 0c4/0108 */
384 ULONG FpSoftwareStatusRegister; /* 0c8/010c */
385 PVOID SystemReserved1[54]; /* 0cc/0110 used for krnl386.exe16 private data in Wine */
386 LONG ExceptionCode; /* 1a4/02c0 */
388 BYTE SpareBytes1[24]; /* 1bc/02e8 */
389 PVOID SystemReserved2[10]; /* 1d4/0300 used for ntdll platform-specific private data in Wine */
390 GDI_TEB_BATCH GdiTebBatch; /* 1fc/0350 used for ntdll private data in Wine */
391 HANDLE gdiRgn; /* 6dc/0838 */
392 HANDLE gdiPen; /* 6e0/0840 */
393 HANDLE gdiBrush; /* 6e4/0848 */
394 CLIENT_ID RealClientId; /* 6e8/0850 */
395 HANDLE GdiCachedProcessHandle; /* 6f0/0860 */
396 ULONG GdiClientPID; /* 6f4/0868 */
397 ULONG GdiClientTID; /* 6f8/086c */
398 PVOID GdiThreadLocaleInfo; /* 6fc/0870 */
399 ULONG UserReserved[5]; /* 700/0878 */
400 PVOID glDispatchTable[280]; /* 714/0890 */
401 PVOID glReserved1[26]; /* b74/1150 */
402 PVOID glReserved2; /* bdc/1220 */
403 PVOID glSectionInfo; /* be0/1228 */
404 PVOID glSection; /* be4/1230 */
405 PVOID glTable; /* be8/1238 */
406 PVOID glCurrentRC; /* bec/1240 */
407 PVOID glContext; /* bf0/1248 */
408 ULONG LastStatusValue; /* bf4/1250 */
409 UNICODE_STRING StaticUnicodeString; /* bf8/1258 used by advapi32 */
410 WCHAR StaticUnicodeBuffer[261]; /* c00/1268 used by advapi32 */
411 PVOID DeallocationStack; /* e0c/1478 */
412 PVOID TlsSlots[64]; /* e10/1480 */
413 LIST_ENTRY TlsLinks; /* f10/1680 */
414 PVOID Vdm; /* f18/1690 */
415 PVOID ReservedForNtRpc; /* f1c/1698 */
416 PVOID DbgSsReserved[2]; /* f20/16a0 */
417 ULONG HardErrorDisabled; /* f28/16b0 */
418 PVOID Instrumentation[16]; /* f2c/16b8 */
419 PVOID WinSockData; /* f6c/1738 */
420 ULONG GdiBatchCount; /* f70/1740 */
421 ULONG Spare2; /* f74/1744 */
422 PVOID Spare3; /* f78/1748 used for fakedll thunks */
423 PVOID Spare4; /* f7c/1750 */
424 PVOID ReservedForOle; /* f80/1758 */
425 ULONG WaitingOnLoaderLock; /* f84/1760 */
426 PVOID Reserved5[3]; /* f88/1768 used for x86_64 OSX and wineserver shared memory */
427 PVOID *TlsExpansionSlots; /* f94/1780 */
428#ifdef _WIN64
429 PVOID DeallocationBStore; /* /1788 */
430 PVOID BStoreLimit; /* /1790 */
431#endif
433 ULONG IsImpersonating; /* f9c/179c */
434 PVOID NlsCache; /* fa0/17a0 */
435 PVOID ShimData; /* fa4/17a8 */
439 PVOID *FlsSlots; /* fb4/17c8 */
441
442/***********************************************************************
443 * Enums
444 */
445
512
526
542
558
576
594
611
612typedef struct _FILE_BASIC_INFORMATION {
619
620typedef struct _FILE_STANDARD_INFORMATION {
627
628typedef struct _FILE_INTERNAL_INFORMATION {
631
632typedef struct _FILE_ID_128 {
633 UCHAR Identifier[16];
635
636typedef struct _FILE_ID_INFORMATION {
640
641typedef struct _FILE_EA_INFORMATION {
644
645typedef struct _FILE_ACCESS_INFORMATION {
648
653
660
661typedef struct _FILE_LINK_INFORMATION {
665 WCHAR FileName[1];
667
668typedef struct _FILE_NAMES_INFORMATION {
672 WCHAR FileName[1];
674
675typedef struct _FILE_DISPOSITION_INFORMATION {
678
679typedef struct _FILE_POSITION_INFORMATION {
682
683typedef struct _FILE_ALIGNMENT_INFORMATION {
686
690
691typedef struct _FILE_END_OF_FILE_INFORMATION {
694
695typedef struct _FILE_NETWORK_OPEN_INFORMATION {
704
705typedef struct _FILE_FULL_EA_INFORMATION {
707 UCHAR Flags;
710 CHAR EaName[1];
712
716
718{
725
727{
731
739
743
748
761
765 union {
766 struct {
774
784
789
790#define FILE_PIPE_DISCONNECTED_STATE 0x01
791#define FILE_PIPE_LISTENING_STATE 0x02
792#define FILE_PIPE_CONNECTED_STATE 0x03
793#define FILE_PIPE_CLOSING_STATE 0x04
794
795typedef struct _FILE_ALL_INFORMATION {
806
810
811#define FILE_SKIP_COMPLETION_PORT_ON_SUCCESS 0x1
812#define FILE_SKIP_SET_EVENT_ON_HANDLE 0x2
813#define FILE_SKIP_SET_USER_EVENT_ON_FAST_IO 0x4
814
815typedef enum _FSINFOCLASS {
826
838
846
854
855typedef enum _PROCESSINFOCLASS {
908
909#define MEM_EXECUTE_OPTION_DISABLE 0x01
910#define MEM_EXECUTE_OPTION_ENABLE 0x02
911#define MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION 0x04
912#define MEM_EXECUTE_OPTION_PERMANENT 0x08
913
914typedef enum _SECTION_INHERIT {
916 ViewUnmap = 2
918
923 SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
1004
1005typedef enum _THREADINFOCLASS {
1042
1043typedef struct _THREAD_BASIC_INFORMATION
1044{
1052
1054{
1058
1059typedef struct _KERNEL_USER_TIMES {
1065
1069
1076
1078{
1081
1083{
1086
1087typedef struct _MUTANT_BASIC_INFORMATION {
1092
1094{
1097
1098typedef struct _TIMER_BASIC_INFORMATION
1099{
1103
1104
1105/* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
1106typedef enum
1107{
1109 UNC_PATH, /* "//foo" */
1110 ABSOLUTE_DRIVE_PATH, /* "c:/foo" */
1111 RELATIVE_DRIVE_PATH, /* "c:foo" */
1112 ABSOLUTE_PATH, /* "/foo" */
1113 RELATIVE_PATH, /* "foo" */
1114 DEVICE_PATH, /* "//./foo" */
1115 UNC_DOT_PATH /* "//." */
1117
1118
1119/***********************************************************************
1120 * Types and data structures
1121 */
1122
1123/* This is used by NtQuerySystemInformation */
1124typedef struct _SYSTEM_THREAD_INFORMATION
1125{ /* win32/win64 */
1126 LARGE_INTEGER KernelTime; /* 00/00 */
1127 LARGE_INTEGER UserTime; /* 08/08 */
1128 LARGE_INTEGER CreateTime; /* 10/10 */
1129 DWORD dwTickCount; /* 18/18 */
1131 CLIENT_ID ClientId; /* 20/28 */
1136 DWORD dwWaitReason; /* 38/48 */
1137 DWORD dwUnknown; /* 3c/4c */
1139
1140typedef struct _IO_STATUS_BLOCK {
1141 union {
1143 PVOID Pointer;
1145
1148
1150
1151typedef struct _KEY_BASIC_INFORMATION {
1155 WCHAR Name[1];
1157
1158typedef struct _KEY_NODE_INFORMATION
1159{
1165 WCHAR Name[1];
1166 /* Class[1]; */
1168
1169typedef struct _KEY_FULL_INFORMATION
1170{
1175 ULONG SubKeys;
1178 ULONG Values;
1181 WCHAR Class[1];
1183
1188
1190{
1200
1201typedef struct _KEY_VALUE_ENTRY
1202{
1206 ULONG Type;
1208
1209typedef struct _KEY_VALUE_BASIC_INFORMATION {
1211 ULONG Type;
1213 WCHAR Name[1];
1215
1216typedef struct _KEY_VALUE_FULL_INFORMATION {
1218 ULONG Type;
1222 WCHAR Name[1];
1224
1225typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
1227 ULONG Type;
1229 UCHAR Data[1];
1231
1232#ifndef __OBJECT_ATTRIBUTES_DEFINED__
1233#define __OBJECT_ATTRIBUTES_DEFINED__
1234typedef struct _OBJECT_ATTRIBUTES {
1235 ULONG Length;
1239 PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */
1240 PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
1242#endif
1243
1248
1262
1263typedef struct _OBJECT_NAME_INFORMATION {
1266
1292
1294{
1297
1298typedef struct _PROCESS_BASIC_INFORMATION {
1299#ifdef __WINESRC__
1306#else
1309 PVOID Reserved2[2];
1312#endif
1314
1315#define PROCESS_PRIOCLASS_IDLE 1
1316#define PROCESS_PRIOCLASS_NORMAL 2
1317#define PROCESS_PRIOCLASS_HIGH 3
1318#define PROCESS_PRIOCLASS_REALTIME 4
1319#define PROCESS_PRIOCLASS_BELOW_NORMAL 5
1320#define PROCESS_PRIOCLASS_ABOVE_NORMAL 6
1321
1322typedef struct _PROCESS_PRIORITY_CLASS {
1326
1327typedef struct _RTL_HEAP_DEFINITION {
1328 ULONG Length; /* = sizeof(RTL_HEAP_DEFINITION) */
1329
1332
1333typedef struct _RTL_RWLOCK {
1335
1338
1341
1347
1348/* System Information Class 0x00 */
1349
1350typedef struct _SYSTEM_BASIC_INFORMATION {
1351#ifdef __WINESRC__
1352 DWORD unknown;
1359 PVOID LowestUserAddress;
1360 PVOID HighestUserAddress;
1363#else
1364 BYTE Reserved1[24];
1365 PVOID Reserved2[4];
1367#endif
1369
1370/* System Information Class 0x01 */
1371
1375 WORD Revision; /* combination of CPU model and stepping */
1376 WORD Reserved; /* always zero */
1377 DWORD FeatureSet; /* see bit flags below */
1379
1380/* definitions of bits in the Feature set for the x86 processors */
1381#define CPU_FEATURE_VME 0x00000005 /* Virtual 86 Mode Extensions */
1382#define CPU_FEATURE_TSC 0x00000002 /* Time Stamp Counter available */
1383#define CPU_FEATURE_CMOV 0x00000008 /* Conditional Move instruction*/
1384#define CPU_FEATURE_PGE 0x00000014 /* Page table Entry Global bit */
1385#define CPU_FEATURE_PSE 0x00000024 /* Page Size Extension */
1386#define CPU_FEATURE_MTRR 0x00000040 /* Memory Type Range Registers */
1387#define CPU_FEATURE_CX8 0x00000080 /* Compare and eXchange 8 byte instr. */
1388#define CPU_FEATURE_MMX 0x00000100 /* Multi Media eXtensions */
1389#define CPU_FEATURE_X86 0x00000200 /* seems to be always ON, on the '86 */
1390#define CPU_FEATURE_PAT 0x00000400 /* Page Attribute Table */
1391#define CPU_FEATURE_FXSR 0x00000800 /* FXSAVE and FXSTORE instructions */
1392#define CPU_FEATURE_SEP 0x00001000 /* SYSENTER and SYSEXIT instructions */
1393#define CPU_FEATURE_SSE 0x00002000 /* SSE extensions (ext. MMX) */
1394#define CPU_FEATURE_3DNOW 0x00004000 /* 3DNOW instructions available */
1395#define CPU_FEATURE_SSE2 0x00010000 /* SSE2 extensions (XMMI64) */
1396#define CPU_FEATURE_DS 0x00020000 /* Debug Store */
1397#define CPU_FEATURE_HTT 0x00040000 /* Hyper Threading Technology */
1398
1399/* System Information Class 0x02 */
1400
1401/* Documented in "Windows NT/2000 Native API Reference" by Gary Nebbett. */
1402typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
1477
1478/* System Information Class 0x03 */
1479
1480typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
1481#ifdef __WINESRC__
1482 LARGE_INTEGER liKeBootTime;
1483 LARGE_INTEGER liKeSystemTime;
1484 LARGE_INTEGER liExpTimeZoneBias;
1485 ULONG uCurrentTimeZoneId;
1486 DWORD dwUnknown1[5];
1487#else
1488 BYTE Reserved1[48];
1489#endif
1491
1492/* System Information Class 0x08 */
1493
1501
1502/* System Information Class 0x0b */
1503
1510 char szName[MAX_PATH + 1];
1512
1513/* System Information Class 0x10 */
1514
1515typedef struct _SYSTEM_HANDLE_ENTRY {
1523
1524typedef struct _SYSTEM_HANDLE_INFORMATION {
1528
1529/* System Information Class 0x40 */
1530
1532{
1533 PVOID Object;
1542
1543typedef struct _SYSTEM_HANDLE_INFORMATION_EX
1544{
1549
1550/* System Information Class 0x15 */
1551
1559#ifdef _WIN64
1560 ULONG unknown64[7];
1561#endif
1563
1564/* System Information Class 0x17 */
1565
1566typedef struct _SYSTEM_INTERRUPT_INFORMATION {
1567 BYTE Reserved1[24];
1569
1571 union {
1573 struct {
1588
1589typedef struct _SYSTEM_EXCEPTION_INFORMATION {
1590 BYTE Reserved1[16];
1592
1593typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
1594 BYTE Reserved1[32];
1596
1601
1602/* System Information Class 0x05 */
1603
1604typedef struct _VM_COUNTERS_ {
1618
1619typedef struct _SYSTEM_PROCESS_INFORMATION {
1620#ifdef __WINESRC__ /* win32/win64 */
1621 ULONG NextEntryOffset; /* 00/00 */
1622 DWORD dwThreadCount; /* 04/04 */
1623 DWORD dwUnknown1[6]; /* 08/08 */
1624 LARGE_INTEGER CreationTime; /* 20/20 */
1625 LARGE_INTEGER UserTime; /* 28/28 */
1626 LARGE_INTEGER KernelTime; /* 30/30 */
1627 UNICODE_STRING ProcessName; /* 38/38 */
1628 DWORD dwBasePriority; /* 40/48 */
1629 HANDLE UniqueProcessId; /* 44/50 */
1630 HANDLE ParentProcessId; /* 48/58 */
1631 ULONG HandleCount; /* 4c/60 */
1632 ULONG SessionId; /* 50/64 */
1633 DWORD dwUnknown4; /* 54/68 */
1634 VM_COUNTERS vmCounters; /* 58/70 */
1635 IO_COUNTERS ioCounters; /* 88/d0 */
1636 SYSTEM_THREAD_INFORMATION ti[1]; /* b8/100 */
1637#else
1638 ULONG NextEntryOffset; /* 00/00 */
1639 BYTE Reserved1[52]; /* 04/04 */
1640 PVOID Reserved2[3]; /* 38/38 */
1641 HANDLE UniqueProcessId; /* 44/50 */
1642 PVOID Reserved3; /* 48/58 */
1643 ULONG HandleCount; /* 4c/60 */
1644 BYTE Reserved4[4]; /* 50/64 */
1645 PVOID Reserved5[11]; /* 54/68 */
1646 SIZE_T PeakPagefileUsage; /* 80/c0 */
1647 SIZE_T PrivatePageCount; /* 84/c8 */
1648 LARGE_INTEGER Reserved6[6]; /* 88/d0 */
1649#endif
1651
1657
1662
1663typedef struct _WINSTATIONINFORMATIONW {
1664 BYTE Reserved2[70];
1665 ULONG LogonId;
1666 BYTE Reserved3[1140];
1668
1670
1671typedef struct _LDR_RESOURCE_INFO
1672{
1677
1678
1679/* debug buffer definitions */
1680
1681typedef struct _DEBUG_BUFFER {
1699
1700#define PDI_MODULES 0x01
1701#define PDI_BACKTRACE 0x02
1702#define PDI_HEAPS 0x04
1703#define PDI_HEAP_TAGS 0x08
1704#define PDI_HEAP_BLOCKS 0x10
1705#define PDI_LOCKS 0x20
1706
1718
1732
1745
1746typedef struct _PORT_MESSAGE_HEADER {
1755
1756typedef unsigned short RTL_ATOM, *PRTL_ATOM;
1757
1758/* Wine doesn't implement atom table as NT does:
1759 * - in NT, atom tables are user space tables, which ntdll directly accesses
1760 * - on Wine, (even local) atom tables are wineserver objects, hence a HANDLE
1761 */
1762typedef struct atom_table *RTL_ATOM_TABLE, **PRTL_ATOM_TABLE;
1763
1768
1769typedef struct _ATOM_BASIC_INFORMATION {
1773 WCHAR Name[1];
1775
1776/* FIXME: names probably not correct */
1777typedef struct _RTL_HANDLE
1778{
1779 struct _RTL_HANDLE * Next;
1781
1782/* FIXME: names probably not correct */
1783typedef struct _RTL_HANDLE_TABLE
1784{
1785 ULONG MaxHandleCount; /* 0x00 */
1786 ULONG HandleSize; /* 0x04 */
1787 ULONG Unused[2]; /* 0x08-0x0c */
1788 PVOID NextFree; /* 0x10 */
1789 PVOID FirstHandle; /* 0x14 */
1790 PVOID ReservedMemory; /* 0x18 */
1791 PVOID MaxHandle; /* 0x1c */
1793
1794/***********************************************************************
1795 * Defines
1796 */
1797
1798/* flags for NtCreateFile and NtOpenFile */
1799#define FILE_DIRECTORY_FILE 0x00000001
1800#define FILE_WRITE_THROUGH 0x00000002
1801#define FILE_SEQUENTIAL_ONLY 0x00000004
1802#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
1803#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
1804#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
1805#define FILE_NON_DIRECTORY_FILE 0x00000040
1806#define FILE_CREATE_TREE_CONNECTION 0x00000080
1807#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
1808#define FILE_NO_EA_KNOWLEDGE 0x00000200
1809#define FILE_OPEN_FOR_RECOVERY 0x00000400
1810#define FILE_RANDOM_ACCESS 0x00000800
1811#define FILE_DELETE_ON_CLOSE 0x00001000
1812#define FILE_OPEN_BY_FILE_ID 0x00002000
1813#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
1814#define FILE_NO_COMPRESSION 0x00008000
1815#define FILE_RESERVE_OPFILTER 0x00100000
1816#define FILE_TRANSACTED_MODE 0x00200000
1817#define FILE_OPEN_OFFLINE_FILE 0x00400000
1818#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
1819
1820#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
1821#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
1822
1823/* status for NtCreateFile or NtOpenFile */
1824#define FILE_SUPERSEDED 0
1825#define FILE_OPENED 1
1826#define FILE_CREATED 2
1827#define FILE_OVERWRITTEN 3
1828#define FILE_EXISTS 4
1829#define FILE_DOES_NOT_EXIST 5
1830
1831/* disposition for NtCreateFile */
1832#define FILE_SUPERSEDE 0
1833#define FILE_OPEN 1
1834#define FILE_CREATE 2
1835#define FILE_OPEN_IF 3
1836#define FILE_OVERWRITE 4
1837#define FILE_OVERWRITE_IF 5
1838#define FILE_MAXIMUM_DISPOSITION 5
1839
1840/* Characteristics of a File System */
1841#define FILE_REMOVABLE_MEDIA 0x00000001
1842#define FILE_READ_ONLY_DEVICE 0x00000002
1843#define FILE_FLOPPY_DISKETTE 0x00000004
1844#define FILE_WRITE_ONE_MEDIA 0x00000008
1845#define FILE_REMOTE_DEVICE 0x00000010
1846#define FILE_DEVICE_IS_MOUNTED 0x00000020
1847#define FILE_VIRTUAL_VOLUME 0x00000040
1848#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
1849#define FILE_DEVICE_SECURE_OPEN 0x00000100
1850#define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
1851#define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
1852#define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
1853#define FILE_CHARACTERISTIC_CSV 0x00010000
1854#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
1855#define FILE_PORTABLE_DEVICE 0x00040000
1856
1857/* options for NtCreateNamedPipeFile */
1858#define FILE_PIPE_INBOUND 0x00000000
1859#define FILE_PIPE_OUTBOUND 0x00000001
1860#define FILE_PIPE_FULL_DUPLEX 0x00000002
1861
1862/* options for pipe's type */
1863#define FILE_PIPE_TYPE_MESSAGE 0x00000001
1864#define FILE_PIPE_TYPE_BYTE 0x00000000
1865/* options for pipe's message mode */
1866#define FILE_PIPE_MESSAGE_MODE 0x00000001
1867#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
1868/* options for pipe's blocking mode */
1869#define FILE_PIPE_COMPLETE_OPERATION 0x00000001
1870#define FILE_PIPE_QUEUE_OPERATION 0x00000000
1871/* and client / server end */
1872#define FILE_PIPE_SERVER_END 0x00000001
1873#define FILE_PIPE_CLIENT_END 0x00000000
1874
1875#define INTERNAL_TS_ACTIVE_CONSOLE_ID ( *((volatile ULONG*)(0x7ffe02d8)) )
1876
1877#define LOGONID_CURRENT ((ULONG)-1)
1878
1879#define OBJ_INHERIT 0x00000002
1880#define OBJ_PERMANENT 0x00000010
1881#define OBJ_EXCLUSIVE 0x00000020
1882#define OBJ_CASE_INSENSITIVE 0x00000040
1883#define OBJ_OPENIF 0x00000080
1884#define OBJ_OPENLINK 0x00000100
1885#define OBJ_KERNEL_HANDLE 0x00000200
1886#define OBJ_FORCE_ACCESS_CHECK 0x00000400
1887#define OBJ_VALID_ATTRIBUTES 0x000007F2
1888
1889#define SERVERNAME_CURRENT ((HANDLE)NULL)
1890
1891typedef void (CALLBACK *PNTAPCFUNC)(ULONG_PTR,ULONG_PTR,ULONG_PTR); /* FIXME: not the right name */
1892typedef void (CALLBACK *PRTL_THREAD_START_ROUTINE)(LPVOID); /* FIXME: not the right name */
1893typedef DWORD (CALLBACK *PRTL_WORK_ITEM_ROUTINE)(LPVOID); /* FIXME: not the right name */
1894typedef void (NTAPI *RTL_WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN); /* FIXME: not the right name */
1895
1896
1897/* DbgPrintEx default levels */
1898#define DPFLTR_ERROR_LEVEL 0
1899#define DPFLTR_WARNING_LEVEL 1
1900#define DPFLTR_TRACE_LEVEL 2
1901#define DPFLTR_INFO_LEVEL 3
1902#define DPFLTR_MASK 0x8000000
1903
1904/* Well-known LUID values */
1905#define SE_MIN_WELL_KNOWN_PRIVILEGE 2
1906#define SE_CREATE_TOKEN_PRIVILEGE 2
1907#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE 3
1908#define SE_LOCK_MEMORY_PRIVILEGE 4
1909#define SE_INCREASE_QUOTA_PRIVILEGE 5
1910#define SE_UNSOLICITED_INPUT_PRIVILEGE 6 /* obsolete */
1911#define SE_MACHINE_ACCOUNT_PRIVILEGE 6
1912#define SE_TCB_PRIVILEGE 7
1913#define SE_SECURITY_PRIVILEGE 8
1914#define SE_TAKE_OWNERSHIP_PRIVILEGE 9
1915#define SE_LOAD_DRIVER_PRIVILEGE 10
1916#define SE_SYSTEM_PROFILE_PRIVILEGE 11
1917#define SE_SYSTEMTIME_PRIVILEGE 12
1918#define SE_PROF_SINGLE_PROCESS_PRIVILEGE 13
1919#define SE_INC_BASE_PRIORITY_PRIVILEGE 14
1920#define SE_CREATE_PAGEFILE_PRIVILEGE 15
1921#define SE_CREATE_PERMANENT_PRIVILEGE 16
1922#define SE_BACKUP_PRIVILEGE 17
1923#define SE_RESTORE_PRIVILEGE 18
1924#define SE_SHUTDOWN_PRIVILEGE 19
1925#define SE_DEBUG_PRIVILEGE 20
1926#define SE_AUDIT_PRIVILEGE 21
1927#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE 22
1928#define SE_CHANGE_NOTIFY_PRIVILEGE 23
1929#define SE_REMOTE_SHUTDOWN_PRIVILEGE 24
1930#define SE_UNDOCK_PRIVILEGE 25
1931#define SE_SYNC_AGENT_PRIVILEGE 26
1932#define SE_ENABLE_DELEGATION_PRIVILEGE 27
1933#define SE_MANAGE_VOLUME_PRIVILEGE 28
1934#define SE_IMPERSONATE_PRIVILEGE 29
1935#define SE_CREATE_GLOBAL_PRIVILEGE 30
1936#define SE_MAX_WELL_KNOWN_PRIVILEGE SE_CREATE_GLOBAL_PRIVILEGE
1937
1938/* NtGlobalFlag bits */
1939#define FLG_STOP_ON_EXCEPTION 0x00000001
1940#define FLG_SHOW_LDR_SNAPS 0x00000002
1941#define FLG_DEBUG_INITIAL_COMMAND 0x00000004
1942#define FLG_STOP_ON_HUNG_GUI 0x00000008
1943#define FLG_HEAP_ENABLE_TAIL_CHECK 0x00000010
1944#define FLG_HEAP_ENABLE_FREE_CHECK 0x00000020
1945#define FLG_HEAP_VALIDATE_PARAMETERS 0x00000040
1946#define FLG_HEAP_VALIDATE_ALL 0x00000080
1947#define FLG_APPLICATION_VERIFIER 0x00000100
1948#define FLG_POOL_ENABLE_TAGGING 0x00000400
1949#define FLG_HEAP_ENABLE_TAGGING 0x00000800
1950#define FLG_USER_STACK_TRACE_DB 0x00001000
1951#define FLG_KERNEL_STACK_TRACE_DB 0x00002000
1952#define FLG_MAINTAIN_OBJECT_TYPELIST 0x00004000
1953#define FLG_HEAP_ENABLE_TAG_BY_DLL 0x00008000
1954#define FLG_DISABLE_STACK_EXTENSION 0x00010000
1955#define FLG_ENABLE_CSRDEBUG 0x00020000
1956#define FLG_ENABLE_KDEBUG_SYMBOL_LOAD 0x00040000
1957#define FLG_DISABLE_PAGE_KERNEL_STACKS 0x00080000
1958#define FLG_ENABLE_SYSTEM_CRIT_BREAKS 0x00100000
1959#define FLG_HEAP_DISABLE_COALESCING 0x00200000
1960#define FLG_ENABLE_CLOSE_EXCEPTIONS 0x00400000
1961#define FLG_ENABLE_EXCEPTION_LOGGING 0x00800000
1962#define FLG_ENABLE_HANDLE_TYPE_TAGGING 0x01000000
1963#define FLG_HEAP_PAGE_ALLOCS 0x02000000
1964#define FLG_DEBUG_INITIAL_COMMAND_EX 0x04000000
1965#define FLG_DISABLE_DBGPRINT 0x08000000
1966#define FLG_CRITSEC_EVENT_CREATION 0x10000000
1967#define FLG_LDR_TOP_DOWN 0x20000000
1968#define FLG_ENABLE_HANDLE_EXCEPTIONS 0x40000000
1969#define FLG_DISABLE_PROTDLLS 0x80000000
1970
1971/* Rtl*Registry* functions structs and defines */
1972#define RTL_REGISTRY_ABSOLUTE 0
1973#define RTL_REGISTRY_SERVICES 1
1974#define RTL_REGISTRY_CONTROL 2
1975#define RTL_REGISTRY_WINDOWS_NT 3
1976#define RTL_REGISTRY_DEVICEMAP 4
1977#define RTL_REGISTRY_USER 5
1978
1979#define RTL_REGISTRY_HANDLE 0x40000000
1980#define RTL_REGISTRY_OPTIONAL 0x80000000
1981
1982#define RTL_QUERY_REGISTRY_SUBKEY 0x00000001
1983#define RTL_QUERY_REGISTRY_TOPKEY 0x00000002
1984#define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
1985#define RTL_QUERY_REGISTRY_NOVALUE 0x00000008
1986#define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
1987#define RTL_QUERY_REGISTRY_DIRECT 0x00000020
1988#define RTL_QUERY_REGISTRY_DELETE 0x00000040
1989
1994 PVOID Context,
1996
1997typedef struct _RTL_QUERY_REGISTRY_TABLE
1998{
2000 ULONG Flags;
2001 PWSTR Name;
2007
2009{
2015
2017
2019
2023
2024typedef struct _EVENT_BASIC_INFORMATION {
2028
2032
2033typedef struct _SEMAPHORE_BASIC_INFORMATION {
2037
2039{
2043
2044typedef struct _SECTION_BASIC_INFORMATION {
2049
2050typedef struct _SECTION_IMAGE_INFORMATION {
2058 ULONG GpValue;
2063 union
2064 {
2066 struct
2067 {
2069 UCHAR ComPlusILOnly : 1;
2073 UCHAR Reserved : 3;
2080
2081typedef struct _LPC_SECTION_WRITE {
2082 ULONG Length;
2089
2090typedef struct _LPC_SECTION_READ {
2091 ULONG Length;
2095
2096typedef struct _LPC_MESSAGE {
2106
2107typedef struct _RTL_USER_PROCESS_INFORMATION
2108{
2115
2116typedef enum _SHUTDOWN_ACTION {
2121
2122typedef enum _KPROFILE_SOURCE {
2149
2154
2155typedef struct _INITIAL_TEB {
2162
2166
2170
2175
2176#define IO_COMPLETION_QUERY_STATE 0x0001
2177#define IO_COMPLETION_MODIFY_STATE 0x0002
2178#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2179
2189
2201
2202typedef enum _SYSDBG_COMMAND {
2224
2225
2226/*************************************************************************
2227 * Loader structures
2228 *
2229 * Those are not part of standard Winternl.h
2230 */
2231typedef struct _LDR_MODULE
2232{
2254
2255 /* Not part of Win7 but used by Wine */
2258
2260{
2261 ULONG Flags;
2264 PVOID DllBase;
2267
2269{
2276
2278{
2282
2284
2285/* those defines are (some of the) regular LDR_MODULE.Flags values */
2286#define LDR_IMAGE_IS_DLL 0x00000004
2287#define LDR_LOAD_IN_PROGRESS 0x00001000
2288#define LDR_UNLOAD_IN_PROGRESS 0x00002000
2289#define LDR_NO_DLL_CALLS 0x00040000
2290#define LDR_PROCESS_ATTACHED 0x00080000
2291#define LDR_MODULE_REBASED 0x00200000
2292
2293/* these ones is Wine specific */
2294#define LDR_DONT_RESOLVE_REFS 0x40000000
2295#define LDR_WINE_INTERNAL 0x80000000
2296
2297/* flag for LdrAddRefDll */
2298#define LDR_ADDREF_DLL_PIN 0x00000001
2299
2300/* FIXME: to be checked */
2301#define MAXIMUM_FILENAME_LENGTH 256
2302
2303#define LDR_DLL_NOTIFICATION_REASON_LOADED 1
2304#define LDR_DLL_NOTIFICATION_REASON_UNLOADED 2
2305
2306typedef struct _SYSTEM_MODULE
2307{
2308 PVOID Reserved1; /* 00/00 */
2309 PVOID Reserved2; /* 04/08 */
2311 ULONG ImageSize; /* 0c/18 */
2312 ULONG Flags; /* 10/1c */
2313 WORD Id; /* 14/20 */
2314 WORD Rank; /* 16/22 */
2315 WORD Unknown; /* 18/24 */
2316 WORD NameOffset; /* 1a/26 */
2319
2320typedef struct _SYSTEM_MODULE_INFORMATION
2321{
2323 SYSTEM_MODULE Modules[1]; /* FIXME: should be Modules[0] */
2325
2326#define THREAD_CREATE_FLAGS_CREATE_SUSPENDED 0x00000001
2327#define THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH 0x00000002
2328#define THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER 0x00000004
2329#define THREAD_CREATE_FLAGS_HAS_SECURITY_DESCRIPTOR 0x00000010
2330#define THREAD_CREATE_FLAGS_ACCESS_CHECK_IN_TARGET 0x00000020
2331#define THREAD_CREATE_FLAGS_INITIAL_THREAD 0x00000080
2332
2333/***********************************************************************
2334 * Function declarations
2335 */
2336
2337#if defined(__i386__) && defined(__GNUC__)
2338static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
2339static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
2340#else /* __i386__ && __GNUC__ */
2343#endif /* __i386__ && __GNUC__ */
2344#ifndef __REACTOS__
2346#endif /* __REACTOS__ */