aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-09-15 23:41:17 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-09-15 23:41:17 +0300
commitd48c38c1a1c6ef28d47de180c845c6292e9f19b8 (patch)
treee9d7138629f8afe2962f5bdf8b6167f94c57547e
parentlink the runtime statically (diff)
downloadprivilege-check-d48c38c1a1c6ef28d47de180c845c6292e9f19b8.tar.gz
privilege-check-d48c38c1a1c6ef28d47de180c845c6292e9f19b8.zip
update resources
Diffstat (limited to '')
-rw-r--r--main.cpp26
-rw-r--r--main.rc14
-rw-r--r--resource_ids.h8
3 files changed, 27 insertions, 21 deletions
diff --git a/main.cpp b/main.cpp
index 44e4b35..cbb77cf 100644
--- a/main.cpp
+++ b/main.cpp
@@ -38,6 +38,12 @@ void set_label(HWND root, int id, bool val)
SetWindowTextW(label, val ? L"True" : L"False");
}
+void set_label(HWND root, int id, const wchar_t* s)
+{
+ const auto label = GetDlgItem(root, id);
+ SetWindowTextW(label, s);
+}
+
void set_label(HWND root, int id, const std::wstring& s)
{
const auto label = GetDlgItem(root, id);
@@ -48,21 +54,21 @@ BOOL on_init_dialog(HWND wnd, HWND, LPARAM)
{
try
{
- set_label(wnd, IDC_STATIC_ADMINISTRATOR, is_user_in_administrators());
+ set_label(wnd, IDC_ADMINISTRATOR, is_user_in_administrators());
}
catch (const Error& e)
{
- set_label(wnd, IDC_STATIC_ADMINISTRATOR, L"N/A");
+ set_label(wnd, IDC_ADMINISTRATOR, L"N/A");
error::report(e);
}
try
{
- set_label(wnd, IDC_STATIC_RUN_AS_ADMINISTRATOR, is_run_as_administrator());
+ set_label(wnd, IDC_RUN_AS_ADMINISTRATOR, is_run_as_administrator());
}
catch (const Error& e)
{
- set_label(wnd, IDC_STATIC_RUN_AS_ADMINISTRATOR, L"N/A");
+ set_label(wnd, IDC_RUN_AS_ADMINISTRATOR, L"N/A");
error::report(e);
}
@@ -71,32 +77,32 @@ BOOL on_init_dialog(HWND wnd, HWND, LPARAM)
try
{
const auto elevated = is_elevated();
- set_label(wnd, IDC_STATIC_ELEVATED, elevated);
+ set_label(wnd, IDC_ELEVATED, elevated);
const auto elevate_button = GetDlgItem(wnd, IDC_BUTTON_ELEVATE);
Button_SetElevationRequiredState(elevate_button, !elevated);
}
catch (const Error& e)
{
- set_label(wnd, IDC_STATIC_ELEVATED, L"N/A");
+ set_label(wnd, IDC_ELEVATED, L"N/A");
error::report(e);
}
try
{
- set_label(wnd, IDC_STATIC_INTEGRITY_LEVEL, token::integrity_level_to_string(
+ set_label(wnd, IDC_INTEGRITY_LEVEL, token::integrity_level_to_string(
token::query_integrity_level(token::open_for_current_process())));
}
catch (const Error& e)
{
- set_label(wnd, IDC_STATIC_INTEGRITY_LEVEL, L"N/A");
+ set_label(wnd, IDC_INTEGRITY_LEVEL, L"N/A");
error::report(e);
}
}
else
{
- set_label(wnd, IDC_STATIC_ELEVATED, L"N/A");
- set_label(wnd, IDC_STATIC_INTEGRITY_LEVEL, L"N/A");
+ set_label(wnd, IDC_ELEVATED, L"N/A");
+ set_label(wnd, IDC_INTEGRITY_LEVEL, L"N/A");
}
return TRUE;
diff --git a/main.rc b/main.rc
index 75c9f19..56adfd9 100644
--- a/main.rc
+++ b/main.rc
@@ -31,14 +31,14 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS
CAPTION "Privilege test"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "Administrator:",IDC_STATIC,7,7,75,12
- RTEXT "",IDC_STATIC_ADMINISTRATOR,85,7,28,12
- LTEXT "Run as administrator:",IDC_STATIC,7,19,75,12
- RTEXT "",IDC_STATIC_RUN_AS_ADMINISTRATOR,85,19,28,12
- LTEXT "Elevated:",IDC_STATIC,7,31,75,12
- RTEXT "",IDC_STATIC_ELEVATED,85,31,28,12
+ LTEXT "Administrator?",IDC_STATIC,7,7,75,12
+ RTEXT "",IDC_ADMINISTRATOR,85,7,28,12
+ LTEXT "Run as administrator?",IDC_STATIC,7,19,75,12
+ RTEXT "",IDC_RUN_AS_ADMINISTRATOR,85,19,28,12
+ LTEXT "Elevated?",IDC_STATIC,7,31,75,12
+ RTEXT "",IDC_ELEVATED,85,31,28,12
LTEXT "Integrity level:",IDC_STATIC,7,43,75,12
- RTEXT "",IDC_STATIC_INTEGRITY_LEVEL,85,43,28,15
+ RTEXT "",IDC_INTEGRITY_LEVEL,85,43,28,15
PUSHBUTTON "Elevate",IDC_BUTTON_ELEVATE,7,58,106,14
END
diff --git a/resource_ids.h b/resource_ids.h
index d77ee63..353dbd2 100644
--- a/resource_ids.h
+++ b/resource_ids.h
@@ -4,10 +4,10 @@
//
#define IDD_MAINDIALOG 100
#define IDC_BUTTON_ELEVATE 1000
-#define IDC_STATIC_ADMINISTRATOR 1001
-#define IDC_STATIC_RUN_AS_ADMINISTRATOR 1002
-#define IDC_STATIC_ELEVATED 1003
-#define IDC_STATIC_INTEGRITY_LEVEL 1004
+#define IDC_ADMINISTRATOR 1001
+#define IDC_RUN_AS_ADMINISTRATOR 1002
+#define IDC_ELEVATED 1003
+#define IDC_INTEGRITY_LEVEL 1004
#define IDC_STATIC -1
// Next default values for new objects