diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2021-08-29 14:24:50 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2021-08-30 00:26:27 +0200 |
commit | e948c5e0a35bf1c076a730b3b1cfbc7460103f65 (patch) | |
tree | 9b10df8f38ecf2007d68c89e44536861f2ffc7ec | |
parent | aab6feabaaa844a77f7588b9c3712889bdd90c25 (diff) | |
download | VeraCrypt-e948c5e0a35bf1c076a730b3b1cfbc7460103f65.tar.gz VeraCrypt-e948c5e0a35bf1c076a730b3b1cfbc7460103f65.zip |
Windows MSI: Don't reboot if /norestart is specified (which is equivalent to REBOOT=REALLYSUPPRESS)
-rw-r--r-- | src/SetupDLL/Setup.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c index 14bdefd4..570af5d5 100644 --- a/src/SetupDLL/Setup.c +++ b/src/SetupDLL/Setup.c @@ -3472,6 +3472,7 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_DoChecks(MSIHANDLE hInstaller) 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 +3507,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 +3602,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 { |