UDID的Windows 8 [英] UDID for windows 8

查看:206
本文介绍了UDID的Windows 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有唯一的设备ID(UDID)或任何类似的ID,我可以在Windows 8上读出不与硬件改动,应用程序,重新安装等改变?

Is there any unique device ID (UDID) or any similar ID I can read out on Windows 8 that doesn't change with hardware changes, app-reinstallation etc.?

如果没有 - 什么是自己生成它的最好办法

If No - what is the best way to generate it yourself?

推荐答案

没有。是。

没有,没有这样的ID,因为(在理论上)可以更改任何硬件组件,所以你可能会得到完全不同的ID(这就是为什么微软建议计算基于 ASHWID )。

No, there is not such ID because (in theory) you can change ANY hardware component so you may get a completely different ID (that's why Microsoft suggest to calculate a score based on ASHWID).

是的,有这样的ID(但它可能不适合你的情况)。
如果你不能依赖于硬件,因为它很容易增加内存,更换磁盘,添加另一个网卡(如打开/关闭蓝牙或Wi-Fi),那么你必须依赖于软件的ID。

Yes, there is such ID (but it may not be applicable in your case). If you can't rely on hardware because it's easy to add memory, change disks, add another network card (for example turning on/off bluetooth or wi-fi) then you have to rely on a "software" ID.

在注册表中存在的Windows安装过程中生成一个唯一的ID,直到你重新安装Windows也不会改变。你可以找到这样的ID HKLM /软件/微软/加密,它是一个命名的字符串 MachineGuid

In the registry there is an unique ID generated during Windows installation and it won't change until you reinstall Windows. You can find such ID in HKLM/Software/Microsoft/Cryptography, it's a string named MachineGuid.

如果你能找出一个组件你pretty肯定不会改变(主板为例),你可以使用一个简单的WMI查询来获取它的序列号,但你应该总是提供一个备用的,因为很多很多的MB返回一个假的S / N(和虚拟可机返回总是相同的一个)。什么是正确的解决方案...以及它取决于你有这个ID做什么。识别用户?检查许可证?加密数据?每一种有ID不同的最佳实践。

If you can identify a component you're pretty sure that won't change (motherboard for example) you may use a simple WMI query to get its serial number but you should always provide a fallback because many many MBs returns a fake S/N (and virtual machines may returns always the same one). What's the proper solution...well it depends on what you have to do with that ID. Identify the user? Check for license? Encrypt data? Each of these has a different "best practice" for ID.

获取一个唯一的ID为设备

如果你必须确定一个特定的设备(不管用户),你有很多选择,我想preFER做的是只使用稳定的数据来生成一个ID(从主板和BIOS S / N,例如) 。这不会帮助你,如果他/她彻底更新其硬件,但它应该是稳定的足够的(但你要的确定的是什么的足够的你的情况)。你甚至可以使用主磁盘的S / N(带便携式设备是pretty稳定,你甚至可以结合其他序列号用它来构建你自己的ID)。您可以通过WMI得到这个信息,或通过 ASHWID 结构的特定字节(如果你的目标的WinRT)。

Get an unique ID for the device
If you have to identify a particular device (regardless to the user) you have many options, what I'd prefer to do is to generate an ID using only stable data (S/N from motherboard and BIOS, for example). This won't help you if he/she completely renew its hardware but it should be stable enough (but you have to define what is enough in your case). You may even use the S/N of the primary disk (with portable devices it's pretty stable and you may even use it in combination with other serial numbers to build your own ID). You can get this informations through WMI or (if you're targeting WinRT) through specific bytes of the ASHWID structure.

数据加密

在这种情况下,你必须考虑,当数据可能的无法恢复的。如果一个小的硬件改变你的用户将不能够读取他们的previous文件很好,他们会不高兴。在这种情况下,我会建议使用 MachineGuid ,除非重新安装操作系统,他们将不必担心(但做他们的忙,并提供一种方法来读回GUID的地方)。如果你确定你的目标的便携式设备,如手机或平板电脑,然后磁盘序列号(或CPU ID,如果有的话,或MB或BIOS)可适当太(因为它是pretty少见,他们会变化)。

Encrypt data
In this case you have to think when data may be unrecoverable. If with a small hardware change your users won't be able to read their previous files well, they'll be unhappy. In this case I would suggest to use the MachineGuid, unless they reinstall the OS they wouldn't have to worry (but do them a favor and provide a way to read back that GUID somewhere). If you're sure you're targeting a portable device like a phone or a tablet then disk serial number (or CPU ID, if available, or MB or BIOS) may be appropriate too (because it's pretty uncommon they'll change).

许可

我会使用许多(稳定)的ID的组合。至于该设备的唯一标识符,你不能肯定什么都不会改变。在过去的MAC地址被大大用于此,但移动设备改变了这些规则(因为它很容易关闭一个NIC)。您仍然可以使用他们,但你必须把额外的照顾(和code)来管理的情况。再次多个ID的组合(慎重选择)可以帮助您,当他们改变他们的硬件/软件设置,以尽量减少客户的工作量。在这种情况下,一个很好的折衷可能是操作系统的序列号(不是MachineGuid)。如果他们安装一个新的操作系统,然后他们必须得更新许可证(但我会用它与其他东西相结合,以确保他们不会使用相同的操作系统在多台计算机或虚拟机复制)。

Licensing
I would use a combination of many (stable) IDs. As for an unique identifier for the device you can't be sure nothing will change. In the past MAC address was vastly used for this but mobile devices changed these rules (because it's easy to turn off a NIC). You can still use them but you have to put extra care (and code) to manage that situation. Again a combination of multiple IDs (chosen carefully) can help you to minimize customers effort when they change their hw/sw setup. In this case a good compromise could be the OS serial number (not the MachineGuid). If they install a new OS then they have to update your license too (but I would use it combined with something else to be sure they won't use the same OS copy on multiple computers or virtual machines).

注意有关虚拟机

如果你有目标虚拟机太然后事情就变得更加复杂。理论上的用户可以创建具有完全相同hardare和软件配置同一个虚拟机的多个副本。的如果的,这是一个问题,的如果的不能正确(例如,使用一个网络检查)解决这个问题,我建议你不支持他们在所有的(只是退出如果检测到VM)。

Note about virtual machines
If you have to target VMs too then things become more complicated. In theory an user can create multiple copies of the same VM with exactly the same hardare and software configuration. If this is an issue and if you can't address this properly (for example using a network check) I would suggest you don't support them at all (just quit if you detect a VM).

这篇关于UDID的Windows 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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