Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Win32 / SafeHandles / SafeMemoryMappedFileHandle.cs / 1305376 / SafeMemoryMappedFileHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeMemoryMappedFileHandle ** ** Purpose: Safe handle wrapping a file mapping object handle ** ** Date: Febuary 7, 2007 ** ===========================================================*/ using System; using System.Runtime.Versioning; using System.Security.Permissions; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { // Reliability notes: // ReleaseHandle has reliability guarantee of Cer.Success, as defined by SafeHandle. // It gets prepared as a CER at instance construction time. This safe handle doesn't // need to override IsInvalid because the one it inherits from // SafeHandleZeroOrMinusOneIsInvalid is correct. //// #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 public sealed class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle() : base(true) { } [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return UnsafeNativeMethods.CloseHandle(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeMemoryMappedFileHandle ** ** Purpose: Safe handle wrapping a file mapping object handle ** ** Date: Febuary 7, 2007 ** ===========================================================*/ using System; using System.Runtime.Versioning; using System.Security.Permissions; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { // Reliability notes: // ReleaseHandle has reliability guarantee of Cer.Success, as defined by SafeHandle. // It gets prepared as a CER at instance construction time. This safe handle doesn't // need to override IsInvalid because the one it inherits from // SafeHandleZeroOrMinusOneIsInvalid is correct. //// // #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 public sealed class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle() : base(true) { } [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return UnsafeNativeMethods.CloseHandle(handle); } } } // 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
- Decimal.cs
- DesignerOptionService.cs
- AssemblyBuilderData.cs
- IItemContainerGenerator.cs
- IdnMapping.cs
- QilPatternFactory.cs
- PrintPreviewDialog.cs
- ContractReference.cs
- ContainerActivationHelper.cs
- Domain.cs
- Compiler.cs
- MasterPageBuildProvider.cs
- WebBrowserDocumentCompletedEventHandler.cs
- _AutoWebProxyScriptEngine.cs
- SchemaElementLookUpTableEnumerator.cs
- ManipulationDeltaEventArgs.cs
- NullableConverter.cs
- TextServicesManager.cs
- Token.cs
- OneToOneMappingSerializer.cs
- TemplateKeyConverter.cs
- HttpCookie.cs
- EmptyStringExpandableObjectConverter.cs
- IndentedWriter.cs
- ApplicationId.cs
- controlskin.cs
- DropSource.cs
- Events.cs
- LassoHelper.cs
- ValueProviderWrapper.cs
- XPathAxisIterator.cs
- RSAPKCS1SignatureDeformatter.cs
- SkinBuilder.cs
- ProfileEventArgs.cs
- BuilderInfo.cs
- EntityDataSourceMemberPath.cs
- BuilderInfo.cs
- InternalUserCancelledException.cs
- PreApplicationStartMethodAttribute.cs
- SpeechRecognitionEngine.cs
- QilTernary.cs
- SqlVersion.cs
- Popup.cs
- HtmlInputImage.cs
- OpCodes.cs
- UnitControl.cs
- DecimalConverter.cs
- ListBox.cs
- DataServiceQueryOfT.cs
- Nodes.cs
- UrlMapping.cs
- ScopelessEnumAttribute.cs
- ProxyHwnd.cs
- ProtocolImporter.cs
- XmlAttributes.cs
- SchemaNames.cs
- BinaryParser.cs
- TimeSpanStorage.cs
- TrackingStringDictionary.cs
- TextAdaptor.cs
- ExecutionEngineException.cs
- ToolBarDesigner.cs
- HttpStreamXmlDictionaryWriter.cs
- Int16Converter.cs
- OleDbDataReader.cs
- CodeTypeDeclaration.cs
- SignedXml.cs
- TrackingConditionCollection.cs
- ConfigXmlCDataSection.cs
- StylusCollection.cs
- CheckBoxAutomationPeer.cs
- Properties.cs
- ProviderConnectionPoint.cs
- DashStyle.cs
- PenThreadPool.cs
- ListItemParagraph.cs
- GridViewDeleteEventArgs.cs
- WindowsListViewGroup.cs
- XmlDataSourceDesigner.cs
- KeyPressEvent.cs
- DependentList.cs
- NotifyCollectionChangedEventArgs.cs
- DocumentGridPage.cs
- TwoPhaseCommit.cs
- unitconverter.cs
- LongValidatorAttribute.cs
- HealthMonitoringSection.cs
- ConnectionConsumerAttribute.cs
- AsyncStreamReader.cs
- WebDescriptionAttribute.cs
- SafeReversePInvokeHandle.cs
- CodeTypeMemberCollection.cs
- ContractListAdapter.cs
- TdsParserSafeHandles.cs
- RC2.cs
- Token.cs
- ScrollBar.cs
- ProcessProtocolHandler.cs
- TextTreeNode.cs
- MessageAction.cs