次の方法で共有


White Lies - Using AppVerifier to Test OS Versioning

 Among other things, our team is testing International applications on Windows 7. We focus on delivering comparable experience to international customers (i.e. customers who are using non-English UI) to help ensuring key applications work on international versions of windows as well as the English equivalents work on the English version of Windows. We also go deeper per market to understand specific applications that are key to those markets to ensure compatibility with Windows 7 as we build it.

 

While we find some issues, that are specific to certain markets (e.g. Input Method Editor compatibility for East Asian markets), most of the bugs that we encounter are generic compatibility issues such Least-Privileged User Account (LUA) problems, high DPI display issues, or incorrect handling of OS versioning information, which is discussed in the following.

 

OS Versioning

We found that quite a few applications fail to install or run on Windows 7, simply because the version check does not account for future versions of Windows. Typically, there is a pre-requisite check in the installer, that calls GetVersionEx/GetVersion to find out if the current operating system is supported or not.

 

In many cases, the installer checks if dwMajorVersion is 5, which covers Windows 2000, Windows XP, and Windows Server 2003.

 

However, for Windows 7 (the version number is 6.1) the check will fail and the application won't install or execute.

 

Testing with AppVerifier

Microsoft Application Verifier (AppVerifier) can help you to find out how your application handles version information of future Windows releases.

 

AppVerifier is a runtime verification tool used in testing applications for compatibility with Microsoft Windows. This tool can be used to test for a wide variety of known compatibility issues while the application is running.

 

One of these tests (HighVersionLie) was developed to test an applications behavior on future Windows releases.

The HighVersionLie AppVerifier shim intercepts calls to the GetVersion/ GetVersionEx API and allows the user to specify the values of the returned OSVERSIONINFO/OSVERSIONINFOEX data structure. This way it is possible to simulate future and legacy Windows version as well as different machine roles. If you don't specify any custom property values, Major version will return the current major version + 2 (e.g. 8 for Windows Vista).

 

The Properties dialog allows you to override the following values:

 

Major Version

The major version number of the operating system.

Minor Version

The minor version number of the operating system.

Build Number

The build number of the operating system.

CSD Version

A null-terminated string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty.

Service Pack Major

The major version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the major version number is 3. If no Service Pack has been installed, the value is zero.

Service Pack Minor

The minor version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the minor version number is 0.

Suite Mask

A bit mask that identifies the product suites available on the system. This member can be a combination of the following values.

Product Type

Any additional information about the system.

For example, you can use the Product Type property to simulate different machine roles:

 

Value

Meaning

VER_NT_DOMAIN_CONTROLLER

0x0000002

The system is a domain controller and the operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.

VER_NT_SERVER

0x0000003

The operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.

Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER.

VER_NT_WORKSTATION

0x0000001

The operating system is Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional.

 

You can also use the command-line version of AppVerifier to specify which tests to apply.

 

The following command causes your test machine to pretend to run Windows 7 when asked by Windows Installer:

 

appverif -enable HighVersionLie -for msiexec.exe -with "Major Version":6 "Minor Version":1

 

Use the following command to reset your test machine:

 

appverif -disable HighVersionLie -for msiexec.exe

 

While this test method certainly is no substitute for compatibility test passes on different operating systems, it allows you to quickly test how your application or setup code handles different OS versions - even for future Windows releases.

Comments