VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/Library/CommonLib/EfiVar.c
diff options
context:
space:
mode:
Diffstat (limited to 'Library/CommonLib/EfiVar.c')
-rw-r--r--Library/CommonLib/EfiVar.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/CommonLib/EfiVar.c b/Library/CommonLib/EfiVar.c
index 2a6e59e..fad6eb5 100644
--- a/Library/CommonLib/EfiVar.c
+++ b/Library/CommonLib/EfiVar.c
@@ -80,7 +80,11 @@ BootOrderInsert(
UINTN i;
UINTN j;
res = EfiGetVar(OrderVarName, &gEfiGlobalVariableGuid, &varBootOrder, &varBootOrderSize, &varBootOrderAttr);
- if (EFI_ERROR(res)) return res;
+ if (EFI_ERROR(res)) {
+ res = EfiSetVar(OrderVarName, &gEfiGlobalVariableGuid, &value, 2,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS);
+ return res;
+ }
BootOrderCount = varBootOrderSize / sizeof(UINT16);
varBootOrderNew = MEM_ALLOC((BootOrderCount + 1) * sizeof(UINT16));
if (BootOrderCount < index) index = BootOrderCount - 1;