IWMDRMWriter::SetDRMAttribute method (wmsdkidl.h)
[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.]
[SetDRMAttribute is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Microsoft PlayReady. ]
The SetDRMAttribute method sets DRM-header attributes as well as other DRM run-time properties.
Syntax
HRESULT SetDRMAttribute(
[in] WORD wStreamNum,
[in] LPCWSTR pszName,
[in] WMT_ATTR_DATATYPE Type,
[in] const BYTE *pValue,
[in] WORD cbLength
);
Parameters
[in] wStreamNum
WORD containing the stream number to which the attribute applies.
[in] pszName
Pointer to a null-terminated string containing the attribute name. See Remarks for supported attributes.
[in] Type
A value from the WMT_ATTR_DATATYPE enumeration type specifying the data type of the attribute data.
[in] pValue
Pointer to an array of bytes containing the attribute data.
[in] cbLength
The size, in bytes, of the attribute data pointed to by pValue.
Return value
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Remarks
This method is somewhat misnamed because it is used to set not only writable DRM file attributes (See DRM Attribute List), but also certain DRM properties that are used by the DRM run-time components but are not written to the DRM header in the file. (See DRM Properties.)
The properties Use_Advanced_DRM and Use_DRM may be specified before a profile is set. No other properties can be set before a profile is set. The following code snippet shows how to call this function, using the DRM_ContentID property as an example. Assume that pDRMWriter is a IWMDRMWriter interface pointer, and wszContentID is an array of type WCHAR.
hr = pDRMWriter->SetDRMAttribute( 0, g_wszWMDRM_ContentID,
WMT_TYPE_STRING, (BYTE *)wszContentID,
( wcslen( wszContentID ) + 1 ) * sizeof( WCHAR ) );
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series SDK, or later versions of the SDK |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wmsdkidl.h (include Wmsdk.h) |
Library | Wmvcore.lib; WMStubDRM.lib (if you use DRM) |