Smbios driver wrong compute the offset when updating string for given handle.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9556 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2009-12-11 11:58:27 +00:00
parent ed79462bee
commit f8ee20c982
1 changed files with 11 additions and 8 deletions

View File

@ -141,7 +141,6 @@ GetSmbiosStructureSize (
// //
while (*CharInStr != 0 || *(CharInStr+1) != 0) { while (*CharInStr != 0 || *(CharInStr+1) != 0) {
if (*CharInStr == 0) { if (*CharInStr == 0) {
*NumberOfStrings += 1;
*Size += 1; *Size += 1;
CharInStr++; CharInStr++;
} }
@ -160,12 +159,9 @@ GetSmbiosStructureSize (
// //
CharInStr += StrLen; CharInStr += StrLen;
*Size += StrLen; *Size += StrLen;
}
if (*NumberOfStrings > 0) {
*NumberOfStrings += 1; *NumberOfStrings += 1;
} }
// //
// count ending two zeros. // count ending two zeros.
// //
@ -511,6 +507,11 @@ SmbiosUpdateString (
} }
} }
if (*StrStart == 0) {
StrStart ++;
TargetStrOffset ++;
}
// //
// Now we get the string target // Now we get the string target
// //
@ -548,9 +549,11 @@ SmbiosUpdateString (
// //
// Copy smbios structure and optional strings. // Copy smbios structure and optional strings.
// //
CopyMem (Raw, SmbiosEntry->RecordHeader + 1, sizeof(EFI_SMBIOS_TABLE_HEADER) + TargetStrOffset); CopyMem (Raw, SmbiosEntry->RecordHeader + 1, Record->Length + TargetStrOffset);
CopyMem ((VOID*)((UINTN)Raw + sizeof(EFI_SMBIOS_TABLE_HEADER) + TargetStrOffset), String, InputStrLen + 1); CopyMem ((VOID*)((UINTN)Raw + Record->Length + TargetStrOffset), String, InputStrLen + 1);
AsciiStrCpy((CHAR8*)((UINTN)Raw + sizeof(EFI_SMBIOS_TABLE_HEADER) + TargetStrOffset + InputStrLen + 1), (CHAR8*)Record + Record->Length + TargetStrOffset + TargetStrLen + 1); CopyMem ((CHAR8*)((UINTN)Raw + Record->Length + TargetStrOffset + InputStrLen + 1),
(CHAR8*)Record + Record->Length + TargetStrOffset + TargetStrLen + 1,
SmbiosEntry->RecordHeader->RecordSize - sizeof (EFI_SMBIOS_RECORD_HEADER) - Record->Length - TargetStrOffset - TargetStrLen - 1);
// //
// Insert new record // Insert new record