Module: wine Branch: master Commit: 8794879335652df5785203f30253866239f8590e URL: https://source.winehq.org/git/wine.git/?a=commit;h=8794879335652df5785203f30...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jul 1 09:00:08 2021 +0200
ntdll: Clear the 32-bit TLS for ZeroTlsCell in Wow64 mode.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/virtual.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 2484450055d..34b332a613c 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3017,6 +3017,11 @@ NTSTATUS virtual_clear_tls_index( ULONG index ) LIST_FOR_EACH_ENTRY( thread_data, &teb_list, struct ntdll_thread_data, entry ) { TEB *teb = CONTAINING_RECORD( thread_data, TEB, GdiTebBatch ); +#ifdef _WIN64 + WOW_TEB *wow_teb = get_wow_teb( teb ); + if (wow_teb) wow_teb->TlsSlots[index] = 0; + else +#endif teb->TlsSlots[index] = 0; } server_leave_uninterrupted_section( &virtual_mutex, &sigset ); @@ -3030,6 +3035,15 @@ NTSTATUS virtual_clear_tls_index( ULONG index ) LIST_FOR_EACH_ENTRY( thread_data, &teb_list, struct ntdll_thread_data, entry ) { TEB *teb = CONTAINING_RECORD( thread_data, TEB, GdiTebBatch ); +#ifdef _WIN64 + WOW_TEB *wow_teb = get_wow_teb( teb ); + if (wow_teb) + { + if (wow_teb->TlsExpansionSlots) + ((ULONG *)ULongToPtr( wow_teb->TlsExpansionSlots ))[index] = 0; + } + else +#endif if (teb->TlsExpansionSlots) teb->TlsExpansionSlots[index] = 0; } server_leave_uninterrupted_section( &virtual_mutex, &sigset );