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
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.


Version Check is a basic operation which every developer does while building applications. Wrong Conditions may cause Application Compatibility issues to both developers and users, when they look at migrating the existing applications to a newer OS. The Windows version is actually composed of a bunch of different fields, all packed into anOSVERSIONINFO structure.
The relevant parts of the OSVERSIONINFO are:
  • Major Version (dwMajorVersion)
  • Minor Version (dwMinorVersion)
  • Build # (dwBuildNumber)
List of Windows Client OS with their Version Numbers
Operating SystemVersion Number
Windows 1.01.04
Windows 2.02.11
Windows 3.03
Windows NT 3.13.10.528
Windows for Workgroups 3.113.11
Windows NT Workstation 3.53.5.807
Windows NT Workstation 3.513.51.1057
Windows 954.0.950
Windows NT Workstation 4.04.0.1381
Windows 984.1.1998
Windows 98 Second Edition4.1.2222
Windows Me4.90.3000
Windows 2000 Professional5.0.2195
Windows XP5.1.2600
Windows Vista6.0.6000
Windows 76.1.7600

Yochay Kiriaty says that “A lot can go wrong when version checking is misused. A user might experience a “silent fail” where the application simply fails to load and nothing happens. Or, a user might see a dialog box indicating something to the effect of “you must be running Microsoft Windows XP or later” when in fact, the computer is running Windows 7. Many other consequences to poor version checking can inconvenience users as well.”
Reference- Windows Team Blog


n the earlier article on Analyzing the ACT Reports, we learnt on how we can identify the application Compatibility issues in your machine/organization. Even If you are not keen in generating an app-report,  this method described in this article will help you learn how to mitigate an application using shims.
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.
Process to Fix an Application – The steps involved in fixing an application using this tool is quite easy. First launch the application, test its functionality. If your enviroment is a locked-down one, then test the application as a Standard User. Identify the issues which arise. Use the Compatibility Administrator tool to create a new Shim database (.sdb), select the compatibility modes and fixes for this application. Apply this shim and test the application again. If the app works and responds fine, deploy the same on the machine.
Compatibility Administrator Process
Step 1: Install the Application Compatibility Toolkit and Start the Compatibility Administrator. You will need to run this as administrator
Launch Compatibility Administrator
As mentioned earlier, This tool  provides individual compatibility fixes, compatibility modes, and AppHelp messages which can help you resolve specific compatibility issues. Right click on the New Database, you will find these below options.
Creating an Application Fix Compatibility Administrator
Step 2: In this example, we will look at how you can fix an application. So lets choose Application Fix here. In this below dialog, give the application details and the executable you would wanna fix.
Create New Application Fix
Step 3: When you press the next button, you will get to see the list of the compatibility modes listed by default. If you have an issue with just the version in-compatiblity then choose the version in which the application was working earlier! You can also do a “Test Run” of the app.
OS Modes - Compatibility Administrator
Step 4: As of now, lets not choose any OS mode here. You can do it in the next window (when you have combination of shims to be choosed). As shown below, you have lots of shims to choose from. Select all the shims which would fix your application (based on the analysis you did during the Application Tests or from the Analyzed Report).
Available Shims - Compatibility Administrator
As you can see above, few of the shims do have parameters to work with. You can check the ACT Documentation to understand more on these individual shims. Check out these 2 articles, where I have written on how you can use Parameters for File and Registry Re-Direction shims (VirtualRegistry and CorrectFilePaths).
Step 5: Let me select the shims, which will resolve the issues with the application I am currently fixing. You can click on the Show Selected Button, which will list out all the shims you have selected.
Selected Shims - Compatibility Administrator
Summary Fixed Application - Compatibility Administrator
Click on Finish. This will give you the complete summary of the application and the fixes applied.
Summary Application - Compatibility Administrator
The Windows installs a System Application Fix database for use with the Compatibility Administrator. This database can be updated through Windows Update, and is stored in the %WINDIR% \AppPatch directory. The custom databases which we create are automatically stored in the %WINDIR% \AppPatch\Custom directory and are installed by using the Sdbinst.exe tool provided with the Compatibility Administrator.
Step 6: Now you need to save this shim database file, and install it. You can either install it by, right click on the shim and press install button, or by using a command-line option.
Install Shims
Or using Command Line arguments – sdbinst.exe C:\msigeek.sdb
sdbinst Command Line
You also have an option to use a query tool that enables you to search for installed fixes on your local computers.
Query Database


