Understanding Application Compatibility


Most new software programs are certified as Windows XP–compatible, meaning that they will install and run without mishap on any Windows XP system. But what about older programs that were coded before Windows XP was released? They can be a bit more problematic. Since Windows XP is based on the code for Windows 2000—which was in turn based on Windows NT—programs that are compatible with those operating systems will probably (although not definitely) be compatible with Windows XP. But the real problems lie with programs written for Windows 9x and Windows Me. Windows XP—even Windows XP Home Edition—uses a completely different code base than the old consumer versions of Windows, so it’s inevitable that some of those so-called legacy programs either will be unstable while running under Windows XP, or they won’t run at all.

Why do such incompatibilities arise? One common reason is that the programmers of a legacy application hard-wired certain data into the program’s code. For example, installation programs often poll the operating system for its version number. If an application is designed for, say, Windows 95, the programmers may have set things up so that the application installs if and only if the operating system returns the Windows 95 version number. The program may run perfectly well under any later version of Windows, but this simplistic brain- dead version check prevents it from even installing on anything but Windows 95.

Another reason incompatibilities arise is that calls to API functions return unexpected results. For example, the programmers of an old application may have assumed that the FAT file system would always be the standard, so when checking for free disk space before installing the program, they’d expect to receive a number that is 2 GB or less (the maximum size of a FAT partition). But FAT32 and NTFS partitions can be considerably larger than 2 GB, so a call to the API function that returns the amount for free space on a partition could return a number that blows out a memory buffer and crashes the installation program.

These types of problems may make it seem as though getting older programs to run under Windows XP would be a nightmare. Fortunately, that’s not true, because the Windows XP programmers did something very smart: Since many of these application incompatibilities are predictable, they gave Windows XP the ability to make allowances for them and so enable many older programs to run under Windows XP without modification. In Windows XP, application compatibility refers to a set of concepts and technologies that enable the operating system to adjust its settings or behavior to compensate for the shortcomings of legacy programs. This section shows you how to work with Windows XP’s application compatibility tools.

Determining Whether a Program Is Windows XP–Compatible

One way to determine whether an application is compatible with Windows XP is to go ahead and install it. If the program is not compatible with Windows XP, you may see a dialog box similar to the one shown in Figure 6-3.

click to expand
Figure 6-3: You may see a dialog box such as this if you try to install a program that isn’t compatible with Windows XP.

At this point you could click Continue (in some dialog boxes, the button is instead named Run Program), but this is a risky strategy since you can’t be sure how the program will interact with Windows XP. (This approach is riskiest when dealing with disk utilities, backup software, anti-virus programs, and other software that requires low-level control of the system. It’s extremely unlikely that Windows XP would ever allow such programs to run. You should always upgrade such products to Windows XP–compatible versions, even if you are successful in forcing them to install.) A much safer route is to click Cancel to cancel the installation and then visit the vendor’s Web site or the Windows Update site to see if a Windows XP–friendly update is available. (You can often get the company’s Web address by clicking the Details button.)

Insider Secret

Where does the information in these dialog boxes come from? In the %SystemRoot%\AppPatch folder, Windows XP has a file named Apphelp.sdb that contains messages such as the one shown in Figure 6-3 for all known applications that don’t have compatibility fixes (discussed later in this section). The .sdb files are not text files, so opening them with Notepad or WordPad will not allow you to read any of those stored messages.

A better approach is to find out in advance whether the program is compatible with Windows XP. The most obvious way to do this is to look for the Designed For Windows XP logo on the box. For older programs, check the manufacturer’s Web site to see if it tells you whether the program can be run under Windows XP, or if an upgrade is available. Alternatively, Microsoft has a Web page that enables you to search on the name of a program or manufacturer to find out compatibility information:

http://www.microsoft.com/windows/catalog

What if you’re upgrading to Windows XP and you want to know if your installed software is compatible? The easiest way to find out is to use the Microsoft Windows Upgrade Advisor tool, which is available on the Windows XP Professional CD. (The Windows XP Home Edition CD doesn’t have the Upgrade Advisor.) Insert the Windows XP Professional CD and, when the Welcome To Microsoft Windows XP screen appears, click Check System Compatibility. Run through the Upgrade Advisor’s dialog boxes until you get to the report on system compatibility. This report will list any software that doesn’t support Windows XP and possibly software that needs to be reinstalled after the Windows XP setup is finished.

Understanding Compatibility Mode

To help you run programs under Windows XP, especially those programs that worked properly in a previous version of Windows, Windows XP offers a new way to run applications using compatibility layers. This means that Windows XP runs the program by doing one or both of the following:

  • Running the program in a compatibility mode. This involves emulating the behavior of a previous version of Windows. Windows XP can emulate the behavior of Windows 95, Windows 98, Windows Me, Windows NT 4.0 with Service Pack 5, or Windows 2000.

  • Temporarily changing the system’s visual display so that it’s compatible with the program. There are three possibilities here: setting the color depth to 256 colors; changing the screen resolution to 640 480; and disabling Windows XP’s visual themes.

    Note

    Windows XP and Microsoft often use the terms compatibility layer and compatibility mode interchangeably, depending on which compatibility tool you’re using. In some cases, the emulations of previous Windows versions are called operating system modes.

