Recovering Windows XP from a corrupted registry

In the workshop at home I have a terribly old PC. It’s got an AMD Athlon XP CPU at a blistering 1.48GHz, and runs Windows XP. It’s mostly just got on with the jobs I ask of it (although its power supply has featured in the blog before) but in the last week it’s failed twice. I suspect there’s a hardware problem, given that the machine is approaching its 15th birthday.

Img_1229

The symptoms have been that the machine would be working normally and then the screen would go black, with no response from the keyboard or mouse and no disk activity. Pressing the PC’s reset button brought it to life again. but with the dreaded message, “Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM”.

A quick web search revealed the official repair procedure from Microsoft: How to recover from a corrupted registry that prevents Windows XP from starting. The procedure looks like this:

  • Boot the machine using the XP install CD and enter the recovery console
  • Copy the five registry hives (system, software, sam, security and default) from \WINDOWS\SYSTEM32\CONFIG into a backup location
  • Copy default registry hives from \WINDOWS\REPAIR in their place
  • Boot into Windows and use the desktop to copy backup registry hives created by System Restore into a temporary location
  • Reboot into the recovery console again
  • Copy the backup registry hives into \WINDOWS\SYSTEM32\CONFIG
  • Reboot into Windows again (yawn)
  • Use the System Restore utility to restore the system to the most recent restore point.

I did this the first time, and it turned out to be an awful lot of fiddling around just to restore a backup of five files. One problem is that installing the default registry hives and booting Windows makes a mess of the user profiles, which is why the later system restore is required. As far as I can see, Microsoft recommend this procedure simply to avoid people having to dig around in the filesystem at the recovery console.

The next time the same fault occurred, I decided to try a short cut. This is what I did.

  • Boot the machine using the XP install CD and enter the recovery console.
  • Copy the corrupt registry hive (system) from \WINDOWS\SYSTEM32\CONFIG into a backup location, just in case
  • Still in the recovery console, find the most recent backup created by System Restore
  • Copy the system registry hive from there into \WINDOWS\SYSTEM32\CONFIG
  • Reboot into Windows and start working again.

The tricky part about this is that the system restore folder names are really long and unpleasant to type, and the recovery console doesn’t have command completion. However, you only have to do it once.

First, find the most recent _restore folder in \System Volume Information:

Img_1230

Then, the most recent RPxxx folder inside there:

Img_1231

That folder will contain a ‘snapshot’ folder, inside which are the registry backups. Copy the relevant one into \WINDOWS\SYSTEM32\CONFIG. Note that the filenames are different:

Img_1234

Type ‘exit’ to reboot, and that’s it. Job done. It worked for me: a ginormous download that Firefox had been working on continued exactly where it left off, and I’m typing this on the very same machine.

It would probably be possible to do exactly the same process using a bootable Linux CD, too, as long as it was capable of reading and writing NTFS filesystems in a trustworthy way.

Incidentally, all this is only possible because XP automagically saves backups of important things using System Restore. Say what you like about Microsoft, but that’s a really useful feature.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s