[System.Security.SecurityCritical]  // auto-generated
 private static bool FrameDescSetHelper(FrameSecurityDescriptor secDesc,
                                        PermissionSet demandSet,
                                        out PermissionSet alteredDemandSet,
                                        RuntimeMethodHandleInternal rmh)
 {
     return secDesc.CheckSetDemand(demandSet, out alteredDemandSet, rmh);
 }
 [System.Security.SecurityCritical]  // auto-generated
 private static bool FrameDescHelper(FrameSecurityDescriptor secDesc,
                                        IPermission demandIn, 
                                        PermissionToken permToken,
                                        RuntimeMethodHandleInternal rmh)
 {
     return secDesc.CheckDemand((CodeAccessPermission) demandIn, permToken, rmh);
 }
 internal RuntimeConstructorInfo(RuntimeMethodHandleInternal handle, RuntimeType declaringType, RuntimeType.RuntimeTypeCache reflectedTypeCache, MethodAttributes methodAttributes, System.Reflection.BindingFlags bindingFlags)
 {
     this.m_bindingFlags = bindingFlags;
     this.m_reflectedTypeCache = reflectedTypeCache;
     this.m_declaringType = declaringType;
     this.m_handle = handle.Value;
     this.m_methodAttributes = methodAttributes;
 }
 internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh)
 {
     if (!CheckAssert(this.AssertSet, demand, permToken))
     {
         return false;
     }
     CodeAccessSecurityEngine.CheckHelper(this.GrantSet, this.RefusedSet, demand, permToken, rmh, null, SecurityAction.Demand, true);
     return true;
 }
 internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh)
 {
     bool flag = this.CheckDemand2(demand, permToken, rmh, false);
     if (flag)
     {
         flag = this.CheckDemand2(demand, permToken, rmh, true);
     }
     return flag;
 }
Beispiel #6
0
        [System.Security.SecurityCritical]  // auto-generated
#pragma warning disable 618
        internal static Exception MakeSecurityException(AssemblyName asmName, Evidence asmEvidence, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
#pragma warning restore 618
        {
#if FEATURE_CAS_POLICY            
            // See if we need to throw a HostProtectionException instead
            HostProtectionPermission hostProtectionPerm = permThatFailed as HostProtectionPermission;
            if(hostProtectionPerm != null)
                return new HostProtectionException(GetResString("HostProtection_HostProtection"), HostProtectionPermission.protectedResources, hostProtectionPerm.Resources);

            // Produce relevant strings
            String message = "";
            MethodInfo method = null;
            try
            {
                if(granted == null && refused == null && demand == null)
                {
                    message = GetResString("Security_NoAPTCA");
                }
                else
                {
                    if(demand != null && demand is IPermission)
                        message = String.Format(CultureInfo.InvariantCulture,  GetResString("Security_Generic"), demand.GetType().AssemblyQualifiedName );
                    else if (permThatFailed != null)
                        message = String.Format(CultureInfo.InvariantCulture, GetResString("Security_Generic"), permThatFailed.GetType().AssemblyQualifiedName);
                    else
                        message = GetResString("Security_GenericNoType");
                }

                method = SecurityRuntime.GetMethodInfo(rmh);
            }
            catch(Exception e)
            {
                // Environment.GetResourceString will throw if we are ReadyForAbort (thread abort).  (We shouldn't do a Contract.Assert in this case or it will lock up the thread.)
                if(e is System.Threading.ThreadAbortException)
                throw;
            }

/*            catch(System.Threading.ThreadAbortException)
            {
                // Environment.GetResourceString will throw if we are ReadyForAbort (thread abort).  (We shouldn't do a BCLDebug.Assert in this case or it will lock up the thread.)
                throw;
            }
            catch
            {
            }
*/
            // make the exception object
            return new SecurityException(message, asmName, granted, refused, method, action, demand, permThatFailed, asmEvidence);
#else
            return new SecurityException(GetResString("Arg_SecurityException"));
#endif

        }
#pragma warning disable 618
        private static void ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
#pragma warning restore 618
        {
            AssemblyName asmName = null;
            Evidence asmEvidence = null;
            if (asm != null)
            {
                // Assert here because reflection will check grants and if we fail the check,
                // there will be an infinite recursion that overflows the stack.
                PermissionSet.s_fullTrust.Assert();
                asmName = asm.GetName();
            }
            throw SecurityException.MakeSecurityException(asmName, asmEvidence, granted, refused, rmh, action, demand, permThatFailed);
        }
 public unsafe SignatureStruct(RuntimeMethodHandleInternal method, RuntimeType[] arguments, RuntimeType returnType, CallingConventions callingConvention)
 {
     this.m_pMethod = method;
     this.m_arguments = arguments;
     this.m_returnTypeORfieldType = returnType;
     this.m_managedCallingConvention = callingConvention;
     this.m_sig = null;
     this.m_pCallTarget = null;
     this.m_csig = 0;
     this.m_numVirtualFixedArgs = 0;
     this.m_64bitpad = 0;
     this.m_declaringType = null;
     this.m_keepalive = null;
 }
 internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh)
 {
     bool flag = true;
     if (this.m_permSetTriples != null)
     {
         for (int i = 0; (i < this.m_permSetTriples.Count) && flag; i++)
         {
             flag = ((PermissionSetTriple) this.m_permSetTriples[i]).CheckDemand(demand, permToken, rmh);
         }
     }
     else if (this.m_firstPermSetTriple != null)
     {
         flag = this.m_firstPermSetTriple.CheckDemand(demand, permToken, rmh);
     }
     return false;
 }
