Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMapViewHandle.cs / 1 / 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; 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)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [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; 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)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [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
- PlanCompiler.cs
- CounterNameConverter.cs
- MonthCalendar.cs
- PenLineJoinValidation.cs
- Bits.cs
- HttpAsyncResult.cs
- ConnectionPointGlyph.cs
- CodeTypeConstructor.cs
- DispatcherProcessingDisabled.cs
- VirtualPathUtility.cs
- JsonWriter.cs
- ItemContainerGenerator.cs
- SmtpNetworkElement.cs
- EnumerableRowCollectionExtensions.cs
- IntegrationExceptionEventArgs.cs
- WebPartCancelEventArgs.cs
- WebBaseEventKeyComparer.cs
- PasswordPropertyTextAttribute.cs
- DataGridViewSortCompareEventArgs.cs
- FormsAuthenticationEventArgs.cs
- MissingMethodException.cs
- UInt16Storage.cs
- InternalBase.cs
- ObjectViewEntityCollectionData.cs
- SHA1CryptoServiceProvider.cs
- __Filters.cs
- xdrvalidator.cs
- UiaCoreTypesApi.cs
- SqlFileStream.cs
- FixedTextSelectionProcessor.cs
- ReadOnlyDictionary.cs
- BaseParser.cs
- BitmapEffectCollection.cs
- WebPartsPersonalization.cs
- PlatformCulture.cs
- RbTree.cs
- Group.cs
- EventSetter.cs
- PinnedBufferMemoryStream.cs
- AliasExpr.cs
- TextDecorationCollectionConverter.cs
- RectKeyFrameCollection.cs
- FieldBuilder.cs
- AddInEnvironment.cs
- UrlPath.cs
- PartialTrustValidationBehavior.cs
- SessionParameter.cs
- RootDesignerSerializerAttribute.cs
- ViewStateModeByIdAttribute.cs
- MultiTrigger.cs
- WindowPatternIdentifiers.cs
- BitmapEncoder.cs
- Cell.cs
- PixelFormat.cs
- LayoutManager.cs
- MsmqDecodeHelper.cs
- TextProviderWrapper.cs
- COM2PictureConverter.cs
- UIHelper.cs
- CaseInsensitiveComparer.cs
- UIElement3D.cs
- _BasicClient.cs
- Focus.cs
- TextOutput.cs
- EventTrigger.cs
- PathHelper.cs
- MsmqInputChannel.cs
- XmlWriter.cs
- DBCommandBuilder.cs
- EventLogPermissionEntry.cs
- ValidationRuleCollection.cs
- FixedDocumentSequencePaginator.cs
- PeerInputChannelListener.cs
- StyleHelper.cs
- MergeFailedEvent.cs
- CommandLineParser.cs
- MessagePartSpecification.cs
- __Error.cs
- DllNotFoundException.cs
- TickBar.cs
- JsonByteArrayDataContract.cs
- CompilerInfo.cs
- WebPart.cs
- ZipIOCentralDirectoryFileHeader.cs
- CacheMode.cs
- TextServicesContext.cs
- MergablePropertyAttribute.cs
- ThaiBuddhistCalendar.cs
- ToolStripProgressBar.cs
- DirtyTextRange.cs
- DelayedRegex.cs
- ObjectHandle.cs
- MetadataHelper.cs
- RefType.cs
- VirtualPath.cs
- SystemUnicastIPAddressInformation.cs
- BindingBase.cs
- Misc.cs
- WebPartCollection.cs
- XmlDigitalSignatureProcessor.cs