Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / AddIn / AddIn / System / Addin / Hosting / AddInIpcChannel.cs / 1305376 / AddInIpcChannel.cs
using System; using System.Collections; using System.Text; using System.Runtime.Remoting.Channels.Ipc; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Messaging; using System.Security; using System.Security.Permissions; namespace System.AddIn.Hosting { //This class exists only to do two security asserts, allowing us to use remoting with partial-trust app domains in external processes. internal class AddInIpcChannel : IpcChannel { ////// [System.Security.SecurityCritical] public AddInIpcChannel(IDictionary props, IClientChannelSinkProvider client, IServerChannelSinkProvider server) : base(props, new AddInBinaryClientFormaterSinkProvider(client), new AddInBinaryServerFormaterSinkProvider(server)) { } } internal class AddInBinaryServerFormaterSinkProvider : IServerChannelSinkProvider { internal IServerChannelSinkProvider _sinkProvider; public AddInBinaryServerFormaterSinkProvider(IServerChannelSinkProvider sink) { _sinkProvider = sink; } #region IServerChannelSinkProvider Members ////// /// [System.Security.SecurityCritical] public IServerChannelSink CreateSink(IChannelReceiver channel) { return new AddInBinaryServerSink(_sinkProvider.CreateSink(channel)); } ////// /// [System.Security.SecurityCritical] public void GetChannelData(IChannelDataStore channelData) { _sinkProvider.GetChannelData(channelData); } public IServerChannelSinkProvider Next { ////// /// [System.Security.SecurityCritical] get { return _sinkProvider.Next; } ////// /// [System.Security.SecurityCritical] set { _sinkProvider.Next = value; } } #endregion } internal class AddInBinaryServerSink : IServerChannelSink { #region IServerChannelSink Members private IServerChannelSink _sink; public AddInBinaryServerSink(IServerChannelSink sink) { _sink = sink; } ////// /// [System.Security.SecurityCritical] public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, System.IO.Stream stream) { _sink.AsyncProcessResponse(sinkStack, state, msg, headers, stream); } ////// /// [System.Security.SecurityCritical] public System.IO.Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers) { return _sink.GetResponseStream(sinkStack, state, msg, headers); } public IServerChannelSink NextChannelSink { ////// /// [System.Security.SecurityCritical] get { return _sink.NextChannelSink; } } ////// /// [System.Security.SecurityCritical] public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { new System.Security.Permissions.SecurityPermission(SecurityPermissionFlag.SerializationFormatter | SecurityPermissionFlag.UnmanagedCode).Assert(); return _sink.ProcessMessage(sinkStack, requestMsg, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream); } #endregion #region IChannelSinkBase Members public IDictionary Properties { ////// /// /// [System.Security.SecurityCritical] get { return _sink.Properties; } } #endregion } internal class AddInBinaryClientFormaterSinkProvider : IClientChannelSinkProvider { IClientChannelSinkProvider _provider; public AddInBinaryClientFormaterSinkProvider(IClientChannelSinkProvider provider) { _provider = provider; } #region IClientChannelSinkProvider Members ////// /// [System.Security.SecurityCritical] public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) { return new AddInBinaryClientFormaterSink(_provider.CreateSink(channel, url, remoteChannelData)); } public IClientChannelSinkProvider Next { ////// /// [System.Security.SecurityCritical] get { return _provider.Next; } ////// /// [System.Security.SecurityCritical] set { _provider.Next = value; } } #endregion } internal class AddInBinaryClientFormaterSink : IClientChannelSink, IMessageSink { IClientChannelSink _sink; IMessageSink _mSink; public AddInBinaryClientFormaterSink(IClientChannelSink sink) { _sink = sink; _mSink = (IMessageSink)sink; } #region IClientChannelSink Members ////// /// [System.Security.SecurityCritical] public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, System.IO.Stream stream) { _sink.AsyncProcessRequest(sinkStack, msg, headers, stream); } ////// /// [System.Security.SecurityCritical] public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, System.IO.Stream stream) { _sink.AsyncProcessResponse(sinkStack, state, headers, stream); } ////// /// [System.Security.SecurityCritical] public System.IO.Stream GetRequestStream(IMessage msg, ITransportHeaders headers) { return _sink.GetRequestStream(msg, headers); } public IClientChannelSink NextChannelSink { ////// /// [System.Security.SecurityCritical] get { return _sink.NextChannelSink; } } ////// /// [System.Security.SecurityCritical] public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, out ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { _sink.ProcessMessage(msg, requestHeaders, requestStream, out responseHeaders,out responseStream); } #endregion #region IChannelSinkBase Members public IDictionary Properties { ////// /// [System.Security.SecurityCritical] get { return _sink.Properties; } } #endregion #region IMessageSink Members ////// /// [System.Security.SecurityCritical] public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink) { return _mSink.AsyncProcessMessage(msg, replySink); } public IMessageSink NextSink { ////// /// [System.Security.SecurityCritical] get { return _mSink.NextSink; } } ////// /// [System.Security.SecurityCritical] public IMessage SyncProcessMessage(IMessage msg) { new System.Security.Permissions.SecurityPermission(SecurityPermissionFlag.SerializationFormatter | SecurityPermissionFlag.UnmanagedCode).Assert(); return _mSink.SyncProcessMessage(msg); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections; using System.Text; using System.Runtime.Remoting.Channels.Ipc; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Messaging; using System.Security; using System.Security.Permissions; namespace System.AddIn.Hosting { //This class exists only to do two security asserts, allowing us to use remoting with partial-trust app domains in external processes. internal class AddInIpcChannel : IpcChannel { ////// /// /// [System.Security.SecurityCritical] public AddInIpcChannel(IDictionary props, IClientChannelSinkProvider client, IServerChannelSinkProvider server) : base(props, new AddInBinaryClientFormaterSinkProvider(client), new AddInBinaryServerFormaterSinkProvider(server)) { } } internal class AddInBinaryServerFormaterSinkProvider : IServerChannelSinkProvider { internal IServerChannelSinkProvider _sinkProvider; public AddInBinaryServerFormaterSinkProvider(IServerChannelSinkProvider sink) { _sinkProvider = sink; } #region IServerChannelSinkProvider Members ////// /// [System.Security.SecurityCritical] public IServerChannelSink CreateSink(IChannelReceiver channel) { return new AddInBinaryServerSink(_sinkProvider.CreateSink(channel)); } ////// /// [System.Security.SecurityCritical] public void GetChannelData(IChannelDataStore channelData) { _sinkProvider.GetChannelData(channelData); } public IServerChannelSinkProvider Next { ////// /// [System.Security.SecurityCritical] get { return _sinkProvider.Next; } ////// /// [System.Security.SecurityCritical] set { _sinkProvider.Next = value; } } #endregion } internal class AddInBinaryServerSink : IServerChannelSink { #region IServerChannelSink Members private IServerChannelSink _sink; public AddInBinaryServerSink(IServerChannelSink sink) { _sink = sink; } ////// /// [System.Security.SecurityCritical] public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, System.IO.Stream stream) { _sink.AsyncProcessResponse(sinkStack, state, msg, headers, stream); } ////// /// [System.Security.SecurityCritical] public System.IO.Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers) { return _sink.GetResponseStream(sinkStack, state, msg, headers); } public IServerChannelSink NextChannelSink { ////// /// [System.Security.SecurityCritical] get { return _sink.NextChannelSink; } } ////// /// [System.Security.SecurityCritical] public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { new System.Security.Permissions.SecurityPermission(SecurityPermissionFlag.SerializationFormatter | SecurityPermissionFlag.UnmanagedCode).Assert(); return _sink.ProcessMessage(sinkStack, requestMsg, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream); } #endregion #region IChannelSinkBase Members public IDictionary Properties { ////// /// /// [System.Security.SecurityCritical] get { return _sink.Properties; } } #endregion } internal class AddInBinaryClientFormaterSinkProvider : IClientChannelSinkProvider { IClientChannelSinkProvider _provider; public AddInBinaryClientFormaterSinkProvider(IClientChannelSinkProvider provider) { _provider = provider; } #region IClientChannelSinkProvider Members ////// /// [System.Security.SecurityCritical] public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) { return new AddInBinaryClientFormaterSink(_provider.CreateSink(channel, url, remoteChannelData)); } public IClientChannelSinkProvider Next { ////// /// [System.Security.SecurityCritical] get { return _provider.Next; } ////// /// [System.Security.SecurityCritical] set { _provider.Next = value; } } #endregion } internal class AddInBinaryClientFormaterSink : IClientChannelSink, IMessageSink { IClientChannelSink _sink; IMessageSink _mSink; public AddInBinaryClientFormaterSink(IClientChannelSink sink) { _sink = sink; _mSink = (IMessageSink)sink; } #region IClientChannelSink Members ////// /// [System.Security.SecurityCritical] public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, System.IO.Stream stream) { _sink.AsyncProcessRequest(sinkStack, msg, headers, stream); } ////// /// [System.Security.SecurityCritical] public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, System.IO.Stream stream) { _sink.AsyncProcessResponse(sinkStack, state, headers, stream); } ////// /// [System.Security.SecurityCritical] public System.IO.Stream GetRequestStream(IMessage msg, ITransportHeaders headers) { return _sink.GetRequestStream(msg, headers); } public IClientChannelSink NextChannelSink { ////// /// [System.Security.SecurityCritical] get { return _sink.NextChannelSink; } } ////// /// [System.Security.SecurityCritical] public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, out ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { _sink.ProcessMessage(msg, requestHeaders, requestStream, out responseHeaders,out responseStream); } #endregion #region IChannelSinkBase Members public IDictionary Properties { ////// /// [System.Security.SecurityCritical] get { return _sink.Properties; } } #endregion #region IMessageSink Members ////// /// [System.Security.SecurityCritical] public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink) { return _mSink.AsyncProcessMessage(msg, replySink); } public IMessageSink NextSink { ////// /// [System.Security.SecurityCritical] get { return _mSink.NextSink; } } ////// /// [System.Security.SecurityCritical] public IMessage SyncProcessMessage(IMessage msg) { new System.Security.Permissions.SecurityPermission(SecurityPermissionFlag.SerializationFormatter | SecurityPermissionFlag.UnmanagedCode).Assert(); return _mSink.SyncProcessMessage(msg); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved./// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AspProxy.cs
- EventProviderWriter.cs
- DesignerWithHeader.cs
- D3DImage.cs
- Message.cs
- PixelShader.cs
- FloaterParaClient.cs
- WebPartMenu.cs
- IChannel.cs
- TreeNodeMouseHoverEvent.cs
- MdiWindowListStrip.cs
- BitmapMetadataEnumerator.cs
- BindingElement.cs
- Schedule.cs
- RelationshipWrapper.cs
- SystemThemeKey.cs
- ResourceReader.cs
- ServiceObjectContainer.cs
- Transform3D.cs
- DataFormats.cs
- Serializer.cs
- ValidationSummaryDesigner.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- RowVisual.cs
- TraceContextRecord.cs
- DataConnectionHelper.cs
- NoneExcludedImageIndexConverter.cs
- FileSystemWatcher.cs
- ExpressionVisitor.cs
- Publisher.cs
- ValidationErrorCollection.cs
- StylusPointPropertyId.cs
- ResourceManagerWrapper.cs
- RichTextBoxAutomationPeer.cs
- panel.cs
- EntityConnection.cs
- ProfilePropertyMetadata.cs
- ListBoxDesigner.cs
- GuidelineSet.cs
- Variant.cs
- XamlDesignerSerializationManager.cs
- WindowsListView.cs
- Effect.cs
- FileResponseElement.cs
- GacUtil.cs
- SafeProcessHandle.cs
- CaseStatement.cs
- DefaultAuthorizationContext.cs
- EnvironmentPermission.cs
- TextSegment.cs
- RenderingBiasValidation.cs
- TextEndOfSegment.cs
- QuaternionAnimationBase.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- BitmapEffectCollection.cs
- CachedFontFamily.cs
- MetricEntry.cs
- SerialPort.cs
- ObjectDesignerDataSourceView.cs
- KeyedHashAlgorithm.cs
- AssemblyAssociatedContentFileAttribute.cs
- ResXDataNode.cs
- ElementHostAutomationPeer.cs
- TextBreakpoint.cs
- ActiveXHost.cs
- AnimationClockResource.cs
- CalendarDateRangeChangingEventArgs.cs
- ExternalCalls.cs
- XsltSettings.cs
- GetBrowserTokenRequest.cs
- TypeGenericEnumerableViewSchema.cs
- HttpServerVarsCollection.cs
- IDataContractSurrogate.cs
- UnsafeNetInfoNativeMethods.cs
- SkipStoryboardToFill.cs
- ColorKeyFrameCollection.cs
- AttributeCollection.cs
- EndpointAddressElementBase.cs
- HeaderCollection.cs
- TagMapInfo.cs
- MetricEntry.cs
- ArgIterator.cs
- QfeChecker.cs
- Profiler.cs
- ITextView.cs
- MetaModel.cs
- HttpGetProtocolImporter.cs
- ApplicationDirectoryMembershipCondition.cs
- DefaultExpression.cs
- MethodBuilder.cs
- XmlSecureResolver.cs
- UseManagedPresentationElement.cs
- SamlAudienceRestrictionCondition.cs
- PersonalizationStateInfoCollection.cs
- MessageSmuggler.cs
- SwitchLevelAttribute.cs
- _ConnectOverlappedAsyncResult.cs
- ConnectionProviderAttribute.cs
- URIFormatException.cs
- TabItemAutomationPeer.cs