/** @file\r
Implementation of interfaces function for EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL.\r
\r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, 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
return (UINT16) sizeof (BOOLEAN);\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
// 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
//\r
// Append L"&PATH="\r
//\r
- StrCpyS (String, MaxLen, L"&PATH=");\r
+ StrCatS (ReturnString, MaxLen, L"&PATH=");\r
String += StrLen (String);\r
\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
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
- StrCpyS (StringPtr, MaxLen, RequestElement);\r
- StringPtr += StrLen (StringPtr);\r
- \r
- *StringPtr = L'&';\r
- StringPtr++;\r
\r
- StrCpyS (StringPtr, MaxLen, L"VALUE=");\r
- StringPtr += StrLen (StringPtr);\r
+ StrCatS (StringPtr, MaxLen, RequestElement);\r
+\r
+ StrCatS (StringPtr, MaxLen, L"&");\r
+\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
// 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
FreePool (*MultiKeywordResp);\r
*MultiKeywordResp = StringPtr;\r
\r
- StringPtr += StrLen (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
@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
+ 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
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
//\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
// 8. Check the readonly flag.\r
//\r
if (ExtractReadOnlyFromOpCode (OpCode) != ReadOnly) {\r
- *ProgressErr = KEYWORD_HANDLER_INCOMPATIBLE_VALUE_DETECTED;\r
- Status = EFI_INVALID_PARAMETER;\r
+ *ProgressErr = KEYWORD_HANDLER_ACCESS_NOT_PERMITTED;\r
+ Status = EFI_ACCESS_DENIED;\r
goto Done; \r
}\r
\r
FreePool (ConfigResp);\r
ConfigResp = NULL;\r
}\r
+ KeywordStartPos = NULL;\r
}\r
\r
//\r
*ProgressErr = KEYWORD_HANDLER_NO_ERROR;\r
\r
Done:\r
- *Progress = KeywordString + (StringPtr - TempString);\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 (MultiConfigResp != NULL && MultiConfigResp != ConfigResp) {\r
FreePool (MultiConfigResp);\r
}\r
- \r
+\r
return Status;\r
}\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
+ 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