[python-win32] Still looking for a method to get CPUID info ...

J dreadpiratejeff at gmail.com
Tue Jan 5 23:03:05 CET 2010


On Tue, Jan 5, 2010 at 16:53, Tim Roberts <timr at probo.com> wrote:
> In my opinion, you could have solved this all much quicker and easier
> just by writing a trivial DLL.

Indeed... and I may well have tried that, were I actually capable of
reading and writing assembly and/or low-level C...  Unfortunately, I'm
not capable of such things and trivial for you is Magic Blue Smoke to
me...  I do understand the basics about registers and kinda how things
are moved in and out, but when it comes to actual real assembly, or
anything more low-level than userspace, I don't know nothin' useful.
Just enough to be dangerous.

However, that's not meant to be snarky, I'm just honest about my
abilities/knowledge.

BUT, thanks for this... this seems simple enough that I can dissect it
and play with it and actually learn some basic assembly (which I've
never done before).

> C:\tmp>python
> Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
> (Intel)] onwin32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import ctypes
>  >>> c = ctypes.windll.cpuid
>  >>> hex(c.GetCpuidEcx())
> '0x444d4163'
>  >>> hex(c.GetCpuidEdx())
> '0x69746e65'

Also have to figure out how to decode the hex value into a more user
friendly format ;-)  BUT I think there was a white paper or something
that I have bookmarked somewhere that does have hex values for the
various flags, at least according to the Intel specs, assuming that
vendors (in this case IBM) hasn't mucked with them.

Seriously though, thanks, even if it turns out I can't really use this
for what I'm working on, it certainly does give me something new to
play with and learn about.

Cheers
Jeff
-- 

Joan Crawford  - "I, Joan Crawford, I believe in the dollar.
Everything I earn, I spend." -
http://www.brainyquote.com/quotes/authors/j/joan_crawford.html


More information about the python-win32 mailing list