From d68b9546bd36fa34093b8592d3927ba581fc8e59 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 3 Sep 2023 00:58:34 +0200 Subject: Windows: simpler and more robust safe dll loading combined with delay loading thanks to Windows 7 being minimum supported version. We also block execution on Windows versions older than Windows 7. A lot of code was removed thanks to this. --- src/Format/Format.vcxproj | 16 ++++++++-------- src/Format/Format_vs2019.vcxproj | 18 +++++++++--------- src/Format/Tcformat.c | 1 - 3 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src/Format') diff --git a/src/Format/Format.vcxproj b/src/Format/Format.vcxproj index 37bf69bb..1ae26d43 100644 --- a/src/Format/Format.vcxproj +++ b/src/Format/Format.vcxproj @@ -181,7 +181,7 @@ ..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true $(OutDir)Format.pdb Windows @@ -221,7 +221,7 @@ copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" >N ..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;..\Common\x64\Debug\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true $(OutDir)Format.pdb Windows @@ -264,7 +264,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -304,7 +304,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -344,7 +344,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -388,7 +388,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -432,7 +432,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -476,7 +476,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;..\Common\x64\Release\lzma.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows diff --git a/src/Format/Format_vs2019.vcxproj b/src/Format/Format_vs2019.vcxproj index f377290f..95f61615 100644 --- a/src/Format/Format_vs2019.vcxproj +++ b/src/Format/Format_vs2019.vcxproj @@ -201,7 +201,7 @@ ..\Crypto\Debug\crypto.lib;..\Common\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true $(OutDir)Format.pdb Windows @@ -241,7 +241,7 @@ copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" >N ..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true $(OutDir)Format.pdb Windows @@ -283,7 +283,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: ..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true $(OutDir)Format.pdb Windows @@ -324,7 +324,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -364,7 +364,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -408,7 +408,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -451,7 +451,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: ..\Crypto\ARM64\Release\crypto.lib;..\Common\ARM64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -494,7 +494,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows @@ -537,7 +537,7 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-arm64.exe" >NUL: ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) $(OutDir)VeraCryptFormat.exe false - mpr.dll;bcrypt.dll;%(DelayLoadDLLs) + mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs) true true Windows diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 8e95d0a4..bf9f9854 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -10694,7 +10694,6 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_VOL_CREATION_WIZARD_DLG), NULL, (DLGPROC) MainDialogProc, (LPARAM)lpszCommandLine); - FinalizeApp (); return 0; } -- cgit v1.2.3