BIOSUtilities v24.10.06

24.10.06

Changed BIOSUtility.parse_format() to return a boolean
Changed 7-Zip and EFI decompressors to return booleans
Apple EFI Package Extractor support for InstallAssistant
Apple EFI Image Identifier support for Apple ROM Version
Added Apple EFI Image Identifier class instance attributes
Improved flow of non-PATH external executable dependencies
Fixed crash when attempting to clear read-only attribute
Fixed incompatibility with Python versions prior to 3.12
Performance improvements when initializing BIOSUtilities
Improved argument naming and definitions of "main" script
Improved the README with new "main" and Apple EFI changes
This commit is contained in:
Plato Mavropoulos 2024-10-07 01:24:12 +03:00
parent 4175af9eb1
commit eda154b0f2
26 changed files with 346 additions and 223 deletions

View file

@ -11,6 +11,7 @@ import logging
import os
from re import Match
from typing import Final
from pefile import PE
@ -28,7 +29,7 @@ class PortwellEfiExtract(BIOSUtility):
TITLE: str = 'Portwell EFI Update Extractor'
FILE_NAMES: dict[int, str] = {
FILE_NAMES: Final[dict[int, str]] = {
0: 'Flash.efi',
1: 'Fparts.txt',
2: 'Update.nsh',
@ -56,7 +57,7 @@ class PortwellEfiExtract(BIOSUtility):
return False
def parse_format(self, input_object: str | bytes | bytearray, extract_path: str, padding: int = 0) -> None:
def parse_format(self, input_object: str | bytes | bytearray, extract_path: str, padding: int = 0) -> bool:
""" Parse & Extract Portwell UEFI Unpacker """
# Initialize EFI Payload file chunks
@ -83,6 +84,8 @@ class PortwellEfiExtract(BIOSUtility):
self._parse_efi_files(extract_path=extract_path, efi_files=efi_files, padding=padding)
return True
@staticmethod
def _get_portwell_pe(in_buffer: bytes) -> tuple:
""" Get PE of Portwell EFI executable """
@ -161,7 +164,7 @@ class PortwellEfiExtract(BIOSUtility):
os.replace(src=file_path, dst=comp_fname)
# Successful decompression, delete compressed file
if efi_decompress(in_path=comp_fname, out_path=file_path, padding=padding + 8) == 0:
if efi_decompress(in_path=comp_fname, out_path=file_path, padding=padding + 8):
os.remove(path=comp_fname)