views:

39

answers:

1

I am writing a function which prints out detailed Windows Version informations, the output may be a tuple like this:

('32bit', 'XP', 'Professional', 'SP3', 'English')

It will be supporting Windows XP and above. And I'm stuck with getting the Windows edition, e.g., "Professional", "Home Basic", etc.

platform.win32_ver() or sys.getwindowsversion() doesn't do it for me.

win32api.GetVersionEx(1) almost hits, but looks like it doesn't tell me enough information.

Then I saw GetProductInfo(), but looks like it's not implemented in pywin32.

Any hints?

+2  A: 

You can use ctypes to access any WinAPI function. GetProductInfo() is in windll.kernel32.GetProductInfo.

I'd found a Python version (GPL licensed, but you can see usage of the functions there) of the MSDN "Getting the System Version" example.

Lukáš Lalinský
Great! How did you find that python version?
Wang Dingwei
By searching for "windll.kernel32.GetProductInfo" on Google.
Lukáš Lalinský