mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Check elevation status on Windows.
This commit is contained in:
parent
e1395f5a53
commit
7e23d873dc
@ -212,6 +212,7 @@
|
|||||||
<ClCompile Include="..\..\src\ImGuiContext.cpp" />
|
<ClCompile Include="..\..\src\ImGuiContext.cpp" />
|
||||||
<ClCompile Include="..\..\src\imgui\imgui_impl_glfw.cpp" />
|
<ClCompile Include="..\..\src\imgui\imgui_impl_glfw.cpp" />
|
||||||
<ClCompile Include="..\..\src\imgui\imgui_impl_opengl3.cpp" />
|
<ClCompile Include="..\..\src\imgui\imgui_impl_opengl3.cpp" />
|
||||||
|
<ClCompile Include="..\..\src\IsElevated.cpp" />
|
||||||
<ClCompile Include="..\..\src\main.cpp" />
|
<ClCompile Include="..\..\src\main.cpp" />
|
||||||
<ClCompile Include="..\..\src\ResolvService.cpp" />
|
<ClCompile Include="..\..\src\ResolvService.cpp" />
|
||||||
<ClCompile Include="..\..\src\RunQueue.cpp" />
|
<ClCompile Include="..\..\src\RunQueue.cpp" />
|
||||||
@ -347,6 +348,7 @@
|
|||||||
<ClInclude Include="..\..\src\imgui\imgui_impl_glfw.h" />
|
<ClInclude Include="..\..\src\imgui\imgui_impl_glfw.h" />
|
||||||
<ClInclude Include="..\..\src\imgui\imgui_impl_opengl3.h" />
|
<ClInclude Include="..\..\src\imgui\imgui_impl_opengl3.h" />
|
||||||
<ClInclude Include="..\..\src\imgui\imgui_impl_opengl3_loader.h" />
|
<ClInclude Include="..\..\src\imgui\imgui_impl_opengl3_loader.h" />
|
||||||
|
<ClInclude Include="..\..\src\IsElevated.hpp" />
|
||||||
<ClInclude Include="..\..\src\ResolvService.hpp" />
|
<ClInclude Include="..\..\src\ResolvService.hpp" />
|
||||||
<ClInclude Include="..\..\src\RunQueue.hpp" />
|
<ClInclude Include="..\..\src\RunQueue.hpp" />
|
||||||
<ClInclude Include="..\..\src\stb_image.h" />
|
<ClInclude Include="..\..\src\stb_image.h" />
|
||||||
|
@ -378,6 +378,9 @@
|
|||||||
<ClCompile Include="..\..\..\server\TracyFileselector.cpp">
|
<ClCompile Include="..\..\..\server\TracyFileselector.cpp">
|
||||||
<Filter>server</Filter>
|
<Filter>server</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\IsElevated.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\server\TracyEvent.hpp">
|
<ClInclude Include="..\..\..\server\TracyEvent.hpp">
|
||||||
@ -764,6 +767,9 @@
|
|||||||
<ClInclude Include="..\..\..\server\TracyFileselector.hpp">
|
<ClInclude Include="..\..\..\server\TracyFileselector.hpp">
|
||||||
<Filter>server</Filter>
|
<Filter>server</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\IsElevated.hpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include="DebugVis.natvis" />
|
<Natvis Include="DebugVis.natvis" />
|
||||||
|
32
profiler/src/IsElevated.cpp
Normal file
32
profiler/src/IsElevated.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "IsElevated.hpp"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
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
|
6
profiler/src/IsElevated.hpp
Normal file
6
profiler/src/IsElevated.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __ISELEVATED_HPP__
|
||||||
|
#define __ISELEVATED_HPP__
|
||||||
|
|
||||||
|
bool IsElevated();
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user