diff --git a/src/main/java/firmware/ifd/IntelFlashDescriptor.java b/src/main/java/firmware/ifd/IntelFlashDescriptor.java index aca9189..f65cf82 100644 --- a/src/main/java/firmware/ifd/IntelFlashDescriptor.java +++ b/src/main/java/firmware/ifd/IntelFlashDescriptor.java @@ -151,10 +151,13 @@ public class IntelFlashDescriptor { * * @param reader the specified BinaryReader */ - public IntelFlashDescriptor(BinaryReader reader) throws IOException { - // Skip the IFD vector (16 0xFF bytes). + public IntelFlashDescriptor(BinaryReader reader, boolean hasZeroVector) throws IOException { + // Skip the IFD vector (16 0xFF bytes) if it's present. + // Some BIOSes may not include this (observed on HP Compaq dc7900). headerOffset = reader.getPointerIndex(); - reader.setPointerIndex(reader.getPointerIndex() + 16); + if (hasZeroVector) { + reader.setPointerIndex(reader.getPointerIndex() + 16); + } signature = reader.readNextInt(); if (signature != IntelFlashDescriptorConstants.IFD_SIGNATURE) { diff --git a/src/main/java/firmware/ifd/IntelFlashFileSystem.java b/src/main/java/firmware/ifd/IntelFlashFileSystem.java index d748292..43b9ea7 100644 --- a/src/main/java/firmware/ifd/IntelFlashFileSystem.java +++ b/src/main/java/firmware/ifd/IntelFlashFileSystem.java @@ -40,9 +40,13 @@ public IntelFlashFileSystem(FSRLRoot fsFSRL) { public void mount(ByteProvider provider, long offset, TaskMonitor monitor) throws IOException { this.provider = provider; BinaryReader reader = new BinaryReader(provider, true); + boolean hasZeroVector = offset >= 16; - reader.setPointerIndex(offset - 16); - IntelFlashDescriptor ifd = new IntelFlashDescriptor(reader); + if (hasZeroVector) { + reader.setPointerIndex(offset - 16); + } + + IntelFlashDescriptor ifd = new IntelFlashDescriptor(reader, hasZeroVector); List regions = ifd.getRegions(); for (IntelFlashRegion region : regions) {