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
- HwndProxyElementProvider.cs
- SqlUnionizer.cs
- WindowsToolbar.cs
- EncodingDataItem.cs
- RedirectionProxy.cs
- StringComparer.cs
- TransactionProtocol.cs
- PEFileReader.cs
- XmlSchemaType.cs
- ColorPalette.cs
- GPRECT.cs
- Int64.cs
- x509store.cs
- ContextStack.cs
- ParseChildrenAsPropertiesAttribute.cs
- SpecialNameAttribute.cs
- RectKeyFrameCollection.cs
- AdapterDictionary.cs
- Console.cs
- ThumbAutomationPeer.cs
- DataGridViewAutoSizeModeEventArgs.cs
- WmlImageAdapter.cs
- XmlWriter.cs
- EventHandlersStore.cs
- SqlPersistenceProviderFactory.cs
- UnsafeNativeMethods.cs
- FaultPropagationRecord.cs
- ListControlBoundActionList.cs
- CompilerResults.cs
- ListViewContainer.cs
- DBParameter.cs
- CreateUserWizard.cs
- TextPointer.cs
- ExpressionPrinter.cs
- ConstraintCollection.cs
- Utility.cs
- WebPartVerbsEventArgs.cs
- GestureRecognizer.cs
- TagPrefixAttribute.cs
- MultiTouchSystemGestureLogic.cs
- Keyboard.cs
- PageStatePersister.cs
- QueryContinueDragEvent.cs
- Activator.cs
- Brush.cs
- TextRangeEdit.cs
- BamlRecordHelper.cs
- UnsafePeerToPeerMethods.cs
- DeleteHelper.cs
- StickyNoteAnnotations.cs
- RuleSetDialog.cs
- ReadOnlyCollectionBase.cs
- StringToken.cs
- SiteMapPath.cs
- ImpersonateTokenRef.cs
- StringPropertyBuilder.cs
- XNameTypeConverter.cs
- ObjectTag.cs
- GlyphRunDrawing.cs
- Funcletizer.cs
- ParentQuery.cs
- SequentialOutput.cs
- SimpleLine.cs
- PackagePartCollection.cs
- XmlSchemaRedefine.cs
- PartialTrustVisibleAssemblyCollection.cs
- OneWayChannelListener.cs
- MultiView.cs
- RelationshipEnd.cs
- TripleDESCryptoServiceProvider.cs
- AddressingProperty.cs
- SymmetricKeyWrap.cs
- MobileControlsSectionHelper.cs
- DataControlPagerLinkButton.cs
- TokenizerHelper.cs
- SqlExpressionNullability.cs
- Control.cs
- PasswordBoxAutomationPeer.cs
- XmlReflectionImporter.cs
- NetTcpSection.cs
- CultureMapper.cs
- BasicCommandTreeVisitor.cs
- WebScriptServiceHost.cs
- ControlBindingsConverter.cs
- GroupBoxRenderer.cs
- Overlapped.cs
- TextElementEnumerator.cs
- DomainConstraint.cs
- SqlClientWrapperSmiStream.cs
- WebEvents.cs
- DeliveryStrategy.cs
- FilteredAttributeCollection.cs
- TouchesOverProperty.cs
- Int16Storage.cs
- ObjectConverter.cs
- ElementHostPropertyMap.cs
- FullTextLine.cs
- JsonWriter.cs
- PrintDialogException.cs
- OperationResponse.cs