From 7df1b9e03a1f6bb3f0da49e346837a17cafc1f5c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 28 Aug 2003 19:57:35 +0000 Subject: [PATCH] Start using the exported TEB structure from winternl.h where possible. --- dlls/kernel/change.c | 1 + dlls/kernel/process.c | 1 + dlls/msvcrt/except.c | 1 - dlls/ntdll/exception.c | 1 + dlls/ntdll/thread.c | 1 + dlls/ntdll/virtual.c | 1 + dlls/ole32/compobj_private.h | 2 +- dlls/user/msg16.c | 1 - dlls/user/user_main.c | 1 - dlls/winedos/dosvm.c | 2 +- dlls/winsock/socket.c | 1 + include/async.h | 1 + include/thread.h | 4 +++ include/wine/server.h | 2 +- include/winternl.h | 65 ++++++++++++++++++++---------------- loader/module.c | 1 + memory/environ.c | 2 +- tools/winebuild/spec16.c | 2 +- windows/message.c | 1 - 19 files changed, 53 insertions(+), 38 deletions(-) diff --git a/dlls/kernel/change.c b/dlls/kernel/change.c index 601b813baf8..3cb2291b8ea 100644 --- a/dlls/kernel/change.c +++ b/dlls/kernel/change.c @@ -25,6 +25,7 @@ #include "winbase.h" #include "winerror.h" +#include "wine/windef16.h" #include "wine/server.h" #include "wine/debug.h" diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index 15c9380bd5f..b393cfa9811 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -23,6 +23,7 @@ #include "wine/winbase16.h" #include "wine/winuser16.h" +#include "thread.h" #include "wine/server.h" #include "wine/debug.h" diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index 3d2a2024063..1d7c0895019 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -30,7 +30,6 @@ #include "winternl.h" #include "wine/exception.h" -#include "thread.h" #include "msvcrt.h" #include "msvcrt/setjmp.h" diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index c5f1e8e2a07..289bbe37ebc 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -26,6 +26,7 @@ #include #include "windef.h" +#include "thread.h" #include "winternl.h" #include "wine/exception.h" #include "wine/server.h" diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index eea36117bbc..deb909c4845 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "thread.h" #include "winternl.h" #include "wine/server.h" #include "wine/debug.h" diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index f82eab3d516..0520b7d2ad5 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -40,6 +40,7 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT +#include "thread.h" #include "winternl.h" #include "global.h" #include "wine/library.h" diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index ff9fe0b9049..0d1b71d80d1 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -28,7 +28,7 @@ #include "wtypes.h" #include "dcom.h" -#include "thread.h" +#include "winternl.h" /* exported interface */ typedef struct tagXIF { diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c index 0ce268769c0..0b6156ca2a6 100644 --- a/dlls/user/msg16.c +++ b/dlls/user/msg16.c @@ -22,7 +22,6 @@ #include "wownt32.h" #include "winerror.h" #include "message.h" -#include "thread.h" #include "win.h" #include "winproc.h" #include "wine/debug.h" diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c index 78dc823cf11..7d5583d7043 100644 --- a/dlls/user/user_main.c +++ b/dlls/user/user_main.c @@ -32,7 +32,6 @@ #include "global.h" #include "message.h" #include "user.h" -#include "thread.h" #include "win.h" #include "wine/debug.h" diff --git a/dlls/winedos/dosvm.c b/dlls/winedos/dosvm.c index 24dec2f2698..fe05f5a5ef5 100644 --- a/dlls/winedos/dosvm.c +++ b/dlls/winedos/dosvm.c @@ -45,12 +45,12 @@ #include "winnt.h" #include "wincon.h" +#include "thread.h" #include "msdos.h" #include "file.h" #include "miscemu.h" #include "dosexe.h" #include "dosvm.h" -#include "thread.h" #include "wine/debug.h" #include "excpt.h" diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index f97119efc43..6b7ff03e39b 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -123,6 +123,7 @@ #include "winnt.h" #include "wownt32.h" #include "iphlpapi.h" +#include "thread.h" #include "wine/server.h" #include "wine/debug.h" diff --git a/include/async.h b/include/async.h index a620f7271ea..8422e41ab94 100644 --- a/include/async.h +++ b/include/async.h @@ -26,6 +26,7 @@ #ifndef __WINE_ASYNC_H #define __WINE_ASYNC_H +#include "thread.h" #include "wine/server.h" #include "winternl.h" diff --git a/include/thread.h b/include/thread.h index 9d7c63309f7..876d121f8d9 100644 --- a/include/thread.h +++ b/include/thread.h @@ -21,6 +21,7 @@ #ifndef __WINE_THREAD_H #define __WINE_THREAD_H +#define WINE_NO_TEB #include "winternl.h" #include "wine/windef16.h" @@ -51,6 +52,8 @@ struct debug_info ie4 0x40 PESHiELD 0x23/0x30 (win95) */ +#ifndef WINE_TEB_DEFINED +#define WINE_TEB_DEFINED typedef struct _TEB { NT_TIB Tib; /* 12- 00 Thread information block */ @@ -126,6 +129,7 @@ typedef struct _TEB DWORD pad9[24]; /* --n f20 */ PVOID ReservedForOle; /* -2- f80 used by ole32 (IErrorInfo*) */ } TEB; +#endif /* WINE_TEB_DEFINED */ /* Thread exception flags */ #define TEBF_WIN32 0x0001 diff --git a/include/wine/server.h b/include/wine/server.h index acde06776f7..5b47c14151b 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -21,7 +21,7 @@ #ifndef __WINE_WINE_SERVER_H #define __WINE_WINE_SERVER_H -#include "thread.h" +#include "winternl.h" #include "wine/exception.h" #include "wine/server_protocol.h" diff --git a/include/winternl.h b/include/winternl.h index 88b9186d13d..94c64fe1bb7 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -30,35 +30,6 @@ extern "C" { #endif /* defined(__cplusplus) */ -/*********************************************************************** - * TEB data structure - */ -#if 0 -typedef struct _TEB -{ - NT_TIB Tib; /* 000 */ - PVOID EnvironmentPointer; /* 01c */ - CLIENT_ID ClientId; /* 020 */ - PVOID ActiveRpcHandle; /* 028 */ - PVOID ThreadLocalStoragePointer; /* 02c */ - PPEB Peb; /* 030 */ - ULONG LastErrorValue; /* 034 */ - BYTE __pad038[140]; /* 038 */ - ULONG CurrentLocale; /* 0c4 */ - BYTE __pad0c8[1752]; /* 0c8 */ - PVOID Reserved2[278]; /* 7a0 */ - UNICODE_STRING StaticUnicodeString; /* bf8 used by advapi32 */ - WCHAR StaticUnicodeBuffer[261]; /* c00 used by advapi32 */ - PVOID DeallocationStack; /* e0c */ - PVOID TlsSlots[64]; /* e10 */ - BYTE Reserved3[8]; /* f10 */ - PVOID Reserved4[26]; /* f18 */ - PVOID ReservedForOle; /* f80 Windows 2000 only */ - PVOID Reserved5[4]; /* f84 */ - PVOID TlsExpansionSlots; /* f94 */ -} TEB, *PTEB; -#endif - /********************************************************************** * Fundamental types and data structures */ @@ -175,6 +146,42 @@ typedef struct _PEB } PEB, *PPEB; +/*********************************************************************** + * TEB data structure + */ +#if defined(_NTSYSTEM_) || defined(_KERNEL32_) /* hack, should go away */ +# define WINE_NO_TEB +#endif + +#ifndef WINE_NO_TEB /* don't define TEB if included from thread.h */ +# ifndef WINE_TEB_DEFINED +# define WINE_TEB_DEFINED +typedef struct _TEB +{ + NT_TIB Tib; /* 000 */ + PVOID EnvironmentPointer; /* 01c */ + CLIENT_ID ClientId; /* 020 */ + PVOID ActiveRpcHandle; /* 028 */ + PVOID ThreadLocalStoragePointer; /* 02c */ + PPEB Peb; /* 030 */ + ULONG LastErrorValue; /* 034 */ + BYTE __pad038[140]; /* 038 */ + ULONG CurrentLocale; /* 0c4 */ + BYTE __pad0c8[1752]; /* 0c8 */ + PVOID Reserved2[278]; /* 7a0 */ + UNICODE_STRING StaticUnicodeString; /* bf8 used by advapi32 */ + WCHAR StaticUnicodeBuffer[261]; /* c00 used by advapi32 */ + PVOID DeallocationStack; /* e0c */ + PVOID TlsSlots[64]; /* e10 */ + BYTE Reserved3[8]; /* f10 */ + PVOID Reserved4[26]; /* f18 */ + PVOID ReservedForOle; /* f80 Windows 2000 only */ + PVOID Reserved5[4]; /* f84 */ + PVOID TlsExpansionSlots; /* f94 */ +} TEB, *PTEB; +# endif /* WINE_TEB_DEFINED */ +#endif /* WINE_NO_TEB */ + /*********************************************************************** * Enums */ diff --git a/loader/module.c b/loader/module.c index e18db677b5e..c7f92d189bf 100644 --- a/loader/module.c +++ b/loader/module.c @@ -34,6 +34,7 @@ #include "winerror.h" #include "winternl.h" #include "heap.h" +#include "thread.h" #include "file.h" #include "module.h" diff --git a/memory/environ.c b/memory/environ.c index 4579d421d55..a80d2680a22 100644 --- a/memory/environ.c +++ b/memory/environ.c @@ -27,7 +27,7 @@ #include "windef.h" #include "winerror.h" - +#include "thread.h" #include "wine/winbase16.h" #include "wine/server.h" #include "wine/library.h" diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index 948949db1a7..eccff57985c 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -29,9 +29,9 @@ #include #include "wine/exception.h" +#include "stackframe.h" #include "builtin16.h" #include "module.h" -#include "stackframe.h" #include "build.h" diff --git a/windows/message.c b/windows/message.c index 1a003b19119..c3e3dbf0a30 100644 --- a/windows/message.c +++ b/windows/message.c @@ -37,7 +37,6 @@ #include "controls.h" #include "dde.h" #include "message.h" -#include "thread.h" #include "user.h" #include "win.h" #include "winpos.h"