Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Log / System / IO / Log / SmuggledIUnknown.cs / 1305376 / SmuggledIUnknown.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Remoting.Services; internal sealed class SmuggledIUnknown : SafeHandle { internal SmuggledIUnknown() : base(IntPtr.Zero, true) { } internal SmuggledIUnknown(object unknown) : this() { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { base.handle = Marshal.GetIUnknownForObject(unknown); } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } public object Smuggle() { object comObject; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { comObject = EnterpriseServicesHelper.WrapIUnknownWithComObject(base.handle); GC.KeepAlive(this); } return comObject; } override protected bool ReleaseHandle() { if (base.handle != IntPtr.Zero) { Marshal.Release(base.handle); base.handle = IntPtr.Zero; } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Remoting.Services; internal sealed class SmuggledIUnknown : SafeHandle { internal SmuggledIUnknown() : base(IntPtr.Zero, true) { } internal SmuggledIUnknown(object unknown) : this() { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { base.handle = Marshal.GetIUnknownForObject(unknown); } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } public object Smuggle() { object comObject; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { comObject = EnterpriseServicesHelper.WrapIUnknownWithComObject(base.handle); GC.KeepAlive(this); } return comObject; } override protected bool ReleaseHandle() { if (base.handle != IntPtr.Zero) { Marshal.Release(base.handle); base.handle = IntPtr.Zero; } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MethodToken.cs
- BehaviorDragDropEventArgs.cs
- WindowsSlider.cs
- HttpListenerContext.cs
- _ListenerResponseStream.cs
- LabelEditEvent.cs
- StorageConditionPropertyMapping.cs
- userdatakeys.cs
- SslStreamSecurityUpgradeProvider.cs
- CancellationState.cs
- DLinqColumnProvider.cs
- ConnectionManagementElementCollection.cs
- StylusPlugInCollection.cs
- ArrayWithOffset.cs
- BindStream.cs
- MappingSource.cs
- SendMessageChannelCache.cs
- UnaryNode.cs
- Queue.cs
- DefaultPropertyAttribute.cs
- DeviceSpecificDialogCachedState.cs
- FrameworkElementFactory.cs
- ExpandedProjectionNode.cs
- DataGridItemEventArgs.cs
- ExecutionEngineException.cs
- Light.cs
- StorageAssociationTypeMapping.cs
- KeyConstraint.cs
- PackagingUtilities.cs
- MediaCommands.cs
- SqlInternalConnectionTds.cs
- TextControl.cs
- DesignerImageAdapter.cs
- CryptoHelper.cs
- XmlObjectSerializerReadContextComplexJson.cs
- CoreSwitches.cs
- XPathAncestorIterator.cs
- OrderedDictionary.cs
- RSAProtectedConfigurationProvider.cs
- FileRegion.cs
- EncryptedReference.cs
- RoleServiceManager.cs
- Point4D.cs
- DrawingBrush.cs
- BaseCollection.cs
- IRCollection.cs
- StrokeNodeOperations.cs
- DrawingAttributeSerializer.cs
- StickyNoteHelper.cs
- BatchParser.cs
- Quad.cs
- DataGridViewColumnHeaderCell.cs
- ListChunk.cs
- AutomationIdentifier.cs
- TypeEnumerableViewSchema.cs
- BufferManager.cs
- Axis.cs
- Expressions.cs
- SmtpFailedRecipientException.cs
- SystemPens.cs
- PersistChildrenAttribute.cs
- UnsafeNativeMethods.cs
- LogEntryHeaderSerializer.cs
- DataTemplateSelector.cs
- PropertyMappingExceptionEventArgs.cs
- EtwTrackingBehavior.cs
- SamlSecurityTokenAuthenticator.cs
- CultureInfoConverter.cs
- SecureEnvironment.cs
- ProtocolsSection.cs
- InternalPermissions.cs
- GrowingArray.cs
- ReadOnlyCollectionBase.cs
- EffectiveValueEntry.cs
- XmlAutoDetectWriter.cs
- ModifierKeysConverter.cs
- MsmqHostedTransportManager.cs
- BamlLocalizer.cs
- GeometryDrawing.cs
- MatchAttribute.cs
- StreamUpdate.cs
- WebPageTraceListener.cs
- WebPartConnection.cs
- WebBrowsableAttribute.cs
- CheckableControlBaseAdapter.cs
- FormsAuthenticationEventArgs.cs
- SecurityStandardsManager.cs
- TransformerInfoCollection.cs
- PerformanceCounterNameAttribute.cs
- SafeNativeMethods.cs
- recordstatescratchpad.cs
- HashAlgorithm.cs
- ElementFactory.cs
- RpcAsyncResult.cs
- SerializationSectionGroup.cs
- SelectionRangeConverter.cs
- WebAdminConfigurationHelper.cs
- HtmlFormParameterWriter.cs
- SQLSingle.cs
- SQLByte.cs