Obtain the OS name?

Blitz3D Forums/Blitz3D Beginners Area/Obtain the OS name?

_PJ_(Posted 2009) [#1]
Is there any means to acquire the name of the OS that a B3D app is run on?

Alternatively, does Vista have a "winver.exe" file?
What about Windows 7 or perhaps, non-Microsoft OS... ?


Ked(Posted 2009) [#2]
non-Microsoft OS...

Blitz3D and BlitzPlus are Windows-only.


_PJ_(Posted 2009) [#3]
That helps some, so what values does GetEnv$("OS") reyturn by default on Vista or Windows 7? Anyone know?


Ked(Posted 2009) [#4]
On Windows 7 it returns Windows_NT like Windows XP, so I think Windows Vista will do the same.

I remember something being posted in the code archives that will do what you are asking, but it was BlitzMax code. It should be portable to B3D.


Warner(Posted 2009) [#5]
Maybe this archive entry can do that?
http://www.blitzbasic.com/codearcs/codearcs.php?code=922


xlsior(Posted 2009) [#6]
Windows NT, 2000, XP, Vista and 7 will all return Windows_NT as the OS.
You can tell them apart base don the version number:

NT = 4.0
2000 = 5.0
XP = 5.1
Vista = 6.0
Windows 7 = 6.1 (Gotta love that one -- It does show that MS considers it to be an incremental Vista update, not an new product line)

There's some windows API's that will return the actual version number.


Barnabius(Posted 2009) [#7]
Windows 7 = 6.1 (Gotta love that one -- It does show that MS considers it to be an incremental Vista update, not an new product line)


Actually, the reason is completely different and it has to do with the silly programs written by everyone else, which check only for the numbers they know about. Some of them even check the first digit only. Therefore a decision was made to have Windows 7 respond with 6.1. A far more plausible reason than the Vista update...

Barney


xlsior(Posted 2009) [#8]
Still, calling version 6.1 "version 7" seems ambiguous at best.


John Blackledge(Posted 2009) [#9]
Barnabius, that makes as much sense as the internal name for the XP Start Bar being Program Manager.

Your explanation sounds like an MS 'whoops, found out' explanation.

No programmer would only get the first digit of an OS version.


_PJ_(Posted 2009) [#10]
Exceellent stuff, Thanks a lot folks. Seems I have something. Warner's link was really handy and I don't even need to be fluent in Deutsch :D

It correctly returns Windows XP for me.

So going by the info from Ked and Xlsior:

NT = 4.0
2000 = 5.0
XP = 5.1
Vista = 6.0
Windows 7 = 6.1



The following (Ive altered the code archives stuff a little to include (hopefully) Windows Vista and Win7...

Would anyone mind testing this for me? You will need the "decls" in your userlibs folder:
.lib "kernel32.dll"
api_GetVersionEx% (lpVersionInformation*) : "GetVersionExA"
api_RtlMoveMemory(Destination*,Source,Length) : "RtlMoveMemory"

.lib "comdlg32.dll"
api_GetOpenFileName% (pOpenfilename*) : "GetOpenFileNameA"
api_GetSaveFileName% (pOpenfilename*) : "GetSaveFileNameA"


I'm particularly interested now, having noticed, whether the "Platform" Identification makes any difference if the OS is 64-bit. Any results people can post will be really helpful, thanks :D

And here's the bb test:


http://www.blitzbasic.com/codearcs/codearcs.php?code=922#comments


_PJ_(Posted 2009) [#11]
Windows Vista 32-bit seems to be returned correctly


_PJ_(Posted 2009) [#12]
Anyone with Windows 7, please?

There's really not much involved, jsut a tiny .decls file and the BB code.


nawi(Posted 2009) [#13]
Blitz3D and BlitzPlus are Windows-only.

Not really, wine can run Blitz3D/+ apps quite well. I think wine returns Windows-something depending on the config though.