Tim Roberts wrote:
> Tim Roberts wrote:
>   
>> J wrote:
>>   
>>     
>>> On Tue, Jan 5, 2010 at 16:53, Tim Roberts <t...@probo.com> wrote:
>>>   
>>>
>>>     
>>>       
>>>> 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 ;-)  
>>>       
>
> OK, so I was being overly clever, showing off a bit, demonstrating that
> it's possible to build a minimal DLL in assembler.  It turns out you can
> do the same thing in Visual C++:
>
> c:\tmp>type cpuid.c
> #include <intrin.h>
>
> int
> GetCpuidEcx( int var )
> {
>     int parts[4];
>     __cpuid( parts, var );
>     return parts[2];
> }
>
> int
> GetCpuidEdx( int var )
> {
>     int parts[4];
>     __cpuid( parts, var );
>     return parts[3];
> }
>   

Well, almost.  Replace both of the "int" lines with this:
    int __declspec(dllexport)

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to