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
- XmlSerializationReader.cs
- Formatter.cs
- GridToolTip.cs
- RTLAwareMessageBox.cs
- XPathSelfQuery.cs
- ShaderEffect.cs
- CheckBoxFlatAdapter.cs
- WebPartConnectionsConfigureVerb.cs
- XmlBindingWorker.cs
- FormatterConverter.cs
- ValidationHelper.cs
- ApplicationFileParser.cs
- XmlnsCache.cs
- TreeWalkHelper.cs
- TypeHelper.cs
- BitConverter.cs
- SystemIPInterfaceProperties.cs
- DependencySource.cs
- LeaseManager.cs
- NeutralResourcesLanguageAttribute.cs
- SafeRightsManagementSessionHandle.cs
- UshortList2.cs
- MethodBuilderInstantiation.cs
- Header.cs
- RecordsAffectedEventArgs.cs
- webeventbuffer.cs
- ReadOnlyHierarchicalDataSource.cs
- EventsTab.cs
- AssemblyInfo.cs
- Util.cs
- TransactionInterop.cs
- DirectionalLight.cs
- ObjectViewListener.cs
- Certificate.cs
- Keywords.cs
- SerializationFieldInfo.cs
- EntityModelSchemaGenerator.cs
- RijndaelManagedTransform.cs
- DateTimeStorage.cs
- ViewPort3D.cs
- DataControlImageButton.cs
- InternalConfigConfigurationFactory.cs
- SocketException.cs
- TraceHwndHost.cs
- User.cs
- sqlpipe.cs
- PTUtility.cs
- TreeViewItem.cs
- BufferAllocator.cs
- TextTreeRootNode.cs
- WorkflowMarkupElementEventArgs.cs
- WsdlInspector.cs
- MailAddress.cs
- MessageQueueTransaction.cs
- loginstatus.cs
- VideoDrawing.cs
- CLSCompliantAttribute.cs
- SafeBitVector32.cs
- IHttpResponseInternal.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- RestClientProxyHandler.cs
- TableCell.cs
- FreezableOperations.cs
- Set.cs
- ByValueEqualityComparer.cs
- ObjectConverter.cs
- HeaderPanel.cs
- HitTestParameters.cs
- FontFamily.cs
- SqlFlattener.cs
- BaseValidator.cs
- ExpandCollapseProviderWrapper.cs
- BigInt.cs
- SizeIndependentAnimationStorage.cs
- DataServiceHostFactory.cs
- RulePatternOps.cs
- mda.cs
- XPathNodePointer.cs
- SegmentInfo.cs
- ValidationRule.cs
- PropertyEntry.cs
- GroupDescription.cs
- OperandQuery.cs
- UInt16Converter.cs
- DataControlImageButton.cs
- ForwardPositionQuery.cs
- GPRECT.cs
- SqlProcedureAttribute.cs
- CachedFontFamily.cs
- NumberAction.cs
- MappingException.cs
- SerialStream.cs
- ResizingMessageFilter.cs
- Cursor.cs
- DragDeltaEventArgs.cs
- Grant.cs
- MissingManifestResourceException.cs
- LabelLiteral.cs
- GPStream.cs
- NamespaceExpr.cs