internal MethodCall(object handlerObject, BinaryMethodCallMessage smuggledMsg)
 {
     if (handlerObject != null)
     {
         this.uri = handlerObject as string;
         if (this.uri == null)
         {
             MarshalByRefObject obj2 = handlerObject as MarshalByRefObject;
             if (obj2 != null)
             {
                 bool flag;
                 this.srvID = MarshalByRefObject.GetIdentity(obj2, out flag) as ServerIdentity;
                 this.uri   = this.srvID.URI;
             }
         }
     }
     this.typeName        = smuggledMsg.TypeName;
     this.methodName      = smuggledMsg.MethodName;
     this.methodSignature = (Type[])smuggledMsg.MethodSignature;
     this.args            = smuggledMsg.Args;
     this.instArgs        = smuggledMsg.InstantiationArgs;
     this.callContext     = smuggledMsg.LogicalCallContext;
     this.ResolveMethod();
     if (smuggledMsg.HasProperties)
     {
         smuggledMsg.PopulateMessageProperties(this.Properties);
     }
 }
Exemple #2
0
 internal MethodResponse(IMethodCallMessage msg, object handlerObject, BinaryMethodReturnMessage smuggledMrm)
 {
     if (msg != null)
     {
         this.MI           = msg.MethodBase;
         this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
         this.methodName   = msg.MethodName;
         this.uri          = msg.Uri;
         this.typeName     = msg.TypeName;
         if (this._methodCache.IsOverloaded())
         {
             this.methodSignature = (Type[])msg.MethodSignature;
         }
         this.argCount = this._methodCache.Parameters.Length;
     }
     this.retVal      = smuggledMrm.ReturnValue;
     this.outArgs     = smuggledMrm.Args;
     this.fault       = smuggledMrm.Exception;
     this.callContext = smuggledMrm.LogicalCallContext;
     if (smuggledMrm.HasProperties)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties);
     }
     this.fSoap = false;
 }
Exemple #3
0
 internal System.Runtime.Remoting.Messaging.LogicalCallContext GetLogicalCallContext()
 {
     if (this.callContext == null)
     {
         this.callContext = new System.Runtime.Remoting.Messaging.LogicalCallContext();
     }
     return(this.callContext);
 }
Exemple #4
0
 public ReturnMessage(System.Exception e, IMethodCallMessage mcm)
 {
     this._e           = IsCustomErrorEnabled() ? new RemotingException(Environment.GetResourceString("Remoting_InternalError")) : e;
     this._callContext = CallContext.GetLogicalCallContext();
     if (mcm != null)
     {
         this._URI             = mcm.Uri;
         this._methodName      = mcm.MethodName;
         this._methodSignature = null;
         this._typeName        = mcm.TypeName;
         this._hasVarArgs      = mcm.HasVarArgs;
         this._methodBase      = mcm.MethodBase;
     }
 }
 internal MethodCall(SmuggledMethodCallMessage smuggledMsg, ArrayList deserializedArgs)
 {
     this.uri             = smuggledMsg.Uri;
     this.typeName        = smuggledMsg.TypeName;
     this.methodName      = smuggledMsg.MethodName;
     this.methodSignature = (Type[])smuggledMsg.GetMethodSignature(deserializedArgs);
     this.args            = smuggledMsg.GetArgs(deserializedArgs);
     this.instArgs        = smuggledMsg.GetInstantiation(deserializedArgs);
     this.callContext     = smuggledMsg.GetCallContext(deserializedArgs);
     this.ResolveMethod();
     if (smuggledMsg.MessagePropertyCount > 0)
     {
         smuggledMsg.PopulateMessageProperties(this.Properties, deserializedArgs);
     }
 }
