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
- FragmentQuery.cs
- FixedPosition.cs
- EventDescriptor.cs
- SqlBinder.cs
- TreeNodeConverter.cs
- XhtmlBasicPhoneCallAdapter.cs
- CursorConverter.cs
- RawTextInputReport.cs
- MaskedTextProvider.cs
- ApplicationGesture.cs
- AssertHelper.cs
- GACMembershipCondition.cs
- GreenMethods.cs
- AgileSafeNativeMemoryHandle.cs
- SByte.cs
- LinkLabelLinkClickedEvent.cs
- EncoderParameter.cs
- MemberPathMap.cs
- BindingsCollection.cs
- SafeLocalMemHandle.cs
- PageStatePersister.cs
- InputMethod.cs
- Rule.cs
- ListViewUpdatedEventArgs.cs
- SQLInt16Storage.cs
- XmlDocumentViewSchema.cs
- JsonFormatGeneratorStatics.cs
- XPathException.cs
- panel.cs
- MouseActionConverter.cs
- WebPartConnectionsConfigureVerb.cs
- IPAddressCollection.cs
- NumberSubstitution.cs
- FunctionDescription.cs
- ResourceWriter.cs
- ListViewSortEventArgs.cs
- MdImport.cs
- StorageTypeMapping.cs
- CompilationAssemblyInstallComponent.cs
- FamilyTypefaceCollection.cs
- StorageModelBuildProvider.cs
- UserMapPath.cs
- StringUtil.cs
- InvokePattern.cs
- HostingEnvironmentWrapper.cs
- Types.cs
- AnonymousIdentificationSection.cs
- OutputWindow.cs
- DeobfuscatingStream.cs
- OracleInfoMessageEventArgs.cs
- MenuCommandService.cs
- ImageDrawing.cs
- ServicePoint.cs
- WebMethodAttribute.cs
- Clipboard.cs
- PackageRelationshipSelector.cs
- PropertyRecord.cs
- LambdaCompiler.Unary.cs
- input.cs
- IssuedTokenClientElement.cs
- XhtmlBasicCommandAdapter.cs
- ProfilePropertyNameValidator.cs
- LinkDesigner.cs
- DateTimeSerializationSection.cs
- IconBitmapDecoder.cs
- OrderedDictionaryStateHelper.cs
- SpellerInterop.cs
- XmlReflectionMember.cs
- XmlNodeComparer.cs
- SevenBitStream.cs
- PersianCalendar.cs
- SplitterCancelEvent.cs
- DrawingContextDrawingContextWalker.cs
- InvokeMethodDesigner.xaml.cs
- ConfigurationManager.cs
- ObjectMemberMapping.cs
- MethodCallExpression.cs
- smtppermission.cs
- SelectionList.cs
- CodeTryCatchFinallyStatement.cs
- Brush.cs
- PropertyItemInternal.cs
- linebase.cs
- NativeBuffer.cs
- MethodBuilder.cs
- Blend.cs
- EditCommandColumn.cs
- InvalidComObjectException.cs
- XmlCodeExporter.cs
- ExternalFile.cs
- OpenTypeCommon.cs
- BaseHashHelper.cs
- TextModifierScope.cs
- NamedPipeTransportManager.cs
- PostBackOptions.cs
- AutomationPropertyInfo.cs
- JoinTreeNode.cs
- GroupBoxAutomationPeer.cs
- QilStrConcat.cs
- StylusPointPropertyId.cs