Beispiel #10
0
 private static bool CheckDynamicMethodSetHelper(System.Reflection.Emit.DynamicResolver dynamicResolver,
                                              PermissionSet demandSet,
                                              out PermissionSet alteredDemandSet,
                                              RuntimeMethodHandleInternal rmh)
 {
     System.Threading.CompressedStack creationStack = dynamicResolver.GetSecurityContext();
     bool result;
     try
     {
         result = creationStack.CheckSetDemandWithModificationNoHalt(demandSet, out alteredDemandSet, rmh);
     }
     catch (SecurityException ex)
     {
         throw new SecurityException(Environment.GetResourceString("Security_AnonymouslyHostedDynamicMethodCheckFailed"), ex);
     }
     
     return result;
 }
        [System.Security.SecurityCritical]  // auto-generated
        internal static MethodInfo GetMethodInfo(RuntimeMethodHandleInternal rmh)
        {
            if (rmh.IsNullHandle())
                return null;

#if _DEBUG
            try
            {
#endif
                // Assert here because reflection will check grants and if we fail the check,
                // there will be an infinite recursion that overflows the stack.
                PermissionSet.s_fullTrust.Assert();
                return (System.RuntimeType.GetMethodBase(RuntimeMethodHandle.GetDeclaringType(rmh), rmh) as MethodInfo);
#if _DEBUG
            }
            catch(Exception)
            {
                return null;
            }
#endif
        }
Beispiel #12
0
 internal extern static bool IsConstructor(RuntimeMethodHandleInternal method);
Beispiel #13
0
 internal extern static Resolver GetResolver(RuntimeMethodHandleInternal method);
Beispiel #14
0
 internal extern static void Destroy(RuntimeMethodHandleInternal method);
Beispiel #15
0
 internal extern static bool IsDynamicMethod(RuntimeMethodHandleInternal method);
Beispiel #16
0
 public RuntimeMethodInfoStub(IntPtr methodHandleValue, object keepalive)
 {
     m_keepalive = keepalive;
     m_value = new RuntimeMethodHandleInternal(methodHandleValue);
 }
Beispiel #17
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 internal int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle)
 {
     return GetInterfaceMethodImplementationSlot(GetNativeHandle(), interfaceHandle.GetNativeHandle(), interfaceMethodHandle);
 }
Beispiel #18
0
 private static extern void GetNextIntroducedMethod(ref RuntimeMethodHandleInternal method);
Beispiel #19
0
 internal static extern Object CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck);
Beispiel #20
0
 internal extern static LoaderAllocator GetLoaderAllocator(RuntimeMethodHandleInternal method);
Beispiel #21
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public Signature (
            IRuntimeMethodInfo method,
            RuntimeType[] arguments,
            RuntimeType returnType,
            CallingConventions callingConvention)
        {
            m_pMethod = method.Value;
            m_arguments = arguments;
            m_returnTypeORfieldType = returnType;
            m_managedCallingConventionAndArgIteratorFlags = (byte)callingConvention;

            GetSignature(null, 0, new RuntimeFieldHandleInternal(), method, null);
        }
Beispiel #22
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method)
 {
     RuntimeType[] types = null;
     GetMethodInstantiation(method, JitHelpers.GetObjectHandleOnStack(ref types), true);
     return types;
 }
Beispiel #23
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 internal IntroducedMethodEnumerator(RuntimeType type)
 {
     _handle = RuntimeTypeHandle.GetFirstIntroducedMethod(type);
     _firstCall = true;
 }
Beispiel #24
0
 internal extern static bool HasMethodInstantiation(RuntimeMethodHandleInternal method);
Beispiel #25
0
 private extern static int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle);
Beispiel #26
0
 internal extern static RuntimeMethodHandleInternal GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation);
Beispiel #27
0
 public RuntimeMethodInfoStub(RuntimeMethodHandleInternal methodHandleValue, object keepalive)
 {
     m_keepalive = keepalive;
     m_value = methodHandleValue;
 }
Beispiel #28
0
 internal extern static RuntimeMethodHandleInternal GetMethodFromCanonical(RuntimeMethodHandleInternal method, RuntimeType declaringType);
        [System.Security.SecuritySafeCritical]  // auto-generated
        protected virtual object DynamicInvokeImpl(object[] args) 
        {
            RuntimeMethodHandleInternal method = new RuntimeMethodHandleInternal(GetInvokeMethod());
            RuntimeMethodInfo invoke = (RuntimeMethodInfo)RuntimeType.GetMethodBase((RuntimeType)this.GetType(), method);

            return invoke.UnsafeInvoke(this, BindingFlags.Default, null, args, null);
        }
Beispiel #30
0
 internal extern static bool IsGenericMethodDefinition(RuntimeMethodHandleInternal method);