Jump to content


Photo

Processor Information Dll (with Added Information)


  • Please log in to reply
3 replies to this topic

#1 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 25 March 2008 - 01:30 AM

Processor Information DLL
(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!

- Roach

Edited by Roach, 25 March 2008 - 01:33 AM.

  • 0
Posted ImagePosted Image

#2 Mgamerz

Mgamerz

    Lazy Developer

  • New Member
  • 1289 posts

Posted 25 March 2008 - 04:30 AM

Finally! The one I needed for my game's boot system analysis.
Awesome roach, downloading now... Will edit when tested.
I was also using Sysinfo.dll and for some reason it would return an "x86" as my processor for about 5 seconds, then It'd return another for a step... my analysis (used to have it there) and blinked red and green... weird. I removed it though, as sometimes it wouldn't even return, it'd just be blank.
[Not really a question... just a statement... I should shut up now LOL]
Ayee! I'm still using GM6, don't want to upgrade to GM7 (For vista I run the converter)... So I can't open the gmk... Any chance It'd still run under gm6? If so, I'll just extract the code with the lite and move it...
Extracted, moved... Integrating then testing...

It works! Now I just need to find out what it acutally is displaying... and to integrate it better. Thanks Roach, I'm sure this will help people who have the same idea as me!

Edit: I have a single core processor, so mine wont' show up as 2 (At least... I think in the registry it comes up as 2 because windows also shows it like that, doesn't it? At least that's what my IT class taught me) So... If with my test, I'm just doing the main core processor as a weak dual core doesn't really exist as they are kinda new (1400 Mhz+). So If I always put 0 as intCnt... It should work right, as 0 will alway be a processor... at least that's what I gathered from my original topic. It'd get a bit complex for my 'basic system analysis' to check for how many cores, or if they are lucky and run the game on a server :)
Another... Edit... The never ending edits. LOL. :
I'm continuing on my end with just 0 as I won't be testing on other computers till the beta phase... which passed beforehand. I'll update it when I get my answer :)

Edited by Mgamerz, 25 March 2008 - 05:35 AM.

  • 1

[StarBord: the First Front]III[Open Source 360° Topdown Shooter]IIIOpen Source Scrolling MenuIIIOpen Source Joystick Controls
Have something you want to figure out how it works? Try a test bed. They are fast to load, and great for experiments. And they are FTW.

#3 Recreate

Recreate

    Furry

  • GMC Member
  • 2992 posts
  • Version:GM:Studio

Posted 04 June 2009 - 08:51 PM

pretty darn usefull Especially for games to warn the user that the processor type is too slow to play or such
  • 0

If the post that you are reading was created prior to 2011. For the safety of the general public, It is not to be regarded under any circumstances.
Please don't ask me to join your group at anything.


#4 smart_monkey

smart_monkey

    GMC Member

  • GMC Member
  • 91 posts

Posted 05 June 2009 - 09:54 AM

This is great but your website is down. It says you need to renew it or it will be deleted.

I cant wait till I can integrate it into my games.
  • 0