Hoo boy, this one’s a doozy.
So following the removal of certain rootkits (such as Rootkit.Boot.SST.a, which is associated with the Windows Recovery rogue), you may find that your Windows boot configuration data has been totally corrupted. Worse yet, the usual steps to remedy (such as those described in my earlier post about TDL4 and the resulting blue screen) all fall apart when you reach the bootrec /RebuildBCD command, which returns the message:
Total identified Windows installations: 0
Geez. This essentially means that the bootrec command cannot identify your Windows installation, even though the Windows Recovery Environment has no trouble doing so upon starting. So, now what?
Sometimes it’s as simple as opening up your favorite disk partitioning software and marking the C: partition as ACTIVE, and if there are still problems, subsequently recovering the boot data as I mentioned in the TDL4 post (keep in mind however that the System Managed partition is typically Active normally on a Windows 7 system thanks to the isolated boot partition that it uses). This problem occurs because of some modern rootkits which create a hidden, encrypted partition at the end of the system drive and mark it as Active and Primary (while simultaneously marking the standard boot partition as Inactive). This infection has been covered in other recent blog posts as well.
Sometimes, however, the BCD is totally corrupted and this doesn’t even work. At this point, most every source on the internet comes up a dead end. Everyone ends up reformatting or reinstalling Windows overtop their existing partition; nothing else seems to work.
You might not think it’d be helpful, but there’s an intimidating post over at the EasyBCD NeoSmart site which explains how to manually rebuild the Vista bootloader from the ground up in catastrophic situations. As it turns out, this procedure applies to Windows 7 as well (which uses the same bootloader and BCD structure), and it’s the key to your recovery here.
It’s no easy feat however, so roll up your sleeves and get ready to do some typing. Here’s the full procedure from start to finish:
- Boot to the Windows Recovery Environment either by selecting Repair Your Computer when Windows fails to boot, by inserting the Windows installation disc, or by using a Windows ERD/MS DART disc (if you happen to have access to one, that is).
- Cancel the recovery attempt if it tries to start on its own (it will fail anyway) and then choose the advanced options link at the bottom of the window.
- Choose to open the Command Prompt.
- Here’s the fun part. Once at the prompt, enter the following commands one by one. Take care not to mistype anything, and be sure to replace C: with whatever your system drive happens to be:
bootrec.exe /fixmbr
bootsect.exe /nt60 all /force
bcdedit /export C:\BCD_Backup
attrib -h -s C:\boot\BCD
ren C:\boot\BCD BCD.old
bcdedit /createstore c:\boot\bcd.temp
bcdedit.exe /store c:\boot\bcd.temp /create {bootmgr} /d “Windows Boot Manager”
bcdedit.exe /import c:\boot\bcd.temp
bcdedit.exe /set {bootmgr} device partition=C:
bcdedit.exe /timeout 10
attrib -h -s C:\boot\bcd.temp
del c:\boot\bcd.temp
bcdedit.exe /create /d “Windows 7” /application osloader
At this point, note the value within the curly braces {……..} as you will need it during the next steps. Replace the dots within the curly braces below with that entire string on each line. NOTE: To make this easier, once you type it once, you can press the Up arrow to restore the last command and simply edit that line for the next one.
bcdedit.exe /set {…..} device partition=C:
bcdedit.exe /set {…..} osdevice partition=C:
bcdedit.exe /set {…..} path \Windows\system32\winload.exe
bcdedit.exe /set {…..} systemroot \Windows
bcdedit.exe /displayorder {…..}
bcdedit.exe /default {…..}
bcdedit.exe /set {…..} locale en-US
Thanks to Bitt Faulk for the final line, which restores the correct Windows loading screen as well. You will need to replace the en-US entry with something different representing your region if you are not in the US.
Then you’re back in Windows, miraculously. No reinstall necessary!
Side effects? A little. Hopefully you can handle not having the nifty new Windows 7 startup animation screen, because this will lose it for you. Instead, you’ll be stuck with the old-school plain Jane Windows Vista progress bar. You’ll also lose any special boot options you had previously. But as a last resort, this works, and it’s still just as quick as ever.
Apart from that, once you’re back in Windows, of course, you’ll still have to disinfect the rest of the way. In my customer’s case, the system damage was actually so bad that I ended up performing an in-place upgrade (the Vista/7 equivalent of a Repair Install), but after that, everything was great. It was a triumph for sure, and yet another situation where the usual solution of reformat/reinstall was not necessary. Now you know how to avoid it!
I hope you’ve found this post useful–if so, please take a moment to leave me a comment!
If you need computer help in the Louisville, KY area, there’s simply no one better. Give me a call today!