summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-12-16 10:58:03 +0100
committerDavid Lönnhager <david.l@mullvad.net>2022-01-11 14:19:38 +0100
commit52577f1b1fa6c49c3cee08d2b8129d2a8e3f62ff (patch)
tree315be2ab8e5693ea6f27f4165ae00892a28a0164
parent82d652a5767027c6246fbc2384b48bd23c21563e (diff)
downloadmullvadvpn-52577f1b1fa6c49c3cee08d2b8129d2a8e3f62ff.tar.xz
mullvadvpn-52577f1b1fa6c49c3cee08d2b8129d2a8e3f62ff.zip
Remove osinfo from nsis-plugins
-rw-r--r--windows/nsis-plugins/nsis-plugins.sln9
-rw-r--r--windows/nsis-plugins/src/osinfo/dllmain.cpp11
-rw-r--r--windows/nsis-plugins/src/osinfo/osinfo.cpp45
-rw-r--r--windows/nsis-plugins/src/osinfo/osinfo.def5
-rw-r--r--windows/nsis-plugins/src/osinfo/osinfo.vcxproj124
-rw-r--r--windows/nsis-plugins/src/osinfo/osinfo.vcxproj.filters19
-rw-r--r--windows/nsis-plugins/src/osinfo/stdafx.cpp8
-rw-r--r--windows/nsis-plugins/src/osinfo/stdafx.h16
-rw-r--r--windows/nsis-plugins/src/osinfo/targetver.h12
-rw-r--r--windows/nsis-plugins/src/osinfo/update.cpp97
-rw-r--r--windows/nsis-plugins/src/osinfo/update.h11
11 files changed, 0 insertions, 357 deletions
diff --git a/windows/nsis-plugins/nsis-plugins.sln b/windows/nsis-plugins/nsis-plugins.sln
index 102a73eb08..487b4bebf4 100644
--- a/windows/nsis-plugins/nsis-plugins.sln
+++ b/windows/nsis-plugins/nsis-plugins.sln
@@ -43,11 +43,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msiutil", "src\msiutil\msiu
{1344152F-2BAD-4198-8E51-31AAC32BFBB2} = {1344152F-2BAD-4198-8E51-31AAC32BFBB2}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osinfo", "src\osinfo\osinfo.vcxproj", "{5ECCC4BC-599B-4F49-8D8F-63A2CF64764F}"
- ProjectSection(ProjectDependencies) = postProject
- {B52E2D10-A94A-4605-914A-2DCEF6A757EF} = {B52E2D10-A94A-4605-914A-2DCEF6A757EF}
- EndProjectSection
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@@ -86,10 +81,6 @@ Global
{83487059-2549-4DF9-A785-A4FD5211234B}.Debug|x86.Build.0 = Debug|Win32
{83487059-2549-4DF9-A785-A4FD5211234B}.Release|x86.ActiveCfg = Release|Win32
{83487059-2549-4DF9-A785-A4FD5211234B}.Release|x86.Build.0 = Release|Win32
- {5ECCC4BC-599B-4F49-8D8F-63A2CF64764F}.Debug|x86.ActiveCfg = Debug|Win32
- {5ECCC4BC-599B-4F49-8D8F-63A2CF64764F}.Debug|x86.Build.0 = Debug|Win32
- {5ECCC4BC-599B-4F49-8D8F-63A2CF64764F}.Release|x86.ActiveCfg = Release|Win32
- {5ECCC4BC-599B-4F49-8D8F-63A2CF64764F}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/windows/nsis-plugins/src/osinfo/dllmain.cpp b/windows/nsis-plugins/src/osinfo/dllmain.cpp
deleted file mode 100644
index f11c65c519..0000000000
--- a/windows/nsis-plugins/src/osinfo/dllmain.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "stdafx.h"
-#include <windows.h>
-
-BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
-{
- //
- // Avoid doing work in DllMain since the loader lock is held
- //
-
- return TRUE;
-}
diff --git a/windows/nsis-plugins/src/osinfo/osinfo.cpp b/windows/nsis-plugins/src/osinfo/osinfo.cpp
deleted file mode 100644
index f80a4b2b26..0000000000
--- a/windows/nsis-plugins/src/osinfo/osinfo.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#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);
- }
-}
diff --git a/windows/nsis-plugins/src/osinfo/osinfo.def b/windows/nsis-plugins/src/osinfo/osinfo.def
deleted file mode 100644
index ec18cc35e8..0000000000
--- a/windows/nsis-plugins/src/osinfo/osinfo.def
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBRARY osinfo
-
-EXPORTS
-
-HasWindows7Sha2Fix
diff --git a/windows/nsis-plugins/src/osinfo/osinfo.vcxproj b/windows/nsis-plugins/src/osinfo/osinfo.vcxproj
deleted file mode 100644
index 6935bdb2a7..0000000000
--- a/windows/nsis-plugins/src/osinfo/osinfo.vcxproj
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>16.0</VCProjectVersion>
- <ProjectGuid>{5ECCC4BC-599B-4F49-8D8F-63A2CF64764F}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>osinfo</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
- <IntDir>$(SolutionDir)bin\temp\$(Platform)-$(Configuration)\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
- <IntDir>$(SolutionDir)bin\temp\$(Platform)-$(Configuration)\$(ProjectName)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>$(ProjectDir)../../../../dist-assets/binaries/x86_64-pc-windows-msvc/;$(ProjectDir)../../../windows-libraries/src/</AdditionalIncludeDirectories>
- <LanguageStandard>stdcpplatest</LanguageStandard>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
- <AdditionalLibraryDirectories>$(ProjectDir)../../../../dist-assets/binaries/x86_64-pc-windows-msvc/nsis/;$(SolutionDir)bin\$(Platform)-$(Configuration)\</AdditionalLibraryDirectories>
- <AdditionalDependencies>libcommon.lib;pluginapi-x86-unicode.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <IgnoreSpecificDefaultLibraries>libc.lib</IgnoreSpecificDefaultLibraries>
- <ModuleDefinitionFile>osinfo.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>$(ProjectDir)../../../../dist-assets/binaries/x86_64-pc-windows-msvc/;$(ProjectDir)../../../windows-libraries/src/</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <LanguageStandard>stdcpplatest</LanguageStandard>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
- <AdditionalLibraryDirectories>$(ProjectDir)../../../../dist-assets/binaries/x86_64-pc-windows-msvc/nsis/;$(SolutionDir)bin\$(Platform)-$(Configuration)\</AdditionalLibraryDirectories>
- <AdditionalDependencies>libcommon.lib;pluginapi-x86-unicode.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <IgnoreSpecificDefaultLibraries>libc.lib</IgnoreSpecificDefaultLibraries>
- <ModuleDefinitionFile>osinfo.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="update.h" />
- <ClInclude Include="stdafx.h" />
- <ClInclude Include="targetver.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="update.cpp" />
- <ClCompile Include="dllmain.cpp" />
- <ClCompile Include="osinfo.cpp" />
- <ClCompile Include="stdafx.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <None Include="osinfo.def" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/windows/nsis-plugins/src/osinfo/osinfo.vcxproj.filters b/windows/nsis-plugins/src/osinfo/osinfo.vcxproj.filters
deleted file mode 100644
index 6b31d70d05..0000000000
--- a/windows/nsis-plugins/src/osinfo/osinfo.vcxproj.filters
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <ClInclude Include="stdafx.h" />
- <ClInclude Include="targetver.h" />
- <ClInclude Include="cleaningops.h" />
- <ClInclude Include="os.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="dllmain.cpp" />
- <ClCompile Include="os.cpp" />
- <ClCompile Include="stdafx.cpp" />
- <ClCompile Include="cleaningops.cpp" />
- <ClCompile Include="os.cpp" />
- </ItemGroup>
- <ItemGroup>
- <None Include="os.def" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/windows/nsis-plugins/src/osinfo/stdafx.cpp b/windows/nsis-plugins/src/osinfo/stdafx.cpp
deleted file mode 100644
index 3b6341d106..0000000000
--- a/windows/nsis-plugins/src/osinfo/stdafx.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-// driverlogic.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/windows/nsis-plugins/src/osinfo/stdafx.h b/windows/nsis-plugins/src/osinfo/stdafx.h
deleted file mode 100644
index f3a07375c7..0000000000
--- a/windows/nsis-plugins/src/osinfo/stdafx.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-
-#include "targetver.h"
-
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-// Windows Header Files:
-#include <windows.h>
-
-
-
-// TODO: reference additional headers your program requires here
diff --git a/windows/nsis-plugins/src/osinfo/targetver.h b/windows/nsis-plugins/src/osinfo/targetver.h
deleted file mode 100644
index ae4a5c032c..0000000000
--- a/windows/nsis-plugins/src/osinfo/targetver.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma once
-
-// Including SDKDDKVer.h defines the highest available Windows platform.
-
-// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
-// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
-
-#include <WinSDKVer.h>
-
-#define _WIN32_WINNT _WIN32_WINNT_WIN7
-
-#include <SDKDDKVer.h>
diff --git a/windows/nsis-plugins/src/osinfo/update.cpp b/windows/nsis-plugins/src/osinfo/update.cpp
deleted file mode 100644
index 4b62bc05f9..0000000000
--- a/windows/nsis-plugins/src/osinfo/update.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdafx.h>
-#include "update.h"
-#include <libcommon/error.h>
-#include <libcommon/filesystem.h>
-#include <libcommon/memory.h>
-#include <algorithm>
-#include <fstream>
-#include <filesystem>
-
-namespace
-{
-
-// Jason found this to be a reliable marker of the signature check fix:
-// https://git.zx2c4.com/wireguard-windows/tree/installer/customactions.c#n145
-const char PATCH_MARKER[] = "Signature Hash";
-
-}
-
-namespace update
-{
-
-bool HasSetupApiSha2Fix()
-{
- common::memory::ScopeDestructor destructor;
-
- common::fs::ScopedNativeFileSystem nativeFileSystem;
-
- const auto systemDir = common::fs::GetKnownFolderPath(FOLDERID_System);
- const auto setupApiPath = std::filesystem::path(systemDir).append(L"setupapi.dll");
-
- const auto setupApiHandle = CreateFileW(
- setupApiPath.c_str(),
- GENERIC_READ,
- FILE_SHARE_READ,
- nullptr,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- nullptr
- );
-
- if (INVALID_HANDLE_VALUE == setupApiHandle)
- {
- THROW_WINDOWS_ERROR(GetLastError(), "CreateFileW");
- }
-
- destructor += [=]() {
- CloseHandle(setupApiHandle);
- };
-
- const auto mapping = CreateFileMappingW(setupApiHandle, nullptr, PAGE_READONLY, 0, 0, nullptr);
-
- if (nullptr == mapping)
- {
- THROW_WINDOWS_ERROR(GetLastError(), "CreateFileMappingW");
- }
-
- destructor += [=]() {
- CloseHandle(mapping);
- };
-
- const auto bytes = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
-
- if (nullptr == bytes)
- {
- THROW_WINDOWS_ERROR(GetLastError(), "MapViewOfFile");
- }
-
- destructor += [=]() {
- UnmapViewOfFile(bytes);
- };
-
- MEMORY_BASIC_INFORMATION meminfo;
-
- if (0 == VirtualQuery(bytes, &meminfo, sizeof(meminfo)))
- {
- THROW_WINDOWS_ERROR(GetLastError(), "VirtualQuery");
- }
-
- constexpr auto PATCH_MARKER_SIZE = sizeof(PATCH_MARKER) - 1;
-
- if (meminfo.RegionSize < PATCH_MARKER_SIZE)
- {
- return false;
- }
-
- for (size_t i = 0; i <= meminfo.RegionSize - PATCH_MARKER_SIZE; i++)
- {
- if (0 == memcmp((void*)((char*)bytes + i), PATCH_MARKER, PATCH_MARKER_SIZE))
- {
- return true;
- }
- }
-
- return false;
-}
-
-}
diff --git a/windows/nsis-plugins/src/osinfo/update.h b/windows/nsis-plugins/src/osinfo/update.h
deleted file mode 100644
index ae33258b56..0000000000
--- a/windows/nsis-plugins/src/osinfo/update.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-namespace update
-{
-
-// Checks whether SHA-2 signatures can be verified correctly
-// on Windows 7. Without this patch, the driver cannot be
-// installed from a service.
-bool HasSetupApiSha2Fix();
-
-}