comparison 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
comparison
equal deleted inserted replaced
320:1628615d904e 321:824ef90a6721
1 #include "util.h"
2 #ifdef WIN32
3 #include <windows.h>
4 #endif
5
6 #ifdef WIN32
7 bool
8 is_elevated() {
9 HANDLE hToken = NULL;
10 bool ret = false;
11 if (OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken))
12 {
13 DWORD elevation;
14 DWORD cbSize = sizeof (DWORD);
15 if (GetTokenInformation (hToken, TokenElevation, &elevation,
16 sizeof (TokenElevation), &cbSize))
17 {
18 ret = elevation;
19 }
20 }
21 if (hToken)
22 CloseHandle (hToken);
23
24 return ret;
25 }
26 #endif

http://wald.intevation.org/projects/trustbridge/