If you are looking for processor information, there are several ways to get them. In this article, I'll show how to use assembly, Registry information, or Platform SDK functions to retrieve information about CPU. You can also get processor information using WMI (Windows Management Instrumentation) or Active Directory. The methods I present work for systems with one processor from Intel or AMD.
Each processor model is identified by a series of numbers returned by CPUID (see below) function 1. The bits returned in EAX are:
0 - 3
4 - 7
8 - 11
12 - 13
16 - 19
20 - 27
If you know the family and model and the processor vendor, you can determine what processor you do have. The vendor name, a 12-byte string, is "GenuineIntel" for Intel's processors and "AuthenticAMD" for AMD's processor. Both family and model are 4-bit integers. The tables below show the family and model for AMD's and Intel's processors.
1 - 3
6 - 7
Extended family table must be used
Athlon 64FX Operon
Pentium 60/66 A-step
Mobile Pentium 75-200
Mobile Pentium MMX
Pentium Pro A-Step
Pentium II Klamath
Pentium II Deschutes
Pentium III Katmai
Pentium III Coppermine
Mobile Pentium III
Pentium III (0.18um)
Pentium III (0.13um)
Extended family table must be used
Pentium IV (0.18um)
Pentium IV (0.13um)
Pentium IV (0.09um)
To see the table with family and model numbers for other companies, see:
The following steps must be taken to get processor information:
Establish that the processor has support for CPUID.
Execute CPUID function 0, which returns the processor vendor string and the highest standard function supported.
If step 2 indicates that the highest standard function is at least 1, execute CPUID function 1, which returns the standard feature flags in the EDX register.
If bit 23 of the standard feature flags is set to 1, MMX technology is supported. MMX instruction support is the basic minimum processor feature required to support other instruction extensions.
Optionally, if bit 25 of the standard feature flags is set, the processor has streaming SIMD extensions (SSE) capabilities. Further qualification of SSE is done by checking for OS support. SSE support might be present in the processor, but not usable due to a lack of OS support for the additional architected registers.
Execute CPUID extended function 80000000h. This function returns the highest extended function supported in EAX. If EAX=0, there is no support for extended functions.
If the highest extended function supported is at least 8000_0001h, execute CPUID function 80000001h. This function returns the extended feature flags in EDX.
If bit 31 of the extended feature flags is set to 1, the 3DNow! instructions are supported.
If the vendor string contains "AuthenticAMD", continue on to the next step.
If bit 30 of the extended feature flags is set to 1, the additions to the 3DNow! instruction set are supported.
If bit 22 of the extended feature flags is set to 1, the new multimedia enhancement instructions that augment the MMX instruction set are supported.
All this is put in CPUAssembly class presented below.
The Registry Method
Windows keeps processor information in the Registry. For each processor present in the system there is a Registry key, called, 0, 1, etc. in
You must have Platform SDK installed on your computer to use this method.
Windows System Information section of Platform SDK provides functions to retrieve or set system information. GetSystemInfo() and IsProcessorFeaturePresent() can be used to find processor related information.
The GetSystemInfo() function returns information about the current system and uses SYSTEM_INFO structure which contains information about the current computer system. This includes the architecture and type of the processor, the number of processors in the system, the page size, and other such information. See MSDN for more.
The IsProcessorFeaturePresent() function determines whether the specified processor feature, such as MMX, SEE, or 3DNow is supported by the current computer.
Putting All Together
To show how each method can be used to retrieve processor information, I have created three classes CPUAssembly, CPURegistry, and CPUPlatformSDK. All of them are derived from an abstract class called ICPUInfo:
virtual bool QueryCPUInfo() = 0;
virtual unsigned __int64 GetSpeed() const;
std::string FormatSpeed(unsigned __int64 speed) const;
virtual unsigned int GetSpeedMHz()const = 0;
virtual std::string GetCPUName() const = 0;
virtual std::string GetVendorName() const;
std::string GetCPUName(std::string vendor, short int family,
short int model, short int family_ex,
short int model_ex) const;
virtual short int GetCPUFamily() const = 0;
virtual short int GetCPUModel() const = 0;
virtual short int GetCPUStepping() const = 0;
virtual bool IsMMXSupported() const = 0;
virtual bool IsSSESupported() const = 0;
virtual bool IsSSE2Supported() const = 0;
virtual bool Is3DNowSupported() const = 0;
QueryCPUInfo() retrieves the processor information and must be call first. If this method returns false, processor information could not be retrieved. Call the other methods only if the returned value is true.
GetSpeed() returns the speed of CPU. The assembly and Platform SDK implementations use the same method for speed measurement, and the returned value is in Hz.
Marius Bancila is a Microsoft MVP for VC++. He works as a software developer for a Norwegian-based company. He is mainly focused on building desktop applications with MFC and VC#. He keeps a blog at www.mariusbancila.ro/blog, focused on Windows programming. He is the co-founder of codexpert.ro, a community for Romanian C++/VC++ programmers.