WinRT: Get App Specific Hardware ID
Solved
General and Desktop
-
Hello!
How to get App Specific Hardware ID on WinRT?
I need to call Windows::System::Profile::HardwareIdentification::GetPackageSpecificToken.I try like this:
ComPtr<IHardwareIdentificationStatics> hardwareIdentificationStatics;
HRESULT hr = RoGetActivationFactory(HString::MakeReference(InterfaceName_Windows_System_Profile_IHardwareIdentificationStatics).Get(),
IID_PPV_ARGS(&hardwareIdentificationStatics));But it is doesn't works...
Thanks. -
Solution:
const WCHAR InterfaceName_Windows_System_Profile_HardwareIdentification[] = L"Windows.System.Profile.HardwareIdentification"; HRESULT hr; ComPtr<IHardwareIdentificationStatics> hardwareIdentificationStatics; hr = RoGetActivationFactory(HString::MakeReference(InterfaceName_Windows_System_Profile_HardwareIdentification).Get(), IID_PPV_ARGS(&hardwareIdentificationStatics)); if (S_OK == hr) { ComPtr<IHardwareToken> hardwareToken; hr = hardwareIdentificationStatics->GetPackageSpecificToken(NULL, &hardwareToken); if (S_OK == hr) { ComPtr<IBuffer> buffer; hr = hardwareToken->get_Id(&buffer); if (S_OK == hr) { quint32 len; buffer->get_Length(&len); qDebug() << "get_Length" << len; } } } if (S_OK != hr) qWarning() << hr;