Fix OS Version Number Issues with Shims / Compat Modes in Windows 7 – AppCompat Series


October 19, 2009

In this first part of the AppCompat Series, we will look at the significance of the OS version number change (6.1 in Windows 7) and how will this impact the existing applications. We will also look at the ways to mitigate them. The internal version number for Windows Vista is changed to 6.0 and 6.1 for Windows 7.  The GetVersion function will now return these version numbers to applications when queried { dwMajorVersion (6) and dwMinorVersion (0 or 1) }.

Any application that specifically checks for the OS version may get a higher version number which it may not be designed to handle. Setup packages may prevent themselves from installing and applications may prevent themselves from starting. Summing up, when a developer writes the code to check for the version numbers, there are some potentional issues with few of the applications.

  1. They only check the dwMajorVersion (These application will only install in Windows 2000,XP and Server 2003)
  2. They hardcoded the Version checks { if (majorVersion = 5 && minorVersion = 1) } (These application will only install in Windows XP)
  3. They implemented a wrong condition check { if (majorVersion > 5 && minorVersion > 1) } (Though the check condition loooks correct, this fails on Windows Vista)

The windows Team suggests the developers not to use the Version Numbers Checks in their applications !!

Mitigations

For new applications,

  1. Best Practice is to check for features instead of versions
  2. Look for OS versions greater than (>) compatible OS version

You can get the version numbers for all the Windows OS here

For existing applications,

Method 1: Compatiblity modes - Right click on the executable (StockViewer.exe in this example), goto the compatibilty tab. You will find all the previous operating systems. You can select the version in which it had worked/installed. Click on Apply and close the window.  Now you can invoke the executable.

comp_modes

Method 2: Applying Shims / Layers – If you are planning to deploy this fix to all the machines where this application needs to be installed. You can use this option. In this method, you can create a shim using Compatibilty Administrator and install this shim database file(sdb) file.

Compatibilty Administrator is a part of the Application Compatiblity Toolkit 5.5, which can be downloaded here

Step 1: Launch the Compatiblity Administrator, and create a new application fix

comadm

Step 2: Select the Compatiblity modes, Click next, and complete this dialog.

selectshim

On completing the dialog, you can see the shim which was just created.

shimsapplied

Step 3: Install the Shims which was just created.

installshim

Step 4: Now launch the application.

You can also deploy this sdb file to all the machines, where this application is to be installed. (you can either export these mitigations as an MSI, or run this in a command line using sdbinst.exe)

Both of these above methods add the Compatibility layers in the registry key – HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\[app path]

PS: This OS fix is only an interim solution and cannot promise complete functionality. Getting back to the Vendor for the compatible version is always a better practice.

The Complete Application Compatibility Series







