コード例 #1
0
        // Token: 0x060057D9 RID: 22489 RVA: 0x00134CD8 File Offset: 0x00132ED8
        internal bool IsNestedCall(IMessage reqMsg)
        {
            bool flag = false;

            if (!this.IsReEntrant)
            {
                string syncCallOutLCID = this.SyncCallOutLCID;
                if (syncCallOutLCID != null)
                {
                    LogicalCallContext logicalCallContext = (LogicalCallContext)reqMsg.Properties[Message.CallContextKey];
                    if (logicalCallContext != null && syncCallOutLCID.Equals(logicalCallContext.RemotingData.LogicalCallID))
                    {
                        flag = true;
                    }
                }
                if (!flag && this.AsyncCallOutLCIDList.Count > 0)
                {
                    LogicalCallContext logicalCallContext2 = (LogicalCallContext)reqMsg.Properties[Message.CallContextKey];
                    if (this.AsyncCallOutLCIDList.Contains(logicalCallContext2.RemotingData.LogicalCallID))
                    {
                        flag = true;
                    }
                }
            }
            return(flag);
        }
コード例 #2
0
        void SetCallContextInMessage(
            IMessage reqMsg, int msgFlags, LogicalCallContext cctx)
        {
            BCLDebug.Assert(msgFlags != -1, "Unexpected msgFlags?");
            Message msg = reqMsg as Message;

            switch (msgFlags)
            {
            case Message.Sync:
                if (msg != null)
                {
                    msg.SetLogicalCallContext(cctx);
                }
                else
                {
                    ((ConstructorCallMessage)reqMsg).SetLogicalCallContext(cctx);
                }
                break;

                /* FUTURE: this code is currently in RemotingProxy.. should
                 * disable it there and enable this when we allow extensible proxies
                 * to handle Async calls etc
                 *
                 * case Message.BeginAsync:
                 * case Message.BeginAsync | Message.OneWay:
                 * case Message.OneWay:
                 *  // All these should be of type Message
                 *  BCLDebug.Assert(msg != null,"bad one-way/async message?");
                 *  // Clone the callcontext (NOTE: we do not do a deep copy)
                 *  LogicalCallContext cloneCtx = (LogicalCallContext) cctx.Clone();
                 *  msg.SetLogicalCallContext(cloneCtx);
                 *  break;
                 */
            }
        }
コード例 #3
0
ファイル: Thread.cs プロジェクト: randomize/VimConfig
        internal LogicalCallContext SetLogicalCallContext(LogicalCallContext callCtx)
        {
            LogicalCallContext logicalCallContext = this.ExecutionContext.LogicalCallContext;

            this.ExecutionContext.LogicalCallContext = callCtx;
            return(logicalCallContext);
        }
コード例 #4
0
 private void ReturnCallContextToThread(Thread currentThread, IMessage retMsg, int msgFlags, LogicalCallContext currCtx)
 {
     if (msgFlags == 0)
     {
         if (retMsg == null)
         {
             return;
         }
         IMethodReturnMessage methodReturnMessage = retMsg as IMethodReturnMessage;
         if (methodReturnMessage == null)
         {
             return;
         }
         LogicalCallContext logicalCallContext = methodReturnMessage.LogicalCallContext;
         if (logicalCallContext == null)
         {
             currentThread.GetMutableExecutionContext().LogicalCallContext = currCtx;
             return;
         }
         if (!(methodReturnMessage is StackBasedReturnMessage))
         {
             ExecutionContext   mutableExecutionContext = currentThread.GetMutableExecutionContext();
             LogicalCallContext logicalCallContext2     = mutableExecutionContext.LogicalCallContext;
             mutableExecutionContext.LogicalCallContext = logicalCallContext;
             if (logicalCallContext2 != logicalCallContext)
             {
                 IPrincipal principal = logicalCallContext2.Principal;
                 if (principal != null)
                 {
                     logicalCallContext.Principal = principal;
                 }
             }
         }
     }
 }
コード例 #5
0
        private object[] WriteMethodReturn(IMethodReturnMessage mrm)
        {
            object logicalCallID;
            object returnValue = mrm.ReturnValue;

            object[]  args      = mrm.Args;
            Exception exception = mrm.Exception;

            object[]      properties = null;
            ReturnMessage message    = mrm as ReturnMessage;

            if ((message == null) || message.HasProperties())
            {
                properties = StoreUserPropertiesForMethodMessage(mrm);
            }
            LogicalCallContext logicalCallContext = mrm.LogicalCallContext;

            if (logicalCallContext == null)
            {
                logicalCallID = null;
            }
            else if (logicalCallContext.HasInfo)
            {
                logicalCallID = logicalCallContext;
            }
            else
            {
                logicalCallID = logicalCallContext.RemotingData.LogicalCallID;
            }
            return(this.serWriter.WriteReturnArray(returnValue, args, exception, logicalCallID, properties));
        }
