Code:
/ FX-1434 / FX-1434 / 1.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
- RenderDataDrawingContext.cs
- CaseExpr.cs
- Domain.cs
- ParallelTimeline.cs
- SamlAuthenticationClaimResource.cs
- WebPartCatalogCloseVerb.cs
- DetailsViewRow.cs
- OlePropertyStructs.cs
- GridViewUpdateEventArgs.cs
- __Error.cs
- InstanceContextMode.cs
- VirtualDirectoryMapping.cs
- XmlChoiceIdentifierAttribute.cs
- ValidationError.cs
- TextSearch.cs
- CallContext.cs
- RequestTimeoutManager.cs
- EventToken.cs
- SecurityManager.cs
- TextBox.cs
- ValidationSummaryDesigner.cs
- AssemblyNameUtility.cs
- JavaScriptString.cs
- QilList.cs
- InstanceHandle.cs
- SecurityKeyIdentifierClause.cs
- RemotingConfigParser.cs
- ContractBase.cs
- CompleteWizardStep.cs
- SearchForVirtualItemEventArgs.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- SAPICategories.cs
- MetadataCache.cs
- PropertyGeneratedEventArgs.cs
- MetadataArtifactLoaderCompositeFile.cs
- Perspective.cs
- TimeoutException.cs
- ObjectToken.cs
- DoubleConverter.cs
- WebPartConnectionCollection.cs
- MeasurementDCInfo.cs
- TraceXPathNavigator.cs
- DriveNotFoundException.cs
- MetadataArtifactLoader.cs
- SmtpAuthenticationManager.cs
- PagePropertiesChangingEventArgs.cs
- BrowserDefinition.cs
- RightsManagementEncryptedStream.cs
- ImageAttributes.cs
- TextTreeRootTextBlock.cs
- SessionViewState.cs
- ToggleProviderWrapper.cs
- IImplicitResourceProvider.cs
- DBDataPermissionAttribute.cs
- MergeFailedEvent.cs
- BasePropertyDescriptor.cs
- Floater.cs
- UnaryNode.cs
- externdll.cs
- ExtensionWindow.cs
- DragSelectionMessageFilter.cs
- TemplateComponentConnector.cs
- DXD.cs
- ResourceExpression.cs
- ClickablePoint.cs
- IListConverters.cs
- XPathDocumentIterator.cs
- FrameworkContextData.cs
- GridView.cs
- TypedAsyncResult.cs
- Tokenizer.cs
- NotificationContext.cs
- HandlerFactoryWrapper.cs
- MergablePropertyAttribute.cs
- Not.cs
- FocusManager.cs
- XamlVector3DCollectionSerializer.cs
- Part.cs
- CombinedGeometry.cs
- HttpConfigurationContext.cs
- XPathSelectionIterator.cs
- OneOf.cs
- DataGridRelationshipRow.cs
- UserControl.cs
- FrugalMap.cs
- EncodingDataItem.cs
- mda.cs
- EmbeddedMailObjectsCollection.cs
- TextDecorationUnitValidation.cs
- ActivityDesigner.cs
- MessageSecurityOverTcpElement.cs
- SimpleParser.cs
- ReflectionPermission.cs
- Section.cs
- RemotingSurrogateSelector.cs
- Internal.cs
- EntityWithChangeTrackerStrategy.cs
- VerificationException.cs
- DrawingBrush.cs
- XmlAttributeCollection.cs