aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/installer
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-08-02 02:29:55 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-08-02 13:54:04 +0200
commit012bc72ad0e444ce231c08538a1848b1561f8d76 (patch)
tree8151e95d01569f13fa0823f4315ec21afdeef6c5 /installer
parentfetcher: close winverifytrust handle after usage (diff)
downloadwireguard-windows-012bc72ad0e444ce231c08538a1848b1561f8d76.tar.xz
wireguard-windows-012bc72ad0e444ce231c08538a1848b1561f8d76.zip
installer: do not require KB2921916
In anticipation of upcoming wintun changes. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'installer')
-rw-r--r--installer/customactions.c88
-rw-r--r--installer/wireguard.wxs8
2 files changed, 0 insertions, 96 deletions
diff --git a/installer/customactions.c b/installer/customactions.c
index 981415e1..7c6a528e 100644
--- a/installer/customactions.c
+++ b/installer/customactions.c
@@ -122,94 +122,6 @@ out:
return ret;
}
-extern NTAPI __declspec(dllimport) void RtlGetNtVersionNumbers(DWORD *MajorVersion, DWORD *MinorVersion, DWORD *BuildNumber);
-
-static int message_box(MSIHANDLE installer, TCHAR *text, UINT type)
-{
- TCHAR progressOnly[2];
- DWORD len;
- MSIHANDLE record;
- int ret;
-
- len = _countof(progressOnly);
- if (MsiGetProperty(installer, TEXT("MsiUIProgressOnly"), progressOnly, &len) == ERROR_SUCCESS && _tcstoul(progressOnly, NULL, 10) == 1)
- return MessageBox(GetForegroundWindow(), text, TEXT("WireGuard"), type);
- record = MsiCreateRecord(2);
- MsiRecordSetString(record, 0, TEXT("[1]"));
- MsiRecordSetString(record, 1, text);
- ret = MsiProcessMessage(installer, INSTALLMESSAGE_USER | type, record);
- MsiCloseHandle(record);
- return ret;
-}
-
-__declspec(dllexport) UINT __stdcall CheckKB2921916(MSIHANDLE installer)
-{
- bool is_com_initialized = SUCCEEDED(CoInitialize(NULL));
- UINT ret = ERROR_SUCCESS;
- DWORD maj, min, build, len;
- TCHAR uiLevel[10];
- TCHAR setupapi_path[MAX_PATH];
- HANDLE setupapi_handle = INVALID_HANDLE_VALUE;
- HANDLE setupapi_filemapping = NULL;
- const char *setupapi_bytes = NULL;
- MEMORY_BASIC_INFORMATION setupapi_meminfo;
- static const char setupapi_marker[] = "Signature Hash";
-
- RtlGetNtVersionNumbers(&maj, &min, &build);
- if (maj != 6 || min != 1)
- goto out;
-
- ret = ERROR_INSTALL_FAILURE;
- if (!GetSystemDirectory(setupapi_path, _countof(setupapi_path)))
- goto out;
- if (!PathAppend(setupapi_path, TEXT("setupapi.dll")))
- goto out;
- setupapi_handle = CreateFile(setupapi_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (setupapi_handle == INVALID_HANDLE_VALUE)
- goto out;
- setupapi_filemapping = CreateFileMapping(setupapi_handle, NULL, PAGE_READONLY, 0, 0, NULL);
- if (!setupapi_filemapping)
- goto out;
- setupapi_bytes = MapViewOfFile(setupapi_filemapping, FILE_MAP_READ, 0, 0, 0);
- if (!setupapi_bytes)
- goto out;
- if (VirtualQuery(setupapi_bytes, &setupapi_meminfo, sizeof(setupapi_meminfo)) != sizeof(setupapi_meminfo))
- goto out;
- if (setupapi_meminfo.RegionSize > strlen(setupapi_marker)) {
- for (const char *p = setupapi_bytes + strlen(setupapi_marker) - 1; (p = memchr(p, 'h', setupapi_meminfo.RegionSize - (p - setupapi_bytes))); ++p) {
- if (!memcmp(p - strlen(setupapi_marker) + 1, setupapi_marker, strlen(setupapi_marker))) {
- ret = ERROR_SUCCESS;
- goto out;
- }
- }
- }
-
- len = _countof(uiLevel);
- if (MsiGetProperty(installer, TEXT("UILevel"), uiLevel, &len) != ERROR_SUCCESS || _tcstoul(uiLevel, NULL, 10) < INSTALLUILEVEL_BASIC) {
- log_messagef(installer, LOG_LEVEL_MSIERR, TEXT("Use of WireGuard on Windows 7 requires KB2921916."));
- goto out;
- }
-#ifdef _WIN64
- static const TCHAR url[] = TEXT("https://download.wireguard.com/windows-toolchain/distfiles/Windows6.1-KB2921916-x64.msu");
-#else
- static const TCHAR url[] = TEXT("https://download.wireguard.com/windows-toolchain/distfiles/Windows6.1-KB2921916-x86.msu");
-#endif
- if (message_box(installer, TEXT("Missing Windows Hotfix\n\nUse of WireGuard on Windows 7 requires KB2921916. Would you like to download the hotfix in your web browser?"), MB_ICONWARNING | MB_YESNO) == IDYES)
- ShellExecute(GetForegroundWindow(), NULL, url, NULL, NULL, SW_SHOWNORMAL);
- ret = ERROR_INSTALL_USEREXIT;
-
-out:
- if (setupapi_bytes)
- UnmapViewOfFile(setupapi_bytes);
- if (setupapi_filemapping)
- CloseHandle(setupapi_filemapping);
- if (setupapi_handle != INVALID_HANDLE_VALUE)
- CloseHandle(setupapi_handle);
- if (is_com_initialized)
- CoUninitialize();
- return ret;
-}
-
static UINT insert_service_control(MSIHANDLE installer, MSIHANDLE view, const TCHAR *service_name, bool start)
{
static unsigned int index = 0;
diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs
index a0fc1396..9cc27156 100644
--- a/installer/wireguard.wxs
+++ b/installer/wireguard.wxs
@@ -102,14 +102,6 @@
</InstallExecuteSequence>
<!--
- Abort early if running without KB2921916 on Windows 7
- -->
- <CustomAction Id="CheckKB2921916" BinaryKey="customactions.dll" DllEntry="CheckKB2921916" />
- <InstallExecuteSequence>
- <Custom Action="CheckKB2921916" After="CheckWow64">NOT REMOVE</Custom>
- </InstallExecuteSequence>
-
- <!--
Evaluate WireGuard services and populate ServiceControl table
-->
<CustomAction Id="EvaluateWireGuardServices" BinaryKey="customactions.dll" DllEntry="EvaluateWireGuardServices" />