If you’re not a subscriber, you can have msigeek blog notifications delivered to you free via these options: RSS Updates , Email Updates and SMS Alerts.

  • Sumesh

    Gr8 One..I never heard about these option before and now its time for me to try this on some applications :) ..Thanks for the article,VJ..Keep it up.

  • http://www.thewindowsclub.com/ AnandK

    Quite a detailed & informative article, Vijay. Thanks for this !

  • Satnix

    Sounds perfekt:

    Now, when we have an app (exe), installed on machine with Compatability issue almost resolved, We can take a snapshot and create MSI. I used this method and it worked in almost all cases for me while packaging apps for Vista. Though its lengthy but I think its easy to do this rather going thru the ACT way. Also, adding the registry to app is another cool way to get out of compatability hangover :P

    Good work VJ

  • Sumesh

    VJ,

    I tried installing Webex,Remedy etc ,i followed the method which you mentioned and it is working soo well in W7..Now i dont need Windows XP Mode VM running..Thanks sooo Much..Gr8 Job….Waiting for More.

  • msigeek

    Thanks a ton for your comments Sumesh. I'm glad that, it worked for you..!

  • Vivek

    QUiet stright forward simple resolution/ workaround suggested. Many thanks for this.

  • vj

    You can apply a shim database for automating the AppCompat flags. You can create a manifest for your executable and distrubute that along with the application. I dont think, there is an option to do it through shims to keep it active even after a re-install.

    Lemme check and get back to you, wen i find a solution.

  • vasujain

    This thing refreshes whenever a reinstall is done..is there any way 2 associate this as a permanent metadata for an application..?

  • http://www.msigeek.com/appcompat-series-%e2%80%93-how-do-you-fix-browser-compatiblity-issues/ AppCompat Series – How do you Fix Browser Compatiblity Issues?

    [...] How do you fix OS Version number Issues? [...]

  • msigeek
  • http://www.nirmaltv.com/2009/11/24/solving-application-compatibility-in-windows-7/ Solving Application Compatibility in Windows 7

    [...] Part 1: How do you fix the OS Version Number Issues? [...]

  • http://www.msigeek.com/appcompat-series-libraries-uac-wrp-and-other-core-changes/ AppCompat Series – Libraries, UAC, WRP and other Core Changes

    [...] shims like Virtualization shims and ForceAdminAccess shims. To learn how to apply shims, refer Part 1. Applications needing to run as administrator should manifested (if you are the author) or use [...]

  • http://ginktage.com/?p=408 Application Compatibility Series on Windows 7 | Senthil Kumar's Blog

    [...] ·         Part 1: How do you fix the OS Version Number Issues? [...]

  • http://www.msigeek.com/how-to-make-windows-7-deployment-easy-effective-guides/ How to make Windows 7 Deployment Easy? – Effective Guides – ms'i'geek

    [...] How do you fix the OS Version Number Issues?  [...]

  • http://easyvsto.wordpress.com/2010/01/31/prepare-your-applications-for-windows-7/ Prepare your Applications for Windows 7 « Very Simple Tools for Office

    [...] How do you fix the OS Version Number Issues? [...]

  • http://www.msigeek.com/2195/how-to-make-windows-7-deployment-easy-effective-guides How to make Windows 7 Deployment Easy? – Effective Guides

    [...] How do you fix the OS Version Number Issues?  [...]

  • http://technology.globalthoughtz.com/index.php/fixing-your-broken-applications-for-windows-7/ Fixing your broken Applications for Windows 7

    [...] How do you fix the OS Version Number Issue? [...]

  • http://www.msigeek.com/1539/appcompat-series-libraries-uac-wrp-and-other-core-changes AppCompat Series – Libraries, UAC, WRP and other Core Changes

    [...] simple Mitigation is to apply shims for WRP issues. See Part 1, to understand how to create a new shim. IT Pros should never repackage Microsoft redistributables [...]

  • http://www.msigeek.com/3067/technet-webcast-migrating-from-internet-explorer-6-to-internet-explorer-8 TechNet Webcast: Migrating from Internet Explorer 6 to Internet Explorer 8

    [...] I would also recommend you read these article on How to Fix Browser Compatiblity Issues and OS Version Issues. [...]

  • http://www.msigeek.com/958/appcompat-series-how-do-you-fix-browser-compatiblity-issues AppCompat Series – How do you Fix Browser Compatiblity Issues?

    [...] Part 1: How do you fix the OS Version Number Issues?  [...]

  • http://www.msigeek.com/1478/appcompat-series-demystifying-the-windows-7-virtual-xp-mode AppCompat Series – Demystifying the Windows 7 Virtual XP Mode

    [...] Part 1: How do you fix the OS Version Number Issues?  [...]

  • http://www.msigeek.com/1521/appcompat-series-session-0-isolation-and-secure-desktop AppCompat Series – Session 0 Isolation and Secure Desktop

    [...] Part 1: How do you fix the OS Version Number Issues?  [...]

  • http://www.msigeek.com/4091/springboard-series-virtual-roundtable-plan-test-and-assess-windows-7-deployment Springboard Series Virtual Roundtable – Plan, Test and Assess Windows 7 Deployment

    [...] Part 1: How do you fix the OS Version Number Issues?  [...]

  • http://www.msigeek.com/4197/solve-application-compatibility-challenges-in-windows-7-video-from-appdna Solve Application Compatibility Challenges in Windows 7 – Video from AppDNA

    [...] Part 1: How do you fix the OS Version Number Issues?  [...]

  • http://www.msigeek.com/4323/microsoft-teched-india-2010-videos-and-presentation-slides-my-sessions Microsoft Teched India 2010 – Videos and Presentation Slides : My Sessions

    [...] Part 1: How do you fix the OS Version Number Issues?  [...]

  • http://www.msigeek.com/5014/download-windows-7-training-kit-for-developers Download Windows 7 Training Kit For Developers

    [...] Application Compatibility topics such as Version Checking, Installer Detection, UAC Data Redirection, User Interface Privilege Isolation,  Session 0 [...]

blog comments powered by Disqus

Previous post:

Next post: