質問

The CPU alias of WMIC returns a value called ProcessorType, MSDN states that there are 6 possible values:

1 (0x1) Other
2 (0x2) Unknown
3 (0x3) Central Processor
4 (0x4) Math Processor
5 (0x5) DSP Processor
6 (0x6) Video Processor

http://msdn.microsoft.com/en-us/library/aa394373(v=vs.85).aspx

Is it possible for any type of processor other than 3 to serve as the main (or only) processor? I am writing a hardware hash function and I don't want to include specialized processors unless a general purpose processor is missing.

役に立ちましたか?

解決

Sounds to me you are asking for a warranty. You cannot get one, this information is not supplied by WMI or the operating system. Like much of the WMI data, this comes from a driver. The chipset driver, invariably supplied by the chipset manufacturer, companies like Intel, AMD, NVidia. They may be tweaked by the system integrator. That is however very rare, the cut-throat pricing in that business just don't allow for goodies. Or the support they'll need to provide when their non-standard query results make programs bomb.

So 99.99% of the time you'll just get a single result. Just 3 for the CPU.

Which makes the property completely useless, it doesn't contribute sufficient random data to make the hardware hash unique enough. So don't include it, problem solved.

他のヒント

You could use the GetNativeSystemInfo (link) API function to get some information about the main processor.

void WINAPI GetNativeSystemInfo(
  _Out_  LPSYSTEM_INFO lpSystemInfo
);

It returns a SYSTEM_INFO structure (link)

typedef struct _SYSTEM_INFO {
  union {
    DWORD  dwOemId;
    struct {
      WORD wProcessorArchitecture;
      WORD wReserved;
    };
  };
  DWORD     dwPageSize;
  LPVOID    lpMinimumApplicationAddress;
  LPVOID    lpMaximumApplicationAddress;
  DWORD_PTR dwActiveProcessorMask;
  DWORD     dwNumberOfProcessors;
  DWORD     dwProcessorType;
  DWORD     dwAllocationGranularity;
  WORD      wProcessorLevel;
  WORD      wProcessorRevision;
} SYSTEM_INFO;

This structure contains the following information in the member dwProcessorType:

PROCESSOR_INTEL_386 (386)
PROCESSOR_INTEL_486 (486)
PROCESSOR_INTEL_PENTIUM (586)
PROCESSOR_INTEL_IA64 (2200)
PROCESSOR_AMD_X8664 (8664)
PROCESSOR_ARM (Reserved)

the member wProcessorLevel shows the vendor-defined processor level, and wProcessorRevision shows the vendor-defined revision number of the processor.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top