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
- DataKeyArray.cs
- EntityStoreSchemaGenerator.cs
- NamespaceList.cs
- EntityStoreSchemaGenerator.cs
- SqlCommandSet.cs
- EditingCoordinator.cs
- CollectionsUtil.cs
- RegexGroup.cs
- __ConsoleStream.cs
- ToolStripRendererSwitcher.cs
- SurrogateEncoder.cs
- SmtpAuthenticationManager.cs
- SystemIPInterfaceProperties.cs
- Int32Rect.cs
- AnimationStorage.cs
- MarginsConverter.cs
- ReceiveDesigner.xaml.cs
- NativeMethods.cs
- BitmapEffectInput.cs
- WebPartEditVerb.cs
- TemplateEditingFrame.cs
- LazyTextWriterCreator.cs
- OdbcEnvironment.cs
- ValidationVisibilityAttribute.cs
- CustomCategoryAttribute.cs
- BitHelper.cs
- InvalidPrinterException.cs
- SimpleMailWebEventProvider.cs
- PartialCachingAttribute.cs
- CultureInfoConverter.cs
- ServiceControllerDesigner.cs
- PresentationSource.cs
- IdentityHolder.cs
- ProfileModule.cs
- StateRuntime.cs
- PageSetupDialog.cs
- DecimalKeyFrameCollection.cs
- GradientSpreadMethodValidation.cs
- DocumentSchemaValidator.cs
- PersonalizationAdministration.cs
- WrappedReader.cs
- EndOfStreamException.cs
- MissingSatelliteAssemblyException.cs
- DataGridItemCollection.cs
- ParsedRoute.cs
- SingleBodyParameterMessageFormatter.cs
- SafeArrayTypeMismatchException.cs
- ReflectionUtil.cs
- UserControlAutomationPeer.cs
- EntryPointNotFoundException.cs
- DbProviderFactories.cs
- BaseDataBoundControl.cs
- WindowsTitleBar.cs
- TextParagraphProperties.cs
- XmlSchemaImport.cs
- ScriptManagerProxy.cs
- StateMachineAction.cs
- path.cs
- AssemblyResourceLoader.cs
- HttpProcessUtility.cs
- HtmlElement.cs
- SHA512CryptoServiceProvider.cs
- XmlBinaryReader.cs
- TextModifier.cs
- PeerValidationBehavior.cs
- BookmarkWorkItem.cs
- SafeReversePInvokeHandle.cs
- SignedInfo.cs
- MouseGestureValueSerializer.cs
- EditorZone.cs
- AddDataControlFieldDialog.cs
- SolidColorBrush.cs
- Reference.cs
- InputLangChangeEvent.cs
- DataGridViewUtilities.cs
- Point4D.cs
- ProtocolsSection.cs
- BitmapSource.cs
- AutoResizedEvent.cs
- WebSysDescriptionAttribute.cs
- CellIdBoolean.cs
- DescendentsWalker.cs
- DocumentSignatureManager.cs
- SQlBooleanStorage.cs
- ModelPerspective.cs
- DesignerPerfEventProvider.cs
- TextTreeInsertElementUndoUnit.cs
- SafeReadContext.cs
- CodeExporter.cs
- TimersDescriptionAttribute.cs
- DataGridRowClipboardEventArgs.cs
- TextEncodedRawTextWriter.cs
- MergeFailedEvent.cs
- TextRangeSerialization.cs
- Pair.cs
- assemblycache.cs
- SQLInt64.cs
- StandardCommands.cs
- DataGridViewSelectedColumnCollection.cs
- GenericIdentity.cs