update parallel rdp

This commit is contained in:
Logan McNaughton committed 2024-05-27 12:38:09 -06:00
1 parent 981d2d459b
commit cf08f49a21
82 files changed
+59984 -51057

No files matched your search

+19 -2
View File
@@ -24,6 +24,10 @@
#ifdef __linux__
#include <pthread.h>
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <string>
#endif
namespace Util
@@ -33,8 +37,21 @@ void set_current_thread_name(const char *name)
#ifdef __linux__
pthread_setname_np(pthread_self(), name);
#else
// TODO: Kinda messy.
(void)name;
using PFN_SetThreadDescription = HRESULT (WINAPI *)(HANDLE, PCWSTR);
auto module = GetModuleHandleA("kernel32.dll");
PFN_SetThreadDescription SetThreadDescription = module ? reinterpret_cast<PFN_SetThreadDescription>(
(void *)GetProcAddress(module, "SetThreadDescription")) : nullptr;
if (SetThreadDescription)
{
std::wstring wname;
while (*name != '\0')
{
wname.push_back(*name);
name++;
}
SetThreadDescription(GetCurrentThread(), wname.c_str());
}
#endif
}
}