VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/Library/CommonLib
diff options
context:
space:
mode:
authorkavsrf <kavsrf@gmail.com>2017-06-14 12:49:40 +0300
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-18 15:52:10 +0200
commitaede42a840cc6e3509048182eb204b5ce8f3187c (patch)
tree49623debea5bda47325e71850a32506209ab9aec /Library/CommonLib
parent37c62bedd36ae255a036fb9e77f529a1021abb9a (diff)
downloadVeraCrypt-DCS-aede42a840cc6e3509048182eb204b5ce8f3187c.tar.gz
VeraCrypt-DCS-aede42a840cc6e3509048182eb204b5ce8f3187c.zip
BML update to sort "BootOrder"
Diffstat (limited to 'Library/CommonLib')
-rw-r--r--Library/CommonLib/EfiVar.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Library/CommonLib/EfiVar.c b/Library/CommonLib/EfiVar.c
index e9c1082..e03544f 100644
--- a/Library/CommonLib/EfiVar.c
+++ b/Library/CommonLib/EfiVar.c
@@ -148,7 +148,8 @@ BootOrderRemove(
EFI_STATUS
BootOrderPresent(
IN CHAR16 *OrderVarName,
- UINT16 value)
+ UINT16 value,
+ UINTN *index)
{
EFI_STATUS res = EFI_NOT_READY;
UINT16* varBootOrder;
@@ -156,19 +157,19 @@ BootOrderPresent(
UINT32 varBootOrderAttr;
UINTN BootOrderCount;
UINTN i;
- UINTN j;
res = EfiGetVar(OrderVarName, &gEfiGlobalVariableGuid, &varBootOrder, &varBootOrderSize, &varBootOrderAttr);
if (EFI_ERROR(res)) return res;
BootOrderCount = varBootOrderSize / sizeof(UINT16);
res = EFI_NOT_FOUND;
- for (j = 0, i = 0; i < BootOrderCount; ++i) {
+ for (i = 0; i < BootOrderCount; ++i) {
if (varBootOrder[i] == value) {
- MEM_FREE(varBootOrder);
res = EFI_SUCCESS;
break;
}
}
+ if (index != NULL) *index = i;
+ MEM_FREE(varBootOrder);
return res;
}