4 * Copyright 1996 Alexandre Julliard
7 #ifndef __WINE_THREAD_H
8 #define __WINE_THREAD_H
13 /* Thread exception block */
16 void *except; /* 00 Head of exception handling chain */
17 void *stack_top; /* 04 Top of thread stack */
18 void *stack_low; /* 08 Stack low-water mark */
19 HTASK16 htask16; /* 0c Win16 task handle */
20 WORD stack_sel; /* 0e 16-bit stack selector */
21 DWORD selman_list; /* 10 Selector manager list */
22 DWORD user_ptr; /* 14 User pointer */
23 struct _TEB *self; /* 18 Pointer to this structure */
24 WORD flags; /* 1c Flags */
25 WORD mutex_count; /* 1e Win16 mutex count */
26 DWORD debug_context; /* 20 Debug context */
27 DWORD *ppriority; /* 24 Pointer to current priority */
28 HQUEUE16 queue; /* 28 Message queue */
30 LPVOID *tls_ptr; /* 2c Pointer to TLS array */
36 K32OBJ header; /* 00 Kernel object header */
37 PDB32 *process; /* 08 Process owning this thread */
38 K32OBJ *event; /* 0c Thread event */
39 TEB teb; /* 10 Thread exception block */
40 PDB32 *process2; /* 40 Same as offset 08 (?) */
41 DWORD flags; /* 44 Flags */
42 DWORD exit_code; /* 48 Termination status */
43 WORD teb_sel; /* 4c Selector to TEB */
44 WORD emu_sel; /* 4e 80387 emulator selector */
45 DWORD unknown1; /* 50 Unknown */
46 void *wait_list; /* 54 Event waiting list */
47 DWORD unknown2; /* 58 Unknown */
48 void *ring0_thread; /* 5c Pointer to ring 0 thread */
49 void *ptdbx; /* 60 Pointer to TDBX structure */
50 void *stack_base; /* 64 Base of the stack */
51 void *exit_stack; /* 68 Stack pointer on thread exit */
52 void *emu_data; /* 6c Related to 80387 emulation */
53 DWORD last_error; /* 70 Last error code */
54 void *debugger_CB; /* 74 Debugger context block */
55 DWORD debug_thread; /* 78 Thread debugging this one (?) */
56 void *pcontext; /* 7c Thread register context */
57 DWORD unknown3[3]; /* 80 Unknown */
58 WORD current_ss; /* 8c Another 16-bit stack selector */
60 void *ss_table; /* 90 Pointer to info about 16-bit stack */
61 WORD thunk_ss; /* 94 Yet another 16-bit stack selector */
63 LPVOID tls_array[64]; /* 98 Thread local storage */
64 DWORD delta_priority; /* 198 Priority delta */
65 DWORD unknown4[7]; /* 19c Unknown */
66 void *create_data; /* 1b8 Pointer to creation structure */
67 DWORD suspend_count; /* 1bc SuspendThread() counter */
68 DWORD unknown5[9]; /* 1c0 Unknown */
69 K32OBJ *crit_section; /* 1e4 Some critical section */
70 K32OBJ *win16_mutex; /* 1e8 Pointer to Win16 mutex */
71 K32OBJ *win32_mutex; /* 1ec Pointer to KERNEL32 mutex */
72 K32OBJ *crit_section2; /* 1f0 Another critical section */
73 DWORD unknown6[3]; /* 1f4 Unknown */
74 /* The following are Wine-specific fields */
75 CONTEXT context; /* 200 Thread context */
79 extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size,
80 LPTHREAD_START_ROUTINE start_addr );
81 extern void THREAD_Destroy( K32OBJ *ptr );
82 extern THDB *THREAD_Current(void);
83 extern THDB *THREAD_SwitchThread( CONTEXT *context );
85 extern THDB *pCurrentThread;
87 #endif /* __WINE_THREAD_H */