Release 970525
[wine/multimedia.git] / include / thread.h
blobec3fa4a6fcada089ac9a7b294008615b25a3f7bd
1 /*
2 * Thread definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_THREAD_H
8 #define __WINE_THREAD_H
10 #include "process.h"
11 #include "winnt.h"
13 /* Thread exception block */
14 typedef struct _TEB
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 */
29 WORD pad1; /* 2a */
30 LPVOID *tls_ptr; /* 2c Pointer to TLS array */
31 } TEB;
33 /* Thread database */
34 typedef struct _THDB
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 */
59 WORD pad2; /* 8e */
60 void *ss_table; /* 90 Pointer to info about 16-bit stack */
61 WORD thunk_ss; /* 94 Yet another 16-bit stack selector */
62 WORD pad3; /* 96 */
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 */
76 } THDB;
79 extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size,
80 LPTHREAD_START_ROUTINE start_addr );
81 extern void THREAD_Destroy( K32OBJ *ptr );
83 extern THDB *pCurrentThread;
85 #endif /* __WINE_THREAD_H */