コード例 #6
0
        private object[] WriteMethodCall(IMethodCallMessage mcm)
        {
            string uri             = mcm.Uri;
            string methodName      = mcm.MethodName;
            string typeName        = mcm.TypeName;
            object methodSignature = (object)null;

            object[] properties = (object[])null;
            Type[]   instArgs   = (Type[])null;
            if (mcm.MethodBase.IsGenericMethod)
            {
                instArgs = mcm.MethodBase.GetGenericArguments();
            }
            object[]         args            = mcm.Args;
            IInternalMessage internalMessage = mcm as IInternalMessage;

            if (internalMessage == null || internalMessage.HasProperties())
            {
                properties = ObjectWriter.StoreUserPropertiesForMethodMessage((IMethodMessage)mcm);
            }
            if (mcm.MethodSignature != null && RemotingServices.IsMethodOverloaded((IMethodMessage)mcm))
            {
                methodSignature = mcm.MethodSignature;
            }
            LogicalCallContext logicalCallContext = mcm.LogicalCallContext;
            object             callContext        = logicalCallContext != null ? (!logicalCallContext.HasInfo ? (object)logicalCallContext.RemotingData.LogicalCallID : (object)logicalCallContext) : (object)null;

            return(this.serWriter.WriteCallArray(uri, methodName, typeName, instArgs, args, methodSignature, callContext, properties));
        }
コード例 #7
0
        public void ServerCallback(IAsyncResult ar)
        {
            if (!(this._asyncEnd != (MethodInfo)null))
            {
                return;
            }
            RemotingMethodCachedData reflectionCachedData1 = InternalRemotingServices.GetReflectionCachedData((MethodBase)this._asyncEnd);
            RemotingMethodCachedData reflectionCachedData2 = InternalRemotingServices.GetReflectionCachedData(this._msg.MethodBase);

            ParameterInfo[] parameters = reflectionCachedData1.Parameters;
            object[]        objArray   = new object[parameters.Length];
            objArray[parameters.Length - 1] = (object)ar;
            object[] args = this._msg.Args;
            AsyncMessageHelper.GetOutArgs(reflectionCachedData2.Parameters, args, objArray);
            StackBuilderSink stackBuilderSink = new StackBuilderSink(this._serverObject);

            object[] outArgs1;
            object   ret = stackBuilderSink.PrivateProcessMessage(this._asyncEnd.MethodHandle, Message.CoerceArgs((MethodBase)this._asyncEnd, objArray, parameters), this._serverObject, out outArgs1);

            if (outArgs1 != null)
            {
                outArgs1 = ArgMapper.ExpandAsyncEndArgsToSyncArgs(reflectionCachedData2, outArgs1);
            }
            stackBuilderSink.CopyNonByrefOutArgsFromOriginalArgs(reflectionCachedData2, args, ref outArgs1);
            object[]           outArgs2           = outArgs1;
            int                argCount           = this._msg.ArgCount;
            LogicalCallContext logicalCallContext = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;
            IMethodCallMessage mcm = this._msg;

            this.AsyncProcessResponse((IMessage) new ReturnMessage(ret, outArgs2, argCount, logicalCallContext, mcm), (ITransportHeaders)null, (Stream)null);
        }
コード例 #8
0
            public override IMessage Invoke(IMessage msg)
            {
                IMethodCallMessage mcm = msg as IMethodCallMessage;

                this.callContext = mcm.LogicalCallContext.Clone() as LogicalCallContext;
                return(new ReturnMessage(null, null, 0, mcm.LogicalCallContext, mcm));
            }
コード例 #9
0
        [System.Security.SecurityCritical]  // auto-generated
        internal BinaryMethodCallMessage(String uri, String methodName, String typeName, Type[] instArgs, Object[] args, Object methodSignature, LogicalCallContext callContext, Object[] properties)
        {
            _methodName = methodName;
            _typeName   = typeName;
            //_uri = uri;
            if (args == null)
            {
                args = new Object[0];
            }

            _inargs          = args;
            _args            = args;
            _instArgs        = instArgs;
            _methodSignature = methodSignature;
            if (callContext == null)
            {
                _logicalCallContext = new LogicalCallContext();
            }
            else
            {
                _logicalCallContext = callContext;
            }

            _properties = properties;
        }
