1 /* TEB/PEB parameters */
2 #ifndef __INCLUDE_INTERNAL_TEB
3 #define __INCLUDE_INTERNAL_TEB
5 #include <napi/types.h>
7 typedef struct _CLIENT_ID
11 } CLIENT_ID
, *PCLIENT_ID
;
13 typedef struct _CURDIR
15 UNICODE_STRING DosPath
;
19 typedef struct RTL_DRIVE_LETTER_CURDIR
24 UNICODE_STRING DosPath
;
25 } RTL_DRIVE_LETTER_CURDIR
, *PRTL_DRIVE_LETTER_CURDIR
;
27 typedef struct _PEB_FREE_BLOCK
29 struct _PEB_FREE_BLOCK
* Next
;
31 } PEB_FREE_BLOCK
, *PPEB_FREE_BLOCK
;
33 /* RTL_USER_PROCESS_PARAMETERS.Flags */
34 #define PPF_NORMALIZED (1)
36 typedef struct _RTL_USER_PROCESS_PARAMETERS
38 ULONG MaximumLength
; // 00h
41 ULONG DebugFlags
; // 0Ch
42 PVOID ConsoleHandle
; // 10h
43 ULONG ConsoleFlags
; // 14h
44 HANDLE InputHandle
; // 18h
45 HANDLE OutputHandle
; // 1Ch
46 HANDLE ErrorHandle
; // 20h
47 CURDIR CurrentDirectory
; // 24h
48 UNICODE_STRING DllPath
; // 30h
49 UNICODE_STRING ImagePathName
; // 38h
50 UNICODE_STRING CommandLine
; // 40h
51 PWSTR Environment
; // 48h
52 ULONG StartingX
; // 4Ch
53 ULONG StartingY
; // 50h
56 ULONG CountCharsX
; // 5Ch
57 ULONG CountCharsY
; // 60h
58 ULONG FillAttribute
; // 64h
59 ULONG WindowFlags
; // 68h
60 ULONG ShowWindowFlags
; // 6Ch
61 UNICODE_STRING WindowTitle
; // 70h
62 UNICODE_STRING DesktopInfo
; // 78h
63 UNICODE_STRING ShellInfo
; // 80h
64 UNICODE_STRING RuntimeInfo
; // 88h
65 RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory
[0x20]; // 90h
66 } RTL_USER_PROCESS_PARAMETERS
, *PRTL_USER_PROCESS_PARAMETERS
;
68 #define PEB_BASE (0x7FFDF000)
70 typedef struct _PEB_LDR_DATA
75 LIST_ENTRY InLoadOrderModuleList
;
76 LIST_ENTRY InMemoryOrderModuleList
;
77 LIST_ENTRY InInitializationOrderModuleList
;
78 } PEB_LDR_DATA
, *PPEB_LDR_DATA
;
80 typedef VOID
STDCALL (*PPEBLOCKROUTINE
)(PVOID
);
84 UCHAR InheritedAddressSpace
; // 00h
85 UCHAR ReadImageFileExecOptions
; // 01h
86 UCHAR BeingDebugged
; // 02h
89 PVOID ImageBaseAddress
; // 08h
90 PPEB_LDR_DATA Ldr
; // 0Ch
91 PRTL_USER_PROCESS_PARAMETERS ProcessParameters
; // 10h
92 PVOID SubSystemData
; // 14h
93 PVOID ProcessHeap
; // 18h
94 PVOID FastPebLock
; // 1Ch
95 PPEBLOCKROUTINE FastPebLockRoutine
; // 20h
96 PPEBLOCKROUTINE FastPebUnlockRoutine
; // 24h
97 ULONG EnvironmentUpdateCount
; // 28h
98 PVOID
* KernelCallbackTable
; // 2Ch
99 PVOID EventLogSection
; // 30h
100 PVOID EventLog
; // 34h
101 PPEB_FREE_BLOCK FreeList
; // 38h
102 ULONG TlsExpansionCounter
; // 3Ch
103 PVOID TlsBitmap
; // 40h
104 ULONG TlsBitmapBits
[0x2]; // 44h
105 PVOID ReadOnlySharedMemoryBase
; // 4Ch
106 PVOID ReadOnlySharedMemoryHeap
; // 50h
107 PVOID
* ReadOnlyStaticServerData
; // 54h
108 PVOID AnsiCodePageData
; // 58h
109 PVOID OemCodePageData
; // 5Ch
110 PVOID UnicodeCaseTableData
; // 60h
111 ULONG NumberOfProcessors
; // 64h
112 ULONG NtGlobalFlag
; // 68h
113 UCHAR Spare2
[0x4]; // 6Ch
114 LARGE_INTEGER CriticalSectionTimeout
; // 70h
115 ULONG HeapSegmentReserve
; // 78h
116 ULONG HeapSegmentCommit
; // 7Ch
117 ULONG HeapDeCommitTotalFreeThreshold
; // 80h
118 ULONG HeapDeCommitFreeBlockThreshold
; // 84h
119 ULONG NumberOfHeaps
; // 88h
120 ULONG MaximumNumberOfHeaps
; // 8Ch
121 PVOID
** ProcessHeaps
; // 90h
122 PVOID GdiSharedHandleTable
; // 94h
123 PVOID ProcessStarterHelper
; // 98h
124 PVOID GdiDCAttributeList
; // 9Ch
125 PVOID LoaderLock
; // A0h
126 ULONG OSMajorVersion
; // A4h
127 ULONG OSMinorVersion
; // A8h
128 ULONG OSBuildNumber
; // ACh
129 ULONG OSPlatformId
; // B0h
130 ULONG ImageSubSystem
; // B4h
131 ULONG ImageSubSystemMajorVersion
; // B8h
132 ULONG ImageSubSystemMinorVersion
; // C0h
133 ULONG GdiHandleBuffer
[0x22]; // C4h
137 typedef struct _NT_TIB
{
138 struct _EXCEPTION_REGISTRATION_RECORD
* ExceptionList
; // 00h
139 PVOID StackBase
; // 04h
140 PVOID StackLimit
; // 08h
141 PVOID SubSystemTib
; // 0Ch
143 PVOID FiberData
; // 10h
144 ULONG Version
; // 10h
146 PVOID ArbitraryUserPointer
; // 14h
147 struct _NT_TIB
*Self
; // 18h
150 typedef struct _GDI_TEB_BATCH
155 } GDI_TEB_BATCH
, *PGDI_TEB_BATCH
;
160 PVOID EnvironmentPointer
; // 1Ch
161 CLIENT_ID Cid
; // 20h
162 PVOID ActiveRpcInfo
; // 28h
163 PVOID ThreadLocalStoragePointer
; // 2Ch
165 ULONG LastErrorValue
; // 34h
166 ULONG CountOfOwnedCriticalSections
; // 38h
167 PVOID CsrClientThread
; // 3Ch
168 struct _W32THREAD
* Win32ThreadInfo
; // 40h
169 ULONG Win32ClientInfo
[0x1F]; // 44h
170 PVOID WOW32Reserved
; // C0h
171 ULONG CurrentLocale
; // C4h
172 ULONG FpSoftwareStatusRegister
; // C8h
173 PVOID SystemReserved1
[0x36]; // CCh
174 PVOID Spare1
; // 1A4h
175 LONG ExceptionCode
; // 1A8h
176 ULONG SpareBytes1
[0x28]; // 1ACh
177 PVOID SystemReserved2
[0xA]; // 1D4h
178 // GDI_TEB_BATCH GdiTebBatch; // 1FCh
179 ULONG gdiRgn
; // 6DCh
180 ULONG gdiPen
; // 6E0h
181 ULONG gdiBrush
; // 6E4h
182 CLIENT_ID RealClientId
; // 6E8h
183 PVOID GdiCachedProcessHandle
; // 6F0h
184 ULONG GdiClientPID
; // 6F4h
185 ULONG GdiClientTID
; // 6F8h
186 PVOID GdiThreadLocaleInfo
; // 6FCh
187 PVOID UserReserved
[5]; // 700h
188 PVOID glDispatchTable
[0x118]; // 714h
189 ULONG glReserved1
[0x1A]; // B74h
190 PVOID glReserved2
; // BDCh
191 PVOID glSectionInfo
; // BE0h
192 PVOID glSection
; // BE4h
193 PVOID glTable
; // BE8h
194 PVOID glCurrentRC
; // BECh
195 PVOID glContext
; // BF0h
196 NTSTATUS LastStatusValue
; // BF4h
197 UNICODE_STRING StaticUnicodeString
; // BF8h
198 WCHAR StaticUnicodeBuffer
[0x105]; // C00h
199 PVOID DeallocationStack
; // E0Ch
200 PVOID TlsSlots
[0x40]; // E10h
201 LIST_ENTRY TlsLinks
; // F10h
203 PVOID ReservedForNtRpc
; // F1Ch
204 PVOID DbgSsReserved
[0x2]; // F20h
205 ULONG HardErrorDisabled
; // F28h
206 PVOID Instrumentation
[0x10]; // F2Ch
207 PVOID WinSockData
; // F6Ch
208 ULONG GdiBatchCount
; // F70h
209 ULONG Spare2
; // F74h
210 ULONG Spare3
; // F78h
211 ULONG Spare4
; // F7Ch
212 PVOID ReservedForOle
; // F80h
213 ULONG WaitingOnLoaderLock
; // F84h
214 PVOID WineDebugInfo
; // Needed for WINE DLL's
218 #define NtCurrentPeb() (NtCurrentTeb()->Peb)
220 static inline PTEB
NtCurrentTeb(VOID
)
224 __asm__
__volatile__("movl %%fs:0x18, %0\n\t"
225 : "=r" (x
) /* can't have two memory operands */
234 #endif /* __INCLUDE_INTERNAL_TEB */