Recovering from Windows registry hive corruption, the clever way.
by Carl Farrington on Jul.26, 2008, under Computer Stuff, Tips & Tricks
I like this trick. Every time I do it, I think about all those people doing repair installs (in-place upgrades).
It works pretty much every time unless the filesystem is really truly screwed, in which case you need a backup, say from the system restore directory (System Volume Information), as per this knowledgebase article (don’t bother with the recovery console though, use your USB to IDE or USB to SATA cable and fix it from your laptop.)
Here are the symptoms. You try to start up your Windows 2000/XP (Vista too?) computer and you get a message, white text on black background:
Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM
or
Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SOFTWARE
Sometimes, the message is cut short, so you might see “\WINDOWS\SYSTEM32\CONFIG\SYS” or similar. Hint: If it’s really cut short, and you can’t see if it’s SOFTWARE or SYSTEM, do the following procedure on both files. Whichever one is identified as having been repaired, well that’s the one that was broken
Anyway, how to fix it in 2 minutes:
Use your USB to IDE/SATA adapter cable, and connect the broken machine’s hard drive to your laptop, or your spare PC or whatever. You don’t have to use a USB to IDE/SATA adapter cable – if you’re a person at home with another PC you can stick the drive on a spare IDE or SATA channel. You just need to get that hard drive into a working Windows XP computer for a few minutes.
Windows will mount the broken computer’s hard drive as, say E: or F:. Make sure you have your computer set to show hidden files and also system files. To check this, go into My Computer -> Tools -> Folder Options, -> View Tab, and select “Show hidden files”, and make sure “Hide protected operating system files” is not ticked.
First things first, run chkdsk on that drive, after all it is most likely filesystem corruption that has caused the registry to become corrupt in the first place. In My Computer, right-click the broken computer’s drive and choose properties. Go to tools, “Check Now”, put a tick in only the first box (Automatically fix filesystem errors), and click start. Let that finish before continuing.
Here’s where the magic happens. Go to start -> run, and type regedit [enter]. This will launch the registry editor on your computer. In the registry editor, highlight HKEY_LOCAL_MACHINE, and then go to File -> Load Hive. Find the file that is “missing or corrupt” (from your error message earlier), and choose to load that. It will be in E:\(or F:\)Windows\System32\Config, and will be called just SOFTWARE or SYSTEM. Regedit will ask you to name the hive, just type “badpc” (any old garbage will do – it’s only temporary).
Regedit will say “One or more files containing the registry were corrupt and had to be recovered by use of log files. The recovery was successful.” You have just repaired the registry! Now you need to Un-load that hive, so highlight that “badpc” hive that you can now see under HKEY_LOCAL_MACHINE, and go to File -> Unload Hive.
You now just need to put that hard drive back in the broken computer, which hopefully won’t be broken any more! If you used a USB to SATA or USB to IDE cable from your laptop, make sure you use the “Safely remove hardware” icon in the system tray next to the clock to safely remove the hard drive, else you may cause filesystem corruption again. Alternatively just shut your laptop/working computer down properly and remove the hard drive once it’s shut down.
All done.
Some background:
The registry is a database. It has transaction log files which can be used to recover from corruption. It would appear that the early Windows boot process is not able to work with those log files, but regedit (and Windows itself further on in the boot process) is.
September 17th, 2009 on 9:39 pm
This was so easy to do and it worked perfectly!
Thank you!!
September 18th, 2009 on 4:28 pm
Worked like a charm!
September 24th, 2009 on 10:45 am
I like this trick!
October 2nd, 2009 on 12:12 am
I love you
October 5th, 2009 on 6:40 pm
What causes this problem? Why does the file get corrupted and can it be caused by a virus? If so, can the computer which we use to fix the broken one get infected when connecting them together?
(please reply to my e-mail) Thank you.
October 11th, 2009 on 12:34 pm
Hey unfortunately it didn’t work for me. I did as u have said. But when i load it dose not say it has “repaired”. But just creates it. So when i re-boot the same problem prevails.
BTW the the error message says that the “system” file that is missing when re-booting which i did as u have said.
Note:(before reading ur article) I did a stupid thing like copying the files within the config folder of the working machine and pasted on the corrupted one, which made some files to be replaced. But not the SYSTEM file as it said “It is being used and can not be copied!!
Any Idea????? Please!! Would be a great help!!
Thanx!
October 21st, 2009 on 5:34 am
My symptoms were the same as you described. I ran chkdsk /f on my C drive and it repaired some of the corrupted items. After loading the “system” hive, I did not get a message that it was repaired. I unloaded the hive and restarted my computer and it booted windows!!! For me, loading the hive may not have been necessary. Thanks for your instructions!!!
November 5th, 2009 on 6:03 am
Whenever I try to import the system file the machine reboots and says it’s recovered from a serious error.
December 7th, 2009 on 7:36 pm
Thanks SO much…..you saved me lots of time and aggravation! I stumbled on this by accident……..thanks so much for your generosity in posting!!
December 13th, 2009 on 5:46 pm
Thank you so much. This solved my problem in a few minutes (after having wasted my time for hours with the windows recovery console).
Thank you, thank you, thank you!!!!!!!!!!
December 14th, 2009 on 8:09 am
Thanks for your instructions, but they haven’t worked for us. Maybe the file system is truly screwed, as you mention at the beginning of the article. We used the McAffee clean-up before the netbook started showing us that error; could we have deleted the wrong files?
It would be great if you could show us some pictures of how to do this as many of us are unsure of what some things you mention actually are. For example, we used a USB to USB cable to try to fix this problem. Is that not good enough?
January 3rd, 2010 on 4:41 pm
Can this be done if the bad hard drive is using XP, and my laptop is using Vista?
January 17th, 2010 on 3:41 pm
I have this same problem on an older model toshiba satellite laptop. it wont boot from cd and changing the boot order does not help. should i put a pin in my hard drive to make it a slave? the only thing i can do is hold down the escape key until says “check system ” and hit F1 which sends me to the system start up and that is where i try to change the boot order but no luck ,it changes but goes back to same message. if i hold down F8 i get another menu but all of the options dead end in the same result pleeeesae help me
February 7th, 2010 on 12:04 am
that was really great. I love people who work and think like you did.that was really great.great tech you should be. from Cameroon.
February 18th, 2010 on 12:02 am
Absolutely terrific. You have saved me many hours of frustration and reloading all for the cost of a usb / hard drive adapter at Comp USA — I can’t say thank you enough!!
February 24th, 2010 on 8:35 am
I made a tool to automate restoring an old registry snapshots to replace a corrupted registry hive. It saves you the time of typing all the commands or dragging and dropping. It can be run from a windowsPE Disk or if you slave the offline drive to another computer. Please let me know if you find any bugs I have tested on a few computers with no issues.
http://whatsmypass.com/files/HiveRestoreXP.zip
It’s free free free
March 9th, 2010 on 11:44 pm
wow, that’s awesome. Thanks.