Ejemplo n.º 1
0
 internal static extern int DRMActivate(
     [In] SafeRightsManagementSessionHandle hSession,
     [In, MarshalAs(UnmanagedType.U4)] uint uFlags,
     [In, MarshalAs(UnmanagedType.U4)] uint uLangID,
     [In, MarshalAs(UnmanagedType.LPStruct)] ActivationServerInfo activationServerInfo,
     IntPtr context,                      // this is a void* in the unmanaged SDK so IntPtr is the right (platform dependent declaration)
     IntPtr parentWindowHandle);          // this a HWND in the unmanaged SDK so IntPtr is the right (platform dependent declaration)
Ejemplo n.º 2
0
 internal static int DRMIsActivated(
     SafeRightsManagementSessionHandle hSession,
     uint uFlags,
     ActivationServerInfo activationServerInfo)
 {
     return(UnsafeNativeMethods.DRMIsActivated(
                hSession,
                uFlags,
                activationServerInfo));
 }
Ejemplo n.º 3
0
 internal static int DRMIsActivated(
     SafeRightsManagementSessionHandle hSession,
     uint uFlags,
     ActivationServerInfo activationServerInfo)
 {
     SecurityHelper.DemandRightsManagementPermission();
     return(UnsafeNativeMethods.DRMIsActivated(
                hSession,
                uFlags,
                activationServerInfo));
 }
Ejemplo n.º 4
0
 internal static int DRMActivate(
     SafeRightsManagementSessionHandle hSession,
     uint uFlags,
     uint uLangID,
     ActivationServerInfo activationServerInfo,
     IntPtr context,
     IntPtr parentWindowHandle)
 {
     return(UnsafeNativeMethods.DRMActivate(
                hSession,
                uFlags,
                uLangID,
                activationServerInfo,
                context,
                parentWindowHandle));
 }
Ejemplo n.º 5
0
 internal static extern int DRMIsActivated(
     [In] SafeRightsManagementSessionHandle hSession,
     [In, MarshalAs(UnmanagedType.U4)] uint uFlags,
     [In, MarshalAs(UnmanagedType.LPStruct)] ActivationServerInfo activationServerInfo);
Ejemplo n.º 6
0
        /// <summary>
        /// The Activate function obtains a lockbox and machine certificate for a machine or a rights 
        /// account certificate for a user (depend on activationFlags). 
        /// </summary>
        private string Activate(
            ActivationFlags activationFlags, Uri url)
        {
            // Optional server information. To query UDDI for an activation URL, pass in NULL
            ActivationServerInfo activationServer = null;

            if (url != null)
            {
                activationServer = new ActivationServerInfo();
                activationServer.PubKey = null;
                activationServer.Url = url.AbsoluteUri;  // We are using Uri class as a basic validation mechanism. These URIs come from unmanaged 
                // code libraries and go back as parameters into the unmanaged code libraries. 
                // We use AbsoluteUri property as means of verifying that it is actually an absolute and 
                // well formed Uri. If by any chance it happened to be a relative URI, an exception will 
                // be thrown here. This will perform the necessary escaping.

                activationServer.Version = NativeConstants.DrmCallbackVersion;
            }

            int hr = SafeNativeMethods.DRMActivate(
                _hSession,
                (uint)activationFlags,
                0,                          //language Id 
                activationServer,
                IntPtr.Zero,    // context 
                IntPtr.Zero);  // parent Window handle 

            Errors.ThrowOnErrorCode(hr);

            _callbackHandler.WaitForCompletion();        // it will throw a proper exception in a failure case             

            return _callbackHandler.CallbackData;
        }
 internal static int DRMActivate( 
                         SafeRightsManagementSessionHandle hSession,
                         uint uFlags, 
                         uint uLangID,
                         ActivationServerInfo activationServerInfo,
                         IntPtr context,
                         IntPtr parentWindowHandle) 
 {
     SecurityHelper.DemandRightsManagementPermission(); 
     return UnsafeNativeMethods.DRMActivate( 
                         hSession,
                         uFlags, 
                         uLangID,
                         activationServerInfo,
                         context,
                         parentWindowHandle); 
 }
 internal static int DRMIsActivated( 
                          SafeRightsManagementSessionHandle hSession,
                          uint uFlags, 
                          ActivationServerInfo activationServerInfo) 
 {
     SecurityHelper.DemandRightsManagementPermission(); 
     return UnsafeNativeMethods.DRMIsActivated(
                         hSession,
                         uFlags,
                         activationServerInfo); 
 }