Windows 7 is released but its version is called 6.1 instead of 7. Well, the reason behind this is experience.
The last major version change was when Vista came out. The major version changed from 5 to 6 and thus many application stopped working. The reason is simply an incorrect implementation
These are the results:
| MajorVersion | MinorVersion | Condition Result |
| … | … | … |
| 4 | 1 | False |
| 4 | 2 | False |
| 4 | 3 | False |
| 5 | 0 | False |
| 5 | 1 | True |
| 5 | 2 | True |
| 5 | 3 | True |
| 6 | 0 | False |
| 6 | 1 | True |
| 7 | 0 | False |
| 7 | 1 | True |
As you can see this code works for Windows XP (5.x) but no more for Vista without SP (6.x). MS didn’t want to repeat history for Windows 7 (or didn’t want to release a Windows 7 SP1) and just refused to increase the major version.
Please go and check your version checking implementations again so your apps won’t refuse to run on Windows 8 or 9 or 10…
3 Responses
Robert Cram
24|Oct|2009 1I think there is a small typo in the code. Shouldn’t the first term in the boolean expression read:
(Win32MajorVersion > AMajor) instead of (Win32MajorVersion >= AMajor)
Christian Wimmer
24|Oct|2009 2Yes, thanks. I had to retype the code because the code highliter recognizes greater and smaller signs as end of code tag.
murphy
24|Oct|2009 3You can do this also:
if ((Win32MajorVersion*100+Win32MinorVersion)>=600) then
begin
// do stuff here
end;
This should also be safe for future versions.
Cheers, murphy
Leave a reply