我可以在 Windows 10/Windows 8/WinRT 中唯一标识设备吗 [英] Can I uniquely identify a device in Windows 10/Windows 8/WinRT

查看:21
本文介绍了我可以在 Windows 10/Windows 8/WinRT 中唯一标识设备吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何机制可以唯一标识设备(即使它是匿名的)?

Is there any mechanism to identify a device uniquely (even if it is anonymous)?

明确地说,设备"是指计算机/slate/pc.

To be clear, by "device" I mean the computer/slate/pc.

Windows 8.x

http://codepaste.net/ybt893

string HardwareId()
{
    var token = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
    var hardwareId = token.Id;
    var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
    var bytes = new byte[hardwareId.Length];
    dataReader.ReadBytes(bytes);
    return BitConverter.ToString(bytes);
}

Windows 10

您必须添加移动和/或桌面扩展 SDK.

You must add the Mobile and/or Desktop extension SDK.

string HardwareId()
{
    var token = HardwareIdentification.GetPackageSpecificToken(null);
    var hardwareId = token.Id;
    var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
    var bytes = new byte[hardwareId.Length];
    dataReader.ReadBytes(bytes);
    return BitConverter.ToString(bytes);
}

推荐答案

Windows 8 RTM 刚刚添加了这样的能力:

Such an ability has just been added in Windows 8 RTM:

Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null)

这篇关于我可以在 Windows 10/Windows 8/WinRT 中唯一标识设备吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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