1cdf0e10cSrcweir #pragma once
2*5b501c92SAndrew Rist // *************************************************************
3*5b501c92SAndrew Rist //
4*5b501c92SAndrew Rist //  Licensed to the Apache Software Foundation (ASF) under one
5*5b501c92SAndrew Rist //  or more contributor license agreements.  See the NOTICE file
6*5b501c92SAndrew Rist //  distributed with this work for additional information
7*5b501c92SAndrew Rist //  regarding copyright ownership.  The ASF licenses this file
8*5b501c92SAndrew Rist //  to you under the Apache License, Version 2.0 (the
9*5b501c92SAndrew Rist //  "License"); you may not use this file except in compliance
10*5b501c92SAndrew Rist //  with the License.  You may obtain a copy of the License at
11*5b501c92SAndrew Rist //
12*5b501c92SAndrew Rist //    http://www.apache.org/licenses/LICENSE-2.0
13*5b501c92SAndrew Rist //
14*5b501c92SAndrew Rist //  Unless required by applicable law or agreed to in writing,
15*5b501c92SAndrew Rist //  software distributed under the License is distributed on an
16*5b501c92SAndrew Rist //  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*5b501c92SAndrew Rist //  KIND, either express or implied.  See the License for the
18*5b501c92SAndrew Rist //  specific language governing permissions and limitations
19*5b501c92SAndrew Rist //  under the License.
20*5b501c92SAndrew Rist //
21*5b501c92SAndrew Rist // *************************************************************
22cdf0e10cSrcweir 
23cdf0e10cSrcweir //Kernel32 objects
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #define K32OBJ_SEMAPHORE			0x1
26cdf0e10cSrcweir #define K32OBJ_EVENT				0x2
27cdf0e10cSrcweir #define K32OBJ_MUTEX				0x3
28cdf0e10cSrcweir #define K32OBJ_CRITICAL_SECTION     0x4
29cdf0e10cSrcweir #define K32OBJ_PROCESS				0x5
30cdf0e10cSrcweir #define K32OBJ_THREAD				0x6
31cdf0e10cSrcweir #define K32OBJ_FILE					0x7
32cdf0e10cSrcweir #define K32OBJ_CHANGE				0x8
33cdf0e10cSrcweir #define K32OBJ_CONSOLE				0x9
34cdf0e10cSrcweir #define K32OBJ_SCREEN_BUFFER	    0xA
35cdf0e10cSrcweir #define K32OBJ_MEM_MAPPED_FILE	    0xB
36cdf0e10cSrcweir #define K32OBJ_SERIAL				0xC
37cdf0e10cSrcweir #define K32OBJ_DEVICE_IOCTL			0xD
38cdf0e10cSrcweir #define K32OBJ_PIPE					0xE
39cdf0e10cSrcweir #define K32OBJ_MAILSLOT 			0xF
40cdf0e10cSrcweir #define K32OBJ_TOOLHELP_SNAPSHOT    0x10
41cdf0e10cSrcweir #define K32OBJ_SOCKET				0x11
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //Process Database flags
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #define fDebugSingle		0x00000001
47cdf0e10cSrcweir #define fCreateProcessEvent	0x00000002
48cdf0e10cSrcweir #define fExitProcessEvent	0x00000004
49cdf0e10cSrcweir #define fWin16Process		0x00000008
50cdf0e10cSrcweir #define fDosProcess			0x00000010
51cdf0e10cSrcweir #define fConsoleProcess 	0x00000020
52cdf0e10cSrcweir #define fFileApisAreOem 	0x00000040
53cdf0e10cSrcweir #define fNukeProcess		0x00000080
54cdf0e10cSrcweir #define fServiceProcess 	0x00000100
55cdf0e10cSrcweir #define fLoginScriptHack	0x00000800
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //Thread Database flags
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #define fCreateThreadEvent		0x00000001
61cdf0e10cSrcweir #define fCancelExceptionAbort	0x00000002
62cdf0e10cSrcweir #define fOnTempStack			0x00000004
63cdf0e10cSrcweir #define fGrowableStack			0x00000008
64cdf0e10cSrcweir #define fDelaySingleStep		0x00000010
65cdf0e10cSrcweir #define fOpenExeAsImmovableFile 0x00000020
66cdf0e10cSrcweir #define fCreateSuspended		0x00000040
67cdf0e10cSrcweir #define fStackOverflow			0x00000080
68cdf0e10cSrcweir #define fNestedCleanAPCs		0x00000100
69cdf0e10cSrcweir #define fWasOemNowAnsi			0x00000200
70cdf0e10cSrcweir #define fOKToSetThreadOem		0x00000400
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #ifdef _MSC_VER
73cdf0e10cSrcweir #pragma warning(disable:4103)
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir #pragma pack(1)
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
78cdf0e10cSrcweir //MODREF and IMTE structures
79cdf0e10cSrcweir 
80cdf0e10cSrcweir typedef struct _MODREF {
81cdf0e10cSrcweir     struct _MODREF *pNextModRef;    // 00h
82cdf0e10cSrcweir     DWORD	    un1;	    // 04h
83cdf0e10cSrcweir     DWORD	    un2;	    // 08h
84cdf0e10cSrcweir     DWORD	    un3;	    // 0Ch
85cdf0e10cSrcweir     WORD	    mteIndex;	// 10h
86cdf0e10cSrcweir     WORD	    un4;	    // 12h
87cdf0e10cSrcweir     DWORD	    un5;	    // 14h
88cdf0e10cSrcweir     PVOID	    ppdb;	    // 18h Pointer to process database
89cdf0e10cSrcweir     DWORD	    un6;	    // 1Ch
90cdf0e10cSrcweir     DWORD	    un7;	    // 20h
91cdf0e10cSrcweir     DWORD	    un8;	    // 24h
92cdf0e10cSrcweir } MODREF, *PMODREF;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir typedef struct _IMTE {
95cdf0e10cSrcweir     DWORD	    un1;			// 00h
96cdf0e10cSrcweir     PIMAGE_NT_HEADERS	pNTHdr; // 04h
97cdf0e10cSrcweir     DWORD	    un2;			// 08h
98cdf0e10cSrcweir     PSTR	    pszFileName;    // 0Ch
99cdf0e10cSrcweir     PSTR	    pszModName;     // 10h
100cdf0e10cSrcweir     WORD	    cbFileName;     // 14h
101cdf0e10cSrcweir     WORD	    cbModName;	    // 16h
102cdf0e10cSrcweir     DWORD	    un3;			// 18h
103cdf0e10cSrcweir     DWORD	    cSections;	    // 1Ch
104cdf0e10cSrcweir     DWORD	    un5;			// 20h
105cdf0e10cSrcweir     DWORD	    baseAddress;    // 24h
106cdf0e10cSrcweir     WORD	    hModule16;	    // 28h
107cdf0e10cSrcweir     WORD	    cUsage;			// 2Ah
108cdf0e10cSrcweir     DWORD	    un7;			// 2Ch
109cdf0e10cSrcweir     PSTR	    pszFileName2;   // 30h
110cdf0e10cSrcweir     WORD	    cbFileName2;    // 34h
111cdf0e10cSrcweir     DWORD	    pszModName2;    // 36h
112cdf0e10cSrcweir     WORD	    cbModName2;     // 3Ah
113cdf0e10cSrcweir } IMTE, *PIMTE;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 
116cdf0e10cSrcweir //Process Database structure
117cdf0e10cSrcweir 
118cdf0e10cSrcweir typedef struct _ENVIRONMENT_DATABASE {
119cdf0e10cSrcweir PSTR	pszEnvironment;     // 00h Pointer to Environment
120cdf0e10cSrcweir DWORD	un1;				// 04h
121cdf0e10cSrcweir PSTR	pszCmdLine;			// 08h Pointer to command line
122cdf0e10cSrcweir PSTR	pszCurrDirectory;   // 0Ch Pointer to current directory
123cdf0e10cSrcweir LPSTARTUPINFOA pStartupInfo;// 10h Pointer to STARTUPINFOA struct
124cdf0e10cSrcweir HANDLE	hStdIn; 			// 14h Standard Input
125cdf0e10cSrcweir HANDLE	hStdOut;			// 18h Standard Output
126cdf0e10cSrcweir HANDLE	hStdErr;			// 1Ch Standard Error
127cdf0e10cSrcweir DWORD	un2;				// 20h
128cdf0e10cSrcweir DWORD	InheritConsole;     // 24h
129cdf0e10cSrcweir DWORD	BreakType;			// 28h
130cdf0e10cSrcweir DWORD	BreakSem;			// 2Ch
131cdf0e10cSrcweir DWORD	BreakEvent;			// 30h
132cdf0e10cSrcweir DWORD	BreakThreadID;	    // 34h
133cdf0e10cSrcweir DWORD	BreakHandlers;	    // 38h
134cdf0e10cSrcweir } ENVIRONMENT_DATABASE, *PENVIRONMENT_DATABASE;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir typedef struct _KERNEL_OBJECT {
137cdf0e10cSrcweir DWORD	Type;		    // 00h KERNEL32 object type (5)
138cdf0e10cSrcweir DWORD	cReference;	    // 04h Number of references to process
139cdf0e10cSrcweir } KERNEL_OBJECT, *PKERNEL_OBJECT;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir typedef struct _HANDLE_TABLE_ENTRY {
142cdf0e10cSrcweir     DWORD   flags;		// Valid flags depend on what type of object this is
143cdf0e10cSrcweir     PKERNEL_OBJECT   pObject;	// Pointer to the object that the handle refers to
144cdf0e10cSrcweir } HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir typedef struct _HANDLE_TABLE {
147cdf0e10cSrcweir     DWORD   cEntries;				// Max number of handles in table
148cdf0e10cSrcweir     HANDLE_TABLE_ENTRY array[1];    // An array (number is given by cEntries)
149cdf0e10cSrcweir } HANDLE_TABLE, *PHANDLE_TABLE;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 
152cdf0e10cSrcweir typedef struct _PROCESS_DATABASE {
153cdf0e10cSrcweir DWORD	Type;		    // 00h KERNEL32 object type (5)
154cdf0e10cSrcweir DWORD	cReference;	    // 04h Number of references to process
155cdf0e10cSrcweir DWORD	un1;		    // 08h
156cdf0e10cSrcweir DWORD	someEvent;	    // 0Ch An event object (What's it used for???)
157cdf0e10cSrcweir DWORD	TerminationStatus;  // 10h Returned by GetExitCodeProcess
158cdf0e10cSrcweir DWORD	un2;		    // 14h
159cdf0e10cSrcweir DWORD	DefaultHeap;	    // 18h Address of the process heap
160cdf0e10cSrcweir DWORD	MemoryContext;	    // 1Ch pointer to the process's context
161cdf0e10cSrcweir DWORD	flags;		    // 20h
162cdf0e10cSrcweir 			    // 0x00000001 - fDebugSingle
163cdf0e10cSrcweir 			    // 0x00000002 - fCreateProcessEvent
164cdf0e10cSrcweir 			    // 0x00000004 - fExitProcessEvent
165cdf0e10cSrcweir 			    // 0x00000008 - fWin16Process
166cdf0e10cSrcweir 			    // 0x00000010 - fDosProcess
167cdf0e10cSrcweir 			    // 0x00000020 - fConsoleProcess
168cdf0e10cSrcweir 			    // 0x00000040 - fFileApisAreOem
169cdf0e10cSrcweir 			    // 0x00000080 - fNukeProcess
170cdf0e10cSrcweir 			    // 0x00000100 - fServiceProcess
171cdf0e10cSrcweir 			    // 0x00000800 - fLoginScriptHack
172cdf0e10cSrcweir DWORD	pPSP;		    // 24h Linear address of PSP?
173cdf0e10cSrcweir WORD	PSPSelector;	    // 28h
174cdf0e10cSrcweir WORD	MTEIndex;	    // 2Ah
175cdf0e10cSrcweir WORD	cThreads;	    // 2Ch
176cdf0e10cSrcweir WORD	cNotTermThreads;    // 2Eh
177cdf0e10cSrcweir WORD	un3;		    // 30h
178cdf0e10cSrcweir WORD	cRing0Threads;	    // 32h number of ring 0 threads
179cdf0e10cSrcweir HANDLE	HeapHandle;	    // 34h Heap to allocate handle tables out of
180cdf0e10cSrcweir 			    //	   This seems to always be the KERNEL32 heap
181cdf0e10cSrcweir HTASK	W16TDB; 	    // 38h Win16 Task Database selector
182cdf0e10cSrcweir DWORD	MemMapFiles;	    // 3Ch memory mapped file list (?)
183cdf0e10cSrcweir PENVIRONMENT_DATABASE pEDB; // 40h Pointer to Environment Database
184cdf0e10cSrcweir PHANDLE_TABLE pHandleTable; // 44h Pointer to process handle table
185cdf0e10cSrcweir struct _PROCESS_DATABASE *ParentPDB;   // 48h Parent process database
186cdf0e10cSrcweir PMODREF MODREFlist;	    // 4Ch Module reference list
187cdf0e10cSrcweir DWORD	ThreadList;	    // 50h Threads in this process
188cdf0e10cSrcweir DWORD	DebuggeeCB;	    // 54h Debuggee Context block?
189cdf0e10cSrcweir DWORD	LocalHeapFreeHead;  // 58h Head of free list in process heap
190cdf0e10cSrcweir DWORD	InitialRing0ID;     // 5Ch
191cdf0e10cSrcweir CRITICAL_SECTION    crst;   // 60h
192cdf0e10cSrcweir DWORD	un4[3]; 	    // 78h
193cdf0e10cSrcweir DWORD	pConsole;	    // 84h Pointer to console for process
194cdf0e10cSrcweir DWORD	tlsInUseBits1;	    // 88h  // Represents TLS indices 0 - 31
195cdf0e10cSrcweir DWORD	tlsInUseBits2;	    // 8Ch  // Represents TLS indices 32 - 63
196cdf0e10cSrcweir DWORD	ProcessDWORD;	    // 90h
197cdf0e10cSrcweir struct _PROCESS_DATABASE *ProcessGroup;    // 94h
198cdf0e10cSrcweir DWORD	pExeMODREF;	    // 98h pointer to EXE's MODREF
199cdf0e10cSrcweir DWORD	TopExcFilter;	    // 9Ch Top Exception Filter?
200cdf0e10cSrcweir DWORD	BasePriority;	    // A0h Base scheduling priority for process
201cdf0e10cSrcweir DWORD	HeapOwnList;	    // A4h Head of the list of process heaps
202cdf0e10cSrcweir DWORD	HeapHandleBlockList;// A8h Pointer to head of heap handle block list
203cdf0e10cSrcweir DWORD	pSomeHeapPtr;	    // ACh normally zero, but can a pointer to a
204cdf0e10cSrcweir 			    // moveable handle block in the heap
205cdf0e10cSrcweir DWORD	pConsoleProvider;   // B0h Process that owns the console we're using?
206cdf0e10cSrcweir WORD	EnvironSelector;    // B4h Selector containing process environment
207cdf0e10cSrcweir WORD	ErrorMode;	    // B6H SetErrorMode value (also thunks to Win16)
208cdf0e10cSrcweir DWORD	pevtLoadFinished;   // B8h Pointer to event LoadFinished?
209cdf0e10cSrcweir WORD	UTState;	    // BCh
210cdf0e10cSrcweir } PROCESS_DATABASE, *PPROCESS_DATABASE;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 
213cdf0e10cSrcweir //TIB (Thread Information Block) structure
214cdf0e10cSrcweir 
215cdf0e10cSrcweir typedef struct _SEH_record {
216cdf0e10cSrcweir     struct _SEH_record *pNext;
217cdf0e10cSrcweir     FARPROC		pfnHandler;
218cdf0e10cSrcweir } SEH_record, *PSEH_record;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir // This is semi-documented in the NTDDK.H file from the NT DDK
221cdf0e10cSrcweir typedef struct _TIB {
222cdf0e10cSrcweir PSEH_record pvExcept;	    // 00h Head of exception record list
223cdf0e10cSrcweir PVOID	pvStackUserTop;     // 04h Top of user stack
224cdf0e10cSrcweir PVOID	pvStackUserBase;    // 08h Base of user stack
225cdf0e10cSrcweir WORD	pvTDB;		    // 0Ch TDB
226cdf0e10cSrcweir WORD	pvThunksSS;	    // 0Eh SS selector used for thunking to 16 bits
227cdf0e10cSrcweir DWORD	SelmanList;	    // 10h
228cdf0e10cSrcweir PVOID	pvArbitrary;	    // 14h Available for application use
229cdf0e10cSrcweir struct _tib *ptibSelf;	    // 18h Linear address of TIB structure
230cdf0e10cSrcweir WORD	TIBFlags;	    // 1Ch
231cdf0e10cSrcweir WORD	Win16MutexCount;    // 1Eh
232cdf0e10cSrcweir DWORD	DebugContext;	    // 20h
233cdf0e10cSrcweir DWORD	pCurrentPriority;   // 24h
234cdf0e10cSrcweir DWORD	pvQueue;	    // 28h Message Queue selector
235cdf0e10cSrcweir PVOID  *pvTLSArray;	    // 2Ch Thread Local Storage array
236cdf0e10cSrcweir } TIB, *PTIB;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 
239cdf0e10cSrcweir //TDBX structure
240cdf0e10cSrcweir 
241cdf0e10cSrcweir typedef struct _TDBX {
242cdf0e10cSrcweir     DWORD   ptdb;		// 00h	// PTHREAD_DATABASE
243cdf0e10cSrcweir     DWORD   ppdb;		// 04h	// PPROCESDS_DATABASE
244cdf0e10cSrcweir     DWORD   ContextHandle;	// 08h
245cdf0e10cSrcweir     DWORD   un1;		// 0Ch
246cdf0e10cSrcweir     DWORD   TimeOutHandle;	// 10h
247cdf0e10cSrcweir     DWORD   WakeParam;		// 14h
248cdf0e10cSrcweir     DWORD   BlockHandle;	// 18h
249cdf0e10cSrcweir     DWORD   BlockState; 	// 1Ch
250cdf0e10cSrcweir     DWORD   SuspendCount;	// 20h
251cdf0e10cSrcweir     DWORD   SuspendHandle;	// 24h
252cdf0e10cSrcweir     DWORD   MustCompleteCount;	// 28h
253cdf0e10cSrcweir     DWORD   WaitExFlags;	// 2Ch
254cdf0e10cSrcweir 				// 0x00000001 - WAITEXBIT
255cdf0e10cSrcweir 				// 0x00000002 - WAITACKBIT
256cdf0e10cSrcweir 				// 0x00000004 - SUSPEND_APC_PENDING
257cdf0e10cSrcweir 				// 0x00000008 - SUSPEND_TERMINATED
258cdf0e10cSrcweir 				// 0x00000010 - BLOCKED_FOR_TERMINATION
259cdf0e10cSrcweir 				// 0x00000020 - EMULATE_NPX
260cdf0e10cSrcweir 				// 0x00000040 - WIN32_NPX
261cdf0e10cSrcweir 				// 0x00000080 - EXTENDED_HANDLES
262cdf0e10cSrcweir 				// 0x00000100 - FROZEN
263cdf0e10cSrcweir 				// 0x00000200 - DONT_FREEZE
264cdf0e10cSrcweir 				// 0x00000400 - DONT_UNFREEZE
265cdf0e10cSrcweir 				// 0x00000800 - DONT_TRACE
266cdf0e10cSrcweir 				// 0x00001000 - STOP_TRACING
267cdf0e10cSrcweir 				// 0x00002000 - WAITING_FOR_CRST_SAFE
268cdf0e10cSrcweir 				// 0x00004000 - CRST_SAFE
269cdf0e10cSrcweir 				// 0x00040000 - BLOCK_TERMINATE_APC
270cdf0e10cSrcweir     DWORD   SyncWaitCount;	// 30h
271cdf0e10cSrcweir     DWORD   QueuedSyncFuncs;	// 34h
272cdf0e10cSrcweir     DWORD   UserAPCList;	// 38h
273cdf0e10cSrcweir     DWORD   KernAPCList;	// 3Ch
274cdf0e10cSrcweir     DWORD   pPMPSPSelector;	// 40h
275cdf0e10cSrcweir     DWORD   BlockedOnID;	// 44h
276cdf0e10cSrcweir     DWORD   un2[7];		// 48h
277cdf0e10cSrcweir     DWORD   TraceRefData;	// 64h
278cdf0e10cSrcweir     DWORD   TraceCallBack;	// 68h
279cdf0e10cSrcweir     DWORD   TraceEventHandle;	// 6Ch
280cdf0e10cSrcweir     WORD    TraceOutLastCS;	// 70h
281cdf0e10cSrcweir     WORD    K16TDB;		// 72h
282cdf0e10cSrcweir     WORD    K16PDB;		// 74h
283cdf0e10cSrcweir     WORD    DosPDBSeg;		// 76h
284cdf0e10cSrcweir     WORD    ExceptionCount;	// 78h
285cdf0e10cSrcweir } TDBX, *PTDBX;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 
288cdf0e10cSrcweir //Thread Database structure
289cdf0e10cSrcweir 
290cdf0e10cSrcweir typedef struct _THREAD_DATABASE {
291cdf0e10cSrcweir DWORD	Type;		    // 00h
292cdf0e10cSrcweir DWORD	cReference;	    // 04h
293cdf0e10cSrcweir PPROCESS_DATABASE pProcess; // 08h
294cdf0e10cSrcweir DWORD	someEvent;	    // 0Ch An event object (What's it used for???)
295cdf0e10cSrcweir DWORD	pvExcept;	    // 10h This field through field 3CH is a TIB
296cdf0e10cSrcweir 			    //	    structure (see TIB.H)
297cdf0e10cSrcweir DWORD	TopOfStack;	    // 14h
298cdf0e10cSrcweir DWORD	StackLow;	    // 18h
299cdf0e10cSrcweir WORD	W16TDB; 	    // 1Ch
300cdf0e10cSrcweir WORD	StackSelector16;    // 1Eh Used when thunking down to 16 bits
301cdf0e10cSrcweir DWORD	SelmanList;	    // 20h
302cdf0e10cSrcweir DWORD	UserPointer;	    // 24h
303cdf0e10cSrcweir PTIB	pTIB;		    // 28h
304cdf0e10cSrcweir WORD	TIBFlags;	    // 2Ch  TIBF_WIN32 = 1, TIBF_TRAP = 2
305cdf0e10cSrcweir WORD	Win16MutexCount;    // 2Eh
306cdf0e10cSrcweir DWORD	DebugContext;	    // 30h
307cdf0e10cSrcweir PDWORD	pCurrentPriority;   // 34h
308cdf0e10cSrcweir DWORD	MessageQueue;	    // 38h
309cdf0e10cSrcweir DWORD	pTLSArray;	    // 3Ch
310cdf0e10cSrcweir PPROCESS_DATABASE pProcess2;// 40h Another copy of the thread's process???
311cdf0e10cSrcweir DWORD	Flags;		    // 44h
312cdf0e10cSrcweir 			    // 0x00000001 - fCreateThreadEvent
313cdf0e10cSrcweir 			    // 0x00000002 - fCancelExceptionAbort
314cdf0e10cSrcweir 			    // 0x00000004 - fOnTempStack
315cdf0e10cSrcweir 			    // 0x00000008 - fGrowableStack
316cdf0e10cSrcweir 			    // 0x00000010 - fDelaySingleStep
317cdf0e10cSrcweir 			    // 0x00000020 - fOpenExeAsImmovableFile
318cdf0e10cSrcweir 			    // 0x00000040 - fCreateSuspended
319cdf0e10cSrcweir 			    // 0x00000080 - fStackOverflow
320cdf0e10cSrcweir 			    // 0x00000100 - fNestedCleanAPCs
321cdf0e10cSrcweir 			    // 0x00000200 - fWasOemNowAnsi
322cdf0e10cSrcweir 			    // 0x00000400 - fOKToSetThreadOem
323cdf0e10cSrcweir DWORD	TerminationStatus;  // 48h Returned by GetExitCodeThread
324cdf0e10cSrcweir WORD	TIBSelector;	    // 4Ch
325cdf0e10cSrcweir WORD	EmulatorSelector;   // 4Eh
326cdf0e10cSrcweir DWORD	cHandles;	    // 50h
327cdf0e10cSrcweir DWORD	WaitNodeList;	    // 54h
328cdf0e10cSrcweir DWORD	un4;		    // 58h
329cdf0e10cSrcweir DWORD	Ring0Thread;	    // 5Ch
330cdf0e10cSrcweir PTDBX	pTDBX;		    // 60
331cdf0e10cSrcweir DWORD	StackBase;	    // 64h
332cdf0e10cSrcweir DWORD	TerminationStack;   // 68h
333cdf0e10cSrcweir DWORD	EmulatorData;	    // 6Ch
334cdf0e10cSrcweir DWORD	GetLastErrorCode;   // 70h
335cdf0e10cSrcweir DWORD	DebuggerCB;	    // 74h
336cdf0e10cSrcweir DWORD	DebuggerThread;     // 78h
337cdf0e10cSrcweir PCONTEXT    ThreadContext;  // 7Ch  // register context defined in WINNT.H
338cdf0e10cSrcweir DWORD	Except16List;	    // 80h
339cdf0e10cSrcweir DWORD	ThunkConnect;	    // 84h
340cdf0e10cSrcweir DWORD	NegStackBase;	    // 88h
341cdf0e10cSrcweir DWORD	CurrentSS;	    // 8Ch
342cdf0e10cSrcweir DWORD	SSTable;	    // 90h
343cdf0e10cSrcweir DWORD	ThunkSS16;	    // 94h
344cdf0e10cSrcweir DWORD	TLSArray[64];	    // 98h
345cdf0e10cSrcweir DWORD	DeltaPriority;	    // 198h
346cdf0e10cSrcweir 
347cdf0e10cSrcweir // The retail version breaks off somewhere around here.
348cdf0e10cSrcweir // All the remaining fields are most likely only in the debug version
349cdf0e10cSrcweir 
350cdf0e10cSrcweir DWORD	un5[7]; 	    // 19Ch
351cdf0e10cSrcweir DWORD	pCreateData16;	    // 1B8h
352cdf0e10cSrcweir DWORD	APISuspendCount;    // 1BCh # of times SuspendThread has been called
353cdf0e10cSrcweir DWORD	un6;		    // 1C0h
354cdf0e10cSrcweir DWORD	WOWChain;	    // 1C4h
355cdf0e10cSrcweir WORD	wSSBig; 	    // 1C8h
356cdf0e10cSrcweir WORD	un7;		    // 1CAh
357cdf0e10cSrcweir DWORD	lp16SwitchRec;	    // 1CCh
358cdf0e10cSrcweir DWORD	un8[6]; 	    // 1D0h
359cdf0e10cSrcweir DWORD	pSomeCritSect1;     // 1E8h
360cdf0e10cSrcweir DWORD	pWin16Mutex;	    // 1ECh
361cdf0e10cSrcweir DWORD	pWin32Mutex;	    // 1F0h
362cdf0e10cSrcweir DWORD	pSomeCritSect2;     // 1F4h
363cdf0e10cSrcweir DWORD	un9;		    // 1F8h
364cdf0e10cSrcweir DWORD	ripString;	    // 1FCh
365cdf0e10cSrcweir DWORD	LastTlsSetValueEIP[64]; // 200h (parallel to TlsArray, contains EIP
366cdf0e10cSrcweir 				//	where TLS value was last set from)
367cdf0e10cSrcweir } THREAD_DATABASE, *PTHREAD_DATABASE;
368cdf0e10cSrcweir 
369