Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ // 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
- SmiTypedGetterSetter.cs
- MediaPlayerState.cs
- CryptoStream.cs
- _LocalDataStoreMgr.cs
- DSACryptoServiceProvider.cs
- CompiledRegexRunner.cs
- WebServiceTypeData.cs
- Stroke.cs
- WebService.cs
- ToolStripMenuItem.cs
- RijndaelManagedTransform.cs
- OrderedEnumerableRowCollection.cs
- TableRowGroup.cs
- SharedConnectionWorkflowTransactionService.cs
- TraceLog.cs
- DiscoveryClientDocuments.cs
- XslAstAnalyzer.cs
- InvokeCompletedEventArgs.cs
- DataStorage.cs
- FocusManager.cs
- Material.cs
- RuntimeHandles.cs
- Normalization.cs
- RecognizeCompletedEventArgs.cs
- Propagator.ExtentPlaceholderCreator.cs
- HealthMonitoringSection.cs
- RegexWriter.cs
- SessionStateModule.cs
- ISFTagAndGuidCache.cs
- InvalidOleVariantTypeException.cs
- HtmlMeta.cs
- ContainerAction.cs
- PackagingUtilities.cs
- CommandID.cs
- Automation.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- SurrogateSelector.cs
- Documentation.cs
- AssemblyEvidenceFactory.cs
- CreateUserWizardDesigner.cs
- ObjectItemConventionAssemblyLoader.cs
- RenderOptions.cs
- ResourceContainer.cs
- RoleGroupCollection.cs
- HTTPAPI_VERSION.cs
- CommandEventArgs.cs
- DateTimeParse.cs
- FormViewPagerRow.cs
- ListBoxAutomationPeer.cs
- CompositeFontFamily.cs
- OdbcHandle.cs
- XmlAttributeOverrides.cs
- LinqDataSourceDisposeEventArgs.cs
- SHA512.cs
- ExpandCollapsePattern.cs
- PrivacyNoticeBindingElement.cs
- FunctionGenerator.cs
- ZipIOBlockManager.cs
- AlternateView.cs
- AssemblyInfo.cs
- SingleObjectCollection.cs
- RegistryPermission.cs
- BitmapData.cs
- TextDecoration.cs
- ReadOnlyDictionary.cs
- _ServiceNameStore.cs
- ConstNode.cs
- XmlSchemaAny.cs
- ComboBoxRenderer.cs
- RepeaterItem.cs
- TextPointerBase.cs
- AssemblyUtil.cs
- DelayLoadType.cs
- SplayTreeNode.cs
- FixedSOMTable.cs
- ProfileService.cs
- HelpKeywordAttribute.cs
- WebPartZoneBase.cs
- ApplicationGesture.cs
- FontWeight.cs
- SolidBrush.cs
- SystemUnicastIPAddressInformation.cs
- DbTypeMap.cs
- ObjectToken.cs
- ByteAnimationBase.cs
- EpmSourcePathSegment.cs
- TimersDescriptionAttribute.cs
- WindowsGraphics2.cs
- NonNullItemCollection.cs
- EncryptedPackageFilter.cs
- SudsParser.cs
- RadioButton.cs
- BamlTreeMap.cs
- VirtualDirectoryMappingCollection.cs
- FormViewDesigner.cs
- EventManager.cs
- HtmlValidationSummaryAdapter.cs
- xml.cs
- SafeSecurityHelper.cs
- TableAutomationPeer.cs