From 4d5824112e13160e538013a25f1c13a124565180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 16 Mar 2021 20:28:09 +0100 Subject: [PATCH] ntdll: Don't call possibly deadly DbgUiGetThreadDebugObject. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/ntdll/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 83ae707ba3f..04bcdb18a2b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3215,7 +3215,8 @@ void WINAPI LdrShutdownThread(void) RtlReleasePebLock(); RtlLeaveCriticalSection( &loader_section ); - if (DbgUiGetThreadDebugObject()) NtClose( DbgUiGetThreadDebugObject() ); + /* don't call DbgUiGetThreadDebugObject as some apps hook it and terminate if called */ + if (NtCurrentTeb()->DbgSsReserved[1]) NtClose( NtCurrentTeb()->DbgSsReserved[1] ); RtlFreeThreadActivationContextStack(); }