From 480dc49de24aac4ae085e45d9bdd650e669f81e3 Mon Sep 17 00:00:00 2001 From: Matthijs Lavrijsen Date: Thu, 12 Jan 2023 15:15:43 +0100 Subject: [PATCH] Fix XP support in GH releases by using the VS 2019 14.27 toolchain --- .github/workflows/build.yml | 7 ++- 3rdparty/distorm/distorm.vcxproj | 4 ++ HookLibrary/HookLibrary.vcxproj | 4 ++ InjectorCLI/InjectorCLI.vcxproj | 4 ++ SCMRevGen/SCMRevGen.vcxproj | 1 + Scylla/Scylla.vcxproj | 4 ++ Scylla/scylla.props | 20 ++++--- .../ScyllaHideGenericPlugin.vcxproj | 4 ++ .../ScyllaHideIDAProPlugin.vcxproj | 2 + .../ScyllaHideIDAServer.vcxproj | 4 ++ .../ScyllaHideOlly1Plugin.vcxproj | 2 + .../ScyllaHideOlly2Plugin.vcxproj | 2 + ScyllaHideTEPlugin/ScyllaHideTEPlugin.vcxproj | 4 ++ .../ScyllaHideX64DBGPlugin.vcxproj | 4 ++ ScyllaTest/ScyllaTest.vcxproj | 4 ++ release.bat | 52 ++++++++++++++++++- 16 files changed, 112 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1336a5d..e19cf45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,12 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - + # toolset should be 14.27, but it's not installed on Github. release.bat will help out here instead so we will eventually get a 14.27 env + - name: Setup VS environment + uses: ilammy/msvc-dev-cmd@v1.12.0 + with: + #vsversion: 2019 # blows up on github. lol... + toolset: 14.29 - name: Build run: | cmd /c call release.bat diff --git a/3rdparty/distorm/distorm.vcxproj b/3rdparty/distorm/distorm.vcxproj index 4450efe..3e86f1e 100644 --- a/3rdparty/distorm/distorm.vcxproj +++ b/3rdparty/distorm/distorm.vcxproj @@ -33,6 +33,7 @@ Unicode false false + 14.27.29110 StaticLibrary @@ -41,6 +42,7 @@ Unicode false false + 14.27.29110 StaticLibrary @@ -50,6 +52,7 @@ Unicode false false + 14.27.29110 StaticLibrary @@ -58,6 +61,7 @@ true false false + 14.27.29110 diff --git a/HookLibrary/HookLibrary.vcxproj b/HookLibrary/HookLibrary.vcxproj index 383a276..60bd038 100644 --- a/HookLibrary/HookLibrary.vcxproj +++ b/HookLibrary/HookLibrary.vcxproj @@ -33,6 +33,7 @@ Unicode false false + 14.27.29110 DynamicLibrary @@ -41,6 +42,7 @@ Unicode false false + 14.27.29110 DynamicLibrary @@ -50,6 +52,7 @@ Unicode false false + 14.27.29110 DynamicLibrary @@ -59,6 +62,7 @@ Unicode false false + 14.27.29110 diff --git a/InjectorCLI/InjectorCLI.vcxproj b/InjectorCLI/InjectorCLI.vcxproj index 1c92ca1..0e21b8b 100644 --- a/InjectorCLI/InjectorCLI.vcxproj +++ b/InjectorCLI/InjectorCLI.vcxproj @@ -33,6 +33,7 @@ Unicode false false + 14.27.29110 Application @@ -41,6 +42,7 @@ Unicode false false + 14.27.29110 Application @@ -50,6 +52,7 @@ Unicode false false + 14.27.29110 Application @@ -59,6 +62,7 @@ Unicode false false + 14.27.29110 diff --git a/SCMRevGen/SCMRevGen.vcxproj b/SCMRevGen/SCMRevGen.vcxproj index 737f37b..da6cb1a 100644 --- a/SCMRevGen/SCMRevGen.vcxproj +++ b/SCMRevGen/SCMRevGen.vcxproj @@ -31,6 +31,7 @@ v142 false false + 14.27.29110 diff --git a/Scylla/Scylla.vcxproj b/Scylla/Scylla.vcxproj index af77c7a..927562d 100644 --- a/Scylla/Scylla.vcxproj +++ b/Scylla/Scylla.vcxproj @@ -61,6 +61,7 @@ Unicode false false + 14.27.29110 StaticLibrary @@ -69,6 +70,7 @@ Unicode false false + 14.27.29110 StaticLibrary @@ -78,6 +80,7 @@ Unicode false false + 14.27.29110 StaticLibrary @@ -87,6 +90,7 @@ Unicode false false + 14.27.29110 diff --git a/Scylla/scylla.props b/Scylla/scylla.props index 12f5a42..f542442 100644 --- a/Scylla/scylla.props +++ b/Scylla/scylla.props @@ -29,26 +29,32 @@ $(SolutionDir)3rdparty;$(SolutionDir)3rdparty\idasdk\lib;$(OutDir) Scylla.lib;ntdll\ntdll_$(PlatformShortName).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) DebugFull - /NOVCFEATURE /NOCOFFGRPINFO %(AdditionalOptions) + /NOVCFEATURE /NOCOFFGRPINFO /PDBALTPATH:%_PDB% %(AdditionalOptions) - WINVER=0x0501;_WIN32_WINNT=0x0501;NTDDI_VERSION=0x05010000;%(PreprocessorDefinitions) + WINVER=0x0501;_WIN32_WINNT=0x0501;NTDDI_VERSION=0x05010000;%(PreprocessorDefinitions) + WINVER=0x0601;_WIN32_WINNT=0x0601;NTDDI_VERSION=0x06010000;%(PreprocessorDefinitions) - 5.1 - 5.01 + 5.1 + 6.1 + 5.01 + 6.01 true - WINVER=0x0502;_WIN32_WINNT=0x0502;NTDDI_VERSION=0x05020000;%(PreprocessorDefinitions) + WINVER=0x0502;_WIN32_WINNT=0x0502;NTDDI_VERSION=0x05020000;%(PreprocessorDefinitions) + WINVER=0x0601;_WIN32_WINNT=0x0601;NTDDI_VERSION=0x06010000;%(PreprocessorDefinitions) - 5.2 - 5.02 + 5.2 + 6.1 + 5.02 + 6.01 diff --git a/ScyllaHideGenericPlugin/ScyllaHideGenericPlugin.vcxproj b/ScyllaHideGenericPlugin/ScyllaHideGenericPlugin.vcxproj index 7cdd3bb..47ffbd8 100644 --- a/ScyllaHideGenericPlugin/ScyllaHideGenericPlugin.vcxproj +++ b/ScyllaHideGenericPlugin/ScyllaHideGenericPlugin.vcxproj @@ -33,6 +33,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -41,6 +42,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -50,6 +52,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -59,6 +62,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.vcxproj b/ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.vcxproj index 076b847..6a94c3a 100644 --- a/ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.vcxproj +++ b/ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.vcxproj @@ -25,6 +25,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -34,6 +35,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaHideIDAServer/ScyllaHideIDAServer.vcxproj b/ScyllaHideIDAServer/ScyllaHideIDAServer.vcxproj index 5aa4854..65cbce4 100644 --- a/ScyllaHideIDAServer/ScyllaHideIDAServer.vcxproj +++ b/ScyllaHideIDAServer/ScyllaHideIDAServer.vcxproj @@ -33,6 +33,7 @@ v142 false false + 14.27.29110 Application @@ -41,6 +42,7 @@ v142 false false + 14.27.29110 Application @@ -50,6 +52,7 @@ v142 false false + 14.27.29110 Application @@ -59,6 +62,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaHideOlly1Plugin/ScyllaHideOlly1Plugin.vcxproj b/ScyllaHideOlly1Plugin/ScyllaHideOlly1Plugin.vcxproj index f81c1e1..888dc42 100644 --- a/ScyllaHideOlly1Plugin/ScyllaHideOlly1Plugin.vcxproj +++ b/ScyllaHideOlly1Plugin/ScyllaHideOlly1Plugin.vcxproj @@ -25,6 +25,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -34,6 +35,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaHideOlly2Plugin/ScyllaHideOlly2Plugin.vcxproj b/ScyllaHideOlly2Plugin/ScyllaHideOlly2Plugin.vcxproj index 5cd2440..bc08ff1 100644 --- a/ScyllaHideOlly2Plugin/ScyllaHideOlly2Plugin.vcxproj +++ b/ScyllaHideOlly2Plugin/ScyllaHideOlly2Plugin.vcxproj @@ -25,6 +25,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -34,6 +35,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaHideTEPlugin/ScyllaHideTEPlugin.vcxproj b/ScyllaHideTEPlugin/ScyllaHideTEPlugin.vcxproj index 5e9d62e..89cd916 100644 --- a/ScyllaHideTEPlugin/ScyllaHideTEPlugin.vcxproj +++ b/ScyllaHideTEPlugin/ScyllaHideTEPlugin.vcxproj @@ -33,6 +33,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -41,6 +42,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -50,6 +52,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -59,6 +62,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaHideX64DBGPlugin/ScyllaHideX64DBGPlugin.vcxproj b/ScyllaHideX64DBGPlugin/ScyllaHideX64DBGPlugin.vcxproj index 3c92e22..cf4f848 100644 --- a/ScyllaHideX64DBGPlugin/ScyllaHideX64DBGPlugin.vcxproj +++ b/ScyllaHideX64DBGPlugin/ScyllaHideX64DBGPlugin.vcxproj @@ -33,6 +33,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -41,6 +42,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -50,6 +52,7 @@ v142 false false + 14.27.29110 DynamicLibrary @@ -59,6 +62,7 @@ v142 false false + 14.27.29110 diff --git a/ScyllaTest/ScyllaTest.vcxproj b/ScyllaTest/ScyllaTest.vcxproj index dee66ef..1215bf6 100644 --- a/ScyllaTest/ScyllaTest.vcxproj +++ b/ScyllaTest/ScyllaTest.vcxproj @@ -32,6 +32,7 @@ Unicode false false + 14.27.29110 Application @@ -40,6 +41,7 @@ Unicode false false + 14.27.29110 Application @@ -49,6 +51,7 @@ Unicode false false + 14.27.29110 Application @@ -58,6 +61,7 @@ Unicode false false + 14.27.29110 diff --git a/release.bat b/release.bat index d90da2a..ea8efe7 100644 --- a/release.bat +++ b/release.bat @@ -6,6 +6,20 @@ setlocal enabledelayedexpansion cd %~dp0 +@rem We still support Windows XP in our release builds, and probably will continue to do so for the foreseeable future. +@rem This is controlled by the following env var. Because we don't expect that regular users will want to target XP in their +@rem private local builds, in the normal case (opening VS) this will not be set and the minimum target version is Windows 7. +@rem If you want to make such a "release build", but without XP support and the toolchain requirements that come with it, +@rem call this with USE_XP_TOOLCHAIN set to FALSE +@rem +@rem 'TRUE' is the default value so that if a commit or PR breaks XP compatibility, it will be caught by Github Actions because it runs this build as a CI step. +@rem +@rem The most important (probably not installed on your machine) requirement to build with XP support enabled is *VS2019* with the latest *14.27* VC++ toolchain. +@rem The installer calls this the "16.7 toolchain", the compiler/CRT files themselves are versioned "14.27". +if "%USE_XP_TOOLCHAIN%"=="" ( + set USE_XP_TOOLCHAIN=TRUE +) + set PROGRAMFILES32=%PROGRAMFILES(x86)% if not exist "%PROGRAMFILES(x86)%" set PROGRAMFILES32=%PROGRAMFILES% @@ -20,20 +34,54 @@ if not exist "%VSWHERE%" ( if not %ERRORLEVEL%==0 ( @rem Fetch some version that gets it echo Fetching vswhere.exe... - curl -O -L https://github.com/microsoft/vswhere/releases/download/2.8.4/vswhere.exe 1>nul + curl -O -L https://github.com/microsoft/vswhere/releases/download/3.1.1/vswhere.exe 1>nul set VSWHERE=vswhere.exe ) - set MSBUILD= for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -nologo -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do ( set MSBUILD=%%i ) +set XPTOOLCHAIN_INSTALLED= +for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -nologo -version [16.0^,17^) -requires Microsoft.VisualStudio.Component.VC.14.27.x86.x64`) do ( + set XPTOOLCHAIN_INSTALLED=%%i +) +set VS2019INSTALLDIR= +for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -nologo -version [16.0^,17^) -property installationPath`) do ( + set VS2019INSTALLDIR=%%i +) +set VS2019SETUP= +for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -nologo -version [16.0^,17^) -property properties_setupEngineFilePath`) do ( + set VS2019SETUP=%%i +) del vswhere.exe 1>nul 2>&1 if "%MSBUILD%"=="" ( echo Failed to find MSBuild installation directory. exit /b ) +@rem Alternatively if github continues to fuck this up, we can curl the latest VS2019 setup from the hardcoded URL https://aka.ms/vs/16/release/vs_enterprise.exe +if "%USE_XP_TOOLCHAIN%"=="TRUE" ( + if "%VS2019INSTALLDIR%"=="" ( + echo XP toolchain build was requested, but VS2019 install dir could not be found. Set USE_XP_TOOLCHAIN to something other than TRUE if you don't actually need it. + exit /b + ) + if "%XPTOOLCHAIN_INSTALLED%"=="" ( + if "%VS2019SETUP%"=="" ( + echo XP toolchain build was requested, but VS2019 setup.exe could not be found. Set USE_XP_TOOLCHAIN to something other than TRUE if you don't actually need it. + exit /b + ) + echo Sorry buddy, but you need some more VS stuff. Installing it for you now, don't worry. We're gonna take care of this for ya... + @rem Despite '--quiet', this command is not actually quiet. AT ALL. Redirect stdout spam + "%VS2019SETUP%" modify --installPath "%VS2019INSTALLDIR%" --add "Microsoft.VisualStudio.Component.VC.14.27.x86.x64" --add "Microsoft.VisualStudio.Component.VC.14.27.MFC" --add "Microsoft.VisualStudio.Component.VC.14.27.ATL" --norestart --force --quiet 1>nul + if not %ERRORLEVEL%==0 ( + echo Installation failed! + exit /b + ) + echo Installation successful. + ) + @rem Finally, ascend to 14.27 toolchain environment + call "%VS2019INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.27 +) "%MSBUILD%" /m /property:Configuration=Release,Platform=Win32 if not %ERRORLEVEL%==0 exit /b