Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMapViewHandle.cs / 1305376 / 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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.Machine)] internal static extern SafeFileMapViewHandle MapViewOfFile(SafeFileMappingHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ResourceExposure(ResourceScope.None)] [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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RowTypePropertyElement.cs
- UpDownEvent.cs
- EntityDataSourceWrapper.cs
- MsmqUri.cs
- MailWebEventProvider.cs
- __TransparentProxy.cs
- TextDecorationCollection.cs
- SharedDp.cs
- sqlmetadatafactory.cs
- WindowsSpinner.cs
- FormatControl.cs
- TypeRefElement.cs
- ConstrainedGroup.cs
- BitmapInitialize.cs
- ProxyGenerator.cs
- RoutedEventValueSerializer.cs
- SessionStateSection.cs
- DiscoveryInnerClientManaged11.cs
- Positioning.cs
- Inflater.cs
- TextOnlyOutput.cs
- DateTimeFormatInfo.cs
- DbDataAdapter.cs
- ServerValidateEventArgs.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- EpmCustomContentWriterNodeData.cs
- ResumeStoryboard.cs
- SqlCacheDependencySection.cs
- ResourceDictionary.cs
- MenuItemCollection.cs
- DependencyObjectPropertyDescriptor.cs
- SqlMetaData.cs
- WindowsIdentity.cs
- TextAction.cs
- TransactionScope.cs
- keycontainerpermission.cs
- SiblingIterators.cs
- LogicalExpressionTypeConverter.cs
- GridPatternIdentifiers.cs
- CompensatableTransactionScopeActivityDesigner.cs
- SimpleWorkerRequest.cs
- SchemaElementLookUpTableEnumerator.cs
- DifferencingCollection.cs
- EndpointAddressProcessor.cs
- KeyMatchBuilder.cs
- DummyDataSource.cs
- XmlStreamStore.cs
- CombinedGeometry.cs
- odbcmetadatafactory.cs
- TextTreeUndo.cs
- MaterialCollection.cs
- WebColorConverter.cs
- PersonalizationStateInfo.cs
- MediaCommands.cs
- HybridObjectCache.cs
- SqlRowUpdatedEvent.cs
- HMAC.cs
- ClientUrlResolverWrapper.cs
- ScriptBehaviorDescriptor.cs
- TreeView.cs
- ServerReliableChannelBinder.cs
- PropertyDescriptorComparer.cs
- ExpressionDumper.cs
- DataKey.cs
- unsafenativemethodstextservices.cs
- WebScriptMetadataFormatter.cs
- SafeNativeMethods.cs
- SplitContainer.cs
- CultureNotFoundException.cs
- SiteMapNode.cs
- ObjectStateFormatter.cs
- Version.cs
- Registry.cs
- BypassElement.cs
- DomNameTable.cs
- EventSinkActivity.cs
- WSDualHttpBindingElement.cs
- WindowsHyperlink.cs
- List.cs
- RMEnrollmentPage1.cs
- HttpModuleActionCollection.cs
- InvokerUtil.cs
- NativeMethods.cs
- ClonableStack.cs
- TrackingMemoryStreamFactory.cs
- tooltip.cs
- TreeNodeConverter.cs
- SqlDataRecord.cs
- ObjectItemConventionAssemblyLoader.cs
- BitmapSizeOptions.cs
- DrawingGroup.cs
- ModifiableIteratorCollection.cs
- SiteMapNodeItem.cs
- PerspectiveCamera.cs
- XamlHostingSection.cs
- UIElement.cs
- PreDigestedSignedInfo.cs
- CodeVariableDeclarationStatement.cs
- NetStream.cs
- DBParameter.cs