Friday, 21 August 2015

MPI Tool Kit v0.054 available (BitDefender/grub2 bugfix)

Due to a weird issue with one of the files on my system, whenever I used the MPI Tool Kit to convert the BitDefender Rescue CD ISO to a .imgPTN file, it always worked (for me!). However, as no one else would have this 'undeletable' file on their system, it turns out that converting a BitDefender ISO (and probably many other grub2 ISOs) to a .imgPTN file probably did not work for anyone else!

I compared a working .imgPTN file with a non-working one and the problem turned out to be due to the \boot\grub\i386-pc\command.lst file being a binary file (despite having a .lst file extension!), but it was getting corrupted by MPI because it was processed as a text file!

MPI changes some strings (e.g. UUID and volume label, etc.) in some text files, using ssed.exe (a version of sed) .

To fix the problem, I needed to find out if each *.lst file was a text file or a binary file and ignore any binary files.

This proved to be quite tricky as Windows does not seem to have a way to detect if a file is a binary file or not (that I could find).

In the end, I used ssed.exe to find and replace any 00 hex bytes in the file with the characters "ZZXXZZ" and then used the Windows find.exe utility to see if any substitution had taken place.

::check for binary file
ssed   "s/\x0/ZZXXZZ/g" "%~1" > sed1.txt
find "ZZXXZZ" sed1.txt > nul
if not errorlevel 1  echo %~nx1 IS A BINARY FILE && goto :quit

Not elegant, but it works!

If you are having trouble getting BitDefender or other grub2 ISOs to work as .imgPTN files, please download the MPI Tool Kit v 0.054 and then run the CreateDesktopShortcuts.cmd script to update your shortcuts to point to the new version.

This version also has improved MBR recovery in case you accidentally trash your E2B drive (for example by accidentally installing grub2 to the MBR and the following sectors). A backup copy of the MBR is now made to the file \e2b\MBR.BIN as soon as you boot to the CSM menu. Once you restore the MBR from this file (by using BootIce or RMPrepUSB - File->Drive), you can re-install grub4dos to the MBR using RMPrepUSB and your E2B USB drive should be operational once again.