コード例 #10
0
        /*
         *   Execute is called to complete a work item (sync or async).
         *   Execute assumes that the context is set correctly and the lock
         *   is taken (i.e. it makes no policy decisions)
         *
         *   It is called from the following 3 points:
         *       1. thread pool thread executing the callback for an async item
         *       2. calling thread executing the callback for a queued sync item
         *       3. calling thread directly calling Execute for a non-queued sync item
         */
        internal virtual void Execute()
        {
            // Execute should be called with the domain policy enforced
            // i.e. a Synchronization domain should be locked etc ...
            BCLDebug.Assert(IsSignaled(), "IsSignaled()");
            ContextTransitionFrame frame = new ContextTransitionFrame();

            Thread.CurrentThread.EnterContext(_ctx, ref frame);

            LogicalCallContext oldCallCtx = CallContext.SetLogicalCallContext(_callCtx);

            if (IsAsync())
            {
                //DBGConsole.WriteLine(Thread.CurrentThread.GetHashCode()+"] AsyncWork.Execute");
                _nextSink.AsyncProcessMessage(_reqMsg, _replySink);
            }
            else if (_nextSink != null)
            {
                //DBGConsole.WriteLine(Thread.CurrentThread.GetHashCode()+"] SyncWork.Execute");
                _replyMsg = _nextSink.SyncProcessMessage(_reqMsg);
            }
            CallContext.SetLogicalCallContext(oldCallCtx);

            Thread.CurrentThread.ReturnToContext(ref frame);
        }
コード例 #11
0
 public void Read(__BinaryParser input)
 {
     this.messageEnum = (MessageEnum)input.ReadInt32();
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.NoReturnValue))
     {
         this.returnValue = null;
     }
     else if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueVoid))
     {
         this.returnValue = instanceOfVoid;
     }
     else if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInline))
     {
         this.returnValue = IOUtil.ReadWithCode(input);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         this.scallContext = (string)IOUtil.ReadWithCode(input);
         LogicalCallContext context = new LogicalCallContext {
             RemotingData = { LogicalCallID = this.scallContext }
         };
         this.callContext = context;
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         this.args = IOUtil.ReadArgs(input);
     }
 }
コード例 #12
0
        internal void SerializeRequestArgs(string idlMethodName, object[] arguments,
                                           CdrOutputStream targetStream, LogicalCallContext context)
        {
            ArgumentsMapping mapping = GetArgumentsMapping(idlMethodName);

            mapping.SerializeRequestArgs(arguments, targetStream, context, m_contextElementSer);
        }
コード例 #13
0
 private void ReturnCallContextToThread(Thread currentThread, IMessage retMsg, int msgFlags, LogicalCallContext currCtx)
 {
     if ((msgFlags == 0) && (retMsg != null))
     {
         IMethodReturnMessage message = retMsg as IMethodReturnMessage;
         if (message != null)
         {
             LogicalCallContext logicalCallContext = message.LogicalCallContext;
             if (logicalCallContext == null)
             {
                 currentThread.SetLogicalCallContext(currCtx);
             }
             else if (!(message is StackBasedReturnMessage))
             {
                 LogicalCallContext context2 = currentThread.SetLogicalCallContext(logicalCallContext);
                 if (context2 != logicalCallContext)
                 {
                     IPrincipal principal = context2.Principal;
                     if (principal != null)
                     {
                         logicalCallContext.Principal = principal;
                     }
                 }
             }
         }
     }
 }
コード例 #14
0
 internal ADAsyncWorkItem(IMessage reqMsg, IMessageSink nextSink, IMessageSink replySink)
 {
     _reqMsg    = reqMsg;
     _nextSink  = nextSink;
     _replySink = replySink;
     _callCtx   = CallContext.GetLogicalCallContext();
 }
コード例 #15
0
 private void SerializeContextElements(CdrOutputStream targetStream,
                                       LogicalCallContext callContext,
                                       Serializer contextElementSer)
 {
     // if no context elements specified, don't serialise a context sequence.
     if (m_contextElementKeys.Length > 0)
     {
         string[] contextSeq = new string[m_contextElementKeys.Length * 2];
         for (int i = 0; i < m_contextElementKeys.Length; i++)
         {
             string contextKey =
                 m_contextElementKeys[i];
             contextSeq[i * 2] = contextKey;
             if (callContext.GetData(contextKey) != null)
             {
                 contextSeq[i * 2 + 1] = callContext.GetData(contextKey).ToString();
             }
             else
             {
                 contextSeq[i * 2 + 1] = "";
             }
         }
         contextElementSer.Serialize(contextSeq, targetStream);
     }
 }
