Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigurationManagerHelper.cs
- HttpSysSettings.cs
- Attachment.cs
- ViewKeyConstraint.cs
- InlineObject.cs
- externdll.cs
- ConversionHelper.cs
- Utils.cs
- StylusDevice.cs
- XPathNavigatorKeyComparer.cs
- MdImport.cs
- WriterOutput.cs
- TextRunCache.cs
- ManagementDateTime.cs
- COM2ExtendedTypeConverter.cs
- FileNotFoundException.cs
- DisposableCollectionWrapper.cs
- StorageMappingItemLoader.cs
- MarshalDirectiveException.cs
- CompositeCollectionView.cs
- SQLBinaryStorage.cs
- SeekableMessageNavigator.cs
- HandleScope.cs
- ParameterToken.cs
- Message.cs
- InvokeWebServiceDesigner.cs
- InnerItemCollectionView.cs
- HtmlEmptyTagControlBuilder.cs
- Accessors.cs
- IDispatchConstantAttribute.cs
- InputEventArgs.cs
- XamlReaderConstants.cs
- HeaderedItemsControl.cs
- Help.cs
- TcpClientSocketManager.cs
- webproxy.cs
- Lock.cs
- SharedPersonalizationStateInfo.cs
- DbProviderFactoriesConfigurationHandler.cs
- IPEndPoint.cs
- DmlSqlGenerator.cs
- FillBehavior.cs
- CacheChildrenQuery.cs
- EntityDataSourceWrapperCollection.cs
- QilChoice.cs
- DataBindingHandlerAttribute.cs
- AnnotationHighlightLayer.cs
- CodeStatement.cs
- OdbcDataReader.cs
- ColorBlend.cs
- EventDescriptor.cs
- MimeFormReflector.cs
- Inline.cs
- WinEventHandler.cs
- DefaultValueTypeConverter.cs
- EdmItemCollection.cs
- DbConnectionStringCommon.cs
- DbProviderSpecificTypePropertyAttribute.cs
- SymmetricKeyWrap.cs
- Part.cs
- CachedPathData.cs
- SystemIcmpV6Statistics.cs
- MarkupProperty.cs
- SqlCharStream.cs
- AvtEvent.cs
- NotFiniteNumberException.cs
- DecimalConstantAttribute.cs
- DataGridSortCommandEventArgs.cs
- NodeInfo.cs
- FilterQuery.cs
- AnimatedTypeHelpers.cs
- MaskedTextBoxDesigner.cs
- userdatakeys.cs
- StylusPointPropertyId.cs
- HyperLinkDesigner.cs
- GregorianCalendar.cs
- AggregateNode.cs
- WindowsFont.cs
- InputLanguageSource.cs
- ToolStripTextBox.cs
- ConfigViewGenerator.cs
- DesignerTextWriter.cs
- XmlNamespaceDeclarationsAttribute.cs
- SectionInput.cs
- ConfigurationValue.cs
- BackEase.cs
- SparseMemoryStream.cs
- UpdateTranslator.cs
- Compress.cs
- WindowsGraphicsWrapper.cs
- ServiceModelDictionary.cs
- COM2Enum.cs
- EntityDescriptor.cs
- DataSetSchema.cs
- ProfileSettingsCollection.cs
- Page.cs
- SecondaryIndexList.cs
- PlainXmlWriter.cs
- BigInt.cs
- prompt.cs