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
- RotateTransform3D.cs
- SqlClientPermission.cs
- SchemaComplexType.cs
- XPathSelectionIterator.cs
- Size3DConverter.cs
- RegexMatch.cs
- SQLDecimalStorage.cs
- StateMachine.cs
- X500Name.cs
- ReflectionUtil.cs
- SupportsEventValidationAttribute.cs
- ModelUIElement3D.cs
- RefreshPropertiesAttribute.cs
- SqlBuffer.cs
- WebBrowserProgressChangedEventHandler.cs
- EmbeddedMailObjectsCollection.cs
- FileInfo.cs
- IRCollection.cs
- ResXBuildProvider.cs
- MimeTypePropertyAttribute.cs
- XpsTokenContext.cs
- Line.cs
- AutomationPatternInfo.cs
- FileDataSourceCache.cs
- FixedDocumentSequencePaginator.cs
- SendReply.cs
- SoapSchemaExporter.cs
- ClientRequest.cs
- Span.cs
- PersonalizationProvider.cs
- ResourceContainer.cs
- ContentHostHelper.cs
- COM2ExtendedUITypeEditor.cs
- RijndaelManagedTransform.cs
- ComponentGlyph.cs
- Token.cs
- ControlBindingsCollection.cs
- GestureRecognizer.cs
- LinqDataSourceDeleteEventArgs.cs
- ApplicationTrust.cs
- PagedControl.cs
- TextChangedEventArgs.cs
- ListViewGroupItemCollection.cs
- WindowsIPAddress.cs
- AttachedPropertyMethodSelector.cs
- ToolboxItemCollection.cs
- DocumentManager.cs
- GeneralTransform3DGroup.cs
- XmlCharCheckingReader.cs
- CollectionViewGroupInternal.cs
- TypeInformation.cs
- TdsParserStateObject.cs
- ReaderWriterLockWrapper.cs
- CompleteWizardStep.cs
- SelectionEditingBehavior.cs
- infer.cs
- Util.cs
- BinarySerializer.cs
- CreateParams.cs
- DbConnectionPoolGroupProviderInfo.cs
- EventMappingSettingsCollection.cs
- LicenseProviderAttribute.cs
- BitmapInitialize.cs
- ArrangedElement.cs
- SQLBytes.cs
- Function.cs
- InvalidFilterCriteriaException.cs
- XmlSchemaComplexContentExtension.cs
- SafeNativeMethodsMilCoreApi.cs
- ExchangeUtilities.cs
- DataContractSerializerFaultFormatter.cs
- MouseGestureConverter.cs
- GetPageNumberCompletedEventArgs.cs
- Menu.cs
- FilterableAttribute.cs
- NullableConverter.cs
- arc.cs
- StateRuntime.cs
- UpdateManifestForBrowserApplication.cs
- DriveInfo.cs
- OleDbConnection.cs
- FtpRequestCacheValidator.cs
- DataSourceControlBuilder.cs
- StyleXamlTreeBuilder.cs
- TraceInternal.cs
- TemplateNameScope.cs
- RequestResizeEvent.cs
- GroupBoxAutomationPeer.cs
- HybridDictionary.cs
- BrowserTree.cs
- CheckBoxPopupAdapter.cs
- ProxyWebPartConnectionCollection.cs
- CompiledIdentityConstraint.cs
- IFormattable.cs
- SQLGuidStorage.cs
- WindowsGraphics.cs
- NotFiniteNumberException.cs
- DescendentsWalker.cs
- ADMembershipUser.cs
- PropertyInfoSet.cs