May 29, 2000
By Karen Kenworthy
IN THIS ISSUE
Wish me well. I'm about to wander into a swamp. And I owe it all to my buddy Bob, the nice fellow who inspired the URL Discombobulator. Unable to leave well- enough alone, he recently made another suggestion. And I didn't have enough good sense to say no. :)
What? You'll come with me? Thanks! You don't know how much this means to me. I *really* don't want to take this trip alone ... Are you ready? Let's get started!
It's A Setup
It was just last week when Bob wrote to me. He ran Control Panel's "Add/Remove Programs" applet, and its list of installed programs was littered with the names of programs that had long since disappeared. Somehow, these programs had been removed from his computer without the help of the program's built-in uninstall feature. Yet their evictions were news to his Control Panel. It still valiantly offered to do the job for Bob.
I know this is a common problem, because I'm asked about it often. And because it's happened to me. Now I would never remove a program by hand. You can ask my Mom. I *always* use the program's uninstall feature, if available.
But somehow that hasn't protected me from Bob's problem. Perhaps some uninstall routines failed to remove all traces of their parent program? Or perhaps an evil elf sneaks into my room at night and tinkers with my computer? Whatever the reason, like nearly everyone else, my Control Panel's list of installed programs is haunted by ghosts.
Fortunately, exorcising these ghosts is relatively easy. The Control Panel keeps its list of installed programs in the Registry, at a location known as HKEY_LOCAL_MACHINE\ Software\Microsoft\Windows\CurrentVersion\Uninstall. There you'll find one Registry "key" (something like a disk folder) for each program you've installed. Within each key will be one or more Registry entries, proving information about the program, including how it should be uninstalled.
As their final act, uninstall routines are supposed to remove their program's Registry entry, signally Windows that the program has left the building, err, computer. But every once in a while one of these Registry entries gets left behind, creating a "ghost."
Other ghosts materialize when a program is installed more than once (creating multiple Registry entries), but uninstalled just one time. If the program's uninstall routine isn't clever, it will remove only one set of Registry entries, overlooking the duplicates. These orphaned entries become Control Panel's ghosts.
Hmm... Orphaned Registry entries. That problem sounds familiar. Do you remember the Registry Ripper? That Power Tool identifies and removes "SharedDLLs" entries from the Windows Registry. Could it solve this problem too? Well, no. Not without some changes. But it's a start.
So a few days ago I set to work to create Registry Pruner version 2.0. This new edition can display all program names found in Control Panel's section of the Registry. It also does its best to determine which of those programs are still installed, and which have gone missing. If it believes it's found a ghost, it flags that program's name and offers to delete its Registry entry. If you accept the offer, the program will no long appear in Control Panel's list of installed programs.
Scanning the Registry, looking for program names, turned out to be easy. Each program's name is kept in a Registry entry named DisplayName, found within the program's Uninstall Registry key. The new Registry Pruner just locates each of these entries, and displays their contents in its main window.
But deciding if a program is alive or dead is more difficult. Along with their name, most programs store an uninstall command string in the Registry, in a key named UnstallString. There, you'll usually find the name of a program, plus some command line parameters. A typical entry looks something like this:
"C:\Program Files\CoolProg\prog.exe" /uninstall
When asked to remove a program, Control Panel simply executes this string, running the program it references, passing that program the parameters found in the string. It should be a simple matter for the new Registry Pruner to examine this string, locate the program name it contains, and see if that program still resides on the hard disk. If not, this Registry entry is a ghost.
Now we're at the edge of the swamp. It turns out a surprisingly large number of programs store invalid UnstallString information in the Registry. Often, the entire command string, including parameters, is enclosed by a single pair of quotation marks. Intended to permit spaces to be a part of the uninstall program's path, this mistake causes the command's parameters ("/uninstall" in the example above), and the spaces that precede them, to appear to be part of the program's name.
More malformed UninstallStrings come about when no quotation marks are present. In the example shown above, if the quotation marks are removed, the program to be run becomes "C:\Program." Two parameters are passed, "Files\CoolProg\prog.exe" and "/uninstall."
Other problematic Uninstall Strings rely on a Windows program called RunDLL32 to start the un-installation process. Checking to see if RunDLL32 exists isn't helpful. The important question is, does the DLL it is asked to run still exist? And picking the DLL's name out of the parameters passed to RunDLL32 can be a tricky business. Often it is packed into a dense string of text and punctuation marks.
So, where does that leave us? About knee-deep in the swamp, as near as I can tell. After a lot of work, the new Registry Pruner has become a pretty good ghost hunter. It's probably not perfect, but it's pretty good. Besides, the Pruner only makes suggestions. The final decision to remove a program's Uninstall Registry key is still up to a human being (you and me). And we should know what programs are still installed, and which programs are missing.
And in the improbably case we make a mistake, the Pruner comes to the rescue. All Registry entries it removes are first saved in a file named AddRemove.REG, stored in your Windows directory (often C:\Windows). If you realize a Registry entry has been removed by mistake, just double-click this file's icon and presto! The once-lost entries are now restored.
The Registry Pruner knows one other new trick. In addition to displaying Control Panel's list of installed programs, it can also display a previously hidden list of program components. This allows you to remove these entries from your Registry too, once the main program has been removed. To see, and optionally remove, component entries just check the "Show program components too" checkbox, on the Pruner's main window.
Lest you think this is an awfully small swamp we've found, we're not back on dry land yet. The world of installation programs, and their uninstalling counterparts, is large, dimly lit, and full of frightening creatures. The new Registry Pruner has gotten us safely this far. But we'll need the help of some other programs, and a new Windows feature or two, to finish this sojourn.
Sadly, the rest of this journey must wait until another day. In the meantime download the latest Registry Pruner. You'll find version 2.0 on my Web site at https://www.karenware.com/powertools/ptpruner. While there, you can download the program's Visual Basic source code too. As always, both are free.
I'll use this coming week to lay in supplies. I think I saw a sale on hip-waders somewhere on the Internet. If the price is right, I'll pick up a pair for you too. And if you see me shopping before we set out again, be sure to wave and say "Hi!" I'll be the one in the pith helmet. :)
Power Tools Newsletter
- Directory Printer v5.4.4 Adds Unicode Characters Support
- Replicator v3.7.6 Eradicates Bug that caused Error 3
31620 Verified Subscribers
Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.Click here to Subscribe