Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- InstanceCreationEditor.cs
- X509CertificateChain.cs
- CompatibleIComparer.cs
- PointHitTestResult.cs
- DBDataPermissionAttribute.cs
- StrokeCollection2.cs
- SystemTcpConnection.cs
- PreservationFileReader.cs
- CharStorage.cs
- InternalDuplexChannelFactory.cs
- ObjectDataSourceFilteringEventArgs.cs
- CharacterBuffer.cs
- XPathParser.cs
- URLAttribute.cs
- SqlComparer.cs
- StrongNamePublicKeyBlob.cs
- ReadOnlyDictionary.cs
- HttpFormatExtensions.cs
- Constraint.cs
- StorageTypeMapping.cs
- IChannel.cs
- TextCollapsingProperties.cs
- RouteTable.cs
- Int64Storage.cs
- CatalogZone.cs
- _AuthenticationState.cs
- Char.cs
- HTMLTextWriter.cs
- PackageController.cs
- Statements.cs
- TextBoxAutomationPeer.cs
- CodeTypeConstructor.cs
- DBPropSet.cs
- KeyValueInternalCollection.cs
- TabControlDesigner.cs
- documentsequencetextpointer.cs
- QueryStringConverter.cs
- NullReferenceException.cs
- MenuTracker.cs
- DesignerResources.cs
- TrustSection.cs
- TargetControlTypeAttribute.cs
- x509store.cs
- RowUpdatingEventArgs.cs
- ConnectionStringsExpressionBuilder.cs
- Emitter.cs
- DirectionalLight.cs
- ADConnectionHelper.cs
- DynamicDataRoute.cs
- MachineKeyConverter.cs
- Int32Rect.cs
- RuntimeConfigLKG.cs
- HtmlCalendarAdapter.cs
- ImageMap.cs
- SortedList.cs
- SafeRegistryHandle.cs
- ComboBoxItem.cs
- PlaceHolder.cs
- JournalNavigationScope.cs
- FrameworkContentElement.cs
- IgnoreFileBuildProvider.cs
- RSACryptoServiceProvider.cs
- IList.cs
- XsdCachingReader.cs
- ReadWriteSpinLock.cs
- XmlQueryOutput.cs
- DataStreams.cs
- PropertyValidationContext.cs
- CqlQuery.cs
- DynamicObjectAccessor.cs
- HMACSHA384.cs
- GradientBrush.cs
- SubpageParaClient.cs
- BookmarkUndoUnit.cs
- DataGridViewBindingCompleteEventArgs.cs
- ColumnBinding.cs
- RoleManagerEventArgs.cs
- HwndHost.cs
- ObjectReferenceStack.cs
- CodeSubDirectory.cs
- IPAddressCollection.cs
- DBCSCodePageEncoding.cs
- BooleanToVisibilityConverter.cs
- ScrollChangedEventArgs.cs
- DataServiceRequestOfT.cs
- CodeBinaryOperatorExpression.cs
- TableAdapterManagerNameHandler.cs
- dsa.cs
- StorageBasedPackageProperties.cs
- DocumentViewerBaseAutomationPeer.cs
- RegionData.cs
- AffineTransform3D.cs
- UpdateManifestForBrowserApplication.cs
- DbProviderConfigurationHandler.cs
- Help.cs
- DiffuseMaterial.cs
- HwndSource.cs
- SHA512.cs
- SubclassTypeValidatorAttribute.cs
- DataGridViewCellStyleChangedEventArgs.cs