J wrote:
> I've been at this a while :)
>
> Thought I'd ask if anyone knew either of a way in python, or just a
> stand alone tool, to use in Windows to get CPU information.
> Specifically, I'm looking for Feature sets or Flags.
>
> What I'm doing is building a tool for work that gets certain bits of
> system information to automate test configuration and deployment.
>   

In my opinion, you could have solved this all much quicker and easier
just by writing a trivial DLL.

c:\tmp>type cpuid.asm
    .586
    .model   flat, stdcall
    .code

GetCpuidEcx   proc   public
    xor eax, eax
    cpuid
    mov eax, ecx
    ret
GetCpuidEcx   endp

GetCpuidEdx   proc   public
    xor eax, eax
    cpuid
    mov eax, edx
    ret
GetCpuidEdx   endp

start   proc    public, x:DWORD, y:DWORD, z:DWORD
        ret
start   endp               

    end start

C:\tmp>ml /Fl /c cpuid.asm
Microsoft (R) Macro Assembler Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: cpuid.asm

C:\tmp>link /dll /out:cpuid.dll /export:GetCpuidEcx /export:GetCpuidEdx
/entry:start cpuid.obj
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library cpuid.lib and object cpuid.exp

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'
 >>>

C:\tmp>

Modifying this to accept the "cpuid" eax value as a parameter is left as
an exercise for the reader.

-- 
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