Mercurial > trustbridge
view common/util.c @ 321:824ef90a6721
Move is_elevated into common/util.c file for better reuse
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 07 Apr 2014 10:58:47 +0000 |
parents | |
children | 31ba7ed4d50f |
line wrap: on
line source
#include "util.h" #ifdef WIN32 #include <windows.h> #endif #ifdef WIN32 bool is_elevated() { HANDLE hToken = NULL; bool ret = false; if (OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken)) { DWORD elevation; DWORD cbSize = sizeof (DWORD); if (GetTokenInformation (hToken, TokenElevation, &elevation, sizeof (TokenElevation), &cbSize)) { ret = elevation; } } if (hToken) CloseHandle (hToken); return ret; } #endif