Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- Region.cs
- IndicShape.cs
- MetaTableHelper.cs
- XmlnsDictionary.cs
- SHA384.cs
- XsdValidatingReader.cs
- TextWriterTraceListener.cs
- HtmlInputText.cs
- DesignerVerbCollection.cs
- JsonUriDataContract.cs
- MasterPage.cs
- RootCodeDomSerializer.cs
- WebServiceData.cs
- DbRetry.cs
- ToolStripRenderer.cs
- StatusBarItem.cs
- SimpleRecyclingCache.cs
- SingleConverter.cs
- DataControlLinkButton.cs
- View.cs
- AttachedPropertyBrowsableAttribute.cs
- SqlParameterCollection.cs
- CodePageEncoding.cs
- ToolStripItemCollection.cs
- GeometryCombineModeValidation.cs
- DependencyProperty.cs
- CodeTypeMemberCollection.cs
- ErrorEventArgs.cs
- TypeInfo.cs
- Int16AnimationUsingKeyFrames.cs
- FileDialogCustomPlacesCollection.cs
- ActiveXSite.cs
- GlyphInfoList.cs
- SerializationException.cs
- WindowsEditBox.cs
- TransformerConfigurationWizardBase.cs
- PartialCachingControl.cs
- EntityDataSourceValidationException.cs
- FileBasedResourceGroveler.cs
- DataBoundLiteralControl.cs
- EmissiveMaterial.cs
- Selector.cs
- TransactionFlowElement.cs
- TemplatedMailWebEventProvider.cs
- TCPListener.cs
- DynamicValidatorEventArgs.cs
- InputScopeManager.cs
- XmlWhitespace.cs
- CodeStatement.cs
- XmlNamespaceMapping.cs
- ActionItem.cs
- AppModelKnownContentFactory.cs
- Misc.cs
- TransformPattern.cs
- SocketElement.cs
- SecurityPolicySection.cs
- CapiSymmetricAlgorithm.cs
- ServiceEndpointAssociationProvider.cs
- WebPart.cs
- Dynamic.cs
- SchemaDeclBase.cs
- Ray3DHitTestResult.cs
- RowUpdatingEventArgs.cs
- SqlGatherProducedAliases.cs
- ClientBuildManagerCallback.cs
- ProxySimple.cs
- HWStack.cs
- CategoryNameCollection.cs
- SvcFileManager.cs
- LinqDataSource.cs
- SignatureDescription.cs
- UTF7Encoding.cs
- GetWinFXPath.cs
- LoginUtil.cs
- FrameworkElementFactoryMarkupObject.cs
- DataListItemEventArgs.cs
- RemotingServices.cs
- OpCodes.cs
- TextMessageEncoder.cs
- EtwProvider.cs
- DtdParser.cs
- TdsParserStateObject.cs
- LinqDataSourceDeleteEventArgs.cs
- CodePropertyReferenceExpression.cs
- PrintPreviewDialog.cs
- remotingproxy.cs
- DynamicValueConverter.cs
- ViewRendering.cs
- FeatureSupport.cs
- HelloMessageApril2005.cs
- FixedSOMTextRun.cs
- AsyncPostBackErrorEventArgs.cs
- PeerApplicationLaunchInfo.cs
- NumberSubstitution.cs
- SqlFacetAttribute.cs
- MimeParameters.cs
- ChtmlLinkAdapter.cs
- HighContrastHelper.cs
- DictionarySectionHandler.cs
- StringOutput.cs