OSVersion() bug?

Just starting out? Need help? Post your questions and find answers here.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

OSVersion() bug?

Post by Inf0Byt3 »

The following code compiled with the 32 bit version of PureBasic then run on XP Pro 64 bit displays "#PB_OS_Windows_Server_2003". Is that correct or am I missing something? On XP 32 bit it displays XP, as expected.

Code: Select all

Select OSVersion()

  Case #PB_OS_Windows_NT3_51
    MessageRequester("","#PB_OS_Windows_NT3_51")
    
  Case #PB_OS_Windows_95
    MessageRequester("","#PB_OS_Windows_95")
  
  Case #PB_OS_Windows_NT_4
    MessageRequester("","#PB_OS_Windows_NT_4")
  
  Case #PB_OS_Windows_98
    MessageRequester("","#PB_OS_Windows_98")
  
  Case #PB_OS_Windows_ME
    MessageRequester("","#PB_OS_Windows_ME")
  
  Case #PB_OS_Windows_2000
    MessageRequester("","#PB_OS_Windows_2000")
  
  Case #PB_OS_Windows_XP
    MessageRequester("","#PB_OS_Windows_XP")
  
  Case #PB_OS_Windows_Server_2003
    MessageRequester("","#PB_OS_Windows_Server_2003")
  
  Case #PB_OS_Windows_Vista
    MessageRequester("","#PB_OS_Windows_Vista")
  
  Case #PB_OS_Windows_Server_2008
    MessageRequester("","#PB_OS_Windows_Server_2008")
  
  Case #PB_OS_Windows_Future
    MessageRequester("","#PB_OS_Windows_Future")

EndSelect
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
freak
PureBasic Team
PureBasic Team
Posts: 5824
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Its because XP 64bit has the same version number as Server 2003 (5.2)
I will fix the detection.
quidquid Latine dictum sit altum videtur
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Thanks for the information Timo. I had a look at GetVersionEx and you are right, it has the same minor and major version. I found some code that works OK on the german forum (it checks for wProductType as well):

http://www.purebasic.fr/german/viewtopic.php?t=11620

Is there a chance to get a beta lib or I should use the code above for the moment?
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
freak
PureBasic Team
PureBasic Team
Posts: 5824
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Just use that code for the moment.
quidquid Latine dictum sit altum videtur
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Ok, thanks.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Hey freak, does XP 64 and Server2003 have the same API though? If they do, then no harm done, but if XP 64 is more like XP and thus lack features that 2003 have then obviously they should be differentiated.
Mistrel
Addict
Addict
Posts: 3379
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

XP and Windows Server have different APIs. For example, Windows Server can create a DFS (Distributed File System) root node while Windows XP, even though the same API is exposed, cannot. There are also additional services and dynamic libraries.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Yeah, but wasn't XP 64 based on Server 2003, while 32bit XP was based on Windows 2000 though?

EDIT: Found this http://en.wikipedia.org/wiki/XP_64-Bit# ... 64_Edition
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

@Inf0Byt3
that code was somewhere in this forum for 2-3 years. i updated it now to support Windows 7 and Windows Server 2008 R2 and posted it in tricks n tips: http://www.purebasic.fr/english/viewtopic.php?t=37240

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Hi nco2k, thanks for the information and the update, it's much appreciated.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
Post Reply