Module: wine Branch: master Commit: aa3e772abf636663313ff0dfe299c6c383ed1b0a URL: https://gitlab.winehq.org/wine/wine/-/commit/aa3e772abf636663313ff0dfe299c6c...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Feb 24 11:51:35 2023 +0100
ntdll: Mark the Wow64 TLS slots as reserved.
---
dlls/ntdll/loader.c | 3 ++- include/winternl.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index f533db060d0..d0d9bae7f0b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4176,7 +4176,8 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 ); RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits, sizeof(peb->TlsExpansionBitmapBits) * 8 ); - RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */ + /* TLS index 0 is always reserved, and wow64 reserves extra TLS entries */ + RtlSetBits( peb->TlsBitmap, 0, NtCurrentTeb()->WowTebOffset ? WOW64_TLS_MAX_NUMBER : 1 );
init_user_process_params(); load_global_options(); diff --git a/include/winternl.h b/include/winternl.h index 3a6c89a5f7a..93bd32e3786 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1084,6 +1084,7 @@ typedef struct _TEB64 #define WOW64_TLS_TEMPLIST 3 #define WOW64_TLS_USERCALLBACKDATA 5 #define WOW64_TLS_FILESYSREDIR 8 +#define WOW64_TLS_MAX_NUMBER 19
/***********************************************************************