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
- TextServicesCompartmentEventSink.cs
- XmlQuerySequence.cs
- assemblycache.cs
- IDQuery.cs
- TypeSource.cs
- ChangePasswordAutoFormat.cs
- JoinElimination.cs
- DataListItemEventArgs.cs
- Crypto.cs
- DBCommandBuilder.cs
- DetailsViewInsertedEventArgs.cs
- OutOfMemoryException.cs
- UnsafeNativeMethods.cs
- FontFamilyConverter.cs
- PDBReader.cs
- XmlArrayItemAttributes.cs
- DataObject.cs
- TrackingLocationCollection.cs
- ListManagerBindingsCollection.cs
- EncoderExceptionFallback.cs
- WorkflowControlClient.cs
- ToolboxDataAttribute.cs
- CharacterMetricsDictionary.cs
- PreviewPrintController.cs
- SecurityProtocolCorrelationState.cs
- HtmlWindowCollection.cs
- ObjectConverter.cs
- InstanceDataCollectionCollection.cs
- Type.cs
- Baml2006KeyRecord.cs
- TypeGenericEnumerableViewSchema.cs
- BackgroundWorker.cs
- DataGridTextColumn.cs
- COM2ComponentEditor.cs
- BasicHttpBindingElement.cs
- MemberDescriptor.cs
- Point4DValueSerializer.cs
- ValueUnavailableException.cs
- PathFigureCollectionConverter.cs
- SortedDictionary.cs
- ButtonFlatAdapter.cs
- Expression.cs
- PersonalizationEntry.cs
- DragDeltaEventArgs.cs
- Size3DConverter.cs
- MailDefinition.cs
- BindableAttribute.cs
- SafeMemoryMappedFileHandle.cs
- CodeNamespace.cs
- smtppermission.cs
- RequestCacheValidator.cs
- ConnectionPoolManager.cs
- AttributeCollection.cs
- SamlAuthenticationClaimResource.cs
- PageDeviceFont.cs
- DataSvcMapFile.cs
- ResourceProviderFactory.cs
- TemplateParser.cs
- EmptyImpersonationContext.cs
- BulletChrome.cs
- ChangeBlockUndoRecord.cs
- DelegatedStream.cs
- CultureInfoConverter.cs
- TimeEnumHelper.cs
- RadialGradientBrush.cs
- Int32Rect.cs
- CompiledAction.cs
- LoginUtil.cs
- DateTimeUtil.cs
- BuildManagerHost.cs
- XmlDownloadManager.cs
- MissingMethodException.cs
- ReadOnlyAttribute.cs
- GreenMethods.cs
- XmlSchemaAnyAttribute.cs
- InfiniteTimeSpanConverter.cs
- GridViewUpdatedEventArgs.cs
- OutKeywords.cs
- SQLDateTime.cs
- SqlVersion.cs
- MetadataUtilsSmi.cs
- XmlComplianceUtil.cs
- DecryptedHeader.cs
- DictionaryContent.cs
- BaseDataListDesigner.cs
- HyperLink.cs
- ToolboxBitmapAttribute.cs
- AppDomainFactory.cs
- SafeWaitHandle.cs
- CustomGrammar.cs
- DeleteIndexBinder.cs
- ApplicationHost.cs
- HyperlinkAutomationPeer.cs
- storagemappingitemcollection.viewdictionary.cs
- DefaultAuthorizationContext.cs
- StringStorage.cs
- TextBox.cs
- InlineObject.cs
- HttpDebugHandler.cs
- TextServicesHost.cs