VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SetupDLL/Setup.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c
index d6f5ebfd..cc537d23 100644
--- a/src/SetupDLL/Setup.c
+++ b/src/SetupDLL/Setup.c
@@ -1891,7 +1891,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 +1901,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 +1942,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;
}