return EFI_SUCCESS;\r
}\r
\r
-/**\r
- Converts a list of string to a specified buffer.\r
-\r
- @param[out] Buf The output buffer that contains the string.\r
- @param[in] BufferLength The length of the buffer\r
- @param[in] Str The input string that contains the hex number\r
-\r
- @retval EFI_SUCCESS The string was successfully converted to the buffer.\r
-\r
-**/\r
-EFI_STATUS\r
-AsciiStrToBuf (\r
- OUT UINT8 *Buf,\r
- IN UINTN BufferLength,\r
- IN CHAR8 *Str\r
- )\r
-{\r
- UINTN Index;\r
- UINTN StrLength;\r
- UINT8 Digit;\r
- UINT8 Byte;\r
-\r
- Digit = 0;\r
-\r
- //\r
- // Two hex char make up one byte\r
- //\r
- StrLength = BufferLength * 2;\r
-\r
- for(Index = 0; Index < StrLength; Index++, Str++) {\r
-\r
- if ((*Str >= 'a') && (*Str <= 'f')) {\r
- Digit = (UINT8) (*Str - 'a' + 0x0A);\r
- } else if ((*Str >= 'A') && (*Str <= 'F')) {\r
- Digit = (UINT8) (*Str - 'A' + 0x0A);\r
- } else if ((*Str >= '0') && (*Str <= '9')) {\r
- Digit = (UINT8) (*Str - '0');\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- //\r
- // For odd characters, write the upper nibble for each buffer byte,\r
- // and for even characters, the lower nibble.\r
- //\r
- if ((Index & 1) == 0) {\r
- Byte = (UINT8) (Digit << 4);\r
- } else {\r
- Byte = Buf[Index / 2];\r
- Byte &= 0xF0;\r
- Byte = (UINT8) (Byte | Digit);\r
- }\r
-\r
- Buf[Index / 2] = Byte;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Converts a string to GUID value.\r
- Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r
-\r
- @param[in] Str The registry format GUID string that contains the GUID value.\r
- @param[out] Guid A pointer to the converted GUID value.\r
-\r
- @retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.\r
- @retval EFI_UNSUPPORTED The input string is not in registry format.\r
- @return others Some error occurred when converting part of GUID value.\r
-\r
-**/\r
-EFI_STATUS\r
-IniAsciiStrToGuid (\r
- IN CHAR8 *Str,\r
- OUT EFI_GUID *Guid\r
- )\r
-{\r
- //\r
- // Get the first UINT32 data\r
- //\r
- Guid->Data1 = (UINT32) AsciiStrHexToUint64 (Str);\r
- while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
- Str ++;\r
- }\r
-\r
- if (IS_HYPHEN (*Str)) {\r
- Str++;\r
- } else {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Get the second UINT16 data\r
- //\r
- Guid->Data2 = (UINT16) AsciiStrHexToUint64 (Str);\r
- while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
- Str ++;\r
- }\r
-\r
- if (IS_HYPHEN (*Str)) {\r
- Str++;\r
- } else {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Get the third UINT16 data\r
- //\r
- Guid->Data3 = (UINT16) AsciiStrHexToUint64 (Str);\r
- while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {\r
- Str ++;\r
- }\r
-\r
- if (IS_HYPHEN (*Str)) {\r
- Str++;\r
- } else {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Get the following 8 bytes data\r
- //\r
- AsciiStrToBuf (&Guid->Data4[0], 2, Str);\r
- //\r
- // Skip 2 byte hex chars\r
- //\r
- Str += 2 * 2;\r
-\r
- if (IS_HYPHEN (*Str)) {\r
- Str++;\r
- } else {\r
- return EFI_UNSUPPORTED;\r
- }\r
- AsciiStrToBuf (&Guid->Data4[2], 6, Str);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
/**\r
Pre process config data buffer into Section entry list and Comment entry list.\r
\r
{\r
CHAR8 *Value;\r
EFI_STATUS Status;\r
+ RETURN_STATUS RStatus;\r
\r
if (Context == NULL || SectionName == NULL || EntryName == NULL || Guid == NULL) {\r
return EFI_INVALID_PARAMETER;\r
return EFI_NOT_FOUND;\r
}\r
ASSERT (Value != NULL);\r
- if (!IsValidGuid(Value, AsciiStrLen(Value))) {\r
- return EFI_NOT_FOUND;\r
- }\r
- Status = IniAsciiStrToGuid(Value, Guid);\r
- if (EFI_ERROR (Status)) {\r
+ RStatus = AsciiStrToGuid (Value, Guid);\r
+ if (RETURN_ERROR (RStatus) || (Value[GUID_STRING_LENGTH] != '\0')) {\r
return EFI_NOT_FOUND;\r
}\r
return EFI_SUCCESS;\r