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
- GetIndexBinder.cs
- GridViewColumnCollection.cs
- SqlTrackingWorkflowInstance.cs
- latinshape.cs
- GacUtil.cs
- MdiWindowListItemConverter.cs
- MetadataArtifactLoaderResource.cs
- OracleCommandBuilder.cs
- PasswordRecovery.cs
- OleDbDataReader.cs
- Point4DValueSerializer.cs
- ImageAttributes.cs
- TabOrder.cs
- FixedTextContainer.cs
- RecognitionResult.cs
- RelationshipManager.cs
- TextFormatterImp.cs
- ConfigurationValues.cs
- ParameterCollection.cs
- PaperSource.cs
- ButtonBase.cs
- DependencyPropertyConverter.cs
- WebPartDisplayModeCancelEventArgs.cs
- CreateUserErrorEventArgs.cs
- Clipboard.cs
- UnmanagedMemoryStream.cs
- XmlMessageFormatter.cs
- SqlExpressionNullability.cs
- GridViewPageEventArgs.cs
- DnsPermission.cs
- AutoCompleteStringCollection.cs
- FormView.cs
- DataView.cs
- RealProxy.cs
- ScrollProperties.cs
- DurableServiceAttribute.cs
- ListBox.cs
- CustomError.cs
- Formatter.cs
- EncoderParameter.cs
- FunctionImportMapping.cs
- ExpressionPrefixAttribute.cs
- WriteableBitmap.cs
- PointLightBase.cs
- HtmlInputRadioButton.cs
- LogManagementAsyncResult.cs
- XmlRawWriter.cs
- MetadataProperty.cs
- Native.cs
- SmiSettersStream.cs
- StrokeRenderer.cs
- MessageQueue.cs
- SchemaNames.cs
- ToolStripSeparator.cs
- AcceleratedTokenProviderState.cs
- PrinterSettings.cs
- RoleManagerEventArgs.cs
- DataFieldConverter.cs
- ObjectDisposedException.cs
- OperandQuery.cs
- ContactManager.cs
- InfoCardCryptoHelper.cs
- Baml2006KeyRecord.cs
- PriorityQueue.cs
- ActiveXHelper.cs
- BaseParaClient.cs
- FontFamilyValueSerializer.cs
- ImageAnimator.cs
- CollectionChangeEventArgs.cs
- ProcessModuleCollection.cs
- StyleBamlTreeBuilder.cs
- RecordsAffectedEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- WebZoneDesigner.cs
- SoundPlayerAction.cs
- MouseBinding.cs
- UpdateProgress.cs
- GeometryHitTestParameters.cs
- FrameworkObject.cs
- XmlBoundElement.cs
- AudioBase.cs
- HttpStreamXmlDictionaryReader.cs
- XmlSchemaSet.cs
- EmptyElement.cs
- FontResourceCache.cs
- ParseNumbers.cs
- WebConfigurationManager.cs
- FolderBrowserDialog.cs
- ObjectDataSourceDisposingEventArgs.cs
- CodeObjectCreateExpression.cs
- TextChangedEventArgs.cs
- UpDownEvent.cs
- ArgumentOutOfRangeException.cs
- ProcessModuleDesigner.cs
- CompilerError.cs
- ByteAnimationUsingKeyFrames.cs
- SafeTimerHandle.cs
- MailMessageEventArgs.cs
- PageCatalogPart.cs
- ResXDataNode.cs