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
- SystemException.cs
- CommandBinding.cs
- RegexRunnerFactory.cs
- TextEditorLists.cs
- LayoutTableCell.cs
- PropertyPushdownHelper.cs
- TextChangedEventArgs.cs
- ChtmlTextWriter.cs
- SafeRightsManagementQueryHandle.cs
- SupportsPreviewControlAttribute.cs
- ViewManager.cs
- TableRowCollection.cs
- WizardSideBarListControlItem.cs
- EventLogPermissionHolder.cs
- FunctionCommandText.cs
- SqlDataSourceView.cs
- SpecialNameAttribute.cs
- DoWorkEventArgs.cs
- RelationshipDetailsCollection.cs
- TreeNodeCollectionEditor.cs
- StateBag.cs
- RenderDataDrawingContext.cs
- StylusPlugin.cs
- RegularExpressionValidator.cs
- WSSecurityPolicy12.cs
- DataGridViewAutoSizeModeEventArgs.cs
- SystemKeyConverter.cs
- Rotation3D.cs
- HtmlLink.cs
- RecognizedWordUnit.cs
- LinearGradientBrush.cs
- ElementHostAutomationPeer.cs
- MarkupProperty.cs
- UIntPtr.cs
- NonParentingControl.cs
- RepeatBehaviorConverter.cs
- CommandCollectionEditor.cs
- AgileSafeNativeMemoryHandle.cs
- RtType.cs
- PreviewKeyDownEventArgs.cs
- BackoffTimeoutHelper.cs
- GetWinFXPath.cs
- Style.cs
- XmlTextReaderImplHelpers.cs
- EDesignUtil.cs
- InputBindingCollection.cs
- SmiGettersStream.cs
- LingerOption.cs
- ValueUnavailableException.cs
- WebPartCancelEventArgs.cs
- SystemIPInterfaceStatistics.cs
- RecipientInfo.cs
- SoapMessage.cs
- HttpCachePolicy.cs
- WizardStepBase.cs
- TransactionBridge.cs
- PropertyBuilder.cs
- MetadataCollection.cs
- CurrentChangingEventArgs.cs
- DocumentViewerAutomationPeer.cs
- GestureRecognitionResult.cs
- Figure.cs
- MessageQueueConverter.cs
- GlyphRunDrawing.cs
- WindowsStreamSecurityUpgradeProvider.cs
- PathFigureCollectionValueSerializer.cs
- ToolStripItemClickedEventArgs.cs
- OracleColumn.cs
- UnauthorizedWebPart.cs
- ListItemConverter.cs
- CompiledQuery.cs
- Triangle.cs
- WinInet.cs
- EntityDataSourceChangingEventArgs.cs
- Listbox.cs
- Stroke2.cs
- RowToParametersTransformer.cs
- NonParentingControl.cs
- MultilineStringConverter.cs
- SemanticResultValue.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- HighlightComponent.cs
- SchemaManager.cs
- MappingMetadataHelper.cs
- Int16.cs
- BamlRecordWriter.cs
- Pair.cs
- LinearGradientBrush.cs
- SafeProcessHandle.cs
- WebRequestModuleElementCollection.cs
- AssemblyAttributesGoHere.cs
- HttpResponseMessageProperty.cs
- SecurityTokenResolver.cs
- SkewTransform.cs
- PageSettings.cs
- GenericTypeParameterBuilder.cs
- FontStyleConverter.cs
- PriorityChain.cs
- ExtendedProtectionPolicy.cs
- FileLevelControlBuilderAttribute.cs