Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpCookie.cs
- HttpStaticObjectsCollectionBase.cs
- NativeCppClassAttribute.cs
- AssertSection.cs
- ColorTranslator.cs
- FormViewRow.cs
- GlyphsSerializer.cs
- HttpListener.cs
- CompilerParameters.cs
- LingerOption.cs
- ChangePassword.cs
- AttachedPropertyBrowsableAttribute.cs
- Rotation3DAnimationUsingKeyFrames.cs
- ReachDocumentSequenceSerializerAsync.cs
- PackUriHelper.cs
- EntityCommandCompilationException.cs
- InputManager.cs
- ActivityFunc.cs
- XmlSchemaSet.cs
- SamlAuthorityBinding.cs
- HTMLTagNameToTypeMapper.cs
- NameTable.cs
- WebPartMovingEventArgs.cs
- HttpCachePolicyElement.cs
- AuthenticationService.cs
- XmlEventCache.cs
- ButtonChrome.cs
- PathNode.cs
- MultilineStringConverter.cs
- documentsequencetextcontainer.cs
- DataGridViewRowConverter.cs
- shaper.cs
- Size.cs
- OutputCacheModule.cs
- BamlLocalizabilityResolver.cs
- IfJoinedCondition.cs
- IImplicitResourceProvider.cs
- StylusPointPropertyUnit.cs
- UIElementPropertyUndoUnit.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- SortQueryOperator.cs
- SerializerProvider.cs
- AutoResizedEvent.cs
- InstanceCreationEditor.cs
- UrlUtility.cs
- SqlDataSourceFilteringEventArgs.cs
- LocalFileSettingsProvider.cs
- TextWriter.cs
- Interlocked.cs
- FileChangesMonitor.cs
- mediapermission.cs
- SecurityResources.cs
- SoapServerMessage.cs
- RadioButton.cs
- FrameworkTemplate.cs
- MenuItemStyle.cs
- BaseResourcesBuildProvider.cs
- ByteConverter.cs
- IdnMapping.cs
- ResourceManager.cs
- SQLBinaryStorage.cs
- precedingsibling.cs
- _KerberosClient.cs
- ACL.cs
- DetailsViewUpdateEventArgs.cs
- DefaultValueConverter.cs
- LogicalMethodInfo.cs
- DataGridViewColumnHeaderCell.cs
- RectangleF.cs
- CodeSnippetTypeMember.cs
- AttachedPropertyMethodSelector.cs
- UniformGrid.cs
- CanExecuteRoutedEventArgs.cs
- StrongNameIdentityPermission.cs
- ClientRoleProvider.cs
- DependencyObject.cs
- UnionExpr.cs
- DataSetUtil.cs
- CodeTryCatchFinallyStatement.cs
- SessionPageStatePersister.cs
- SplashScreen.cs
- CompositionTarget.cs
- DataGridViewComboBoxEditingControl.cs
- OdbcUtils.cs
- TransportSecurityProtocolFactory.cs
- ToolboxItem.cs
- ResourceDisplayNameAttribute.cs
- DataObjectEventArgs.cs
- HostAdapter.cs
- SqlStatistics.cs
- DependencyPropertyDescriptor.cs
- VariableExpressionConverter.cs
- ComponentManagerBroker.cs
- WebConfigurationFileMap.cs
- WebMessageFormatHelper.cs
- shaperfactoryquerycacheentry.cs
- XamlDebuggerXmlReader.cs
- WmlCommandAdapter.cs
- SHA256CryptoServiceProvider.cs
- FixedDSBuilder.cs