Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMapViewHandle.cs / 1305376 / SafeFileMapViewHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileMapViewHandle ** **Author: Brian Grunkemeyer ([....]) ** ** A wrapper for handles returned from MapViewOfFile, used ** for shared memory. ** ** Date: August 7, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeFileMapViewHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that MapViewOfFile returns 0 on failure internal SafeFileMapViewHandle() : base(true) {} [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool UnmapViewOfFile(IntPtr handle); override protected bool ReleaseHandle() { return UnmapViewOfFile(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeFileMapViewHandle ** **Author: Brian Grunkemeyer ([....]) ** ** A wrapper for handles returned from MapViewOfFile, used ** for shared memory. ** ** Date: August 7, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeFileMapViewHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that MapViewOfFile returns 0 on failure internal SafeFileMapViewHandle() : base(true) {} [DllImport(ExternDll.Kernel32, ExactSpelling=true, CharSet=CharSet.Auto)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool UnmapViewOfFile(IntPtr handle); override protected bool ReleaseHandle() { return UnmapViewOfFile(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
- XmlReaderSettings.cs
- fixedPageContentExtractor.cs
- EmptyQuery.cs
- DiscoveryClientProtocol.cs
- DoubleLinkListEnumerator.cs
- Opcode.cs
- TableItemStyle.cs
- ConfigurationUtility.cs
- SafeReversePInvokeHandle.cs
- XmlSerializerSection.cs
- MemoryMappedView.cs
- Set.cs
- ConfigXmlSignificantWhitespace.cs
- RotateTransform3D.cs
- QueryOutputWriter.cs
- CuspData.cs
- ProfilePropertySettings.cs
- GridViewCancelEditEventArgs.cs
- DataKeyCollection.cs
- ReadOnlyMetadataCollection.cs
- CheckBoxPopupAdapter.cs
- PhysicalOps.cs
- MetadataProperty.cs
- DataListCommandEventArgs.cs
- SemaphoreFullException.cs
- HwndHost.cs
- NetworkInterface.cs
- SpeakInfo.cs
- CacheAxisQuery.cs
- DecodeHelper.cs
- ProviderMetadata.cs
- SafeFileMapViewHandle.cs
- Point3D.cs
- XmlSchemaImporter.cs
- CngProvider.cs
- FontFamily.cs
- CategoryEditor.cs
- SecurityDocument.cs
- BasicKeyConstraint.cs
- ObjectManager.cs
- SelectionPattern.cs
- CompressedStack.cs
- ToolConsole.cs
- TypeValidationEventArgs.cs
- Barrier.cs
- FormsAuthenticationUserCollection.cs
- Queue.cs
- ListContractAdapter.cs
- SettingsPropertyValueCollection.cs
- TransactionScope.cs
- WindowsFormsSectionHandler.cs
- HierarchicalDataSourceControl.cs
- TypeUsage.cs
- InputManager.cs
- _NestedMultipleAsyncResult.cs
- DataPagerCommandEventArgs.cs
- EmptyStringExpandableObjectConverter.cs
- ServicePoint.cs
- ThreadInterruptedException.cs
- HierarchicalDataSourceIDConverter.cs
- ObjectViewListener.cs
- Clipboard.cs
- Int16Converter.cs
- HwndProxyElementProvider.cs
- TransformGroup.cs
- XmlSerializerSection.cs
- PointLightBase.cs
- Encoder.cs
- ColumnMapCopier.cs
- EndpointConfigContainer.cs
- GraphicsState.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- StateRuntime.cs
- HitTestResult.cs
- Transform.cs
- SqlConnectionFactory.cs
- RTTrackingProfile.cs
- X509ChainPolicy.cs
- CompilerScopeManager.cs
- Formatter.cs
- DataErrorValidationRule.cs
- HttpApplication.cs
- DataDesignUtil.cs
- TabPage.cs
- HttpGetServerProtocol.cs
- PermissionToken.cs
- XmlTextReaderImpl.cs
- SortQuery.cs
- PropertyMapper.cs
- MethodBuilderInstantiation.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- EntityConnectionStringBuilderItem.cs
- DocumentAutomationPeer.cs
- Exceptions.cs
- ControlDesignerState.cs
- ToolStripItemEventArgs.cs
- ReverseInheritProperty.cs
- CodeCommentStatement.cs
- RefreshEventArgs.cs
- FontStretches.cs