Reputation: 20474
I would like to determine whether the current OS is Windows 8.1.
I know this could be solved analyzing the NT version number (6.3) of the current Windows version, but I don't know how to do it under Pascal script.
Pseudo-Code:
// Occurs when the installer initializes.
function InitializeSetup(): Boolean;
begin
if IsWindows81 then
begin
Result := IsKBInstalled('KB2919355');
if not Result then
MsgBox('Windows Update package "KB2919355" not found.', mbError, MB_OK);
end;
else
begin
Result := True
end;
end;
Upvotes: 0
Views: 1203
Reputation: 202514
Windows 8.1 is Windows version 6.3.
The easiest is to check the return value of the GetWindowsVersion
function, which is $MMNNBBBB
(Major, miNor, Build).
function IsWindows81OrLater: Boolean;
begin
Result := (GetWindowsVersion >= $06030000);
end;
If you want to check for Windows 8.1 only, use:
function IsWindows81: Boolean;
begin
Result := (GetWindowsVersion >= $06030000) and (GetWindowsVersion <= $0603FFFF);
end;
See also Determine Windows version in Inno Setup.
Upvotes: 2