diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-02-16 15:26:47 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-02-17 13:02:40 +0100 |
| commit | 623a102b094ff85bcc98e60a424ff18df66cc747 (patch) | |
| tree | dfd0b18348400d40843afbe7d6c3bc8094a54659 /windows/nsis-plugins/src/os/os.cpp | |
| parent | 9f1eeca0791459be6d62bfd7ea687fdfc4833dc8 (diff) | |
| download | mullvadvpn-623a102b094ff85bcc98e60a424ff18df66cc747.tar.xz mullvadvpn-623a102b094ff85bcc98e60a424ff18df66cc747.zip | |
Add "os" NSIS plugin
Diffstat (limited to 'windows/nsis-plugins/src/os/os.cpp')
| -rw-r--r-- | windows/nsis-plugins/src/os/os.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/windows/nsis-plugins/src/os/os.cpp b/windows/nsis-plugins/src/os/os.cpp new file mode 100644 index 0000000000..b5b1e54250 --- /dev/null +++ b/windows/nsis-plugins/src/os/os.cpp @@ -0,0 +1,45 @@ +#include <stdafx.h> +#include "../error.h" +#include "update.h" +#include <libcommon/string.h> +#include <windows.h> +#include <nsis/pluginapi.h> +#include <functional> +#include <vector> + +enum PatchStatus +{ + PATCH_ERROR = 0, + PATCH_PRESENT, + PATCH_MISSING +}; + +void __declspec(dllexport) NSISCALL CheckWindows7Patch +( + HWND hwndParent, + int string_size, + LPTSTR variables, + stack_t** stacktop, + extra_parameters* extra, + ... +) +{ + EXDLL_INIT(); + + try + { + const auto success = update::HasSetupApiSha2Fix(); + pushstring(L""); + pushint(success ? PatchStatus::PATCH_PRESENT : PatchStatus::PATCH_MISSING); + } + catch (const std::exception& err) + { + pushstring(common::string::ToWide(err.what()).c_str()); + pushint(PatchStatus::PATCH_ERROR); + } + catch (...) + { + pushstring(L"Unspecified error"); + pushint(PatchStatus::PATCH_ERROR); + } +} |
