IWMDRMLicenseManagement::AcquireLicense method
[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 AcquireLicense method asynchronously acquires a license from a specified URL.
Syntax
HRESULT AcquireLicense(
[in] BSTR bstrURL,
[in] BSTR bstrHeaderData,
[in] BSTR bstrActions,
[in] DWORD dwFlags,
[out] IUnknown **ppunkCancelationCookie
);
Parameters
-
bstrURL [in]
-
URL of the license server from which to acquire the license. Pass NULL to have the method parse the URL from the content header.
-
bstrHeaderData [in]
-
Content header to be passed to the license server. If bstrURL is NULL, the method will parse the URL from this header. If dwFlags is set to WMDRM_ACQUIRE_LICENSE_LEGACY_NONSILENT, set this value to the key ID instead of the entire content header.
-
bstrActions [in]
-
String containing zero or more actions for which to request permission in the license. The string must be formatted as follows:
Each action must be defined within an ACTION element. The data of the element is the action string.
All ACTION elements must be contained within an ACTIONLIST element.
For example, the string to request a license to play content is formatted like this:
<ACTIONLIST><ACTION></ACTION></ACTIONLIST>
-
dwFlags [in]
-
License acquisition option flags. Set to one of the constants in the following table.
Constant Description WMDRM_ACQUIRE_LICENSE_SILENT The license will be issued directly over the Internet without any confirmation from the client application. WMDRM_ACQUIRE_LICENSE_NONSILENT The DRM subsystem will create a license request which will be returned asynchronously for posting to the license server. WMDRM_ACQUIRE_LICENSE_LEGACY_NONSILENT The same as WMDRM_ACQUIRE_LICENSE_NONSILENT, except that a DRM version 1 license challenge will be created. -
ppunkCancelationCookie [out]
-
Pointer that receives a pointer to the IUnknown interface of an object that identifies this asynchronous call. This interface pointer can be used to cancel the asynchronous call by calling the IWMDRMEventGenerator::CancelAsyncOperation method.
Return value
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return code | Description |
---|---|
|
The method succeeded. |
Remarks
This method executes asynchronously. It returns immediately after being called and then generates an MEWMDRMLicenseAcquisitionCompleted event when processing is complete. For non-silent license acquisition operations, the value of the event obtained by calling IMFMediaEvent::GetValue is an IUnknown pointer. You can call the QueryInterface method of the retrieved IUnknown interface to get an instance of the IWMDRMNonSilentLicenseAquisition interface.
For more information about using the asynchronous methods of the Windows Media DRM Client Extended APIs, see Using the Media Foundation Event Model.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|