Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMappingHandle.cs / 1 / SafeFileMappingHandle.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: SafeFileMappingHandle
**
** Author: David Gutierrez ([....])
**
** A wrapper for handle to file mappings, returned by
** CreateFileMapping and OpenFileMapping. Used for shared
** memory.
**
** Date: July 8, 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 SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid
{
// Note that CreateFileMapping returns 0 on failure.
// Note that you can pass in -1 for the hFile parameter.
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)]
internal SafeFileMappingHandle() : base(true) {}
[DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
private static extern bool CloseHandle(IntPtr handle);
override protected bool ReleaseHandle()
{
return CloseHandle(handle);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: SafeFileMappingHandle
**
** Author: David Gutierrez ([....])
**
** A wrapper for handle to file mappings, returned by
** CreateFileMapping and OpenFileMapping. Used for shared
** memory.
**
** Date: July 8, 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 SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid
{
// Note that CreateFileMapping returns 0 on failure.
// Note that you can pass in -1 for the hFile parameter.
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)]
internal SafeFileMappingHandle() : base(true) {}
[DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
private static extern bool CloseHandle(IntPtr handle);
override protected bool ReleaseHandle()
{
return CloseHandle(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
- XslTransformFileEditor.cs
- KeyValueConfigurationElement.cs
- _LazyAsyncResult.cs
- RecognizeCompletedEventArgs.cs
- TableLayoutPanel.cs
- ForEachAction.cs
- ValueExpressions.cs
- BidirectionalDictionary.cs
- Boolean.cs
- Duration.cs
- DataGridViewCheckBoxColumn.cs
- Stack.cs
- SelectionHighlightInfo.cs
- LogAppendAsyncResult.cs
- PointConverter.cs
- StringUtil.cs
- GroupByExpressionRewriter.cs
- SchemaElementDecl.cs
- OpenFileDialog.cs
- BindingListCollectionView.cs
- SecurityPermission.cs
- ListParaClient.cs
- XsdCachingReader.cs
- HostUtils.cs
- ColorTransform.cs
- CodeConditionStatement.cs
- KerberosSecurityTokenAuthenticator.cs
- EventDescriptorCollection.cs
- UIElement.cs
- MediaTimeline.cs
- WebPartConnectionsCancelVerb.cs
- LinqDataSourceHelper.cs
- Color.cs
- AutomationProperties.cs
- RequestTimeoutManager.cs
- DataSpaceManager.cs
- SystemTcpConnection.cs
- Control.cs
- Point3DAnimationUsingKeyFrames.cs
- ExtensionQuery.cs
- EdmToObjectNamespaceMap.cs
- DataGridViewRowPostPaintEventArgs.cs
- LineMetrics.cs
- CustomErrorsSectionWrapper.cs
- ReferencedAssemblyResolver.cs
- CompositeTypefaceMetrics.cs
- SystemPens.cs
- MultilineStringEditor.cs
- ExtractedStateEntry.cs
- InfoCardSymmetricCrypto.cs
- CqlQuery.cs
- PropertyGeneratedEventArgs.cs
- printdlgexmarshaler.cs
- Int16AnimationUsingKeyFrames.cs
- CodeMemberEvent.cs
- TTSEngineTypes.cs
- ReflectionUtil.cs
- HtmlTableCellCollection.cs
- DataGridViewCellValidatingEventArgs.cs
- DescendantOverDescendantQuery.cs
- UpdateException.cs
- XmlCharType.cs
- CfgSemanticTag.cs
- PointLightBase.cs
- ChannelRequirements.cs
- Scene3D.cs
- LocatorBase.cs
- BinaryReader.cs
- Identity.cs
- AnnotationService.cs
- XmlNamespaceMapping.cs
- ReflectTypeDescriptionProvider.cs
- Calendar.cs
- ImportContext.cs
- SqlNodeAnnotation.cs
- Shared.cs
- VirtualizedCellInfoCollection.cs
- CacheRequest.cs
- ModulesEntry.cs
- StringCollection.cs
- DataGridViewRowsRemovedEventArgs.cs
- BidOverLoads.cs
- PresentationTraceSources.cs
- DisableDpiAwarenessAttribute.cs
- EntitySqlQueryBuilder.cs
- DoubleCollectionValueSerializer.cs
- DropAnimation.xaml.cs
- Fx.cs
- MultipartIdentifier.cs
- _PooledStream.cs
- TreeNodeSelectionProcessor.cs
- MergeLocalizationDirectives.cs
- SafeNativeMethods.cs
- NamespaceCollection.cs
- SqlBulkCopy.cs
- HttpListenerResponse.cs
- Vector3DKeyFrameCollection.cs
- ASCIIEncoding.cs
- RoleBoolean.cs
- Focus.cs