Page 1 of 3

Windows 8 and 8.1

Posted: Tue Nov 12, 2013 4:04 pm
by mikejs
It looks like PB returns #PB_OS_Windows_8 from OSVersion() on both 8.0 and 8.1.

Is there any easy way of telling whether you're running on 8.1 or not?

(Using 5.20)

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 4:19 pm
by IdeasVacuum
It does not return #PB_OS_Windows_Future? ( = 200)

Code by IT-994A

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  osv.OSVERSIONINFO
  osv\dwOSVersionInfoSize = SizeOf(OSVERSIONINFO)
  GetVersionEx_(@osv)
  os.s = Str(osv\dwMajorVersion)
  os + "." + Str(osv\dwMinorVersion)
  os + "." + Str(osv\dwBuildNumber)
CompilerEndIf

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 4:27 pm
by c4s
@IdeasVacuum
No, he's right. #PB_OS_Windows_8 is returned on Windows 8.1. By the way, the internal Windows version is 6.2 for 8 and 6.3 for 8.1.

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 4:36 pm
by mikejs
IdeasVacuum wrote:It does not return #PB_OS_Windows_Future? ( = 200)

Code by IT-994A

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  osv.OSVERSIONINFO
  osv\dwOSVersionInfoSize = SizeOf(OSVERSIONINFO)
  GetVersionEx_(@osv)
  os.s = Str(osv\dwMajorVersion)
  os + "." + Str(osv\dwMinorVersion)
  os + "." + Str(osv\dwBuildNumber)
CompilerEndIf
OSVersion() returns 90, which I think is the same as 8.0 (I don't have an 8.0 machine to hand to check).

The above code returns 6.2.9200, which I think is the same as 8.0 aside from the buildnumber. Still, I can use the build number to distinguish in the meantime.

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 4:51 pm
by mikejs
mikejs wrote: ...
OSVersion() returns 90, which I think is the same as 8.0 (I don't have an 8.0 machine to hand to check).

The above code returns 6.2.9200, which I think is the same as 8.0 aside from the buildnumber. Still, I can use the build number to distinguish in the meantime.
...

Ok, Now I'm really confused.

The above code returns 6.2.9200.

Looking in the registry (HKLM\Software\Microsoft\Windows NT\CurrentVersion), I see:

CurrentVersion = 6.3
CurrentBuild = 9600

Any reason why the api calls would not match the registry?

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 5:53 pm
by IdeasVacuum
Well, at least we know from CS4 that the registry values you have found are correct for Win8.1. I'm always loath to query the registry as a solution though because it very often is not correct. Why GetVersionEx_() fails is a mystery. What happens if you Import GetVersionEx instead? Same result?

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 6:35 pm
by fsw
c4s wrote:@IdeasVacuum
By the way, the internal Windows version is 6.2 for 8 and 6.3 for 8.1.
That's the Microsoft way: let's confuse everyone instead of naming it the way it really is.
The only problem with that is that you not only confuse outside developers but also the ones that work in Redmond.

No wonder they are always late to the party...

But who needs a party when he makes $2B a year on Android patents.
(without writing one line of code for it...)

I really need the phone number of the Microsoft patent lawyer :mrgreen:

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 6:42 pm
by PureGuy
Your Program need to run in 8.1 compatibly mode.

http://msdn.microsoft.com/en-us/library ... 02074.aspx

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 11:19 pm
by PB
> It does not return #PB_OS_Windows_Future?

Why should it? It's still Windows 8, not Windows 9.
OSVersion() just returns the base, not the revision.

Re: Windows 8 and 8.1

Posted: Tue Nov 12, 2013 11:29 pm
by IdeasVacuum
According to Microsoft, 8.1 is not a service pack as such, but a new version of the OS. That might be 'technically untrue', but that is their marketing - sounds similar to Apple? No matter, if you need a function that reports the exact OS version, and MS is telling their Users 8.1 is an OS in it's own right, you can't have your app telling them it's 8.0.

Re: Windows 8 and 8.1

Posted: Wed Nov 13, 2013 11:07 am
by mikejs
PureGuy wrote:Your Program need to run in 8.1 compatibly mode.

http://msdn.microsoft.com/en-us/library ... 02074.aspx
Thanks, that clears up what's going on with the api calls.

In this case, the program is generating desktop wallpaper, and includes the OS version on it, so it ideally needs to reflect the real version of the OS. As it's just dealing with it as text, I can probably just read it from the registry.

Re: Windows 8 and 8.1

Posted: Wed Nov 13, 2013 10:38 pm
by IdeasVacuum
You can't rely 100% on the Registry being correct though - even MS gets this wrong (see the posts re Direct X registry entries). There may well be a system component that exists for Win8.1 but not for Win8.0 So your code could check for that.

Re: Windows 8 and 8.1

Posted: Thu Nov 14, 2013 6:44 pm
by luis
PureGuy wrote:Your Program need to run in 8.1 compatibly mode.
The reasoning behind seems a little strange: "some programmers are idiots so we did this".

Some amusing comments about this -> http://social.msdn.microsoft.com/Forums ... windowssdk

Re: Windows 8 and 8.1

Posted: Thu Nov 14, 2013 8:52 pm
by Thade
You can even get the numbers for Win XP with GetVersion() on Windows 8.1 - because GetVersion reports the Compatibility Mode you have set for the certain program.
I hopped with an USB-Stick and new copies of a program between my LapTop (Win 8.1) and another PC (Win 7) for half an hour until I noticed that the Program, which tested the OS Version was set to Win XP compatibility before. And every new version I copied over the old one had still this mode set.

Re: Windows 8 and 8.1

Posted: Thu Nov 14, 2013 9:25 pm
by PureGuy
luis wrote: The reasoning behind seems a little strange: "some programmers are idiots so we did this".
Yeah, that real strange move form microsoft.
However, I think PB's OSVersion() functions should be updated.

Or does anyone agree with this new ms way?