/* This helper function does everything that CreateBasicVariablePolicy() does, but also uses the passed in protocol to register the policy with the infrastructure. Does not return a buffer, does not require the caller to free anything. */
EFI_STATUS EFIAPI RegisterBasicVariablePolicy(IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, IN CONST EFI_GUID *Namespace, IN CONST CHAR16 *Name OPTIONAL, IN UINT32 MinSize, IN UINT32 MaxSize, IN UINT32 AttributesMustHave, IN UINT32 AttributesCantHave, IN UINT8 LockPolicyType)
/* This helper function does everything that CreateBasicVariablePolicy() does, but also uses the passed in protocol to register the policy with the infrastructure. Does not return a buffer, does not require the caller to free anything. */
EFI_STATUS EFIAPI RegisterBasicVariablePolicy(IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, IN CONST EFI_GUID *Namespace, IN CONST CHAR16 *Name OPTIONAL, IN UINT32 MinSize, IN UINT32 MaxSize, IN UINT32 AttributesMustHave, IN UINT32 AttributesCantHave, IN UINT8 LockPolicyType)
{
  VARIABLE_POLICY_ENTRY  *NewEntry;
  EFI_STATUS             Status;
  if (VariablePolicy == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  NewEntry = NULL;
  Status   = CreateBasicVariablePolicy (
               Namespace,
               Name,
               MinSize,
               MaxSize,
               AttributesMustHave,
               AttributesCantHave,
               LockPolicyType,
               &NewEntry
               );
  if (!EFI_ERROR (Status)) {
    Status = VariablePolicy->RegisterVariablePolicy (NewEntry);
  }
  if (NewEntry != NULL) {
    FreePool (NewEntry);
  }
  return Status;
}