IWMDRMProfile::put_V1LicenseAcquisitionURL

Windows Media Encoder SDK banner art

The put_V1LicenseAcquisitionURL method specifies the URL for acquiring version 1 licenses.

Syntax

HRESULT put_V1LicenseAcquisitionURL(
  BSTR  bstrLAINFO
);

Parameters

bstrLAINFO

[in]  BSTR containing the URL for acquiring version 1 licenses.

Return Values

If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.

Remarks

Players that support only Windows Media Rights Manager 1 require version 1 licenses, so you need to specify a license acquisition URL where version 1 licenses are issued. If your license provider does not issue version 1 licenses, you can supply a URL that points to a page where users can upgrade to a player that supports Windows Media Rights Manager 7 or later. For example, use http://go.microsoft.com/fwlink/?LinkId=10141 for the put_V1LicenseAcquisitionURL method.

Example Code

// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include "C:\WMSDK\WMEncSDK9\include\wmdrmprf.h" // for DRM features

    HRESULT hr;
    IWMEncoder2* pEncoder;
    IWMDRMContentAuthor* pDRM;
    IWMDRMProfileCollection* pDRMProColl;
    IWMDRMProfile* pDRMPro;
    IWMDRMAttributes* pProAttr;

    // Initialize the COM library and retrieve a pointer
    // to an IWMEncoder interface.
    hr = CoInitialize(NULL);

    if ( SUCCEEDED( hr ) )
    {
        hr = CoCreateInstance(CLSID_WMEncoder,
            NULL,
            CLSCTX_INPROC_SERVER,
            IID_IWMEncoder2,
            (void**) &pEncoder);
    }

    // Create an IWMDRMContentAuthor object.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_EncoderDRMContentAuthor(&pDRM);
    }

    // Retrieve the collection of DRM profiles.
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRM->get_DRMProfileCollection(&pDRMProColl);
    }

    // Declare variables. Specify the provider's Web site and signature values.
    // The other variables are returned.
    CComBSTR sPublicKey;
    CComBSTR sWebURL("http://YourWebSite");
    CComVariant vProfileID;
    CComVariant vSeed;
    CComBSTR sSigPrivKey("Replace with signature private key");
    CComBSTR sSignedPubKey("Replace with signed public key");
    CComBSTR sSigLSCert("Replace with the licensor certificate");
    CComBSTR sSigRootCert("Replace with the Microsoft DRM License Server Root certificate");

    // Create the DRM profile. The public key, DRM profile ID, and
    // license key seed are returned.
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRM->CreateDRMProfile(sWebURL, sSigPrivKey, sSignedPubKey, sSigLSCert, sSigRootCert, &vProfileID, &vSeed, &sPublicKey);
    }

    // Create an IWMDRMProfile object and retrieve a profile.
    CComVariant vIndex(0);
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMProColl->Item(vIndex, &pDRMPro);
    }

    // Set the rest of the properties for the DRM profile.
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMPro->put_Description(CComBSTR("Replace with a description of this DRM profile"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMPro->put_LicenseAcquisitionURL(CComBSTR("Replace with v7 license acquisition URL"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMPro->put_Name(CComBSTR("Replace with a name for the DRM profile"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMPro->put_V1LicenseAcquisitionURL(CComBSTR("Replace with v1 license acquisition URL"));
    }

    // Add the individualization version as an attribute.
    // This attribute should be saved in the DRM profile. 
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMPro->get_Attributes(&pProAttr);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pProAttr->Add(CComBSTR("SECURITYVERSION"), CComVariant("2.2"));
    }

    // Add the content ID as an attribute. This attribute is for the current
    // session only and is not saved in the profile.
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRM->get_Attributes(&pProAttr);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pProAttr->Add(CComBSTR("ContentID"), CComVariant("10011"));
    }

    // Set the profile into the DRM session.
    CComVariant vKeyID;
    CComBSTR sProID;
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMPro->get_ID(&sProID);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRM->SetSessionDRMProfile(sProID, &vKeyID);
    }

    // Release pointers.
    if ( pDRM )
    {
        pDRM->Release();
        pDRM = NULL;
    }
    if ( pDRMProColl )
    {
        pDRMProColl->Release();
        pDRMProColl = NULL;
    }
    if ( pDRMPro )
    {
        pDRMPro->Release();
        pDRMPro = NULL;
    }
    if ( pProAttr )
    {
        pProAttr->Release();
        pProAttr = NULL;
    }
    if ( pEncoder )
    {
        pEncoder->Release();
        pEncoder = NULL;
    }

Requirements

Header: wmdrmprf.h

Library: wmenc.exe

See Also