Implementation for EFI_HII_STRING_PROTOCOL.\r
\r
\r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
@param StringSrc Points to current null-terminated string.\r
@param BufferSize Length of the buffer.\r
\r
- @retval EFI_SUCCESS The string text was outputed successfully.\r
+ @retval EFI_SUCCESS The string text was outputted successfully.\r
@retval EFI_BUFFER_TOO_SMALL Buffer is insufficient to store the found string\r
text. BufferSize is updated to the required buffer\r
size.\r
@param StringSrc Points to current null-terminated string.\r
@param BufferSize Length of the buffer.\r
\r
- @retval EFI_SUCCESS The string text was outputed successfully.\r
+ @retval EFI_SUCCESS The string text was outputted successfully.\r
@retval EFI_BUFFER_TOO_SMALL Buffer is insufficient to store the found string\r
text. BufferSize is updated to the required buffer\r
size.\r
@param StringFontInfo Buffer to record the output font info. It's\r
caller's responsibility to free this buffer.\r
\r
- @retval EFI_SUCCESS The string font is outputed successfully.\r
+ @retval EFI_SUCCESS The string font is outputted successfully.\r
@retval EFI_NOT_FOUND The specified font id does not exist.\r
\r
**/\r
ASSERT (StringPackage->Signature == HII_STRING_PACKAGE_SIGNATURE);\r
\r
CurrentStringId = 1;\r
+ StringSize = 0;\r
\r
if (StringId != (EFI_STRING_ID) (-1) && StringId != 0) {\r
ASSERT (BlockType != NULL && StringBlockAddr != NULL && StringTextOffset != NULL);\r
@param StringBlockAddr Output the block address of found string block. \r
@param FontBlock whether this string block has font info.\r
\r
- @retval EFI_SUCCESS The string font is outputed successfully.\r
+ @retval EFI_SUCCESS The string font is outputted successfully.\r
@retval EFI_OUT_OF_RESOURCES NO resource for the memory to save the new string block.\r
\r
**/\r
StringPackage->StringPkgHdr->StringInfoOffset = HeaderSize;\r
CopyMem (StringPackage->StringPkgHdr->LanguageWindow, mLanguageWindow, 16 * sizeof (CHAR16));\r
StringPackage->StringPkgHdr->LanguageName = 1;\r
- AsciiStrCpy (StringPackage->StringPkgHdr->Language, (CHAR8 *) Language);\r
+ AsciiStrCpyS (StringPackage->StringPkgHdr->Language, (HeaderSize - OFFSET_OF(EFI_HII_STRING_PACKAGE_HDR,Language)) / sizeof (CHAR8), (CHAR8 *) Language);\r
\r
//\r
// Calculate the length of the string blocks, including string block to record\r
FreePool (StringPackage->StringPkgHdr);\r
FreePool (StringPackage);\r
}\r
+ //\r
+ // The contents of HiiDataBase may updated,need to check.\r
+ //\r
+ //\r
+ // Check whether need to get the contents of HiiDataBase.\r
+ // Only after ReadyToBoot to do the export.\r
+ //\r
+ if (gExportAfterReadyToBoot) {\r
+ if (!EFI_ERROR (Status)) {\r
+ HiiGetDatabaseInfo(&Private->HiiDatabase);\r
+ }\r
+ }\r
\r
return Status;\r
}\r
return Status;\r
}\r
PackageListNode->PackageListHdr.PackageLength += StringPackage->StringPkgHdr->Header.Length - OldPackageLen;\r
+ //\r
+ // Check whether need to get the contents of HiiDataBase.\r
+ // Only after ReadyToBoot to do the export.\r
+ //\r
+ if (gExportAfterReadyToBoot) {\r
+ HiiGetDatabaseInfo(&Private->HiiDatabase);\r
+ }\r
return EFI_SUCCESS;\r
}\r
}\r
Link = Link->ForwardLink\r
) {\r
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);\r
- if (AsciiStrnCmp (StringPackage->StringPkgHdr->Language, UEFI_CONFIG_LANG, AsciiStrLen (UEFI_CONFIG_LANG)) == 0) {\r
- //\r
- // Skip string package used for keyword protocol.\r
- //\r
- continue;\r
- }\r
ResultSize += AsciiStrSize (StringPackage->StringPkgHdr->Language);\r
if (ResultSize <= *LanguagesSize) {\r
- AsciiStrCpy (Languages, StringPackage->StringPkgHdr->Language);\r
+ AsciiStrCpyS (Languages, *LanguagesSize / sizeof (CHAR8), StringPackage->StringPkgHdr->Language);\r
Languages += AsciiStrSize (StringPackage->StringPkgHdr->Language);\r
*(Languages - 1) = L';';\r
}\r
\r
ResultSize = AsciiStrSize (Languages);\r
if (ResultSize <= *SecondaryLanguagesSize) {\r
- AsciiStrCpy (SecondaryLanguages, Languages);\r
+ AsciiStrCpyS (SecondaryLanguages, *SecondaryLanguagesSize / sizeof (CHAR8), Languages);\r
} else {\r
*SecondaryLanguagesSize = ResultSize;\r
return EFI_BUFFER_TOO_SMALL;\r
StrLen = AsciiStrSize (Language1);\r
Lan1 = AllocateZeroPool (StrLen);\r
ASSERT (Lan1 != NULL);\r
- AsciiStrCpy(Lan1, Language1);\r
+ AsciiStrCpyS(Lan1, StrLen / sizeof (CHAR8), Language1);\r
AsciiHiiToLower (Lan1);\r
\r
StrLen = AsciiStrSize (Language2);\r
Lan2 = AllocateZeroPool (StrLen);\r
ASSERT (Lan2 != NULL);\r
- AsciiStrCpy(Lan2, Language2);\r
+ AsciiStrCpyS(Lan2, StrLen / sizeof (CHAR8), Language2);\r
AsciiHiiToLower (Lan2);\r
\r
//\r