user1752602
user1752602

Reputation: 423

GetWindowsVersionEx function wrong output in windows 2012 R2

We are using the "GetWindowsVersionEx" function to extract the build version values in windows. It is working perfectly in all the Operating systems, But in Windows 2012-R2 released recently it is giving the wrong output. The actual build version is 6.3 but its showing as 6.2 only. So, when i have done some research i found the below link to solve the issue. But, i am not understanding how can i implement this in inno setup code.

Help appreciated.

Link: http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074%28v=vs.85%29.aspx

[Setup]
AppName=My Program
AppVersion=1.5
DisableProgramGroupPage=yes
DefaultGroupName=My Program

OutputDir=c:\output
DefaultDirName={sd}\MYPROG
UninstallDisplayIcon={app}\MyProg.exe


[code]
var
 Version: TWindowsVersion;
function InitializeSetup(): Boolean;
begin
             GetWindowsVersionEx(Version);
             SuppressibleMsgBox('Major='+ IntToStr(Version.Major)+ ' Minor='+IntToStr(Version.Minor),mbCriticalError, MB_OK, MB_OK);

end;

Upvotes: 3

Views: 1551

Answers (1)

Deanna
Deanna

Reputation: 24283

This is by design in Windows 8.1 and Server 2012-R2. It will return the latest version of Windows that the application says it supports via the application manifest.

Inno setup versions 5.5.3 and below were only marked as compatible with up to Windows 8. As of Inno Setup 5.5.4, it was updated to support Windows 8.1:

Added the Windows 8.1 "compatibility" section to the various manifest resources used by Inno Setup. This enables any check for the operating system version to get the real version number (6.3) instead of getting the same version number as it did in Windows 8 (6.2).

tl;dr: Upgrade to the latest version of Inno Setup.

Upvotes: 6

Related Questions