Exemple #6
0
 /// <summary>
 /// Configura a thread;
 /// </summary>
 /// <param name="contextThread"></param>
 private bool ConfigureThread(System.Threading.Thread contextThread)
 {
     if (contextThread.ExecutionContext != null)
     {
         var setPrincipalInternalMethod = typeof(System.Threading.Thread).GetMethod("SetPrincipalInternal", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
         if (setPrincipalInternalMethod != null)
         {
             try
             {
                 setPrincipalInternalMethod.Invoke(contextThread, new object[] {
                     _principal
                 });
                 return(true);
             }
             catch
             {
             }
         }
         var getLogicalCallContextMethod = typeof(System.Threading.Thread).GetMethod("GetLogicalCallContext", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
         if (getLogicalCallContextMethod == null)
         {
             return(false);
         }
         System.Runtime.Remoting.Messaging.LogicalCallContext callContext = null;
         try
         {
             callContext = (System.Runtime.Remoting.Messaging.LogicalCallContext)getLogicalCallContextMethod.Invoke(contextThread, null);
         }
         catch
         {
             return(false);
         }
         if (callContext != null)
         {
             var principalProperty = typeof(System.Runtime.Remoting.Messaging.LogicalCallContext).GetProperty("Principal", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
             if (principalProperty == null)
             {
                 throw new InvalidOperationException("PrincipalProperty not found");
             }
             if (callContext == null)
             {
                 throw new InvalidOperationException("callContext undefined");
             }
             principalProperty.SetValue(callContext, _principal, null);
         }
     }
     return(true);
 }
Exemple #7
0
 internal void FillHeader(string name, object value)
 {
     if (name.Equals("__MethodName"))
     {
         this.methodName = (string)value;
     }
     else if (name.Equals("__Uri"))
     {
         this.uri = (string)value;
     }
     else if (name.Equals("__MethodSignature"))
     {
         this.methodSignature = (Type[])value;
     }
     else if (name.Equals("__TypeName"))
     {
         this.typeName = (string)value;
     }
     else if (name.Equals("__OutArgs"))
     {
         this.outArgs = (object[])value;
     }
     else if (name.Equals("__CallContext"))
     {
         if (value is string)
         {
             this.callContext = new System.Runtime.Remoting.Messaging.LogicalCallContext();
             this.callContext.RemotingData.LogicalCallID = (string)value;
         }
         else
         {
             this.callContext = (System.Runtime.Remoting.Messaging.LogicalCallContext)value;
         }
     }
     else if (name.Equals("__Return"))
     {
         this.retVal = value;
     }
     else
     {
         if (this.InternalProperties == null)
         {
             this.InternalProperties = new Hashtable();
         }
         this.InternalProperties[name] = value;
     }
 }
 internal virtual bool FillSpecialHeader(string key, object value)
 {
     if (key != null)
     {
         if (key.Equals("__Uri"))
         {
             this.uri = (string)value;
         }
         else if (key.Equals("__MethodName"))
         {
             this.methodName = (string)value;
         }
         else if (key.Equals("__MethodSignature"))
         {
             this.methodSignature = (Type[])value;
         }
         else if (key.Equals("__TypeName"))
         {
             this.typeName = (string)value;
         }
         else if (key.Equals("__Args"))
         {
             this.args = (object[])value;
         }
         else
         {
             if (!key.Equals("__CallContext"))
             {
                 return(false);
             }
             if (value is string)
             {
                 this.callContext = new System.Runtime.Remoting.Messaging.LogicalCallContext();
                 this.callContext.RemotingData.LogicalCallID = (string)value;
             }
             else
             {
                 this.callContext = (System.Runtime.Remoting.Messaging.LogicalCallContext)value;
             }
         }
     }
     return(true);
 }
Exemple #9
0
 internal void InitFields(MessageData msgData)
 {
     this._frame           = msgData.pFrame;
     this._delegateMD      = msgData.pDelegateMD;
     this._methodDesc      = msgData.pMethodDesc;
     this._flags           = msgData.iFlags;
     this._initDone        = true;
     this._metaSigHolder   = msgData.pSig;
     this._governingType   = msgData.thGoverningType;
     this._MethodName      = null;
     this._MethodSignature = null;
     this._MethodBase      = null;
     this._URI             = null;
     this._Fault           = null;
     this._ID          = null;
     this._srvID       = null;
     this._callContext = null;
     if (this._properties != null)
     {
         ((IDictionary)this._properties).Clear();
     }
 }
Exemple #10
0
 internal MethodResponse(IMethodCallMessage msg, SmuggledMethodReturnMessage smuggledMrm, ArrayList deserializedArgs)
 {
     this.MI           = msg.MethodBase;
     this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
     this.methodName   = msg.MethodName;
     this.uri          = msg.Uri;
     this.typeName     = msg.TypeName;
     if (this._methodCache.IsOverloaded())
     {
         this.methodSignature = (Type[])msg.MethodSignature;
     }
     this.retVal      = smuggledMrm.GetReturnValue(deserializedArgs);
     this.outArgs     = smuggledMrm.GetArgs(deserializedArgs);
     this.fault       = smuggledMrm.GetException(deserializedArgs);
     this.callContext = smuggledMrm.GetCallContext(deserializedArgs);
     if (smuggledMrm.MessagePropertyCount > 0)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties, deserializedArgs);
     }
     this.argCount = this._methodCache.Parameters.Length;
     this.fSoap    = false;
 }
Exemple #11
0
 public ReturnMessage(object ret, object[] outArgs, int outArgsCount, System.Runtime.Remoting.Messaging.LogicalCallContext callCtx, IMethodCallMessage mcm)
 {
     this._ret          = ret;
     this._outArgs      = outArgs;
     this._outArgsCount = outArgsCount;
     if (callCtx != null)
     {
         this._callContext = callCtx;
     }
     else
     {
         this._callContext = CallContext.GetLogicalCallContext();
     }
     if (mcm != null)
     {
         this._URI             = mcm.Uri;
         this._methodName      = mcm.MethodName;
         this._methodSignature = null;
         this._typeName        = mcm.TypeName;
         this._hasVarArgs      = mcm.HasVarArgs;
         this._methodBase      = mcm.MethodBase;
     }
 }
 internal System.Runtime.Remoting.Messaging.LogicalCallContext SetLogicalCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext ctx)
 {
     if (this._message == null)
     {
         throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_InternalState"));
     }
     return(this._message.SetLogicalCallContext(ctx));
 }
 internal MethodResponse(IMethodCallMessage msg, SmuggledMethodReturnMessage smuggledMrm, ArrayList deserializedArgs)
 {
     this.MI = msg.MethodBase;
     this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
     this.methodName = msg.MethodName;
     this.uri = msg.Uri;
     this.typeName = msg.TypeName;
     if (this._methodCache.IsOverloaded())
     {
         this.methodSignature = (Type[]) msg.MethodSignature;
     }
     this.retVal = smuggledMrm.GetReturnValue(deserializedArgs);
     this.outArgs = smuggledMrm.GetArgs(deserializedArgs);
     this.fault = smuggledMrm.GetException(deserializedArgs);
     this.callContext = smuggledMrm.GetCallContext(deserializedArgs);
     if (smuggledMrm.MessagePropertyCount > 0)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties, deserializedArgs);
     }
     this.argCount = this._methodCache.Parameters.Length;
     this.fSoap = false;
 }
 void IInternalMessage.SetCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext newCallContext)
 {
     this.callContext = newCallContext;
 }
 internal MethodCall(SmuggledMethodCallMessage smuggledMsg, ArrayList deserializedArgs)
 {
     this.uri = smuggledMsg.Uri;
     this.typeName = smuggledMsg.TypeName;
     this.methodName = smuggledMsg.MethodName;
     this.methodSignature = (Type[]) smuggledMsg.GetMethodSignature(deserializedArgs);
     this.args = smuggledMsg.GetArgs(deserializedArgs);
     this.instArgs = smuggledMsg.GetInstantiation(deserializedArgs);
     this.callContext = smuggledMsg.GetCallContext(deserializedArgs);
     this.ResolveMethod();
     if (smuggledMsg.MessagePropertyCount > 0)
     {
         smuggledMsg.PopulateMessageProperties(this.Properties, deserializedArgs);
     }
 }
 internal MethodCall(object handlerObject, BinaryMethodCallMessage smuggledMsg)
 {
     if (handlerObject != null)
     {
         this.uri = handlerObject as string;
         if (this.uri == null)
         {
             MarshalByRefObject obj2 = handlerObject as MarshalByRefObject;
             if (obj2 != null)
             {
                 bool flag;
                 this.srvID = MarshalByRefObject.GetIdentity(obj2, out flag) as ServerIdentity;
                 this.uri = this.srvID.URI;
             }
         }
     }
     this.typeName = smuggledMsg.TypeName;
     this.methodName = smuggledMsg.MethodName;
     this.methodSignature = (Type[]) smuggledMsg.MethodSignature;
     this.args = smuggledMsg.Args;
     this.instArgs = smuggledMsg.InstantiationArgs;
     this.callContext = smuggledMsg.LogicalCallContext;
     this.ResolveMethod();
     if (smuggledMsg.HasProperties)
     {
         smuggledMsg.PopulateMessageProperties(this.Properties);
     }
 }
