AlienCowEatCake / ImageViewer

Simple, cross-platform image viewer
GNU General Public License v3.0
32 stars 4 forks source link

Remove dangerous default associations from MSI packages #6

Closed AlienCowEatCake closed 2 years ago

AlienCowEatCake commented 2 years ago
AlienCowEatCake commented 2 years ago

Patch for quick repack MSI builds: repack.diff.zip

diff --git a/buildscripts/win_qt4.8_mingw32.bat b/buildscripts/win_qt4.8_mingw32.bat
index 2230702..6aeff1c 100755
--- a/buildscripts/win_qt4.8_mingw32.bat
+++ b/buildscripts/win_qt4.8_mingw32.bat
@@ -14,29 +14,30 @@ cd ..
 rmdir /S /Q %BUILDDIR% 2>nul >nul
 mkdir %BUILDDIR%
 cd %BUILDDIR%
-qmake -r CONFIG+="release" CONFIG+="enable_qtwebkit disable_wic" CONFIG+="enable_cxx11" QMAKE_CXXFLAGS+="-std=gnu++1y" ..\%PROJECT%.pro
-mingw32-make
-strip --strip-all %APP_PATH%\release\%PROJECT%.exe
-mkdir %PROJECT%%SUFFIX%
-copy %APP_PATH%\release\%PROJECT%.exe %PROJECT%%SUFFIX%\%PROJECT%.exe
-for %%x in (Core, Gui, Network, Svg, WebKit) do (
-    copy %QTDIR%\bin\Qt%%x4.dll %PROJECT%%SUFFIX%\
-)
-for %%x in (accessible, bearer, codecs, graphicssystems, iconengines, imageformats) do (
-    mkdir %PROJECT%%SUFFIX%\plugins\%%x
-    copy %QTDIR%\plugins\%%x\*.dll %PROJECT%%SUFFIX%\plugins\%%x\
-    del /S /Q %PROJECT%%SUFFIX%\plugins\%%x\*d4.dll
-)
-mkdir %PROJECT%%SUFFIX%\translations
-for %%x in (en ru) do (
-    copy %QTDIR%\translations\qt_%%x.qm %PROJECT%%SUFFIX%\translations\
-)
-(
-    echo [Paths]
-    echo Translations = translations
-    echo Plugins = plugins
-)> %PROJECT%%SUFFIX%\qt.conf
-%ZIP_CMD% -9r ..\%PROJECT%%SUFFIX%.zip %PROJECT%%SUFFIX%
+rem qmake -r CONFIG+="release" CONFIG+="enable_qtwebkit disable_wic" CONFIG+="enable_cxx11" QMAKE_CXXFLAGS+="-std=gnu++1y" ..\%PROJECT%.pro
+rem mingw32-make
+rem strip --strip-all %APP_PATH%\release\%PROJECT%.exe
+rem mkdir %PROJECT%%SUFFIX%
+rem copy %APP_PATH%\release\%PROJECT%.exe %PROJECT%%SUFFIX%\%PROJECT%.exe
+rem for %%x in (Core, Gui, Network, Svg, WebKit) do (
+rem     copy %QTDIR%\bin\Qt%%x4.dll %PROJECT%%SUFFIX%\
+rem )
+rem for %%x in (accessible, bearer, codecs, graphicssystems, iconengines, imageformats) do (
+rem     mkdir %PROJECT%%SUFFIX%\plugins\%%x
+rem     copy %QTDIR%\plugins\%%x\*.dll %PROJECT%%SUFFIX%\plugins\%%x\
+rem     del /S /Q %PROJECT%%SUFFIX%\plugins\%%x\*d4.dll
+rem )
+rem mkdir %PROJECT%%SUFFIX%\translations
+rem for %%x in (en ru) do (
+rem     copy %QTDIR%\translations\qt_%%x.qm %PROJECT%%SUFFIX%\translations\
+rem )
+rem (
+rem     echo [Paths]
+rem     echo Translations = translations
+rem     echo Plugins = plugins
+rem )> %PROJECT%%SUFFIX%\qt.conf
+rem %ZIP_CMD% -9r ..\%PROJECT%%SUFFIX%.zip %PROJECT%%SUFFIX%
+"C:\Program Files\7-Zip\7z.exe" x ..\%PROJECT%%SUFFIX%.zip
 rmdir /S /Q build_msi 2>nul >nul
 move %PROJECT%%SUFFIX% build_msi
 heat dir build_msi -cg ApplicationFiles -dr INSTALLLOCATION -gg -scom -sfrag -srd -sreg -svb6 -out appfiles.wxs
@@ -44,7 +45,7 @@ candle -out appfiles.wixobj appfiles.wxs -arch x86
 candle -out common.wixobj ..\src\ImageViewer\resources\platform\windows\common.wxs -arch x86
 candle -out main.wixobj ..\src\ImageViewer\resources\platform\windows\w2k.wxs -ext WixUIExtension -arch x86
 light -out %PROJECT%.msi -b build_msi main.wixobj appfiles.wixobj common.wixobj -ext WixUIExtension -dcl:high
