tags:

views:

1109

answers:

4

I'm aware that I can grab the CPU identifier and the volume serial number for a physical drive by querying WMI, but WMI usually takes its sweet time. What other speedier options, if any, are available to retrieve this information? Are there Win32 APIs that would accomplish this?

Edit: Allow me to clarify. By CPU identifier, I'm referring to the same value one gets by querying the following WMI instance properties:

  • Win32_Processor::ProcessorId
  • Win32_LogicalDisk::VolumeSerialNumber
A: 

I like GetSystemInfo but that doesn't cover physical drives..

Nicholas Mancuso
GetSystemInfo doesn't get the CPU ID as mentioned by Brian Cline
faulty
A: 

For CPUID, try this: http://devpinoy.org/blogs/cvega/archive/2006/04/07/2658.aspx

For Volume Serial Number, try this: http://www.eggheadcafe.com/articles/20021019.asp

Google is your friend ;-)

Jeroen Pluimers
+2  A: 

Just keep in mind that ID of the CPU is not always available.

By the way, what are you trying to accomplish? If you want to generate a unique key for a computer instance, check the Generating Unique Key (Finger Print) for a Computer for Licensing Purposes post by Sowkot Osman at Codeproject; it can give you some hints (also read comments).

Alek Davis
+2  A: 

You can query the windows registry for the drive information, not sure about the CPU though. It seems that your question is addressed in this SO q/a (demonstrates a number of methods to get this info, but for speed, maybe getting it from registry is your best bet):

http://stackoverflow.com/questions/327718/how-to-list-physical-disks

Josh E