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
- EventHandlerList.cs
- HebrewNumber.cs
- SystemParameters.cs
- MobileUITypeEditor.cs
- VirtualPathProvider.cs
- _AutoWebProxyScriptWrapper.cs
- ReflectPropertyDescriptor.cs
- AuthenticationModulesSection.cs
- ServiceBusyException.cs
- AppDomainProtocolHandler.cs
- NonBatchDirectoryCompiler.cs
- RbTree.cs
- UdpTransportBindingElement.cs
- CharEntityEncoderFallback.cs
- ExternalFile.cs
- LassoHelper.cs
- TypefaceCollection.cs
- DataGridViewCheckBoxColumn.cs
- userdatakeys.cs
- StylusEditingBehavior.cs
- ScriptControlDescriptor.cs
- ViewValidator.cs
- BrowserDefinition.cs
- TraceHandlerErrorFormatter.cs
- TabPage.cs
- BoolExpr.cs
- DataGridViewComboBoxEditingControl.cs
- HtmlTableRow.cs
- HttpCacheVaryByContentEncodings.cs
- Int32.cs
- DataSourceGroupCollection.cs
- SQLInt32Storage.cs
- CryptoHelper.cs
- ColumnMapProcessor.cs
- XmlnsCache.cs
- SystemColors.cs
- PassportAuthentication.cs
- XamlNamespaceHelper.cs
- TabControl.cs
- WebEventTraceProvider.cs
- ResolveNextArgumentWorkItem.cs
- FixedSOMTable.cs
- KerberosSecurityTokenProvider.cs
- ScrollEvent.cs
- ColorTransform.cs
- CustomErrorsSection.cs
- AstNode.cs
- HttpListenerContext.cs
- Merger.cs
- DesignBindingConverter.cs
- FacetEnabledSchemaElement.cs
- ComboBoxDesigner.cs
- DeviceContext.cs
- Image.cs
- CharacterMetrics.cs
- DispatcherHooks.cs
- _ContextAwareResult.cs
- ExceptionUtil.cs
- ImageAutomationPeer.cs
- TemplateControlBuildProvider.cs
- DesignerCategoryAttribute.cs
- SqlCharStream.cs
- Canvas.cs
- SqlCacheDependencyDatabase.cs
- CalendarModeChangedEventArgs.cs
- ExtensionWindow.cs
- UInt16Storage.cs
- ExtendedProtectionPolicyElement.cs
- SplineQuaternionKeyFrame.cs
- DataGridRowAutomationPeer.cs
- LocatorBase.cs
- ToolBarButton.cs
- ReadOnlyDataSourceView.cs
- GacUtil.cs
- WebBrowserProgressChangedEventHandler.cs
- XsdBuildProvider.cs
- DrawingServices.cs
- DbInsertCommandTree.cs
- CngUIPolicy.cs
- ISCIIEncoding.cs
- WorkflowRuntimeService.cs
- NopReturnReader.cs
- SimpleFileLog.cs
- ExtensionFile.cs
- FusionWrap.cs
- Vector3DValueSerializer.cs
- WebBaseEventKeyComparer.cs
- BaseProcessor.cs
- SchemaImporterExtensionsSection.cs
- CustomPopupPlacement.cs
- AssertSection.cs
- FontEmbeddingManager.cs
- TextTreeDeleteContentUndoUnit.cs
- AttachedPropertyBrowsableAttribute.cs
- TextDecoration.cs
- RepeatInfo.cs
- UnsupportedPolicyOptionsException.cs
- MergeFailedEvent.cs
- AsymmetricKeyExchangeFormatter.cs
- MonthChangedEventArgs.cs