次の方法で共有


Windows Media Rights Manager SDK banner art

WMRMLicenseStateData.Dates

The Dates property retrieves an array of start and/or expiration dates.

Syntax

SAFEARRAY = WMRMLicenseStateData.Dates

Parameters

This property takes no parameters.

Return Values

If the property succeeds, it returns a SAFEARRAY of Variants, indicating remaining dates in a license. If it fails, it returns a number in the error object.

Remarks

The number of dates in the array depends on the license state category. For example, the license might contain only an expiration date, or both a start date and an expiration date, or remaining play counts. For more information, see the Category property.

This property is read-only.

Example Code

' Declare variables.
    Dim ChallengeObj             ' WMRMChallenge object
    Dim ChainCollObj             ' WMRMUplinkCollection object
    Dim ChainObj                 ' WMRMUplink object
    Dim LeafLicenseStateObj      ' WMRMLicenseStateData object
    Dim RootLicenseStateObj      ' WMRMLicenseStateData object
    Dim HeaderObj                ' WMRMHeader object

    Dim ContentServerPubKey      ' Public key of the content server
    Dim Seed                     ' License key seed
    Dim LicChain                 ' License chain flag
    Dim strLicenseRequested      ' License request string
    Dim varClientInfo            ' Client information
    Dim varHeader                ' Content header
    Dim blnResult                ' Signature verification
    Dim SimpleLeafKID            ' Key ID of a simple license or leaf license
    Dim IndiVersion              ' Security version of the DRM component

    Dim RootKID                  ' Key ID of the root license
    Dim RootCat                  ' License state data for root licenses
    Dim RCountArray              ' Count array
    Dim RDateArray               ' Date array
    Dim RStreamID                ' Stream ID
    Dim RVague                   ' Vagueness
    Dim IssueRoot                ' Root license flag
    Dim Rcounts                  ' Remaining counts
    Dim RstartDate               ' Start date
    Dim RExpDate                 ' Expiration date

    Dim LeafCat                  ' License state data for leaf licenses
    Dim LCountArray              ' Count array
    Dim LDateArray               ' Date array
    Dim LStreamID                ' Stream ID
    Dim LVague                   ' Vagueness
    Dim IssueLeaf                ' Leaf license flag
    Dim Lcounts                  ' Remaining counts
    Dim LstartDate               ' Start date
    Dim LExpDate                 ' Expiration date

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' Set variables.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    ContentServerPubKey = Application("contentserverpubkey")
    Seed = Application("seed")
    LicChain = ""

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' Retrieve the license request. Get the client information and content header.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    Set ChallengeObj = Server.CreateObject("WMRMObjs.WMRMchallenge")
    strLicenseRequested = Request.Form("challenge")
    ChallengeObj.Challenge = strLicenseRequested
    varClientInfo = ChallengeObj.ClientInfo
    varHeader = ChallengeObj.Header

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' Put the content header into the header object. Retrieve
' the KID and required individualization version.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    Set HeaderObj = Server.CreateObject("WMRMObjs.WMRMheader")
    HeaderObj.Header = varHeader
    blnResult = HeaderObj.Verify(ContentServerPubKey)
    SimpleLeafKID = HeaderObj.KeyID
    IndiVersion = HeaderObj.IndividualizedVersion
        ' If IndividualizedVersion is not specified, an error 
        ' might be set.

'"""""""""""""""""""""""""""""""""""""""""""""""""""""
' If this is a chained license, retrieve the root license KID.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""
    Set ChainCollObj = ChallengeObj.Uplinks
    If (Err.Number = 0) Then    ' Request for a license chain. 
        LicChain = "chain"     

        ' Get license state data and key ID for the root license.
        Set ChainObj = ChainCollObj.item(1)
        RootKID =  ChainObj.KID

        ' Get license state data to determine whether to issue
        ' a root license.
        Set RootLicenseStateObj = ChainObj.LicenseState
        RootCat = cstr(RootLicenseStateObj.Category)
        Select Case RootCat
            case 0    ' The root license has no rights.
                IssueRoot = True
            case 1    ' The root license has unlimited play counts.
                IssueRoot = False
            case 2    ' The root license has remaining play counts.
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 3    ' The root license has a start date.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                IssueRoot = False
            case 4    ' The root license has an expiration date.
                RDateArray = RootLicenseStateObj.Dates
                RExpDate =  cstr(RDateArray(0))
                IssueRoot = False
            case 5    ' The root license has start and expiration dates.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                RExpDate =  cstr(RDateArray(1))
                IssueRoot = False
            case 6    ' The root license has a start date and 
                      ' remaining play counts.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 7    ' The root license has an expiration date and 
                      ' remaining play counts.
                RDateArray = RootLicenseStateObj.Dates
                RExpDate =  cstr(RDateArray(0))
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 8    ' The root license has start and expiration 
                      ' dates, and remaining play counts.
                RDateArray = RootLicenseStateObj.Dates
                RStartDate =  cstr(RDateArray(0))
                RExpDate =  cstr(RDateArray(1))
                RCountArray = RootLicenseStateObj.Counts 
                RCounts = cstr(RCountArray(0))
                IssueRoot = False
            case 9    ' The root license expires after first use.
                IssueRoot = False
        End Select

        RStreamID = RootLicenseStateObj.StreamID  ' This value is always 0.
        RVague = RootLicenseStateObj.Vagueness

        ' Get license state data to determine whether to issue
        ' a leaf license.
        Set ChainObj = ChainCollObj.item(0)
        Set LeafLicenseStateObj = ChainObj.LicenseState
        LeafCat = cstr(LeafLicenseStateObj.Category)
        Select Case LeafCat
            case 0    ' The leaf license has no rights.
                IssueLeaf = True
            case 1    ' The leaf license has unlimited play counts.
                IssueLeaf = False
            case 2    ' The leaf license has remaining play counts.
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 3    ' The leaf license has a start date.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                IssueLeaf = False
            case 4    ' The leaf license has an expiration date.
                LDateArray = LeafLicenseStateObj.Dates
                LExpDate =  cstr(LDateArray(0))
                IssueLeaf = False
            case 5    ' The leaf license has start and expiration dates.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                LExpDate =  cstr(LDateArray(1))
                IssueLeaf = False
            case 6    ' The leaf license has a start date and 
                      ' remaining play counts.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 7    ' The leaf license has an expiration date and 
                      ' remaining play counts.
                LDateArray = LeafLicenseStateObj.Dates
                LExpDate =  cstr(LDateArray(0))
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 8    ' The leaf license has start and expiration 
                      ' dates, and remaining play counts.
                LDateArray = LeafLicenseStateObj.Dates
                LStartDate =  cstr(LDateArray(0))
                LExpDate =  cstr(LDateArray(1))
                LCountArray = LeafLicenseStateObj.Counts 
                LCounts = cstr(LCountArray(0))
                IssueLeaf = False
            case 9    ' The root license expires after first use.
                IssueLeaf = False
        End Select

        LStreamID = LeafLicenseStateObj.StreamID  ' This value is always 0.
        LVague = LeafLicenseStateObj.Vagueness

    Else    ' An error indicates a request for a simple license.
        err.clear
        LicChain = "simple"
    End If

' Continue generating the license. 

Requirements

Version: Windows Media Rights Manager 10 SDK

Reference: wmrmobjs 1.0 Type Library

Library: wmrmobjs.dll

Platform: Windows Server 2003

See Also