From e7fd76d180744440db7b5a91a7787ca39713da05 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 24 Nov 2011 08:47:57 +0000 Subject: Patch includes: 1. Support get default value for ref opcode logic. 2. Correct the sample for ref opcode with default value. 3. Refine logic about processing device path info in ref value. Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12774 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 32 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/Ui.c') diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index 0be50263dd..ebe8fae2cc 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -1891,6 +1891,7 @@ ProcessGotoOpCode ( ) { CHAR16 *StringPtr; + UINTN StringLen; UINTN BufferSize; EFI_DEVICE_PATH_PROTOCOL *DevicePath; CHAR16 TemStr[2]; @@ -1905,8 +1906,23 @@ ProcessGotoOpCode ( Status = EFI_SUCCESS; UpdateFormInfo = TRUE; + StringPtr = NULL; + StringLen = 0; + // + // Prepare the device path check, get the device path info first. + // if (Statement->HiiValue.Value.ref.DevicePath != 0) { + StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle); + if (StringPtr != NULL) { + StringLen = StrLen (StringPtr); + } + } + + // + // Check whether the device path string is a valid string. + // + if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringLen != 0) { if (Selection->Form->ModalForm) { return Status; } @@ -1914,16 +1930,6 @@ ProcessGotoOpCode ( // Goto another Hii Package list // Selection->Action = UI_ACTION_REFRESH_FORMSET; - - StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle); - if (StringPtr == NULL) { - // - // No device path string not found, exit - // - Selection->Action = UI_ACTION_EXIT; - Selection->Statement = NULL; - return Status; - } BufferSize = StrLen (StringPtr) / 2; DevicePath = AllocatePool (BufferSize); ASSERT (DevicePath != NULL); @@ -1947,8 +1953,11 @@ ProcessGotoOpCode ( DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8); } } + FreePool (StringPtr); Selection->Handle = DevicePathToHiiHandle (DevicePath); + FreePool (DevicePath); + if (Selection->Handle == NULL) { // // If target Hii Handle not found, exit @@ -1958,9 +1967,6 @@ ProcessGotoOpCode ( return Status; } - FreePool (StringPtr); - FreePool (DevicePath); - CopyMem (&Selection->FormSetGuid,&Statement->HiiValue.Value.ref.FormSetGuid, sizeof (EFI_GUID)); Selection->FormId = Statement->HiiValue.Value.ref.FormId; Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId; -- cgit v1.2.3