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
- CellQuery.cs
- XmlUrlEditor.cs
- odbcmetadatacolumnnames.cs
- TdsParserStaticMethods.cs
- PropertyMappingExceptionEventArgs.cs
- ViewGenResults.cs
- SQLCharsStorage.cs
- SqlParameterCollection.cs
- ToolStripItemDataObject.cs
- DirectoryNotFoundException.cs
- EventWaitHandleSecurity.cs
- XmlSignificantWhitespace.cs
- TabControl.cs
- WindowProviderWrapper.cs
- AlgoModule.cs
- XmlDataSourceNodeDescriptor.cs
- ISCIIEncoding.cs
- ClipboardProcessor.cs
- EDesignUtil.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- StorageConditionPropertyMapping.cs
- RepeaterItemEventArgs.cs
- DataGridViewButtonColumn.cs
- XmlNodeChangedEventArgs.cs
- StrokeFIndices.cs
- DataSourceGroupCollection.cs
- TableHeaderCell.cs
- TreeChangeInfo.cs
- OracleTransaction.cs
- LogExtent.cs
- DrawToolTipEventArgs.cs
- Dispatcher.cs
- ComAwareEventInfo.cs
- SspiNegotiationTokenProvider.cs
- IIS7UserPrincipal.cs
- MailWriter.cs
- BufferedGraphicsManager.cs
- XmlAtomicValue.cs
- PartialTrustValidationBehavior.cs
- BlockCollection.cs
- WindowHideOrCloseTracker.cs
- Single.cs
- XmlHierarchicalDataSourceView.cs
- CalendarTable.cs
- ConvertersCollection.cs
- WorkflowWebService.cs
- BaseParagraph.cs
- XmlSchemaAttribute.cs
- FilterElement.cs
- ButtonColumn.cs
- KnownBoxes.cs
- FixedSOMContainer.cs
- SizeKeyFrameCollection.cs
- ConfigurationStrings.cs
- RegexCaptureCollection.cs
- LocalBuilder.cs
- FontFamily.cs
- DataGridViewColumn.cs
- XmlEncodedRawTextWriter.cs
- Operators.cs
- Nullable.cs
- Input.cs
- WebPartConnectionsCancelEventArgs.cs
- SoapFault.cs
- AvTrace.cs
- ScrollChrome.cs
- CompositeDesignerAccessibleObject.cs
- ToolboxComponentsCreatedEventArgs.cs
- TiffBitmapDecoder.cs
- PropertySegmentSerializationProvider.cs
- SerializationException.cs
- WebPartEditVerb.cs
- versioninfo.cs
- SelectedDatesCollection.cs
- SingleConverter.cs
- MultiAsyncResult.cs
- AttributeProviderAttribute.cs
- DCSafeHandle.cs
- SqlConnectionPoolProviderInfo.cs
- __Error.cs
- PropertyPath.cs
- BoundPropertyEntry.cs
- MimePart.cs
- CodeSnippetStatement.cs
- FormatterConverter.cs
- AdornerLayer.cs
- MinimizableAttributeTypeConverter.cs
- XPathSelectionIterator.cs
- ApplicationSecurityManager.cs
- IWorkflowDebuggerService.cs
- UnmanagedMarshal.cs
- WizardPanel.cs
- BackgroundFormatInfo.cs
- SEHException.cs
- StructuralCache.cs
- WebPartMinimizeVerb.cs
- XPathNode.cs
- PnrpPermission.cs
- DBConnectionString.cs
- Module.cs