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
- EncoderFallback.cs
- DataGridViewAccessibleObject.cs
- XmlUTF8TextReader.cs
- _LocalDataStoreMgr.cs
- Connector.xaml.cs
- MethodCallConverter.cs
- CompiledQueryCacheEntry.cs
- PrintPreviewControl.cs
- ContextMarshalException.cs
- WebPartTransformer.cs
- GridViewRowEventArgs.cs
- FilterQueryOptionExpression.cs
- UnsafeNativeMethodsTablet.cs
- PingOptions.cs
- UrlAuthFailedErrorFormatter.cs
- KnownBoxes.cs
- RequestContext.cs
- ToolStripScrollButton.cs
- SymLanguageType.cs
- MulticastDelegate.cs
- DragEventArgs.cs
- SqlTypeConverter.cs
- OLEDB_Util.cs
- BamlBinaryReader.cs
- TableDesigner.cs
- _ConnectionGroup.cs
- FixedSOMPage.cs
- BasicHttpBindingElement.cs
- DateTimeOffset.cs
- CodeGenerator.cs
- Section.cs
- ResXResourceWriter.cs
- WebServiceTypeData.cs
- Part.cs
- NativeRecognizer.cs
- TaskDesigner.cs
- XAMLParseException.cs
- ExitEventArgs.cs
- RtfToken.cs
- SafeRsaProviderHandle.cs
- UrlAuthorizationModule.cs
- DoubleAnimationClockResource.cs
- XamlPoint3DCollectionSerializer.cs
- SessionStateUtil.cs
- TextStore.cs
- ThumbAutomationPeer.cs
- _AutoWebProxyScriptEngine.cs
- MailAddress.cs
- SqlCharStream.cs
- EntityCodeGenerator.cs
- TransformPatternIdentifiers.cs
- TypeBuilder.cs
- RotateTransform.cs
- NumericUpDownAcceleration.cs
- TypeGeneratedEventArgs.cs
- PackagingUtilities.cs
- SchemaEntity.cs
- SerializationInfo.cs
- TraceHandler.cs
- NativeMethods.cs
- SpecularMaterial.cs
- HelpKeywordAttribute.cs
- ResourceContainerWrapper.cs
- HighContrastHelper.cs
- XmlNamespaceMapping.cs
- SafeIUnknown.cs
- SqlClientPermission.cs
- DatatypeImplementation.cs
- SecurityPolicySection.cs
- IsolatedStoragePermission.cs
- BridgeDataReader.cs
- DataKey.cs
- ExpressionVisitor.cs
- Journal.cs
- ChangeDirector.cs
- FileSecurity.cs
- CalendarDay.cs
- LongValidator.cs
- DataGridItemCollection.cs
- ExceptionHandlersDesigner.cs
- ResourceReferenceExpressionConverter.cs
- MatrixTransform.cs
- XPathSelectionIterator.cs
- PageAdapter.cs
- AssemblyBuilderData.cs
- TextRangeAdaptor.cs
- LocalizeDesigner.cs
- ReliableSessionBindingElementImporter.cs
- DecoratedNameAttribute.cs
- RoutedEvent.cs
- ParentQuery.cs
- SafeNativeMemoryHandle.cs
- TableColumnCollectionInternal.cs
- PrintPageEvent.cs
- EdmProviderManifest.cs
- TypeDescriptionProvider.cs
- DeferrableContent.cs
- DataGridItemAttachedStorage.cs
- TimelineCollection.cs
- SimpleApplicationHost.cs