コード例 #16
0
            public override System.Runtime.Remoting.Messaging.IMessage Invoke(System.Runtime.Remoting.Messaging.IMessage msg)
            {
                IMethodCallMessage methodCallMessage = msg as IMethodCallMessage;

                this.callContext = methodCallMessage.LogicalCallContext.Clone() as LogicalCallContext;
                return(new ReturnMessage(null, null, 0, methodCallMessage.LogicalCallContext, methodCallMessage));
            }
コード例 #17
0
 [System.Security.SecurityCritical]  // auto-generated
 internal ADAsyncWorkItem(IMessage reqMsg, IMessageSink nextSink, IMessageSink replySink)
 {
     _reqMsg    = reqMsg;
     _nextSink  = nextSink;
     _replySink = replySink;
     _callCtx   = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;
 }
コード例 #18
0
        public ExecutionContext CreateCopy()
        {
            if (!isNewCapture)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotCopyUsedContext"));
            }
            ExecutionContext ec = new ExecutionContext();

            ec.isNewCapture = true;
            ec._syncContext = _syncContext == null ? null : _syncContext.CreateCopy();
            // capture the host execution context
            ec._hostExecutionContext = _hostExecutionContext == null ? null : _hostExecutionContext.CreateCopy();
            if (_securityContext != null)
            {
                ec._securityContext = _securityContext.CreateCopy();
                ec._securityContext.ExecutionContext = ec;
            }
            if (this._logicalCallContext != null)
            {
                LogicalCallContext lc = (LogicalCallContext)this.LogicalCallContext;
                ec.LogicalCallContext = (LogicalCallContext)lc.Clone();
            }
            if (this._illogicalCallContext != null)
            {
                IllogicalCallContext ilcc = (IllogicalCallContext)this.IllogicalCallContext;
                ec.IllogicalCallContext = (IllogicalCallContext)ilcc.Clone();
            }

            return(ec);
        }
コード例 #19
0
        /* package */
        internal virtual void FinishAsyncWork(Object stateIgnored)
        {
            // set to the server context
            ContextTransitionFrame frame = new ContextTransitionFrame();
            Context srvCtx = _srvID.ServerContext;

            Thread.CurrentThread.EnterContext(srvCtx, ref frame);

            LogicalCallContext threadPoolCallCtx =
                CallContext.SetLogicalCallContext(_callCtx);

            // Call the server context chain Async. We provide workItem as our
            // replySink ... this will cause the replySink.ProcessMessage
            // to switch back to the context of the original caller thread.

            // Call the dynamic sinks to notify that the async call
            // is starting
            srvCtx.NotifyDynamicSinks(
                _reqMsg,
                false,  // bCliSide
                true,   // bStart
                true,   // bAsync
                true);  // bNotifyGlobals

            IMessageCtrl ctrl =
                srvCtx.GetServerContextChain().AsyncProcessMessage(
                    _reqMsg,
                    (IMessageSink)this);

            // change back to the old context
            CallContext.SetLogicalCallContext(threadPoolCallCtx);
            Thread.CurrentThread.ReturnToContext(ref frame);
        }
コード例 #20
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static Object FinishAsyncWorkCallback(Object[] args)
        {
            AsyncWorkItem This   = (AsyncWorkItem)args[0];
            Context       srvCtx = This._srvID.ServerContext;

            LogicalCallContext threadPoolCallCtx =
                CallContext.SetLogicalCallContext(This._callCtx);

            // Call the server context chain Async. We provide workItem as our
            // replySink ... this will cause the replySink.ProcessMessage
            // to switch back to the context of the original caller thread.

            // Call the dynamic sinks to notify that the async call
            // is starting
            srvCtx.NotifyDynamicSinks(
                This._reqMsg,
                false,  // bCliSide
                true,   // bStart
                true,   // bAsync
                true);  // bNotifyGlobals

            // <

            IMessageCtrl ctrl =
                srvCtx.GetServerContextChain().AsyncProcessMessage(
                    This._reqMsg,
                    (IMessageSink)This);

            // change back to the old context
            CallContext.SetLogicalCallContext(threadPoolCallCtx);

            return(null);
        }
