Report win2k service pack 4 instead of 3.
[wine/multimedia.git] / include / thread.h
blob210a96c1d5a442152137c14594695dd1402ea168
1 /*
2 * Thread definitions
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
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <winreg.h>
28 #define WINE_NO_TEB
29 #include <winternl.h>
30 #include <wine/windef16.h>
32 struct _SECURITY_ATTRIBUTES;
33 struct tagSYSLEVEL;
34 struct server_buffer_info;
35 struct fiber_data;
37 struct debug_info
39 char *str_pos; /* current position in strings buffer */
40 char *out_pos; /* current position in output buffer */
41 char strings[1024]; /* buffer for temporary strings */
42 char output[1024]; /* current output line */
45 /* Thread exception block
47 flags in the comment:
48 1-- win95 field
49 d-- win95 debug version
50 -2- nt field
51 --3 wine special
52 --n wine unused
53 !-- or -!- likely or observed collision
54 more problems (collected from mailing list):
55 psapi.dll 0x10/0x30 (expects nt fields)
56 ie4 0x40
57 PESHiELD 0x23/0x30 (win95)
59 #ifndef WINE_TEB_DEFINED
60 #define WINE_TEB_DEFINED
61 typedef struct _TEB
63 NT_TIB Tib; /* 12- 00 Thread information block */
64 PVOID EnvironmentPointer; /* 12- 1c EnvironmentPointer (win95: tib flags + win16 mutex count) */
65 CLIENT_ID ClientId; /* -2- 20 Process and thread id (win95: debug context) */
66 HQUEUE16 queue; /* 1!- 28 Message queue (NT: DWORD ActiveRpcHandle)*/
67 WORD pad1; /* --n 2a */
68 PVOID ThreadLocalStoragePointer; /* 1-- 2c Pointer to TLS array */
69 PEB *Peb; /* 12- 30 owning process PEB */
70 DWORD LastErrorValue; /* -2- 34 Last error code */
71 DWORD exit_code; /* 1-- 38 Termination status */
72 WORD teb_sel; /* 1-- 3c Selector to TEB */
73 WORD emu_sel; /* 1-n 3e 80387 emulator selector */
74 DWORD unknown1; /* --n 40 */
75 DWORD unknown2; /* --n 44 */
76 DWORD unknown3; /* --n 48 */
77 int thread_errno; /* --3 4c Per-thread errno (was: ring0_thread) */
78 int thread_h_errno; /* --3 50 Per-thread h_errno (was: ptr to tdbx structure) */
79 void *stack_base; /* 1-n 54 Stack base (unused) */
80 void *exit_stack; /* 1-n 58 Exit stack */
81 void *emu_data; /* --n 5c Related to 80387 emulation */
82 DWORD last_error; /* 1-- 60 Last error code */
83 HANDLE debug_cb; /* 1-n 64 Debugger context block */
84 DWORD debug_thread; /* 1-n 68 Thread debugging this one (?) */
85 void *pcontext; /* 1-n 6c Thread register context */
86 DWORD cur_stack; /* --3 70 Current stack (was: unknown) */
87 DWORD ThunkConnect; /* 1-n 74 */
88 DWORD NegStackBase; /* 1-n 78 */
89 WORD current_ss; /* 1-n 7c Another 16-bit stack selector */
90 WORD pad2; /* --n 7e */
91 void *ss_table; /* --n 80 Pointer to info about 16-bit stack */
92 WORD stack_sel; /* --3 84 16-bit stack selector */
93 HTASK16 htask16; /* --3 86 Win16 task handle */
94 DWORD pad4[15]; /* --n 88 */
95 ULONG CurrentLocale; /* -2- C4 */
96 DWORD pad5[48]; /* --n C8 */
97 DWORD delta_priority; /* 1-n 188 Priority delta */
98 DWORD unknown4[7]; /* d-n 18c Unknown */
99 void *create_data; /* d-n 1a8 Pointer to creation structure */
100 DWORD suspend_count; /* d-n 1ac SuspendThread() counter */
101 DWORD unknown5[6]; /* --n 1b0 Unknown */
102 DWORD sys_count[4]; /* --3 1c8 Syslevel mutex entry counters */
103 struct tagSYSLEVEL *sys_mutex[4]; /* --3 1d8 Syslevel mutex pointers */
104 DWORD unknown6[5]; /* --n 1e8 Unknown */
106 /* The following are Wine-specific fields (NT: GDI stuff) */
107 UINT code_page; /* --3 1fc Thread code page */
108 DWORD unused[2]; /* --3 200 Was server buffer */
109 DWORD gs_sel; /* --3 208 %gs selector for this thread */
110 int request_fd; /* --3 20c fd for sending server requests */
111 int reply_fd; /* --3 210 fd for receiving server replies */
112 int wait_fd[2]; /* --3 214 fd for sleeping server requests */
113 struct debug_info *debug_info; /* --3 21c Info for debugstr functions */
114 void *pthread_data; /* --3 220 Data for pthread emulation */
115 struct async_private *pending_list; /* --3 224 list of pending async operations */
116 void *driver_data; /* --3 228 Graphics driver private data */
117 DWORD dpmi_vif; /* --3 22c Protected mode virtual interrupt flag */
118 DWORD vm86_pending; /* --3 230 Data for vm86 mode */
119 void *vm86_ptr; /* --3 234 Data for vm86 mode */
120 /* here is plenty space for wine specific fields (don't forget to change pad6!!) */
122 /* the following are nt specific fields */
123 DWORD pad6[624]; /* --n 238 */
124 UNICODE_STRING StaticUnicodeString; /* -2- bf8 used by advapi32 */
125 WCHAR StaticUnicodeBuffer[261]; /* -2- c00 used by advapi32 */
126 PVOID DeallocationStack; /* -2- e0c Base of the stack */
127 LPVOID TlsSlots[64]; /* -2- e10 Thread local storage */
128 LIST_ENTRY TlsLinks; /* -2- f10 */
129 DWORD pad8[1]; /* --n f18 */
130 PVOID ReservedForNtRpc; /* -2- f1c used by rpcrt4 */
131 DWORD pad9[24]; /* --n f20 */
132 PVOID ReservedForOle; /* -2- f80 used by ole32 (IErrorInfo*) */
133 PVOID pad10[4]; /* --n f84 */
134 PVOID TlsExpansionSlots; /* -2- f94 */
135 } TEB;
136 #endif /* WINE_TEB_DEFINED */
139 /* The thread information for 16-bit threads */
140 /* NtCurrentTeb()->SubSystemTib points to this */
141 typedef struct
143 void *unknown; /* 00 unknown */
144 UNICODE_STRING *exe_name; /* 04 exe module name */
146 /* the following fields do not exist under Windows */
147 UNICODE_STRING exe_str; /* exe name string pointed to by exe_name */
148 CURDIR curdir; /* current directory */
149 WCHAR curdir_buffer[MAX_PATH];
150 } WIN16_SUBSYSTEM_TIB;
152 /* scheduler/thread.c */
153 extern TEB *THREAD_InitStack( TEB *teb, DWORD stack_size );
155 #endif /* __WINE_THREAD_H */