GetVersionEx Not Working on Windows 7?!

Posted by Andreas Rejbrand on Stack Overflow See other posts from Stack Overflow or by Andreas Rejbrand
Published on 2010-04-10T12:20:15Z Indexed on 2010/04/10 12:23 UTC
Read the original article Hit count: 386

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about getversionex

Related posts about winapi