How to get Processor and Motherboard Id?

南楼画角 提交于 2019-12-11 03:55:44

问题


I used the code from http://www.rgagnon.com/javadetails/java-0580.html to get Motherboard Id, but the result is "null".

  1. How can that be?

  2. Also I modified the code a bit to look like this to get ProcessorId:

    "Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n"+
                 "Set colItems = objWMIService.ExecQuery _ \n"+
                 "   (\"Select * from Win32_Processor\") \n"+
                 "For Each objItem in colItems \n"+
                 "    Wscript.Echo objItem.ProcessorId \n"+
                 "    exit for  ' do the first cpu only! \n"+
                 "Next \n";
    

The result is something like: ProcessorId = BFEBFBFF00010676

On http://msdn.microsoft.com/en-us/library/aa389273%28VS.85%29.aspx it says:

ProcessorId: Processor information that describes the processor features. For an x86 class CPU, the field format depends on the processor support of the CPUID instruction. If the instruction is supported, the property contains 2 (two) DWORD formatted values. The first is an offset of 08h-0Bh, which is the EAX value that a CPUID instruction returns with input EAX set to 1. The second is an offset of 0Ch-0Fh, which is the EDX value that the instruction returns. Only the first two bytes of the property are significant and contain the contents of the DX register at CPU reset—all others are set to 0 (zero), and the contents are in DWORD format.

I don't quite understand it; in plain English, is it unique or just a number for this class of processors, for instance all Intel Core2 Duo P8400 will have this number?


回答1:


With eax set to 1, the cpuid opcode will return the processor type, familly, etc in eax, and the processor features in edx. So what you will get is not something unique, like the CPU serial number.



来源:https://stackoverflow.com/questions/2436221/how-to-get-processor-and-motherboard-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!