コード例 #21
0
        /// <summary>
        /// process message
        /// </summary>
        public IMessage SyncProcessMessage(IMessage msg)
        {
            if (msg.Properties["__Uri"] == null)
            {
                return(this.nextSink.SyncProcessMessage(msg));
            }
            else
            {
                LogicalCallContext callContext = (LogicalCallContext)msg.Properties["__CallContext"];

                if ((callContext.GetData("__ClientID") != null) && (callContext.GetData("__ServiceID") != null))
                {
                    string clientID  = (string)callContext.GetData("__ClientID");
                    string serviceID = (string)callContext.GetData("__ServiceID");

                    if (TLogging.DebugLevel >= 10)
                    {
                        TLogging.Log("SyncProcessMessage: " + clientID + " " + serviceID);
                    }

                    return(TCrossDomainMarshaller.GetService(clientID, serviceID).Marshal(msg));
                }
                else
                {
                    // TLogging.Log("SyncProcessMessage: No __ClientID or __ServiceID");
                    return(new ReturnMessage(
                               new EOPAppException("No __ClientID or __ServiceID"),
                               (IMethodCallMessage)msg));
                }
            }
        }
コード例 #22
0
        private SmuggledMethodCallMessage(IMethodCallMessage mcm)
        {
            this._uri        = mcm.Uri;
            this._methodName = mcm.MethodName;
            this._typeName   = mcm.TypeName;
            ArrayList argsToSerialize = (ArrayList)null;

            if (!(mcm is IInternalMessage internalMessage) || internalMessage.HasProperties())
            {
                this._propertyCount = MessageSmuggler.StoreUserPropertiesForMethodMessage((IMethodMessage)mcm, ref argsToSerialize);
            }
            if (mcm.MethodBase.IsGenericMethod)
            {
                Type[] genericArguments = mcm.MethodBase.GetGenericArguments();
                if (genericArguments != null && genericArguments.Length > 0)
                {
                    if (argsToSerialize == null)
                    {
                        argsToSerialize = new ArrayList();
                    }
                    this._instantiation = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                    argsToSerialize.Add((object)genericArguments);
                }
            }
            if (RemotingServices.IsMethodOverloaded((IMethodMessage)mcm))
            {
                if (argsToSerialize == null)
                {
                    argsToSerialize = new ArrayList();
                }
                this._methodSignature = new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                argsToSerialize.Add(mcm.MethodSignature);
            }
            LogicalCallContext logicalCallContext = mcm.LogicalCallContext;

            if (logicalCallContext == null)
            {
                this._callContext = (object)null;
            }
            else if (logicalCallContext.HasInfo)
            {
                if (argsToSerialize == null)
                {
                    argsToSerialize = new ArrayList();
                }
                this._callContext = (object)new MessageSmuggler.SerializedArg(argsToSerialize.Count);
                argsToSerialize.Add((object)logicalCallContext);
            }
            else
            {
                this._callContext = (object)logicalCallContext.RemotingData.LogicalCallID;
            }
            this._args = MessageSmuggler.FixupArgs(mcm.Args, ref argsToSerialize);
            if (argsToSerialize == null)
            {
                return;
            }
            this._serializedArgs = CrossAppDomainSerializer.SerializeMessageParts(argsToSerialize).GetBuffer();
        }
コード例 #23
0
 internal AsyncWorkItem(IMessage reqMsg, IMessageSink replySink, Context oldCtx, ServerIdentity srvID)
 {
     this._reqMsg    = reqMsg;
     this._replySink = replySink;
     this._oldCtx    = oldCtx;
     this._callCtx   = CallContext.GetLogicalCallContext();
     this._srvID     = srvID;
 }
コード例 #24
0
ファイル: thread.cs プロジェクト: wolewd/Windows-Server-2003
        internal LogicalCallContext SetLogicalCallContext(
            LogicalCallContext callCtx)
        {
            LogicalCallContext oldCtx = m_LogicalCallContext;

            m_LogicalCallContext = callCtx;
            return(oldCtx);
        }
コード例 #25
0
ファイル: thread.cs プロジェクト: wolewd/Windows-Server-2003
 internal LogicalCallContext GetLogicalCallContext()
 {
     if (m_LogicalCallContext == null)
     {
         m_LogicalCallContext = new LogicalCallContext();
     }
     return(m_LogicalCallContext);
 }
コード例 #26
0
 [System.Security.SecurityCritical]  // auto-generated
 internal AsyncWorkItem(IMessage reqMsg, IMessageSink replySink, Context oldCtx, ServerIdentity srvID)
 {
     _reqMsg    = reqMsg;
     _replySink = replySink;
     _oldCtx    = oldCtx;
     _callCtx   = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;
     _srvID     = srvID;
 }
