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
- CapabilitiesPattern.cs
- NotSupportedException.cs
- AtomServiceDocumentSerializer.cs
- sqlpipe.cs
- DependencyPropertyHelper.cs
- ToolBar.cs
- Application.cs
- BamlBinaryWriter.cs
- CellParagraph.cs
- DrawingState.cs
- HTMLTextWriter.cs
- FocusTracker.cs
- UInt16Storage.cs
- ScriptingRoleServiceSection.cs
- DataGridTemplateColumn.cs
- DictionaryKeyPropertyAttribute.cs
- ScriptManagerProxy.cs
- ModifiableIteratorCollection.cs
- PropertyEmitter.cs
- CorrelationHandle.cs
- ConsumerConnectionPointCollection.cs
- CacheDict.cs
- LineServices.cs
- UniqueEventHelper.cs
- ScriptMethodAttribute.cs
- WorkflowTransactionService.cs
- SafeLibraryHandle.cs
- InternalRelationshipCollection.cs
- FormsAuthenticationUserCollection.cs
- MouseActionValueSerializer.cs
- FixedPage.cs
- Size.cs
- XmlNamespaceManager.cs
- _NativeSSPI.cs
- DataGridViewToolTip.cs
- securestring.cs
- Stylus.cs
- CompiledRegexRunner.cs
- ColorConverter.cs
- ConfigXmlSignificantWhitespace.cs
- RewritingValidator.cs
- BitmapEffectInput.cs
- TableLayoutStyleCollection.cs
- StdValidatorsAndConverters.cs
- AlignmentXValidation.cs
- GridEntry.cs
- CompiledIdentityConstraint.cs
- ServiceTimeoutsBehavior.cs
- ToolStripLocationCancelEventArgs.cs
- BinaryMethodMessage.cs
- InteropBitmapSource.cs
- ActivityDesignerHelper.cs
- EntityDataSourceChangingEventArgs.cs
- TriggerAction.cs
- ParameterModifier.cs
- TextViewBase.cs
- FileLogRecordEnumerator.cs
- OdbcConnectionString.cs
- SchemaMapping.cs
- JobCollate.cs
- SendSecurityHeader.cs
- DataTableMappingCollection.cs
- TrackingWorkflowEventArgs.cs
- SecurityHeaderLayout.cs
- XmlNode.cs
- PrintingPermission.cs
- ZipIOBlockManager.cs
- HTMLTagNameToTypeMapper.cs
- OdbcError.cs
- loginstatus.cs
- ControlParameter.cs
- DocumentApplicationJournalEntry.cs
- XmlSchemaComplexContentRestriction.cs
- WorkflowServiceInstance.cs
- ConfigurationValues.cs
- ElementProxy.cs
- AnimationStorage.cs
- MaterialCollection.cs
- EntityDesignerUtils.cs
- AnnotationStore.cs
- HttpCapabilitiesSectionHandler.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ConfigUtil.cs
- ClientRolePrincipal.cs
- MediaContext.cs
- PageStatePersister.cs
- BinaryConverter.cs
- TransactionTable.cs
- SmtpTransport.cs
- BigInt.cs
- NamespaceQuery.cs
- XamlReader.cs
- AuthenticationModuleElement.cs
- StringFormat.cs
- EntityContainerAssociationSetEnd.cs
- ListCollectionView.cs
- MD5CryptoServiceProvider.cs
- SqlStatistics.cs
- ServiceModelActivationSectionGroup.cs
- DataGridViewEditingControlShowingEventArgs.cs