/** @file\r
Implementation of interfaces function for EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL.\r
\r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<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
-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) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
@param NextString string follow the possible PathHdr string.\r
\r
@retval EFI_INVALID_PARAMETER The device path is not valid or the incoming parameter is invalid.\r
- @retval EFI_OUT_OF_RESOURCES Lake of resources to store neccesary structures.\r
+ @retval EFI_OUT_OF_RESOURCES Lake of resources to store necessary structures.\r
@retval EFI_SUCCESS The device path is retrieved and translated to binary format.\r
The Input string not include PathHdr section.\r
\r
if (((Length + 1) / 2) < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
//\r
// The data in <PathHdr> is encoded as hex UNICODE %02x bytes in the same order\r
// as the device path resides in RAM memory.\r
if (DevicePathBuffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- \r
+\r
//\r
// Convert DevicePath\r
//\r
DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);\r
}\r
}\r
- \r
+\r
//\r
// Validate DevicePath\r
//\r
)\r
{\r
CHAR16 *TmpPtr;\r
+ UINTN NameSpaceSize;\r
\r
ASSERT (NameSpace != NULL);\r
\r
\r
TmpPtr = StrStr (String, L"&");\r
if (TmpPtr != NULL) {\r
- *TmpPtr = 0; \r
+ *TmpPtr = 0;\r
}\r
if (NextString != NULL) {\r
*NextString = String + StrLen (String);\r
// Input NameSpace is unicode string. The language in String package is ascii string.\r
// Here will convert the unicode string to ascii and save it.\r
//\r
- *NameSpace = AllocatePool (StrLen (String) + 1);\r
+ NameSpaceSize = StrLen (String) + 1;\r
+ *NameSpace = AllocatePool (NameSpaceSize);\r
if (*NameSpace == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- UnicodeStrToAsciiStr (String, *NameSpace);\r
+ UnicodeStrToAsciiStrS (String, *NameSpace, NameSpaceSize);\r
\r
if (TmpPtr != NULL) {\r
- *TmpPtr = L'&'; \r
+ *TmpPtr = L'&';\r
}\r
\r
return EFI_SUCCESS;\r
\r
@param String KeywordRequestformat string.\r
@param Keyword return the extract keyword string.\r
- @param NextString return the next string follow this keyword sectin.\r
+ @param NextString return the next string follow this keyword section.\r
\r
@retval EFI_SUCCESS Success to get the keyword string.\r
- @retval EFI_INVALID_PARAMETER Parsr the input string return error.\r
+ @retval EFI_INVALID_PARAMETER Parse the input string return error.\r
\r
**/\r
EFI_STATUS\r
EFI_STRING TmpPtr;\r
\r
ASSERT ((Keyword != NULL) && (NextString != NULL));\r
- \r
+\r
TmpPtr = NULL;\r
\r
//\r
}\r
\r
String += StrLen (L"KEYWORD=");\r
- \r
+\r
TmpPtr = StrStr (String, L"&");\r
if (TmpPtr != NULL) {\r
- *TmpPtr = 0; \r
+ *TmpPtr = 0;\r
}\r
*NextString = String + StrLen (String);\r
\r
if (TmpPtr != NULL) {\r
*TmpPtr = L'&';\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
@param String KeywordRequestformat string.\r
@param Value return the extract value string.\r
- @param NextString return the next string follow this keyword sectin.\r
+ @param NextString return the next string follow this keyword section.\r
\r
@retval EFI_SUCCESS Success to get the keyword string.\r
- @retval EFI_INVALID_PARAMETER Parsr the input string return error.\r
+ @retval EFI_INVALID_PARAMETER Parse the input string return error.\r
\r
**/\r
EFI_STATUS\r
}\r
\r
String += StrLen (L"VALUE=");\r
- \r
+\r
TmpPtr = StrStr (String, L"&");\r
if (TmpPtr != NULL) {\r
- *TmpPtr = 0; \r
+ *TmpPtr = 0;\r
}\r
*NextString = String + StrLen (String);\r
\r
if (TmpPtr != NULL) {\r
*TmpPtr = L'&';\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
@param String KeywordRequestformat string.\r
@param FilterFlags return the filter condition.\r
- @param NextString return the next string follow this keyword sectin.\r
+ @param NextString return the next string follow this keyword section.\r
\r
@retval EFI_SUCCESS Success to get the keyword string.\r
- @retval EFI_INVALID_PARAMETER Parsr the input string return error.\r
+ @retval EFI_INVALID_PARAMETER Parse the input string return error.\r
\r
**/\r
BOOLEAN\r
{\r
CHAR16 *PathPtr;\r
CHAR16 *KeywordPtr;\r
- BOOLEAN RetVal; \r
+ BOOLEAN RetVal;\r
\r
ASSERT ((FilterFlags != NULL) && (NextString != NULL));\r
\r
*NextString = NULL;\r
return FALSE;\r
}\r
- \r
+\r
*FilterFlags = 0;\r
RetVal = TRUE;\r
\r
String = KeywordPtr;\r
} else {\r
//\r
- // Only has paltform defined filter section, just skip it.\r
+ // Only has platform defined filter section, just skip it.\r
//\r
String += StrLen (String);\r
}\r
\r
This is a internal function.\r
\r
- @param OpCodeData The questin binary ifr data.\r
+ @param OpCodeData The question binary ifr data.\r
@param KeywordRequest KeywordRequestformat string.\r
- @param NextString return the next string follow this keyword sectin.\r
+ @param NextString return the next string follow this keyword section.\r
@param ReadOnly Return whether this question is read only.\r
\r
@retval KEYWORD_HANDLER_NO_ERROR Success validate.\r
\r
//\r
// Get ReadOnly flag from Question.\r
- // \r
+ //\r
*ReadOnly = ExtractReadOnlyFromOpCode(OpCodeData);\r
\r
while (ExtractFilter (StringPtr, &FilterFlags, &NextFilter)) {\r
//\r
StringPtr = NextFilter;\r
}\r
- \r
+\r
Done:\r
//\r
// The current filter which is processing.\r
}\r
\r
/**\r
- Calculate the size of StringSrc and output it. Also copy string text from src \r
+ Calculate the size of StringSrc and output it. Also copy string text from src\r
to dest.\r
\r
This is a internal function.\r
\r
@param StringSrc Points to current null-terminated string.\r
@param BufferSize Length of the buffer.\r
- @param StringDest Buffer to store the string text. \r
+ @param StringDest Buffer to store the string text.\r
\r
- @retval EFI_SUCCESS The string text was outputed successfully.\r
+ @retval EFI_SUCCESS The string text was outputted successfully.\r
@retval EFI_OUT_OF_RESOURCES Out of resource.\r
\r
**/\r
if (*StringDest == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- \r
+\r
CopyMem (*StringDest, StringSrc, StringSize);\r
\r
*BufferSize = StringSize;\r
UINTN StringSize;\r
CHAR16 *String;\r
CHAR8 *AsciiKeywordValue;\r
+ UINTN KeywordValueSize;\r
EFI_STATUS Status;\r
\r
ASSERT (StringPackage != NULL && KeywordValue != NULL && StringId != NULL);\r
//\r
// Make a ascii keyword value for later use.\r
//\r
- AsciiKeywordValue = AllocatePool (StrLen (KeywordValue) + 1);\r
+ KeywordValueSize = StrLen (KeywordValue) + 1;\r
+ AsciiKeywordValue = AllocatePool (KeywordValueSize);\r
if (AsciiKeywordValue == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- UnicodeStrToAsciiStr(KeywordValue, AsciiKeywordValue);\r
+ UnicodeStrToAsciiStrS (KeywordValue, AsciiKeywordValue, KeywordValueSize);\r
\r
while (*BlockHdr != EFI_HII_SIBT_END) {\r
switch (*BlockHdr) {\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
- \r
+ ASSERT (String != NULL);\r
if (StrCmp(KeywordValue, String) == 0) {\r
*StringId = CurrentStringId;\r
goto Done;\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
- \r
+ ASSERT (String != NULL);\r
if (StrCmp(KeywordValue, String) == 0) {\r
*StringId = CurrentStringId;\r
goto Done;\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
-\r
+ ASSERT (String != NULL);\r
BlockSize += StringSize;\r
if (StrCmp(KeywordValue, String) == 0) {\r
*StringId = CurrentStringId;\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
-\r
+ ASSERT (String != NULL);\r
BlockSize += StringSize;\r
if (StrCmp(KeywordValue, String) == 0) {\r
*StringId = CurrentStringId;\r
case EFI_HII_SIBT_STRING_SCSU:\r
Offset = sizeof (EFI_HII_STRING_BLOCK);\r
StringTextPtr = BlockHdr + Offset;\r
- \r
+\r
if (FindString) {\r
- *KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));\r
+ StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);\r
+ *KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));\r
if (*KeywordValue == NULL) {\r
return 0;\r
}\r
- AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);\r
+ AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);\r
return CurrentStringId;\r
} else if (CurrentStringId == StringId) {\r
FindString = TRUE;\r
case EFI_HII_SIBT_STRING_SCSU_FONT:\r
Offset = sizeof (EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK) - sizeof (UINT8);\r
StringTextPtr = BlockHdr + Offset;\r
- \r
+\r
if (FindString) {\r
- *KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));\r
+ StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);\r
+ *KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));\r
if (*KeywordValue == NULL) {\r
return 0;\r
}\r
- AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);\r
+ AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);\r
return CurrentStringId;\r
} else if (CurrentStringId == StringId) {\r
FindString = TRUE;\r
\r
for (Index = 0; Index < StringCount; Index++) {\r
if (FindString) {\r
- *KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));\r
+ StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);\r
+ *KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));\r
if (*KeywordValue == NULL) {\r
return 0;\r
}\r
- AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);\r
+ AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);\r
return CurrentStringId;\r
} else if (CurrentStringId == StringId) {\r
FindString = TRUE;\r
\r
for (Index = 0; Index < StringCount; Index++) {\r
if (FindString) {\r
- *KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));\r
+ StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);\r
+ *KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));\r
if (*KeywordValue == NULL) {\r
return 0;\r
}\r
- AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);\r
+ AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);\r
return CurrentStringId;\r
} else if (CurrentStringId == StringId) {\r
FindString = TRUE;\r
BlockSize += Offset;\r
CopyMem (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));\r
for (Index = 0; Index < StringCount; Index++) {\r
- GetUnicodeStringTextAndSize (StringTextPtr, &StringSize, &String); \r
+ GetUnicodeStringTextAndSize (StringTextPtr, &StringSize, &String);\r
\r
if (FindString) {\r
*KeywordValue = String;\r
@param KeywordValue Keyword value.\r
@param StringId String Id for this keyword.\r
\r
- @retval KEYWORD_HANDLER_NO_ERROR Get String id succes.\r
+ @retval KEYWORD_HANDLER_NO_ERROR Get String id successfully.\r
@retval KEYWORD_HANDLER_KEYWORD_NOT_FOUND Not found the string id in the string package.\r
@retval KEYWORD_HANDLER_NAMESPACE_ID_NOT_FOUND Not found the string package for this namespace.\r
@retval KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR Out of resource error.\r
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);\r
\r
if (AsciiStrnCmp(Name, StringPackage->StringPkgHdr->Language, AsciiStrLen (Name)) == 0) {\r
- Status = GetStringIdFromString (StringPackage, KeywordValue, StringId); \r
+ Status = GetStringIdFromString (StringPackage, KeywordValue, StringId);\r
if (EFI_ERROR (Status)) {\r
- RetVal = KEYWORD_HANDLER_KEYWORD_NOT_FOUND;\r
- continue;\r
+ return KEYWORD_HANDLER_KEYWORD_NOT_FOUND;\r
} else {\r
if (*NameSpace == NULL) {\r
*NameSpace = AllocateCopyPool (AsciiStrSize (StringPackage->StringPkgHdr->Language), StringPackage->StringPkgHdr->Language);\r
@retval the opcode for the question.\r
\r
**/\r
-UINT8 * \r
+UINT8 *\r
FindQuestionFromStringId (\r
IN HII_IFR_PACKAGE_INSTANCE *FormPackage,\r
- IN EFI_STRING_ID KeywordStrId \r
+ IN EFI_STRING_ID KeywordStrId\r
)\r
{\r
UINT8 *OpCodeData;\r
@retval the width info for one question.\r
\r
**/\r
-UINT16 \r
+UINT16\r
GetWidth (\r
IN UINT8 *OpCodeData\r
)\r
switch (((EFI_IFR_ONE_OF *) OpCodeData)->Flags & EFI_IFR_NUMERIC_SIZE) {\r
case EFI_IFR_NUMERIC_SIZE_1:\r
return (UINT16) sizeof (UINT8);\r
- \r
+\r
case EFI_IFR_NUMERIC_SIZE_2:\r
return (UINT16) sizeof (UINT16);\r
- \r
+\r
case EFI_IFR_NUMERIC_SIZE_4:\r
return (UINT16) sizeof (UINT32);\r
- \r
+\r
case EFI_IFR_NUMERIC_SIZE_8:\r
return (UINT16) sizeof (UINT64);\r
- \r
+\r
default:\r
ASSERT (FALSE);\r
return 0;\r
switch (((EFI_IFR_ONE_OF_OPTION *) NextOpCodeData)->Type) {\r
case EFI_IFR_TYPE_NUM_SIZE_8:\r
return (UINT16) sizeof (UINT8) * ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers;\r
- \r
+\r
case EFI_IFR_TYPE_NUM_SIZE_16:\r
return (UINT16) sizeof (UINT16) * ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers ;\r
- \r
+\r
case EFI_IFR_TYPE_NUM_SIZE_32:\r
return (UINT16) sizeof (UINT32) * ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers;\r
- \r
+\r
case EFI_IFR_TYPE_NUM_SIZE_64:\r
return (UINT16) sizeof (UINT64) * ((EFI_IFR_ORDERED_LIST *) OpCodeData)->MaxContainers;\r
- \r
+\r
default:\r
ASSERT (FALSE);\r
return 0;\r
\r
case EFI_IFR_CHECKBOX_OP:\r
return (UINT16) sizeof (BOOLEAN);\r
- \r
+\r
case EFI_IFR_PASSWORD_OP:\r
+ return (UINT16)((UINTN) ((EFI_IFR_PASSWORD *) OpCodeData)->MaxSize * sizeof (CHAR16));\r
+\r
case EFI_IFR_STRING_OP:\r
return (UINT16)((UINTN) ((EFI_IFR_STRING *) OpCodeData)->MaxSize * sizeof (CHAR16));\r
\r
}\r
\r
/**\r
- Converts all hex dtring characters in range ['A'..'F'] to ['a'..'f'] for \r
+ Converts all hex string characters in range ['A'..'F'] to ['a'..'f'] for\r
hex digits that appear between a '=' and a '&' in a config string.\r
\r
If ConfigString is NULL, then ASSERT().\r
\r
/**\r
Allocates and returns a Null-terminated Unicode <ConfigHdr> string.\r
- \r
+\r
The format of a <ConfigHdr> is as follows:\r
\r
GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null>\r
\r
- @param[in] OpCodeData The opcode for the storage. \r
+ @param[in] OpCodeData The opcode for the storage.\r
@param[in] DriverHandle The driver handle which supports a Device Path Protocol\r
that is the routing information PATH. Each byte of\r
the Device Path associated with DriverHandle is converted\r
- to a 2 Unicode character hexidecimal string.\r
+ to a 2 Unicode character hexadecimal string.\r
\r
@retval NULL DriverHandle does not support the Device Path Protocol.\r
@retval Other A pointer to the Null-terminate Unicode <ConfigHdr> string\r
UINT8 *Buffer;\r
CHAR16 *Name;\r
CHAR8 *AsciiName;\r
+ UINTN NameSize;\r
EFI_GUID *Guid;\r
UINTN MaxLen;\r
\r
Guid = (EFI_GUID *)(UINTN *)&((EFI_IFR_VARSTORE *) OpCodeData)->Guid;\r
AsciiName = (CHAR8 *) ((EFI_IFR_VARSTORE *) OpCodeData)->Name;\r
break;\r
- \r
+\r
case EFI_IFR_VARSTORE_NAME_VALUE_OP:\r
Guid = (EFI_GUID *)(UINTN *)&((EFI_IFR_VARSTORE_NAME_VALUE *) OpCodeData)->Guid;\r
AsciiName = NULL;\r
break;\r
- \r
+\r
case EFI_IFR_VARSTORE_EFI_OP:\r
Guid = (EFI_GUID *)(UINTN *)&((EFI_IFR_VARSTORE_EFI *) OpCodeData)->Guid;\r
AsciiName = (CHAR8 *) ((EFI_IFR_VARSTORE_EFI *) OpCodeData)->Name;\r
break;\r
- \r
+\r
default:\r
ASSERT (FALSE);\r
Guid = NULL;\r
}\r
\r
if (AsciiName != NULL) {\r
- Name = AllocateZeroPool (AsciiStrSize (AsciiName) * 2);\r
+ NameSize = AsciiStrSize (AsciiName);\r
+ Name = AllocateZeroPool (NameSize * sizeof (CHAR16));\r
ASSERT (Name != NULL);\r
- AsciiStrToUnicodeStr(AsciiName, Name);\r
+ AsciiStrToUnicodeStrS (AsciiName, Name, NameSize);\r
} else {\r
Name = NULL;\r
}\r
\r
//\r
- // Compute the length of Name in Unicode characters. \r
+ // Compute the length of Name in Unicode characters.\r
// If Name is NULL, then the length is 0.\r
//\r
NameLength = 0;\r
// Append Guid converted to <HexCh>32\r
//\r
for (Index = 0, Buffer = (UINT8 *)Guid; Index < sizeof (EFI_GUID); Index++) {\r
- String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(Buffer++), 2);\r
+ UnicodeValueToStringS (\r
+ String,\r
+ MaxLen * sizeof (CHAR16) - ((UINTN)String - (UINTN)ReturnString),\r
+ PREFIX_ZERO | RADIX_HEX,\r
+ *(Buffer++),\r
+ 2\r
+ );\r
+ String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));\r
}\r
}\r
- \r
+\r
//\r
// Append L"&NAME="\r
//\r
- StrCpyS (String, MaxLen, L"&NAME=");\r
+ StrCatS (ReturnString, MaxLen, L"&NAME=");\r
String += StrLen (String);\r
\r
if (Name != NULL) {\r
// Append Name converted to <Char>NameLength\r
//\r
for (; *Name != L'\0'; Name++) {\r
- String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *Name, 4);\r
+ UnicodeValueToStringS (\r
+ String,\r
+ MaxLen * sizeof (CHAR16) - ((UINTN)String - (UINTN)ReturnString),\r
+ PREFIX_ZERO | RADIX_HEX,\r
+ *Name,\r
+ 4\r
+ );\r
+ String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));\r
}\r
}\r
\r
//\r
// Append L"&PATH="\r
//\r
- StrCpyS (String, MaxLen, L"&PATH=");\r
+ StrCatS (ReturnString, MaxLen, L"&PATH=");\r
String += StrLen (String);\r
\r
//\r
// Append the device path associated with DriverHandle converted to <HexChar>DevicePathSize\r
//\r
for (Index = 0, Buffer = (UINT8 *)DevicePath; Index < DevicePathSize; Index++) {\r
- String += UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(Buffer++), 2);\r
+ UnicodeValueToStringS (\r
+ String,\r
+ MaxLen * sizeof (CHAR16) - ((UINTN)String - (UINTN)ReturnString),\r
+ PREFIX_ZERO | RADIX_HEX,\r
+ *(Buffer++),\r
+ 2\r
+ );\r
+ String += StrnLenS (String, MaxLen - ((UINTN)String - (UINTN)ReturnString) / sizeof (CHAR16));\r
}\r
\r
//\r
ConstructRequestElement (\r
IN CHAR16 *Name,\r
IN UINT16 Offset,\r
- IN UINT16 Width \r
+ IN UINT16 Width\r
)\r
{\r
CHAR16 *StringPtr;\r
UINTN Length;\r
- \r
+\r
if (Name != NULL) {\r
//\r
// Add <BlockName> length for each Name\r
// Append OFFSET=XXXX&WIDTH=YYYY\0\r
//\r
UnicodeSPrint (\r
- StringPtr, \r
- (7 + 4 + 7 + 4 + 1) * sizeof (CHAR16), \r
- L"OFFSET=%04X&WIDTH=%04X", \r
- Offset, \r
+ StringPtr,\r
+ (7 + 4 + 7 + 4 + 1) * sizeof (CHAR16),\r
+ L"OFFSET=%04X&WIDTH=%04X",\r
+ Offset,\r
Width\r
);\r
}\r
\r
Name = NULL;\r
BestLanguage = NULL;\r
- PlatformLanguage = NULL; \r
+ PlatformLanguage = NULL;\r
SupportedLanguages = NULL;\r
\r
GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);\r
// Get the best matching language from SupportedLanguages\r
//\r
BestLanguage = GetBestLanguage (\r
- SupportedLanguages, \r
+ SupportedLanguages,\r
FALSE, // RFC 4646 mode\r
PlatformLanguage != NULL ? PlatformLanguage : "", // Highest priority\r
- SupportedLanguages, // Lowest priority \r
+ SupportedLanguages, // Lowest priority\r
NULL\r
);\r
if (BestLanguage == NULL) {\r
IN EFI_STRING_ID KeywordStrId,\r
OUT UINT8 **OpCodeData,\r
OUT EFI_STRING *ConfigRequest\r
- ) \r
+ )\r
{\r
LIST_ENTRY *Link;\r
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;\r
// Header->VarStoreId == 0 means no storage for this question.\r
//\r
ASSERT (Header->VarStoreId != 0);\r
- DEBUG ((EFI_D_INFO, "Varstore Id: 0x%x\n", Header->VarStoreId));\r
- \r
+ DEBUG ((DEBUG_INFO, "Varstore Id: 0x%x\n", Header->VarStoreId));\r
+\r
Storage = FindStorageFromVarId (FormPackage, Header->VarStoreId);\r
ASSERT (Storage != NULL);\r
\r
StringPtr = *ConfigRequest;\r
\r
StrCpyS (StringPtr, MaxLen, ConfigHdr);\r
- StringPtr += StrLen (StringPtr);\r
\r
- *StringPtr = L'&';\r
- StringPtr++;\r
+ StrCatS (StringPtr, MaxLen, L"&");\r
\r
- StrCpyS (StringPtr, MaxLen, RequestElement);\r
- StringPtr += StrLen (StringPtr);\r
- *StringPtr = L'\0';\r
+ StrCatS (StringPtr, MaxLen, RequestElement);\r
\r
FreePool (ConfigHdr);\r
FreePool (RequestElement);\r
IN EFI_STRING ValueElement,\r
OUT UINT8 **OpCodeData,\r
OUT EFI_STRING *ConfigResp\r
- ) \r
+ )\r
{\r
LIST_ENTRY *Link;\r
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;\r
// Header->VarStoreId == 0 means no storage for this question.\r
//\r
ASSERT (Header->VarStoreId != 0);\r
- DEBUG ((EFI_D_INFO, "Varstore Id: 0x%x\n", Header->VarStoreId));\r
- \r
+ DEBUG ((DEBUG_INFO, "Varstore Id: 0x%x\n", Header->VarStoreId));\r
+\r
Storage = FindStorageFromVarId (FormPackage, Header->VarStoreId);\r
ASSERT (Storage != NULL);\r
\r
StringPtr = *ConfigResp;\r
\r
StrCpyS (StringPtr, MaxLen, ConfigHdr);\r
- StringPtr += StrLen (StringPtr);\r
\r
- *StringPtr = L'&';\r
- StringPtr++;\r
+ StrCatS (StringPtr, MaxLen, L"&");\r
+\r
+\r
+ StrCatS (StringPtr, MaxLen, RequestElement);\r
\r
- StrCpyS (StringPtr, MaxLen, RequestElement);\r
- StringPtr += StrLen (StringPtr);\r
- \r
- *StringPtr = L'&';\r
- StringPtr++;\r
+ StrCatS (StringPtr, MaxLen, L"&");\r
\r
- StrCpyS (StringPtr, MaxLen, L"VALUE=");\r
- StringPtr += StrLen (StringPtr);\r
+ StrCatS (StringPtr, MaxLen, L"VALUE=");\r
\r
- StrCpyS (StringPtr, MaxLen, ValueElement);\r
- StringPtr += StrLen (StringPtr);\r
- *StringPtr = L'\0';\r
+ StrCatS (StringPtr, MaxLen, ValueElement);\r
\r
FreePool (ConfigHdr);\r
FreePool (RequestElement);\r
*ProgressErr = GetStringIdFromRecord (Record, NameSpace, KeywordData, KeywordStringId);\r
if (*ProgressErr == KEYWORD_HANDLER_NO_ERROR) {\r
*DataBaseRecord = Record;\r
- \r
+\r
if ((DevicePathPkg = Record->PackageList->DevicePathPkg) != NULL) {\r
DestDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) (DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER));\r
DevicePathSize = GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) DestDevicePath);\r
return EFI_OUT_OF_RESOURCES;\r
} else if (*ProgressErr == KEYWORD_HANDLER_KEYWORD_NOT_FOUND) {\r
FindNameSpace = TRUE;\r
- } \r
+ }\r
}\r
\r
//\r
}\r
\r
/**\r
- Genereate the KeywordResp String.\r
+ Generate the KeywordResp String.\r
\r
<KeywordResp> ::= <NameSpaceId><PathHdr>'&'<Keyword>'&VALUE='<Number>['&READONLY']\r
\r
**/\r
EFI_STATUS\r
GenerateKeywordResp (\r
- IN CHAR8 *NameSpace, \r
+ IN CHAR8 *NameSpace,\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
IN EFI_STRING KeywordData,\r
IN EFI_STRING ValueStr,\r
CHAR16 *RespStr;\r
CHAR16 *PathHdr;\r
CHAR16 *UnicodeNameSpace;\r
+ UINTN NameSpaceLength;\r
\r
ASSERT ((NameSpace != NULL) && (DevicePath != NULL) && (KeywordData != NULL) && (ValueStr != NULL) && (KeywordResp != NULL));\r
\r
// 1.1 NameSpaceId size.\r
// 'NAMESPACE='<String>\r
//\r
- RespStrLen = 10 + AsciiStrLen (NameSpace);\r
- UnicodeNameSpace = AllocatePool ((AsciiStrLen (NameSpace) + 1) * sizeof (CHAR16));\r
+ NameSpaceLength = AsciiStrLen (NameSpace);\r
+ RespStrLen = 10 + NameSpaceLength;\r
+ UnicodeNameSpace = AllocatePool ((NameSpaceLength + 1) * sizeof (CHAR16));\r
if (UnicodeNameSpace == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- AsciiStrToUnicodeStr(NameSpace, UnicodeNameSpace);\r
+ AsciiStrToUnicodeStrS (NameSpace, UnicodeNameSpace, NameSpaceLength + 1);\r
\r
//\r
// 1.2 PathHdr size.\r
RespStrLen += StrLen (PathHdr);\r
\r
//\r
- // 1.3 Keyword setion.\r
+ // 1.3 Keyword section.\r
// 'KEYWORD='<String>[':'<DecCh>(1/4)]\r
//\r
RespStrLen += 8 + StrLen (KeywordData);\r
// 2.1 Copy NameSpaceId section.\r
//\r
StrCpyS (RespStr, RespStrLen, L"NAMESPACE=");\r
- RespStr += StrLen (RespStr);\r
- StrCpyS (RespStr, RespStrLen, UnicodeNameSpace);\r
- RespStr += StrLen (RespStr);\r
+\r
+ StrCatS (RespStr, RespStrLen, UnicodeNameSpace);\r
\r
//\r
// 2.2 Copy PathHdr section.\r
//\r
- StrCpyS (RespStr, RespStrLen, PathHdr);\r
- RespStr += StrLen (RespStr);\r
+ StrCatS (RespStr, RespStrLen, PathHdr);\r
\r
//\r
// 2.3 Copy Keyword section.\r
//\r
- StrCpyS (RespStr, RespStrLen, L"KEYWORD=");\r
- RespStr += StrLen (RespStr);\r
- StrCpyS (RespStr, RespStrLen, KeywordData);\r
- RespStr += StrLen (RespStr);\r
+ StrCatS (RespStr, RespStrLen, L"KEYWORD=");\r
+\r
+ StrCatS (RespStr, RespStrLen, KeywordData);\r
\r
//\r
// 2.4 Copy the Value section.\r
//\r
- StrCpyS (RespStr, RespStrLen, ValueStr);\r
- RespStr += StrLen (RespStr);\r
+ StrCatS (RespStr, RespStrLen, ValueStr);\r
\r
//\r
// 2.5 Copy ReadOnly section if exist.\r
//\r
if (ReadOnly) {\r
- StrCpyS (RespStr, RespStrLen, L"&READONLY");\r
- RespStr += StrLen (RespStr);\r
+ StrCatS (RespStr, RespStrLen, L"&READONLY");\r
}\r
\r
- //\r
- // 2.6 Add the end.\r
- //\r
- *RespStr = L'\0';\r
-\r
if (UnicodeNameSpace != NULL) {\r
FreePool (UnicodeNameSpace);\r
}\r
if (PathHdr != NULL) {\r
FreePool (PathHdr);\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
MultiKeywordRespLen = (StrLen (*MultiKeywordResp) + 1 + StrLen (*KeywordResp) + 1) * sizeof (CHAR16);\r
\r
- StringPtr = AllocateCopyPool (MultiKeywordRespLen, *MultiKeywordResp);\r
+ StringPtr = ReallocatePool (\r
+ StrSize (*MultiKeywordResp),\r
+ MultiKeywordRespLen,\r
+ *MultiKeywordResp\r
+ );\r
if (StringPtr == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- \r
- FreePool (*MultiKeywordResp);\r
- *MultiKeywordResp = StringPtr;\r
\r
- StringPtr += StrLen (StringPtr);\r
+ *MultiKeywordResp = StringPtr;\r
\r
- *StringPtr = L'&';\r
- StringPtr++;\r
+ StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), L"&");\r
\r
- StrCpyS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);\r
+ StrCatS (StringPtr, MultiKeywordRespLen / sizeof (CHAR16), *KeywordResp);\r
\r
return EFI_SUCCESS;\r
}\r
\r
/**\r
- Enumerate all keyword in the system. \r
- \r
- If error occur when parse one keyword, just skip it and parse the next one. \r
+ Enumerate all keyword in the system.\r
+\r
+ If error occur when parse one keyword, just skip it and parse the next one.\r
\r
This is a internal function.\r
\r
@param NameSpace The namespace used to search the string.\r
@param MultiResp Return the MultiKeywordResp string for the system.\r
+ @param ProgressErr Return the error status.\r
\r
@retval EFI_OUT_OF_RESOURCES The memory can't be allocated.\r
@retval EFI_SUCCESS Generate the MultiKeywordResp string.\r
EFI_STATUS\r
EnumerateAllKeywords (\r
IN CHAR8 *NameSpace,\r
- OUT EFI_STRING *MultiResp\r
+ OUT EFI_STRING *MultiResp,\r
+ OUT UINT32 *ProgressErr\r
)\r
{\r
LIST_ENTRY *Link;\r
CHAR16 *MultiKeywordResp;\r
CHAR16 *KeywordData;\r
BOOLEAN ReadOnly;\r
+ BOOLEAN FindKeywordPackages;\r
\r
DataBaseRecord = NULL;\r
Status = EFI_SUCCESS;\r
ConfigRequest = NULL;\r
ValueElement = NULL;\r
KeywordResp = NULL;\r
+ FindKeywordPackages = FALSE;\r
\r
if (NameSpace == NULL) {\r
NameSpace = UEFI_CONFIG_LANG;\r
// Check whether has keyword string package.\r
//\r
if (AsciiStrnCmp(NameSpace, StringPackage->StringPkgHdr->Language, AsciiStrLen (NameSpace)) == 0) {\r
+ FindKeywordPackages = TRUE;\r
//\r
// Keep the NameSpace string.\r
//\r
// Any valid string start from 2. so here initial it to 1.\r
//\r
NextStringId = 1;\r
- \r
+\r
//\r
// Enumerate all valid stringid in the package.\r
//\r
//\r
goto Error;\r
}\r
- \r
+\r
//\r
// 3.4 Extract Value for the input keyword.\r
//\r
//\r
goto Done;\r
}\r
- \r
+\r
//\r
// 6. Merge to the MultiKeywordResp string.\r
//\r
if (KeywordResp != NULL) {\r
FreePool (KeywordResp);\r
KeywordResp = NULL;\r
- } \r
+ }\r
}\r
\r
if (LocalNameSpace != NULL) {\r
LocalNameSpace = NULL;\r
}\r
}\r
- } \r
+ }\r
}\r
\r
//\r
- // return the already get MultiKeywordString even error occured.\r
+ // return the already get MultiKeywordString even error occurred.\r
//\r
if (MultiKeywordResp == NULL) {\r
Status = EFI_NOT_FOUND;\r
+ if (!FindKeywordPackages) {\r
+ *ProgressErr = KEYWORD_HANDLER_NAMESPACE_ID_NOT_FOUND;\r
+ } else {\r
+ *ProgressErr = KEYWORD_HANDLER_KEYWORD_NOT_FOUND;\r
+ }\r
} else {\r
Status = EFI_SUCCESS;\r
}\r
*MultiResp = MultiKeywordResp;\r
- \r
+\r
Done:\r
if (LocalNameSpace != NULL) {\r
FreePool (LocalNameSpace);\r
This function accepts a <MultiKeywordResp> formatted string, finds the associated\r
keyword owners, creates a <MultiConfigResp> string from it and forwards it to the\r
EFI_HII_ROUTING_PROTOCOL.RouteConfig function.\r
- \r
- If there is an issue in resolving the contents of the KeywordString, then the \r
- function returns an error and also sets the Progress and ProgressErr with the \r
+\r
+ If there is an issue in resolving the contents of the KeywordString, then the\r
+ function returns an error and also sets the Progress and ProgressErr with the\r
appropriate information about where the issue occurred and additional data about\r
- the nature of the issue. \r
- \r
+ the nature of the issue.\r
+\r
In the case when KeywordString containing multiple keywords, when an EFI_NOT_FOUND\r
error is generated during processing the second or later keyword element, the system\r
- storage associated with earlier keywords is not modified. All elements of the \r
+ storage associated with earlier keywords is not modified. All elements of the\r
KeywordString must successfully pass all tests for format and access prior to making\r
any modifications to storage.\r
- \r
+\r
In the case when EFI_DEVICE_ERROR is returned from the processing of a KeywordString\r
containing multiple keywords, the state of storage associated with earlier keywords\r
is undefined.\r
\r
@param This Pointer to the EFI_KEYWORD_HANDLER _PROTOCOL instance.\r
\r
- @param KeywordString A null-terminated string in <MultiKeywordResp> format. \r
+ @param KeywordString A null-terminated string in <MultiKeywordResp> format.\r
\r
- @param Progress On return, points to a character in the KeywordString. \r
- Points to the string's NULL terminator if the request \r
- was successful. Points to the most recent '&' before \r
- the first failing string element if the request was \r
- not successful.\r
+ @param Progress On return, points to a character in the KeywordString.\r
+ Points to the string's NULL terminator if the request\r
+ was successful. Points to the most recent '&' before\r
+ the first failing name / value pair (or the beginning\r
+ of the string if the failure is in the first name / value\r
+ pair) if the request was not successful.\r
\r
@param ProgressErr If during the processing of the KeywordString there was\r
- a failure, this parameter gives additional information \r
- about the possible source of the problem. The various \r
+ a failure, this parameter gives additional information\r
+ about the possible source of the problem. The various\r
errors are defined in "Related Definitions" below.\r
\r
\r
\r
@retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
1. KeywordString is NULL.\r
- 2. Parsing of the KeywordString resulted in an \r
+ 2. Parsing of the KeywordString resulted in an\r
error. See Progress and ProgressErr for more data.\r
\r
- @retval EFI_NOT_FOUND An element of the KeywordString was not found. \r
+ @retval EFI_NOT_FOUND An element of the KeywordString was not found.\r
See ProgressErr for more data.\r
\r
- @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. \r
+ @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
See ProgressErr for more data.\r
- \r
- @retval EFI_ACCESS_DENIED The action violated system policy. See ProgressErr \r
+\r
+ @retval EFI_ACCESS_DENIED The action violated system policy. See ProgressErr\r
for more data.\r
\r
@retval EFI_DEVICE_ERROR An unexpected system error occurred. See ProgressErr\r
\r
**/\r
EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
EfiConfigKeywordHandlerSetData (\r
IN EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *This,\r
IN CONST EFI_STRING KeywordString,\r
BOOLEAN ReadOnly;\r
EFI_STRING InternalProgress;\r
CHAR16 *TempString;\r
+ CHAR16 *KeywordStartPos;\r
\r
if (This == NULL || Progress == NULL || ProgressErr == NULL || KeywordString == NULL) {\r
return EFI_INVALID_PARAMETER;\r
KeywordData = NULL;\r
ValueElement = NULL;\r
ConfigResp = NULL;\r
+ KeywordStartPos = NULL;\r
KeywordStringId = 0;\r
\r
//\r
// 1.1 Check whether the input namespace is valid.\r
//\r
if (AsciiStrnCmp(NameSpace, UEFI_CONFIG_LANG, AsciiStrLen (UEFI_CONFIG_LANG)) != 0) {\r
- *ProgressErr = KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR;\r
+ *ProgressErr = KEYWORD_HANDLER_MALFORMED_STRING;\r
Status = EFI_INVALID_PARAMETER;\r
goto Done;\r
}\r
//\r
// 3. Extract keyword from the KeywordRequest string.\r
//\r
+ KeywordStartPos = StringPtr;\r
Status = ExtractKeyword(StringPtr, &KeywordData, &NextStringPtr);\r
if (EFI_ERROR (Status)) {\r
//\r
StringPtr = NextStringPtr;\r
\r
//\r
- // 5. Find ReadOnly filter.\r
+ // 5. Find READONLY tag.\r
//\r
- if ((StringPtr != NULL) && StrnCmp (StringPtr, L"&ReadOnly", StrLen (L"&ReadOnly")) == 0) {\r
+ if ((StringPtr != NULL) && StrnCmp (StringPtr, L"&READONLY", StrLen (L"&READONLY")) == 0) {\r
ReadOnly = TRUE;\r
- StringPtr += StrLen (L"&ReadOnly");\r
+ StringPtr += StrLen (L"&READONLY");\r
} else {\r
ReadOnly = FALSE;\r
}\r
// 8. Check the readonly flag.\r
//\r
if (ExtractReadOnlyFromOpCode (OpCode) != ReadOnly) {\r
+ //\r
+ // Extracting readonly flag form opcode and extracting "READONLY" tag form KeywordString should have the same results.\r
+ // If not, the input KeywordString must be incorrect, return the error status to caller.\r
+ //\r
*ProgressErr = KEYWORD_HANDLER_INCOMPATIBLE_VALUE_DETECTED;\r
Status = EFI_INVALID_PARAMETER;\r
- goto Done; \r
+ goto Done;\r
}\r
- \r
+ if (ReadOnly) {\r
+ *ProgressErr = KEYWORD_HANDLER_ACCESS_NOT_PERMITTED;\r
+ Status = EFI_ACCESS_DENIED;\r
+ goto Done;\r
+ }\r
+\r
//\r
// 9. Merge to the MultiKeywordResp string.\r
//\r
FreePool (KeywordData);\r
FreePool (ValueElement);\r
NameSpace = NULL;\r
- DevicePath = NULL; \r
+ DevicePath = NULL;\r
KeywordData = NULL;\r
ValueElement = NULL;\r
if (ConfigResp != NULL) {\r
FreePool (ConfigResp);\r
ConfigResp = NULL;\r
}\r
+ KeywordStartPos = NULL;\r
}\r
\r
//\r
Status = EFI_DEVICE_ERROR;\r
goto Done;\r
}\r
- \r
+\r
*ProgressErr = KEYWORD_HANDLER_NO_ERROR;\r
\r
Done:\r
+ if (KeywordStartPos != NULL) {\r
+ *Progress = KeywordString + (KeywordStartPos - TempString);\r
+ } else {\r
+ *Progress = KeywordString + (StringPtr - TempString);\r
+ }\r
+\r
ASSERT (TempString != NULL);\r
FreePool (TempString);\r
if (NameSpace != NULL) {\r
}\r
if (MultiConfigResp != NULL && MultiConfigResp != ConfigResp) {\r
FreePool (MultiConfigResp);\r
- } \r
- *Progress = StringPtr;\r
+ }\r
+\r
return Status;\r
}\r
\r
/**\r
\r
- This function accepts a <MultiKeywordRequest> formatted string, finds the underlying \r
+ This function accepts a <MultiKeywordRequest> formatted string, finds the underlying\r
keyword owners, creates a <MultiConfigRequest> string from it and forwards it to the\r
EFI_HII_ROUTING_PROTOCOL.ExtractConfig function.\r
- \r
+\r
If there is an issue in resolving the contents of the KeywordString, then the function\r
returns an EFI_INVALID_PARAMETER and also set the Progress and ProgressErr with the\r
appropriate information about where the issue occurred and additional data about the\r
nature of the issue.\r
- \r
+\r
In the case when KeywordString is NULL, or contains multiple keywords, or when\r
EFI_NOT_FOUND is generated while processing the keyword elements, the Results string\r
- contains values returned for all keywords processed prior to the keyword generating the \r
+ contains values returned for all keywords processed prior to the keyword generating the\r
error but no values for the keyword with error or any following keywords.\r
\r
- \r
+\r
@param This Pointer to the EFI_KEYWORD_HANDLER _PROTOCOL instance.\r
- \r
+\r
@param NameSpaceId A null-terminated string containing the platform configuration\r
language to search through in the system. If a NULL is passed\r
in, then it is assumed that any platform configuration language\r
with the prefix of "x-UEFI-" are searched.\r
- \r
+\r
@param KeywordString A null-terminated string in <MultiKeywordRequest> format. If a\r
- NULL is passed in the KeywordString field, all of the known \r
- keywords in the system for the NameSpaceId specified are \r
+ NULL is passed in the KeywordString field, all of the known\r
+ keywords in the system for the NameSpaceId specified are\r
returned in the Results field.\r
- \r
+\r
@param Progress On return, points to a character in the KeywordString. Points\r
- to the string's NULL terminator if the request was successful. \r
- Points to the most recent '&' before the first failing string\r
- element if the request was not successful.\r
- \r
+ to the string's NULL terminator if the request was successful.\r
+ Points to the most recent '&' before the first failing name / value\r
+ pair (or the beginning of the string if the failure is in the first\r
+ name / value pair) if the request was not successful.\r
+\r
@param ProgressErr If during the processing of the KeywordString there was a\r
- failure, this parameter gives additional information about the \r
+ failure, this parameter gives additional information about the\r
possible source of the problem. See the definitions in SetData()\r
for valid value definitions.\r
- \r
+\r
@param Results A null-terminated string in <MultiKeywordResp> format is returned\r
- which has all the values filled in for the keywords in the \r
+ which has all the values filled in for the keywords in the\r
KeywordString. This is a callee-allocated field, and must be freed\r
- by the caller after being used. \r
+ by the caller after being used.\r
\r
@retval EFI_SUCCESS The specified action was completed successfully.\r
- \r
+\r
@retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
- 1.Progress, ProgressErr, or Resuts is NULL.\r
+ 1.Progress, ProgressErr, or Results is NULL.\r
2.Parsing of the KeywordString resulted in an error. See\r
Progress and ProgressErr for more data.\r
- \r
+\r
\r
@retval EFI_NOT_FOUND An element of the KeywordString was not found. See\r
ProgressErr for more data.\r
\r
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. See\r
ProgressErr for more data.\r
- \r
+\r
@retval EFI_ACCESS_DENIED The action violated system policy. See ProgressErr for\r
more data.\r
\r
\r
**/\r
EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
EfiConfigKeywordHandlerGetData (\r
IN EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *This,\r
IN CONST EFI_STRING NameSpaceId, OPTIONAL\r
IN CONST EFI_STRING KeywordString, OPTIONAL\r
- OUT EFI_STRING *Progress, \r
+ OUT EFI_STRING *Progress,\r
OUT UINT32 *ProgressErr,\r
OUT EFI_STRING *Results\r
)\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
HII_DATABASE_RECORD *DataBaseRecord;\r
CHAR16 *StringPtr;\r
- CHAR16 *NextStringPtr; \r
+ CHAR16 *NextStringPtr;\r
CHAR16 *KeywordData;\r
EFI_STRING_ID KeywordStringId;\r
UINT8 *OpCode;\r
TempString = NULL;\r
}\r
if (EFI_ERROR (Status)) {\r
- *ProgressErr = KEYWORD_HANDLER_NAMESPACE_ID_NOT_FOUND;\r
+ *ProgressErr = KEYWORD_HANDLER_MALFORMED_STRING;\r
return Status;\r
}\r
//\r
//\r
if (NameSpace != NULL){\r
if (AsciiStrnCmp(NameSpace, UEFI_CONFIG_LANG, AsciiStrLen (UEFI_CONFIG_LANG)) != 0) {\r
- *ProgressErr = KEYWORD_HANDLER_UNDEFINED_PROCESSING_ERROR;\r
+ *ProgressErr = KEYWORD_HANDLER_MALFORMED_STRING;\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
- \r
+\r
if (KeywordString != NULL) {\r
//\r
// Use temp string to avoid changing input string buffer.\r
}\r
StringPtr = NextStringPtr;\r
\r
- \r
+\r
//\r
// 3. Process Keyword section from the input keywordRequest string.\r
//\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
- \r
+\r
//\r
// 3.4 Extract Value for the input keyword.\r
//\r
FreePool (KeywordData);\r
FreePool (ValueElement);\r
FreePool (ConfigRequest);\r
- DevicePath = NULL; \r
+ DevicePath = NULL;\r
KeywordData = NULL;\r
ValueElement = NULL;\r
ConfigRequest = NULL;\r
//\r
// Enumerate all keyword in the system.\r
//\r
- Status = EnumerateAllKeywords(NameSpace, &MultiKeywordResp);\r
+ Status = EnumerateAllKeywords(NameSpace, &MultiKeywordResp, ProgressErr);\r
if (EFI_ERROR (Status)) {\r
goto Done;\r
}\r
*ProgressErr = KEYWORD_HANDLER_NO_ERROR;\r
\r
Done:\r
+ *Progress = KeywordString + (StringPtr - TempString);\r
+\r
if (TempString != NULL) {\r
FreePool (TempString);\r
}\r
if (KeywordData != NULL) {\r
FreePool (KeywordData);\r
}\r
- *Progress = StringPtr;\r
+\r
return Status;\r
}\r