From a6c6943a6c3d0de8c1054979f314bcf8575f7d05 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 4 May 2021 16:13:42 +0200 Subject: [PATCH] Check if GetThreadDescription() is supported. This functionality is available since Win 10 1607. --- client/TracySysTrace.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/client/TracySysTrace.cpp b/client/TracySysTrace.cpp index 83575f1f..ff459b2a 100644 --- a/client/TracySysTrace.cpp +++ b/client/TracySysTrace.cpp @@ -486,16 +486,19 @@ void SysTraceSendExternalName( uint64_t thread ) } if( hnd != 0 ) { - PWSTR tmp; - _GetThreadDescription( hnd, &tmp ); - char buf[256]; - if( tmp ) + if( _GetThreadDescription ) { - auto ret = wcstombs( buf, tmp, 256 ); - if( ret != 0 ) + PWSTR tmp; + _GetThreadDescription( hnd, &tmp ); + char buf[256]; + if( tmp ) { - GetProfiler().SendString( thread, buf, ret, QueueType::ExternalThreadName ); - threadSent = true; + auto ret = wcstombs( buf, tmp, 256 ); + if( ret != 0 ) + { + GetProfiler().SendString( thread, buf, ret, QueueType::ExternalThreadName ); + threadSent = true; + } } } const auto pid = GetProcessIdOfThread( hnd );