Exemplo n.º 1
0
        internal static int DRMCreateClientSession(
            CallbackDelegate pfnCallback,
            uint uCallbackVersion,
            string GroupIDProviderType,
            string GroupID,
            out SafeRightsManagementSessionHandle phSession)
        {
            SecurityHelper.DemandRightsManagementPermission();
            int res = UnsafeNativeMethods.DRMCreateClientSession(
                pfnCallback,
                uCallbackVersion,
                GroupIDProviderType,
                GroupID,
                out phSession);

            // 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 ((phSession != null) && phSession.IsInvalid)
            {
                phSession.Dispose();
                phSession = null;
            }
            return(res);
        }
        internal static int DRMCreateClientSession(
                                CallbackDelegate pfnCallback,
                                 uint uCallbackVersion, 
                                 string GroupIDProviderType,
                                 string GroupID, 
                                 out SafeRightsManagementSessionHandle phSession) 
        {
            SecurityHelper.DemandRightsManagementPermission(); 
            int res = UnsafeNativeMethods.DRMCreateClientSession(
                                pfnCallback,
                                uCallbackVersion,
                                GroupIDProviderType, 
                                GroupID,
                                out phSession); 
 
            // 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 ((phSession != null) && phSession.IsInvalid)
            {
                phSession.Dispose(); 
                phSession = null;
            } 
            return res; 
        }
Exemplo n.º 3
0
        internal static int DRMCreateLicenseStorageSession(
            SafeRightsManagementEnvironmentHandle hEnv,
            SafeRightsManagementHandle hDefLib,
            SafeRightsManagementSessionHandle hClientSession,
            uint uFlags,
            string IssuanceLicense,
            out SafeRightsManagementSessionHandle phLicenseStorageSession)
        {
            SecurityHelper.DemandRightsManagementPermission();
            int res = UnsafeNativeMethods.DRMCreateLicenseStorageSession(
                hEnv,
                hDefLib,
                hClientSession,
                uFlags,
                IssuanceLicense,
                out phLicenseStorageSession);

            // 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 ((phLicenseStorageSession != null) && phLicenseStorageSession.IsInvalid)
            {
                phLicenseStorageSession.Dispose();
                phLicenseStorageSession = null;
            }
            return(res);
        }
        internal static int DRMCreateLicenseStorageSession( 
                                SafeRightsManagementEnvironmentHandle hEnv,
                                SafeRightsManagementHandle hDefLib, 
                                SafeRightsManagementSessionHandle hClientSession,
                                uint uFlags,
                                string IssuanceLicense,
                                out SafeRightsManagementSessionHandle phLicenseStorageSession) 
        {
            SecurityHelper.DemandRightsManagementPermission(); 
            int res = UnsafeNativeMethods.DRMCreateLicenseStorageSession( 
                                hEnv,
                                hDefLib, 
                                hClientSession,
                                uFlags,
                                IssuanceLicense,
                                out phLicenseStorageSession); 

            // 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 ((phLicenseStorageSession != null) && phLicenseStorageSession.IsInvalid) 
            {
                phLicenseStorageSession.Dispose();
                phLicenseStorageSession = null;
            } 
            return res;
        }