简体   繁体   English

Windows 2012 R2中的GetWindowsVersionEx函数输出错误

[英]GetWindowsVersionEx function wrong output in windows 2012 R2

We are using the "GetWindowsVersionEx" function to extract the build version values in windows. 我们使用“GetWindowsVersionEx”函数来提取Windows中的构建版本值。 It is working perfectly in all the Operating systems, But in Windows 2012-R2 released recently it is giving the wrong output. 它在所有操作系统中都运行良好,但在最近发布的Windows 2012-R2中,它输出错误。 The actual build version is 6.3 but its showing as 6.2 only. 实际构建版本为6.3,但仅显示为6.2。 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. 但是,我不明白如何在inno设置代码中实现这一点。

Help appreciated. 帮助赞赏。

Link: http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074%28v=vs.85%29.aspx 链接: 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;

This is by design in Windows 8.1 and Server 2012-R2 . 这是在Windows 8.1和Server 2012-R2中设计的 It will return the latest version of Windows that the application says it supports via the application manifest. 它将返回应用程序说它通过应用程序清单支持的最新版本的Windows。

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: Inno安装版本5.5.3及更低版本仅标记为与Windows 8兼容。截至Inno Setup 5.5.4 ,它已更新为支持Windows 8.1:

Added the Windows 8.1 "compatibility" section to the various manifest resources used by Inno Setup. 将Windows 8.1“兼容性”部分添加到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). 这使得对操作系统版本的任何检查都可以获得实际版本号(6.3),而不是获得与Windows 8(6.2)中相同的版本号。

tl;dr: Upgrade to the latest version of Inno Setup. tl; dr:升级到Inno Setup的最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM