Ejemplo n.º 1
0
        public UnmanagedObjectProxy(Type oftype, string chURI, string objURI) : base(oftype)
        {
            m_Proxy        = (UnmanagedProxy)Activator.GetObject(typeof(UnmanagedProxy), chURI + "/" + objURI + "_LOCALPROXY");
            m_ProxySponsor = new UnmanagedProxySponsor();
            ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Proxy);

            lease.Register(m_ProxySponsor);
        }
Ejemplo n.º 2
0
 private UnmanagedObject(Type unmanagedinterface, IntPtr address)
 {
     addr       = address;
     LocalProxy = new UnmanagedProxy(unmanagedinterface, address, this);
 }
Ejemplo n.º 3
0
 public bool m_Hook_Call(Assembler.UnmanagedContext ctx, UnmanagedStack stck)
 {
     lock (m_Delegates)
     {
         bool retval = true;
         if (m_Delegates.Count > 0)
         {
             object[] parameters = new object[parinfo.Length];
             object[] attribs;
             uint     stckpos = 0;
             uint     i       = 0;
             foreach (ParameterInfo pi in parinfo)
             {
                 //marshal parameter here
                 if ((attribs = pi.GetCustomAttributes(typeof(UThisParAttribute), true)).Length > 0)
                 {
                     if ((attribs = pi.GetCustomAttributes(typeof(UParAttribute), true)).Length > 0)
                     {
                         UParAttribute upa = (UParAttribute)attribs[0];
                         parameters[i] = UnmanagedProxy.MarshalFromUnmanaged(ctx.ECX, upa.ReturnType, upa.SizeConstant, upa.KnownType);
                     }
                     else
                     {
                         parameters[i] = null;//can't marshal
                     }
                 }
                 else if ((attribs = pi.GetCustomAttributes(typeof(UParAttribute), true)).Length > 0)
                 {
                     UParAttribute upa = (UParAttribute)attribs[0];
                     parameters[i] = UnmanagedProxy.MarshalFromUnmanaged(stck[stckpos], upa.ReturnType, upa.SizeConstant, upa.KnownType);
                     stckpos++;
                 }
                 else
                 {
                     parameters[i] = null;//can't marshal
                 }
                 i++;
             }
             foreach (Delegate del in m_Delegates)
             {
                 try
                 {
                     if (Client.InvokationTarget != null)
                     {
                         if (Client.AsyncInvokation)
                         {
                             Client.InvokationTarget.BeginInvoke(del, parameters);
                         }
                         else
                         {
                             retval &= (bool)Client.InvokationTarget.Invoke(del, parameters);
                         }
                     }
                     else
                     {
                         retval &= (bool)del.DynamicInvoke(parameters);
                     }
                 }
                 catch
                 {
                     Remove(del);
                 }
             }
         }
         return(retval);
     }
 }