How do I obtain the serial number of the CPU in a PC?
Some more details please: operating system, language.
For example on Windows you can get it by using WMI and reading Win32_Processor.ProcessorId.
I guess quite a few compiler do offer some wrapper or the like around the mentioned command. Here's an example
#include <stdlib.h>
#include <string.h>
#include <intrinsics.h>
_CPUID cpuinfo;
int main(void) {
_cpuid(&cpuinfo);
printf("Vendor: %s\n", cpuinfo.Vendor);
return 0;
}
Output:
Vendor: GenuineIntel
Remember that most computers these days ship with CPU ID disabled in the BIOS. See CPUID on Wikipedia
Even with CPUID enabled is there actually a serial number available in modern processors? I remember there being a big outcry in the Pentium 3 days when this whole serial number issue was raised.
In windows, I am sure there is a system call, In linux one could try "sudo lshw" but most kernels do not seem to support CPU serial numbers, and preliminary research seems to indicate that the general outrage against uniquely identifiable computers means that there is no perfect answer.
What are you trying to do? Almost certainly someone has done it before and it may be wise to reuse or emulate what they have done.
Based upon 'licensing' tag you have used for your question, you might get better results reading network MAC address. Identifying PC by a MAC address isn't totally unbreakable method for copy protection, still it is sometimes used.
I have the ultimate answer for this without any external libraries. Simply type this:
wmic bios get serialnumber
This will give you the Serial Number on the PCs chassis ;) (found in microsoft's knowledge base)
Regards!