Exemple #17
0
 internal static void PropagateCallContextFromThreadToMessage(IMessage msg)
 {
     System.Runtime.Remoting.Messaging.LogicalCallContext logicalCallContext = CallContext.GetLogicalCallContext();
     msg.Properties[CallContextKey] = logicalCallContext;
 }
Exemple #18
0
 void IInternalMessage.SetCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext callContext)
 {
     this._callContext = callContext;
 }
 internal void FillHeader(string name, object value)
 {
     if (name.Equals("__MethodName"))
     {
         this.methodName = (string) value;
     }
     else if (name.Equals("__Uri"))
     {
         this.uri = (string) value;
     }
     else if (name.Equals("__MethodSignature"))
     {
         this.methodSignature = (Type[]) value;
     }
     else if (name.Equals("__TypeName"))
     {
         this.typeName = (string) value;
     }
     else if (name.Equals("__OutArgs"))
     {
         this.outArgs = (object[]) value;
     }
     else if (name.Equals("__CallContext"))
     {
         if (value is string)
         {
             this.callContext = new System.Runtime.Remoting.Messaging.LogicalCallContext();
             this.callContext.RemotingData.LogicalCallID = (string) value;
         }
         else
         {
             this.callContext = (System.Runtime.Remoting.Messaging.LogicalCallContext) value;
         }
     }
     else if (name.Equals("__Return"))
     {
         this.retVal = value;
     }
     else
     {
         if (this.InternalProperties == null)
         {
             this.InternalProperties = new Hashtable();
         }
         this.InternalProperties[name] = value;
     }
 }
 internal MethodResponse(IMethodCallMessage msg, object handlerObject, BinaryMethodReturnMessage smuggledMrm)
 {
     if (msg != null)
     {
         this.MI = msg.MethodBase;
         this._methodCache = InternalRemotingServices.GetReflectionCachedData(this.MI);
         this.methodName = msg.MethodName;
         this.uri = msg.Uri;
         this.typeName = msg.TypeName;
         if (this._methodCache.IsOverloaded())
         {
             this.methodSignature = (Type[]) msg.MethodSignature;
         }
         this.argCount = this._methodCache.Parameters.Length;
     }
     this.retVal = smuggledMrm.ReturnValue;
     this.outArgs = smuggledMrm.Args;
     this.fault = smuggledMrm.Exception;
     this.callContext = smuggledMrm.LogicalCallContext;
     if (smuggledMrm.HasProperties)
     {
         smuggledMrm.PopulateMessageProperties(this.Properties);
     }
     this.fSoap = false;
 }
