VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/SetupDLL/Setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/SetupDLL/Setup.c')
-rw-r--r--src/SetupDLL/Setup.c60
1 files changed, 56 insertions, 4 deletions
diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c
index 14bdefd4..4aec04f9 100644
--- a/src/SetupDLL/Setup.c
+++ b/src/SetupDLL/Setup.c
@@ -1511,6 +1511,11 @@ BOOL DoDriverUnload_Dll (MSIHANDLE hInstaller, HWND hwnd)
BootEncryption bootEnc (hwnd);
if (bootEnc.GetDriverServiceStartType() == SERVICE_BOOT_START)
{
+ MSILogAndShow(hInstaller, MSI_ERROR_LEVEL, L"VeraCrypt MSI installation is currently not compatible with Windows System Encryption");
+ bOK = FALSE;
+ goto end;
+
+ /************* TODO: find a workaround to the fact that MSI service cannot access EFI environment variable
try
{
// Check hidden OS update consistency
@@ -1554,6 +1559,7 @@ BOOL DoDriverUnload_Dll (MSIHANDLE hInstaller, HWND hwnd)
SystemEncryptionUpdate = TRUE;
PortableMode = FALSE;
}
+ *****************************************/
}
}
catch (...) { }
@@ -1891,7 +1897,8 @@ BOOL UpgradeBootLoader_Dll (MSIHANDLE hInstaller, HWND hwndDlg)
{
MSILog(hInstaller, MSI_INFO_LEVEL, L"Begin UpgradeBootLoader_Dll");
- BOOL bOK = FALSE;
+ BOOL bOK = FALSE, bNeedUnloadDriver = FALSE;
+ int status;
if (!SystemEncryptionUpdate)
{
@@ -1900,6 +1907,19 @@ BOOL UpgradeBootLoader_Dll (MSIHANDLE hInstaller, HWND hwndDlg)
goto end;
}
+ if (hDriver == INVALID_HANDLE_VALUE)
+ {
+ status = DriverAttach();
+ if ((status == 0) && (hDriver != INVALID_HANDLE_VALUE))
+ {
+ bNeedUnloadDriver = TRUE;
+ }
+ else
+ {
+ MSILog(hInstaller, MSI_INFO_LEVEL, L"UpgradeBootLoader_Dll: failed to attach to driver");
+ }
+ }
+
try
{
BootEncryption bootEnc (hwndDlg);
@@ -1928,6 +1948,11 @@ BOOL UpgradeBootLoader_Dll (MSIHANDLE hInstaller, HWND hwndDlg)
MSILog (hInstaller, MSI_ERROR_LEVEL, GetString("BOOT_LOADER_UPGRADE_FAILED"));
end:
+ if (bNeedUnloadDriver)
+ {
+ CloseHandle (hDriver);
+ hDriver = INVALID_HANDLE_VALUE;
+ }
MSILog(hInstaller, MSI_INFO_LEVEL, L"End UpgradeBootLoader_Dll");
return bOK;
}
@@ -3045,6 +3070,9 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_PostInstall(MSIHANDLE hInstaller)
{
MSILog(hInstaller, MSI_ERROR_LEVEL, L"End VC_CustomAction_PostInstall: Could not write to registry");
}
+
+ // delete entry of EXE installation if it exists
+ RegDeleteKeyExW (HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\VeraCrypt", KEY_WOW64_32KEY, 0);
}
end:
@@ -3469,9 +3497,9 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_DoChecks(MSIHANDLE hInstaller)
DWORD cchValueBuf = 0;
UINT uiStat = 0;
HKEY hkey = 0;
- DWORD dw = 0;
std::wstring szInstallDir = L"";
BOOL bRefreshExts = FALSE;
+ BOOL bDisableReboot = FALSE;
UINT uiRet = ERROR_INSTALL_FAILURE;
MSILog(hInstaller, MSI_INFO_LEVEL, L"Begin VC_CustomAction_DoChecks");
@@ -3506,6 +3534,22 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_DoChecks(MSIHANDLE hInstaller)
}
}
+ // Get REBOOT to see whether it specified "ReallySuppress" which means no automatic reboot
+ szValueBuf.clear();
+ cchValueBuf = 0;
+ uiStat = MsiGetProperty(hInstaller, TEXT("REBOOT"), (LPWSTR)TEXT(""), &cchValueBuf);
+ if (ERROR_MORE_DATA == uiStat)
+ {
+ ++cchValueBuf; // add 1 for null termination
+ szValueBuf.resize(cchValueBuf);
+ uiStat = MsiGetProperty(hInstaller, TEXT("REBOOT"), &szValueBuf[0], &cchValueBuf);
+ if ((ERROR_SUCCESS == uiStat))
+ {
+ MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_DoChecks: REBOOT = '%s'", szValueBuf.c_str());
+ bDisableReboot = (szValueBuf[0] == L'R' || szValueBuf[0] == L'r');
+ }
+ }
+
// Read RegKeys previously setup by Pre/Post-Install
if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, L"Software\\.VeraCrypt\\Values", 0, KEY_READ, &hkey) == ERROR_SUCCESS)
{
@@ -3585,8 +3629,16 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_DoChecks(MSIHANDLE hInstaller)
// Check if reboot was required by the pre/post-install and set Wix property ISREBOOTREQUIRED accordingly.
if (bRestartRequired)
- {
- uiRet = MsiSetProperty(hInstaller, L"ISREBOOTREQUIRED", L"1");
+ {
+ if (bDisableReboot)
+ {
+ MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_DoChecks: reboot is required but it is disabled because \"REBOOT\" specifies ReallySuppress");
+ }
+ else
+ {
+ MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_DoChecks: reboot is required");
+ uiRet = MsiSetProperty(hInstaller, L"ISREBOOTREQUIRED", L"1");
+ }
}
else
{