4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_THREAD_H
22 #define __WINE_THREAD_H
35 char *str_pos; /* current position in strings buffer */
36 char *out_pos; /* current position in output buffer */
37 char strings[1024]; /* buffer for temporary strings */
38 char output[1024]; /* current output line */
41 /* Thread exception block
45 d-- win95 debug version
49 !-- or -!- likely or observed collision
50 more problems (collected from mailing list):
51 psapi.dll 0x10/0x30 (expects nt fields)
53 PESHiELD 0x23/0x30 (win95)
55 #ifndef WINE_TEB_DEFINED
56 #define WINE_TEB_DEFINED
59 NT_TIB Tib; /* 12- 00 Thread information block */
60 PVOID EnvironmentPointer; /* 12- 1c EnvironmentPointer (win95: tib flags + win16 mutex count) */
61 CLIENT_ID ClientId; /* -2- 20 Process and thread id (win95: debug context) */
62 PVOID ActiveRpcHandle; /* 028 */
63 PVOID ThreadLocalStoragePointer; /* 02c Pointer to TLS array */
64 PEB *Peb; /* 030 owning process PEB */
65 DWORD LastErrorValue; /* 034 Last error code */
66 ULONG CountOfOwnedCriticalSections; /* 038 */
67 PVOID CsrClientThread; /* 03c */
68 PVOID Win32ThreadInfo; /* 040 */
69 ULONG Win32ClientInfo[0x1f]; /* 044 */
70 PVOID WOW32Reserved; /* 0c0 */
71 ULONG CurrentLocale; /* -2- C4 */
72 DWORD pad5[48]; /* --n C8 */
73 DWORD delta_priority; /* 1-n 188 Priority delta */
74 DWORD unknown4[7]; /* d-n 18c Unknown */
75 void *create_data; /* d-n 1a8 Pointer to creation structure */
76 DWORD suspend_count; /* d-n 1ac SuspendThread() counter */
77 DWORD unknown5[6]; /* --n 1b0 Unknown */
78 DWORD sys_count[4]; /* --3 1c8 Syslevel mutex entry counters */
79 struct tagSYSLEVEL *sys_mutex[4]; /* --3 1d8 Syslevel mutex pointers */
80 DWORD unknown6[5]; /* --n 1e8 Unknown */
82 /* The following are Wine-specific fields (NT: GDI stuff) */
83 DWORD unused_1fc; /* --3 1fc */
84 UINT code_page; /* --3 200 Thread code page */
85 DWORD teb_sel; /* --3 204 Selector to TEB */
86 DWORD gs_sel; /* --3 208 %gs selector for this thread */
87 int request_fd; /* --3 20c fd for sending server requests */
88 int reply_fd; /* --3 210 fd for receiving server replies */
89 int wait_fd[2]; /* --3 214 fd for sleeping server requests */
90 struct debug_info *debug_info; /* --3 21c Info for debugstr functions */
91 void *pthread_data; /* --3 220 Data for pthread emulation */
92 DWORD num_async_io; /* --3 224 number of pending async I/O in the server */
93 void *driver_data; /* --3 228 Graphics driver private data */
94 DWORD dpmi_vif; /* --3 22c Protected mode virtual interrupt flag */
95 DWORD vm86_pending; /* --3 230 Data for vm86 mode */
96 void *vm86_ptr; /* --3 234 Data for vm86 mode */
97 WORD stack_sel; /* --3 238 16-bit stack selector */
98 WORD htask16; /* --3 23a Win16 task handle */
99 /* here is plenty space for wine specific fields (don't forget to change pad6!!) */
101 /* the following are nt specific fields */
102 DWORD pad6[622]; /* --n 23c */
103 ULONG LastStatusValue; /* -2- bf4 */
104 UNICODE_STRING StaticUnicodeString; /* -2- bf8 used by advapi32 */
105 WCHAR StaticUnicodeBuffer[261]; /* -2- c00 used by advapi32 */
106 PVOID DeallocationStack; /* -2- e0c Base of the stack */
107 LPVOID TlsSlots[64]; /* -2- e10 Thread local storage */
108 LIST_ENTRY TlsLinks; /* -2- f10 */
110 PVOID ReservedForNtRpc; /* f1c */
111 PVOID DbgSsReserved[2]; /* f20 */
112 ULONG HardErrorDisabled; /* f28 */
113 PVOID Instrumentation[16]; /* f2c */
114 PVOID WinSockData; /* f6c */
115 ULONG GdiBatchCount; /* f70 */
116 ULONG Spare2; /* f74 */
117 ULONG Spare3; /* f78 */
118 ULONG Spare4; /* f7c */
119 PVOID ReservedForOle; /* f80 */
120 ULONG WaitingOnLoaderLock; /* f84 */
121 PVOID Reserved5[3]; /* f88 */
122 PVOID *TlsExpansionSlots; /* f94 */
124 #endif /* WINE_TEB_DEFINED */
127 /* The thread information for 16-bit threads */
128 /* NtCurrentTeb()->SubSystemTib points to this */
131 void *unknown; /* 00 unknown */
132 UNICODE_STRING *exe_name; /* 04 exe module name */
134 /* the following fields do not exist under Windows */
135 UNICODE_STRING exe_str; /* exe name string pointed to by exe_name */
136 CURDIR curdir; /* current directory */
137 WCHAR curdir_buffer[MAX_PATH];
138 } WIN16_SUBSYSTEM_TIB;
140 /* scheduler/thread.c */
141 extern TEB *THREAD_InitStack( TEB *teb, DWORD stack_size );
143 #endif /* __WINE_THREAD_H */