Exemple #21
0
 internal System.Runtime.Remoting.Messaging.LogicalCallContext SetLogicalCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext ctx)
 {
     System.Runtime.Remoting.Messaging.LogicalCallContext callContext = this.callContext;
     this.callContext = ctx;
     return(callContext);
 }
 internal System.Runtime.Remoting.Messaging.LogicalCallContext SetLogicalCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext callCtx)
 {
     return(this._m.SetLogicalCallContext(callCtx));
 }
 internal virtual bool FillSpecialHeader(string key, object value)
 {
     if (key != null)
     {
         if (key.Equals("__Uri"))
         {
             this.uri = (string) value;
         }
         else if (key.Equals("__MethodName"))
         {
             this.methodName = (string) value;
         }
         else if (key.Equals("__MethodSignature"))
         {
             this.methodSignature = (Type[]) value;
         }
         else if (key.Equals("__TypeName"))
         {
             this.typeName = (string) value;
         }
         else if (key.Equals("__Args"))
         {
             this.args = (object[]) value;
         }
         else
         {
             if (!key.Equals("__CallContext"))
             {
                 return false;
             }
             if (value is string)
             {
                 this.callContext = new System.Runtime.Remoting.Messaging.LogicalCallContext();
                 this.callContext.RemotingData.LogicalCallID = (string) value;
             }
             else
             {
                 this.callContext = (System.Runtime.Remoting.Messaging.LogicalCallContext) value;
             }
         }
     }
     return true;
 }
Exemple #24
0
 internal static void PropagateCallContextFromThreadToMessage(IMessage msg, System.Runtime.Remoting.Messaging.LogicalCallContext oldcctx)
 {
     PropagateCallContextFromThreadToMessage(msg);
     CallContext.SetLogicalCallContext(oldcctx);
 }
 internal System.Runtime.Remoting.Messaging.LogicalCallContext GetLogicalCallContext()
 {
     if (this.callContext == null)
     {
         this.callContext = new System.Runtime.Remoting.Messaging.LogicalCallContext();
     }
     return this.callContext;
 }
 internal System.Runtime.Remoting.Messaging.LogicalCallContext SetLogicalCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext ctx)
 {
     System.Runtime.Remoting.Messaging.LogicalCallContext callContext = this.callContext;
     this.callContext = ctx;
     return callContext;
 }
 void IInternalMessage.SetCallContext(System.Runtime.Remoting.Messaging.LogicalCallContext newCallContext)
 {
     this._m.SetLogicalCallContext(newCallContext);
 }
 internal void InitFields(MessageData msgData)
 {
     this._frame = msgData.pFrame;
     this._delegateMD = msgData.pDelegateMD;
     this._methodDesc = msgData.pMethodDesc;
     this._flags = msgData.iFlags;
     this._initDone = true;
     this._metaSigHolder = msgData.pSig;
     this._governingType = msgData.thGoverningType;
     this._MethodName = null;
     this._MethodSignature = null;
     this._MethodBase = null;
     this._URI = null;
     this._Fault = null;
     this._ID = null;
     this._srvID = null;
     this._callContext = null;
     if (this._properties != null)
     {
         ((IDictionary) this._properties).Clear();
     }
 }