IWMDRMWriter2::SetWMDRMNetEncryption 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.]

[SetWMDRMNetEncryption 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 SetWMDRMNetEncryption method configures the writer to receive input samples encoded with Windows Media DRM 10 for Network Devices.

Syntax

HRESULT SetWMDRMNetEncryption(
  [in] BOOL  fSamplesEncrypted,
  [in] BYTE  *pbKeyID,
  [in] DWORD cbKeyID
);

Parameters

[in] fSamplesEncrypted

Flag that specifies whether the samples sent to the writer will be encoded for Windows Media DRM 10 for Network Devices protocol.

[in] pbKeyID

Address of the key identification in memory.

[in] cbKeyID

The size of the key identification in bytes.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The method succeeded.

Remarks

You must use this method to prepare the writer if you have samples that are already encoded for delivery to a device that supports Windows Media DRM 10 for Network Devices. Call this method before calling IWMWriter::BeginWriting.

After configuring the writer to receive encrypted samples, the writer will not accept samples from calls to IWMWriter::WriteSample. Instead, you must use IWMWriterAdvanced::WriteStreamSample.

This method is intended only to create new files from existing data that is encoded for delivery to devices that support Windows Media DRM 10 for Network Devices. To generate data for streaming to secure devices from an existing DRM-protected ASF file, use the methods of the IWMDRMTranscryptor interface.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only],Windows Media Format 9.5 SDK
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header wmsdkidl.h (include Wmsdk.h)
Library Wmvcore.lib; WMStubDRM.lib (if you use DRM)

See also

IWMDRMWriter2 Interface