In this article, we will look at how to create a Registry redirection and make the application point to a new hive instead of the old one!
The Compatibility Administrator tool enables you to resolve many of your potential application-compatibility issues before deploying a new version of Windows in your organization. This tool enables you to create customized compatibility fixes, compatibility modes, AppHelp messages, and compatibility databases. To know more on how to create one and implement it, Read – Creating a Shim/Fix Using Compatibility Administrator.
Scenario: When I launch this application, and press on the browser button, i get a error dialog which says “The browse functionality requires IE6″. Windows 7 comes with IE8 as the default browser and we do not have any options to downgrade it to IE6.
On analyzing with Process Monitor (a Sysinternals tool) and clicking the Browse Button again, we will see a detailed report on all the resources this application action accessed. In this below dialog, you can find that this action has actually checked the IE Version number in the registry hive.
I reckon that the developer of this application had some functionalities which was working only with IE6 (at that time – legacy app), and hence, he would’ve added this as a launch condition. As IE8 is a higher version, and it would have a backward compatibility.. we will just need to comment this condition of checking the browser. Now if we want to send this application to the developer again to fix this simple stuff, it would involve lots of efforts of re-compiling, testing, communication etc. This is where, the shims come into picture.
In this post,we will create a new registry hive and path; make this application to point to the new hive, when the quering is done. VirtualRegistry Shim exactly helps us in doing so.
Step 1: Create a new registry key which would mimick the original registry key. Instead of HLM->Software->Microsoft->Internet Explorer->Version, I will create a new hive in HKLM->Software->msigeek -> Fix Apps ->Internet Explorer->Version
Step 2: Launch the Application Compatibility Administrator, and create a new Application Shim. Select VirtualRegistry Shim and press the parameters button. This will give you options to configure the paths. You will need to use the ADDREDIRECT command.
Step 3: Give the parameter for this shim.
ADDREDIRECT(oldpath^newpath) is the general syntax. In our scenario, we will give it as ADDREDIRECT(HKLM\Software\Microsoft\Internet%20Explorer^HKLM\Software\msigeek\Fix%20Apps\Internet%20Explorer). You will need to give %20 to signify empty spaces.
Step 4: Apply the shim and test the application.
Now, when I launch the browse button, the Internet Explorer window opens. What happens in background is that, a condition is checked for the old path and this shim redirects it to the new one. This passes the condition and launches the browser!
This mitigation technique can be used for any registry path redirection. If you have any application which is hard-coded and checks a particular registry key, this technique can make it refer a new path and hence pass the condition. You must keep it in mind that, this would just pass the condition (in simple words.. just a return true). This does not ensure or simulate the platform. So only when you are sure that, the application functionality can be achieved and this condition is just a road-block.. you can use shims to mitigate these kind of issues.
If you have issues with Hard-coded file paths, then do read this article!