HardwareIdentification クラス

定義

現在のハードウェアを表すハードウェア識別子を取得する機能を提供します。

public ref class HardwareIdentification abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.System.Profile.ProfileHardwareTokenContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class HardwareIdentification final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.System.Profile.ProfileHardwareTokenContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public static class HardwareIdentification
Public Class HardwareIdentification
継承
Object Platform::Object IInspectable HardwareIdentification
属性

Windows の要件

デバイス ファミリ
Windows Desktop Extension SDK (10.0.10240.0 で導入)
Windows Mobile Extension SDK (10.0.10240.0 で導入)
Windows 10 Anniversary Edition (10.0.14393.0 で導入)
API contract
Windows.System.Profile.ProfileHardwareTokenContract (v1.0 で導入)

次のコードは、 GetPackageSpecificToken を使用してデバイスのハードウェア ID を取得する方法を示しています。

// nonce is an IBuffer object that would be sent from the cloud service.
HardwareToken packageSpecificToken;

packageSpecificToken =  Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(nonce);

// hardware id, signature, certificate IBuffer objects 
// that can be accessed through properties.
IBuffer hardwareId  = packageSpecificToken.Id;
IBuffer signature = packageSpecificToken.Signature;
IBuffer certificate = packageSpecificToken.Certificate;
void MainPage::DefaultLaunch()
{
    // nonce is a value of type Windows::Storage::Streams::IBuffer, which
    // would be sent from the cloud service in a real scenario.
    Windows::System::Profile::HardwareToken packageSpecificToken{
        Windows::System::Profile::HardwareIdentification::GetPackageSpecificToken(nonce) };

    // hardware id, signature, certificate IBuffer objects 
    // that can be accessed through properties.
    Windows::Storage::Streams::IBuffer hardwareId{ packageSpecificToken.Id() };
    Windows::Storage::Streams::IBuffer signature{ packageSpecificToken.Signature() };
    Windows::Storage::Streams::IBuffer certificate{ packageSpecificToken.Certificate() };
}
// nonce is an IBuffer object that would be sent from the cloud service.
HardwareToken^ packageSpecificToken;

packageSpecificToken =  Windows::System::Profile::HardwareIdentification::GetPackageSpecificToken(nonce);

// hardware id, signature, certificate IBuffer objects 
// that can be accessed through properties.
IBuffer^ hardwareId = packageSpecificToken->Id;
IBuffer^ signature = packageSpecificToken->Signature;
IBuffer^ certificate = packageSpecificToken->Certificate;
// nonce is an IBuffer object that would be sent from the cloud service.
Dim packageSpecificToken As Windows.System.Profile.HardwareToken

packageSpecificToken = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(nonce)

// hardware id, signature, certificate IBuffer objects 
// that can be accessed through properties.
Dim hardwareId As Windows.Storage.Streams.IBuffer = packageSpecificToken.Id
Dim signature As Windows.Storage.Streams.IBuffer = packageSpecificToken.Signature
Dim certificate As Windows.Storage.Streams.IBuffer = packageSpecificToken.Certificate

注釈

詳細については、「 アプリ固有のハードウェア ID (ASHWID) を使用してデバイスごとのアプリ ロジックを実装するためのガイダンス 」を参照してください。

注意

このクラスはアジャイルではありません。つまり、スレッド モデルとマーシャリング動作を考慮する必要があります。 詳細については、「スレッド処理とマーシャリング (C++/CX)」および「マルチスレッド環境での Windows ランタイム オブジェクトの使用 (.NET)」を参照してください。

メソッド

GetPackageSpecificToken(IBuffer)

現在のハードウェアを表すハードウェア識別子 (ASHWID) を取得します。 返される ASHWID は、アプリケーション パッケージごとに異なります。 つまり、この API は、異なるパッケージから 2 つのアプリによって呼び出されると、異なる識別子を返します。 同じパッケージの一部である 2 つのアプリによって呼び出されると、同じ識別子が返されます。

適用対象

こちらもご覧ください