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
- FastEncoder.cs
- EndpointAddressElementBase.cs
- NetCodeGroup.cs
- DocumentOrderQuery.cs
- GridErrorDlg.cs
- DayRenderEvent.cs
- DeflateStream.cs
- datacache.cs
- CatalogZone.cs
- EllipseGeometry.cs
- SqlCacheDependencyDatabaseCollection.cs
- ConnectionStringsExpressionBuilder.cs
- DNS.cs
- NamespaceEmitter.cs
- RemoteHelper.cs
- Int64.cs
- AllMembershipCondition.cs
- PersonalizableTypeEntry.cs
- FilteredXmlReader.cs
- XmlSchemaAnyAttribute.cs
- _FtpControlStream.cs
- Helper.cs
- AddInIpcChannel.cs
- ByeMessageApril2005.cs
- AudioFormatConverter.cs
- TransportBindingElementImporter.cs
- Int32RectConverter.cs
- BaseTemplateParser.cs
- ICollection.cs
- OledbConnectionStringbuilder.cs
- Crc32.cs
- TdsValueSetter.cs
- WarningException.cs
- SqlInternalConnection.cs
- SamlAuthorizationDecisionClaimResource.cs
- ZoneIdentityPermission.cs
- ModulesEntry.cs
- FixedSOMTextRun.cs
- Bezier.cs
- WebPartActionVerb.cs
- RowsCopiedEventArgs.cs
- GenericAuthenticationEventArgs.cs
- ISAPIApplicationHost.cs
- SafeRegistryKey.cs
- FixedSOMTextRun.cs
- FixedSOMTable.cs
- CroppedBitmap.cs
- XmlChildEnumerator.cs
- DelegatingTypeDescriptionProvider.cs
- XPathNodeInfoAtom.cs
- AssertFilter.cs
- UIElementIsland.cs
- HeaderedContentControl.cs
- GridItem.cs
- SiteMapNodeItem.cs
- XPathNavigatorException.cs
- ReflectTypeDescriptionProvider.cs
- WSHttpBinding.cs
- SHA1.cs
- Attachment.cs
- CompilerWrapper.cs
- CurrencyManager.cs
- DispatcherHooks.cs
- UnsafeNativeMethods.cs
- MsmqInputSessionChannelListener.cs
- AttributeUsageAttribute.cs
- DbParameterHelper.cs
- TreeNodeConverter.cs
- SqlDataSourceQueryEditorForm.cs
- SplashScreen.cs
- SingleStorage.cs
- DLinqDataModelProvider.cs
- XmlObjectSerializerWriteContext.cs
- JumpItem.cs
- TreeViewImageKeyConverter.cs
- FunctionImportMapping.cs
- ToolStripContainer.cs
- ServiceMetadataContractBehavior.cs
- ServiceMetadataExtension.cs
- Switch.cs
- TimeIntervalCollection.cs
- ConnectivityStatus.cs
- ModifiableIteratorCollection.cs
- TextEditorSelection.cs
- StylusButton.cs
- TPLETWProvider.cs
- AppSettingsExpressionEditor.cs
- SerializationHelper.cs
- DocumentXPathNavigator.cs
- Line.cs
- NetworkInformationPermission.cs
- InputLangChangeEvent.cs
- ListItemConverter.cs
- DataBindingValueUIHandler.cs
- FullTextState.cs
- FileAuthorizationModule.cs
- CodeSubDirectory.cs
- NetTcpBindingElement.cs
- CommandArguments.cs
- OneOfScalarConst.cs