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
- WebBrowser.cs
- AttachmentService.cs
- UInt16Storage.cs
- x509store.cs
- SemaphoreFullException.cs
- TransformPatternIdentifiers.cs
- WindowsSysHeader.cs
- SubqueryRules.cs
- DesignDataSource.cs
- EmptyQuery.cs
- WindowsListViewItemStartMenu.cs
- ErrorProvider.cs
- XhtmlBasicFormAdapter.cs
- CodeIndexerExpression.cs
- GeometryCombineModeValidation.cs
- PasswordTextNavigator.cs
- ZipIOCentralDirectoryBlock.cs
- DuplicateDetector.cs
- OleDbDataAdapter.cs
- FloaterParaClient.cs
- GrammarBuilderPhrase.cs
- ContentValidator.cs
- LazyTextWriterCreator.cs
- ThreadStaticAttribute.cs
- DateTimeSerializationSection.cs
- SyntaxCheck.cs
- MailMessageEventArgs.cs
- HttpStreamMessage.cs
- DetailsViewPageEventArgs.cs
- DrawingContextWalker.cs
- WebPartDisplayModeEventArgs.cs
- Wizard.cs
- SourceFileBuildProvider.cs
- PropertyGeneratedEventArgs.cs
- ByteArrayHelperWithString.cs
- DataGridViewCheckBoxCell.cs
- StaticResourceExtension.cs
- TiffBitmapEncoder.cs
- TreeNodeBinding.cs
- ProxyGenerationError.cs
- UIElement3DAutomationPeer.cs
- WindowsGraphicsWrapper.cs
- ConditionCollection.cs
- CaseInsensitiveComparer.cs
- NotSupportedException.cs
- MailAddressCollection.cs
- OrthographicCamera.cs
- AuthorizationContext.cs
- MarkupProperty.cs
- ItemsChangedEventArgs.cs
- __Error.cs
- SecurityManager.cs
- OdbcConnectionFactory.cs
- COM2ExtendedBrowsingHandler.cs
- Condition.cs
- OneOfElement.cs
- relpropertyhelper.cs
- EnumMemberAttribute.cs
- DataGridColumnsPage.cs
- AvTraceDetails.cs
- COM2ExtendedBrowsingHandler.cs
- WindowsFormsHelpers.cs
- ResourceDictionary.cs
- StorageFunctionMapping.cs
- EdmToObjectNamespaceMap.cs
- SpecialNameAttribute.cs
- CapabilitiesUse.cs
- UInt16Converter.cs
- HostVisual.cs
- HwndAppCommandInputProvider.cs
- DataBoundControl.cs
- TextEffectCollection.cs
- CalendarAutoFormat.cs
- ExplicitDiscriminatorMap.cs
- OleDbMetaDataFactory.cs
- MediaCommands.cs
- TypedElement.cs
- securitycriticaldataClass.cs
- RSAProtectedConfigurationProvider.cs
- JoinCqlBlock.cs
- SqlClientWrapperSmiStreamChars.cs
- ViewStateException.cs
- FormViewRow.cs
- SelectionProviderWrapper.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- rsa.cs
- CriticalHandle.cs
- AsymmetricAlgorithm.cs
- Condition.cs
- MobileListItem.cs
- OracleCommandBuilder.cs
- SelectorItemAutomationPeer.cs
- DateTimeUtil.cs
- UpdateTracker.cs
- HotSpotCollection.cs
- AddInIpcChannel.cs
- _Rfc2616CacheValidators.cs
- SoapTypeAttribute.cs
- ProvidePropertyAttribute.cs
- WeakReferenceEnumerator.cs