From a20b3083b058901572953364dccbdd4cad8f3c5a Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 26 Jan 2019 01:18:03 +0100 Subject: Windows: Add a build configuration containing EFI bootloader signed with custom SecureBoot key instead --- src/Common/BootEncryption.cpp | 5 +- src/Common/Cmdline.c | 2 +- src/Common/Dlgcode.c | 2 +- src/Common/Language.c | 2 +- src/Common/Tcdefs.h | 6 ++ src/Driver/Ntdriver.c | 2 +- src/ExpandVolume/ExpandVolume.vcxproj | 147 ++++++++++++++++++++++++++++++++++ src/Format/Format.vcxproj | 135 +++++++++++++++++++++++++++++++ src/Mount/Mount.vcxproj | 139 ++++++++++++++++++++++++++++++++ src/Setup/Portable.vcxproj | 64 +++++++++++++++ src/Setup/SelfExtract.c | 4 +- src/Setup/Setup.c | 51 +++++++++++- src/Setup/Setup.h | 3 + src/Setup/Setup.vcxproj | 64 +++++++++++++++ src/Setup/Wizard.c | 11 ++- src/VeraCrypt.sln | 34 ++++++++ 16 files changed, 660 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index 2bf7991c..4061bde9 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -4740,7 +4740,9 @@ namespace VeraCrypt throw SystemException (SRC_POS); } } +#endif +#if defined(VC_EFI_CUSTOM_MODE) || !defined(SETUP) void BootEncryption::GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded) { SystemDriveConfiguration config = GetSystemDriveConfiguration (); @@ -4780,7 +4782,8 @@ namespace VeraCrypt throw SystemException (SRC_POS); } } - +#endif +#ifndef SETUP void BootEncryption::CheckRequirements () { if (nCurrentOS == WIN_2000) diff --git a/src/Common/Cmdline.c b/src/Common/Cmdline.c index bc304578..d2056734 100644 --- a/src/Common/Cmdline.c +++ b/src/Common/Cmdline.c @@ -51,7 +51,7 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM *tmp = 0; - StringCchCopyW (tmp, 8192, L"VeraCrypt " _T(VERSION_STRING)); + StringCchCopyW (tmp, 8192, L"VeraCrypt " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)); #ifdef _WIN64 StringCchCatW (tmp, 8192, L" (64-bit)"); #else diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 4480f426..3de37b7c 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -1422,7 +1422,7 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam // Version SendMessage (GetDlgItem (hwndDlg, IDT_ABOUT_VERSION), WM_SETFONT, (WPARAM) hUserBoldFont, 0); - StringCbPrintfW (szTmp, sizeof(szTmp), L"VeraCrypt %s", _T(VERSION_STRING)); + StringCbPrintfW (szTmp, sizeof(szTmp), L"VeraCrypt %s", _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)); #ifdef _WIN64 StringCbCatW (szTmp, sizeof(szTmp), L" (64-bit)"); #else diff --git a/src/Common/Language.c b/src/Common/Language.c index ba0b6d19..6dbd8b61 100644 --- a/src/Common/Language.c +++ b/src/Common/Language.c @@ -225,7 +225,7 @@ static BOOL LoadLanguageData (int resourceid, BOOL bForceSetPreferredLanguage, B XmlGetAttributeText (xml, "prog-version", attr, sizeof (attr)); // Check version of external language file - if (defaultLangParsed && strcmp (attr, VERSION_STRING) && strcmp (attr, "DEBUG")) + if (defaultLangParsed && strcmp (attr, VERSION_STRING VERSION_STRING_SUFFIX) && strcmp (attr, "DEBUG")) { wchar_t m[2048]; StringCbPrintfW (m, sizeof(m), L"The installed language pack is incompatible with this version of VeraCrypt (the language pack is for VeraCrypt %hs). A newer version may be available at www.idrix.fr.\n\nTo prevent this message from being displayed, do any of the following:\n\n- Select 'Settings' > 'Language'; then select 'English' and click 'OK'.\n\n- Remove or replace the language pack with a compatible version (the language pack may reside e.g. in 'C:\\Program Files\\VeraCrypt' or '%%LOCALAPPDATA%%\\VirtualStore\\Program Files\\VeraCrypt', etc.)", attr); diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h index efa4df63..33dfbf5e 100644 --- a/src/Common/Tcdefs.h +++ b/src/Common/Tcdefs.h @@ -54,6 +54,12 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift); #define TC_APP_NAME "VeraCrypt" +#ifdef VC_EFI_CUSTOM_MODE +#define VERSION_STRING_SUFFIX "-CustomEFI" +#else +#define VERSION_STRING_SUFFIX "" +#endif + // Version displayed to user #define VERSION_STRING "1.24-Beta1" diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c index 282112fc..c76263b0 100644 --- a/src/Driver/Ntdriver.c +++ b/src/Driver/Ntdriver.c @@ -150,7 +150,7 @@ NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) LONG version; int i; - Dump ("DriverEntry " TC_APP_NAME " " VERSION_STRING "\n"); + Dump ("DriverEntry " TC_APP_NAME " " VERSION_STRING VERSION_STRING_SUFFIX "\n"); DetectX86Features (); diff --git a/src/ExpandVolume/ExpandVolume.vcxproj b/src/ExpandVolume/ExpandVolume.vcxproj index 0db64c99..5fe967bb 100644 --- a/src/ExpandVolume/ExpandVolume.vcxproj +++ b/src/ExpandVolume/ExpandVolume.vcxproj @@ -9,6 +9,14 @@ Debug x64 + + ReleaseCustomEFI + Win32 + + + ReleaseCustomEFI + x64 + Release Win32 @@ -29,6 +37,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -39,6 +52,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -51,6 +69,10 @@ + + + + @@ -59,6 +81,10 @@ + + + + @@ -75,17 +101,27 @@ true true Release\ + Release\ Release\ + Release\ false + false true + true $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ false + false true + true VeraCryptExpander VeraCryptExpander + VeraCryptExpander VeraCryptExpander VeraCryptExpander + VeraCryptExpander @@ -241,6 +277,53 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: copy Release\VeraCryptExpander.exe "..\Release\Setup Files\" + + + %(AdditionalIncludeDirectories) + $(SolutionDir)/Mount/$(ProjectName).tlb + + + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\pkcs11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + VCEXPANDER;VC_EFI_CUSTOM_MODE;TCMOUNT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level3 + ProgramDatabase + 4311;4131;%(DisableSpecificWarnings) + + + ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) + $(OutDir)VeraCryptExpander.exe + false + mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX86 + RequireAdministrator + + + VeraCryptExpander.manifest;%(AdditionalManifestFiles) + + + copy Release\VeraCryptExpander.exe "..\Release\Setup Files\" + + + VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) @@ -289,6 +372,54 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: WIN64;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + X64 + $(SolutionDir)/Mount/$(ProjectName).tlb + + + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\pkcs11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + VCEXPANDER;VC_EFI_CUSTOM_MODE;TCMOUNT;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level3 + ProgramDatabase + 4311;4131;%(DisableSpecificWarnings) + + + ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) + $(OutDir)VeraCryptExpander.exe + false + mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX64 + RequireAdministrator + + + VeraCryptExpander.manifest;%(AdditionalManifestFiles) + + + copy $(TargetPath) "..\Release\Setup Files\VeraCryptExpander-x64.exe" + + + VC_EFI_CUSTOM_MODE;WIN64;%(PreprocessorDefinitions) + + {8b7f059f-e4c7-4e11-88f5-ee8b8433072e} @@ -321,7 +452,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -333,13 +466,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -348,7 +485,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -369,7 +508,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -415,9 +556,13 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: $(SolutionDir)/Mount $(SolutionDir)/Mount/%(Filename)_h.h $(SolutionDir)/Mount + $(SolutionDir)/Mount $(SolutionDir)/Mount/%(Filename)_h.h + $(SolutionDir)/Mount/%(Filename)_h.h $(SolutionDir)/Mount + $(SolutionDir)/Mount $(SolutionDir)/Mount/%(Filename)_h.h + $(SolutionDir)/Mount/%(Filename)_h.h @@ -426,7 +571,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCryptExpander-x64.exe" >NUL: true true true + true true + true diff --git a/src/Format/Format.vcxproj b/src/Format/Format.vcxproj index 7d21e818..204654e1 100644 --- a/src/Format/Format.vcxproj +++ b/src/Format/Format.vcxproj @@ -9,6 +9,14 @@ Debug x64 + + ReleaseCustomEFI + Win32 + + + ReleaseCustomEFI + x64 + Release Win32 @@ -29,6 +37,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -39,6 +52,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -51,6 +69,10 @@ + + + + @@ -59,6 +81,10 @@ + + + + @@ -75,17 +101,27 @@ true true Release\ + Release\ Release\ + Release\ false + false true + true $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ false + false true + true VeraCryptFormat VeraCryptFormat + VeraCryptFormat VeraCryptFormat VeraCryptFormat + VeraCryptFormat @@ -209,6 +245,49 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe" + + + $(SolutionDir)/$(ProjectName)/$(ProjectName).tlb + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level4 + ProgramDatabase + 4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings) + + + ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) + $(OutDir)VeraCryptFormat.exe + false + mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX86 + + + Format.manifest;%(AdditionalManifestFiles) + + + copy Release\VeraCryptFormat.exe "..\Release\Setup Files\VeraCrypt Format.exe" + + + VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions) + + X64 @@ -253,19 +332,67 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: WIN64;%(PreprocessorDefinitions) + + + X64 + $(SolutionDir)/$(ProjectName)/$(ProjectName).tlb + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + VOLFORMAT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level4 + ProgramDatabase + 4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings) + + + ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) + $(OutDir)VeraCryptFormat.exe + false + mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX64 + + + Format.manifest;%(AdditionalManifestFiles) + + + copy $(TargetPath) "..\Release\Setup Files\VeraCrypt Format-x64.exe" + + + VC_EFI_CUSTOM_MODE;WIN64;%(PreprocessorDefinitions) + + CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -277,13 +404,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -294,7 +425,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -397,7 +530,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt Format-x64.exe" >NUL: true true true + true true + true diff --git a/src/Mount/Mount.vcxproj b/src/Mount/Mount.vcxproj index d4af0464..73a6641e 100644 --- a/src/Mount/Mount.vcxproj +++ b/src/Mount/Mount.vcxproj @@ -9,6 +9,14 @@ Debug x64 + + ReleaseCustomEFI + Win32 + + + ReleaseCustomEFI + x64 + Release Win32 @@ -29,6 +37,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -39,6 +52,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -51,6 +69,10 @@ + + + + @@ -59,6 +81,10 @@ + + + + @@ -75,17 +101,27 @@ true true Release\ + Release\ Release\ + Release\ false + false true + true $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ false + false true + true VeraCrypt VeraCrypt + VeraCrypt VeraCrypt VeraCrypt + VeraCrypt @@ -230,6 +266,52 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: copy Release\VeraCrypt.exe "..\Release\Setup Files" + + + %(AdditionalIncludeDirectories) + $(SolutionDir)/$(ProjectName)/$(ProjectName).tlb + + + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + TCMOUNT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level4 + ProgramDatabase + 4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings) + + + ..\Crypto\Release\crypto.lib;..\Common\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) + $(OutDir)VeraCrypt.exe + false + mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX86 + + + Mount.manifest;%(AdditionalManifestFiles) + + + copy Release\VeraCrypt.exe "..\Release\Setup Files" + + + VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) @@ -277,6 +359,53 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: WIN64;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + X64 + $(SolutionDir)/$(ProjectName)/$(ProjectName).tlb + + + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + TCMOUNT;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level4 + ProgramDatabase + 4057;4100;4127;4201;4701;4706;4131;%(DisableSpecificWarnings) + + + ..\Crypto\x64\Release\crypto.lib;..\Common\x64\Release\Zip.lib;mpr.lib;%(AdditionalDependencies) + $(OutDir)VeraCrypt.exe + false + mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX64 + + + Mount.manifest;%(AdditionalManifestFiles) + + + copy $(TargetPath) "..\Release\Setup Files\VeraCrypt-x64.exe" + + + VC_EFI_CUSTOM_MODE;WIN64;%(PreprocessorDefinitions) + + @@ -286,7 +415,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -298,13 +429,17 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -313,7 +448,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp + CompileAsCpp @@ -419,7 +556,9 @@ copy $(TargetPath) "..\Debug\Setup Files\VeraCrypt-x64.exe" >NUL: true true true + true true + true diff --git a/src/Setup/Portable.vcxproj b/src/Setup/Portable.vcxproj index 06c2e45a..e864515b 100644 --- a/src/Setup/Portable.vcxproj +++ b/src/Setup/Portable.vcxproj @@ -5,6 +5,10 @@ Debug Win32 + + ReleaseCustomEFI + Win32 + Release Win32 @@ -21,6 +25,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -33,6 +42,10 @@ + + + + @@ -46,11 +59,16 @@ true true PortableRelease\ + PortableRelease\ PortableRelease\ + PortableRelease\ false + false true + true VeraCryptPortable VeraCryptPortable + VeraCryptPortable @@ -127,16 +145,59 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl copy PortableRelease\VeraCryptPortable.exe "..\Release\Setup Files\VeraCrypt Portable.exe" + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + SETUP;PORTABLE;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;_ATL_NO_DEFAULT_LIBS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level4 + ProgramDatabase + 4057;4100;4127;4201;4505;4701;4706;4131;%(DisableSpecificWarnings) + + + /IGNORE:4089 %(AdditionalOptions) + mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;%(AdditionalDependencies) + $(OutDir)VeraCryptPortable.exe + AsInvoker + user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX86 + + + Portable.manifest;%(AdditionalManifestFiles) + + + copy PortableRelease\VeraCryptPortable.exe "..\Release\Setup Files\VeraCrypt Portable.exe" + + + VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions) + + CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp @@ -144,10 +205,12 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp @@ -190,6 +253,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl true true + true diff --git a/src/Setup/SelfExtract.c b/src/Setup/SelfExtract.c index cf825104..e4791dae 100644 --- a/src/Setup/SelfExtract.c +++ b/src/Setup/SelfExtract.c @@ -30,9 +30,9 @@ #endif #ifdef PORTABLE -#define OutputPackageFile L"VeraCrypt Portable " _T(VERSION_STRING) L".exe" +#define OutputPackageFile L"VeraCrypt Portable " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)L".exe" #else -#define OutputPackageFile L"VeraCrypt Setup " _T(VERSION_STRING) L".exe" +#define OutputPackageFile L"VeraCrypt Setup " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX) L".exe" #endif #define MAG_START_MARKER "VCINSTRT" #define MAG_END_MARKER_OBFUSCATED "V/C/I/N/S/C/R/C" diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index bd073d9a..7d17962c 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -658,6 +658,53 @@ void IconMessage (HWND hwndDlg, const wchar_t *txt) StatusMessageParam (hwndDlg, "ADDING_ICON", txt); } +#ifdef VC_EFI_CUSTOM_MODE +BOOL CheckSecureBootCompatibility (HWND hWnd) +{ + BOOL bRet = FALSE; + BOOL bDriverAttached = FALSE; + if (hDriver == INVALID_HANDLE_VALUE) + { + int status = DriverAttach(); + if (status || (hDriver == INVALID_HANDLE_VALUE)) + return FALSE; + bDriverAttached = TRUE; + } + + try + { + BootEncryption bootEnc (hWnd); + if (bootEnc.GetDriverServiceStartType() == SERVICE_BOOT_START) + { + SystemDriveConfiguration config = bootEnc.GetSystemDriveConfiguration (); + if (config.SystemPartition.IsGPT) + { + BOOL bSecureBootEnabled = FALSE, bVeraCryptKeysLoaded = FALSE; + bootEnc.GetSecureBootConfig (&bSecureBootEnabled, &bVeraCryptKeysLoaded); + if (!bSecureBootEnabled || bVeraCryptKeysLoaded) + { + bRet = TRUE; + } + } + else + bRet = TRUE; + } + else + bRet = TRUE; + } + catch (...) + { + } + + if (bDriverAttached) + { + CloseHandle (hDriver); + hDriver = INVALID_HANDLE_VALUE; + } + return bRet; +} +#endif + void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersionPtr) { LONG driverVersion = VERSION_NUM; @@ -1133,7 +1180,7 @@ BOOL DoRegInstall (HWND hwndDlg, wchar_t *szDestDir, BOOL bInstallType) if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_32KEY, NULL, &hkey, &dw) == ERROR_SUCCESS) { - StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING)); + StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)); RegSetValueEx (hkey, L"DisplayVersion", 0, REG_SZ, (BYTE *) szTmp, (wcslen (szTmp) + 1) * sizeof (wchar_t)); StringCbCopyW (szTmp, sizeof(szTmp), TC_HOMEPAGE); @@ -1249,7 +1296,7 @@ BOOL DoRegInstall (HWND hwndDlg, wchar_t *szDestDir, BOOL bInstallType) if (RegSetValueEx (hkey, L"DisplayIcon", 0, REG_SZ, (BYTE *) szTmp, (wcslen (szTmp) + 1) * sizeof (wchar_t)) != ERROR_SUCCESS) goto error; - StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING)); + StringCbCopyW (szTmp, sizeof(szTmp), _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)); if (RegSetValueEx (hkey, L"DisplayVersion", 0, REG_SZ, (BYTE *) szTmp, (wcslen (szTmp) + 1) * sizeof (wchar_t)) != ERROR_SUCCESS) goto error; diff --git a/src/Setup/Setup.h b/src/Setup/Setup.h index ada20fb9..60c95395 100644 --- a/src/Setup/Setup.h +++ b/src/Setup/Setup.h @@ -101,6 +101,9 @@ void DoInstall ( void *hwndDlg ); void SetInstallationPath (HWND hwndDlg); BOOL UpgradeBootLoader (HWND hwndDlg); BOOL CALLBACK InstallDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam ); +#ifdef VC_EFI_CUSTOM_MODE +BOOL CheckSecureBootCompatibility (HWND hWnd); +#endif extern BOOL bDevm; extern BOOL Rollback; diff --git a/src/Setup/Setup.vcxproj b/src/Setup/Setup.vcxproj index 932cb051..922d3018 100644 --- a/src/Setup/Setup.vcxproj +++ b/src/Setup/Setup.vcxproj @@ -5,6 +5,10 @@ Debug Win32 + + ReleaseCustomEFI + Win32 + Release Win32 @@ -21,6 +25,11 @@ Unicode Windows7.1SDK + + Application + Unicode + Windows7.1SDK + Application Unicode @@ -33,6 +42,10 @@ + + + + @@ -46,11 +59,16 @@ true true Release\ + Release\ Release\ + Release\ false + false true + true VeraCryptSetup VeraCryptSetup + VeraCryptSetup @@ -127,6 +145,47 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" >NUL copy Release\VeraCryptSetup.exe "..\Release\Setup Files\VeraCrypt Setup.exe" + + + /w34189 %(AdditionalOptions) + MaxSpeed + ..\Common;..\Crypto;..\;..\PKCS11;..\Common\zlib;..\Common\libzip;%(AdditionalIncludeDirectories) + SETUP;VC_EFI_CUSTOM_MODE;WIN32;HAVE_CONFIG_H;ZIP_STATIC;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS;_ATL_NO_DEFAULT_LIBS;%(PreprocessorDefinitions) + MultiThreaded + true + + + All + $(IntDir) + Level4 + ProgramDatabase + 4057;4100;4127;4201;4505;4701;4706;4131;%(DisableSpecificWarnings) + + + /IGNORE:4089 %(AdditionalOptions) + mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;%(AdditionalDependencies) + $(OutDir)VeraCryptSetup.exe + RequireAdministrator + user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs) + true + true + Windows + true + true + true + true + MachineX86 + + + Setup.manifest;%(AdditionalManifestFiles) + + + copy Release\VeraCryptSetup.exe "..\Release\Setup Files\VeraCrypt Setup.exe" + + + VC_EFI_CUSTOM_MODE;%(PreprocessorDefinitions) + + @@ -134,10 +193,12 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" >NUL CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp @@ -145,10 +206,12 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" >NUL CompileAsCpp CompileAsCpp + CompileAsCpp CompileAsCpp CompileAsCpp + CompileAsCpp @@ -193,6 +256,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" >NUL true true + true diff --git a/src/Setup/Wizard.c b/src/Setup/Wizard.c index 94e3aae5..a497d4e0 100644 --- a/src/Setup/Wizard.c +++ b/src/Setup/Wizard.c @@ -845,9 +845,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SendMessage (GetDlgItem (hwndDlg, IDC_BOX_TITLE), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE); #ifndef PORTABLE - SetWindowText (hwndDlg, L"VeraCrypt Setup " _T(VERSION_STRING)); + SetWindowText (hwndDlg, L"VeraCrypt Setup " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)); #else - SetWindowText (hwndDlg, L"VeraCrypt Portable " _T(VERSION_STRING)); + SetWindowText (hwndDlg, L"VeraCrypt Portable " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)); #endif DonColorSchemeId = GetDonVal (2, 9); @@ -948,6 +948,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa bExtractOnly = TRUE; nCurPageNo = EXTRACTION_OPTIONS_PAGE - 1; } +#ifdef VC_EFI_CUSTOM_MODE + else if (bUpgrade && !CheckSecureBootCompatibility (hwndDlg)) + { + WarningDirect(L"This installer version supports only custom EFI SecureBoot.\nPlease use regular installer to update your system", hwndDlg); + return 1; + } +#endif } #endif else if (nCurPageNo == EXTRACTION_OPTIONS_PAGE) diff --git a/src/VeraCrypt.sln b/src/VeraCrypt.sln index 6c6a54e0..6f373bcd 100644 --- a/src/VeraCrypt.sln +++ b/src/VeraCrypt.sln @@ -35,6 +35,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Portable", "Setup\Portable. EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + All CustomEFI|Win32 = All CustomEFI|Win32 + All CustomEFI|x64 = All CustomEFI|x64 All Debug|Win32 = All Debug|Win32 All Debug|x64 = All Debug|x64 All|Win32 = All|Win32 @@ -77,6 +79,10 @@ Global Setup|x64 = Setup|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All CustomEFI|Win32.ActiveCfg = Release|Win32 + {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All CustomEFI|Win32.Build.0 = Release|Win32 + {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All CustomEFI|x64.ActiveCfg = Release|x64 + {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All CustomEFI|x64.Build.0 = Release|x64 {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All Debug|Win32.ActiveCfg = Debug|Win32 {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All Debug|Win32.Build.0 = Debug|Win32 {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.All Debug|x64.ActiveCfg = Debug|x64 @@ -145,6 +151,9 @@ Global {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.Setup|Win32.ActiveCfg = Release|Win32 {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.Setup|x64.ActiveCfg = Release|x64 {993245CF-6B70-47EE-91BB-39F8FC6DC0E7}.Setup|x64.Build.0 = Release|x64 + {EF5EF444-18D0-40D7-8DFA-775EC4448602}.All CustomEFI|Win32.ActiveCfg = Release|Win32 + {EF5EF444-18D0-40D7-8DFA-775EC4448602}.All CustomEFI|Win32.Build.0 = Release|Win32 + {EF5EF444-18D0-40D7-8DFA-775EC4448602}.All CustomEFI|x64.ActiveCfg = Release|Win32 {EF5EF444-18D0-40D7-8DFA-775EC4448602}.All Debug|Win32.ActiveCfg = Debug|Win32 {EF5EF444-18D0-40D7-8DFA-775EC4448602}.All Debug|Win32.Build.0 = Debug|Win32 {EF5EF444-18D0-40D7-8DFA-775EC4448602}.All Debug|x64.ActiveCfg = Debug|Win32 @@ -195,6 +204,10 @@ Global {EF5EF444-18D0-40D7-8DFA-775EC4448602}.Setup Debug|x64.ActiveCfg = Debug|Win32 {EF5EF444-18D0-40D7-8DFA-775EC4448602}.Setup|Win32.ActiveCfg = Release|Win32 {EF5EF444-18D0-40D7-8DFA-775EC4448602}.Setup|x64.ActiveCfg = Debug x64|Win32 + {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All CustomEFI|Win32.ActiveCfg = ReleaseCustomEFI|Win32 + {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All CustomEFI|Win32.Build.0 = ReleaseCustomEFI|Win32 + {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All CustomEFI|x64.ActiveCfg = ReleaseCustomEFI|x64 + {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All CustomEFI|x64.Build.0 = ReleaseCustomEFI|x64 {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All Debug|Win32.ActiveCfg = Debug|Win32 {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All Debug|Win32.Build.0 = Debug|Win32 {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.All Debug|x64.ActiveCfg = Debug|x64 @@ -261,6 +274,10 @@ Global {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.Setup|Win32.ActiveCfg = Release|Win32 {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.Setup|x64.ActiveCfg = Release|x64 {9DC1ABE2-D18B-48FB-81D2-8C50ADC57BCF}.Setup|x64.Build.0 = Release|x64 + {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All CustomEFI|Win32.ActiveCfg = ReleaseCustomEFI|Win32 + {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All CustomEFI|Win32.Build.0 = ReleaseCustomEFI|Win32 + {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All CustomEFI|x64.ActiveCfg = ReleaseCustomEFI|x64 + {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All CustomEFI|x64.Build.0 = ReleaseCustomEFI|x64 {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All Debug|Win32.ActiveCfg = Debug|Win32 {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All Debug|Win32.Build.0 = Debug|Win32 {E4C40F94-E7F9-4981-86E4-186B46F993F3}.All Debug|x64.ActiveCfg = Debug|x64 @@ -327,6 +344,9 @@ Global {E4C40F94-E7F9-4981-86E4-186B46F993F3}.Setup|Win32.ActiveCfg = Release|Win32 {E4C40F94-E7F9-4981-86E4-186B46F993F3}.Setup|x64.ActiveCfg = Release|x64 {E4C40F94-E7F9-4981-86E4-186B46F993F3}.Setup|x64.Build.0 = Release|x64 + {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.All CustomEFI|Win32.ActiveCfg = ReleaseCustomEFI|Win32 + {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.All CustomEFI|Win32.Build.0 = ReleaseCustomEFI|Win32 + {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.All CustomEFI|x64.ActiveCfg = ReleaseCustomEFI|Win32 {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.All Debug|Win32.ActiveCfg = Debug|Win32 {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.All Debug|Win32.Build.0 = Debug|Win32 {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.All Debug|x64.ActiveCfg = Debug|Win32 @@ -375,6 +395,9 @@ Global {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.Setup|Win32.ActiveCfg = Release|Win32 {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.Setup|Win32.Build.0 = Release|Win32 {DF5F654D-BD44-4E31-B92E-B68074DC37A8}.Setup|x64.ActiveCfg = Release|Win32 + {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.All CustomEFI|Win32.ActiveCfg = Release|Win32 + {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.All CustomEFI|Win32.Build.0 = Release|Win32 + {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.All CustomEFI|x64.ActiveCfg = Release|Win32 {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.All Debug|Win32.ActiveCfg = Release|Win32 {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.All Debug|Win32.Build.0 = Release|Win32 {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.All Debug|x64.ActiveCfg = Release Loader|Win32 @@ -421,6 +444,10 @@ Global {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.Setup Debug|x64.ActiveCfg = Release Loader|Win32 {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.Setup|Win32.ActiveCfg = Release|Win32 {8B7F059F-E4C7-4E11-88F5-EE8B8433072E}.Setup|x64.ActiveCfg = Release Loader|Win32 + {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All CustomEFI|Win32.ActiveCfg = ReleaseCustomEFI|Win32 + {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All CustomEFI|Win32.Build.0 = ReleaseCustomEFI|Win32 + {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All CustomEFI|x64.ActiveCfg = ReleaseCustomEFI|x64 + {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All CustomEFI|x64.Build.0 = ReleaseCustomEFI|x64 {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All Debug|Win32.ActiveCfg = Debug|Win32 {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All Debug|Win32.Build.0 = Debug|Win32 {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.All Debug|x64.ActiveCfg = Debug|x64 @@ -498,6 +525,10 @@ Global {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.Setup|Win32.ActiveCfg = Release|Win32 {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.Setup|x64.ActiveCfg = Release|x64 {9715FF1D-599B-4BBC-AD96-BEF6E08FF827}.Setup|x64.Build.0 = Release|x64 + {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All CustomEFI|Win32.ActiveCfg = Release|Win32 + {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All CustomEFI|Win32.Build.0 = Release|Win32 + {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All CustomEFI|x64.ActiveCfg = Release|x64 + {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All CustomEFI|x64.Build.0 = Release|x64 {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All Debug|Win32.ActiveCfg = Debug|Win32 {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All Debug|Win32.Build.0 = Debug|Win32 {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.All Debug|x64.ActiveCfg = Debug|x64 @@ -560,6 +591,9 @@ Global {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.Setup|Win32.ActiveCfg = Release|Win32 {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.Setup|Win32.Build.0 = Release|Win32 {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}.Setup|x64.ActiveCfg = Release|Win32 + {60698D56-DB83-4D19-9C87-9DFB6A6F8C87}.All CustomEFI|Win32.ActiveCfg = ReleaseCustomEFI|Win32 + {60698D56-DB83-4D19-9C87-9DFB6A6F8C87}.All CustomEFI|Win32.Build.0 = ReleaseCustomEFI|Win32 + {60698D56-DB83-4D19-9C87-9DFB6A6F8C87}.All CustomEFI|x64.ActiveCfg = ReleaseCustomEFI|Win32 {60698D56-DB83-4D19-9C87-9DFB6A6F8C87}.All Debug|Win32.ActiveCfg = Debug|Win32 {60698D56-DB83-4D19-9C87-9DFB6A6F8C87}.All Debug|Win32.Build.0 = Debug|Win32 {60698D56-DB83-4D19-9C87-9DFB6A6F8C87}.All Debug|x64.ActiveCfg = Debug|Win32 -- cgit v1.2.3