/* To find the BlockName in the string with same value. */
EFI_STATUS FindSameBlockElement(IN EFI_STRING String, IN EFI_STRING BlockName, IN UINT8 *Buffer, OUT BOOLEAN *Found, IN UINTN BufferLen)
/* To find the BlockName in the string with same value. */
EFI_STATUS FindSameBlockElement(IN EFI_STRING String, IN EFI_STRING BlockName, IN UINT8 *Buffer, OUT BOOLEAN *Found, IN UINTN BufferLen)
{
  EFI_STRING  BlockPtr;
  UINTN       Length;
  UINT8       *TempBuffer;
  EFI_STATUS  Status;
  TempBuffer = NULL;
  *Found     = FALSE;
  BlockPtr   = StrStr (String, BlockName);
  while (BlockPtr != NULL) {
    BlockPtr += StrLen (BlockName);
    Status    = GetValueOfNumber (BlockPtr, &TempBuffer, &Length);
    if (EFI_ERROR (Status)) {
      return Status;
    }
    ASSERT (TempBuffer != NULL);
    if ((BufferLen == Length) && (0 == CompareMem (Buffer, TempBuffer, Length))) {
      *Found = TRUE;
      FreePool (TempBuffer);
      TempBuffer = NULL;
      return EFI_SUCCESS;
    } else {
      FreePool (TempBuffer);
      TempBuffer = NULL;
      BlockPtr   = StrStr (BlockPtr + 1, BlockName);
    }
  }
  return EFI_SUCCESS;
}