/* This service is an MOR/MorLock checker handler for the SetVariable(). */
EFI_STATUS SetVariableCheckHandlerMor(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
/* This service is an MOR/MorLock checker handler for the SetVariable(). */
EFI_STATUS SetVariableCheckHandlerMor(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
{
  if (!IsAnyMorVariable (VariableName, VendorGuid)) {
    return EFI_SUCCESS;
  }
  if (!IsVariablePolicyEnabled () && ((Attributes == 0) || (DataSize == 0))) {
    return EFI_SUCCESS;
  }
  if (IsMorLockVariable (VariableName, VendorGuid)) {
    return SetVariableCheckHandlerMorLock (
             VariableName,
             VendorGuid,
             Attributes,
             DataSize,
             Data
             );
  }
  if (((Attributes == 0) || (DataSize == 0)) && mMorPassThru) {
    return EFI_SUCCESS;
  }
  if ((Attributes != (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)) ||
      (DataSize != sizeof (UINT8)) ||
      (Data == NULL))
  {
    return EFI_INVALID_PARAMETER;
  }
  if (mMorLockState == MorLockStateLocked) {
    return EFI_ACCESS_DENIED;
  }
  return EFI_SUCCESS;
}