Previously I was using:
{ Check Windows Version }
WindowsVersion := GetWindowsVersion;
Log(Format('Windows Version: %x', [WindowsVersion]));
Now I am using:
{ Check Windows Version }
GetWindowsVersionEx(WinVer);
WinVerPacked := PackVersionComponents(WinVer.Major, WinVer.Minor, WinVer.Build, 0);
Where WinVer
is of type TWindowsVersion
. How do we now handle the Log
entry?
Why do you want to log it, if it is logged already by Inno Setup?
2020-11-17 16:26:59.234 Windows version: 10.0.19041 (NT platform: Yes)
Anyway, there's nothing preventing you from continuing to use GetWindowsVersion
for logging purposes, even if you now use GetWindowsVersionEx
for the version check.
PackVersionComponents
return value is actually similar to GetWindowsVersion
, so you can log it directly:
Log(Format('Windows Version: %x', [WinVerPacked]));
It will just have more zeroes in the output:
2020-11-17 16:26:59.337 Windows Version: A00004A610000
Though it's similarly user unfriendly as your previous logging of GetWindowsVersion
:
2020-11-17 16:26:59.337 Windows Version: A004A61
More user friendly is indeed to use TWindowsVersion
components.
Log(Format('Windows Version: %d.%d.%d', [WinVer.Major, WinVer.Minor, WinVer.Build]));
That will get you what Inno Setup logs in its header:
2020-11-17 16:26:59.337 Windows Version: 10.0.19041
Though, if you log TWindowsVersion
returned by GetWindowsVersionEx
, you can make your life easier by logging output of GetWindowsVersionString
:
Log(Format('Windows Version: %s', [GetWindowsVersionString]));
which does pretty much the same:
2020-11-17 16:26:59.337 Windows Version: 10.00.19041