13#include <Library/VariablePolicyLib.h>
14#include <Library/VariablePolicyHelperLib.h>
44 IN CHAR16 *VariableName,
51 DEBUG ((DEBUG_WARN,
"!!! DEPRECATED INTERFACE !!! %a() will go away soon!\n", __func__));
52 DEBUG ((DEBUG_WARN,
"!!! DEPRECATED INTERFACE !!! Please move to use Variable Policy!\n"));
53 DEBUG ((DEBUG_WARN,
"!!! DEPRECATED INTERFACE !!! Variable: %g %s\n", VendorGuid, VariableName));
56 Status = CreateBasicVariablePolicy (
59 VARIABLE_POLICY_NO_MIN_SIZE,
60 VARIABLE_POLICY_NO_MAX_SIZE,
61 VARIABLE_POLICY_NO_MUST_ATTR,
62 VARIABLE_POLICY_NO_CANT_ATTR,
63 VARIABLE_POLICY_TYPE_LOCK_NOW,
66 if (!EFI_ERROR (Status)) {
67 Status = RegisterVariablePolicy (NewPolicy);
75 if (Status == EFI_ALREADY_STARTED) {
76 Status = ValidateSetVariable (VariableName, VendorGuid, 0, 0,
NULL);
77 if (Status == EFI_WRITE_PROTECTED) {
78 DEBUG ((DEBUG_WARN,
" Variable: %g %s is already locked!\n", VendorGuid, VariableName));
81 DEBUG ((DEBUG_ERROR,
" Variable: %g %s can not be locked!\n", VendorGuid, VariableName));
82 Status = EFI_ACCESS_DENIED;
87 if (EFI_ERROR (Status)) {
88 DEBUG ((DEBUG_ERROR,
"%a - Failed to lock variable %s! %r\n", __func__, VariableName, Status));
91 if (NewPolicy !=
NULL) {
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
EFI_STATUS EFIAPI VariableLockRequestToLock(IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This, IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
=== CODE UNDER TEST ===========================================================================