From d91c7bf9e42e8be23bb67bf7c189348b4ec11797 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Fri, 17 Apr 2009 05:28:31 +0000 Subject: Update HiiLib to copy all IfrOpcode, not Opcode by Opcode. Update DriverSampleDxe to use new UEFI 2.1 classguid git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8114 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index e1d8a64730..d36828a115 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -2191,8 +2191,7 @@ InternalHiiUpdateFormPackageData ( BOOLEAN GetFormSet; BOOLEAN GetForm; BOOLEAN Updated; - EFI_IFR_OP_HEADER *AddOpCode; - UINT32 UpdatePackageLength; + UINTN UpdatePackageLength; CopyMem (TempPackage, Package, sizeof (EFI_HII_PACKAGE_HEADER)); UpdatePackageLength = sizeof (EFI_HII_PACKAGE_HEADER); @@ -2230,7 +2229,7 @@ InternalHiiUpdateFormPackageData ( // // The matched Form is found, and Update data in this form // - if (GetFormSet && GetForm && !Updated) { + if (GetFormSet && GetForm) { UpdateIfrOpHdr = (EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer; if ((UpdateIfrOpHdr->Length == IfrOpHdr->Length) && \ (CompareMem (IfrOpHdr, UpdateIfrOpHdr, UpdateIfrOpHdr->Length) == 0)) { @@ -2263,22 +2262,14 @@ InternalHiiUpdateFormPackageData ( return EFI_NOT_FOUND; } } + // // Insert the updated data // - UpdateIfrOpHdr = (EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer; - AddSize = UpdateIfrOpHdr->Length; - AddOpCode = (EFI_IFR_OP_HEADER *) (OpCodeBufferStart->Buffer + AddSize); - while (AddSize < OpCodeBufferStart->Position) { - CopyMem (BufferPos, AddOpCode, AddOpCode->Length); - BufferPos += AddOpCode->Length; - UpdatePackageLength += AddOpCode->Length; - - AddSize += AddOpCode->Length; - AddOpCode = (EFI_IFR_OP_HEADER *) (OpCodeBufferStart->Buffer + AddSize); - } - - ASSERT (AddSize == OpCodeBufferStart->Position); + AddSize = ((EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer)->Length; + CopyMem (BufferPos, OpCodeBufferStart->Buffer + AddSize, OpCodeBufferStart->Position - AddSize); + BufferPos += OpCodeBufferStart->Position - AddSize; + UpdatePackageLength += OpCodeBufferStart->Position - AddSize; if (OpCodeBufferEnd != NULL) { // @@ -2288,10 +2279,19 @@ InternalHiiUpdateFormPackageData ( BufferPos += IfrOpHdr->Length; UpdatePackageLength += IfrOpHdr->Length; } + + // + // Copy the left package data. + // + Offset += IfrOpHdr->Length; + CopyMem (BufferPos, (UINT8 *) Package + Offset, PackageHeader.Length - Offset); + UpdatePackageLength += PackageHeader.Length - Offset; + // // Set update flag // Updated = TRUE; + break; } } @@ -2311,7 +2311,7 @@ InternalHiiUpdateFormPackageData ( // // Update the package length. // - PackageHeader.Length = UpdatePackageLength; + PackageHeader.Length = (UINT32) UpdatePackageLength; CopyMem (TempPackage, &PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER)); return EFI_SUCCESS; -- cgit v1.2.3