开发者

How to get Processor and Motherboard Id?

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