コード例 #27
0
 internal WorkItem(IMessage reqMsg, IMessageSink nextSink, IMessageSink replySink)
 {
     this._reqMsg    = reqMsg;
     this._replyMsg  = (IMessage)null;
     this._nextSink  = nextSink;
     this._replySink = replySink;
     this._ctx       = Thread.CurrentContext;
     this._callCtx   = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;
 }
コード例 #28
0
        //Workaround is to set the activityid in remoting call's LogicalCallContext
        static LogicalCallContext SetActivityIdInLogicalCallContext(LogicalCallContext logicalCallContext)
        {
            if (TraceUtility.ActivityTracing)
            {
                logicalCallContext.SetData(activityIdSlotName, DiagnosticTraceBase.ActivityId);
            }

            return(logicalCallContext);
        }
コード例 #29
0
        [System.Security.SecurityCritical]  // auto-generated
        internal static byte[] DoDispatch(byte[] reqStmBuff,
                                          SmuggledMethodCallMessage smuggledMcm,
                                          out SmuggledMethodReturnMessage smuggledMrm)
        {
            //*********************** DE-SERIALIZE REQ-MSG ********************

            IMessage desReqMsg = null;

            if (smuggledMcm != null)
            {
                ArrayList deserializedArgs = smuggledMcm.FixupForNewAppDomain();
                desReqMsg = new MethodCall(smuggledMcm, deserializedArgs);
            }
            else
            {
                MemoryStream reqStm = new MemoryStream(reqStmBuff);
                desReqMsg = CrossAppDomainSerializer.DeserializeMessage(reqStm);
            }

            LogicalCallContext lcc = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;

            lcc.SetData(LCC_DATA_KEY, true);
            // now we can delegate to the DispatchMessage to do the rest

            IMessage retMsg = ChannelServices.SyncDispatchMessage(desReqMsg);

            lcc.FreeNamedDataSlot(LCC_DATA_KEY);

            smuggledMrm = SmuggledMethodReturnMessage.SmuggleIfPossible(retMsg);
            if (smuggledMrm != null)
            {
                return(null);
            }
            else
            {
                if (retMsg != null)
                {
                    // Null out the principal since we won't use it on the other side.
                    // This is handled inside of SmuggleIfPossible for method call
                    // messages.
                    LogicalCallContext callCtx = (LogicalCallContext)
                                                 retMsg.Properties[Message.CallContextKey];
                    if (callCtx != null)
                    {
                        if (callCtx.Principal != null)
                        {
                            callCtx.Principal = null;
                        }
                    }

                    return(CrossAppDomainSerializer.SerializeMessage(retMsg).GetBuffer());
                }

                //*********************** SERIALIZE RET-MSG ********************
                return(null);
            }
        } // DoDispatch
コード例 #30
0
 internal WorkItem(IMessage reqMsg, IMessageSink nextSink, IMessageSink replySink)
 {
     this._reqMsg    = reqMsg;
     this._replyMsg  = null;
     this._nextSink  = nextSink;
     this._replySink = replySink;
     this._ctx       = Thread.CurrentContext;
     this._callCtx   = CallContext.GetLogicalCallContext();
 }
コード例 #31
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated 
        internal MethodResponse(IMethodCallMessage msg, 
                                SmuggledMethodReturnMessage smuggledMrm,
                                ArrayList deserializedArgs) 
        {
            MI = (MethodBase)msg.MethodBase;
            _methodCache = InternalRemotingServices.GetReflectionCachedData(MI);
 
            methodName = msg.MethodName;
            uri = msg.Uri; 
            typeName = msg.TypeName; 

            if (_methodCache.IsOverloaded()) 
                methodSignature = (Type[])msg.MethodSignature;

            retVal = smuggledMrm.GetReturnValue(deserializedArgs);
            outArgs = smuggledMrm.GetArgs(deserializedArgs); 
            fault = smuggledMrm.GetException(deserializedArgs);
 
            callContext = smuggledMrm.GetCallContext(deserializedArgs); 

            if (smuggledMrm.MessagePropertyCount > 0) 
                smuggledMrm.PopulateMessageProperties(Properties, deserializedArgs);

            argCount = _methodCache.Parameters.Length;
            fSoap = false; 
        }
