/* this function does not check for built in alias'. */
EFI_STATUS InternalSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Volatile)
/* this function does not check for built in alias'. */
EFI_STATUS InternalSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Volatile)
{
  EFI_STATUS  Status;
  CHAR16      *AliasLower;
  BOOLEAN     DeleteAlias;
  DeleteAlias = FALSE;
  if (Alias == NULL) {
    Alias       = Command;
    DeleteAlias = TRUE;
  }
  ASSERT (Alias != NULL);
  AliasLower = AllocateCopyPool (StrSize (Alias), Alias);
  if (AliasLower == NULL) {
    return EFI_OUT_OF_RESOURCES;
  }
  ToLower (AliasLower);
  if (DeleteAlias) {
    Status = gRT->SetVariable (AliasLower, &gShellAliasGuid, 0, 0, NULL);
  } else {
    Status = gRT->SetVariable (
                    AliasLower,
                    &gShellAliasGuid,
                    EFI_VARIABLE_BOOTSERVICE_ACCESS | (Volatile ? 0 : EFI_VARIABLE_NON_VOLATILE),
                    StrSize (Command),
                    (VOID *)Command
                    );
  }
  FreePool (AliasLower);
  return Status;
}