From: Dandan Bi Date: Mon, 17 Oct 2016 06:04:21 +0000 (+0800) Subject: MdeModulePkg/BMMUI: Make the BmmFakeNvData and BmmOldFakeNVData consistent X-Git-Tag: edk2-stable201903~5582 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=7880f73a8e89f482c61e181861997331baf37857 MdeModulePkg/BMMUI: Make the BmmFakeNvData and BmmOldFakeNVData consistent In BootMaintRouteConfig function, it will compare the data in BmmFakeNvData and BmmOldFakeNVData to see whether there are some changes need to save. In current codes when discarding changes or removing the useless changes, it will update the related fields in BmmFakeNvData. But also need to update related fields in BmmOldFakeNVData, or it will result in incorrect comparison in BootMaintRouteConfig function, then resulting in incorrect UI behaviors. Cc: Laszlo Ersek Cc: Liming Gao Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Eric Dong --- diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c index 92c44ea867..7475a94a27 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c @@ -925,6 +925,7 @@ BootMaintCallback ( BMM_CALLBACK_DATA *Private; BM_MENU_ENTRY *NewMenuEntry; BMM_FAKE_NV_DATA *CurrentFakeNVMap; + BMM_FAKE_NV_DATA *OldFakeNVMap; UINTN Index; EFI_DEVICE_PATH_PROTOCOL * File; @@ -959,6 +960,7 @@ BootMaintCallback ( // Retrive uncommitted data from Form Browser // CurrentFakeNVMap = &Private->BmmFakeNvData; + OldFakeNVMap = &Private->BmmOldFakeNVData; HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap); if (Action == EFI_BROWSER_ACTION_CHANGING) { @@ -1061,8 +1063,10 @@ BootMaintCallback ( // // Discard changes and exit formset // - CurrentFakeNVMap->DriverOptionalData[0] = 0x0000; - CurrentFakeNVMap->DriverDescriptionData[0] = 0x0000; + ZeroMem (CurrentFakeNVMap->DriverOptionalData, sizeof (CurrentFakeNVMap->DriverOptionalData)); + ZeroMem (CurrentFakeNVMap->BootDescriptionData, sizeof (CurrentFakeNVMap->BootDescriptionData)); + ZeroMem (OldFakeNVMap->DriverOptionalData, sizeof (OldFakeNVMap->DriverOptionalData)); + ZeroMem (OldFakeNVMap->DriverDescriptionData, sizeof (OldFakeNVMap->DriverDescriptionData)); CurrentFakeNVMap->DriverOptionChanged = FALSE; CurrentFakeNVMap->ForceReconnect = TRUE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; @@ -1070,8 +1074,10 @@ BootMaintCallback ( // // Discard changes and exit formset // - CurrentFakeNVMap->BootOptionalData[0] = 0x0000; - CurrentFakeNVMap->BootDescriptionData[0] = 0x0000; + ZeroMem (CurrentFakeNVMap->BootOptionalData, sizeof (CurrentFakeNVMap->BootOptionalData)); + ZeroMem (CurrentFakeNVMap->BootDescriptionData, sizeof (CurrentFakeNVMap->BootDescriptionData)); + ZeroMem (OldFakeNVMap->BootOptionalData, sizeof (OldFakeNVMap->BootOptionalData)); + ZeroMem (OldFakeNVMap->BootDescriptionData, sizeof (OldFakeNVMap->BootDescriptionData)); CurrentFakeNVMap->BootOptionChanged = FALSE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; } else if (QuestionId == KEY_VALUE_BOOT_DESCRIPTION || QuestionId == KEY_VALUE_BOOT_OPTION) { diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c index 960d0b0f9d..29d3ac9a47 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c @@ -262,6 +262,7 @@ UpdateBootDelPage ( // through HiiSetBrowserData function. // CallbackData->BmmFakeNvData.BootOptionDel[Index] = FALSE; + CallbackData->BmmOldFakeNVData.BootOptionDel[Index] = FALSE; } HiiCreateCheckBoxOpCode ( @@ -348,6 +349,7 @@ UpdateDrvDelPage ( // through HiiSetBrowserData function. // CallbackData->BmmFakeNvData.DriverOptionDel[Index] = FALSE; + CallbackData->BmmOldFakeNVData.DriverOptionDel[Index] = FALSE; } HiiCreateCheckBoxOpCode ( mStartOpCodeHandle, @@ -1025,11 +1027,15 @@ UpdateOptionPage( if (!CallbackData->BmmFakeNvData.BootOptionChanged) { ZeroMem (CallbackData->BmmFakeNvData.BootOptionalData, sizeof (CallbackData->BmmFakeNvData.BootOptionalData)); ZeroMem (CallbackData->BmmFakeNvData.BootDescriptionData, sizeof (CallbackData->BmmFakeNvData.BootDescriptionData)); + ZeroMem (CallbackData->BmmOldFakeNVData.BootOptionalData, sizeof (CallbackData->BmmOldFakeNVData.BootOptionalData)); + ZeroMem (CallbackData->BmmOldFakeNVData.BootDescriptionData, sizeof (CallbackData->BmmOldFakeNVData.BootDescriptionData)); } } else if (FormId == FORM_DRV_ADD_FILE_ID){ if (!CallbackData->BmmFakeNvData.DriverOptionChanged) { ZeroMem (CallbackData->BmmFakeNvData.DriverOptionalData, sizeof (CallbackData->BmmFakeNvData.DriverOptionalData)); ZeroMem (CallbackData->BmmFakeNvData.DriverDescriptionData, sizeof (CallbackData->BmmFakeNvData.DriverDescriptionData)); + ZeroMem (CallbackData->BmmOldFakeNVData.DriverOptionalData, sizeof (CallbackData->BmmOldFakeNVData.DriverOptionalData)); + ZeroMem (CallbackData->BmmOldFakeNVData.DriverDescriptionData, sizeof (CallbackData->BmmOldFakeNVData.DriverDescriptionData)); } }