Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WinRT: Get App Specific Hardware ID
QtWS25 Last Chance

WinRT: Get App Specific Hardware ID

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 487 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Igor2017
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Igor2017
      wrote on last edited by
      #2

      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;
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved