Windows MSI: Fix error querying bootloader information

This commit is contained in:
Mounir IDRASSI 2021-09-02 00:08:18 +02:00
parent 4dc3d9c1a7
commit 7bc4256c42
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F
1 changed files with 20 additions and 1 deletions

View File

@ -1891,7 +1891,8 @@ BOOL UpgradeBootLoader_Dll (MSIHANDLE hInstaller, HWND hwndDlg)
{ {
MSILog(hInstaller, MSI_INFO_LEVEL, L"Begin UpgradeBootLoader_Dll"); MSILog(hInstaller, MSI_INFO_LEVEL, L"Begin UpgradeBootLoader_Dll");
BOOL bOK = FALSE; BOOL bOK = FALSE, bNeedUnloadDriver = FALSE;
int status;
if (!SystemEncryptionUpdate) if (!SystemEncryptionUpdate)
{ {
@ -1900,6 +1901,19 @@ BOOL UpgradeBootLoader_Dll (MSIHANDLE hInstaller, HWND hwndDlg)
goto end; 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 try
{ {
BootEncryption bootEnc (hwndDlg); BootEncryption bootEnc (hwndDlg);
@ -1928,6 +1942,11 @@ BOOL UpgradeBootLoader_Dll (MSIHANDLE hInstaller, HWND hwndDlg)
MSILog (hInstaller, MSI_ERROR_LEVEL, GetString("BOOT_LOADER_UPGRADE_FAILED")); MSILog (hInstaller, MSI_ERROR_LEVEL, GetString("BOOT_LOADER_UPGRADE_FAILED"));
end: end:
if (bNeedUnloadDriver)
{
CloseHandle (hDriver);
hDriver = INVALID_HANDLE_VALUE;
}
MSILog(hInstaller, MSI_INFO_LEVEL, L"End UpgradeBootLoader_Dll"); MSILog(hInstaller, MSI_INFO_LEVEL, L"End UpgradeBootLoader_Dll");
return bOK; return bOK;
} }