January 1, 2005

WinTask - GetVersionEx

'
' GetVersionEx
'
' Author: Joe Strazzere
'

'"kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type
'
'OSVERSIONINFO
'dwOSVersionInfoSize As Long
'dwMajorVersion As Long
'dwMinorVersion As Long
'dwBuildNumber As Long
'dwPlatformId As Long
'szCSDVersion As String * 128
dim pointer as unsigned
dim pointer2 as unsigned
pointer=allocate(1000)
pokeinteger(pointer,148,4)
a=External("kernel32","GetVersionExA",pointer)
pointer2=pointer + 0
OSVersionInfoSize   =  peekinteger(pointer2,4)
pointer2 = pointer + 4
MajorVersion   = peekinteger(pointer2,4)
pointer2 = pointer + 8
MinorVersion   = peekinteger(pointer2,4)
pointer2 = pointer + 12
BuildNumber   = peekinteger(pointer2,4)
pointer2 = pointer + 16
PlatformId   = peekinteger(pointer2,4)
pointer2 = pointer + 20
CSDVersion$   = peekstring$(pointer2)
msgtxt$="Version Information"+crlf+crlf
msgtxt$=msgtxt$+"OS Version size :"+str$(OSVersionInfoSize)+crlf
msgtxt$=msgtxt$+"Major Version :"+str$(MajorVersion)+crlf
msgtxt$=msgtxt$+"Minor Version :"+str$(MinorVersion)+crlf
msgtxt$=msgtxt$+"Build Number :"+str$(BuildNumber)+crlf
msgtxt$=msgtxt$+"Platform ID (1=95/98, 2=NT):"+str$(PlatformId)+crlf
msgtxt$=msgtxt$+"CSD Version :"+CSDVersion$
msgbox(msgtxt$,,"GetVersionEx")