Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Tools / WSATConfig / Configuration / SafeIUnknown.cs / 1 / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MetricEntry.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- DataGridSortCommandEventArgs.cs
- AddingNewEventArgs.cs
- XmlAttributeAttribute.cs
- ListControlStringCollectionEditor.cs
- _AutoWebProxyScriptWrapper.cs
- LinkConverter.cs
- Path.cs
- TypeSystem.cs
- BuilderInfo.cs
- MetadataProperty.cs
- CodeEntryPointMethod.cs
- DecoderReplacementFallback.cs
- ExtractedStateEntry.cs
- InputBinder.cs
- ObsoleteAttribute.cs
- ColorAnimation.cs
- KeyFrames.cs
- HtmlSelect.cs
- UnsafeNativeMethods.cs
- ICollection.cs
- ColumnPropertiesGroup.cs
- DataGridrowEditEndingEventArgs.cs
- TimeSpan.cs
- SymmetricAlgorithm.cs
- EventRoute.cs
- XmlSchemaElement.cs
- WebSysDefaultValueAttribute.cs
- Processor.cs
- DataGridViewTextBoxColumn.cs
- UnmanagedMemoryStreamWrapper.cs
- WebPartDeleteVerb.cs
- EndpointDesigner.cs
- ArglessEventHandlerProxy.cs
- RotateTransform3D.cs
- XhtmlTextWriter.cs
- MoveSizeWinEventHandler.cs
- ScalarConstant.cs
- GenericAuthenticationEventArgs.cs
- CFStream.cs
- JpegBitmapDecoder.cs
- ConfigXmlText.cs
- CodeArgumentReferenceExpression.cs
- ClientBuildManager.cs
- BufferedReadStream.cs
- ListViewInsertionMark.cs
- IntranetCredentialPolicy.cs
- ColumnCollection.cs
- VisualBasicDesignerHelper.cs
- DictionaryChange.cs
- Properties.cs
- LassoHelper.cs
- UserControlBuildProvider.cs
- TextParagraph.cs
- PathSegment.cs
- WinEventQueueItem.cs
- GeneratedView.cs
- messageonlyhwndwrapper.cs
- QuaternionRotation3D.cs
- FontUnitConverter.cs
- ClientTarget.cs
- ToolStripSettings.cs
- ComponentResourceKeyConverter.cs
- VarRemapper.cs
- TypeExtensionConverter.cs
- _KerberosClient.cs
- BitSet.cs
- XmlSchemaObjectTable.cs
- PerformanceCounterPermission.cs
- ExecutionEngineException.cs
- SchemaImporter.cs
- LabelExpression.cs
- WeakReferenceList.cs
- DoubleAnimationUsingKeyFrames.cs
- Constants.cs
- DoubleLinkList.cs
- VisualProxy.cs
- FileChangesMonitor.cs
- XsltException.cs
- BufferAllocator.cs
- AsyncInvokeContext.cs
- PlanCompilerUtil.cs
- GridViewCancelEditEventArgs.cs
- PlainXmlSerializer.cs
- SpoolingTaskBase.cs
- RealProxy.cs
- SchemaAttDef.cs
- XmlSchemaSimpleType.cs
- InitializeCorrelation.cs
- StringConcat.cs
- WebPartZoneCollection.cs
- EllipseGeometry.cs
- TextViewSelectionProcessor.cs
- BamlRecordHelper.cs
- GradientStopCollection.cs
- ConsoleCancelEventArgs.cs
- DataColumnMapping.cs
- PermissionSetEnumerator.cs
- Matrix3D.cs