コード例 #32
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated 
        internal void FillHeader(String name, Object value) 
        {
            Message.DebugOut("MethodCall::FillHeaders: name: " + (name == null ? "NULL" : name) + "\n"); 
            Message.DebugOut("MethodCall::FillHeaders: Value.GetClass: " + (value == null ? "NULL" : value.GetType().FullName) + "\n");
            Message.DebugOut("MethodCall::FillHeaders: Value.ToString: " + (value == null ? "NULL" : value.ToString()) + "\n");

            if (name.Equals("__MethodName")) 
            {
                methodName = (String) value; 
            } 
            else if (name.Equals("__Uri"))
            { 
                uri = (String) value;
            }
            else if (name.Equals("__MethodSignature"))
            { 
                methodSignature = (Type[]) value;
            } 
            else if (name.Equals("__TypeName")) 
            {
                typeName = (String) value; 
            }
            else if (name.Equals("__OutArgs"))
            {
                outArgs = (Object[]) value; 
            }
            else if (name.Equals("__CallContext")) 
            { 
                // if the value is a string, then its the LogicalCallId
                if (value is String) 
                {
                    callContext = new LogicalCallContext();
                    callContext.RemotingData.LogicalCallID = (String) value;
                } 
                else
                    callContext = (LogicalCallContext) value; 
            } 
            else if (name.Equals("__Return"))
            { 
                retVal = value;
            }
            else
            { 
                if (InternalProperties == null)
                { 
                    InternalProperties = new Hashtable(); 
                }
                InternalProperties[name] = value; 
            }
        }
コード例 #33
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 internal LogicalCallContext SetLogicalCallContext(LogicalCallContext ctx)
 {
     LogicalCallContext old=callContext; 
     callContext=ctx;
     return old; 
 } 
コード例 #34
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 [System.Security.SecurityCritical]  // auto-generated
 public ReturnMessage(Exception e, IMethodCallMessage mcm) 
 { 
     _e   = IsCustomErrorEnabled()? new RemotingException(Environment.GetResourceString("Remoting_InternalError")):e;
     _callContext = CallContext.GetLogicalCallContext(); 
     if (mcm != null)
     {
         _URI = mcm.Uri;
         _methodName = mcm.MethodName; 
         _methodSignature = null;
         _typeName = mcm.TypeName; 
         _hasVarArgs = mcm.HasVarArgs; 
         _methodBase = mcm.MethodBase;
     } 
 }
コード例 #35
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated
        internal MethodCall(SmuggledMethodCallMessage smuggledMsg, ArrayList deserializedArgs)
        {
            uri = smuggledMsg.Uri; 
            typeName = smuggledMsg.TypeName;
            methodName = smuggledMsg.MethodName; 
            methodSignature = (Type[])smuggledMsg.GetMethodSignature(deserializedArgs); 
            args = smuggledMsg.GetArgs(deserializedArgs);
            instArgs = smuggledMsg.GetInstantiation(deserializedArgs); 
            callContext = smuggledMsg.GetCallContext(deserializedArgs);

            ResolveMethod();
 
            if (smuggledMsg.MessagePropertyCount > 0)
                smuggledMsg.PopulateMessageProperties(Properties, deserializedArgs); 
        } 
コード例 #36
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 public ConstructorReturnMessage(MarshalByRefObject o, Object[] outArgs, int outArgsCount, 
                                 LogicalCallContext callCtx, IConstructionCallMessage ccm)
 : base(o, outArgs, outArgsCount, callCtx, ccm) 
 {
     _o = o;
     _iFlags = Intercept;
 } 
コード例 #37
0
 // Constructors
 public ReturnMessage(object ret, object[] outArgs, int outArgsCount, LogicalCallContext callCtx, IMethodCallMessage mcm)
 {
 }
コード例 #38
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 [System.Security.SecurityCritical]  // auto-generated
 internal LogicalCallContext SetLogicalCallContext(LogicalCallContext callCtx) 
 {
     return _m.SetLogicalCallContext(callCtx);
 }
コード例 #39
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated
        public ReturnMessage(Object ret, Object[] outArgs, int outArgsCount, LogicalCallContext callCtx, 
                             IMethodCallMessage mcm)
        {
            _ret = ret;
            _outArgs = outArgs; 
            _outArgsCount = outArgsCount;
 
            if (callCtx != null) 
                _callContext = callCtx;
            else 
                _callContext = CallContext.GetLogicalCallContext();

            if (mcm != null)
            { 
                _URI = mcm.Uri;
                _methodName = mcm.MethodName; 
                _methodSignature = null; 
                _typeName = mcm.TypeName;
                _hasVarArgs = mcm.HasVarArgs; 
                _methodBase = mcm.MethodBase;
            }
        }
