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