DESKTOP

Windows Vista : Installing and Running Applications - Applications and the Registry, Understanding Application Compatibility

2/21/2013 8:46:36 PM

1. Applications and the Registry

The Registry is perhaps Windows Vista’s most important component because it stores thousands of settings that Windows needs. The Registry is important for your applications, as well, because most Windows applications use the Registry to store configuration data and other settings.

When you install an application, it typically makes a half-dozen different Registry modifications:

  • Program settings

  • User settings

  • File types

  • Application-specific paths

  • Shared DLLs

  • Uninstall settings

Program Settings

Program settings are related to the application as a whole: where it was installed, the serial number, and so on. The program settings are placed in a new subkey of HKEY_LOCAL_MACHINE\Software:

HKLM\Software\Company\Product\Version
						

Here, Company is the name of the program vendor, Product is the name of the software, and Version is the version number of the program. Here’s an example for Office 2007:

HKLM\Software\Microsoft\Office\12.0

User Settings

User settings are user-specific entries, such as the user’s name, preferences and options the user has selected, and so on. The user settings are stored in a subkey of HKEY_CURRENT_USER\Software:

HKCU\Software\Company\Product
						

File Types

File types refer to the file extensions used by the program’s documents. These extensions are associated with the program’s executable file so that double-clicking a document loads the program and displays the document. The extensions and file types are stored as subkeys within HKEY_CLASSES_ROOT. 

If the application comes with OLE (object linking and embedding) support, it will have a unique class ID, which will be stored as a subkey within HKEY_CLASSES_ROOT\CLSID.

Application-Specific Paths

In computing, a path is a listing of the folders that the operating system must traverse to get to a particular file. Windows Vista uses a variation on this theme called application-specific paths. The idea is that if you enter only the primary name of a program’s executable file in the Run dialog box (press Windows Logo+R), Windows Vista will find and run the program. For example, WordPad’s executable file is Wordpad.exe, so you type wordpad in the Run dialog box, click OK, and WordPad opens.

Note

A file’s primary name is the part of the filename to the left of the dot (.). For example, the primary name of the file Excel.exe is excel.


Windows finds the program because the application’s executable file is associated with the particular path to the folder in which the file resides. These application-specific paths are set up in the following key:

HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths

Each application that supports this feature adds a subkey that uses the name of the application’s executable file (for example, Wordpad.exe). Within that subkey, the value of the Default setting is the full pathname (drive, folder, and filename) of the executable file. Note, too, that many applications also create a Path setting that specifies a default folder for the application.

2. Understanding Application Compatibility

Most new software programs are certified as Windows Vista–compatible, meaning that they can be installed and run without mishap on any Windows Vista system. But what about older programs that were coded before Windows Vista was released? They can be a bit more problematic. Because Windows Vista 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 Vista. But the real problems lie with programs written for Windows 9x and Me. Windows Vista—even Windows Vista Home—uses a completely different code base than the old consumer versions of Windows, so it’s inevitable that some of those legacy programs will either be unstable while running under Windows Vista or they won’t run at all.

Why do such incompatibilities arise? One common reason is that the programmers of a legacy application hardwired 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 might have set things up so that the application installs if and only if the operating system returns the Windows 95 version number. The program might 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 (application programming interface) functions return unexpected results. For example, the programmers of an old application might have assumed that the FAT (file allocation table) 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 2GB or less (the maximum size of a FAT partition). However, FAT32 and NTFS (NT file system) partitions can be considerably larger than 2GB, so a call to the API function that returns the amount of free space on a partition could return a number that blows out a memory buffer and crashes the installation program.

These types of problems might make it seem as though getting older programs to run under Windows Vista would be a nightmare. Fortunately, that’s not usually true because the Windows Vista programmers did something very smart: Because many of these application incompatibilities are predictable, they gave Windows Vista the capability to make allowances for them and so enable many older programs to run under Windows Vista without modification. In Windows Vista, 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 Vista’s application compatibility tools.

Caution