-move %PROJECT%.msi ..\%PROJECT%%SUFFIX%.msi
+move %PROJECT%.msi ..\%PROJECT%%SUFFIX%-1.msi
 cd ..

 pause
diff --git a/buildscripts/win_qt5.15_msvc2022_x64.bat b/buildscripts/win_qt5.15_msvc2022_x64.bat
index 65f3b50..aacd60c 100755
--- a/buildscripts/win_qt5.15_msvc2022_x64.bat
+++ b/buildscripts/win_qt5.15_msvc2022_x64.bat
@@ -21,21 +21,22 @@ cd ..
 rmdir /S /Q %BUILDDIR% 2>nul >nul
 mkdir %BUILDDIR%
 cd %BUILDDIR%
-qmake -r CONFIG+="release" CONFIG+="enable_qtwebkit enable_update_checking" ..\%PROJECT%.pro
-nmake
-mkdir %PROJECT%%SUFFIX%
-copy %APP_PATH%\release\%PROJECT%.exe %PROJECT%%SUFFIX%\%PROJECT%.exe
-windeployqt --release --no-compiler-runtime --no-system-d3d-compiler --no-virtualkeyboard --no-angle --no-opengl-sw --translations en,ru %PROJECT%%SUFFIX%
-copy %WEBVIEW2LOADER_DLL% %PROJECT%%SUFFIX%\
-copy %QTDIR%\bin\libxml2.dll %PROJECT%%SUFFIX%\
-copy %QTDIR%\bin\libxslt.dll %PROJECT%%SUFFIX%\
-copy %OPENSSL_DIR%\*.dll %PROJECT%%SUFFIX%\
-copy %CRT_DIR%\*.dll %PROJECT%%SUFFIX%\
-copy %UCRT_DIR%\*.dll %PROJECT%%SUFFIX%\
-rmdir /S /Q %PROJECT%%SUFFIX%\position 2>nul >nul
-rmdir /S /Q %PROJECT%%SUFFIX%\sensorgestures 2>nul >nul
-rmdir /S /Q %PROJECT%%SUFFIX%\sensors 2>nul >nul
-%ZIP_CMD% -9r ..\%PROJECT%%SUFFIX%.zip %PROJECT%%SUFFIX%
+rem qmake -r CONFIG+="release" CONFIG+="enable_qtwebkit enable_update_checking" ..\%PROJECT%.pro
+rem nmake
+rem mkdir %PROJECT%%SUFFIX%
+rem copy %APP_PATH%\release\%PROJECT%.exe %PROJECT%%SUFFIX%\%PROJECT%.exe
+rem windeployqt --release --no-compiler-runtime --no-system-d3d-compiler --no-virtualkeyboard --no-angle --no-opengl-sw --translations en,ru %PROJECT%%SUFFIX%
+rem copy %WEBVIEW2LOADER_DLL% %PROJECT%%SUFFIX%\
+rem copy %QTDIR%\bin\libxml2.dll %PROJECT%%SUFFIX%\
+rem copy %QTDIR%\bin\libxslt.dll %PROJECT%%SUFFIX%\
+rem copy %OPENSSL_DIR%\*.dll %PROJECT%%SUFFIX%\
+rem copy %CRT_DIR%\*.dll %PROJECT%%SUFFIX%\
+rem copy %UCRT_DIR%\*.dll %PROJECT%%SUFFIX%\
+rem rmdir /S /Q %PROJECT%%SUFFIX%\position 2>nul >nul
+rem rmdir /S /Q %PROJECT%%SUFFIX%\sensorgestures 2>nul >nul
+rem rmdir /S /Q %PROJECT%%SUFFIX%\sensors 2>nul >nul
+rem %ZIP_CMD% -9r ..\%PROJECT%%SUFFIX%.zip %PROJECT%%SUFFIX%
+"C:\Program Files\7-Zip\7z.exe" x ..\%PROJECT%%SUFFIX%.zip
 rmdir /S /Q build_msi 2>nul >nul
 move %PROJECT%%SUFFIX% build_msi
 heat dir build_msi -cg ApplicationFiles -dr INSTALLLOCATION -gg -scom -sfrag -srd -sreg -svb6 -out appfiles.wxs
@@ -43,7 +44,7 @@ candle -out appfiles.wixobj appfiles.wxs -arch %ARCH%
 candle -out common.wixobj ..\src\ImageViewer\resources\platform\windows\common.wxs -arch %ARCH%
 candle -out main.wixobj ..\src\ImageViewer\resources\platform\windows\%ARCH%.wxs -ext WixUIExtension -ext WixUtilExtension -arch %ARCH%
 light -out %PROJECT%.msi -b build_msi main.wixobj appfiles.wixobj common.wixobj -ext WixUIExtension -ext WixUtilExtension -dcl:high
