I posted earlier on using VirtualRegistry to provide version lies when an application is looking for the version of the operating system in the registry instead of using one of the GetVersion APIs. I could go on and on about all of the other command line arguments that do interesting things, but that is actually the subject of a forthcoming update to the help file itself, so I'm going to focus on the interesting ones here.

Probably the most interesting one is the command line argument that allows you to redirect any one key to any other key. Why is this one so compelling? Because it can resolve almost every issue you could possibly come across.

You see, the rest of the command line arguments do specific fixes. They can pretend that certain keys exist, and that they have certain values. They can redirect registry keys to other places. But you have to get lucky and happen to find one that is redirecting the keys you need to a place that works for you. In the case of version lies, this is something that comes up quite a lot, and you can completely re-use that. There are command line arguments around various versions of DirectX and codecs, all of which either redirect or pretend.

But redirection can be a form of pretending. If you want the version to say 5.0, but it says 6.0, if you know the command line NT50 that's a very effective way to do that. But, what if you didn't know this command line (which until recently is probably the case)? What if there is an existing command line for a problem you have, but you don't happen to know that one, and I haven't talked about that yet? You can achieve the same effect using redirection.

For installation, I simply repackage the application so I create a new key that contains the value 5.0. I redirect the key I'm looking for, say HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Current Version, to HKEY_LOCAL_MACHINE\Software\My Company\Vendor\App\Nt Current Version, and then populate that key with the value of 5.0. I then redirect to this new key, and voila - I get the same version lie.

Yes, it requires me to drop a key, but you can see that I can create whatever I need, and use redirection both for redirecting to user-writeable locations as well as lying about existing values (which don't need to be user-writeable necessarily).

That being said, what's the command line to use?

ADDREDIRECT(key_to_redirect_from^key_to_redirect_to)

If you have multiple keys to redirect from and to, then you can just chain them together, separating each with the caret (^) symbol.

With this fix, there should be almost no registry issue you can't resolve somehow, as long as you don't limit your thinking on what a redirect is supposed to do. Remember, you can always repackage if you need to add some new values to redirect to.

Now, I mentioned earlier that you can resolve almost any issue that you could possibly run across. Why didn't I just say every issue?

Partially because I doubt that my own creativity can rival the combined creativity of the rest of the software developers in the world for coming up with registry issues that could cause problems in terms of application compatibility.

Also, there is a limitation to how much you can redirect. In fact, the sheer scope and power of what you can do with VirtualRegistry is not completely exposed because of one simple limitation: the number of characters the Windows Shim Infrastructure supports in a command line argument. It's simply not long enough. So, the developers on the Windows team would implement the things they needed in code (no limitation there) and assign a name to it that was nice and short, this name either being the name of the application or component, or the nature of the problem.

You may bump into the same thing, if you have a host of keys to redirect. In which case, then you may want to browse the forthcoming documentation to see if perhaps an existing command line argument will cause the keys you need redirected or lied about. Personally, I haven't experienced this problem with a customer, but it could potentially happen.

Nonetheless, you can take this incredibly powerful shim, and this incredibly flexible command line argument, and resolve a host of registry-related issues on Windows Vista.