/** @file\r
HII Library implementation that uses DXE protocols and services.\r
\r
- Copyright (c) 2006 - 2010, Intel Corporation<BR>\r
- All rights reserved. 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include "InternalHiiLib.h"\r
\r
/**\r
- This function create a new string in String Package or updates an existing \r
+ This function create a new string in String Package or updates an existing\r
string in a String Package. If StringId is 0, then a new string is added to\r
a String Package. If StringId is not zero, then a string in String Package is\r
updated. If SupportedLanguages is NULL, then the string is added or updated\r
for all the languages that the String Package supports. If SupportedLanguages\r
- is not NULL, then the string is added or updated for the set of languages \r
+ is not NULL, then the string is added or updated for the set of languages\r
specified by SupportedLanguages.\r
- \r
+\r
If HiiHandle is NULL, then ASSERT().\r
If String is NULL, then ASSERT().\r
\r
- @param[in] HiiHandle A handle that was previously registered in the \r
+ @param[in] HiiHandle A handle that was previously registered in the\r
HII Database.\r
- @param[in] StringId If zero, then a new string is created in the \r
- String Package associated with HiiHandle. If \r
- non-zero, then the string specified by StringId \r
- is updated in the String Package associated \r
- with HiiHandle. \r
- @param[in] String A pointer to the Null-terminated Unicode string \r
- to add or update in the String Package associated \r
+ @param[in] StringId If zero, then a new string is created in the\r
+ String Package associated with HiiHandle. If\r
+ non-zero, then the string specified by StringId\r
+ is updated in the String Package associated\r
with HiiHandle.\r
- @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of \r
- language codes. If this parameter is NULL, then \r
- String is added or updated in the String Package \r
- associated with HiiHandle for all the languages \r
- that the String Package supports. If this \r
- parameter is not NULL, then then String is added \r
- or updated in the String Package associated with \r
- HiiHandle for the set oflanguages specified by \r
- SupportedLanguages. The format of \r
- SupportedLanguages must follow the language \r
+ @param[in] String A pointer to the Null-terminated Unicode string\r
+ to add or update in the String Package associated\r
+ with HiiHandle.\r
+ @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string of\r
+ language codes. If this parameter is NULL, then\r
+ String is added or updated in the String Package\r
+ associated with HiiHandle for all the languages\r
+ that the String Package supports. If this\r
+ parameter is not NULL, then then String is added\r
+ or updated in the String Package associated with\r
+ HiiHandle for the set oflanguages specified by\r
+ SupportedLanguages. The format of\r
+ SupportedLanguages must follow the language\r
format assumed the HII Database.\r
\r
@retval 0 The string could not be added or updated in the String Package.\r
Language = Supported;\r
\r
//\r
- // Search for the next language seperator and replace it with a Null-terminator\r
+ // Search for the next language separator and replace it with a Null-terminator\r
//\r
for (; *Supported != 0 && *Supported != ';'; Supported++);\r
if (*Supported != 0) {\r
*(Supported++) = '\0';\r
}\r
\r
+ if ((SupportedLanguages == NULL) && AsciiStrnCmp (Language, UEFI_CONFIG_LANG, AsciiStrLen (UEFI_CONFIG_LANG)) == 0) {\r
+ //\r
+ // Skip string package used for keyword protocol.\r
+ //\r
+ continue;\r
+ }\r
+\r
//\r
// If StringId is 0, then call NewString(). Otherwise, call SetString()\r
//\r
\r
\r
/**\r
- Retrieves a string from a string package names by GUID in a specific language. \r
- If the language is not specified, then a string from a string package in the \r
- current platform language is retrieved. If the string can not be retrieved \r
- using the specified language or the current platform language, then the string \r
- is retrieved from the string package in the first language the string package \r
- supports. The returned string is allocated using AllocatePool(). The caller \r
+ Retrieves a string from a string package names by GUID in a specific language.\r
+ If the language is not specified, then a string from a string package in the\r
+ current platform language is retrieved. If the string can not be retrieved\r
+ using the specified language or the current platform language, then the string\r
+ is retrieved from the string package in the first language the string package\r
+ supports. The returned string is allocated using AllocatePool(). The caller\r
is responsible for freeing the allocated buffer using FreePool().\r
- \r
+\r
If PackageListGuid is NULL, then ASSERT().\r
If StringId is 0, then ASSERT.\r
\r
- @param[in] PackageListGuid The GUID of a package list that was previously \r
+ @param[in] PackageListGuid The GUID of a package list that was previously\r
registered in the HII Database.\r
- @param[in] StringId The identifier of the string to retrieved from the \r
+ @param[in] StringId The identifier of the string to retrieved from the\r
string package associated with PackageListGuid.\r
- @param[in] Language The language of the string to retrieve. If this \r
- parameter is NULL, then the current platform \r
- language is used. The format of Language must \r
+ @param[in] Language The language of the string to retrieve. If this\r
+ parameter is NULL, then the current platform\r
+ language is used. The format of Language must\r
follow the language format assumed the HII Database.\r
\r
@retval NULL The package list specified by PackageListGuid is not present in the\r
\r
/**\r
Retrieves a string from a string package in a specific language. If the language\r
- is not specified, then a string from a string package in the current platform \r
- language is retrieved. If the string can not be retrieved using the specified \r
- language or the current platform language, then the string is retrieved from \r
- the string package in the first language the string package supports. The \r
- returned string is allocated using AllocatePool(). The caller is responsible \r
+ is not specified, then a string from a string package in the current platform\r
+ language is retrieved. If the string can not be retrieved using the specified\r
+ language or the current platform language, then the string is retrieved from\r
+ the string package in the first language the string package supports. The\r
+ returned string is allocated using AllocatePool(). The caller is responsible\r
for freeing the allocated buffer using FreePool().\r
- \r
+\r
If HiiHandle is NULL, then ASSERT().\r
If StringId is 0, then ASSET.\r
\r
@param[in] HiiHandle A handle that was previously registered in the HII Database.\r
- @param[in] StringId The identifier of the string to retrieved from the string \r
+ @param[in] StringId The identifier of the string to retrieved from the string\r
package associated with HiiHandle.\r
- @param[in] Language The language of the string to retrieve. If this parameter \r
- is NULL, then the current platform language is used. The \r
- format of Language must follow the language format assumed \r
+ @param[in] Language The language of the string to retrieve. If this parameter\r
+ is NULL, then the current platform language is used. The\r
+ format of Language must follow the language format assumed\r
the HII Database.\r
\r
@retval NULL The string specified by StringId is not present in the string package.\r
\r
//\r
// Initialize all allocated buffers to NULL\r
- // \r
+ //\r
SupportedLanguages = NULL;\r
PlatformLanguage = NULL;\r
BestLanguage = NULL;\r
//\r
// Get the current platform language setting\r
//\r
- PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");\r
+ GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);\r
\r
//\r
- // If Languag is NULL, then set it to an empty string, so it will be \r
+ // If Languag is NULL, then set it to an empty string, so it will be\r
// skipped by GetBestLanguage()\r
//\r
if (Language == NULL) {\r
// Get the best matching language from SupportedLanguages\r
//\r
BestLanguage = GetBestLanguage (\r
- SupportedLanguages, \r
+ SupportedLanguages,\r
FALSE, // RFC 4646 mode\r
- Language, // Highest priority \r
+ Language, // Highest priority\r
PlatformLanguage != NULL ? PlatformLanguage : "", // Next highest priority\r
- SupportedLanguages, // Lowest priority \r
+ SupportedLanguages, // Lowest priority\r
NULL\r
);\r
if (BestLanguage == NULL) {\r
NULL\r
);\r
//\r
- // If GetString() returns EFI_SUCCESS for a zero size, \r
- // then there are no supported languages registered for HiiHandle. If GetString() \r
+ // If GetString() returns EFI_SUCCESS for a zero size,\r
+ // then there are no supported languages registered for HiiHandle. If GetString()\r
// returns an error other than EFI_BUFFER_TOO_SMALL, then HiiHandle is not present\r
// in the HII Database\r
//\r