DRMGetUnboundLicenseAttribute function (msdrm.h)
[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.1,
which leverages functionality exposed by the client in Msipc.dll.]
The DRMGetUnboundLicenseAttribute function retrieves an unbound license attribute from the underlying XrML.
DRMEXPORT HRESULT UDAPICALL DRMGetUnboundLicenseAttribute( DRMQUERYHANDLE hQueryRoot, PWSTR wszAttributeType, UINT iWhich, DRMENCODINGTYPE *peEncoding, UINT *pcBuffer, BYTE *pbBuffer );
Name of the attribute to retrieve.
Zero-based index of the attribute to retrieve.
An enumeration value specifying the encoding type of the return value.
Size of the returned data, in characters, plus one for a null terminator.
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 list. For a list of common error codes, see Common HRESULT Values.
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.