Thursday, July 25, 2013

PCA (Program Compatibility Assistant for Windows Vista ,Windows 7)

PCA Introduction

  1. The Program Compatibility Wizard in Help and Support and the Compatibility tab in file properties are useful tools for users to fix program-compatibility issues in Windows Vista , Windows 7 & Windows 8 , Windows Server 2008.
  2. The Program Compatibility Assistant (PCA) can make older programs that have compatibility problems work better in an automated manner. PCA monitors programs for known issues.
  3. When a user runs an app, PCA tracks the app and identifies any symptoms of certain known compatibility issues. When it detects any issue symptoms, it provides the user an opportunity to apply a recommended fix that will help run the app better.

PCA Scenarios

Detecting Failures in Setup Programs [1]

  1. One of the main scenarios for PCA is detecting setup programs failing to install on Windows 7 and providing the solution of applying the Windows XP compatibility mode.
  2. The most common setup failure is due to installers hard-coding the check for the Windows OS version. These installers will typically fail with an error message saying that the current version of Windows is not supported and installation will be terminated.
  3. The following is an example of such error message, illustrated by a test program.

 Why this happens  ?? , Programs commonly use the GetVersion function or the GetVersionEx APIs to get information on the Windows OS version they are running on. Under Windows Vista and Windows Server 2008, these APIs will return 6 as the major version. If the program is hard-coded to look for the XP version, which is major version 5, it will fail under Windows Vista and Windows Server 2008. The XPVersionLie fix included in the Windows XP compatibility mode will provide the XP version of the OS to the program, when it calls GetVersion or GetVersionEx APIs.

PCA targets to detect this scenario and will display a user interface similar to the one below after the installer is terminated. This scenario also covers uninstallers and a similar dialog will soon be shown.

 When the user selects the Reinstall using recommended settings option, the WINXPS2 compatibility mode will be applied to the installer program, and the installer will be automatically restarted.

What's happening in details ?? ,What is the detection logic, and how does PCA know that the setup failed due to version problems?? , How does PCA get information about the setup programs? ? , What does each option in the PCA dialog for setups do? ?

Detecting Program Failures under UAC [2]

  • The second main scenario category for PCA is detecting program failures while running under User Access Control (UAC). PCA detects three different types of program failures under UAC, which are described in the following sections.

Detecting Program Failures While Trying to Launch Installers [3]

  • PCA detects this particular scenario of a program not running as Administrator that is experiencing a failure while launching a child program, because the child program is required to run as Administrator. This scenario will typically be the case for programs trying to launch an updater program because Windows Vista and Windows Server 2008 returns a new error code to programs trying to launch an executable that is detected to run as Administrator. If the same updater is run from Windows Explorer, it will run as administrator since Explorer knows how to handle this error code. Explorer launches the UAC consent UI asking for administrator credentials or approval and finally runs the program as Administrator. The following is an example of a PCA dialog that will show up in this scenario, illustrated by a test program.
  • Here the test program has tried to launch an updater that is required to run as administrator and has failed. In this case, PCA will apply the ELEVATECREATEPROCESS compatibility mode, which will enable the program to successfully launch the child program as Administrator the next time. Now when the program is run the next time and while trying to launch the updater, it will not fail and will successfully run as Administrator. The user will see the UAC consent UI.

Detecting Installers That Need to Be Run as Administrator [4]
  • One of the tenets of Windows is that the installation of most software requires administrative privileges. This requirement is because installed applications are loaded into system directories and manipulate system resources. The installation-detection part of the overall UAC feature helps by identifying setup programs and automatically prompting the user for Administrator approval or credentials. In some cases it is possible that an installation program might not be detected by UAC. These programs are typically custom made installers that are not built using standard installer technologies such Install Shield and Microsoft Windows Installer.
  • PCA detects this scenario and will display a user interface similar to the following one after the installer is terminated.

Detecting Legacy Control Panels That Might Need to Run as Administrator [5]

  • The last UAC-related scenario addressed by PCA is to detect Control Panel items that need to be run as Administrator. After a legacy Control Panel item is run once, a PCA dialog similar to the following one will show up.

Detecting Program Failures Due to Deprecated Windows Components [6]

  • This PCA scenario mitigates the impact on programs due to deprecated (removed) components in Windows Vista and Windows Server 2008. PCA detects programs that are trying to access a DLL or a COM object removed in Windows Vista and Windows Server 2008. If a program is detected trying to access a known DLL or COM object, PCA will provide a UI at the program termination to inform the user and provide options to check online for a solution.
  • The following is an example of a PCA dialog that will show up in this scenario, illustrated by a test program.

