WIN32_Processor::ProcessorId 对于所有计算机都是唯一的
我想使用一些独特的许可系统。 我决定使用 Win32_Processor Management 类中的 ProcessorID。
我尝试了两个具有相同处理器类型的不同系统。
它显示了两个系统相同的处理器ID。 我正在使用这个代码
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;
}
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..
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不,不能保证它是唯一的,因为处理器甚至可能不支持CPUID指令,在这种情况下,不能保证调用成功。
另外,您忽略了一台机器可能有多个处理器,因此获取单个处理器的 ID 没有帮助。
正如其他人所指出的,如果您想获得系统的唯一 id,最好的选择是创建一个 id,它是系统上各种组件 id 的混合体。
硬件的各种值的散列(不是任意散列,而是冲突很少的散列)可能就足够了。 您可能想要使用完全嵌入系统中的东西,例如处理器、主板信息,但不想使用容易分离/更改的东西,例如 USB 驱动器/集线器/等。
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.
Also, you are neglecting that a machine might have multiple processors in it, so getting the id of a single processor doesn't help.
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.
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.
大多数许可系统依赖多个硬件组件来创建指纹。 没有单个组件被用作唯一的唯一密钥。 因此,您可能需要考虑以下因素:
当组合为一个整体时,您将获得机器的唯一表示。 当用户更改计算机上的某些内容时,危险当然就会出现。 他们会失去执照吗? 他们必须联系你吗?
另请注意,WMI 类通常需要管理员权限才能读取您正在查找的信息类型,这对于 Vista 和 Windows 来说是一个真正的麻烦。 Windows 7 用户。
正确执行硬件锁定非常困难。 所以我建议要么 1. 不要这样做,要么 2. 购买已经这样做的商业图书馆。
Most licensing systems rely on multiple hardware components to create a fingerprint. No single component is used as the only unique key. So you might take the following into consideration:
When combined as a whole you'll get a unique representation of the machine. The danger of course comes when the user changes something on their machine. Do they lose their license? Do they have to contact you?
Also note that WMI classes often require admin rights to read the kind of information that you're looking for which would be a real hassle for Vista & Windows 7 users.
Doing hardware locking is very difficult to get right. So I'd recommend either 1. don't do it or 2. purchase a commercial library that already does this.
ProcessorID 或 CPUID 用于识别处理器的型号和功能集 (ARM,x86/x64)。
Pentium III 支持处理器序列号 (PSN)。 除了仅在 Pentium III(以及 Transmeta 的 Efficeon 和 Crusoe 处理器)上受支持之外,功能必须在 BIOS 中启用并引发隐私问题。
因此,ProcessorID 并非对所有计算机都是唯一的。 此外,它很可能在您公司的计算机中不是唯一的(因为许多组织购买多台相同型号的计算机)。
注意:ATPO 是唯一的每个 CPU,但它是物理打印< /a> 在芯片上。
The ProcessorID or CPUID are for identifying the model and feature set of the processor (ARM, x86/x64).
The Pentium III supported a Processor Serial Number (PSN). In addition to only being supported on the Pentium III (and Transmeta's Efficeon and Crusoe processors), the feature had to be enabled in BIOS and raised privacy concerns.
So no, ProcessorID is not unique for all computers. Additionally, it is very likely to not be unique across computers in your company (since many organizations buy multiple computers of the same model).
Note: the ATPO is unique to each CPU, but it is physically printed on the chip.
对于您要查找的唯一字符串,我们使用 MAC 地址。 如果用户没有 MAC 地址,我们只需允许多次安装。 它涵盖了大多数情况,这正是我们想要完成的。
For the unique string you're looking for, we use the MAC address. If the user doesn't have a MAC address we simply allow multiple installs. It covers most cases which is all we wanted to accomplish.