Windows 8 Consumer Preview Wrong Major Version?
Asked Answered
I

2

5

I am using this code to detect the WindowsVersion on a PC.

function GetOS: string;
var
 osVerInfo: TOSVersionInfo;
 majorVer, minorVer: Integer; 
begin
Result := 'Unknown';
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(osVerInfo) then
 begin
  majorVer := osVerInfo.dwMajorVersion;
  minorVer := osVerInfo.dwMinorVersion;
  case osVerInfo.dwPlatformId of
  VER_PLATFORM_WIN32_NT: {Mirosoft Windows NT/2000 }
    begin
      if majorVer <= 4 then
        Result := 'Win NT'
      else if (majorVer = 5) and (minorVer = 0) then
        Result := 'Win 2k'
      else if (majorVer = 5) and (minorVer = 1) then
        Result := 'Win XP'
      else if (majorVer = 6) and (minorVer = 0) then
        Result := 'Win Vista'
      else if (majorVer = 6) and (minorVer = 1) then
        Result := 'Win 7'
      else if (majorVer = 6) and (minorVer = 2) then
        Result := 'Win 8'
    end;
  VER_PLATFORM_WIN32_WINDOWS:  { Windows 9x/ME }
    begin
      if (majorVer = 4) and (minorVer = 0) then
        Result := 'Win 95'
      else if (majorVer = 4) and (minorVer = 10) then
      begin
        if osVerInfo.szCSDVersion[1] = 'A' then
          Result := 'Win 98SE'
        else
          Result := 'Win 98';
      end
      else if (majorVer = 4) and (minorVer = 90) then
        Result := 'Win ME'
    end;
  end;
end;
end;

For some reason it says that Windows8 Consumer Preview Build 8250 (32bit) is Windows XP - Major Version 5. I checked and it's supposed to be Version 6.2 (according to notepad.exe on windows8) Is this a bug or is something wrong? btw. my Windows 8 is up2date.

Any Ideas?

EDIT: ScreenShot GETOS

Insphere answered 11/5, 2012 at 19:14 Comment(8)
Have you tried debugging it? Check to see what you get back in osVerInfo and trace through it to see how you end up with that result. That'll give you an idea of what's going on.Sadism
I looked through the entire osVerInfo and debugged it. It says Major Version 5.Insphere
maybe your app is running under XP compatibility mode ?Winthrop
The GetVersionEx function works fine under Windows 8, I just tested a Delphi XE2 application under Windows 8 Developer Preview and the GetVersionEx returns 6.2, so has @AntonioBakula says probably your are executing you app in XP compatibility mode.Salutary
That was it. The Delphi7 IDE runs under compatibility mode. I totally forgot about that. Thank you very much.Insphere
Then would be fair if @Antonio post that as the answer and you would accept it ;-)Caesaria
posted as answer, I wasn't sure that this was a reason so I posted comment :)Winthrop
FWIW The Delphi IDE, even for D7, does not need compat mode.Tejada
W
11

The reason for this behavior is XP Compatibility mode, Delphi 7 IDE was running under compatibility mode.

Winthrop answered 11/5, 2012 at 19:40 Comment(0)
M
1

For Windows 8.0 the version 6.2 is correct - also the Build-Number. With Windows 8.1 you get version 6.2 too. But now the Version-Number ist 6.3 Build 9600. You can see it in the system-info. GetVersionEx allows only 0,1,2 for Win32MinorVersion. If you need this info, you can read it from registry-key 'Version' in HKCU\Software\Microsoft\Internet Explorer\Main\WindowsSearch. Best regards, asks

Moynahan answered 22/10, 2013 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.