diff --git a/CMakeLists.txt b/CMakeLists.txt index 144379b9..712e0975 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/public/common/TracySystem.cpp b/public/common/TracySystem.cpp index b48121b0..9ccb1bce 100644 --- a/public/common/TracySystem.cpp +++ b/public/common/TracySystem.cpp @@ -8,10 +8,15 @@ # ifndef NOMINMAX # define NOMINMAX # endif +# define SECURITY_WIN32 # include # include # include +# include # include "TracyWinFamily.hpp" +# ifdef _MSC_VER +# pragma comment(lib, "secur32.lib") +# endif #else # include # include @@ -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() );