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