From 3a0fd18211be27ea512ce892df705cbd4b86350d Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Tue, 2 Jan 2024 12:12:59 +0100 Subject: [PATCH] Simplify BlDisplayInputDialog() saving input buffer --- xtldr2/textui.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/xtldr2/textui.c b/xtldr2/textui.c index 52b5755..8f3620e 100644 --- a/xtldr2/textui.c +++ b/xtldr2/textui.c @@ -528,21 +528,8 @@ BlDisplayInputDialog(IN PWCHAR Caption, } else if(Key.UnicodeChar == 0x0D) { - /* ENTER key pressed, allocate memory for updated input text */ - BufferLength = RtlWideStringLength(InputFieldBuffer, 0); - BlMemoryFreePool(*InputFieldText); - Status = BlMemoryAllocatePool(BufferLength * sizeof(WCHAR), (PVOID *)*InputFieldText); - if(Status != STATUS_EFI_SUCCESS) - { - /* Failed to allocate memory, print error message and return status code */ - BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%lx)\n", Status); - BlDisplayErrorDialog(L"XTLDR", L"Failed to save input data."); - break; - } - - /* Copy edit buffer into original buffer */ - RtlZeroMemory(InputFieldText, BufferLength * sizeof(WCHAR)); - RtlCopyMemory(*InputFieldText, InputFieldBuffer, BufferLength * sizeof(WCHAR)); + /* ENTER key pressed, update input buffer */ + *InputFieldText = InputFieldBuffer; break; } else