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
- ParameterBuilder.cs
- SchemaCollectionCompiler.cs
- UInt64Converter.cs
- FileIOPermission.cs
- HttpPostedFile.cs
- FontInfo.cs
- ListMarkerLine.cs
- XmlLanguageConverter.cs
- WebReferencesBuildProvider.cs
- ToolStripTextBox.cs
- TextCompositionEventArgs.cs
- RelationshipManager.cs
- ReferentialConstraint.cs
- MaterialCollection.cs
- WindowsGraphics2.cs
- Int64Storage.cs
- ListViewItem.cs
- EdmValidator.cs
- SendMailErrorEventArgs.cs
- ConditionCollection.cs
- OpCellTreeNode.cs
- FragmentQuery.cs
- GenericXmlSecurityToken.cs
- DataGridRow.cs
- SiteMapDataSource.cs
- TrackingServices.cs
- GridViewDeleteEventArgs.cs
- TraceData.cs
- PartitionerQueryOperator.cs
- AppDomainShutdownMonitor.cs
- SessionEndingEventArgs.cs
- __ComObject.cs
- MailAddressCollection.cs
- ImageSourceConverter.cs
- EncryptedReference.cs
- SocketAddress.cs
- SqlProviderManifest.cs
- RootDesignerSerializerAttribute.cs
- Misc.cs
- MenuStrip.cs
- SessionParameter.cs
- codemethodreferenceexpression.cs
- BaseComponentEditor.cs
- JpegBitmapDecoder.cs
- PixelFormats.cs
- QilTernary.cs
- DispatcherExceptionEventArgs.cs
- ConfigurationConverterBase.cs
- XsdDataContractImporter.cs
- XmlDataSourceNodeDescriptor.cs
- HttpConfigurationSystem.cs
- CustomCredentialPolicy.cs
- TcpTransportManager.cs
- CAGDesigner.cs
- FormViewCommandEventArgs.cs
- ApplicationActivator.cs
- SqlDataReaderSmi.cs
- QilSortKey.cs
- Fonts.cs
- ObjectDataSource.cs
- _RequestLifetimeSetter.cs
- ErrorFormatterPage.cs
- FormatConvertedBitmap.cs
- Set.cs
- FloaterBaseParagraph.cs
- RTTypeWrapper.cs
- ConditionalAttribute.cs
- BoundPropertyEntry.cs
- DictionaryEntry.cs
- TemplateBuilder.cs
- SelectionItemPattern.cs
- dbdatarecord.cs
- ListViewGroupConverter.cs
- InvalidCastException.cs
- WasNotInstalledException.cs
- SafeFileHandle.cs
- TransactionState.cs
- ArgIterator.cs
- ObservableDictionary.cs
- WSDualHttpBindingCollectionElement.cs
- RegexGroupCollection.cs
- JsonFormatWriterGenerator.cs
- TerminatorSinks.cs
- XmlSchemaObject.cs
- TextBox.cs
- MonthCalendarDesigner.cs
- ObjectDataSourceDisposingEventArgs.cs
- TargetException.cs
- WebPartConnection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- DragDrop.cs
- InputMethodStateChangeEventArgs.cs
- IndicCharClassifier.cs
- InternalConfigHost.cs
- HtmlProps.cs
- DeleteCardRequest.cs
- WorkflowNamespace.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- RegexCaptureCollection.cs
- ToolStripLocationCancelEventArgs.cs