mirror of
https://github.com/wolfpld/tracy
synced 2026-01-19 04:52:09 +00:00
Implement full user name retrieval on win32.
This commit is contained in:
@@ -78,7 +78,7 @@ endif()
|
|||||||
|
|
||||||
# Public dependency on some libraries required when using Mingw
|
# Public dependency on some libraries required when using Mingw
|
||||||
if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
|
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()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
|
|||||||
@@ -8,10 +8,15 @@
|
|||||||
# ifndef NOMINMAX
|
# ifndef NOMINMAX
|
||||||
# define NOMINMAX
|
# define NOMINMAX
|
||||||
# endif
|
# endif
|
||||||
|
# define SECURITY_WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
# include <lmcons.h>
|
# include <lmcons.h>
|
||||||
|
# include <security.h>
|
||||||
# include "TracyWinFamily.hpp"
|
# include "TracyWinFamily.hpp"
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# pragma comment(lib, "secur32.lib")
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
@@ -363,6 +368,9 @@ TRACY_API const char* GetUserLogin()
|
|||||||
TRACY_API const char* GetUserFullName()
|
TRACY_API const char* GetUserFullName()
|
||||||
{
|
{
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
|
static char buf[1024];
|
||||||
|
ULONG size = sizeof( buf );
|
||||||
|
if( GetUserNameExA( NameDisplay, buf, &size ) ) return buf;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#elif defined __ANDROID__
|
#elif defined __ANDROID__
|
||||||
const auto passwd = getpwuid( getuid() );
|
const auto passwd = getpwuid( getuid() );
|
||||||
|
|||||||
Reference in New Issue
Block a user