Module: wine Branch: master Commit: f726b6ba79e2b0b98c5afba747457f6685e80f59 URL: https://gitlab.winehq.org/wine/wine/-/commit/f726b6ba79e2b0b98c5afba747457f6...
Author: Brendan Shanks bshanks@codeweavers.com Date: Tue Oct 18 15:45:24 2022 -0700
ntdll: Print correct thread rename trace if non-pseudo-handle to current thread is used.
---
dlls/ntdll/unix/thread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 3a737044407..0cf0da4ad4c 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -2282,9 +2282,10 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, if (!info) return STATUS_ACCESS_VIOLATION; if (info->ThreadName.Length && !info->ThreadName.Buffer) return STATUS_ACCESS_VIOLATION;
- if (handle == GetCurrentThread()) + status = NtQueryInformationThread( handle, ThreadBasicInformation, &tbi, sizeof(tbi), NULL ); + if (handle == GetCurrentThread() || (!status && (HandleToULong(tbi.ClientId.UniqueThread) == GetCurrentThreadId()))) WARN_(threadname)( "Thread renamed to %s\n", debugstr_us(&info->ThreadName) ); - else if (!NtQueryInformationThread( handle, ThreadBasicInformation, &tbi, sizeof(tbi), NULL )) + else if (!status) WARN_(threadname)( "Thread ID %04x renamed to %s\n", HandleToULong( tbi.ClientId.UniqueThread ), debugstr_us(&info->ThreadName) ); else WARN_(threadname)( "Thread handle %p renamed to %s\n", handle, debugstr_us(&info->ThreadName) );