Now many online tutorials, teach people through Wmi-win32_processor-processorid to get the CPU "serial number", the typical code is as follows:
Public Static stringGetcpuserialnumber () {stringCpuserialnumber =string. Empty; ManagementClass MC=NewManagementClass ("Win32_Processor"); Managementobjectcollection MOC=MC. GetInstances (); foreach(ManagementObject moinchMOC) {Cpuserialnumber= mo["Processorid"]. ToString (); Break; } MC. Dispose (); MoC. Dispose (); returnCpuserialnumber; }
In fact, the value obtained is not the CPU number or serial number, and is not unique, for this, Microsoft on MSDN has the relevant description:
MSDN Link: http://msdn.microsoft.com/en-us/library/aa394373 (v=vs.85). aspx
This is what the original version of MSDN says:
Processorid
-
Data type:
string
-
Access type:read-only
Processor information that describes the Processor features. For a x86 class CPU, the field format depends on the processor the CPUID instruction. If The instruction is supported, the property contains 2 (both) DWORD formatted values. The first is an offset of 08H-0BH, which are the EAX value, a CPUID instruction returns with input EAX set to 1. The second is a offset of 0ch-0fh, which is the EDX value and the instruction returns. Only the first, bytes of the property is significant and contain the contents of the DX register at CPU Reset-all othe RS is set to 0 (zero), and the contents is in DWORD format.
According to the MSDN instructions, if the CPU supports the CPUID directive, the value of this processorid is: "When the register EAX is 1, the CPUID instruction is executed, and the data in the returned EAX and edx registers contains information such as the CPU model, the supported instruction set, etc. ”。 What if the CPU does not support CPUID instructions? MSDN did not say that the estimate should be empty.
Therefore, Processorid is not the CPU number or serial number, just the CPU model, instruction set and other information.
Reference Links:
[1]. Win32_Processor class
[2]. An attempt to bring CPUID to C #
Not the CPU serial number obtained through Wmi-win32_processor-processorid, nor the unique