Redigera

Dela via


Backing Up and Restoring Licenses

[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The backup and restore processes are asynchronous. They are triggered when the user selects a menu command or option in the application to back up or restore licenses. You should allow the user to specify the locations where licenses must be backed up to and restored from.

To back up licenses:

  1. Use the WMCreateBackupRestorer function to create the backup restorer object.
  2. Call the IWMBackupRestoreProps::SetProp method to set the backup path (the location where you will write the files, such as A:\ or D:\Licenses).
  3. Call the IWMLicenseBackup::BackupLicenses method to back up the licenses to the specified path.

The following events are sent to the IWMStatusCallback::OnStatus method:

  • WMT_BACKUPRESTORE_BEGIN indicates the backup process has started.
  • WMT_BACKUPRESTORE_END indicates the backup process has been completed.
  • WMT_RESTRICTED_LICENSE indicates that one or more licenses cannot be backed up because the right has been disallowed by the content owner.

The key ID is also included in this message. If you have implemented a database for protected files that includes the key ID and metadata, you can display a message to the user with the specific title (such as a song title) for which the license cannot be backed up. Otherwise, the message must be generic and inform the user that some licenses cannot be backed up.

To restore licenses:

  1. Use the WMCreateBackupRestorer function to create the backup restorer object.
  2. Call the IWMBackupRestoreProps::SetProp method to set the restore path to the location where licenses are backed up.
  3. Call the IWMLicenseRestore::RestoreLicenses method to restore licenses from that location.

The following events are sent to the IWMStatusCallback::OnStatus method:

  • WMT_BACKUPRESTORE_CONNECTING indicates that the application is connecting to the License Management Service.
  • WMT_BACKUPRESTORE_DISCONNECTING indicates that the application is disconnecting from the License Management Service.
  • WMT_BACKUPRESTORE_BEGIN indicates the restore process has started.
  • WMT_BACKUPRESTORE_END indicates the restore process has been completed.

Note

DRM is not supported by the x64-based version of this SDK.

 

Digital Rights Management Features

IWMBackupRestoreProps Interface

IWMLicenseBackup Interface

IWMLicenseRestore Interface