// Gonzalo Paniagua (gonzalo@ximian.com)
//
// (c) 2001-2003 Ximian, Inc.
-// (c) 2003,2004 Novell, Inc. (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2003-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
-using System.Globalization;
using System.Runtime.Serialization;
+using System.Security;
namespace System
{
if (types == null) {
if (count > 1)
throw new AmbiguousMatchException ();
- return found;
+ return (ConstructorInfo) CheckMethodSecurity (found);
}
match = new MethodBase [count];
if (count == 1)
}
if (binder == null)
binder = Binder.DefaultBinder;
- return (ConstructorInfo)binder.SelectMethod (bindingAttr, match, types, modifiers);
+ return (ConstructorInfo) CheckMethodSecurity (binder.SelectMethod (bindingAttr, match, types, modifiers));
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
return null;
if (count == 1 && typesLen == 0)
- return found;
+ return (MethodInfo) CheckMethodSecurity (found);
match = new MethodBase [count];
if (count == 1)
}
if (types == null)
- return (MethodInfo) Binder.FindMostDerivedMatch (match);
+ return (MethodInfo) CheckMethodSecurity (Binder.FindMostDerivedMatch (match));
if (binder == null)
binder = Binder.DefaultBinder;
- return (MethodInfo)binder.SelectMethod (bindingAttr, match, types, modifiers);
+ return (MethodInfo) CheckMethodSecurity (binder.SelectMethod (bindingAttr, match, types, modifiers));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern MethodInfo GetCorrespondingInflatedMethod (MethodInfo generic);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern ConstructorInfo GetCorrespondingInflatedConstructor (ConstructorInfo generic);
+
+ internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
+ {
+ return GetCorrespondingInflatedMethod (fromNoninstanciated);
+ }
+
+ internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
+ {
+ return GetCorrespondingInflatedConstructor (fromNoninstanciated);
+ }
+
+ internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
+ {
+ return GetField (fromNoninstanciated.Name);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public override string AssemblyQualifiedName {
get {
- return getFullName (false) + ", " + Assembly.GetName ().ToString ();
+ return getFullName (true, true);
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern string getFullName(bool full_name);
+ private extern string getFullName(bool full_name, bool assembly_qualified);
public extern override Type BaseType {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public override string FullName {
get {
- return getFullName (false);
+ return getFullName (true, false);
}
}
public override string ToString()
{
- return getFullName (true);
+ return getFullName (false, false);
}
#if NET_2_0 || BOOTSTRAP_NET_2_0
get;
}
#endif
+
+ private MethodBase CheckMethodSecurity (MethodBase mb)
+ {
+ if (!SecurityManager.SecurityEnabled || (mb == null))
+ return mb;
+
+ // Sadly we have no way to know which kind of security action this is
+ // so we must do it the hard way. Actually this isn't so bad
+ // because we can skip the (mb.Attributes & MethodAttributes.HasSecurity)
+ // icall required (and do it ourselves)
+
+ // this (unlike the Invoke step) is _and stays_ a LinkDemand (caller)
+ return SecurityManager.ReflectedLinkDemandQuery (mb) ? mb : null;
+ }
}
}