internal static byte[] DoDispatch(byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, out SmuggledMethodReturnMessage smuggledMrm)
 {
     IMessage msg = null;
     if (smuggledMcm != null)
     {
         ArrayList deserializedArgs = smuggledMcm.FixupForNewAppDomain();
         msg = new MethodCall(smuggledMcm, deserializedArgs);
     }
     else
     {
         MemoryStream stm = new MemoryStream(reqStmBuff);
         msg = CrossAppDomainSerializer.DeserializeMessage(stm);
     }
     LogicalCallContext logicalCallContext = CallContext.GetLogicalCallContext();
     logicalCallContext.SetData("__xADCall", true);
     IMessage message2 = ChannelServices.SyncDispatchMessage(msg);
     logicalCallContext.FreeNamedDataSlot("__xADCall");
     smuggledMrm = SmuggledMethodReturnMessage.SmuggleIfPossible(message2);
     if (smuggledMrm != null)
     {
         return null;
     }
     if (message2 == null)
     {
         return null;
     }
     LogicalCallContext context2 = (LogicalCallContext) message2.Properties[Message.CallContextKey];
     if ((context2 != null) && (context2.Principal != null))
     {
         context2.Principal = null;
     }
     return CrossAppDomainSerializer.SerializeMessage(message2).GetBuffer();
 }
예제 #2
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
예제 #3
0
        internal byte[] DoDispatch(byte[] reqStmBuff, 
                                   SmuggledMethodCallMessage smuggledMcm,
                                   out SmuggledMethodReturnMessage smuggledMrm)
        {
            RemotingServices.LogRemotingStage(RemotingServices.SERVER_MSG_DESER);

            //*********************** 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);
            }

            // now we can delegate to the DispatchMessage to do the rest

            RemotingServices.LogRemotingStage(RemotingServices.SERVER_MSG_SINK_CHAIN);

            IMessage retMsg = ChannelServices.SyncDispatchMessage(desReqMsg);

            RemotingServices.LogRemotingStage(RemotingServices.SERVER_RET_SER);

            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;
                    }
                }
            
                //*********************** SERIALIZE RET-MSG ********************
                return CrossAppDomainSerializer.SerializeMessage(retMsg).GetBuffer();
            }
        } // DoDispatch