Although application compatibility can work wonders to give aging programs new life under Vista, it doesn’t mean that every legacy program will benefit. If history is any guide, some programs simply will not run under Vista, no matter which compatibility rabbits you pull out of Vista’s hat. In some of these cases you may be able to get a program to run by installing a patch from the manufacturer, so check the program’s website to see if updates are available that make the program Vista-friendly.


Determining Whether a Program Is Compatible with Windows Vista

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

Figure 1. You might see a dialog box such as this if you try to install a program that isn’t compatible with Windows Vista.

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

Note

Where does the information in these dialog boxes come from? In the %SystemRoot%\AppPatch folder, Windows Vista has various system database (.sdb) files that contain messages such as the one shown in Figure 5.5 for all known applications that don’t have compatibility fixes (discussed later in this section). The system database files aren’t text files, so opening them with Notepad or WordPad will not allow you to read any of these stored messages.


A better approach is to find out in advance whether the program is compatible with Windows Vista. The most obvious way to do this is to look for the Designed for Windows Vista logo on the box. For older programs, check the manufacturer’s website to see whether the company tells you that the program can be run under Windows Vista 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 Vista and you want to know whether your installed software is compatible? The easiest way to find out is to use the Upgrade Advisor tool, which is available on the Windows Vista Professional CD. (The Windows Vista Home CD doesn’t have the Upgrade Advisor.) Insert the Windows Vista Pro CD and, when the Welcome to Microsoft Windows Vista screen appears, click Check System Compatibility. Run through the Advisor’s dialog boxes until you get to the report on system compatibility. This report will list software that doesn’t support Windows Vista and possibly software that needs to be reinstalled after the Windows Vista setup has finished.

Understanding Compatibility Mode

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

  • Running the program in a compatibility mode— This involves emulating the behavior of previous version of Windows. Windows Vista can emulate the behavior of Windows 95, Windows 98, Windows Me, Windows NT 4.0 with Service Pack 5, and Windows 2000, as well as two more versions that are new to Windows Vista: Windows 2003 with Service Pack 1 and Windows XP with Service Pack 2.

  • Temporarily changing the system’s visual display so that it’s compatible with the program— There are five possibilities here: setting the color depth to 256 colors, changing the screen resolution to 640×480, disabling Windows Vista’s visual themes, disabling desktop composition, and disabling displaying scaling on high-DPI settings. Note that the last two settings are new to Windows Vista.

Note

Windows Vista 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 that Windows Vista supports. As you’ll see a bit later, Windows Vista also offers fine-tuned control over these and other compatibility settings. For now, however, to set up a compatibility layer, you right-click the program’s executable file or a shortcut to the file, click Properties, and then display the Compatibility tab in the property sheet that appears. To set the compatibility mode, activate the Run this Program in Compatibility Mode For check box (see Figure 2), and then use the list to choose the Windows version the program requires. You can also use the check boxes in the Display Settings group to adjust the video mode that Windows Vista will switch to when you use the program.

Figure 2. In the property sheet for an executable file, use the Compatibility tab to set the compatibility layer for 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:

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

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

Table 1. Codes to Use When Scripting Compatibility Layers
CodeCompatibility Layer
Win95Windows 95
Win98Windows 98 / Windows Me
Win2000Windows 2000
NTSP5Windows NT 4.0 SP 5
WinXPSp2Windows XP (Service Pack 2)
WinSrv03Sp1Windows Server 2003 (Service Pack 1)
256Color256 color
640×480640×480 screen resolution
DisableThemesDisable visual themes
DisableDWMDisable desktop composition
HighDpiAwareDisable display scaling on high DPI settings
RunAsAdminRun this program as an administrator
InternationalThis layer handles incompatibilities caused by double-byte character sets
LUALimited User Access—This layer redirects some Registry and file operations to nonrestricted areas for users that don’t have permission to access restricted areas (such as the HKLM key)
LUACleanupLimited User Access Cleanup—This layer removes the Registry settings and files that were redirected using the LUA layer
ProfilesSetupProfile Setup Support—This layer is used for older programs that install only for the current user; the layer ensures that the program is installed for all users

