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
- HtmlInputText.cs
- HostProtectionPermission.cs
- TimerTable.cs
- ObservableDictionary.cs
- ParagraphResult.cs
- ExpressionBuilder.cs
- UserControlDesigner.cs
- EntityConnectionStringBuilderItem.cs
- Executor.cs
- TrackingDataItemValue.cs
- WebZone.cs
- FontResourceCache.cs
- UITypeEditor.cs
- IApplicationTrustManager.cs
- RectangleGeometry.cs
- TabControlDesigner.cs
- Function.cs
- MetabaseSettingsIis7.cs
- TraceXPathNavigator.cs
- XmlMemberMapping.cs
- ObjectViewFactory.cs
- MessageLogger.cs
- ToolboxComponentsCreatedEventArgs.cs
- ColorMatrix.cs
- MessageContractImporter.cs
- TrackingMemoryStreamFactory.cs
- remotingproxy.cs
- SettingsAttributeDictionary.cs
- COM2IDispatchConverter.cs
- PageAction.cs
- ThaiBuddhistCalendar.cs
- QueryExpr.cs
- SpeechSynthesizer.cs
- ClientSettings.cs
- WebServiceBindingAttribute.cs
- recordstatefactory.cs
- AdornerDecorator.cs
- StylusPointProperties.cs
- ScrollEvent.cs
- Stopwatch.cs
- cookie.cs
- srgsitem.cs
- UnsafePeerToPeerMethods.cs
- DataGridViewCellStyleConverter.cs
- DiscoveryOperationContext.cs
- BufferedResponseStream.cs
- sitestring.cs
- TemplateControlCodeDomTreeGenerator.cs
- Pointer.cs
- PropertyIdentifier.cs
- CommentEmitter.cs
- ChangePassword.cs
- DelegateArgumentReference.cs
- safex509handles.cs
- SimpleBitVector32.cs
- AssemblyNameUtility.cs
- SqlDataSource.cs
- DataSetMappper.cs
- APCustomTypeDescriptor.cs
- WebPartManager.cs
- ArgumentOutOfRangeException.cs
- DatePickerTextBox.cs
- DataGridViewToolTip.cs
- HashJoinQueryOperatorEnumerator.cs
- TableHeaderCell.cs
- ImageSource.cs
- SqlInfoMessageEvent.cs
- HMACSHA512.cs
- XmlNamespaceDeclarationsAttribute.cs
- ValidationError.cs
- RuleSetCollection.cs
- MergePropertyDescriptor.cs
- UserControlCodeDomTreeGenerator.cs
- DataGridTextBox.cs
- FontUnitConverter.cs
- ErasingStroke.cs
- ResXFileRef.cs
- TripleDESCryptoServiceProvider.cs
- ValidationErrorInfo.cs
- DataGridColumnCollection.cs
- Ops.cs
- DbDataReader.cs
- PostBackOptions.cs
- SHA384.cs
- DialogBaseForm.cs
- NamedPermissionSet.cs
- MappingModelBuildProvider.cs
- Calendar.cs
- versioninfo.cs
- Compiler.cs
- ShaderRenderModeValidation.cs
- ParameterBinding.cs
- ToolStripGrip.cs
- SerialPinChanges.cs
- ProcessProtocolHandler.cs
- WrapPanel.cs
- ClientCultureInfo.cs
- SignatureResourcePool.cs
- DropDownButton.cs
- Events.cs