예제 #1
0
        internal static bool IsTypeAptca(Type type)
        {
            Assembly assembly = type.Assembly;

            if (PartialTrustHelpers.IsAssemblyAptca(assembly))
            {
                return(true);
            }
            return(!PartialTrustHelpers.IsAssemblySigned(assembly));
        }
예제 #2
0
 protected void Schedule()
 {
     if (this.isScheduled)
     {
         throw Fx.Exception.AsError(new InvalidOperationException(SRCore.ActionItemIsAlreadyScheduled), null);
     }
     this.isScheduled = true;
     if (PartialTrustHelpers.ShouldFlowSecurityContext)
     {
         this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow();
     }
     if (this.context != null)
     {
         this.ScheduleCallback(ActionItem.CallbackHelper.InvokeWithContextCallback);
         return;
     }
     this.ScheduleCallback(ActionItem.CallbackHelper.InvokeWithoutContextCallback);
 }
 public static Exception PrepareForRethrow(this Exception exception)
 {
     if (!ExceptionExtensionMethods.ShouldPrepareForRethrow(exception))
     {
         return(exception);
     }
     if (PartialTrustHelpers.UnsafeIsInFullTrust())
     {
         if (ExceptionExtensionMethods.prepForRemotingMethodInfo == null)
         {
             ExceptionExtensionMethods.prepForRemotingMethodInfo = typeof(Exception).GetMethod("PrepForRemoting", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[0], new ParameterModifier[0]);
         }
         if (ExceptionExtensionMethods.prepForRemotingMethodInfo != null)
         {
             ExceptionExtensionMethods.prepForRemotingMethodInfo.Invoke(exception, new object[0]);
         }
     }
     return(exception);
 }
예제 #4
0
        internal static bool IsInFullTrust()
        {
            bool flag;

            if (AppDomain.CurrentDomain.IsHomogenous)
            {
                return(AppDomain.CurrentDomain.IsFullyTrusted);
            }
            if (!SecurityManager.CurrentThreadRequiresSecurityContextCapture())
            {
                return(true);
            }
            try
            {
                PartialTrustHelpers.DemandForFullTrust();
                flag = true;
            }
            catch (SecurityException securityException)
            {
                flag = false;
            }
            return(flag);
        }
예제 #5
0
 internal static bool HasEtwPermissions()
 {
     return(PartialTrustHelpers.CheckAppDomainPermissions(new PermissionSet(PermissionState.Unrestricted)));
 }