Update PCD driver to correctly set the HII type PCDs.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9078 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-08-17 02:05:32 +00:00
parent e0d22735b7
commit b13151ffb6
1 changed files with 10 additions and 6 deletions

View File

@ -975,8 +975,10 @@ SetHiiVariable (
VOID *Buffer; VOID *Buffer;
EFI_STATUS Status; EFI_STATUS Status;
UINT32 Attribute; UINT32 Attribute;
UINTN SetSize;
Size = 0; Size = 0;
SetSize = 0;
// //
// Try to get original variable size information. // Try to get original variable size information.
@ -993,9 +995,12 @@ SetHiiVariable (
// //
// Patch new PCD's value to offset in given HII variable. // Patch new PCD's value to offset in given HII variable.
// //
if (Size >= (DataSize + Offset)) {
Buffer = AllocatePool (Size); SetSize = Size;
} else {
SetSize = DataSize + Offset;
}
Buffer = AllocatePool (SetSize);
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
Status = gRT->GetVariable ( Status = gRT->GetVariable (
@ -1014,13 +1019,12 @@ SetHiiVariable (
VariableName, VariableName,
VariableGuid, VariableGuid,
Attribute, Attribute,
Size, SetSize,
Buffer Buffer
); );
FreePool (Buffer); FreePool (Buffer);
return Status; return Status;
} else if (Status == EFI_NOT_FOUND) { } else if (Status == EFI_NOT_FOUND) {
// //
// If variable does not exist, a new variable need to be created. // If variable does not exist, a new variable need to be created.