On my Windows 7 system, the GetVersionEx Windows API function returns "6.0", indicating Windows Vista, when it should return "6.1".
If it matters, I used the following Delphi code:
function winver: string;
var
ver: TOSVersionInfo;
begin
ver.dwOSVersionInfoSize := SizeOf(ver);
if GetVersionEx(ver) then
with ver do
result := IntToStr(dwMajorVersion) + '.' + IntToStr(dwMinorVersion) + '.' + IntToStr(dwBuildNumber) + ' (' + szCSDVersion + ')';
end;
and the string "6.0.6002 (Service Pack 2)" was returned.
Isn't this highly odd?
I now found that GetVersionEx returns Vista when my application runs through the Delphi 2009 debugger, but Windows 7 when the application is executed alone. I also found that RAD Studio (the Delphi IDE) actually runs in compatibility mode for Windows Vista SP2. Hence everything makes sense, for, as pointed out by kibab, a child process will "inherit" the compatibility settings of its parent process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With