Detecting Unsigned Drivers on 64-Bit Platforms [7]

  • In this scenario, PCA is trying to protect the system stability due to programs or devices using unsigned drivers on 64-bit platforms. Windows Vista and Windows Server 2008 do not support unsigned drivers on the 64bit platform and enforce a policy that all drivers should be signed. If an unsigned driver is installed into the system with a 64-bit platform, it will not be loaded. After the user reboots the machine, the system will not start if it is a boot-time driver. The device or program trying to use the driver might experience failures that might also result in a system crash. In order to prevent this problem, PCA monitors installation of unsigned drivers, and whenever PCA detects installation of an unsigned driver, it will notify the user as shown in the following dialog.
  • If it is a boot-time driver, PCA will disable the driver so that the system will be able to boot.
  • PCA detects this scenario first by monitoring changes to the KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services registry key for addition of new drivers into the system. Then, based on the location of driver from the registry, each new driver installed will be checked for a valid digital signature. If the driver does not have a valid signature, the PCA dialog will be displayed. Unlike in the other PCA scenarios, this message is not related to specific applications and is related to the driver, regardless of how it was installed.

Informing Users about Compatibility Issues with Known Programs at Startup

Apart from the runtime issue detection scenarios listed above, PCA also informs users at program startup if the program belongs to a list of programs known to have compatibility issues. The list is stored in the System application compatibility database. This scenario also exists in Windows XP, and these messages are known as the Application Help (shortly Apphelp) messages. There are two types of Apphelp messages:

Hard Block Messages—if the program is known to be incompatible and if allowing the program could result in severe impact to the system (for example, a stop error or unable to boot after the installation.), a blocking message as shown will be displayed.
Soft Block Messages— used in the case of programs that have known compatibility issues, but the impact is not severe to the system.

In both cases, the Check for solutions option sends a Windows Error Report to get an online response from Microsoft. The responses will be displayed in the client Solutions to Problems (wercon.exe) UI. Typically the responses will be one of three types:
  • Pointing the user to an update from the ISV for that program.
  • Pointing the user to an ISV website for more information.
  • Pointing the user to a Microsoft Knowledge base article for more information.

Managing Settings Made by PCA

  • The compatibility modes will be applied to programs by setting a registry key under Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers with a key name of the full path of the program and a string value of the name of the compatibility mode being applied.  
  • The registry key will be set under HKEY_LOCAL_MACHINE to apply the solutions to be effective for all users except for the scenario where the ELEVATECREATEPROCESS compatibility mode is applied automatically before the PCA dialog shows up. In that scenario, the registry key will be set under HKEY_CURRENT_USER, and the solution will be effective only for the current user.
  • Apart from this key, PCA stores the list of all programs for which it came up under the following key for each user, even if no compatibility modes were applied (e.g. in the case where the user reported that the program worked correctly): HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted

 Excluding Programs from PCA

  • PCA is intended to detect issues with older programs and not intended to monitor programs developed for Windows 7. The best option to exclude a program from PCA is to include, with the program, an application manifest with run level (either Administrator or as limited users) marking for UAC. This marking means the program is tested to work under UAC (and, windows 7, Windows Vista and Windows Server 2008). PCA checks for this manifest and will exclude the program. This process applies for both installer and regular programs.
  • Another option to exclude applications from PCA is to add the list of executable files with full path under the following registry key: HKEY_LOCAL_MACHINE\ Software\Microsoft\Windows NT\CurrentVersion\Compatibility Assistant. The value name is ExecutablesToExclude, which is type REG_MULTI_SZ.
  • PCA automatically excludes programs running from network locations and programs containing fixes applied to them in the application compatibility databases.
  • A group policy setting is provided to disable PCA for all programs if desired. The name of the policy is Turn Off Program Compatibility Assistant. It can be found under Administrative Templates\Windows Components\Application Compatibility in the group policy editor (gpedit.msc).
  • There are also individual policies to turn off specific scenarios. These policies are available under Administrative Templates\System\Troubleshooting and Diagnostics\Application Compatibility Diagnostics in the group policy editor.

Event Logging For PCA

After the user has acted on PCA, an event will be logged in the event log. The events can be found under

Application and Services Logs\Microsoft\Windows\Program-Compatibility-Assistant\Operationalin the Event viewer.

 The event log includes the following information: application name, application version, executable path, scenario ID, user action, and the names of the compatibility modes applied if any. The values of the scenario ID are listed  below.

1 -  Detecting failures in setup programs (installer)
10 -  Detecting failures in setup programs (uninstaller)
3 -  Detecting program failures while trying to launch installers
8 -  Detecting installers that need to be run as administrator
9 -  Detecting legacy control panels that may need to run as administrator
5 -   Detecting program failures due to deprecated Windows components
11 - Detecting unsigned drivers on 64-bit platform

Managing Apphelp Messages

  • In an Enterprise setting, an IT Professional can use the Compatibility Administrator tool to disable the Apphelp entries present in the System application compatibility database or add custom databases that contain Apphelp messages for programs used in the enterprise.
  • The Compatibility Administrator tool ships as part of the Application Compatibility Toolkit.


jowdjbrown said...

The Program Compatibility Assistant (PCA) can make older programs that have compatibility problems work better in an automated manner. best virtual assistant program

sivanesan said...

Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it. erp in chennai.

Brave Technologies said...

Thank you for this valuable information. erp provider in chennai

preethi Shetty said...

Thanks for posting please do keep on sharing...
Best Online Software Training Institute | Spring Training