0
0
mirror of https://github.com/wolfpld/tracy.git synced 2026-01-18 17:11:26 +01:00

Implement full user name retrieval on win32.

This commit is contained in:
Bartosz Taudul
2025-12-30 15:10:08 +01:00
parent 9016911a04
commit 5bc2e4b95c
2 changed files with 9 additions and 1 deletions

View File

@@ -78,7 +78,7 @@ endif()
# Public dependency on some libraries required when using Mingw
if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
target_link_libraries(TracyClient PUBLIC ws2_32 dbghelp)
target_link_libraries(TracyClient PUBLIC ws2_32 dbghelp secur32)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")

View File

@@ -8,10 +8,15 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
# define SECURITY_WIN32
# include <windows.h>
# include <malloc.h>
# include <lmcons.h>
# include <security.h>
# include "TracyWinFamily.hpp"
# ifdef _MSC_VER
# pragma comment(lib, "secur32.lib")
# endif
#else
# include <pthread.h>
# include <pwd.h>
@@ -363,6 +368,9 @@ TRACY_API const char* GetUserLogin()
TRACY_API const char* GetUserFullName()
{
#if defined _WIN32
static char buf[1024];
ULONG size = sizeof( buf );
if( GetUserNameExA( NameDisplay, buf, &size ) ) return buf;
return nullptr;
#elif defined __ANDROID__
const auto passwd = getpwuid( getuid() );