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
- BehaviorEditorPart.cs
- GroupJoinQueryOperator.cs
- XmlDataCollection.cs
- TraceContextRecord.cs
- ScriptingSectionGroup.cs
- MatchNoneMessageFilter.cs
- _ConnectStream.cs
- DataContractSerializerSection.cs
- NetTcpBindingCollectionElement.cs
- UpdatePanel.cs
- Line.cs
- Interop.cs
- Queue.cs
- StringResourceManager.cs
- DbParameterCollection.cs
- CopyCodeAction.cs
- MSHTMLHostUtil.cs
- ControlParameter.cs
- TakeQueryOptionExpression.cs
- XmlEncoding.cs
- Enlistment.cs
- ConstrainedDataObject.cs
- GraphicsContext.cs
- GatewayIPAddressInformationCollection.cs
- input.cs
- XmlMessageFormatter.cs
- SqlSupersetValidator.cs
- ReachSerializationCacheItems.cs
- DynamicResourceExtensionConverter.cs
- ComponentChangedEvent.cs
- UTF7Encoding.cs
- InvalidAsynchronousStateException.cs
- MemoryPressure.cs
- UIPropertyMetadata.cs
- Size.cs
- TextMessageEncodingElement.cs
- TimelineGroup.cs
- ComponentResourceKey.cs
- DataSourceControlBuilder.cs
- ListManagerBindingsCollection.cs
- Message.cs
- XmlSchemaIdentityConstraint.cs
- ExpressionBinding.cs
- BitmapMetadataBlob.cs
- FutureFactory.cs
- ThreadExceptionEvent.cs
- SizeLimitedCache.cs
- ItemCollection.cs
- CheckBoxField.cs
- PeerInvitationResponse.cs
- Content.cs
- SEHException.cs
- FacetEnabledSchemaElement.cs
- AutomationPatternInfo.cs
- EmptyQuery.cs
- ConnectionProviderAttribute.cs
- GridPattern.cs
- RefExpr.cs
- ValidationRuleCollection.cs
- sqlnorm.cs
- SliderAutomationPeer.cs
- PreloadedPackages.cs
- SqlProvider.cs
- PropertyItemInternal.cs
- ContainerFilterService.cs
- HttpGetServerProtocol.cs
- SQLByteStorage.cs
- cookiecontainer.cs
- IdentityHolder.cs
- sitestring.cs
- ConnectionStringsExpressionBuilder.cs
- MultiSelector.cs
- GlyphCollection.cs
- HashSetEqualityComparer.cs
- SamlAssertionKeyIdentifierClause.cs
- DataPagerFieldCommandEventArgs.cs
- ServerIdentity.cs
- AuthenticationModuleElement.cs
- ToolStripDropTargetManager.cs
- GiveFeedbackEvent.cs
- TableAutomationPeer.cs
- XmlStreamNodeWriter.cs
- BamlReader.cs
- CollectionContainer.cs
- DebugView.cs
- TextEditorLists.cs
- TraversalRequest.cs
- MetadataItem_Static.cs
- CodeTypeOfExpression.cs
- MemberPath.cs
- ReflectionUtil.cs
- DesignTimeHTMLTextWriter.cs
- CreateCardRequest.cs
- ChildTable.cs
- UIHelper.cs
- EntityClassGenerator.cs
- SafeRightsManagementQueryHandle.cs
- ItemAutomationPeer.cs
- Control.cs
- ThrowHelper.cs