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
- CodeVariableReferenceExpression.cs
- TdsParameterSetter.cs
- VisualStyleTypesAndProperties.cs
- DeadCharTextComposition.cs
- sqlstateclientmanager.cs
- RequestCachePolicy.cs
- RegistryKey.cs
- DelegateHelpers.cs
- MessageFilter.cs
- ZeroOpNode.cs
- EventToken.cs
- CLSCompliantAttribute.cs
- DbParameterCollectionHelper.cs
- EncodingNLS.cs
- CreateUserErrorEventArgs.cs
- objectquery_tresulttype.cs
- WSTrustDec2005.cs
- XmlObjectSerializerReadContextComplexJson.cs
- FixedPosition.cs
- DataGridItem.cs
- Triangle.cs
- LoopExpression.cs
- FloaterParagraph.cs
- ListSortDescriptionCollection.cs
- SocketInformation.cs
- RectangleGeometry.cs
- HtmlInputPassword.cs
- ToolStripOverflow.cs
- ApplicationFileCodeDomTreeGenerator.cs
- BasicHttpMessageSecurity.cs
- AspNetSynchronizationContext.cs
- ToolBarButton.cs
- PageAdapter.cs
- DbCommandDefinition.cs
- AutomationInteropProvider.cs
- CodeMemberMethod.cs
- CodeNamespaceCollection.cs
- AutoSizeToolBoxItem.cs
- ObjectCacheSettings.cs
- PropertyState.cs
- SqlFacetAttribute.cs
- TimeManager.cs
- NetworkCredential.cs
- WebServiceEnumData.cs
- XmlName.cs
- ConstraintManager.cs
- NameValuePair.cs
- ChtmlSelectionListAdapter.cs
- CodeCompileUnit.cs
- ResourceDescriptionAttribute.cs
- ParameterElementCollection.cs
- CodeNamespaceCollection.cs
- WindowsGraphics2.cs
- ComboBox.cs
- NotCondition.cs
- StreamWriter.cs
- DataColumnPropertyDescriptor.cs
- PointF.cs
- NativeMethods.cs
- AssemblyName.cs
- DbLambda.cs
- DbMetaDataCollectionNames.cs
- DbConnectionPool.cs
- ChannelPoolSettings.cs
- PriorityBindingExpression.cs
- ListControlDataBindingHandler.cs
- ValueConversionAttribute.cs
- XDeferredAxisSource.cs
- AdornerLayer.cs
- InternalConfigRoot.cs
- ProfileInfo.cs
- HMACRIPEMD160.cs
- MailMessage.cs
- SqlFactory.cs
- BamlWriter.cs
- QilName.cs
- DataBoundControlHelper.cs
- EnumUnknown.cs
- TabControlEvent.cs
- State.cs
- AmbientLight.cs
- MsmqIntegrationProcessProtocolHandler.cs
- SendSecurityHeaderElement.cs
- TextServicesCompartment.cs
- DataGridViewComboBoxColumnDesigner.cs
- Rect3DConverter.cs
- FontInfo.cs
- ColorAnimationUsingKeyFrames.cs
- ResolvedKeyFrameEntry.cs
- SerializationAttributes.cs
- DescendentsWalkerBase.cs
- BlockUIContainer.cs
- BufferBuilder.cs
- dataobject.cs
- PropertyValueUIItem.cs
- SignedPkcs7.cs
- NullReferenceException.cs
- DesignerEventService.cs
- RelationshipEndMember.cs
- SliderAutomationPeer.cs