From f274810c8d6e9178f726d5c8381b5b7d2c09426a Mon Sep 17 00:00:00 2001 From: qwang12 Date: Wed, 30 Apr 2008 06:35:24 +0000 Subject: [PATCH] Add in code to support the deletion of opcode from a form. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5153 6f19259b-4bc3-4df7-8a09-765794883524 --- .../FrameworkHiiToUefiHiiThunk/Forms.c | 56 ++++++++++++------- .../OpcodeCreation.c | 2 +- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c index 95bd618bb6..ee4e2ac988 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c @@ -435,32 +435,50 @@ Returns: } } - if (Data->DataCount != 0) { - if (HandleMapEntry->IsPackageListWithOnlyStringPackages) { - UefiHiiHandle = TagGuidToUefiIfrHiiHandle (Private, &HandleMapEntry->TagGuid); - - if (UefiHiiHandle == NULL) { - return EFI_INVALID_PARAMETER; - } - } else { - UefiHiiHandle = HandleMapEntry->UefiHiiHandle; + if (HandleMapEntry->IsPackageListWithOnlyStringPackages) { + UefiHiiHandle = TagGuidToUefiIfrHiiHandle (Private, &HandleMapEntry->TagGuid); + + if (UefiHiiHandle == NULL) { + return EFI_INVALID_PARAMETER; } + } else { + UefiHiiHandle = HandleMapEntry->UefiHiiHandle; + } - UefiHiiUpdateData = NULL; + UefiHiiUpdateData = NULL; + + if (AddData) { + if (Data->DataCount != 0) { + + Status = ThunkFrameworkUpdateDataToUefiUpdateData (Data, AddData, &UefiHiiUpdateData); + ASSERT_EFI_ERROR (Status); + + Status = ThunkLocateFormId (UefiHiiHandle, Label, &FormsetGuid, &FormId); + ASSERT_EFI_ERROR (Status); + + Status = IfrLibUpdateForm (UefiHiiHandle, &FormsetGuid, FormId, Label, AddData, UefiHiiUpdateData); + ASSERT_EFI_ERROR (Status); + + } else { + ASSERT (FALSE); + return EFI_INVALID_PARAMETER; + } - Status = ThunkFrameworkUpdateDataToUefiUpdateData (Data, AddData, &UefiHiiUpdateData); - ASSERT_EFI_ERROR (Status); - + } else { Status = ThunkLocateFormId (UefiHiiHandle, Label, &FormsetGuid, &FormId); ASSERT_EFI_ERROR (Status); - Status = IfrLibUpdateForm (UefiHiiHandle, &FormsetGuid, FormId, Label, AddData, UefiHiiUpdateData); - ASSERT_EFI_ERROR (Status); + // + // Delete Opcode starting from Labe in FormId found + // - if (UefiHiiUpdateData != NULL) { - SafeFreePool (UefiHiiUpdateData->Data); - SafeFreePool (UefiHiiUpdateData); - } + Status = IfrLibUpdateForm (UefiHiiHandle, &FormsetGuid, FormId, Label, FALSE, NULL); + ASSERT_EFI_ERROR (Status); + } + + if (UefiHiiUpdateData != NULL) { + SafeFreePool (UefiHiiUpdateData->Data); + SafeFreePool (UefiHiiUpdateData); } return Status; diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c index fb6169b29c..391e698d1e 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c @@ -595,7 +595,7 @@ F2UCreateNumericOpCode ( } // - // We need to create a default + // We need to create a default value. // if (FwOpcode->Default != 0) { ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));