From 50aec61d3941c51767b42eb2421d2ea2c3df3f40 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 6 Aug 2016 20:00:48 -0700 Subject: [PATCH] libobs: Log whether user is running as administrator --- libobs/obs-windows.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libobs/obs-windows.c b/libobs/obs-windows.c index 7db3afe1e..8bc4683ad 100644 --- a/libobs/obs-windows.c +++ b/libobs/obs-windows.c @@ -181,6 +181,25 @@ static void log_windows_version(void) ver.major, ver.minor, ver.build, ver.revis); } +static void log_admin_status(void) +{ + SID_IDENTIFIER_AUTHORITY auth = SECURITY_NT_AUTHORITY; + PSID admin_group; + BOOL success; + + success = AllocateAndInitializeSid(&auth, 2, + SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &admin_group); + if (success) { + if (!CheckTokenMembership(NULL, admin_group, &success)) + success = false; + FreeSid(admin_group); + } + + blog(LOG_INFO, "Running as administrator: %s", + success ? "true" : "false"); +} + typedef HRESULT (WINAPI *dwm_is_composition_enabled_t)(BOOL*); static void log_aero(void) @@ -219,6 +238,7 @@ void log_system_info(void) log_processor_cores(); log_available_memory(); log_windows_version(); + log_admin_status(); log_aero(); }