diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-10-11 14:29:25 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-10-11 14:29:25 +0300 |
commit | f9228256ae6f52f7fcc7717a53780586bed10e15 (patch) | |
tree | c021a8b75f728f2f9ea2b75591653eacf17fd334 /src/main.cpp | |
parent | turn on /W4 (diff) | |
download | privilege-check-f9228256ae6f52f7fcc7717a53780586bed10e15.tar.gz privilege-check-f9228256ae6f52f7fcc7717a53780586bed10e15.zip |
hardening
Diffstat (limited to '')
-rw-r--r-- | src/main.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp index be8d5e7..3ae2bcc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ #include <CommCtrl.h> #include <windowsx.h> +#include <exception> #include <string> #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") @@ -223,17 +224,25 @@ int APIENTRY wWinMain( wchar_t*, int) { - const auto ret = DialogBoxW( - instance, - MAKEINTRESOURCE(IDD_MAINDIALOG), - NULL, - dialog_main); + try + { + const auto ret = DialogBoxW( + instance, + MAKEINTRESOURCE(IDD_MAINDIALOG), + NULL, + dialog_main); - switch (ret) + switch (ret) + { + case -1: + error::report(error::make("DialogBoxW")); + default: + return static_cast<int>(ret); + } + } + catch (const std::exception& e) { - case -1: - error::report(error::make("DialogBoxW")); - default: - return static_cast<int>(ret); + error::report(e); + return 1; } } |