Windows 8 and 8.1

Windows specific forum
mikejs
Enthusiast
Enthusiast
Posts: 175
Joined: Thu Oct 21, 2010 9:46 pm

Windows 8 and 8.1

Post 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)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Windows 8 and 8.1

Post 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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Windows 8 and 8.1

Post 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.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
mikejs
Enthusiast
Enthusiast
Posts: 175
Joined: Thu Oct 21, 2010 9:46 pm

Re: Windows 8 and 8.1

Post 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.
mikejs
Enthusiast
Enthusiast
Posts: 175
Joined: Thu Oct 21, 2010 9:46 pm

Re: Windows 8 and 8.1

Post 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?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Windows 8 and 8.1

Post 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?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Windows 8 and 8.1

Post 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:

I am to provide the public with beneficial shocks.
Alfred Hitshock
PureGuy
Enthusiast
Enthusiast
Posts: 102
Joined: Mon Aug 30, 2010 11:51 am

Re: Windows 8 and 8.1

Post by PureGuy »

Your Program need to run in 8.1 compatibly mode.

http://msdn.microsoft.com/en-us/library ... 02074.aspx
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Windows 8 and 8.1

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Windows 8 and 8.1

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
mikejs
Enthusiast
Enthusiast
Posts: 175
Joined: Thu Oct 21, 2010 9:46 pm

Re: Windows 8 and 8.1

Post 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.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Windows 8 and 8.1

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Windows 8 and 8.1

Post 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
"Have you tried turning it off and on again ?"
A little PureBasic review
Thade
Enthusiast
Enthusiast
Posts: 266
Joined: Sun Aug 03, 2003 12:06 am
Location: Austria

Re: Windows 8 and 8.1

Post 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.
--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
PureGuy
Enthusiast
Enthusiast
Posts: 102
Joined: Mon Aug 30, 2010 11:51 am

Re: Windows 8 and 8.1

Post 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?
Post Reply