Internet Explorer Compatibility Test Tool (IECTT) is a part of the Application Compatibility Toolkit. Its a freeware tool from Microsoft to solve and address AppCompat Issues.
You can also emulate your website to solve the Website Compatibility Issues – 
This Tool collects your Web-based issues from Internet Explorer 7 / Internet Explorer 8, uploads the data to the ACT Log Processing Service, and gives the details about discovered compatibility issues. It also provides you links for more information about each of this compatibility issues.
To know more on how to Install and setup the Application Compatibility Toolkit Environment, i would recommend you read this article!
Step 1: Invoke the tool from the Start Menu -> All Programs -> Microsoft Application Compatibility Toolkit 5.5 -> Developer and Test Tools -> Internet Explorer Compatibility Test Tool
Internet Explorer Compatibility Test (IECT) Tool
Once the application is launched, you will see the below dialog;
Internet Explorer Compatibility Test Tool
Step 2: Close all of your active Internet Explorer browser windows; and then click on the Enable button in the Toolbar.
Enable - Internet Explorer Compatibility Test Tool
This will start monitoring your Internet Explorer session. In the Internet Explorer Compatibility Tool, you can view the potential compatibility issues, filter your results, save an issue report, and open an existing issue report, and upload all data to your ACT database.
Step 3: Now Open the website on the Internet Explorer (This would be the website, which you would need to check the Compatibility for)
Report Gathering - Internet Explorer Compatibility Test Tool
Step 4: Press the Disable Button. This will stop the monitoring of the Website.
Disable - Internet Explorer Compatibility Test Tool
You will now see the complete information which was collected. You can also opt to save this report (.cet) file, so that you can review your issues at a later time, or for archival purposes.
Data Collected - IECTT
You can also filter the reports based on the issue occurances.
Filter Report
Step 5: You have an option to Upload these data to your ACT Database and rationalize and review it using the ACM (Application Compatibility Manager). Click on the Upload Button. This will create an XML file and bucket the data.
Upload the Reports
Saving the Issues Cab File
Step 6: Save the Cab file in the parent level of your ACT log file directory; This will be automatically processed by the ACT Log Processing Service the next time it runs. If you have not created the LogShare – Check this out
Save the cab file in the Root Folder of the Log Share
Step 7: Start the Application Compatibility Manager (ACM) - (right click and run as administrator)Now you will see the Internet Explorer reports also. If you do not see the collected data., open services.msc, stop the ACT Log Processing Service and Restart it.
IE Reports in ACM
Now you can Send-Recieve the data on ACM, so that you can get the suggestions from the community / Microsoft on this issues. If you are an IT Pro, you can also forward this report to the website developer, to fix these issues.
Send Recieve IE Reports
To understand on how to analyze these reports on the Application Compatibility Manager –Read this article


Many of us work with Applications; either we develop or deploy them! While doing so, its important to test the developed application as a Standard User. Especially when the organization has a locked-down environment or the New Generation Operating Systems with UAC.
This helps in understanding the application behavior better. Standard User Analyzer tool exactly helps you in this purpose! This tool is a part of the Application Compatibility Toolkit.
Step 1: Install the Application Compatibility Toolkit and Start the Standard User Analyser. You dont need to run this as administrator; you can just launch it.
Standard User Analyzer
The application launches as below,
Standard User Analyzer - Application Launches
If you are aware of the SysInternals Tools Filemon/Regmon, this tool pretty much does the similar job. When you launch an application, it will monitor all the files, registries, INI files modified, the name-spaces which the app calls, the credential Privilages Process calls etc. This will give a detailed analysis on how this application behaves as a standard user.
You also have an option to run the same application as an administrator user and compare these 2 reports. This can be done, by marking the checkbox “Elevate” in the Launch Options.
Step 2: In the Target application tab, browse to the executable which the application will be launching. In this example, it is StockViewer.exe. Click on the button Launch. (You can also specify any command line arguments / parameters for this executable)
Launch Executable in the Standard User Analyzer
This tool needs a pre-requisite “Application Verifier”. If you have not installed this application, you will get this below dialog. Download and install this app.
Application Verifier is designed specifically to detect and help debug memory corruptions and critical security vulnerabilities. This is achieved by monitoring a native application’s interaction with the Windows operating system, profiling its use of objects, the registry, the file system, and Win32 APIs (including heaps, handles, locks, etc), and indicating issues when and where they are discovered. Application Verifier also includes checks to predict how well an application may perform under various account privileges. You can download it here
Application Verifier
Once Application Verifier is installed, This will actually start monitoring your application usage.  You may also get this below warning message,
Warning Message
Step 3: Start your application which you want to monitor; you can perform all the operations which an end-user would do!
While this demo, i launched my application and found that this application asked for administrator rights while launching, and also gives some ‘access denied’ error. When I close this app, the Standard User Analyzer has fetched all the requirement information which the application has accessed.
Standard User Analyzer - Application Reports
These logs and reports will explain you on the application behavior. It will also help your developers to fix this application easily. Looking from the application Compatibility front, this tool also gives you an option which identifies the mitigations and provides you options to fix them.
Apply Mitigations
When you click on the Apply Mitigation, you will get the below dialog with the list of shims which would mitigate the issues identified.
Mitigations List
You can also export this mitigation as an msi, so that you can deploy the same using any deployment tools in your organization!