aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/mingw.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index 44356d6b0..b50c1ecee 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -1576,3 +1576,21 @@ void hide_console(void)
1576 } 1576 }
1577} 1577}
1578#endif 1578#endif
1579
1580int is_admin(void)
1581{
1582 int ret = FALSE;
1583 HANDLE h;
1584
1585 if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &h)) {
1586 TOKEN_ELEVATION elevation;
1587 DWORD size = sizeof(TOKEN_ELEVATION);
1588
1589 if (GetTokenInformation(h, TokenElevation, &elevation,
1590 sizeof(elevation), &size)) {
1591 ret = elevation.TokenIsElevated;
1592 }
1593 CloseHandle(h);
1594 }
1595 return ret;
1596}