Jump to content
  • Advertisement
Sign in to follow this  
madRenEGadE

[WinAPI] How to get CPU type

This topic is 3925 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, is there any way to get the name/type of the processor without using asm? I notices that the SYSTEM_INFO struct has some cpu info but only numbers I do not know how to deal with...

Share this post


Link to post
Share on other sites
Advertisement
This is one way of finding the architecture as a string.

std::string getProcessorArchitecture()
{
SYSTEM_INFO siSysInfo;
GetSystemInfo(&siSysInfo);

std::string architecture = "unknown";

switch(siSysInfo.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
architecture = "x64 (AMD or Intel)";
break;
case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
architecture = "WOW64";
break;
case PROCESSOR_ARCHITECTURE_IA64:
architecture = "Intel Itanium Processor Family (IPF)";
break;
case PROCESSOR_ARCHITECTURE_INTEL:
architecture = "x86";
break;
default:
break;
}

return architecture;
}

Share this post


Link to post
Share on other sites
Yeah that's a beginning but I would rather like to know how to get
something like "Intel Core 2 Duo T7400"? (like it can be found on linux in /proc/cpuinfo)

Share this post


Link to post
Share on other sites
Quote:
Original post by madRenEGadE
Yeah that's a beginning but I would rather like to know how to get
something like "Intel Core 2 Duo T7400"? (like it can be found on linux in /proc/cpuinfo)


Just query the registry for the following:

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0

What you want is in that area.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!