Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeFileMappingHandle.cs / 1305376 / 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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.None)] [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; using System.Runtime.Versioning; 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)] [ResourceExposure(ResourceScope.None)] [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
- AspCompat.cs
- PageCatalogPart.cs
- ZipIOExtraFieldPaddingElement.cs
- ControlPropertyNameConverter.cs
- BackgroundFormatInfo.cs
- OleDbPropertySetGuid.cs
- AppDomainResourcePerfCounters.cs
- TrustLevel.cs
- ProxyDataContractResolver.cs
- PenThreadPool.cs
- SequentialActivityDesigner.cs
- GridViewCellAutomationPeer.cs
- ObjectItemAssemblyLoader.cs
- CustomErrorsSection.cs
- EntityCommandExecutionException.cs
- ScaleTransform3D.cs
- IgnoreFileBuildProvider.cs
- ItemList.cs
- ActivitiesCollection.cs
- PopOutPanel.cs
- SchemaType.cs
- HtmlTernaryTree.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- DateTimeHelper.cs
- TextureBrush.cs
- MarkupWriter.cs
- XamlStyleSerializer.cs
- Msec.cs
- AssemblyName.cs
- ViewLoader.cs
- ConditionCollection.cs
- x509store.cs
- NumberSubstitution.cs
- StreamUpdate.cs
- RegistryConfigurationProvider.cs
- SupportingTokenListenerFactory.cs
- ProxyGenerator.cs
- ThreadSafeList.cs
- Baml2006KnownTypes.cs
- ResourcePool.cs
- MsmqTransportSecurity.cs
- SqlMethodTransformer.cs
- SqlCacheDependencyDatabaseCollection.cs
- ObjectPropertyMapping.cs
- GrabHandleGlyph.cs
- MessageSecurityProtocolFactory.cs
- shaperfactoryquerycachekey.cs
- RSAOAEPKeyExchangeFormatter.cs
- WizardStepCollectionEditor.cs
- SubqueryRules.cs
- MarkupExtensionParser.cs
- DNS.cs
- ConfigurationManagerHelper.cs
- RIPEMD160Managed.cs
- GACMembershipCondition.cs
- DataGridViewRowConverter.cs
- SqlMetaData.cs
- SchemaManager.cs
- WeakReference.cs
- Misc.cs
- DynamicValidatorEventArgs.cs
- SimpleMailWebEventProvider.cs
- KeyGesture.cs
- AccessibilityApplicationManager.cs
- XmlnsDictionary.cs
- DataException.cs
- OracleCommand.cs
- ContextDataSourceContextData.cs
- RSACryptoServiceProvider.cs
- Stack.cs
- ServiceMetadataExtension.cs
- WizardSideBarListControlItem.cs
- InfoCardProofToken.cs
- RefreshEventArgs.cs
- TextReader.cs
- Stack.cs
- HttpDebugHandler.cs
- ListSortDescriptionCollection.cs
- AttributeProviderAttribute.cs
- StrongNameUtility.cs
- QueryOptionExpression.cs
- DbProviderServices.cs
- TextElementEditingBehaviorAttribute.cs
- SingleObjectCollection.cs
- DesignSurfaceManager.cs
- OleDbEnumerator.cs
- MouseButtonEventArgs.cs
- SqlDependencyUtils.cs
- FunctionNode.cs
- HttpCacheVary.cs
- ConfigurationLockCollection.cs
- ItemContainerGenerator.cs
- DynamicActivityProperty.cs
- SHA1Cng.cs
- RSAPKCS1KeyExchangeFormatter.cs
- ValidationErrorInfo.cs
- SettingsSection.cs
- XmlQueryType.cs
- SupportsPreviewControlAttribute.cs
- PageHandlerFactory.cs