diff --git a/profiler/build/win32/Tracy.vcxproj b/profiler/build/win32/Tracy.vcxproj index 834e38c5..83351c3d 100644 --- a/profiler/build/win32/Tracy.vcxproj +++ b/profiler/build/win32/Tracy.vcxproj @@ -212,6 +212,7 @@ + @@ -347,6 +348,7 @@ + diff --git a/profiler/build/win32/Tracy.vcxproj.filters b/profiler/build/win32/Tracy.vcxproj.filters index a97ea0b0..31415380 100644 --- a/profiler/build/win32/Tracy.vcxproj.filters +++ b/profiler/build/win32/Tracy.vcxproj.filters @@ -378,6 +378,9 @@ server + + src + @@ -764,6 +767,9 @@ server + + src + diff --git a/profiler/src/IsElevated.cpp b/profiler/src/IsElevated.cpp new file mode 100644 index 00000000..2f257b72 --- /dev/null +++ b/profiler/src/IsElevated.cpp @@ -0,0 +1,32 @@ +#include "IsElevated.hpp" + +#ifdef _WIN32 + +#include + +bool IsElevated() +{ + HANDLE token; + if( OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY, &token ) == 0 ) return false; + + TOKEN_ELEVATION te; + DWORD sz; + if( GetTokenInformation( token, TokenElevation, &te, sizeof( te ), &sz ) == 0 ) + { + CloseHandle( token ); + return false; + } + + bool ret = te.TokenIsElevated; + CloseHandle( token ); + return ret; +} + +#else + +bool IsElevated() +{ + return false; +} + +#endif diff --git a/profiler/src/IsElevated.hpp b/profiler/src/IsElevated.hpp new file mode 100644 index 00000000..35c73984 --- /dev/null +++ b/profiler/src/IsElevated.hpp @@ -0,0 +1,6 @@ +#ifndef __ISELEVATED_HPP__ +#define __ISELEVATED_HPP__ + +bool IsElevated(); + +#endif