Tag Archives: Registry

Windows Registry Adventure

“Don’t screw around with the Windows registry.”

That’s something I’ve told both users, helpdesk techs, and even IT managers for nearly a decade. “If you change something in the registry you don’t understand, you can render your system unbootable.” And yet, over the last 10 years, I’ve had my fingers pretty deep in the registry several times – especially with my high capacity terminal servers. But it wasn’t until this week that I really had my first stumble, and it was quite an adventure.

Read on for the exciting adventure in gory detail.

<!–more–>It all started with an attractive promise made by the folks at <a href=”http://www.kaxaml.com/”>Kaxaml, a lightweight XAML-optimized text editor</a>.  It seemed like a cool app, and I like to dip my toes into new types of programming from time to time to see if anything sticks.  After all, mere exposure to a myriad of new technologies puts you at the head of the pack in the IT world.  Honestly, most people don’t even know what <a href=”http://en.wikipedia.org/wiki/Xaml”>XAML</a> is. 

So I downloaded the MSI for Kaxaml, which requires the .NET framework version 3.0 or greater.  WinFX, or .NET 3.0, is relatively new, and for most people, there’s little need to run this right now, so naturally, my work laptop, which has steadily chugged along on XP SP2 for several years, didn’t have it installed.  So I downloaded the .NET 3.0 setup files from Microsoft.  Halfway through the installation, I got an error message saying that the .NET framework could not be installed because I had the “beta 2” version of “Windows Presentation Foundation.”  Fair enough. 

But the problem is, you can’t uninstall WPF beta 2, at least not directly.  You need a special uninstaller, downloadable from Microsoft, once you’ve validated yourself with your Passport, natch.  

So I downloaded the WPF beta 2 uninstaller.  And after it ran for a bit, it shared a tidbit with me about being unable to access a particular registry key HKEY_CLASSES_ROOT .xaml or somesuch (It did provide me the entire reg path).  So, feeling brave and confident, I called the ‘ol Start > Run > Regedit and drilled down to the key in question.  

Wouldn’t you know it, I didn’t have rights to the little bastard.  How can that be? I’m an admin, I certainly installed this myself, I’m using the Microsoft uninstaller.  So, I tried to grant myself rights, but alas… no go. 

So, my next step, being tempted by Kaxaml to see what it was all about, was the navigate to the HKEY_CLASSES_ROOT element and grant myself inheritable rights to the entire hive.  After all, I’m an admin, so what harm could this do? 

A lot, it turns out.  See, after that happened, I started having some troubles with Windows, like immediately! First, I noticed that right clicking files only gave me a few options: cut, copy, paste… that’s about all.  I borked my shell.  

So, I rebooted.  Whoops! That’s a problem, because when I log in, I see nothing. Nada, zero, zilch, squadoosh, a big ‘ol goose egg.  So, I issue Ctrl+Alt+Del to bring up the task manager, which runs, but when I select a new task and type any command, I get an error about being unable to find any program to open this application.  Doesn’t open Explorer, doesn’t open regedit, doesn’t open “cmd.” Huh?

So, I reboot into safe mode to get to the registry again, but guess what – no shell.  I’m f’ed.  My staff tells me to hit up the recovery console, but I’m scared because I have A LOT of data on this machine, and the recovery console has a long and sordid history of screwing up user accounts, so I opt to hammer away a little longer.  

Then, via <a href=”http://google.com”>Google</a>: A new trick! Holding down the shift key can produce a terminal window.  And guess what – EXE files launch! Weird, right?  

So I can get into the registry and I can get into several other apps now, such as a brower, but not Explorer.  Okay, we’re one step of the way there.  I get into the registry and attempt to give myself access to the HKEY_CLASSES_ROOT hive again, but guess what – now I have no permission to the ENTIRE HIVE.  The entire thing is blanked out.  Google is not much help.  

Eventually, I reboot an login as the local administrator, only to find the same problems, but this time, in the registrym with enough fooling around, eventually, I get the shell to run again, huzzah! But alas, no icons, just blank gray default icons where everything should be.  Not a single one shows, not a single one works.  In fact, even the Quick Launch toolbar is icon-less.  Still useless, but progress, nonetheless.

At this point, I’m getting tired of this nonsense, certainly feeling as though Kaxaml is not worth it, and upset I fooled with the registry to begin with.  My otherwise happy machine is truly useless.  Then, finally, after a million or so Google results, way too many cached pages, and lots of technet articles that didn’t help one iota, I find something.  I get back into the registry via the crazy Task Manager > Command Line > regedit trick from before, and give it a shot.  The recommendation is to grant “Everyone” full control to the entire CLASSES_ROOT hive.  At this point, why not? So I do, and like magic, all of my icons light up in full color! Shazam! 

..But it’s short lived, because nothing works.  None of my EXE files launch, they still give me an association error.  Turns out this is a common problem (although one I’ve never encountered with with NT since version 4: I’ve lost my associations for EXE files.  Actually, I had suspected this before, except the only way to change it is via Explorer, and I couldn’t get any explorer windows to open before, neither via the GUI or the terminal.  So now, with a still hobbling machine, I double click “My Computer” and get a window – thankfully.  I then drill into Tools > Folder options and associate “EXE” with “Application.”  And like magic,  it works.  The machine is restored in  full working order, full color, full function.  Ha ha, recovery console be damned.  

Except one thing: I still have WPF beta 2.  And guess what? I’m fine with that.  Sorry, Kaxaml, maybe on my next laptop?

I realize that the entirety of this adventure was based on me screwing around with my own registry against the suggestion of Microsoft, but it ought to remind everyone that even a seasoned technician can still make a mistake, and the registry is not a toy.  

So I remind you all, gently, “Don’t screw around with the Windows registry.”

Tagged , ,