[PATCH v2 2/2] ntdll: Use +threadname channel for SetThreadDescription().
Brendan Shanks
wine at gitlab.winehq.org
Wed Jun 29 11:24:17 CDT 2022
From: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
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
More information about the wine-devel
mailing list