AppCompat in Windows Installer

AppCompat in Windows Installer

  • Comments 1

The Application Compatibility (AppCompat) platform in Windows is a powerful feature that allows for fixes on practically any program or package to be loaded on Windows. Windows Installer takes advantage of a protected database full of fixes in the form of transforms and custom action shims.

While looking in a verbose Windows Installer log, you will see a line like the following:

MSI (s) (10:B0) [13:33:43:361]: APPCOMPAT: looking for appcompat database entry with ProductCode '{1862162E-3BBC-448F-AA63-49F33152D54A}'.

Windows Installer is checking an AppCompat database, %WINDIR%\AppPatch\msimain.sdb, to determine if the product requires any fixes. Normally, the next line in the log you would see is like the following example:

MSI (s) (10:B0) [13:33:43:361]: APPCOMPAT: no matching ProductCode found in database.

But what happens for products that are found in the AppCompat database? To find out what products have AppCompat fixes, I needed to look into msimain.sdb. Unfortunately, the Application Compatibility Toolkit (ACT) 5.0 lets you view the main system database, %WINDIR%\AppPatch\sysmain.sdb, and view and even create custom databases. It will not display other databases like msimain.sdb.

Using a tool I wrote based on what little documentation is available and some experimentation, one can view an XML representation of any AppCompat database (or shim database, hence the .sdb file extension). Using this information one can see that transforms are included and also that custom actions can and are often shimmed much like applications might be, for example to think they are running on an older Windows platform. I could see that Visual Studio 2005 Team Suite was in msimain.sdb on Vista, and during a repair the following log lines are printed:

MSI (s) (10:B0) [13:33:43:361]: APPCOMPAT: matching ProductCode found in database.  Entry name: 'vs_setup.msi'.  Testing other attributes...
MSI (s) (10:B0) [13:33:43:361]: APPCOMPAT: matching ProductCode found in database, and other attributes match.  Applying appcompat fix.
MSI (s) (10:B0) [13:33:43:367]: APPCOMPAT: applying appcompat transform 'C:\Windows\Installer\89a4134.mst'.

Since the tool can extract binary data like transforms, even without installing Visual Studio 2005 Team Suite (VSTS) the AppCompat transform can be extracted and applied to the VSTS .msi. The transform sets the msidbCustomActionTypeNoImpersonate (0x0800) bit for a few custom actions that needed to be elevated under UAC starting with Vista.

Leave a Comment
  • Please add 8 and 6 and type the answer here:
  • Post