Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StateItem.cs
- DataListItem.cs
- XMLSchema.cs
- SecurityRuntime.cs
- ReachPageContentSerializerAsync.cs
- BulletedListEventArgs.cs
- Crc32.cs
- PropertyToken.cs
- TraceAsyncResult.cs
- RSAPKCS1SignatureFormatter.cs
- DataGridViewCellCollection.cs
- CachedFontFamily.cs
- PropertyDescriptor.cs
- RequestCacheEntry.cs
- StatusBarItem.cs
- LazyInitializer.cs
- EmptyStringExpandableObjectConverter.cs
- ReadOnlyDataSource.cs
- EntityDataSourceView.cs
- ScaleTransform3D.cs
- WindowPatternIdentifiers.cs
- NaturalLanguageHyphenator.cs
- BindingList.cs
- securitycriticaldataformultiplegetandset.cs
- MetadataFile.cs
- HeaderCollection.cs
- WindowsTab.cs
- BitmapEffect.cs
- DateTime.cs
- SqlUtils.cs
- DocumentPageViewAutomationPeer.cs
- DataError.cs
- BCryptHashAlgorithm.cs
- TemplateColumn.cs
- DefaultTextStore.cs
- DataGridViewIntLinkedList.cs
- MobileListItem.cs
- FontWeight.cs
- Decoder.cs
- HttpCacheVaryByContentEncodings.cs
- SubqueryRules.cs
- Decorator.cs
- EventData.cs
- CultureInfoConverter.cs
- __Filters.cs
- DataRelationPropertyDescriptor.cs
- EntityWrapperFactory.cs
- UpWmlMobileTextWriter.cs
- MarshalByRefObject.cs
- PersistChildrenAttribute.cs
- ZipFileInfoCollection.cs
- CounterCreationData.cs
- DataGridViewDataErrorEventArgs.cs
- HMACSHA512.cs
- ComponentConverter.cs
- DateRangeEvent.cs
- SqlSelectStatement.cs
- X509CertificateEndpointIdentity.cs
- LocalTransaction.cs
- DesignTimeHTMLTextWriter.cs
- TemplateLookupAction.cs
- SystemWebCachingSectionGroup.cs
- MachineSettingsSection.cs
- SocketAddress.cs
- odbcmetadatacolumnnames.cs
- DrawingCollection.cs
- HttpCacheVary.cs
- ScrollBarRenderer.cs
- IsolatedStorageFileStream.cs
- Metafile.cs
- DataException.cs
- StringDictionaryEditor.cs
- ConfigurationSectionHelper.cs
- Repeater.cs
- ValidationEventArgs.cs
- Storyboard.cs
- UInt64.cs
- HyperLinkField.cs
- GZipDecoder.cs
- SocketElement.cs
- TagPrefixAttribute.cs
- MetadataAssemblyHelper.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- CodeDOMProvider.cs
- CalendarDay.cs
- OleStrCAMarshaler.cs
- Line.cs
- ScriptReferenceEventArgs.cs
- TransactionTraceIdentifier.cs
- Section.cs
- CodeGenerator.cs
- LambdaCompiler.Address.cs
- GeometryHitTestParameters.cs
- StringConcat.cs
- DefaultClaimSet.cs
- DiscoveryClientProtocol.cs
- UnmanagedHandle.cs
- SrgsGrammar.cs
- KeySpline.cs
- HttpWrapper.cs