mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-27 21:43:29 +01:00
Windows MSI: Don't reboot if /norestart is specified (which is equivalent to REBOOT=REALLYSUPPRESS)
This commit is contained in:
parent
aab6feabaa
commit
e948c5e0a3
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user