From 56389010fbd2936ef44375ea42a032a2e83df6e8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Tue, 17 May 2022 11:47:14 -0300 Subject: [PATCH] Streamline non-PCI VBIOS detection to act alongside option ROM detection --- biostools/analyzers.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/biostools/analyzers.py b/biostools/analyzers.py index d8c8a48..8f9ea72 100644 --- a/biostools/analyzers.py +++ b/biostools/analyzers.py @@ -1106,7 +1106,7 @@ class BonusAnalyzer(Analyzer): self._acpi_table_pattern = re.compile(b'''(?:DSDT|FACP|PSDT|RSDT|SBST|SSDT)([\\x00-\\xFF]{4})[\\x00-\\xFF]{24}[\\x00\\x20-\\x7E]{4}''') self._adaptec_pattern = re.compile(b'''Adaptec (?:BIOS:|([\\x20-\\x7E]+) BIOS )''') self._ncr_pattern = re.compile(b''' SDMS \\(TM\\) V([0-9])''') - self._orom_pattern = re.compile(b'''\\x55\\xAA[\\x01-\\xFF][\\x00-\\xFF]{21}([\\x00-\\xFF]{4})''') + self._orom_pattern = re.compile(b'''\\x55\\xAA[\\x01-\\xFF][\\x00-\\xFF]{21}([\\x00-\\xFF]{4})([\\x00-\\xFF]{2}IBM)?''') self._phoenixnet_patterns = ( re.compile(b'''CPLRESELLERID'''), re.compile(b'''BINCPUTBL'''), @@ -1118,7 +1118,6 @@ class BonusAnalyzer(Analyzer): ) self._rpl_pattern = re.compile(b'''NetWare Ready ROM''') self._sli_pattern = re.compile(b'''[0-9]{12}Genuine NVIDIA Certified SLI Ready Motherboard for ''') - self._vbios_pattern = re.compile(b'''IBM (?:VGA C(?:OMPAT[IA]BLE|ompatible)|COMPATIBLE PARADISE)|ATI Technologies Inc\\.|SiS super VGA chip''') def can_handle(self, file_data, header_data): # PhoenixNet @@ -1155,23 +1154,25 @@ class BonusAnalyzer(Analyzer): if header_data == b'\x00\xFFUEFIExtract\xFF\x00': self.addons.append('UEFI') - # VGA BIOS - if self._vbios_pattern.search(file_data): - self.addons.append('VGA') - # Look for PCI/PnP option ROMs. for match in self._orom_pattern.finditer(file_data): + # Check for the VGA BIOS compatibility marker. + if match.group(2): + self.addons.append('VGA') + # Extract PCI and PnP data structure pointers. pci_header_ptr, pnp_header_ptr = struct.unpack('= 26: pci_header_ptr += match.start() - if file_data[pci_header_ptr:pci_header_ptr + 4] == b'PCIR': + pci_magic = file_data[pci_header_ptr:pci_header_ptr + 4] + if pci_magic == b'PCIR': pci_header_data = file_data[pci_header_ptr + 4:pci_header_ptr + 16] if len(pci_header_data) == 12: # Read PCI header data. vendor_id, device_id, device_list_ptr, _, revision, progif, subclass, class_code = struct.unpack('