These are the broad compatibility layers supported by Windows XP. As you’ll see a bit later, Windows XP also offers fine-tuned control over these and other compatibility settings. For now, however, you have two ways to set up a compatibility layer:

  • Right-click the program’s executable file (or a shortcut to the file), select Properties, and then select the Compatibility tab in the property sheet that appears (see Figure 6-4). To set the compatibility mode, select the Run This Program In Compatibility Mode For check box, and then use the list to choose the Windows version the program requires. You can also use the check boxes in the Display Settings section of the dialog box to adjust the video mode that Windows XP will switch to when you use the program.

    click to expand
    Figure 6-4: In the property sheet for an executable file, use the Compatibility tab to set the compatibility layer for the program.

  • Run the Program Compatibility Wizard by selecting Start, All Programs, Accessories, Program Compatibility Wizard. Use the wizard’s windows to select the program’s executable file, choose a compatibility mode, set the visual options, and then test the program.

Scripting Compatibility Layers

What do you do if you have a batch file that needs to run one or more programs within a temporary compatibility layer? You can handle this by using the following command within the batch file before you start the program. Look closely at the command: The word SET is followed by a space, then two underscore characters.

SET __COMPAT_LAYER=[!]layer1 [ layer2...]

Here, layer1 and layer2 are codes that represent the compatibility layers. Table 6.1 lists the 11 codes you can use.

Table 6.1: Codes to use when scripting compatibility layers

Code

Compatibility Layer

Win95

Windows 95

Win98

Windows 98 / Windows Me

Win2000

Windows 2000

NT4SP5

Windows NT 4.0 SP 5

256Color

256 Color

640x480

640 480 Screen Resolution

DisableThemes

Disable Visual Themes

International

International
This layer handles incompatibilities caused by double-byte character sets.

LUA

Limited User Access
This layer redirects some registry and file operations to non- restricted areas for users that don’t have permission to access restricted areas (such as the HKLM key).

LUACleanup

Limited User Access Cleanup
This layer removes the registry settings and files that were redirected using the LUA layer.

ProfilesSetup

Profile Setup Support
This layer is used for older programs that install only for the current user; the layer ensures the program is installed for all users.

Note, too, that if you’ve already applied one or more layers to the program using the techniques from the previous section, you can tell Windows XP not to use one of those layers by preceding its keyword with the ! symbol. Also, to turn off the compatibility layers, run the command without any parameters, like so:

SET __COMPAT_LAYER=

For example, the following commands set the compatibility layers to Windows 95 and 256 colors, run a program, and then remove the layers:

SET __COMPAT_LAYER=Win95 256Color D:\Legacy\oldapp.exe SET __COMPAT_LAYER=
Note

The compatibility layers created by SET __COMPAT_LAYER apply also to any processes that are spawned by the affected application. For example, if you set the Windows 95 layer for Setup.exe, the same layer will also apply to any other executable called by Setup.exe. More information regarding the SET __COMPAT_LAYER command and its parameters can be found at http://support.microsoft.com/ default.aspx?scid=kb;en-us;Q286705.

Using the Application Compatibility Toolkit

When you execute a program using a compatibility layer, Windows XP creates an environment within which the program can function properly. For example, a program running under the Win95 layer actually believes that Windows 95 is the operating system. Windows XP accomplishes that not only by returning the Windows 95 version number when the program calls the GetVersion or GetVersionEx API functions, but also by “fixing” other incompatibilities between Windows 95 and Windows XP. For example, Windows 95 programs expect components such as Calculator and Solitaire to be in the %SystemRoot% folder, but in Windows XP these are in the %SystemRoot%\System32\ folder. The Win95 layer intercepts such file calls and reroutes them to the appropriate location.

The Win95 layer is composed of more than 50 such fixes, which are part of a large database of incompatibilities maintained by Microsoft. As of this writing, nearly 200 incompatibilities have been identified, and others may be found in the future. To get access to all these fixes and thus get fine-tuned control over the compatibility issues relating to any legacy program, you need to use the Application Compatibility Toolkit (ACT).

To install the ACT, you have two choices:

  • In the Windows XP Professional CD, open the \SUPPORT\TOOLS\ folder and launch the Act20.exe file.

  • Download and run the latest version of ACT from the following Microsoft Web page:

    http://www.microsoft.com/windows/WindowsXP/appexperience/

The ACT package consists of a number of programs and tools. Some of these are for programmers only, so the next two sections look at the end-user tools: QFixApp and the Compatibility Administrator.

