示例#1
0
        internal static int DRMParseUnboundLicense(
            string certificate,
            out SafeRightsManagementQueryHandle queryRootHandle)
        {
            int res = UnsafeNativeMethods.DRMParseUnboundLicense(
                certificate,
                out queryRootHandle);

            // on some platforms in the failure cases the out parameter is being created with the value 0
            // in order to simplify error handling and Disposing of those handles we will just close them as
            // soon as we detect such case
            if ((queryRootHandle != null) && queryRootHandle.IsInvalid)
            {
                queryRootHandle.Dispose();
                queryRootHandle = null;
            }
            return(res);
        }
示例#2
0
        internal static int DRMGetUnboundLicenseObject(
            SafeRightsManagementQueryHandle queryRootHandle,
            string subObjectType,
            uint index,
            out SafeRightsManagementQueryHandle subQueryHandle)
        {
            int res = UnsafeNativeMethods.DRMGetUnboundLicenseObject(
                queryRootHandle,
                subObjectType,
                index,
                out subQueryHandle);

            // on some platforms in the failure cases the out parameter is being created with the value 0
            // in order to simplify error handling and Disposing of those handles we will just close them as
            // soon as we detect such case
            if ((subQueryHandle != null) && subQueryHandle.IsInvalid)
            {
                subQueryHandle.Dispose();
                subQueryHandle = null;
            }
            return(res);
        }
        internal static int DRMGetUnboundLicenseObject(
                                 SafeRightsManagementQueryHandle queryRootHandle, 
                                 string subObjectType,
                                 uint index,
                                 out SafeRightsManagementQueryHandle subQueryHandle)
        { 
            SecurityHelper.DemandRightsManagementPermission();
            int res = UnsafeNativeMethods.DRMGetUnboundLicenseObject( 
                                queryRootHandle, 
                                subObjectType,
                                index, 
                                out subQueryHandle);

            // on some platforms in the failure cases the out parameter is being created with the value 0
            // in order to simplify error handling and Disposing of those handles we will just close them as 
            // soon as we detect such case
            if ((subQueryHandle != null) && subQueryHandle.IsInvalid) 
            { 
                subQueryHandle.Dispose();
                subQueryHandle = null; 
            }
            return res;
        }