(procInfo DLL for short)
I came across this topic and noticed that there wasn't a DLL to find the processor speed of a computer. I decided to create a quick and easy DLL to find this along with several other pieces of information. All of the information is found via the registry. Below I will explain where the data is coming from.
Download DLL with example: procInfoDLL.zip
The first task when getting any information about the computer processors is to figure out how many processors the computer actually has. This is not a direct value in the registry, but it is easily obtainable. In the registry key HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor, there will be a subkey for each processor that is installed on the computer. The subkeys will have numeric titles, starting at zero and counting upwards. To determine the amount of subkeys (which directly corresponds to the number of processors), the RegQueryInfoKey API command is used, with focus on the lpcSubKeys parameter.
The processor speeds can be retrieved from inside their corresponding processor subkeys. The actual speed (measured in MHz) is located in the ~MHz key in the processor subkey. For example, the speed of the first processor is located in the following key: HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\~MHz. The value is stored as a "DWORD". To retrieve it, the standard RegQueryValueEx function is used. If you want to calculate GHz from MHz, simply divide the MHz by 1000. (GHz = MHz / 1000)
Finding the rest of the information is much more simple. They are all of the "string" type, and in the same location of the speed. The key names are: Identifier, ProcessorNameString, and VendorIdentifier.
To open regedit to view these values for yourself,
- Click start
- Click on run
- In the dialog box that appears, clear any existing text and type: regedit or regedit.exe
- Now follow the path the processor information: HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor
Hope this helps!
Edited by Roach, 25 March 2008 - 01:33 AM.