WIN32_Processor ​​::是ProcessorId唯一的所有计算机 [英] WIN32_Processor::Is ProcessorId Unique for all computers

查看:2178
本文介绍了WIN32_Processor ​​::是ProcessorId唯一的所有计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一些东西是独一无二的许可制度。我决定用ProcessorID从Win32_Processor管理类。

I want to use some thing unique for a licensing system. i decided to use ProcessorID from Win32_Processor Management class.

我试着与相同的处理器类型。

I tried on two different systems with same processor type..

这表明我这两个系统相同processorID。我用这code

It shows me same processorID for both system. i am using this code

public static String GetCPUId()
{
    String processorID = "";

    ManagementObjectSearcher searcher = new ManagementObjectSearcher(
        "Select * FROM WIN32_Processor");

    ManagementObjectCollection mObject = searcher.Get();

    foreach (ManagementObject obj in mObject)
    {
        processorID = obj["ProcessorId"].ToString();
    }

    return processorID;
}


推荐答案

没有,它不能保证,这将是唯一的,作为处理器甚至可能不支持CPUID指令,在这种情况下,呼叫可以' T为保证成功。

No, it can't be guaranteed that it will be unique, as the processor might not even support the CPUID instruction, in which case, the call can't be guaranteed to succeed.

另外,你可没有一台机器可能有多个处理器,所以让单个处理器的ID没有帮助。

Also, you are neglecting that a machine might have multiple processors in it, so getting the id of a single processor doesn't help.

正如其他人所指出的,如果你想获得对系统唯一的ID,你最好的选择是创建一个id是各种组件ID的系统上的混合体。

As others have indicated, if you want to get a unique id for the system, your best bet is to create an id which is an amalgam of various component ids on the system.

一个哈希(不只是有,而是一个的非常的几个碰撞)硬件的可能的足够了各种价值观。你可能想使用的东西,都相当的嵌入式系统,如处理器,主板信息,但不事容易脱落/改变,如USB驱动器/集线器/等。

A hash (and not just any, but one that has very few collisions) of various values of the hardware could suffice. You'd probably want to use things that are fairly embedded in the system, such as the processor, motherboard info, but not things easily detached/changed, such as USB drives/hubs/etc.

这篇关于WIN32_Processor ​​::是ProcessorId唯一的所有计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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