From: Brendan Shanks Subject: [PATCH v2 2/2] ntdll: Use +threadname channel for SetThreadDescription(). Message-Id: Date: Wed, 29 Jun 2022 16:24:17 +0000 In-Reply-To: References: From: Brendan Shanks Signed-off-by: Brendan Shanks --- dlls/ntdll/unix/thread.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index ad47a5fce74..ca1d1293d10 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -70,6 +70,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread); WINE_DECLARE_DEBUG_CHANNEL(seh); +WINE_DECLARE_DEBUG_CHANNEL(threadname); static int nb_threads = 1; @@ -2232,11 +2233,19 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, case ThreadNameInformation: { const THREAD_NAME_INFORMATION *info = data; + THREAD_BASIC_INFORMATION tbi; if (length != sizeof(*info)) return STATUS_INFO_LENGTH_MISMATCH; if (!info) return STATUS_ACCESS_VIOLATION; if (info->ThreadName.Length && !info->ThreadName.Buffer) return STATUS_ACCESS_VIOLATION; + if (handle == GetCurrentThread()) + WARN_(threadname)( "Thread renamed to %s\n", debugstr_us(&info->ThreadName) ); + else if (!NtQueryInformationThread( handle, ThreadBasicInformation, &tbi, sizeof(tbi), NULL )) + 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) ); + SERVER_START_REQ( set_thread_info ) { req->handle = wine_server_obj_handle( handle ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/89