From 4125599c9298261f09611bffda0c4370b9c32841 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Sat, 25 Aug 2018 10:55:13 +0200 Subject: [PATCH 01/18] Use my udis86 fork, will fix python3 compilation. build with py -3 --- .gitmodules | 2 +- vsbuild/udis86.vcxproj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 40cf5267..4f5ca60f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,7 @@ url = https://github.com/asmjit/asmjit.git [submodule "udis86"] path = udis86 - url = https://github.com/vmt/udis86 + url = https://github.com/LePresidente/udis86 [submodule "fmt"] path = fmt url = https://github.com/fmtlib/fmt.git diff --git a/vsbuild/udis86.vcxproj b/vsbuild/udis86.vcxproj index 1c53d730..e7a1d08e 100644 --- a/vsbuild/udis86.vcxproj +++ b/vsbuild/udis86.vcxproj @@ -95,7 +95,7 @@ C:\Games\MO2\build\usvfs_clean\udis86\libudis86;%(AdditionalIncludeDirectories) - py -2 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable @@ -113,7 +113,7 @@ C:\Games\MO2\build\usvfs_clean\udis86\libudis86;%(AdditionalIncludeDirectories) - py -2 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable @@ -137,7 +137,7 @@ true - py -2 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable @@ -161,7 +161,7 @@ true - py -2 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable From 33e2d9e75f403b01067f4c36188513929e024745 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Mon, 27 Aug 2018 06:41:04 +0200 Subject: [PATCH 02/18] use py -3 only, having it try python caused an error. --- vsbuild/udis86.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vsbuild/udis86.vcxproj b/vsbuild/udis86.vcxproj index e7a1d08e..1f7b72f8 100644 --- a/vsbuild/udis86.vcxproj +++ b/vsbuild/udis86.vcxproj @@ -95,7 +95,7 @@ C:\Games\MO2\build\usvfs_clean\udis86\libudis86;%(AdditionalIncludeDirectories) - py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable @@ -113,7 +113,7 @@ C:\Games\MO2\build\usvfs_clean\udis86\libudis86;%(AdditionalIncludeDirectories) - py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable @@ -137,7 +137,7 @@ true - py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable @@ -161,7 +161,7 @@ true - py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 || python ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 + py -3 ..\udis86\scripts\ud_itab.py ..\udis86\docs\x86\optable.xml ..\udis86\libudis86 Building udis86 optable From 50d7344c0d2d160fc51a11005290c3b3efb47a1c Mon Sep 17 00:00:00 2001 From: LePresidente Date: Mon, 27 Aug 2018 06:50:29 +0200 Subject: [PATCH 03/18] Fix Appveyor to use LePresidente/udis86 instead of vmt/udis86 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4eead89d..b2082f32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,6 +13,6 @@ environment: install: - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) build_script: -- ps: "New-Item c:\\projects\\usvfs\\build -type directory\nNew-Item c:\\projects\\install -type directory\nNew-Item c:\\temp -type directory\n\ngit clone --depth=1 --branch=master https://github.com/TanninOne/spdlog.git c:\\libraries\\spdlog 2> $null\ngit clone --depth=1 --branch=3.0.0 https://github.com/fmtlib/fmt.git c:\\libraries\\fmtlib 2> $null\ngit clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\ngit clone --branch=master https://github.com/kobalicek/asmjit.git c:\\libraries\\asmjit 2> $null\ngit clone --depth=1 --branch=v1.7.2 https://github.com/vmt/udis86.git c:\\libraries\\udis86 2> $null\n\nSet-Location -Path c:\\libraries\\googletest \ncmake . -Dgtest_force_shared_crt=ON -DBUILD_GMOCK=OFF -DBUILD_GTEST=ON -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -G\"Visual Studio 15 2017\"\ncmake --build . --config Release -- /p:Platform=$Env:Platform\nCopy-Item C:\\Libraries\\googletest\\googletest\\Release\\gtest.lib c:\\libraries\\googletest\\googletest\n\nSet-Location -Path c:\\libraries\\fmtlib\ncmake . -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -DCMAKE_BUILD_TYPE=Release -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\nCopy-Item c:\\libraries\\fmtlib\\fmt\\Release\\fmt.lib c:\\libraries\\fmtlib\n\nSet-Location -Path c:\\libraries\\asmjit\ngit checkout fb9f82cb61df36aa513d054e748dc6769045f33e\ncmake . -DASMJIT_STATIC=TRUE -DASMJIT_DISABLE_COMPILER=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\nRename-Item c:\\libraries\\asmjit\\Release c:\\libraries\\asmjit\\build\n\nSet-Location -Path c:\\libraries\\udis86\\BuildVS2010\n& 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe' /Upgrade .\\udis86.sln\nStart-Sleep -s 15\nmsbuild.exe udis86.sln /t:Clean\nmsbuild.exe build.proj /t:BuildRelease_$Env:Arch\nCopy-Item c:\\libraries\\udis86\\BuildVS2010\\build\\lib\\x64\\libudis86.lib c:\\libraries\\udis86\n\nSet-Location -Path C:\\Libraries\\boost_1_65_1\n.\"C:\\Python27-x64\\Scripts\\pip.exe\" install \"patch==1.*\"\n.\"C:\\Python27-x64\\python.exe\" -m patch \"C:\\projects\\usvfs\\patches\\type_traits_vs15_fix.patch\"\n.\\bootstrap.bat\n.\\b2 address-model=\"$Env:Boost_Addressmode\" toolset=msvc-14.1 windows-api=desktop variant=release link=static threading=multi runtime-link=shared --with-filesystem --with-date_time --with-thread --with-locale\n\nSet-Location -Path c:\\projects\\usvfs\\build\ncmake .. -DPROJ_ARCH=\"$Env:Arch\" -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -DCMAKE_BUILD_TYPE=Release -DDEPENDENCIES_DIR=c:\\libraries -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\n\nNew-Item c:\\projects\\usvfs\\install -type directory\n\nCopy-Item c:\\projects\\usvfs\\build\\testinject_bin\\Release\\testinject_bin.exe c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\nCopy-Item c:\\projects\\usvfs\\build\\testinject_dll\\Release\\testinject_dll.dll c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\nCopy-Item c:\\projects\\usvfs\\build\\testinject_dll\\Release\\testinject_dll.dll c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\\testinject_dll-d.dll\nCopy-Item c:\\projects\\usvfs\\build\\usvfs\\Release\\usvfs_$Env:Arch.dll c:\\projects\\usvfs\\build\\usvfs_test\\Release\nctest -VV -C Release" +- ps: "New-Item c:\\projects\\usvfs\\build -type directory\nNew-Item c:\\projects\\install -type directory\nNew-Item c:\\temp -type directory\n\ngit clone --depth=1 --branch=master https://github.com/TanninOne/spdlog.git c:\\libraries\\spdlog 2> $null\ngit clone --depth=1 --branch=3.0.0 https://github.com/fmtlib/fmt.git c:\\libraries\\fmtlib 2> $null\ngit clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\ngit clone --branch=master https://github.com/kobalicek/asmjit.git c:\\libraries\\asmjit 2> $null\ngit clone --depth=1 --branch=v1.7.2 https://github.com/LePresidente/udis86.git c:\\libraries\\udis86 2> $null\n\nSet-Location -Path c:\\libraries\\googletest \ncmake . -Dgtest_force_shared_crt=ON -DBUILD_GMOCK=OFF -DBUILD_GTEST=ON -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -G\"Visual Studio 15 2017\"\ncmake --build . --config Release -- /p:Platform=$Env:Platform\nCopy-Item C:\\Libraries\\googletest\\googletest\\Release\\gtest.lib c:\\libraries\\googletest\\googletest\n\nSet-Location -Path c:\\libraries\\fmtlib\ncmake . -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -DCMAKE_BUILD_TYPE=Release -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\nCopy-Item c:\\libraries\\fmtlib\\fmt\\Release\\fmt.lib c:\\libraries\\fmtlib\n\nSet-Location -Path c:\\libraries\\asmjit\ngit checkout fb9f82cb61df36aa513d054e748dc6769045f33e\ncmake . -DASMJIT_STATIC=TRUE -DASMJIT_DISABLE_COMPILER=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\nRename-Item c:\\libraries\\asmjit\\Release c:\\libraries\\asmjit\\build\n\nSet-Location -Path c:\\libraries\\udis86\\BuildVS2010\n& 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe' /Upgrade .\\udis86.sln\nStart-Sleep -s 15\nmsbuild.exe udis86.sln /t:Clean\nmsbuild.exe build.proj /t:BuildRelease_$Env:Arch\nCopy-Item c:\\libraries\\udis86\\BuildVS2010\\build\\lib\\x64\\libudis86.lib c:\\libraries\\udis86\n\nSet-Location -Path C:\\Libraries\\boost_1_65_1\n.\"C:\\Python27-x64\\Scripts\\pip.exe\" install \"patch==1.*\"\n.\"C:\\Python27-x64\\python.exe\" -m patch \"C:\\projects\\usvfs\\patches\\type_traits_vs15_fix.patch\"\n.\\bootstrap.bat\n.\\b2 address-model=\"$Env:Boost_Addressmode\" toolset=msvc-14.1 windows-api=desktop variant=release link=static threading=multi runtime-link=shared --with-filesystem --with-date_time --with-thread --with-locale\n\nSet-Location -Path c:\\projects\\usvfs\\build\ncmake .. -DPROJ_ARCH=\"$Env:Arch\" -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -DCMAKE_BUILD_TYPE=Release -DDEPENDENCIES_DIR=c:\\libraries -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\n\nNew-Item c:\\projects\\usvfs\\install -type directory\n\nCopy-Item c:\\projects\\usvfs\\build\\testinject_bin\\Release\\testinject_bin.exe c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\nCopy-Item c:\\projects\\usvfs\\build\\testinject_dll\\Release\\testinject_dll.dll c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\nCopy-Item c:\\projects\\usvfs\\build\\testinject_dll\\Release\\testinject_dll.dll c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\\testinject_dll-d.dll\nCopy-Item c:\\projects\\usvfs\\build\\usvfs\\Release\\usvfs_$Env:Arch.dll c:\\projects\\usvfs\\build\\usvfs_test\\Release\nctest -VV -C Release" test_script: - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) \ No newline at end of file From 30432800253e7dece64407a175be6ab733bcb5df Mon Sep 17 00:00:00 2001 From: LePresidente Date: Mon, 27 Aug 2018 08:52:59 +0200 Subject: [PATCH 04/18] AppVeyor was still the old build file, updated to new build procedure. --- appveyor.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b2082f32..a1fdc62d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,18 +1,20 @@ version: 1.0.{build} image: Visual Studio 2017 -init: -- ps: echo $Env:Arch $Env:Platform $Env:Boost_Addressmode +configuration: Release +platform: +- x64 +- x86 environment: - matrix: - - Platform: x64 - Boost_Addressmode: 64 - Arch: x64 - - Platform: win32 - Boost_Addressmode: 32 - Arch: x86 + GTEST_PATH: C:\Libraries\googletest + BOOST_PATH: C:\Libraries\boost_1_66_0 install: - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) -build_script: -- ps: "New-Item c:\\projects\\usvfs\\build -type directory\nNew-Item c:\\projects\\install -type directory\nNew-Item c:\\temp -type directory\n\ngit clone --depth=1 --branch=master https://github.com/TanninOne/spdlog.git c:\\libraries\\spdlog 2> $null\ngit clone --depth=1 --branch=3.0.0 https://github.com/fmtlib/fmt.git c:\\libraries\\fmtlib 2> $null\ngit clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\ngit clone --branch=master https://github.com/kobalicek/asmjit.git c:\\libraries\\asmjit 2> $null\ngit clone --depth=1 --branch=v1.7.2 https://github.com/LePresidente/udis86.git c:\\libraries\\udis86 2> $null\n\nSet-Location -Path c:\\libraries\\googletest \ncmake . -Dgtest_force_shared_crt=ON -DBUILD_GMOCK=OFF -DBUILD_GTEST=ON -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -G\"Visual Studio 15 2017\"\ncmake --build . --config Release -- /p:Platform=$Env:Platform\nCopy-Item C:\\Libraries\\googletest\\googletest\\Release\\gtest.lib c:\\libraries\\googletest\\googletest\n\nSet-Location -Path c:\\libraries\\fmtlib\ncmake . -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -DCMAKE_BUILD_TYPE=Release -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\nCopy-Item c:\\libraries\\fmtlib\\fmt\\Release\\fmt.lib c:\\libraries\\fmtlib\n\nSet-Location -Path c:\\libraries\\asmjit\ngit checkout fb9f82cb61df36aa513d054e748dc6769045f33e\ncmake . -DASMJIT_STATIC=TRUE -DASMJIT_DISABLE_COMPILER=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\nRename-Item c:\\libraries\\asmjit\\Release c:\\libraries\\asmjit\\build\n\nSet-Location -Path c:\\libraries\\udis86\\BuildVS2010\n& 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe' /Upgrade .\\udis86.sln\nStart-Sleep -s 15\nmsbuild.exe udis86.sln /t:Clean\nmsbuild.exe build.proj /t:BuildRelease_$Env:Arch\nCopy-Item c:\\libraries\\udis86\\BuildVS2010\\build\\lib\\x64\\libudis86.lib c:\\libraries\\udis86\n\nSet-Location -Path C:\\Libraries\\boost_1_65_1\n.\"C:\\Python27-x64\\Scripts\\pip.exe\" install \"patch==1.*\"\n.\"C:\\Python27-x64\\python.exe\" -m patch \"C:\\projects\\usvfs\\patches\\type_traits_vs15_fix.patch\"\n.\\bootstrap.bat\n.\\b2 address-model=\"$Env:Boost_Addressmode\" toolset=msvc-14.1 windows-api=desktop variant=release link=static threading=multi runtime-link=shared --with-filesystem --with-date_time --with-thread --with-locale\n\nSet-Location -Path c:\\projects\\usvfs\\build\ncmake .. -DPROJ_ARCH=\"$Env:Arch\" -DCMAKE_GENERATOR_PLATFORM=\"$Env:Platform\" -DCMAKE_BUILD_TYPE=Release -DDEPENDENCIES_DIR=c:\\libraries -G\"Visual Studio 15 2017\"\ncmake --build . --config Release\n\nNew-Item c:\\projects\\usvfs\\install -type directory\n\nCopy-Item c:\\projects\\usvfs\\build\\testinject_bin\\Release\\testinject_bin.exe c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\nCopy-Item c:\\projects\\usvfs\\build\\testinject_dll\\Release\\testinject_dll.dll c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\nCopy-Item c:\\projects\\usvfs\\build\\testinject_dll\\Release\\testinject_dll.dll c:\\projects\\usvfs\\build\\tinjectlib_test\\Release\\testinject_dll-d.dll\nCopy-Item c:\\projects\\usvfs\\build\\usvfs\\Release\\usvfs_$Env:Arch.dll c:\\projects\\usvfs\\build\\usvfs_test\\Release\nctest -VV -C Release" -test_script: +before_build: +- ps: "echo $env:Platform\nif (${env:Platform} -eq \"x64\") {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib64-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build \n}\nElse {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib32-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build_32\n}\n\n. git clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\nNew-Item $Env:GTEST_BUILDDIR -type directory\nSet-Location -Path $Env:GTEST_BUILDDIR\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && cmake -G `\"NMake Makefiles`\" -DCMAKE_BUILD_TYPE=Release ..`\"\"\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && nmake\"\n\nSet-Location -Path c:\\projects\\usvfs\\vsbuild\n#Tempory fix due to that appveyor has boost lib files in a custom output folder\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib') {(Get-Content $_ | ForEach {$_ -replace '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib', \"$Env:BOOST_LIBPATH\"}) | Set-Content $_ }}\n\n#Need to tell usvfs to not use the BOOST_BUILDID\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern 'BOOST_LIB_BUILDID=x86;') {(Get-Content $_ | ForEach {$_ -replace 'BOOST_LIB_BUILDID=x86;', \"\"}) | Set-Content $_ }}\n\nSet-Location -Path c:\\projects\\usvfs\ngit submodule -q update --init --recursive" +build: + project: vsbuild/usvfs.sln + parallel: true + verbosity: normal +test: off +on_failure: - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) \ No newline at end of file From bda2e6cd81febba37fec6aa22836e81b2d39ec3d Mon Sep 17 00:00:00 2001 From: LePresidente Date: Mon, 27 Aug 2018 09:23:55 +0200 Subject: [PATCH 05/18] Force pull on udis86 to master before build, since the init was not pulling the latest changes. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a1fdc62d..a3dc1436 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ environment: install: - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) before_build: -- ps: "echo $env:Platform\nif (${env:Platform} -eq \"x64\") {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib64-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build \n}\nElse {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib32-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build_32\n}\n\n. git clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\nNew-Item $Env:GTEST_BUILDDIR -type directory\nSet-Location -Path $Env:GTEST_BUILDDIR\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && cmake -G `\"NMake Makefiles`\" -DCMAKE_BUILD_TYPE=Release ..`\"\"\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && nmake\"\n\nSet-Location -Path c:\\projects\\usvfs\\vsbuild\n#Tempory fix due to that appveyor has boost lib files in a custom output folder\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib') {(Get-Content $_ | ForEach {$_ -replace '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib', \"$Env:BOOST_LIBPATH\"}) | Set-Content $_ }}\n\n#Need to tell usvfs to not use the BOOST_BUILDID\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern 'BOOST_LIB_BUILDID=x86;') {(Get-Content $_ | ForEach {$_ -replace 'BOOST_LIB_BUILDID=x86;', \"\"}) | Set-Content $_ }}\n\nSet-Location -Path c:\\projects\\usvfs\ngit submodule -q update --init --recursive" +- ps: "echo $env:Platform\nif (${env:Platform} -eq \"x64\") {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib64-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build \n}\nElse {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib32-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build_32\n}\n\n. git clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\nNew-Item $Env:GTEST_BUILDDIR -type directory\nSet-Location -Path $Env:GTEST_BUILDDIR\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && cmake -G `\"NMake Makefiles`\" -DCMAKE_BUILD_TYPE=Release ..`\"\"\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && nmake\"\n\nSet-Location -Path c:\\projects\\usvfs\\vsbuild\n#Tempory fix due to that appveyor has boost lib files in a custom output folder\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib') {(Get-Content $_ | ForEach {$_ -replace '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib', \"$Env:BOOST_LIBPATH\"}) | Set-Content $_ }}\n\n#Need to tell usvfs to not use the BOOST_BUILDID\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern 'BOOST_LIB_BUILDID=x86;') {(Get-Content $_ | ForEach {$_ -replace 'BOOST_LIB_BUILDID=x86;', \"\"}) | Set-Content $_ }}\n\nSet-Location -Path c:\\projects\\usvfs\ngit submodule -q update --init --recursive\nSet-Location -Path c:\\projects\\usvfs\\udis86\ngit pull -q origin master" build: project: vsbuild/usvfs.sln parallel: true From cdfbadccc6c963273a140b3cd5f6564e10224b19 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Wed, 29 Aug 2018 08:32:37 +0200 Subject: [PATCH 06/18] Pulled down update to udis86 --- udis86 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udis86 b/udis86 index 56ff6c87..dda4a95b 160000 --- a/udis86 +++ b/udis86 @@ -1 +1 @@ -Subproject commit 56ff6c87c11de0ffa725b14339004820556e343d +Subproject commit dda4a95b816ac3f749cd4f798b99d8ed076e83ff From 8e9619fc1365dbd091ffdbc7e7c7bda4ebb7c1ec Mon Sep 17 00:00:00 2001 From: Silarn Date: Sun, 7 Oct 2018 21:32:25 -0500 Subject: [PATCH 07/18] Fix lib path for latest gtest versions --- vsbuild/test_common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsbuild/test_common.props b/vsbuild/test_common.props index 25e42a4d..0e095312 100644 --- a/vsbuild/test_common.props +++ b/vsbuild/test_common.props @@ -14,7 +14,7 @@ UNITTEST;%(PreprocessorDefinitions) - %(AdditionalLibraryDirectories);$(GTEST_PATH)\build$(PLATFORM_32)\googlemock\gtest + %(AdditionalLibraryDirectories);$(GTEST_PATH)\build$(PLATFORM_32)\lib gtest.lib;%(AdditionalDependencies) From c7afff578795a6eccb714a6539313dbd9ca9e3a9 Mon Sep 17 00:00:00 2001 From: LePresidente Date: Mon, 22 Oct 2018 12:18:56 +0200 Subject: [PATCH 08/18] use the new boost location, that will be included in the prebuilt package. --- vsbuild/platform_x64.props | 3 +++ vsbuild/platform_x86.props | 6 +++--- vsbuild/shared_common.props | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vsbuild/platform_x64.props b/vsbuild/platform_x64.props index b15018c7..7317e5c7 100644 --- a/vsbuild/platform_x64.props +++ b/vsbuild/platform_x64.props @@ -14,6 +14,9 @@ _WIN64;%(PreprocessorDefinitions) + + $(BOOST_PATH)\lib64-msvc-14.1\lib;%(AdditionalLibraryDirectories) + diff --git a/vsbuild/platform_x86.props b/vsbuild/platform_x86.props index f9bb0630..7b66bb75 100644 --- a/vsbuild/platform_x86.props +++ b/vsbuild/platform_x86.props @@ -11,9 +11,9 @@ - - BOOST_LIB_BUILDID=x86;%(PreprocessorDefinitions) - + + $(BOOST_PATH)\lib32-msvc-14.1\lib;%(AdditionalLibraryDirectories) + diff --git a/vsbuild/shared_common.props b/vsbuild/shared_common.props index cb88e726..c4c45109 100644 --- a/vsbuild/shared_common.props +++ b/vsbuild/shared_common.props @@ -11,9 +11,6 @@ ..\include;$(BOOST_PATH);..\fmt;..\spdlog\include\spdlog;%(AdditionalIncludeDirectories) SPDLOG_NO_NAME;SPDLOG_NO_REGISTRY_MUTEX;NOMINMAX;%(PreprocessorDefinitions) - - $(BOOST_PATH)\stage\lib;%(AdditionalLibraryDirectories) - \ No newline at end of file From 8256f116fef4246c398f804c23713e8b0164b16f Mon Sep 17 00:00:00 2001 From: LePresidente Date: Tue, 23 Oct 2018 14:29:31 +0200 Subject: [PATCH 09/18] Fix Appveyor build --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a3dc1436..6da1eded 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ environment: install: - ps: $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) before_build: -- ps: "echo $env:Platform\nif (${env:Platform} -eq \"x64\") {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib64-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build \n}\nElse {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib32-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build_32\n}\n\n. git clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\nNew-Item $Env:GTEST_BUILDDIR -type directory\nSet-Location -Path $Env:GTEST_BUILDDIR\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && cmake -G `\"NMake Makefiles`\" -DCMAKE_BUILD_TYPE=Release ..`\"\"\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && nmake\"\n\nSet-Location -Path c:\\projects\\usvfs\\vsbuild\n#Tempory fix due to that appveyor has boost lib files in a custom output folder\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib') {(Get-Content $_ | ForEach {$_ -replace '\\$\\(BOOST_PATH\\)\\\\stage\\\\lib', \"$Env:BOOST_LIBPATH\"}) | Set-Content $_ }}\n\n#Need to tell usvfs to not use the BOOST_BUILDID\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern 'BOOST_LIB_BUILDID=x86;') {(Get-Content $_ | ForEach {$_ -replace 'BOOST_LIB_BUILDID=x86;', \"\"}) | Set-Content $_ }}\n\nSet-Location -Path c:\\projects\\usvfs\ngit submodule -q update --init --recursive\nSet-Location -Path c:\\projects\\usvfs\\udis86\ngit pull -q origin master" +- ps: "echo $env:Platform\nif (${env:Platform} -eq \"x64\") {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib64-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build \n}\nElse {\n set-item -path Env:BOOST_LIBPATH -value C:\\Libraries\\boost_1_66_0\\lib32-msvc-14.1\n set-item -path Env:GTEST_BUILDDIR -value c:\\libraries\\googletest\\build_32\n}\n\n. git clone --depth=1 --branch=master https://github.com/google/googletest.git c:\\libraries\\googletest 2> $null\nNew-Item $Env:GTEST_BUILDDIR -type directory\nSet-Location -Path $Env:GTEST_BUILDDIR\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && cmake -G `\"NMake Makefiles`\" -DCMAKE_BUILD_TYPE=Release ..`\"\"\n. cmd /c \"`\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat`\" $env:Platform && nmake\"\n\nSet-Location -Path c:\\projects\\usvfs\\vsbuild\n#Tempory fix due to that appveyor has boost lib files in a custom output folder\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern '\\$\\(BOOST_PATH\\)\\\\.*\\\\lib') {(Get-Content $_ | ForEach {$_ -replace '\\$\\(BOOST_PATH\\)\\\\.*\\\\lib', \"$Env:BOOST_LIBPATH\"}) | Set-Content $_ }}\n\n#Need to tell usvfs to not use the BOOST_BUILDID\nGet-ChildItem -Path *.props -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern 'BOOST_LIB_BUILDID=x86;') {(Get-Content $_ | ForEach {$_ -replace 'BOOST_LIB_BUILDID=x86;', \"\"}) | Set-Content $_ }}\n\nSet-Location -Path c:\\projects\\usvfs\ngit submodule -q update --init --recursive\nSet-Location -Path c:\\projects\\usvfs\\udis86\ngit pull -q origin master" build: project: vsbuild/usvfs.sln parallel: true From bb88b16e249712e11abe74a9423db8020ee653c4 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Wed, 28 Nov 2018 03:38:41 -0600 Subject: [PATCH 10/18] Update path to Boost --- vsbuild/external_dependencies.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsbuild/external_dependencies.props b/vsbuild/external_dependencies.props index f8c26636..2d64f847 100644 --- a/vsbuild/external_dependencies.props +++ b/vsbuild/external_dependencies.props @@ -4,7 +4,7 @@ - ..\..\boost_1_67_0 + ..\..\boost_1_68_0 $(BOOST_PATH) ..\..\googletest @@ -18,4 +18,4 @@ $(GTEST_PATH) - \ No newline at end of file + From 7f0eda57fa49b5fb3e346e690de9ac700cb11ae1 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 29 Nov 2018 08:19:40 -0600 Subject: [PATCH 11/18] Add executable blacklisting functionality --- include/usvfs.h | 5 +++ src/usvfs_dll/hookcontext.cpp | 18 ++++++++++- src/usvfs_dll/hookcontext.h | 2 ++ src/usvfs_dll/hooks/kernel32.cpp | 55 ++++++++++++++++++++++++-------- src/usvfs_dll/usvfs.cpp | 5 +++ src/usvfs_proxy/main.cpp | 32 +++++++++++++++++-- 6 files changed, 100 insertions(+), 17 deletions(-) diff --git a/include/usvfs.h b/include/usvfs.h index 43441038..8a09d551 100644 --- a/include/usvfs.h +++ b/include/usvfs.h @@ -139,6 +139,11 @@ DLLEXPORT BOOL WINAPI CreateVFSDump(LPSTR buffer, size_t *size); */ DLLEXPORT VOID WINAPI BlacklistExecutable(LPWSTR executableName); +/** + * clears the executable blacklist + */ +DLLEXPORT VOID WINAPI ClearExecutableBlacklist(); + /** * print debugging info about the vfs. The format is currently not fixed and may * change between usvfs versions diff --git a/src/usvfs_dll/hookcontext.cpp b/src/usvfs_dll/hookcontext.cpp index 1570e535..5342e8c0 100644 --- a/src/usvfs_dll/hookcontext.cpp +++ b/src/usvfs_dll/hookcontext.cpp @@ -26,7 +26,7 @@ along with usvfs. If not, see . #include #include #include "loghelpers.h" - +#include namespace bi = boost::interprocess; using usvfs::shared::SharedMemoryT; @@ -209,6 +209,22 @@ void HookContext::blacklistExecutable(const std::wstring &executableName) m_Parameters->processBlacklist.get_allocator())); } +void HookContext::clearExecutableBlacklist() +{ + m_Parameters->processBlacklist.clear(); +} + +BOOL HookContext::executableBlacklisted(const std::wstring &executableName) const +{ + for (shared::StringT exec : m_Parameters->processBlacklist) { + if (boost::algorithm::iends_with(executableName, + "\\" + std::string(exec.data(), exec.size()))) { + return TRUE; + } + } + return FALSE; +} + void HookContext::unregisterCurrentProcess() { auto iter = m_Parameters->processList.find(::GetCurrentProcessId()); diff --git a/src/usvfs_dll/hookcontext.h b/src/usvfs_dll/hookcontext.h index 25a65f05..8e435b06 100644 --- a/src/usvfs_dll/hookcontext.h +++ b/src/usvfs_dll/hookcontext.h @@ -199,6 +199,8 @@ class HookContext std::vector registeredProcesses() const; void blacklistExecutable(const std::wstring &executableName); + void clearExecutableBlacklist(); + BOOL executableBlacklisted(const std::wstring &executableName) const; void setLogLevel(LogLevel level); void setCrashDumpsType(CrashDumpsType type); diff --git a/src/usvfs_dll/hooks/kernel32.cpp b/src/usvfs_dll/hooks/kernel32.cpp index 6c5ca204..408896db 100644 --- a/src/usvfs_dll/hooks/kernel32.cpp +++ b/src/usvfs_dll/hooks/kernel32.cpp @@ -807,20 +807,49 @@ BOOL WINAPI usvfs::hook_CreateProcessInternalW( newToken); POST_REALCALL + BOOL blacklisted = FALSE; + if (applicationReroute.fileName()) { + auto context = READ_CONTEXT(); + if (context->executableBlacklisted(applicationReroute.fileName())) { + spdlog::get("hooks")->info( + "not injecting {} as application is blacklisted", + ush::string_cast( + applicationReroute.fileName(), + ush::CodePage::UTF8 + ) + ); + blacklisted = TRUE; + } + } else if (cmdReroute.fileName()) { + auto context = READ_CONTEXT(); + if (context->executableBlacklisted(cmdReroute.fileName())) { + spdlog::get("hooks")->info( + "not injecting {} as command line is blacklisted", + ush::string_cast( + cmdReroute.fileName(), + ush::CodePage::UTF8 + ) + ); + blacklisted = TRUE; + } + } + if (res) { - try { - injectProcess(dllPath, callParameters, *lpProcessInformation); - } catch (const std::exception &e) { - spdlog::get("hooks") - ->error("failed to inject into {0}: {1}", - lpApplicationName != nullptr - ? log::wrap(applicationReroute.fileName()) - : log::wrap(static_cast(lpCommandLine)), - e.what()); + if (!blacklisted) { + try { + injectProcess(dllPath, callParameters, *lpProcessInformation); + } catch (const std::exception &e) { + spdlog::get("hooks") + ->error("failed to inject into {0}: {1}", + lpApplicationName != nullptr + ? log::wrap(applicationReroute.fileName()) + : log::wrap(static_cast(lpCommandLine)), + e.what()); + } } - // resume unless process is suposed to start suspended + // resume unless process is supposed to start suspended if (!susp && (ResumeThread(lpProcessInformation->hThread) == (DWORD)-1)) { spdlog::get("hooks")->error("failed to inject into spawned process"); res = FALSE; @@ -830,9 +859,10 @@ BOOL WINAPI usvfs::hook_CreateProcessInternalW( LOG_CALL() .PARAM(lpApplicationName) .PARAM(applicationReroute.fileName()) - .PARAM(cmdline) + .PARAM(cmdReroute.fileName()) .PARAM(res) - .PARAM(callContext.lastError()); + .PARAM(callContext.lastError()) + .PARAM(cmdline); HOOK_END return res; @@ -2048,7 +2078,6 @@ HANDLE WINAPI usvfs::hook_FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVEL bool usedRewrite = false; - if (boost::algorithm::icontains(lpFileName, tempPathStr)) { PRE_REALCALL //Force the mutEXHook to match NtQueryDirectoryFile so it calls the non hooked NtQueryDirectoryFile. diff --git a/src/usvfs_dll/usvfs.cpp b/src/usvfs_dll/usvfs.cpp index 356b5642..1515b1b8 100644 --- a/src/usvfs_dll/usvfs.cpp +++ b/src/usvfs_dll/usvfs.cpp @@ -716,6 +716,11 @@ VOID WINAPI BlacklistExecutable(LPWSTR executableName) context->blacklistExecutable(executableName); } +VOID WINAPI ClearExecutableBlacklist() +{ + context->clearExecutableBlacklist(); +} + VOID WINAPI PrintDebugInfo() { diff --git a/src/usvfs_proxy/main.cpp b/src/usvfs_proxy/main.cpp index 17615f53..bc0a8aa1 100644 --- a/src/usvfs_proxy/main.cpp +++ b/src/usvfs_proxy/main.cpp @@ -28,6 +28,8 @@ along with usvfs. If not, see . #include #include #include +#include +#include namespace bi = boost::interprocess; @@ -135,8 +137,22 @@ int main(int argc, char **argv) { if (tid != 0) { threadHandle = OpenThread(THREAD_ALL_ACCESS, FALSE, tid); } - usvfs::injectProcess(p.parent_path().wstring(), par, processHandle, - threadHandle); + + BOOL blacklisted = FALSE; + TCHAR szModName[MAX_PATH]; + if (GetModuleFileNameEx(processHandle, NULL, szModName, sizeof(szModName) / sizeof(TCHAR))) { + for (usvfs::shared::StringT exec : params.first->processBlacklist) { + if (boost::algorithm::iends_with(std::wstring(szModName), + "\\" + std::string(exec.data(), exec.size()))) { + blacklisted = TRUE; + break; + } + } + } + if (!blacklisted) { + usvfs::injectProcess(p.parent_path().wstring(), par, processHandle, + threadHandle); + } } else { winapi::process::Result process = winapi::ansi::createProcess(executable) @@ -148,7 +164,17 @@ int main(int argc, char **argv) { return 1; } - usvfs::injectProcess(p.parent_path().wstring(), par, process.processInfo); + BOOL blacklisted = FALSE; + for (usvfs::shared::StringT exec : params.first->processBlacklist) { + if (boost::algorithm::iends_with(executable, + "\\" + std::string(exec.data(), exec.size()))) { + blacklisted = TRUE; + break; + } + } + if (!blacklisted) { + usvfs::injectProcess(p.parent_path().wstring(), par, process.processInfo); + } ResumeThread(process.processInfo.hThread); } From c785950f949a3266d71925972695fafe9c57d385 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 29 Nov 2018 15:55:28 -0600 Subject: [PATCH 12/18] Add some more blacklisting logs --- src/usvfs_proxy/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/usvfs_proxy/main.cpp b/src/usvfs_proxy/main.cpp index bc0a8aa1..c32f248d 100644 --- a/src/usvfs_proxy/main.cpp +++ b/src/usvfs_proxy/main.cpp @@ -144,6 +144,8 @@ int main(int argc, char **argv) { for (usvfs::shared::StringT exec : params.first->processBlacklist) { if (boost::algorithm::iends_with(std::wstring(szModName), "\\" + std::string(exec.data(), exec.size()))) { + logger->info("not injecting {} as application is blacklisted", + usvfs::shared::string_cast(std::wstring(szModName))); blacklisted = TRUE; break; } @@ -168,6 +170,8 @@ int main(int argc, char **argv) { for (usvfs::shared::StringT exec : params.first->processBlacklist) { if (boost::algorithm::iends_with(executable, "\\" + std::string(exec.data(), exec.size()))) { + logger->info("not injecting {} as application is blacklisted", + std::string(exec.data(), exec.size())); blacklisted = TRUE; break; } From 41d0a9eda999db976531a8e145bedb7dcde4dbc2 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 6 Dec 2018 17:27:02 -0600 Subject: [PATCH 13/18] Change the ProgramData folder used to prevent issues when clearing Windows Event Logs --- src/shared/shmlogger.cpp | 16 ++++++++++++++++ vsbuild/common.props | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/shared/shmlogger.cpp b/src/shared/shmlogger.cpp index 04ad61d5..54c0e701 100644 --- a/src/shared/shmlogger.cpp +++ b/src/shared/shmlogger.cpp @@ -27,10 +27,14 @@ along with usvfs. If not, see . #include #include #include +#include +#include #pragma warning(pop) #pragma warning(disable : 4996) +#pragma comment(lib, "comsuppw") + using namespace boost::interprocess; SHMLogger *SHMLogger::s_Instance = nullptr; @@ -194,3 +198,15 @@ void spdlog::sinks::shm_sink::output(level::level_enum lev, m_DroppedMessages.fetch_add(1, std::memory_order_relaxed); } } + +void __cdecl boost::interprocess::ipcdetail::get_shared_dir(std::string &shared_dir) +{ + PWSTR path; + if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_ProgramData, 0, NULL, &path))) { + _bstr_t bPath(path); + shared_dir = (char*)bPath; + shared_dir += "\\USVFS"; + } else { + shared_dir = "C:\\ProgramData\\USVFS"; + } +} \ No newline at end of file diff --git a/vsbuild/common.props b/vsbuild/common.props index 33a10b7c..1c410517 100644 --- a/vsbuild/common.props +++ b/vsbuild/common.props @@ -11,7 +11,7 @@ MultiThreaded false true - _WINDOWS;NDEBUG;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;%(PreprocessorDefinitions) + _WINDOWS;NDEBUG;BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE;BOOST_INTERPROCESS_SHARED_DIR_FUNC;%(PreprocessorDefinitions) From 5e31b3673a8fc477e1bb9b1b9d66ff55f2579c10 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 6 Dec 2018 17:49:09 -0600 Subject: [PATCH 14/18] Add dialogs to display unhandled exceptions --- src/usvfs_proxy/main.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/usvfs_proxy/main.cpp b/src/usvfs_proxy/main.cpp index c32f248d..93e00403 100644 --- a/src/usvfs_proxy/main.cpp +++ b/src/usvfs_proxy/main.cpp @@ -30,6 +30,7 @@ along with usvfs. If not, see . #include #include #include +#include namespace bi = boost::interprocess; @@ -70,6 +71,27 @@ T getParameter(std::vector &arguments, const std::string &key, cons } } +static void exceptionDialog(int line, int num, ...) { + va_list args; + va_start(args, num); + + std::wstring wstr; + WCHAR buf[256]; + wstr.append(L"Unhandled USVFS proxy exception (line "); + wsprintf(buf, L"%d): ", line); + wstr.append(buf); + for (int i = 0; i < num; i++ ) { + wsprintf(buf, L"%S", va_arg(args, const char *)); + if (i < num-1) + wsprintf(buf, L", "); + wstr.append(buf); + } + + MessageBox(NULL, wstr.data(), NULL, MB_OK); + + va_end(args); +} + int main(int argc, char **argv) { std::shared_ptr logger; @@ -85,11 +107,13 @@ int main(int argc, char **argv) { instance = getParameter(arguments, "instance", true); } catch (const std::exception &e) { if (logger.get() == nullptr) { + exceptionDialog(__LINE__, 1, e.what()); return 1; } try { logger->critical("{}", e.what()); - } catch (const spdlog::spdlog_ex &) { + } catch (const spdlog::spdlog_ex &e2) { + exceptionDialog(__LINE__, 2, e.what(), e2.what()); // no way to log this } catch (const std::exception &) { logger->critical() << e.what(); @@ -188,8 +212,9 @@ int main(int argc, char **argv) { try { logger->critical("unhandled exception: {}", e.what()); logExtInfo(e); - } catch (const spdlog::spdlog_ex &) { + } catch (const spdlog::spdlog_ex &e2) { // no way to log this + exceptionDialog(__LINE__, 2, e.what(), e2.what()); } catch (const std::exception &) { logger->critical() << e.what(); } From acf3c28305a6d830684eff5afc14ecdc66d905b8 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 6 Dec 2018 18:55:42 -0600 Subject: [PATCH 15/18] Do not add/remove fake/overwrite folders to the directory tracker --- src/usvfs_dll/hooks/kernel32.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/usvfs_dll/hooks/kernel32.cpp b/src/usvfs_dll/hooks/kernel32.cpp index 408896db..d74e5dc5 100644 --- a/src/usvfs_dll/hooks/kernel32.cpp +++ b/src/usvfs_dll/hooks/kernel32.cpp @@ -276,8 +276,8 @@ class RerouteW } else { - if (m_PathCreated) - addDirectoryMapping(context, fs::path(m_RealPath).parent_path(), fs::path(m_FileName).parent_path()); + //if (m_PathCreated) + //addDirectoryMapping(context, fs::path(m_RealPath).parent_path(), fs::path(m_FileName).parent_path()); spdlog::get("hooks")->info("mapping file in vfs: {}, {}", ush::string_cast(m_RealPath, ush::CodePage::UTF8), @@ -291,6 +291,9 @@ class RerouteW void removeMapping(const usvfs::HookContext::ConstPtr &readContext, bool directory = false) { + bool addToDelete = false; + bool dontAddToDelete = false; + // We need to track deleted files even if they were not rerouted (i.e. files deleted from the real folder which there is // a virtualized mapped folder on top of it). Since we don't want to add, *every* file which is deleted we check this: if (!directory) { @@ -305,7 +308,7 @@ class RerouteW found = true; } if (found) - k32DeleteTracker.insert(m_RealPath, m_FileName); + addToDelete = true; } if (wasRerouted()) { @@ -324,6 +327,7 @@ class RerouteW parent = fs::path(parent).parent_path().wstring(); if (k32FakeDirTracker.contains(parent)) { + dontAddToDelete = true; if (RemoveDirectoryW(parent.c_str())) { k32FakeDirTracker.erase(parent); spdlog::get("usvfs")->info("removed empty fake directory: {}", string_cast(parent)); @@ -339,6 +343,9 @@ class RerouteW } } } + if (addToDelete && !dontAddToDelete) { + k32DeleteTracker.insert(m_RealPath, m_FileName); + } } static bool createFakePath(fs::path path, LPSECURITY_ATTRIBUTES securityAttributes) From a81b862f04ce5f6b3411af5996bbdc58d07e9862 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 6 Dec 2018 18:56:13 -0600 Subject: [PATCH 16/18] Change version to 0.4.2 --- include/usvfs_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/usvfs_version.h b/include/usvfs_version.h index a83c455d..8470464e 100644 --- a/include/usvfs_version.h +++ b/include/usvfs_version.h @@ -2,7 +2,7 @@ #define USVFS_VERSION_MAJOR 0 #define USVFS_VERSION_MINOR 4 -#define USVFS_VERSION_BUILD 1 +#define USVFS_VERSION_BUILD 2 #define USVFS_VERSION_REVISION 0 #define USVFS_BUILD_STRING "" From 40e79a29170f68ce5b6d6e313849fe9ff730049a Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Fri, 7 Dec 2018 06:23:41 -0600 Subject: [PATCH 17/18] Create the shared directory if it doesn't exist --- src/shared/shmlogger.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/shmlogger.cpp b/src/shared/shmlogger.cpp index 54c0e701..ae90af6c 100644 --- a/src/shared/shmlogger.cpp +++ b/src/shared/shmlogger.cpp @@ -25,6 +25,7 @@ along with usvfs. If not, see . #include #include #include +#include #include #include #include @@ -209,4 +210,7 @@ void __cdecl boost::interprocess::ipcdetail::get_shared_dir(std::string &shared_ } else { shared_dir = "C:\\ProgramData\\USVFS"; } + boost::filesystem::path boostPath(shared_dir); + if (!boost::filesystem::exists(boostPath)) + boost::filesystem::create_directories(boostPath); } \ No newline at end of file From 5c109dd3981d4875fcd3ab10694a46baf5160653 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Tue, 11 Dec 2018 18:26:47 -0600 Subject: [PATCH 18/18] Extend the proxy injection timeout to 15 seconds --- src/usvfs_helper/inject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usvfs_helper/inject.cpp b/src/usvfs_helper/inject.cpp index 5e6342f1..8fbe5306 100644 --- a/src/usvfs_helper/inject.cpp +++ b/src/usvfs_helper/inject.cpp @@ -154,8 +154,8 @@ void usvfs::injectProcess(const std::wstring &applicationPath + ush::string_cast(exePath.wstring())) << ex_win_errcode(result.errorCode)); } else { - // wait for proxy completion. this shouldn't take long, 5 seconds is very generous - switch (WaitForSingleObject(result.processInfo.hProcess, 5000)) { + // wait for proxy completion. this shouldn't take long, 15 seconds is very generous + switch (WaitForSingleObject(result.processInfo.hProcess, 15000)) { case WAIT_TIMEOUT: { spdlog::get("usvfs")->debug("proxy timeout"); TerminateProcess(result.processInfo.hProcess, 1);