简体   繁体   中英

Check if the current OS is Windows 8.1 using Inno Setup Pascal Script

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;

Windows 8.1 is Windows version 6.3.

The easiest is to check the return value of the GetWindowsVersion function , which is $MMNNBBBB ( M ajor, mi N or, B uild).

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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