Using QFixApp

QFixApp enables you to apply either a layer or a specific set of fixes to an executable file, and then run the file to test the fixes. If the program works properly, you can then use the Compatibility Administrator (discussed in the next section) to apply the fixes to the file. Note, however, that the latest version of the ACT doesn’t require QFixApp because it enables you to choose fixes and test executables from within the Compatibility Administrator.

If you’re still using the original version of the ACT, follow these steps to test an executable using QFixApp:

  1. Select Start, All Programs, Application Compatibility Toolkit, QFixApp. (Newer versions of ACT still have QFixApp, but it’s not available via the Start menu. Open the folder into which you installed the ACT and double-click the Qfixapp.exe file instead.)

  2. In the QFixApp window, click Browse to choose the executable file you want to test. If the executable requires parameters or switches, add them to the Command Line text box.

  3. If you want to apply a layer, choose it from the Layers tab.

  4. If you want to apply specific fixes instead (or in addition to the fixes associated with the specified layer), display the Fixes tab and use the check boxes to select the fixes you want to test. Selecting a fix displays its description in the Fix Description box, as shown in Figure 6-5.

    click to expand
    Figure 6-5: QFixApp allows you to interactively determine parameters for application compatibility.

  5. Click Run to test the file.

  6. Click View Log. The top part of the log will show you the fixes that Windows XP used to run the program. In the following example, Windows XP used three fixes—EmulateHeap, Win95VersionLie, and EmulateGetDiskFreeSpace:

    -------------------------------------------  Log  "D:\oldapp.exe" ------------------------------------------- 09/10/2002 11:55:59 EmulateHeap 3 - [NotifyFn] Win9x heap manager initialized 09/10/2002 11:55:59 Win95VersionLie 3 - [GetVersionExA] Return Win95 09/10/2002 11:56:15 EmulateGetDiskFreeSpace 3 -  [GetDiskFreeSpaceA] Called. Returning <=2GB free space

  7. On the Fixes tab, clear all the fixes that the application did not require.

  8. Repeat steps 5 through 7 until the fixes selected in QFixApp match the fixes required by the program.

The fixes you’ve determined for your program are in effect only during the current QFixApp session. To create a permanent fix, you need to use the Compatibility Administrator, discussed next.

Using the Compatibility Administrator

To create a usable compatibility fix for an application—one that you can use on your own computer or distribute to other computers—you use the Compatibility Administrator. The Compatibility Administrator stores fixes in databases:

  • System database This database contains three items: a list of applications for which Microsoft has applied fixes for known problems; a list of the available compatibility fixes (these are the items that QFixApp displays on its Fixes tab); and the defined compatibility modes (that is, the compatibility layers discussed earlier).

  • Installed databases These are databases that have been installed on this computer.

  • Custom databases These are databases that contain fixes that you applied to one or more applications.

There are two ways to start this program:

  • If you’re using the original version of the ACT, select Start, All Programs, Application Compatibility Toolkit, Compatibility Administration Tool.

  • If you’re using the latest version of the ACT, select Start, All Programs, Windows Application Compatibility Toolkit, Compatibility Administration Tool.

Here’s how to create a custom fix database (note that we’re using version 2.6 of the Compatibility Administrator for these instructions):

  1. In the Compatibility Administrator window, a new database is created for you automatically under the Custom Databases branch. Either select this database or create a new one by selecting Custom Database and selecting File, New.

  2. Right-click the new database, select Rename, and then enter a name for the database.

  3. To create a new application fix, click the Fix button in the toolbar to launch the Create New Application Fix Wizard.

  4. Enter the program’s name, vendor, and location, and then click Next.

  5. Choose an operating system mode and use the check boxes in the Select Additional Compatibility Modes section to choose additional layers to apply to the program. Click Next.

  6. In the Compatibility Fixes list, use the check boxes to apply specific compatibility fixes and then click Next.

  7. The Compatibility Administrator also needs to know how to identify the program. Click Auto-Generate to have the wizard set up the matching attributes for you, and then click Finish.

You’ll see your program listed in the database. To try it out, select the program and click Run. Then select View, View Log to see the log that the Compatibility Administrator created. As with QFixApp, use the log to determine which fixes were required by the program. Then edit the fix to clear any fixes that aren’t required by the program. (To change the fixes, right-click the program’s executable file name in the right pane and then select Edit Application Fix.

Once you’ve added all the fixes for all your incompatible programs to the database, save the database file. To enable Windows XP to use the resulting .sdb file, you need to install the file by selecting it and selecting File, Install. To distribute the fix to another computer, copy the .sdb file to the machine, launch the Compatibility Administrator, and then click Open to open the .sdb file. You can then install the database.




Insider Power Techniques for Microsoft Windows XP
Insider Power Techniques for Microsoft Windows XP (Bpg-Other)
ISBN: 0735618968
EAN: 2147483647
Year: 2005
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net