IWMDMDevice3::FindStorage method (mswmdm.h)

The FindStorage method finds a storage by its persistent unique identifier. Unlike other methods, this method can search recursively from the root storage.


HRESULT FindStorage(
  [in]  WMDM_FIND_SCOPE findScope,
  [in]  LPCWSTR         pwszUniqueID,
  [out] IWMDMStorage    **ppStorage


[in] findScope

A WMDM_FIND_SCOPE enumeration specifying the scope of the find operation.

[in] pwszUniqueID

A wide character, null-terminated string representing a persistent unique identifier of the storage, which can be retrieved by querying for the g_wszWMDMPersistentUniqueID property of the storage.

[out] ppStorage

Pointer to the returned storage. The caller must release this interface when done with it.

Return value

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes
For an extensive list of possible error codes, see Error Codes.


A persistent unique identifier is used to uniquely identify content stored on a particular device. It does not represent a content-specific globally unique identifier that remains identical across all devices. Thus, the same content stored in different storages will have different persistent unique identifiers. Similarly, different content can have same persistent unique identifier when it is stored on different devices. Using the analogy of content on a device being similar to rows in a database, this property serves the same purpose as the identity column serves in a database.

Because it is generated by the device, the format of the persistent unique identifier is device-dependent. The application should get the persistent unique identifier by querying the g_wszWMDMPersistentUniqueID property of the storage. An application can use the GetSpecifiedMetadata or GetMetadata methods to query this property.


Target Platform Windows
Header mswmdm.h
Library Mssachlp.lib

See also

IWMDMDevice3 Interface




Metadata Constants