[工具] 旧版 BIOS Boot Manager 编辑器

Finally got the time to write a legacy BIOS Boot Manager editor. Microsoft started compressing legacy BIOS Boot Managers after it got too big to fit into the 640kb of initial memory, and it’s quite annoying if you want to modify it for whatever reason.

The compression isn’t the worst thing. A compressed Boot Manager can be split into 4 sections – 16-bit loader, data location structure, PE stub and compressed buffer. There are tools out there to help you to recompress the buffer, but none of them can correct the PE checksum of the PE stub. This means even if you recompress your modified Boot Manager, Windows Setup will refuse to install it because it does not have a valid checksum.

So here is my Boot Manager editor, it allows you to extract and replace the 16-bit loader, the PE stub and the actual Boot Manager executable, and you can also create a compressed Boot Manager from scratch with it.

Pre-Windows 8 Boot Managers used LZNT1 compression, and post-Windows 8 Boot Managers use Xpress Huffman compression. You can change the compression format, but you’ll also need to change the 16-bit loader since it is what decompresses the Boot Manager executable in memory.

When you save the edited Boot Manager, it’ll automatically correct the PE checksum of the PE stub for you. With this tool you can now easily patch flightsigned Windows 10 builds to boot in legacy BIOS mode – patch the extracted bootmgr.exe in the same way as you patch bootmgr.efi, and then use the editor to replace the original executable with your patched executable.

This tool is currently still WIP, so if you encounter bugs make sure you report them to me. It will only run (correctly) on Windows 8+ by the way, because Windows 7 does not have all the APIs required.