如何获得处理器和主板ID? [英] How to get Processor and Motherboard Id?

查看:472
本文介绍了如何获得处理器和主板ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 http://www.rgagnon.com/javadetails/java-0580.html 获取主板ID,但结果为"null".

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

  1. 那怎么可能?

  1. How can that be?

我也对代码进行了一些修改,使其看起来像这样来获取ProcessorId:

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";

结果类似于:ProcessorId = BFEBFBFF00010676

http://msdn.microsoft上. com/en-us/library/aa389273%28VS.85%29.aspx 它说:

ProcessorId::描述处理器功能的处理器信息.对于x86类CPU,字段格式取决于CPUID指令的处理器支持.如果支持该指令,则该属性包含2(两个)DWORD格式的值.第一个是偏移量08h-0Bh,它是输入EAX设置为1时CPUID指令返回的EAX值.第二个是偏移量0Ch-0Fh,它是指令返回的EDX值.该属性只有前两个字节有效,并且包含CPU复位时DX寄存器的内容-所有其他字节均设置为0(零),并且内容均为DWORD格式.

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.

我不太了解;用简单的英语来说,它是唯一的还是仅是此类处理器的编号,例如,所有Intel Core2 Duo P8400都具有该编号?

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?

推荐答案

在eax设置为1的情况下,cpuid操作码将在eax中返回处理器类型,familly等,并在edx中返回处理器功能.因此,您得到的并不是唯一的东西,例如CPU序列号.

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.

这篇关于如何获得处理器和主板ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