Hi,
Hallo kennt jemand eine function die sauber die Windows Version zurück gibt.
Danke für jeden Tipp im voraus.
Here a trick that can't be fooled by Windows Compatibility, that work for 32bit and 64bit.
Delphi-Quellcode:
type
TWinVersion =
record
Major: Cardinal;
Minor: Cardinal;
end;
function GetWinVersion: TWinVersion;
const
// Address of USER_SHARED_DATA (KUSER_SHARED_DATA) is always at FS/GS:[0x7FFE0000]
KUSER_SHARED_DATA = $7FFE0000;
begin
// NtMajorVersion is at offset $26C, NtMinorVersion at $270
// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm
Result.Major := PCardinal(KUSER_SHARED_DATA + $26C)^;
Result.Minor := PCardinal(KUSER_SHARED_DATA + $270)^;
end;
As for build number is little more trickier and while it is backward compatible, there is no guarantee it will work in future, but you can
access the build number by reading NtBuildNumber, whcih changed its index in the past.
Zitat:
0x0244 (4.0 to 5.1);
0x0248 (5.2 to 6.1);
0x0260