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
- WorkflowInspectionServices.cs
- CompleteWizardStep.cs
- WindowsGrip.cs
- HttpServerVarsCollection.cs
- StringResourceManager.cs
- TransformProviderWrapper.cs
- FilterQueryOptionExpression.cs
- webproxy.cs
- SqlHelper.cs
- UnmanagedMemoryAccessor.cs
- BaseConfigurationRecord.cs
- LocalServiceSecuritySettingsElement.cs
- WebContext.cs
- GACIdentityPermission.cs
- CaseExpr.cs
- EntitySqlQueryCacheEntry.cs
- ServiceDesigner.xaml.cs
- ToolStripItemRenderEventArgs.cs
- EmptyQuery.cs
- IgnoreSectionHandler.cs
- StaticResourceExtension.cs
- Simplifier.cs
- PenLineCapValidation.cs
- MetricEntry.cs
- SequentialUshortCollection.cs
- SizeChangedInfo.cs
- SubstitutionList.cs
- GetMemberBinder.cs
- MonthCalendar.cs
- WindowsTitleBar.cs
- ConnectionPointCookie.cs
- WebServiceMethodData.cs
- HtmlTableRowCollection.cs
- ObjectContextServiceProvider.cs
- XmlSchemaAttribute.cs
- CalendarDateChangedEventArgs.cs
- DebugHandleTracker.cs
- ConfigurationLoader.cs
- DeclaredTypeElement.cs
- ExpressionTextBoxAutomationPeer.cs
- ArrayConverter.cs
- HttpCacheParams.cs
- XmlSchemaAttributeGroupRef.cs
- EncryptedType.cs
- DataGridViewTextBoxCell.cs
- ServiceModelTimeSpanValidator.cs
- ExpressionBuilder.cs
- ToolStripItemDataObject.cs
- Rfc2898DeriveBytes.cs
- TextEffect.cs
- PrintPageEvent.cs
- XmlnsCache.cs
- StrokeRenderer.cs
- SharedConnectionWorkflowTransactionService.cs
- FreezableOperations.cs
- RegexStringValidatorAttribute.cs
- DispatcherProcessingDisabled.cs
- PropertyCollection.cs
- RemotingException.cs
- OleDbFactory.cs
- SecurityContextSecurityTokenParameters.cs
- ArrayList.cs
- SocketAddress.cs
- OleDbRowUpdatedEvent.cs
- SqlLiftWhereClauses.cs
- DefaultTraceListener.cs
- EncryptedData.cs
- WindowsToolbarItemAsMenuItem.cs
- _NegoState.cs
- XmlComplianceUtil.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- EraserBehavior.cs
- OutputBuffer.cs
- Pkcs9Attribute.cs
- ExternalException.cs
- PhysicalFontFamily.cs
- StringArrayConverter.cs
- InputProcessorProfilesLoader.cs
- ContainerParaClient.cs
- PixelFormat.cs
- DesignerPerfEventProvider.cs
- GridItemProviderWrapper.cs
- SoapReflectionImporter.cs
- HuffCodec.cs
- WebPartsSection.cs
- SizeValueSerializer.cs
- ReadOnlyDataSource.cs
- NativeObjectSecurity.cs
- SqlDependencyListener.cs
- Roles.cs
- SchemeSettingElement.cs
- ZipIOLocalFileBlock.cs
- LayoutSettings.cs
- Highlights.cs
- X509AudioLogo.cs
- WorkItem.cs
- CommonRemoteMemoryBlock.cs
- RSACryptoServiceProvider.cs
- TypeInfo.cs
- ImageSource.cs