Check if GetThreadDescription() is supported.

This functionality is available since Win 10 1607.
This commit is contained in:
Bartosz Taudul 2021-05-04 16:13:42 +02:00
parent 402d749d13
commit a6c6943a6c
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -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 );