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
- Positioning.cs
- TimeEnumHelper.cs
- Rect.cs
- EventLogConfiguration.cs
- SqlBooleanizer.cs
- CqlParser.cs
- CommonGetThemePartSize.cs
- PhoneCallDesigner.cs
- AtlasWeb.Designer.cs
- PageParser.cs
- Type.cs
- PropertyGridEditorPart.cs
- WindowsStartMenu.cs
- AppliedDeviceFiltersEditor.cs
- DatatypeImplementation.cs
- MachineKeySection.cs
- WindowsTreeView.cs
- SchemaElement.cs
- ObjectStateFormatter.cs
- ProfileInfo.cs
- ConfigXmlReader.cs
- CodePropertyReferenceExpression.cs
- DiscardableAttribute.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- XXXInfos.cs
- RectAnimation.cs
- XappLauncher.cs
- AuthStoreRoleProvider.cs
- WindowsBrush.cs
- AppSettingsSection.cs
- ThrowHelper.cs
- Schedule.cs
- XmlSchemaType.cs
- ProtocolsConfiguration.cs
- InternalReceiveMessage.cs
- Soap12FormatExtensions.cs
- PathData.cs
- DiscardableAttribute.cs
- SiteMapHierarchicalDataSourceView.cs
- NetworkStream.cs
- DivideByZeroException.cs
- DataGridRelationshipRow.cs
- AdCreatedEventArgs.cs
- MatrixAnimationBase.cs
- RuntimeConfigurationRecord.cs
- EpmSyndicationContentDeSerializer.cs
- DefaultAuthorizationContext.cs
- Utils.cs
- PopOutPanel.cs
- HttpProcessUtility.cs
- BoolLiteral.cs
- DockPattern.cs
- Form.cs
- LayoutUtils.cs
- ColorConvertedBitmap.cs
- XmlDataCollection.cs
- ElementHostPropertyMap.cs
- TcpClientSocketManager.cs
- WriterOutput.cs
- PrimitiveDataContract.cs
- Delay.cs
- GeometryCollection.cs
- XmlSignatureProperties.cs
- IsolatedStorage.cs
- BinaryQueryOperator.cs
- FtpCachePolicyElement.cs
- AppLevelCompilationSectionCache.cs
- Button.cs
- DispatcherSynchronizationContext.cs
- XamlBrushSerializer.cs
- EventItfInfo.cs
- AppSecurityManager.cs
- SqlUtil.cs
- StreamGeometry.cs
- ListViewGroup.cs
- RequiredFieldValidator.cs
- EdmToObjectNamespaceMap.cs
- ScrollChangedEventArgs.cs
- WS2007FederationHttpBindingElement.cs
- BitmapVisualManager.cs
- InputReport.cs
- Panel.cs
- ComponentCommands.cs
- CommandID.cs
- DataGridTableCollection.cs
- EntityDataSourceValidationException.cs
- ContainsRowNumberChecker.cs
- _FixedSizeReader.cs
- EventListener.cs
- MessageQueueTransaction.cs
- SessionPageStateSection.cs
- KeyManager.cs
- CompilerErrorCollection.cs
- DesignerDataColumn.cs
- DbConnectionPool.cs
- ThreadExceptionDialog.cs
- TraceEventCache.cs
- _Connection.cs
- SHA384Managed.cs
- UIElementParaClient.cs