API in C # to capture CPU IDs and disk / volume serial number

I know that I can capture the CPU ID and volume serial number for a physical disk by querying for WMI, but WMI usually takes its sweet time. What even faster options, if any, are available to extract this information? Are there any Win32 APIs that could accomplish this?

Edit: Let me clarify. By CPU ID, I mean the same value that is obtained by querying the following properties of a WMI instance:

  • Win32_Processor :: ProcessorId
  • Win32_LogicalDisk :: VolumeSerialNumber
+4
source share
5 answers

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

By the way, what are you trying to achieve? If you want to create a unique key for a computer instance, check Create a unique key (Finger Print) for a computer for licensing purposes post by Sovokt Osman in Codeproject; he can give you some advice (also read the comments).

+2
source

You can query the Windows registry for disk information, but are not sure what the CPU is. It seems that your question is addressed in this SO q / a (demonstrates a number of methods for obtaining this information, but for speed, perhaps getting it from the registry is the best choice):

How to display physical disks?

+2
source

WMI actually takes a significant portion of its data from the registry. The system stores a lot of information about the system there and, obviously, reacts very quickly.

If you want to lock the motherboard, processor, and / or hard drive for licensing reasons, check the following values:
HKLM \ HARDWARE \ DESCRIPTION \ System \ BIOS \ BaseBoardManufacturer
HKLM \ HARDWARE \ DESCRIPTION \ System \ BIOS \ BaseBoardProduct
HKLM \ HARDWARE \ DESCRIPTION \ System \ CentralProcessor \ 0 \ Identifier
HKLM \ HARDWARE \ DESCRIPTION \ System \ CentralProcessor \ 0 \ ProcessorNameString
HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ DigitalProductId
HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProductId
HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ BuildLabEx
HKLM \ HARDWARE \ DESCRIPTION \ System \ MultifunctionAdapter \ 0 \ DiskController \ 0 \ DiskPeripheral \ 0
(may be typical for boards using RAID)

If you want to get a serial drive without WMI, call the DeviceIoControl call on the physical device. Sample code in VB.NET: http://www.dreamincode.net/code/snippet429.htm

+2
source

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

For volume serial number, try the following: http://www.eggheadcafe.com/articles/20021019.asp

Google is your friend; -)

0
source

I like GetSystemInfo , but this does not apply to physical disks ..

-2
source

All Articles