Page 1 of 1

OSVersion() bug?

Posted: Thu Apr 09, 2009 6:02 pm
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

Posted: Thu Apr 09, 2009 6:23 pm
by freak
Its because XP 64bit has the same version number as Server 2003 (5.2)
I will fix the detection.

Posted: Thu Apr 09, 2009 6:30 pm
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?

Posted: Thu Apr 09, 2009 6:46 pm
by freak
Just use that code for the moment.

Posted: Thu Apr 09, 2009 7:00 pm
by Inf0Byt3
Ok, thanks.

Posted: Fri Apr 10, 2009 2:58 am
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.

Posted: Fri Apr 10, 2009 3:03 am
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.

Posted: Fri Apr 10, 2009 3:05 am
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

Posted: Sun Apr 26, 2009 2:07 pm
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

Posted: Sun Apr 26, 2009 5:10 pm
by Inf0Byt3
Hi nco2k, thanks for the information and the update, it's much appreciated.