Expand Minimize

DRMGetUnboundLicenseAttribute function

[The AD RMS SDK leveraging functionality exposed by the client in Msdrm.dll is available for use in Windows Server 2008, Windows Vista, Windows Server 2008 R2, Windows 7, Windows Server 2012, and Windows 8. It may be altered or unavailable in subsequent versions. Instead, use Active Directory Rights Management Services SDK 2.0, which leverages functionality exposed by the client in Msipc.dll.]

The DRMGetUnboundLicenseAttribute function retrieves an unbound license attribute from the underlying XrML.

Syntax


HRESULT DRMGetUnboundLicenseAttribute(
  _In_     DRMQUERYHANDLE hQueryRoot,
  _In_     PWSTR wszAttributeType,
  _In_     UINT iWhich,
  _Out_    DRMENCODINGTYPE *peEncoding,
  _Inout_  UINT *pcBuffer,
  _Out_    BYTE *pbBuffer
);

Parameters

hQueryRoot [in]

A handle to a license or object in the license, created by using DRMGetUnboundLicenseObject or DRMParseUnboundLicense.

wszAttributeType [in]

Name of the attribute to retrieve.

iWhich [in]

Zero-based index of the attribute to retrieve.

peEncoding [out]

An enumeration value specifying the encoding type of the return value.

pcBuffer [in, out]

Size of the returned data, in characters, plus one for a null terminator.

pbBuffer [out]

Attribute value.

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.

Return codeDescription
E_DRM_BADGETINFOQUERY

The requested attribute cannot exist in the object specified.

E_DRM_NO_MORE_DATA

No license or certificate exists at the specified index.

E_DRM_QUERY_REPORTS_NO_RESULTS

No instances of the requested attribute exist.

 

Remarks

Attributes hold information about an object, such as its name, issue time, or SKU value. All allocating and freeing of memory are the responsibility of the caller. To obtain the size of the returned value, first call this function with the attribute sought (such as "Issue Date"), and NULL in the pbBuffer value. The size required for the buffer will be passed out in pcBuffer.

An object may have several instances of an attribute with the same name. For example, a RIGHT object may have several name-value pairs. In this case, it may be necessary to iterate through all the instances of an attribute (g_wszQUERY_RIGHTSPARAMETERNAME or g_wszQUERY_RIGHTSPARAMETERVALUE in the preceding example) by first calling DRMGetUnboundLicenseAttributeCount to get a count of existing objects, and then looping through all iWhich instances of the attribute, starting at zero and incrementing by one.

This query will search only at the level immediately below the passed in object. So, for example, if the root license handle is passed in and the attribute to find is g_wszQUERY_SKUVALUE, the query will find nothing because the SKUVALUE appears at the second level or deeper (counting the license root as level 0).

The only attributes you can query for in an issuance license are g_wszQUERY_IDTYPE, g_wszQUERY_IDVALUE, g_wszQUERY_NAME, g_wszQUERY_ADDRESSTYPE, and g_wszQUERY_ADDRESSVALUE.

Requirements

Product

Rights Management Services client 1.0 SP2 or later

Header

Msdrm.h

Library

Msdrm.lib

DLL

Msdrm.dll

See also

Querying Licenses
DRMGetUnboundLicenseAttributeCount
DRMGetUnboundLicenseObjectCount
DRMGetUnboundLicenseObject

 

 

Show:
© 2014 Microsoft