From 9b88625d9713309c2dd9285f69875852aad6fe6c Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 1 Feb 2022 23:25:07 +0100 Subject: Windows: Make MSI installer compatible with System Encryption by leveraging VeraCrypt service capabilities --- src/Common/BootEncryption.h | 1 + src/Common/Dlgcode.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src/Common') diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h index 7f5c3b16..e25427dd 100644 --- a/src/Common/BootEncryption.h +++ b/src/Common/BootEncryption.h @@ -360,6 +360,7 @@ namespace VeraCrypt #define TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP L"Event Log" #define TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION L"/systemFavoritesService" #define VC_SYSTEM_FAVORITES_SERVICE_ARG_SKIP_MOUNT L"/SkipMount" +#define VC_SYSTEM_FAVORITES_SERVICE_ARG_UPDATE_LOADER L"/UpdateLoader" #define VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER 0x1 #define VC_SYSTEM_FAVORITES_SERVICE_CONFIG_FORCE_SET_BOOTNEXT 0x2 diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 7f2218e4..683e5c43 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -175,6 +175,10 @@ BOOL bLanguageSetInSetup = FALSE; extern BOOL bMakePackage; #endif +#ifdef TCMOUNT +extern BOOL ServiceMode; +#endif + // Status of detection of hidden sectors (whole-system-drive encryption). // 0 - Unknown/undetermined/completed, 1: Detection is or was in progress (but did not complete e.g. due to system crash). int HiddenSectorDetectionStatus = 0; @@ -4759,10 +4763,16 @@ load: if (IsNonInstallMode () && CreateDriverSetupMutex () && DriverUnload () && nLoadRetryCount++ < 3) goto load; - CloseDriverSetupMutex (); - CloseHandle (hDriver); - hDriver = INVALID_HANDLE_VALUE; - return ERR_DRIVER_VERSION; +#ifdef TCMOUNT + // don't fail in case of service. This solves issues during upgrade when system encryption is enabled + if (!ServiceMode) +#endif + { + CloseDriverSetupMutex (); + CloseHandle (hDriver); + hDriver = INVALID_HANDLE_VALUE; + return ERR_DRIVER_VERSION; + } } #else if (!bResult) -- cgit v1.2.3