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
- StreamAsIStream.cs
- EntityDataSourceSelectedEventArgs.cs
- LinqDataSourceUpdateEventArgs.cs
- InvalidPrinterException.cs
- DataListItem.cs
- ExpressionVisitor.cs
- HttpHandlersSection.cs
- WindowsFormsSectionHandler.cs
- HtmlLink.cs
- DrawingAttributeSerializer.cs
- nulltextnavigator.cs
- QueryCoreOp.cs
- ApplicationCommands.cs
- RuntimeHelpers.cs
- MethodAccessException.cs
- SchemaCollectionPreprocessor.cs
- ResourceDefaultValueAttribute.cs
- HttpListener.cs
- BamlLocalizer.cs
- LinkButton.cs
- CodeCompileUnit.cs
- Viewport2DVisual3D.cs
- ListControl.cs
- AccessibleObject.cs
- FloaterParagraph.cs
- Hex.cs
- XPathChildIterator.cs
- itemelement.cs
- ToolStripItemCollection.cs
- Vector3DKeyFrameCollection.cs
- SchemaTypeEmitter.cs
- NonBatchDirectoryCompiler.cs
- DateTimePicker.cs
- NavigationCommands.cs
- XmlDataSourceView.cs
- XmlSchemaSimpleContent.cs
- SqlClientFactory.cs
- BStrWrapper.cs
- InternalUserCancelledException.cs
- SiteIdentityPermission.cs
- XmlAttributeCollection.cs
- ResolvedKeyFrameEntry.cs
- FuncCompletionCallbackWrapper.cs
- SelectionChangedEventArgs.cs
- DependencyPropertyKind.cs
- ConnectionManagementElementCollection.cs
- DataTable.cs
- NavigatingCancelEventArgs.cs
- PeerMessageDispatcher.cs
- Panel.cs
- ViewManager.cs
- BulletedListEventArgs.cs
- EntityDataSourceValidationException.cs
- SafeNativeMethods.cs
- ClaimTypeRequirement.cs
- ConnectionInterfaceCollection.cs
- ToolstripProfessionalRenderer.cs
- lengthconverter.cs
- BridgeDataRecord.cs
- HwndProxyElementProvider.cs
- PropertyFilterAttribute.cs
- BrowserCapabilitiesFactoryBase.cs
- IResourceProvider.cs
- Point3D.cs
- MsmqInputChannelListener.cs
- sqlstateclientmanager.cs
- _IPv6Address.cs
- UpdateTracker.cs
- RIPEMD160Managed.cs
- SafeNativeMethods.cs
- ExternalFile.cs
- AutomationPatternInfo.cs
- UniformGrid.cs
- ActiveDocumentEvent.cs
- CrossAppDomainChannel.cs
- CodeRemoveEventStatement.cs
- EntityParameterCollection.cs
- QilValidationVisitor.cs
- basenumberconverter.cs
- EasingKeyFrames.cs
- DesignerTextWriter.cs
- EventLogTraceListener.cs
- CompilationSection.cs
- SchemaImporterExtensionElement.cs
- XmlLinkedNode.cs
- DataGridRowHeaderAutomationPeer.cs
- DictionaryTraceRecord.cs
- EventLogPropertySelector.cs
- arclist.cs
- VirtualPath.cs
- IdentityValidationException.cs
- TraceLevelStore.cs
- AsyncStreamReader.cs
- MatrixStack.cs
- UserMapPath.cs
- StaticFileHandler.cs
- CurrencyWrapper.cs
- Attributes.cs
- GradientStopCollection.cs
- ProtocolsConfigurationEntry.cs