Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- Attributes.cs
- NumberAction.cs
- WebPartHeaderCloseVerb.cs
- Marshal.cs
- PrintDialogDesigner.cs
- SoapSchemaExporter.cs
- SoapAttributeAttribute.cs
- BCLDebug.cs
- QilVisitor.cs
- NullReferenceException.cs
- UnsafePeerToPeerMethods.cs
- Stackframe.cs
- DbDataSourceEnumerator.cs
- relpropertyhelper.cs
- KnownColorTable.cs
- SerializationStore.cs
- ServiceOperation.cs
- ReadOnlyAttribute.cs
- SynchronizingStream.cs
- PropertyHelper.cs
- PerspectiveCamera.cs
- DefaultSettingsSection.cs
- SmiGettersStream.cs
- SqlParameter.cs
- PostBackOptions.cs
- NameSpaceEvent.cs
- ObjectStateEntryDbDataRecord.cs
- TableCell.cs
- OracleException.cs
- EnumerationRangeValidationUtil.cs
- PlainXmlWriter.cs
- DataGridViewRow.cs
- PersianCalendar.cs
- CfgRule.cs
- WindowsSolidBrush.cs
- ProcessThread.cs
- BackgroundFormatInfo.cs
- MenuItem.cs
- ILGenerator.cs
- filewebresponse.cs
- DataGridViewCellFormattingEventArgs.cs
- StopStoryboard.cs
- SequentialUshortCollection.cs
- InternalResources.cs
- DocumentGrid.cs
- TypeUtils.cs
- XmlQuerySequence.cs
- Journaling.cs
- XslAst.cs
- SqlMetaData.cs
- StringBlob.cs
- XPathDocumentNavigator.cs
- TextMessageEncoder.cs
- MethodBuilder.cs
- TypeBrowser.xaml.cs
- EntityUtil.cs
- ConfigurationManagerHelperFactory.cs
- CodeTypeOfExpression.cs
- SqlXmlStorage.cs
- Matrix3DValueSerializer.cs
- NamespaceDisplayAutomationPeer.cs
- WindowProviderWrapper.cs
- ScalarRestriction.cs
- SerializationException.cs
- LayoutDump.cs
- SelectingProviderEventArgs.cs
- ControlTemplate.cs
- wmiprovider.cs
- FontStyles.cs
- BuildProviderCollection.cs
- ThreadAttributes.cs
- XmlMembersMapping.cs
- FullTextBreakpoint.cs
- NameValueFileSectionHandler.cs
- NativeMethodsOther.cs
- MenuItemCollectionEditor.cs
- AtomServiceDocumentSerializer.cs
- XmlDomTextWriter.cs
- Button.cs
- TraceSwitch.cs
- HttpCachePolicyElement.cs
- QilChoice.cs
- InstanceDataCollection.cs
- TextRangeBase.cs
- WindowsBrush.cs
- StringResourceManager.cs
- CalendarAutoFormatDialog.cs
- RowToFieldTransformer.cs
- _NegoStream.cs
- SkipStoryboardToFill.cs
- BinaryObjectReader.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- WebRequest.cs
- EndOfStreamException.cs
- WindowInteropHelper.cs
- MonthCalendar.cs
- MruCache.cs
- XsdValidatingReader.cs
- SystemNetworkInterface.cs
- WindowsClaimSet.cs