Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Win32 / SafeHandles / SafeMemoryMappedViewHandle.cs / 1305376 / SafeMemoryMappedViewHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeMemoryMappedViewHandle ** ** Purpose: Safe handle wrapping a MMF view pointer ** ** Date: February 7, 2007 ** ===========================================================*/ using System; using System.Runtime.InteropServices; 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 SafeMemoryMappedViewHandle : SafeBuffer { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedViewHandle() : base(true) { } [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedViewHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) { base.SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { if (UnsafeNativeMethods.UnmapViewOfFile(handle)) { handle = IntPtr.Zero; return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeMemoryMappedViewHandle ** ** Purpose: Safe handle wrapping a MMF view pointer ** ** Date: February 7, 2007 ** ===========================================================*/ using System; using System.Runtime.InteropServices; 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 SafeMemoryMappedViewHandle : SafeBuffer { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedViewHandle() : base(true) { } [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedViewHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) { base.SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { if (UnsafeNativeMethods.UnmapViewOfFile(handle)) { handle = IntPtr.Zero; return true; } return false; } } } // 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
- ContextStack.cs
- XPathMessageFilterTable.cs
- IndependentAnimationStorage.cs
- EnumerableValidator.cs
- DescendantQuery.cs
- DataGridRowHeader.cs
- ECDsa.cs
- ByteStorage.cs
- XslCompiledTransform.cs
- XmlProcessingInstruction.cs
- DiagnosticStrings.cs
- X509ChainPolicy.cs
- AnnotationService.cs
- TaskForm.cs
- DbParameterCollectionHelper.cs
- RotateTransform3D.cs
- DocumentViewer.cs
- CompiledQueryCacheKey.cs
- TextViewBase.cs
- HtmlElement.cs
- UpWmlMobileTextWriter.cs
- Tuple.cs
- XmlILIndex.cs
- InlineCategoriesDocument.cs
- Stack.cs
- DataTableCollection.cs
- EntityDataSourceStatementEditor.cs
- PrivilegedConfigurationManager.cs
- DataContractSerializerSection.cs
- UrlMappingCollection.cs
- NetStream.cs
- DataTableTypeConverter.cs
- IdentifierCreationService.cs
- JpegBitmapDecoder.cs
- UInt32.cs
- _OverlappedAsyncResult.cs
- AssemblyCache.cs
- DataObjectCopyingEventArgs.cs
- DetailsViewRow.cs
- DescendantQuery.cs
- CompoundFileIOPermission.cs
- BookmarkManager.cs
- TextReader.cs
- SmtpTransport.cs
- SudsCommon.cs
- CursorInteropHelper.cs
- WebBrowser.cs
- DataGridViewCellCancelEventArgs.cs
- ImmutableClientRuntime.cs
- ArgIterator.cs
- DataGridHeaderBorder.cs
- ContentControl.cs
- ObjectStateManager.cs
- UIElementHelper.cs
- X509Utils.cs
- MappingModelBuildProvider.cs
- SelectionListComponentEditor.cs
- ByteAnimationUsingKeyFrames.cs
- ViewManager.cs
- DetailsViewModeEventArgs.cs
- OleDbConnectionFactory.cs
- ListItem.cs
- Vector3DConverter.cs
- PasswordTextContainer.cs
- StringConcat.cs
- SqlTypesSchemaImporter.cs
- Baml6ConstructorInfo.cs
- ScalarOps.cs
- FontWeights.cs
- SchemaInfo.cs
- OleDbPropertySetGuid.cs
- RowToFieldTransformer.cs
- DispatchChannelSink.cs
- StickyNote.cs
- SystemDiagnosticsSection.cs
- GlyphShapingProperties.cs
- ManagementClass.cs
- PeerTransportListenAddressValidatorAttribute.cs
- KoreanLunisolarCalendar.cs
- KeyValueConfigurationElement.cs
- WebConfigurationFileMap.cs
- AmbiguousMatchException.cs
- ArrayWithOffset.cs
- Win32MouseDevice.cs
- LayoutEvent.cs
- RegexMatchCollection.cs
- SqlCacheDependency.cs
- ConfigurationElement.cs
- Panel.cs
- BindingsCollection.cs
- ConnectionConsumerAttribute.cs
- WebUtility.cs
- XmlSchemaGroupRef.cs
- ByteArrayHelperWithString.cs
- FolderBrowserDialog.cs
- Errors.cs
- BaseParagraph.cs
- TransactionFlowProperty.cs
- ConfigurationSectionCollection.cs
- XmlSchemaComplexContent.cs