Moved the ntdll per-thread data out of the TEB into a private
[wine] / include / thread.h
1 /*
2  * Thread definitions
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_THREAD_H
22 #define __WINE_THREAD_H
23
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
31 #ifndef WINE_TEB_DEFINED
32 #define WINE_TEB_DEFINED
33 typedef struct _TEB
34 {
35     NT_TIB       Tib;            /* 12-  00 Thread information block */
36     PVOID        EnvironmentPointer; /* 12-  1c EnvironmentPointer (win95: tib flags + win16 mutex count) */
37     CLIENT_ID    ClientId;       /* -2-  20 Process and thread id (win95: debug context) */
38     PVOID        ActiveRpcHandle;              /* 028 */
39     PVOID        ThreadLocalStoragePointer;    /* 02c Pointer to TLS array */
40     PEB         *Peb;                          /* 030 owning process PEB */
41     DWORD        LastErrorValue;               /* 034 Last error code */
42     ULONG        CountOfOwnedCriticalSections; /* 038 */
43     PVOID        CsrClientThread;              /* 03c */
44     PVOID        Win32ThreadInfo;              /* 040 */
45     ULONG        Win32ClientInfo[0x1f];        /* 044 */
46     PVOID        WOW32Reserved;                /* 0c0 */
47     ULONG        CurrentLocale;                /* 0c4 */
48     ULONG        FpSoftwareStatusRegister;     /* 0c8 */
49     PVOID        SystemReserved1[54];          /* 0cc */
50     PVOID        Spare1;                       /* 1a4 */
51     LONG         ExceptionCode;                /* 1a8 */
52     BYTE         SpareBytes1[40];              /* 1ac */
53     PVOID        SystemReserved2[10];          /* 1d4 */
54
55     /* The following are Wine-specific fields (NT: GdiTebBatch) */
56     DWORD        gs_sel;              /* 1fc %gs selector for this thread */
57     DWORD        num_async_io;        /* 200 number of pending async I/O in the server */
58     DWORD        dpmi_vif;            /* 204 protected mode virtual interrupt flag */
59     DWORD        vm86_pending;        /* 208 data for vm86 mode */
60     /* here is plenty space for wine specific fields (don't forget to change pad6!!) */
61     DWORD        pad6[308];           /* 20c */
62
63     ULONG        gdiRgn;                     /* 6dc */
64     ULONG        gdiPen;                     /* 6e0 */
65     ULONG        gdiBrush;                   /* 6e4 */
66     CLIENT_ID    RealClientId;               /* 6e8 */
67     HANDLE       GdiCachedProcessHandle;     /* 6f0 */
68     ULONG        GdiClientPID;               /* 6f4 */
69     ULONG        GdiClientTID;               /* 6f8 */
70     PVOID        GdiThreadLocaleInfo;        /* 6fc */
71     PVOID        UserReserved[5];            /* 700 */
72     PVOID        glDispachTable[280];        /* 714 */
73     ULONG        glReserved1[26];            /* b74 */
74     PVOID        glReserved2;                /* bdc */
75     PVOID        glSectionInfo;              /* be0 */
76     PVOID        glSection;                  /* be4 */
77     PVOID        glTable;                    /* be8 */
78     PVOID        glCurrentRC;                /* bec */
79     PVOID        glContext;                  /* bf0 */
80     ULONG        LastStatusValue;            /* bf4 */
81     UNICODE_STRING StaticUnicodeString;      /* bf8 */
82     WCHAR        StaticUnicodeBuffer[261];   /* c00 */
83     PVOID        DeallocationStack;          /* e0c */
84     PVOID        TlsSlots[64];               /* e10 */
85     LIST_ENTRY   TlsLinks;                   /* f10 */
86     PVOID        Vdm;                        /* f18 */
87     PVOID        ReservedForNtRpc;           /* f1c */
88     PVOID        DbgSsReserved[2];           /* f20 */
89     ULONG        HardErrorDisabled;          /* f28 */
90     PVOID        Instrumentation[16];        /* f2c */
91     PVOID        WinSockData;                /* f6c */
92     ULONG        GdiBatchCount;              /* f70 */
93     ULONG        Spare2;                     /* f74 */
94     ULONG        Spare3;                     /* f78 */
95     ULONG        Spare4;                     /* f7c */
96     PVOID        ReservedForOle;             /* f80 */
97     ULONG        WaitingOnLoaderLock;        /* f84 */
98     PVOID        Reserved5[3];               /* f88 */
99     PVOID       *TlsExpansionSlots;          /* f94 */
100 } TEB;
101 #endif /* WINE_TEB_DEFINED */
102
103
104 /* The thread information for 16-bit threads */
105 /* NtCurrentTeb()->SubSystemTib points to this */
106 typedef struct
107 {
108     void           *unknown;    /* 00 unknown */
109     UNICODE_STRING *exe_name;   /* 04 exe module name */
110
111     /* the following fields do not exist under Windows */
112     UNICODE_STRING  exe_str;    /* exe name string pointed to by exe_name */
113     CURDIR          curdir;     /* current directory */
114     WCHAR           curdir_buffer[MAX_PATH];
115 } WIN16_SUBSYSTEM_TIB;
116
117 #endif  /* __WINE_THREAD_H */