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
- HttpSocketManager.cs
- DomNameTable.cs
- ApplicationHost.cs
- DataGridTable.cs
- CustomErrorsSection.cs
- ReflectionUtil.cs
- UserNameSecurityToken.cs
- ProvidersHelper.cs
- ConnectionManagementElementCollection.cs
- Matrix.cs
- Vector3DAnimationUsingKeyFrames.cs
- EnglishPluralizationService.cs
- EUCJPEncoding.cs
- DiscoveryMessageProperty.cs
- BitmapEffectGroup.cs
- TextUtf8RawTextWriter.cs
- SqlBulkCopyColumnMappingCollection.cs
- SByteConverter.cs
- NameValueConfigurationCollection.cs
- EntityContainerAssociationSetEnd.cs
- MSAAEventDispatcher.cs
- ObjectQuery_EntitySqlExtensions.cs
- MediaContextNotificationWindow.cs
- TaskScheduler.cs
- CheckBoxStandardAdapter.cs
- BevelBitmapEffect.cs
- VScrollProperties.cs
- StickyNote.cs
- MappingException.cs
- ScriptingScriptResourceHandlerSection.cs
- FileDialog.cs
- Rotation3DKeyFrameCollection.cs
- Shared.cs
- CodeCompiler.cs
- ResourceDisplayNameAttribute.cs
- CalendarAutomationPeer.cs
- CodePageUtils.cs
- BinaryNode.cs
- Hashtable.cs
- EndpointIdentityExtension.cs
- AttributeCollection.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- TrackingAnnotationCollection.cs
- BasicKeyConstraint.cs
- CodeConditionStatement.cs
- Viewport3DVisual.cs
- PriorityBindingExpression.cs
- XmlComplianceUtil.cs
- Constant.cs
- WSSecurityPolicy11.cs
- ExclusiveCanonicalizationTransform.cs
- DuplexClientBase.cs
- CSharpCodeProvider.cs
- RectAnimationUsingKeyFrames.cs
- Select.cs
- CellParagraph.cs
- SudsCommon.cs
- MultipartContentParser.cs
- LoadGrammarCompletedEventArgs.cs
- BamlTreeNode.cs
- MetadataPropertyCollection.cs
- PeerApplication.cs
- EmbeddedMailObjectsCollection.cs
- EtwProvider.cs
- WindowsClaimSet.cs
- XmlChoiceIdentifierAttribute.cs
- ProxyBuilder.cs
- MenuItemBindingCollection.cs
- PermissionRequestEvidence.cs
- EtwTrace.cs
- SymDocumentType.cs
- UriTemplateTrieNode.cs
- DataPagerField.cs
- MetabaseSettingsIis7.cs
- XmlArrayItemAttributes.cs
- ContainerSelectorGlyph.cs
- Int32RectValueSerializer.cs
- EmptyEnumerable.cs
- TypeToken.cs
- HeaderedItemsControl.cs
- SchemeSettingElement.cs
- HierarchicalDataBoundControl.cs
- PartBasedPackageProperties.cs
- VisualBrush.cs
- ModifierKeysValueSerializer.cs
- DataServiceRequestOfT.cs
- HostedTransportConfigurationManager.cs
- TableCell.cs
- IUnknownConstantAttribute.cs
- StringPropertyBuilder.cs
- SettingsPropertyIsReadOnlyException.cs
- RelationshipDetailsRow.cs
- RowUpdatingEventArgs.cs
- IssuedTokenParametersElement.cs
- UInt32Converter.cs
- Int32Animation.cs
- EnvelopedSignatureTransform.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- KeyedCollection.cs
- ByteStream.cs