A customer reported that when their application called the GetVersionEx
function, it sometimes reported incorrect values. Specifically, the logs collected from clients shows that the first time the program was run on a Windows 7 machine, the operating system was correctly reported as 6.1.7600 (Windows 7), but the second time it was run, the operating system was erroneously reported as 6.0.6000 (Windows Vista).
This was definitely strange behavior, and upon further questioning, the customer admitted that their application was a setup program.
The fact that it was a setup program was the missing ingredient.
What happened is that the setup program ran, correctly detected the version as Windows 7, and then started installing its pre-requisite components. The installer for one of the pre-requisites failed, causing the entire setup to fail.
The Program Compatibility Assistant noticed that the initial attempt to install the program failed, and it guessed (based on its internal heuristics) that the problem was that the program had an incorrect operating system version check. After the first setup failed, the Program Compatibility Assistant puts up a dialog box saying, “Hey, I think I know what went wrong. This setup program has a bad operating system version check. Do you want to give it another shot?” If the client says, “Go for it”, then it will run the setup program again, but with a false operating system version.
Unfortunately, the heuristic that the Program Compatibility Assistant used was a false positive in this case, so saying “Go for it” was the wrong answer. (Not like the client had any idea. This was a case of the computer asking the user a question they cannot answer.)
The fix is to add a manifest to the setup program specifying whether it needs to run as administrator. It doesn’t matter what the manifest says as its requirements; the fact that the manifest said anything at all means that the setup program understands the new rules introduced in Windows Vista and doesn’t need the Program Compatibility Assistant’s help.
(You can read the Excluding Programs from PCA section for other ways to disable the Program Compatibility Assistant for a program.)
0 comments