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
- XmlElement.cs
- EncryptedXml.cs
- NameScope.cs
- HttpInputStream.cs
- TdsParserSafeHandles.cs
- OutputChannelBinder.cs
- SignatureToken.cs
- LinqDataSourceEditData.cs
- IncrementalHitTester.cs
- ToolStripStatusLabel.cs
- DataPager.cs
- RoleGroupCollection.cs
- AuthenticateEventArgs.cs
- BufferedGraphicsManager.cs
- PeerToPeerException.cs
- CompareValidator.cs
- MutexSecurity.cs
- ServiceDescriptionSerializer.cs
- InvalidProgramException.cs
- DotExpr.cs
- TaiwanCalendar.cs
- ErrorFormatter.cs
- Rect3DConverter.cs
- HttpServerVarsCollection.cs
- TableRowCollection.cs
- MarshalByValueComponent.cs
- ToolStripPanelCell.cs
- TitleStyle.cs
- MouseButton.cs
- FixedDSBuilder.cs
- BufferedMessageData.cs
- Exceptions.cs
- SubstitutionList.cs
- MenuItemStyleCollection.cs
- MSAANativeProvider.cs
- InkPresenterAutomationPeer.cs
- XamlHostingSectionGroup.cs
- ToolStripSeparator.cs
- HttpDebugHandler.cs
- Misc.cs
- BuilderPropertyEntry.cs
- DataGridViewTopRowAccessibleObject.cs
- ConfigXmlWhitespace.cs
- GridPatternIdentifiers.cs
- WebServicesSection.cs
- ChangeNode.cs
- OuterGlowBitmapEffect.cs
- MobileFormsAuthentication.cs
- MenuItem.cs
- XmlSchemaParticle.cs
- MessageFilterException.cs
- DataServiceQuery.cs
- safelink.cs
- XmlSchemaNotation.cs
- ObjectSet.cs
- TableCell.cs
- DataServices.cs
- StickyNoteContentControl.cs
- CryptoApi.cs
- BinaryUtilClasses.cs
- RequestCachingSection.cs
- SaveFileDialog.cs
- ReceiveCompletedEventArgs.cs
- AutomationPeer.cs
- Soap12ProtocolImporter.cs
- XmlAnyElementAttribute.cs
- PeerHelpers.cs
- EditorPart.cs
- WebRequestModulesSection.cs
- HttpContext.cs
- PropertyDescriptorComparer.cs
- mactripleDES.cs
- DataFormats.cs
- ContentTextAutomationPeer.cs
- ColorAnimation.cs
- UnaryNode.cs
- SimpleHandlerFactory.cs
- PEFileReader.cs
- CriticalFinalizerObject.cs
- NativeMethods.cs
- PopupRootAutomationPeer.cs
- XmlSchemaComplexContentRestriction.cs
- CodeDirectoryCompiler.cs
- Selector.cs
- RoutedUICommand.cs
- FixedSOMPage.cs
- InternalTypeHelper.cs
- CodeAccessPermission.cs
- Matrix3D.cs
- ContentOperations.cs
- StylusCaptureWithinProperty.cs
- followingquery.cs
- COAUTHINFO.cs
- RootAction.cs
- AppDomainFactory.cs
- WmpBitmapDecoder.cs
- ListBase.cs
- WorkflowRuntimeService.cs
- RoleManagerSection.cs
- InvokeGenerator.cs