summaryrefslogtreecommitdiffhomepage
path: root/windows/nsis-plugins/src/os/os.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'windows/nsis-plugins/src/os/os.cpp')
-rw-r--r--windows/nsis-plugins/src/os/os.cpp45
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);
+ }
+}