Beispiel #1
0
 protected void Schedule()
 {
     if (!this.isScheduled)
     {
         this.isScheduled = true;
         if (PartialTrustHelpers.ShouldFlowSecurityContext)
         {
             this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow();
         }
         if (this.context == null)
         {
             this.ScheduleCallback(ActionItem.CallbackHelper.InvokeWithoutContextCallback);
             return;
         }
         else
         {
             this.ScheduleCallback(ActionItem.CallbackHelper.InvokeWithContextCallback);
             return;
         }
     }
     else
     {
         throw Fx.Exception.AsError(new InvalidOperationException(InternalSR.ActionItemIsAlreadyScheduled));
     }
 }
Beispiel #2
0
        internal static bool IsTypeAptca(Type type)
        {
            Assembly assembly = type.Assembly;

            if (PartialTrustHelpers.IsAssemblyAptca(assembly))
            {
                return(true);
            }
            else
            {
                return(!PartialTrustHelpers.IsAssemblySigned(assembly));
            }
        }
Beispiel #3
0
        internal static bool IsInFullTrust()
        {
            bool flag;

            if (SecurityManager.CurrentThreadRequiresSecurityContextCapture())
            {
                try
                {
                    PartialTrustHelpers.DemandForFullTrust();
                    flag = true;
                }
                catch (SecurityException securityException)
                {
                    flag = false;
                }
                return(flag);
            }
            else
            {
                return(true);
            }
        }
Beispiel #4
0
        protected void Schedule()
        {
            if (isScheduled)
            {
                throw Fx.Exception.AsError(new InvalidOperationException(InternalSR.ActionItemIsAlreadyScheduled));
            }

            this.isScheduled = true;
#if FEATURE_COMPRESSEDSTACK
            if (PartialTrustHelpers.ShouldFlowSecurityContext)
            {
                this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow();
            }
            if (this.context != null)
            {
                ScheduleCallback(CallbackHelper.InvokeWithContextCallback);
            }
            else
#endif
            {
                ScheduleCallback(CallbackHelper.InvokeWithoutContextCallback);
            }
        }
Beispiel #5
0
        internal static bool HasEtwPermissions()
        {
            PermissionSet permissionSets = new PermissionSet(PermissionState.Unrestricted);

            return(PartialTrustHelpers.CheckAppDomainPermissions(permissionSets));
        }