summaryrefslogtreecommitdiffhomepage
path: root/windows/nsis-plugins/src/osinfo/osinfo.cpp
blob: f80a4b2b269b2c180a79daaf531fdf237bede95c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 HasWindows7Sha2Fix
(
	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);
	}
}