コード例 #40
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated 
        internal MethodResponse(IMethodCallMessage msg,
                                Object handlerObject, 
                                BinaryMethodReturnMessage smuggledMrm)
        {

            if (msg != null) 
            {
                MI = (MethodBase)msg.MethodBase; 
                _methodCache = InternalRemotingServices.GetReflectionCachedData(MI); 

                methodName = msg.MethodName; 
                uri = msg.Uri;
                typeName = msg.TypeName;

                if (_methodCache.IsOverloaded()) 
                    methodSignature = (Type[])msg.MethodSignature;
 
                argCount = _methodCache.Parameters.Length; 

            } 

            retVal = smuggledMrm.ReturnValue;
            outArgs = smuggledMrm.Args;
            fault = smuggledMrm.Exception; 

            callContext = smuggledMrm.LogicalCallContext; 
 
            if (smuggledMrm.HasProperties)
                smuggledMrm.PopulateMessageProperties(Properties); 

            fSoap = false;
        }
コード例 #41
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 [System.Security.SecurityCritical]  // auto-generated
 internal LogicalCallContext GetLogicalCallContext() 
 {
     if (callContext == null) 
         callContext = new LogicalCallContext(); 
     return callContext;
 } 
コード例 #42
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 void IInternalMessage.SetCallContext(LogicalCallContext newCallContext) 
 {
     _m.SetLogicalCallContext(newCallContext); 
 }
コード例 #43
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 [System.Security.SecurityCritical]  // auto-generated
 internal virtual bool FillSpecialHeader(String key, Object value) 
 {
     if (key == null) 
     { 
         //skip
     } 
     else if (key.Equals("__Uri"))
     {
         uri = (String) value;
     } 
     else if (key.Equals("__MethodName"))
     { 
         methodName = (String) value; 
     }
     else if (key.Equals("__MethodSignature")) 
     {
         methodSignature = (Type[]) value;
     }
     else if (key.Equals("__TypeName")) 
     {
         typeName = (String) value; 
     } 
     else if (key.Equals("__Args"))
     { 
         args = (Object[]) value;
     }
     else if (key.Equals("__CallContext"))
     { 
         // if the value is a string, then its the LogicalCallId
         if (value is String) 
         { 
             callContext = new LogicalCallContext();
             callContext.RemotingData.LogicalCallID = (String) value; 
         }
         else
             callContext = (LogicalCallContext) value;
     } 
     else
     { 
         return false; 
     }
     return true; 
 }
コード例 #44
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated
        internal LogicalCallContext SetLogicalCallContext(LogicalCallContext ctx) 
        { 
            if (_message != null)
            { 
                return _message.SetLogicalCallContext(ctx);
            }
            else
            { 
                throw new InvalidOperationException(
                    Environment.GetResourceString( 
                        "InvalidOperation_InternalState")); 
            }
 
        }
コード例 #45
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
        [System.Security.SecurityCritical]  // auto-generated 
        internal MethodCall(Object handlerObject, BinaryMethodCallMessage smuggledMsg)
        {
            if (handlerObject != null)
            { 
                uri = handlerObject as String;
                if (uri == null) 
                { 
                    // This must be the tranparent proxy
                    MarshalByRefObject mbr = handlerObject as MarshalByRefObject; 
                    if (mbr != null)
                    {
                        bool fServer;
                        srvID = MarshalByRefObject.GetIdentity(mbr, out fServer) as ServerIdentity; 
                        uri = srvID.URI;
                    } 
                } 
            }
 
            typeName = smuggledMsg.TypeName;
            methodName = smuggledMsg.MethodName;
            methodSignature = (Type[])smuggledMsg.MethodSignature;
            args = smuggledMsg.Args; 
            instArgs = smuggledMsg.InstantiationArgs;
            callContext = smuggledMsg.LogicalCallContext; 
 
            ResolveMethod();
 
            if (smuggledMsg.HasProperties)
                smuggledMsg.PopulateMessageProperties(Properties);
        }
コード例 #46
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 void IInternalMessage.SetCallContext(LogicalCallContext callContext)
 {
     throw new RemotingException( 
         Environment.GetResourceString(
             "Remoting_Default")); 
 } 
コード例 #47
0
ファイル: Message.cs プロジェクト: sjyanxin/WPFSource
 void IInternalMessage.SetCallContext(LogicalCallContext newCallContext) 
 {
     callContext = newCallContext;
 }