/* Convert input unicode string to ascii string. It's caller's responsibility to free returned buffer using FreePool(). */
CHAR8* StrToAsciiStr(IN EFI_STRING UnicodeString)
/* Convert input unicode string to ascii string. It's caller's responsibility to free returned buffer using FreePool(). */
CHAR8* StrToAsciiStr(IN EFI_STRING UnicodeString)
{
  UINTN       StringLen;
  CHAR8       *Buffer;
  EFI_STATUS  Status;
  if (UnicodeString == NULL) {
    return NULL;
  }
  StringLen = StrLen (UnicodeString) + 1;
  Buffer    = AllocatePool (StringLen * sizeof (CHAR8));
  if (Buffer == NULL) {
    return NULL;
  }
  Status = UnicodeStrToAsciiStrS (UnicodeString, Buffer, StringLen);
  if (EFI_ERROR (Status)) {
    FreePool (Buffer);
    return NULL;
  }
  return Buffer;
}