/* The HiiValue->Buffer is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */
EFI_STATUS HiiStatementValueToHiiValue(IN HII_STATEMENT_VALUE *StatementValue, OUT EFI_HII_VALUE *HiiValue)
/* The HiiValue->Buffer is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */
EFI_STATUS HiiStatementValueToHiiValue(IN HII_STATEMENT_VALUE *StatementValue, OUT EFI_HII_VALUE *HiiValue)
{
  if ((StatementValue == NULL) || (HiiValue == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  ZeroMem (HiiValue, sizeof (EFI_HII_VALUE));
  HiiValue->Type      = StatementValue->Type;
  HiiValue->BufferLen = StatementValue->BufferLen;
  if ((StatementValue->Buffer != NULL) && (StatementValue->BufferLen > 0)) {
    HiiValue->Buffer = AllocateCopyPool (HiiValue->BufferLen, StatementValue->Buffer);
  }
  CopyMem (&HiiValue->Value, &StatementValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
  return EFI_SUCCESS;
}