Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Tools / WSATConfig / Configuration / SafeIUnknown.cs / 1305376 / SafeIUnknown.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.Tools.ServiceModel.WsatConfig { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.ConstrainedExecution; using System.Security.Permissions; // Keep an interface pointer that will not be used in a SafeHandle derived so // that it will be properly released. internal sealed class SafeIUnknown : SafeHandle { // This constructor is called by ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SafeIUnknown() : base(IntPtr.Zero, true) { } // This constructor is called by ComInterop [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SafeIUnknown(IntPtr unknown) : base(IntPtr.Zero, true) { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { base.handle = unknown; } } public override bool IsInvalid { get { return (IsClosed || (IntPtr.Zero == base.handle)); } } override protected bool ReleaseHandle() { // NOTE: The SafeHandle class guarantees this will be called exactly once. IntPtr ptr = base.handle; base.handle = IntPtr.Zero; if (IntPtr.Zero != ptr) { Marshal.Release(ptr); } 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
- SamlSubject.cs
- SessionMode.cs
- DateTimeOffsetStorage.cs
- HtmlImage.cs
- AssociatedControlConverter.cs
- Utils.cs
- DateTimeParse.cs
- ValidationUtility.cs
- XmlSchemaExporter.cs
- SQLBoolean.cs
- InputScopeManager.cs
- EventListener.cs
- DataGridViewSortCompareEventArgs.cs
- LinqDataSourceUpdateEventArgs.cs
- XmlSchemaSimpleTypeUnion.cs
- BindingListCollectionView.cs
- DataGridViewRowCollection.cs
- QuotedPairReader.cs
- GradientStopCollection.cs
- VisualTransition.cs
- XmlReflectionMember.cs
- OSFeature.cs
- SizeConverter.cs
- SvcMapFileLoader.cs
- EmbeddedMailObjectsCollection.cs
- SecureStringHasher.cs
- TextTreeTextElementNode.cs
- OpenTypeMethods.cs
- MULTI_QI.cs
- TrackingMemoryStreamFactory.cs
- UnsafeNativeMethods.cs
- DataGridViewComboBoxCell.cs
- SqlBulkCopyColumnMappingCollection.cs
- WebPartConnection.cs
- TableParaClient.cs
- ScriptHandlerFactory.cs
- DataTableTypeConverter.cs
- MetadataCache.cs
- ImageAttributes.cs
- ObjectCacheHost.cs
- SystemResourceHost.cs
- RSAPKCS1SignatureDeformatter.cs
- SafeNativeMethods.cs
- UdpDuplexChannel.cs
- FormatterConverter.cs
- SchemaDeclBase.cs
- XmlElementElementCollection.cs
- NetPipeSectionData.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- TemplateGroupCollection.cs
- Imaging.cs
- SecurityResources.cs
- BaseWebProxyFinder.cs
- XmlLoader.cs
- HtmlLink.cs
- ObjectStateManagerMetadata.cs
- WebPartEditVerb.cs
- URLString.cs
- ProfileEventArgs.cs
- ClientOptions.cs
- IDictionary.cs
- SortedList.cs
- FreezableCollection.cs
- CompiledRegexRunner.cs
- IISUnsafeMethods.cs
- DataGridViewRowPostPaintEventArgs.cs
- ImageSourceValueSerializer.cs
- DllNotFoundException.cs
- InputLanguageEventArgs.cs
- SiteMapPath.cs
- Util.cs
- FtpWebResponse.cs
- ShapingWorkspace.cs
- RichListBox.cs
- DbXmlEnabledProviderManifest.cs
- DesignerHierarchicalDataSourceView.cs
- PeerNode.cs
- Model3DGroup.cs
- DateTimeOffset.cs
- RawUIStateInputReport.cs
- DataError.cs
- UnsignedPublishLicense.cs
- DocumentCollection.cs
- WsatServiceCertificate.cs
- ApplicationFileParser.cs
- DispatchChannelSink.cs
- TableNameAttribute.cs
- ModelUIElement3D.cs
- BinaryParser.cs
- ResourceWriter.cs
- AsymmetricKeyExchangeFormatter.cs
- StreamBodyWriter.cs
- TagPrefixAttribute.cs
- DataGridViewDataErrorEventArgs.cs
- StorageMappingFragment.cs
- TraceLog.cs
- XamlReader.cs
- DrawingCollection.cs
- ColorMatrix.cs
- ToolZone.cs