banner art

The FindStorage method finds a storage with the given persistent unique identifier. The persistent unique identifier of a storage is described by the g_wszWMDMPersistentUniqueID property of that storage.


HRESULT FindStorage(WMDM_FIND_SCOPEfindScope,LPCWSTRpwszUniqueID,IMDSPStorage**ppStorage);



[in]  Scope of the find operation. It must be one of the following values.

Value Description
WMDM_FIND_SCOPE_GLOBAL Search the entire device.
WMDM_FIND_SCOPE_IMMEDIATE_CHILDREN Search only in the immediate children of the current storage.


[in]  Persistent unique identifier of the storage.


[out]  Pointer to the returned storage specified by the pwszUniqueID parameter.

Return Values

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 extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table. If the method fails with an error, it returns a standard error code.

Return code Description
S_OK The method succeeded.
E_INVALIDARG The findScope parameter is invalid, or pwszUniqueID or ppStorage is NULL.
HRESULT_FROM_WIN32(ERROR_NOT_FOUND) No storage was found with the specified persistent unique identifier.


The service provider returns a persistent unique identifier through the g_wszWMDMPersistentUniqueID property of the storage. For a specific storage, the persistent unique identifier supplied by service provider should be the same across different device connect sessions.

The application may call FindStorage with this persistent unique identifier at a later point. In response, Windows Media Device Manager calls this method on the service provider.

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.

This method allows searching for a storage based on persistent unique identifier while IMDSPStorage2::GetStorage allows searching for a storage based on name.

Windows Media Device Manager calls this method only for devices that can be synchronized with Windows Media Player. See Enabling Synchronization with Windows Media Player for more information.


Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also