Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SystemInfo.cs
- ListBoxItemAutomationPeer.cs
- CodeValidator.cs
- VisualTreeUtils.cs
- BCryptSafeHandles.cs
- XamlSerializerUtil.cs
- CorrelationRequestContext.cs
- RuntimeEnvironment.cs
- DelayLoadType.cs
- CompiledRegexRunnerFactory.cs
- DateTimeConverter2.cs
- COM2PictureConverter.cs
- FontFamilyIdentifier.cs
- rsa.cs
- SoapServerProtocol.cs
- TabControlCancelEvent.cs
- ScrollBar.cs
- SignatureHelper.cs
- _DigestClient.cs
- MetaDataInfo.cs
- BatchParser.cs
- HotSpotCollection.cs
- Int32CollectionValueSerializer.cs
- Rotation3D.cs
- WindowsButton.cs
- WindowsStatic.cs
- WinInetCache.cs
- Vector3D.cs
- DataGridViewButtonColumn.cs
- FastEncoder.cs
- MenuEventArgs.cs
- OleDbDataReader.cs
- XPathBinder.cs
- FlowLayoutSettings.cs
- SettingsAttributes.cs
- PlacementWorkspace.cs
- ListBindingConverter.cs
- UIElement3D.cs
- PersistenceTypeAttribute.cs
- ConfigXmlCDataSection.cs
- FileSystemInfo.cs
- TimersDescriptionAttribute.cs
- JobPageOrder.cs
- HtmlTitle.cs
- App.cs
- SizeChangedEventArgs.cs
- GraphicsPath.cs
- AliasExpr.cs
- HierarchicalDataSourceControl.cs
- unsafenativemethodstextservices.cs
- EncodingInfo.cs
- AssemblyResolver.cs
- FullTextLine.cs
- SafeCertificateStore.cs
- __Error.cs
- DrawingAttributesDefaultValueFactory.cs
- LateBoundChannelParameterCollection.cs
- ModelPropertyDescriptor.cs
- SecUtil.cs
- basenumberconverter.cs
- SqlDataSourceFilteringEventArgs.cs
- TextBoxAutomationPeer.cs
- Int32Rect.cs
- TableRow.cs
- Message.cs
- LeftCellWrapper.cs
- CommentEmitter.cs
- XpsS0ValidatingLoader.cs
- CompositeFontInfo.cs
- NameGenerator.cs
- ValidationErrorCollection.cs
- ServiceTimeoutsElement.cs
- ValidationPropertyAttribute.cs
- CanExecuteRoutedEventArgs.cs
- ZoomPercentageConverter.cs
- MediaPlayer.cs
- WebPartEditorApplyVerb.cs
- ServiceReflector.cs
- SimpleType.cs
- MetaDataInfo.cs
- UDPClient.cs
- DragCompletedEventArgs.cs
- ContextProperty.cs
- SR.Designer.cs
- OutputCacheProfileCollection.cs
- ExitEventArgs.cs
- DataGridViewCellParsingEventArgs.cs
- CodeDomSerializationProvider.cs
- LogicalExpr.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- Token.cs
- Overlapped.cs
- EngineSite.cs
- InputProcessorProfiles.cs
- MethodMessage.cs
- MarshalByRefObject.cs
- CodeBlockBuilder.cs
- PrintingPermission.cs
- Matrix3DConverter.cs
- ElementUtil.cs