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 ;-) 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. >
Well, those hex values are actually part of the string "AuthenticAMD" that gets returned in ebx, edx, and ecx in response to the standard "cpuid" (since I'm running an AMD 64X2). That's because I used the "eax=0" variant of cpuid. For the version you want, you'd set eax to 1 before invoking "cpuid", which would return the feature capability bits. Replace the code with this: GetCpuidEcx proc public, style:DWORD mov eax, [style] cpuid mov eax, ecx ret GetCpuidEcx endp GetCpuidEdx proc public, style:DWORD mov eax, [style] cpuid mov eax, edx ret GetCpuidEdx endp Now I can pass the cpuid code as a parameter: C:\tmp>python Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes >>> c = ctypes.windll.cpuid >>> c.GetCpuidEcx(1) 1 >>> hex(c.GetCpuidEdx(1)) '0x178bfbff' >>> -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32