[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.
HRESULT SetDRMAttribute( WORD wStreamNum, LPCWSTR pszName, WMT_ATTR_DATATYPE Type, const BYTE *pValue, WORD cbLength );
WORD containing the stream number to which the attribute applies.
Pointer to a null-terminated string containing the attribute name. See Remarks for supported attributes.
A value from the WMT_ATTR_DATATYPE enumeration type specifying the data type of the attribute data.
Pointer to an array of bytes containing the attribute data.
The size, in bytes, of the attribute data pointed to by pValue.
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
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 ) );
|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]|
|Header||wmsdkidl.h (include Wmsdk.h)|
|Library||Wmvcore.lib; WMStubDRM.lib (if you use DRM)|