-move %PROJECT%.msi ..\%PROJECT%%SUFFIX%.msi
+move %PROJECT%.msi ..\%PROJECT%%SUFFIX%-1.msi
 cd ..

 pause
diff --git a/buildscripts/win_qt5.15_msvc2022_x86.bat b/buildscripts/win_qt5.15_msvc2022_x86.bat
index 783ff9f..c48b799 100755
--- a/buildscripts/win_qt5.15_msvc2022_x86.bat
+++ b/buildscripts/win_qt5.15_msvc2022_x86.bat
@@ -21,21 +21,22 @@ cd ..
 rmdir /S /Q %BUILDDIR% 2>nul >nul
 mkdir %BUILDDIR%
 cd %BUILDDIR%
-qmake -r CONFIG+="release" CONFIG+="enable_qtwebkit enable_update_checking" ..\%PROJECT%.pro
-nmake
-mkdir %PROJECT%%SUFFIX%
-copy %APP_PATH%\release\%PROJECT%.exe %PROJECT%%SUFFIX%\%PROJECT%.exe
-windeployqt --release --no-compiler-runtime --no-system-d3d-compiler --no-virtualkeyboard --no-angle --no-opengl-sw --translations en,ru %PROJECT%%SUFFIX%
-copy %WEBVIEW2LOADER_DLL% %PROJECT%%SUFFIX%\
-copy %QTDIR%\bin\libxml2.dll %PROJECT%%SUFFIX%\
-copy %QTDIR%\bin\libxslt.dll %PROJECT%%SUFFIX%\
-copy %OPENSSL_DIR%\*.dll %PROJECT%%SUFFIX%\
-copy %CRT_DIR%\*.dll %PROJECT%%SUFFIX%\
-copy %UCRT_DIR%\*.dll %PROJECT%%SUFFIX%\
-rmdir /S /Q %PROJECT%%SUFFIX%\position 2>nul >nul
-rmdir /S /Q %PROJECT%%SUFFIX%\sensorgestures 2>nul >nul
-rmdir /S /Q %PROJECT%%SUFFIX%\sensors 2>nul >nul
-%ZIP_CMD% -9r ..\%PROJECT%%SUFFIX%.zip %PROJECT%%SUFFIX%
+rem qmake -r CONFIG+="release" CONFIG+="enable_qtwebkit enable_update_checking" ..\%PROJECT%.pro
+rem nmake
+rem mkdir %PROJECT%%SUFFIX%
+rem copy %APP_PATH%\release\%PROJECT%.exe %PROJECT%%SUFFIX%\%PROJECT%.exe
+rem windeployqt --release --no-compiler-runtime --no-system-d3d-compiler --no-virtualkeyboard --no-angle --no-opengl-sw --translations en,ru %PROJECT%%SUFFIX%
+rem copy %WEBVIEW2LOADER_DLL% %PROJECT%%SUFFIX%\
+rem copy %QTDIR%\bin\libxml2.dll %PROJECT%%SUFFIX%\
+rem copy %QTDIR%\bin\libxslt.dll %PROJECT%%SUFFIX%\
+rem copy %OPENSSL_DIR%\*.dll %PROJECT%%SUFFIX%\
+rem copy %CRT_DIR%\*.dll %PROJECT%%SUFFIX%\
+rem copy %UCRT_DIR%\*.dll %PROJECT%%SUFFIX%\
+rem rmdir /S /Q %PROJECT%%SUFFIX%\position 2>nul >nul
+rem rmdir /S /Q %PROJECT%%SUFFIX%\sensorgestures 2>nul >nul
+rem rmdir /S /Q %PROJECT%%SUFFIX%\sensors 2>nul >nul
+rem %ZIP_CMD% -9r ..\%PROJECT%%SUFFIX%.zip %PROJECT%%SUFFIX%
+"C:\Program Files\7-Zip\7z.exe" x ..\%PROJECT%%SUFFIX%.zip
 rmdir /S /Q build_msi 2>nul >nul
 move %PROJECT%%SUFFIX% build_msi
 heat dir build_msi -cg ApplicationFiles -dr INSTALLLOCATION -gg -scom -sfrag -srd -sreg -svb6 -out appfiles.wxs
@@ -43,7 +44,7 @@ candle -out appfiles.wixobj appfiles.wxs -arch %ARCH%
 candle -out common.wixobj ..\src\ImageViewer\resources\platform\windows\common.wxs -arch %ARCH%
 candle -out main.wixobj ..\src\ImageViewer\resources\platform\windows\%ARCH%.wxs -ext WixUIExtension -ext WixUtilExtension -arch %ARCH%
 light -out %PROJECT%.msi -b build_msi main.wixobj appfiles.wixobj common.wixobj -ext WixUIExtension -ext WixUtilExtension -dcl:high
-move %PROJECT%.msi ..\%PROJECT%%SUFFIX%.msi
+move %PROJECT%.msi ..\%PROJECT%%SUFFIX%-1.msi
 cd ..

 pause