Not the CPU serial number obtained through Wmi-win32_processor-processorid, nor the unique

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.