From 008ea3ad95d299fe4ebbd99cb3dd985378f35aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Thu, 3 Jul 2025 10:07:05 +0200 Subject: [PATCH] treewide: Pass string literals in SetupResetReminder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Żygowski --- MdeModulePkg/Application/UiApp/FrontPage.c | 18 ++++++------------ .../BootMaintenanceManagerUiLib/BootOption.c | 18 ++++++------------ .../Library/BootManagerUiLib/BootManager.c | 18 ++++++------------ .../SecureBootConfigDxe/SecureBootConfigImpl.c | 18 ++++++------------ 4 files changed, 24 insertions(+), 48 deletions(-) diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c b/MdeModulePkg/Application/UiApp/FrontPage.c index f2015ea742..0680fa00da 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.c +++ b/MdeModulePkg/Application/UiApp/FrontPage.c @@ -1132,29 +1132,23 @@ SetupResetReminder ( ) { EFI_INPUT_KEY Key; - CHAR16 *StringBuffer1; - CHAR16 *StringBuffer2; // // check any reset required change is applied? if yes, reset system // if (IsResetRequired ()) { - StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer1 != NULL); - StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer2 != NULL); - StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now."); - StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset"); // // Popup a menu to notice user // do { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Configuration changed. Reset to apply it Now.", + L"Press ENTER to reset", + NULL); } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); - FreePool (StringBuffer1); - FreePool (StringBuffer2); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } } diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c index e22aaf3039..1d592f98e6 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c @@ -28,8 +28,6 @@ BmmSetupResetReminder ( ) { EFI_INPUT_KEY Key; - CHAR16 *StringBuffer1; - CHAR16 *StringBuffer2; EFI_STATUS Status; EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2; @@ -42,22 +40,18 @@ BmmSetupResetReminder ( // check any reset required change is applied? if yes, reset system // if (!EFI_ERROR (Status) && FormBrowserEx2->IsResetRequired ()) { - StringBuffer1 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16)); - ASSERT (StringBuffer1 != NULL); - StringBuffer2 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16)); - ASSERT (StringBuffer2 != NULL); - StrCpyS (StringBuffer1, MAX_CHAR, L"Configuration changed. Reset to apply it Now."); - StrCpyS (StringBuffer2, MAX_CHAR, L"Press ENTER to reset"); // // Popup a menu to notice user // do { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Configuration changed. Reset to apply it Now.", + L"Press ENTER to reset", + NULL); } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); - FreePool (StringBuffer1); - FreePool (StringBuffer2); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } } diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c index 5ceb54164d..55f6fc148a 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c @@ -305,8 +305,6 @@ BmSetupResetReminder ( ) { EFI_INPUT_KEY Key; - CHAR16 *StringBuffer1; - CHAR16 *StringBuffer2; EFI_STATUS Status; EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2; @@ -318,22 +316,18 @@ BmSetupResetReminder ( // check any reset required change is applied? if yes, reset system // if (!EFI_ERROR (Status) && FormBrowserEx2->IsResetRequired ()) { - StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer1 != NULL); - StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); - ASSERT (StringBuffer2 != NULL); - StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now."); - StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset"); // // Popup a menu to notice user // do { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Configuration changed. Reset to apply it Now.", + L"Press ENTER to reset", + NULL); } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); - FreePool (StringBuffer1); - FreePool (StringBuffer2); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } } diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index 35a8baf089..e33df6842e 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c @@ -4867,8 +4867,6 @@ SetupResetReminder ( ) { EFI_INPUT_KEY Key; - CHAR16 *StringBuffer1; - CHAR16 *StringBuffer2; EFI_STATUS Status; EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2; @@ -4881,22 +4879,18 @@ SetupResetReminder ( // check any reset required change is applied? if yes, reset system // if (!EFI_ERROR (Status) && FormBrowserEx2->IsResetRequired ()) { - StringBuffer1 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16)); - ASSERT (StringBuffer1 != NULL); - StringBuffer2 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16)); - ASSERT (StringBuffer2 != NULL); - StrCpyS (StringBuffer1, MAX_CHAR, L"Configuration changed. Reset to apply it Now."); - StrCpyS (StringBuffer2, MAX_CHAR, L"Press ENTER to reset"); // // Popup a menu to notice user // do { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Configuration changed. Reset to apply it Now.", + L"Press ENTER to reset", + NULL); } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); - FreePool (StringBuffer1); - FreePool (StringBuffer2); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); } }