Module for generic platform information: platform.py

Karl Putland kputland at wisen.com
Thu Oct 28 10:35:13 EDT 1999


Two way to get the values that you want.

The values that are useful are
['CurrentVersion','CurrentBuildNumber','CSDVersion','Plus! VersionNumber']

>
> Is there a way to directly extract a certain key from the registry ?
> I'd need the values of the keys 'CSDVersion', 'CurrentVersion' and
> 'CurrentBuild'. Plus perhaps 'CurrentType' if someone could enlighten
> me with a suitable interpretation ;-) ... 'Uniprocessor Free' sounds
> somewhat strange.
>

I think, but don't quote me, that "Uniprocessor Free" is the number of
processors or the number of unused processors left for the version that you
own. eg. WinNTwrkstn4.0 is dual processor capable.  My machine only has one
processor.  I don't have a dual machine to test that theory though.

> Thanks,
> --
> Marc-Andre Lemburg
>

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
IDLE 0.5 -- press F1 for help
>>> from win32api import
RegQueryValueEx,RegEnumValue,RegOpenKeyEx,RegCloseKey
>>> from win32con import HKEY_LOCAL_MACHINE
>>> HKLM = HKEY_LOCAL_MACHINE
>>> keyNTCurVer = RegOpenKeyEx(HKLM,'SOFTWARE\Microsoft\Windows
NT\CurrentVersion')
>>> verVals={}
>>> i=0
>>> while 1:
	try:
		name,val,typ = RegEnumValue(keyNTCurVer,i)
		verVals[name] = val
		i=i+1
	except:
		break


>>> verVals['CurrentBuildNumber']
'1381'
>>> verVals['CSDVersion']
'Service Pack 4'
>>> verVals['Plus! VersionNumber']
'IE 5 5.00.2314.1003'
>>> verVals['CurrentVersion']
'4.0'
>>>
>>> # OR individual calls
>>>
>>> RegQueryValueEx(keyNTCurVer,'CurrentVersion')
('4.0', 1)
>>> RegQueryValueEx(keyNTCurVer,'CSDVersion')
('Service Pack 4', 1)
>>> RegQueryValueEx(keyNTCurVer,'CurrentBuildNumber')
('1381', 1)
>>> RegQueryValueEx(keyNTCurVer,'Plus! VersionNumber')
('IE 5 5.00.2314.1003', 1)
>>>
>>>
>>> RegCloseKey(keyNTCurVer)
>>>


Karl Putland
kputland at wisen.com





More information about the Python-list mailing list