If you’ve already applied one or more layers to the program using the techniques from the previous section, you can tell Windows Vista 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 the affected application spawns. 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. You can find more information about the SET __COMPAT_LAYER command and its parameters at http://support.microsoft.com/default.aspx?scid=kb;en-us;286705.


Note

When you execute a program using a compatibility layer, Windows Vista 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 Vista 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 Vista. For example, Windows 95 programs expect components such as Calculator and Solitaire to be in the %SystemRoot% folder, but in Windows Vista these are in the %SystemRoot%\System32\ folder. The Win95 layer intercepts such file calls and reroutes them to the appropriate location.

The Win95 layer consists of dozens of such fixes, which are part of a large database of incompatibilities maintained by Microsoft. As of this writing, hundreds of incompatibilities have been identified, and others might be found in the future. To get access to all these fixes and so get fine-tuned control over the compatibility issues relating to any legacy program, you need to use Application Compatibility Toolkit (ACT). Download and install the latest version of ACT (version 5.0 was in beta testing as of this writing) from the following Microsoft web page: go.microsoft.com/fwlink/?LinkID=36665

Other  
  •  Windows Vista : Installing and Running Applications - Practicing Safe Setups
  •  Windows Server 2003 : Domain Name System - Command-Line Utilities
  •  Computer Planet I7 Extreme Gaming PC
  •  Windows Vista : Web and Email (part 4) - Change the Default Email Reader, Stop Spam, Send Large Files
  •  Windows Vista : Web and Email (part 3) - Stop Annoying Animations, Opt Out of Tabbed Browsing, Surf Anonymously
  •  Windows Vista : Web and Email (part 2)
  •  Windows Vista : Web and Email (part 1) - Lock Down Internet Explorer, Change Internet Shortcut Icons
  •  Windows 7 : Zero Touch Installations - Monitoring Deployment Progress
  •  Windows 7 : Zero Touch Installations - Deploying Windows 7 (part 3) - Performing the Zero Touch Installation
  •  Windows 7 : Zero Touch Installations - Deploying Windows 7 (part 2) - Edit the Deployment Task Sequence
  •  
    Most View
    Programming Windows Services with Microsoft Visual Basic 2008 : Service Notification
    BlackBerry Development : Pushing Data to External Users - Web Signals (part 5) - Building a Web Signal - Requesting the Status of a Subscription
    DirectX 10 : The 2D Resurgence - Getting the Sprites Moving
    SQL Server 2012 : Measuring SQL Server Performance (part 1) - Understanding Performance Counters
    Not Bad For A Monkey (Part 2)
    HTC One - Great For Music-Lovers (Part 3)
    Toshiba SSD PC Upgrade Kit 60GB
    LINQ to Objects : How to Join with Data in Another Sequence (part 6) - One-to-Many Joins - The join Operator
    Automating Windows 7 Installation : Creating Your First Image, Using the Windows Automated Installation Kit
    Apache Cassandra The Crash-Proof Nosql Database (Part 2)
    Top 10
    Windows 8 : Monitoring, optimizing, and troubleshooting system health and performance (part 5) - Monitoring system resources by using Performance Monitor
    Windows 8 : Monitoring, optimizing, and troubleshooting system health and performance (part 4) - Configuring and analyzing event logs
    Windows 8 : Monitoring, optimizing, and troubleshooting system health and performance (part 3) - Using Windows Action Center
    Windows 8 : Monitoring, optimizing, and troubleshooting system health and performance (part 2) - App history, Startup, Services
    Windows 8 : Monitoring, optimizing, and troubleshooting system health and performance (part 1) - Processes, Performance
    Sharepoint 2013 : List and library essentials - Creating and deleting lists
    Sharepoint 2013 : List and library essentials - Using your apps
    Sharepoint 2013 : Developing Applications Using Office Services - What’s New in Access Services
    Sharepoint 2013 : Developing Applications Using Office Services - The New Machine Translation Services
    Sharepoint 2013 : Developing Applications Using Office Services - Word Automation Services and the New PowerPoint Automation Services