[python-win32] using WMI to get processor flags...

Kevin Horn kevin.horn at gmail.com
Wed Oct 28 17:41:31 CET 2009


On Fri, Oct 23, 2009 at 3:21 PM, J <dreadpiratejeff at gmail.com> wrote:

> First, Thanks again Tim Golden :)
>
> I've gotten a lot of use out of WMI so far, though I'm still trying to
> get an actual list of WHAT I need as far as system info for this tool
> I'm writing.
>
> Now I've got another question that I hope someone can provide the
> answer I want, not the one I'm afraid is coming ;-)
>
> So I've been looking at Win32_Processor and it provides a lot of
> processor information that I need, like max speed, cpu stepping,
> family ID and so forth, and I can also get packages, cores, and
> logical counts.
>
> What I haven't been able to find is a way to get a listing of
> processor flags (like FPU, MMX, SVN, VMX, SSE3, HTT, etc).  Is there a
> way to do this without resorting to pycpuid??  Pycpuid can give me
> this stuff but it requires some compiling for systems, and I'm still
> not positive that it will work across platforms (AMD v. Intel).
>
> Any thoughts?  I haven't found an answer yet.  I've also looked at
> CIM_Processor, but it seems to me that the CIM classes are identical
> to the Win32 classes, at least in most cases.  I haven't dug TOO
> deeply into CIM_Processor though...
>
> Cheers
> Jeff
>
>
I don't know of a way to get this with WMI, though it _might_ be possible.

You might try looking at this page for some ideas:
http://www.codeguru.com/cpp/w-p/system/hardwareinformation/article.php/c9087__2/

It gives 3 ways to get processor information:
- assembly (pycpuid uses this)
- registry (there is a key in the registry that stores this info, but it
looks like it's all ORd together, so you'd have to decode it)
- Platform SDK ( IsProcessorFeaturePresent() is probably the function you
want )

The page has some C++ sample code, which might help you some.  I'd probably
either try to read the info from the registry (though you can't be 100% sure
the registry is correct, of course), or figure out what C functions to call
and wrap them up in ctypes calls.

How to integrate this with your WMI code (is it querying remote machines?)
is up to you. :)  But feel free to ask if you need ideas.

Kevin Horn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20091028/88bdc1da/attachment.htm>


More information about the python-win32 mailing list