OS Version
Posted: Tue Jul 26, 2011 1:09 pm
Using this (from the help) to get the OS version:
.....and looking up a registry key to determine OS bits:
.... works perfectly but it's not enough. I really need to confirm that the PC has the latest OS Service Pack installed. Where is the most reliable place to find that info?
Code: Select all
Procedure.s GetOsVersn()
;----------------------
sVersion.s = ""
Select OSVersion()
Case #PB_OS_Windows_NT3_51: sVersion = "Windows NT3.51"
Case #PB_OS_Windows_95: sVersion = "Windows 95"
Case #PB_OS_Windows_NT_4: sVersion = "Windows NT4"
Case #PB_OS_Windows_98: sVersion = "Windows 98"
Case #PB_OS_Windows_ME: sVersion = "Windows ME"
Case #PB_OS_Windows_2000: sVersion = "Windows 2000"
Case #PB_OS_Windows_XP: sVersion = "Windows XP"
Case #PB_OS_Windows_Server_2003: sVersion = "Windows Server 2003"
Case #PB_OS_Windows_Vista: sVersion = "Windows Vista"
Case #PB_OS_Windows_Server_2008: sVersion = "Windows Server 2008"
Case #PB_OS_Windows_7: sVersion = "Windows 7"
Case #PB_OS_Windows_Future: sVersion = "Windows Version later than Win7"
Default: sVersion = "Windows Version not identified"
EndSelect
ProcedureReturn sVersion
EndProcedureCode: Select all
Procedure.s OSbits()
;-------------------
lpftLastWriteTime.FILETIME
lpName.s = ""
sKeyName.s = "Software\Wow6432Node"
sOSbits.s = "64"
sSubKey.s = ""
iIndex.i = 1
hKey.i = 0
GetHandle.l = 0
If Left(sKeyName, 1) = ""
sKeyName = Right(sKeyName, Len(sKeyName) - 1)
EndIf
GetHandle = RegOpenKeyEx_(#HKEY_LOCAL_MACHINE, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
If GetHandle = #ERROR_SUCCESS
lpcbName = 255
lpName = Space(255)
GetHandle = RegEnumKeyEx_(hKey, iIndex, @lpName, @lpcbName, 0, 0, 0, @lpftLastWriteTime)
If GetHandle = #ERROR_SUCCESS : sSubKey = Left(lpName, lpcbName) : EndIf
EndIf
RegCloseKey_(hKey)
If sSubKey = "" : sOSbits = "32" : EndIf
ProcedureReturn sOSbits
EndProcedure