diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2021-09-02 00:08:18 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2021-09-02 00:20:05 +0200 |
commit | 7bc4256c420d1da2e51ac90dd913ea4307407299 (patch) | |
tree | c7e35b6dd11283794b61e31a3a7f39c05a6f1134 /src/SetupDLL | |
parent | 4dc3d9c1a78b6e13abb10de288c67ef94e191c93 (diff) | |
download | VeraCrypt-7bc4256c420d1da2e51ac90dd913ea4307407299.tar.gz VeraCrypt-7bc4256c420d1da2e51ac90dd913ea4307407299.zip |
Windows MSI: Fix error querying bootloader information
Diffstat (limited to 'src/SetupDLL')
-rw-r--r-- | src/SetupDLL/Setup.c | 21 |
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; } |