public object FindObject(ICatalogCollection coll, object key)
        {
            ICatalogObject obj2      = (ICatalogObject)key;
            int            slot      = (int)obj2.GetValue("Index");
            ComMemberType  method    = ComMemberType.Method;
            MemberInfo     setMethod = Marshal.GetMethodInfoForComSlot(this._type, slot, ref method);

            if (setMethod is PropertyInfo)
            {
                switch (method)
                {
                case ComMemberType.PropSet:
                    setMethod = ((PropertyInfo)setMethod).GetSetMethod();
                    break;

                case ComMemberType.PropGet:
                    setMethod = ((PropertyInfo)setMethod).GetGetMethod();
                    break;
                }
            }
            if (this._map.InterfaceMethods != null)
            {
                for (int i = 0; i < this._map.InterfaceMethods.Length; i++)
                {
                    MethodInfo info2 = setMethod as MethodInfo;
                    if (this._map.InterfaceMethods[i] == info2)
                    {
                        return(this._map.TargetMethods[i]);
                    }
                }
            }
            return(setMethod);
        }
        private IMessage CrossCtxInvoke(IMessage reqMsg)
        {
            IMessage message = null;

            this.AssertValid();
            message = this.HandleDispose(reqMsg);
            if (message != null)
            {
                return(message);
            }
            message = this.HandleSetCOMIUnknown(reqMsg);
            if (message != null)
            {
                return(message);
            }
            message = this.HandleSpecialMethods(reqMsg);
            if (message != null)
            {
                return(message);
            }
            object     transparentProxy = this.GetTransparentProxy();
            MethodBase methodBase       = ((IMethodMessage)reqMsg).MethodBase;
            MemberInfo mi          = methodBase;
            MemberInfo mb          = mi;
            MemberInfo info3       = null;
            MemberInfo m           = ReflectionCache.ConvertToClassMI(base.GetProxiedType(), mi);
            bool       fIsAutoDone = false;
            int        num         = ServicedComponentInfo.MICachedLookup(m);

            if (reqMsg is IConstructionCallMessage)
            {
                ComMemberType method = ComMemberType.Method;
                mb = Marshal.GetMethodInfoForComSlot(typeof(IManagedObject), 3, ref method);
            }
            else
            {
                info3 = this.AliasCall(methodBase as MethodInfo);
                if (info3 != null)
                {
                    mb = info3;
                }
                else if (this._fUseIntfDispatch || ((num & 4) != 0))
                {
                    mb = ReflectionCache.ConvertToInterfaceMI(mi);
                    if (mb == null)
                    {
                        throw new ServicedComponentException(Resource.FormatString("ServicedComponentException_SecurityMapping"));
                    }
                }
                else
                {
                    fIsAutoDone = (num & 2) != 0;
                }
            }
            return(this._callback.DoCallback(transparentProxy, reqMsg, this._context, fIsAutoDone, mb, this._gitCookie != 0));
        }
Пример #3
0
            static KnownMethodSlots()
            {
                var iface     = typeof(ID3DXEffect);
                var firstSlot = Marshal.GetStartComSlot(iface);
                var lastSlot  = Marshal.GetEndComSlot(iface);

                for (var i = firstSlot; i <= lastSlot; i++)
                {
                    ComMemberType mt          = ComMemberType.Method;
                    var           mi          = Marshal.GetMethodInfoForComSlot(iface, i, ref mt);
                    var           targetField = typeof(KnownMethodSlots).GetField(mi.Name);
                    if (targetField == null)
                    {
                        continue;
                    }
                    targetField.SetValue(null, (uint)i);
                }
            }
        private MemberInfo AliasCall(MethodInfo mi)
        {
            if (mi == null)
            {
                return(null);
            }
            MethodInfo baseDefinition = mi.GetBaseDefinition();

            if (baseDefinition == _internalDeactivateMethod)
            {
                return(_getIDisposableDispose);
            }
            if ((!(baseDefinition == _initializeLifetimeServiceMethod) && !(baseDefinition == _getLifetimeServiceMethod)) && (!(baseDefinition == _getComIUnknownMethod) && !(baseDefinition == _setCOMIUnknownMethod)))
            {
                return(null);
            }
            ComMemberType method = ComMemberType.Method;

            return(Marshal.GetMethodInfoForComSlot(typeof(IManagedObject), 3, ref method));
        }
Пример #5
0
        public Object FindObject(ICatalogCollection coll, Object key)
        {
            ICatalogObject methObj = (ICatalogObject)key;
            int            slot    = (int)(methObj.GetValue("Index"));
            ComMemberType  mtype   = ComMemberType.Method;

            MemberInfo info = Marshal.GetMethodInfoForComSlot(_type, slot, ref mtype);

            DBG.Assert(info != null, "Failed to find method info for COM slot!");

            // Now we have the member info, look through the interface
            // mapping for this guy:
            if (info is PropertyInfo)
            {
                if (mtype == ComMemberType.PropSet)
                {
                    info = ((PropertyInfo)info).GetSetMethod();
                }
                else if (mtype == ComMemberType.PropGet)
                {
                    info = ((PropertyInfo)info).GetGetMethod();
                }
                else
                {
                    DBG.Assert(false, "Illegal ComMemberType returned");
                }
            }

            if (_map.InterfaceMethods != null)
            {
                for (int i = 0; i < _map.InterfaceMethods.Length; i++)
                {
                    if (_map.InterfaceMethods[i] == info)
                    {
                        return(_map.TargetMethods[i]);
                    }
                }
                DBG.Assert(false, "Had interface mapping, but found no method.");
            }
            return(info);
        }
Пример #6
0
 public static MemberInfo GetMethodInfoForComSlot(Type t, int slot, ref ComMemberType memberType)
 {
     throw new NotImplementedException();
 }
Пример #7
0
		public static MemberInfo GetMethodInfoForComSlot (Type t, int slot, ref ComMemberType memberType)
		{
			throw new NotImplementedException ();
		}
Пример #8
0
 public static System.Reflection.MemberInfo GetMethodInfoForComSlot(Type t, int slot, ComMemberType& memberType)
 {
 }
 public static MemberInfo GetMethodInfoForComSlot(Type t, int slot, ref ComMemberType memberType) {
 //
 // Summary:
 //     Converts an object to a COM VARIANT.
 //
 // Parameters:
 //   obj:
 //     The object for which to get a COM VARIANT.
 //
 //   pDstNativeVariant:
 //     An System.IntPtr to receive the VARIANT corresponding to the obj parameter.
 //
 // Exceptions:
 //   System.ArgumentException:
 //     The obj parameter is a generic type.
   return default(MemberInfo);
 }
 public static System.Reflection.MemberInfo GetMethodInfoForComSlot(Type t, int slot, ref ComMemberType memberType)
 {
     return(default(System.Reflection.MemberInfo));
 }
	public static System.Reflection.MemberInfo GetMethodInfoForComSlot(Type t, int slot, ComMemberType& memberType) {}
 public static System.Reflection.MemberInfo GetMethodInfoForComSlot(Type t, int slot, ref ComMemberType memberType)
 {
   return default(System.Reflection.MemberInfo);
 }