Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
os-d committed Oct 18, 2024
1 parent db0565d commit 4e420d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion edk2toollib/os/uefivariablesupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ def GetUefiVar(self, name: str, guid: str) -> tuple[int, str]:
efi_var = fd.read()
length = len(efi_var)

return (err, efi_var[:length])
# Unpack a uint32 from the start of efi_var, which is the attributes
# we always expect the attributes to be 7, since we are reading from runtime,
# report an error so the user knows it may fail to load if not 7
attrs, = struct.unpack("=I", efi_var[:4])
if attrs != 7:
logging.error(f"Unexpected attributes value: {attrs} for {name}-{guid}")
efi_var = efi_var[4:length]

return (err, efi_var)

def GetUefiAllVarNames(self) -> tuple[int, bytes]:
"""Get all Uefi Variables in the system, and return a byte packed byte string.
Expand Down

0 comments on commit 4e420d5

Please sign in to comment.