source: trunk/include/win/thread.h@ 4657

Last change on this file since 4657 was 4657, checked in by sandervl, 25 years ago

header updates for TEB changes

File size: 7.8 KB
Line 
1/* $Id: thread.h,v 1.18 2000-11-21 11:33:59 sandervl Exp $ */
2
3/*
4 * Thread definitions
5 *
6 * Copyright 1996 Alexandre Julliard
7 */
8
9#ifndef __WINE_THREAD_H
10#define __WINE_THREAD_H
11
12#ifdef __WIN32OS2__
13#define TLS_MINIMUM_AVAILABLE 64
14 #ifndef __OS2_H__
15 #include "config.h"
16 #include "winbase.h"
17 #include "winuser.h"
18 #include <ntdef.h>
19 #endif
20 #include <ntdllsec.h> //PROCESSTHREAD_SECURITYINFO struct
21#else
22#include "config.h"
23#include "winbase.h"
24#include "selectors.h" /* for SET_FS */
25#endif
26
27struct _PDB;
28
29#ifndef OS2DEF_INCLUDED
30 /* QMSG structure */
31 typedef struct _QMSG /* qmsg */
32 {
33 HWND hwnd;
34 ULONG msg;
35 ULONG mp1;
36 ULONG mp2;
37 ULONG time;
38 POINTL ptl;
39 ULONG reserved;
40 } QMSG;
41#endif
42
43/* Thread exception block
44
45 flags in the comment:
46 1-- win95 field
47 d-- win95 debug version
48 -2- nt field
49 --3 wine special
50 --n wine unused
51 !-- or -!- likely or observed collision
52 more problems (collected from mailing list):
53 psapi.dll 0x10/0x30 (expects nt fields)
54 ie4 0x40
55 PESHiELD 0x23/0x30 (win95)
56*/
57
58#pragma pack(1)
59/* Thread exception block */
60typedef struct _TEB
61{
62/* start of NT_TIB */
63 void *except; /* 12- 00 Head of exception handling chain */
64 void *stack_top; /* 12- 04 Top of thread stack */
65 void *stack_low; /* 12- 08 Stack low-water mark */
66 HTASK16 htask16; /* 1-- 0c Win16 task handle */
67 WORD stack_sel; /* 1-- 0e 16-bit stack selector */
68 DWORD selman_list; /* 1-n 10 Selector manager list */
69 DWORD user_ptr; /* 12n 14 User pointer */
70/* end of NT_TIB */
71 struct _TEB *self; /* 12- 18 Pointer to this structure */
72 WORD tibflags; /* 1!n 1c Flags (NT: EnvironmentPointer) */
73 WORD mutex_count; /* 1-n 1e Win16 mutex count */
74 void *pid; /* !2- 20 Process id (win95: debug context) */
75 void *tid; /* -2- 24 Thread id */
76 HQUEUE16 queue; /* 1!- 28 Message queue (NT: DWORD ActiveRpcHandle)*/
77 WORD pad1; /* --n 2a */
78 LPVOID *tls_ptr; /* 2c Pointer to TLS array */
79 struct _PDB *process; /* 12- 30 owning process (win95: PDB; nt: NTPEB !!) */
80 DWORD flags; /* 1-n 34 */
81 DWORD exit_code; /* 1-- 38 Termination status */
82 WORD teb_sel; /* 1-- 3c Selector to TEB */
83 WORD emu_sel; /* 1-n 3e 80387 emulator selector */
84 DWORD unknown1; /* --n 40 */
85 DWORD unknown2; /* --n 44 */
86 void (*startup)(void); /* --3 48 Thread startup routine */
87 int thread_errno; /* --3 4c Per-thread errno (was: ring0_thread) */
88 int thread_h_errno; /* --3 50 Per-thread h_errno (was: ptr to tdbx structure) */
89 void *stack_base; /* 1-- 54 Base of the stack */
90 void *signal_stack; /* --3 58 Signal stack (was: exit_stack) */
91 void *emu_data; /* --n 5c Related to 80387 emulation */
92 DWORD last_error; /* 1-- 60 Last error code */
93 HANDLE debug_cb; /* 1-n 64 Debugger context block */
94 DWORD debug_thread; /* 1-n 68 Thread debugging this one (?) */
95 void *pcontext; /* 1-n 6c Thread register context */
96 DWORD cur_stack; /* --3 70 Current stack (was: unknown) */
97 DWORD ThunkConnect; /* 1-n 74 */
98 DWORD NegStackBase; /* 1-n 78 */
99 WORD current_ss; /* 1-n 7c Another 16-bit stack selector */
100 WORD pad2; /* --n 7e */
101 void *ss_table; /* --n 80 Pointer to info about 16-bit stack */
102 WORD thunk_ss; /* --n 84 Yet another 16-bit stack selector */
103 WORD pad3; /* --n 86 */
104 DWORD pad4[15]; /* --n 88 */
105 ULONG CurrentLocale; /* -2- C4 */
106 DWORD pad5[48]; /* --n C8 */
107 DWORD delta_priority; /* 1-n 188 Priority delta */
108 DWORD unknown4[7]; /* d-n 18c Unknown */
109 void *create_data; /* d-n 1a8 Pointer to creation structure */
110 DWORD suspend_count; /* d-n 1ac SuspendThread() counter */
111 void *entry_point; /* --3 1b0 Thread entry point (was: unknown) */
112 void *entry_arg; /* --3 1b4 Entry point arg (was: unknown) */
113 DWORD unknown5[4]; /* --n 1b8 Unknown */
114 DWORD sys_count[4]; /* --3 1c8 Syslevel mutex entry counters */
115 struct tagSYSLEVEL *sys_mutex[4]; /* --3 1d8 Syslevel mutex pointers */
116 DWORD unknown6[5]; /* --n 1e8 Unknown */
117
118 union {
119#ifdef __WIN32OS2__
120 struct {
121 struct _TEB *next;
122 DWORD OrgTIBSel; // Original OS/2 TIB selector (always the same, but let's not assume too much for future compatibility)
123 ULONG hmq; // Thread message queue
124 ULONG hab; // Thread Anchor block
125 ULONG hooks[WH_NB_HOOKS]; //list of hooks for this thread queue
126 ULONG threadId; // Thread ID
127 ULONG hThread; // thread handle
128 ULONG exceptFrame; // address of os/2 exception handler frame
129 ULONG newWindow; // Pointer to window object of window that was just created
130 void* pWsockData; // Winsock data pointer (NULL if unused)
131 DWORD lParam; // MessageExtraInfo
132 WINDOWPOS wp; // Used by message translation for WM_WINDOWPOSCHANGED
133 ULONG nrOfMsgs; // Usually 1; some PM messages can generated more than 1 win32 msg
134 BOOL fTranslated; // WM_CHAR already translated or not
135 ULONG msgstate; // odd -> dispatchmessage called, even -> not called
136 QMSG os2msg; // original os2 msg (received with Get- or PeekMessage)
137 MSG winmsg; // temporary storage for translated os2 msg (used in DispatchMessage)
138 MSG msg; // Used by message translation to store translated PM message (sent to win32 window proc in pmwindow.cpp)
139 MSG msgWCHAR; // Used to store extra WM_CHAR message generated by TranslateMessage
140 DWORD pidDebuggee; // process id of debuggee
141 DWORD logfile; // last FILE ptr used for logging (for exception handling in vfprintf)
142 PROCESSTHREAD_SECURITYINFO threadinfo; //used to store security info for thread tokens
143 DWORD lcid; // thread lcid
144 } odin;
145#endif
146 /* the following are nt specific fields */
147 DWORD pad6[633]; /* --n 214 */
148 } o;
149 UNICODE_STRING StaticUnicodeString; /* -2- bf8 used by advapi32 */
150 USHORT StaticUnicodeBuffer[261]; /* -2- c00 used by advapi32 */
151 DWORD pad7; /* --n e0c */
152#ifdef __WIN32OS2__
153 LPVOID tls_array[TLS_MINIMUM_AVAILABLE]; /* -2- e10 Thread local storage */
154#else
155 LPVOID tls_array[64]; /* -2- e10 Thread local storage */
156#endif
157 DWORD pad8[3]; /* --n f10 */
158 PVOID ReservedForNtRpc; /* -2- f1c used by rpcrt4 */
159 DWORD pad9[24]; /* --n f20 */
160 PVOID ErrorInfo; /* -2- f80 used by ole32 (IErrorInfo*) */
161} TEB;
162#pragma pack()
163
164/* Thread exception flags */
165#define TEBF_WIN32 0x0001
166#define TEBF_TRAP 0x0002
167
168
169/* The pseudo handle value returned by GetCurrentThread */
170#define CURRENT_THREAD_PSEUDOHANDLE 0xfffffffe
171
172#endif /* __WINE_THREAD_H */
Note: See TracBrowser for help on using the repository browser.