[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;
 }
Example #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

        }
 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;
 }
#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);
        }
 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;
 }
Example #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
        }
Example #12
0
 internal extern static bool HasMethodInstantiation(RuntimeMethodHandleInternal method);
Example #13
0
 internal static extern MethodAttributes GetAttributes(RuntimeMethodHandleInternal method);
Example #14
0
 internal static extern bool MatchesNameHash(RuntimeMethodHandleInternal method, uint hash);
 internal int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle)
 {
     return(GetInterfaceMethodImplementationSlot(this.GetNativeHandle(), interfaceHandle.GetNativeHandle(), interfaceMethodHandle));
 }
Example #16
0
 internal static extern Object CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck);
Example #17
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 internal int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle)
 {
     return GetInterfaceMethodImplementationSlot(GetNativeHandle(), interfaceHandle.GetNativeHandle(), interfaceMethodHandle);
 }
Example #18
0
 internal static extern bool IsDynamicMethod(RuntimeMethodHandleInternal method);
Example #19
0
 internal static extern void Destroy(RuntimeMethodHandleInternal method);
Example #20
0
 internal static extern RuntimeMethodHandleInternal GetMethodFromCanonical(RuntimeMethodHandleInternal method, RuntimeType declaringType);
Example #21
0
 internal static extern bool IsGenericMethodDefinition(RuntimeMethodHandleInternal method);
Example #22
0
 internal static extern RuntimeMethodHandleInternal GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation);
Example #23
0
 internal static extern bool HasMethodInstantiation(RuntimeMethodHandleInternal method);
Example #24
0
 internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method)
 {
     RuntimeType[] o = null;
     GetMethodInstantiation(method, JitHelpers.GetObjectHandleOnStack <RuntimeType[]>(ref o), true);
     return(o);
 }
Example #25
0
 private static extern void GetMethodInstantiation(RuntimeMethodHandleInternal method, ObjectHandleOnStack types, bool fAsRuntimeTypeArray);
Example #26
0
 internal static extern Resolver GetResolver(RuntimeMethodHandleInternal method);
Example #27
0
 internal extern static LoaderAllocator GetLoaderAllocator(RuntimeMethodHandleInternal method);
Example #28
0
 internal static extern bool IsConstructor(RuntimeMethodHandleInternal method);
Example #29
0
 private static extern void GetNextIntroducedMethod(ref RuntimeMethodHandleInternal method);
Example #30
0
 internal static extern object GetLoaderAllocator(RuntimeMethodHandleInternal method);
Example #31
0
 public RuntimeMethodInfoStub(IntPtr methodHandleValue, object keepalive)
 {
     m_keepalive = keepalive;
     m_value = new RuntimeMethodHandleInternal(methodHandleValue);
 }
Example #32
0
 internal static extern void PerformSecurityCheck(object obj, RuntimeMethodHandleInternal method, RuntimeType parent, uint invocationFlags);
 private static extern int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle);
Example #34
0
 private static extern unsafe void *_GetUtf8Name(RuntimeMethodHandleInternal method);
 internal IntroducedMethodEnumerator(RuntimeType type)
 {
     this._handle    = RuntimeTypeHandle.GetFirstIntroducedMethod(type);
     this._firstCall = true;
 }
Example #36
0
 internal extern static RuntimeMethodHandleInternal GetMethodFromCanonical(RuntimeMethodHandleInternal method, RuntimeType declaringType);
Example #37
0
 internal static extern RuntimeType GetDeclaringType(RuntimeMethodHandleInternal method);
Example #38
0
 internal extern static bool IsDynamicMethod(RuntimeMethodHandleInternal method);
Example #39
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method)
 {
     RuntimeType[] types = null;
     GetMethodInstantiation(method, JitHelpers.GetObjectHandleOnStack(ref types), true);
     return types;
 }
Example #40
0
 internal extern static Resolver GetResolver(RuntimeMethodHandleInternal method);
Example #41
0
 internal extern static RuntimeMethodHandleInternal GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation);
Example #42
0
 internal static extern bool IsILStub(RuntimeMethodHandleInternal method);
Example #43
0
 internal extern static bool IsGenericMethodDefinition(RuntimeMethodHandleInternal method);
Example #44
0
 internal static extern string GetName(RuntimeMethodHandleInternal method);
Example #45
0
 internal extern static void Destroy(RuntimeMethodHandleInternal method);
Example #46
0
 public RuntimeMethodInfoStub(RuntimeMethodHandleInternal methodHandleValue, object keepalive)
 {
     this.m_keepalive = keepalive;
     this.m_value     = methodHandleValue;
 }
Example #47
0
 internal extern static bool IsConstructor(RuntimeMethodHandleInternal method);
Example #48
0
 public RuntimeMethodInfoStub(IntPtr methodHandleValue, object keepalive)
 {
     this.m_keepalive = keepalive;
     this.m_value     = new RuntimeMethodHandleInternal(methodHandleValue);
 }
Example #49
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);
        }
Example #50
0
 internal static extern IntPtr GetFunctionPointer(RuntimeMethodHandleInternal handle);
Example #51
0
 [System.Security.SecuritySafeCritical]  // auto-generated
 internal IntroducedMethodEnumerator(RuntimeType type)
 {
     _handle = RuntimeTypeHandle.GetFirstIntroducedMethod(type);
     _firstCall = true;
 }
Example #52
0
 internal static extern int GetSlot(RuntimeMethodHandleInternal method);
Example #53
0
 private extern static int GetInterfaceMethodImplementationSlot(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle, RuntimeMethodHandleInternal interfaceMethodHandle);
 internal static extern object CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck);
Example #55
0
 public RuntimeMethodInfoStub(RuntimeMethodHandleInternal methodHandleValue, object keepalive)
 {
     m_keepalive = keepalive;
     m_value = methodHandleValue;
 }
 private static extern void GetNextIntroducedMethod(ref RuntimeMethodHandleInternal method);
Example #57
0
        [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);
        }
Example #58
0
 internal static Utf8String GetUtf8Name(RuntimeMethodHandleInternal method)
 {
     return(new Utf8String(_GetUtf8Name(method)));
 }