Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- WithStatement.cs
- AttributeAction.cs
- DataGridItemCollection.cs
- CodeAssignStatement.cs
- WSMessageEncoding.cs
- AutomationPattern.cs
- CompatibleComparer.cs
- Decoder.cs
- InspectionWorker.cs
- PrincipalPermissionMode.cs
- SlotInfo.cs
- PerformanceCounterCategory.cs
- SimpleRecyclingCache.cs
- SqlDataSourceAdvancedOptionsForm.cs
- ConfigurationPermission.cs
- Span.cs
- CodeMethodInvokeExpression.cs
- DocumentPageView.cs
- WebEventCodes.cs
- ToolStripItemCollection.cs
- ActivitySurrogate.cs
- Scripts.cs
- OciHandle.cs
- PixelFormats.cs
- NameTable.cs
- ForceCopyBuildProvider.cs
- RealProxy.cs
- RoleManagerSection.cs
- TreeIterators.cs
- CodeEntryPointMethod.cs
- _AutoWebProxyScriptHelper.cs
- TreeNode.cs
- XPathAncestorIterator.cs
- TaskbarItemInfo.cs
- CngAlgorithmGroup.cs
- ValueTypeIndexerReference.cs
- WebControl.cs
- PairComparer.cs
- CheckBox.cs
- EarlyBoundInfo.cs
- ApplicationGesture.cs
- SQLRoleProvider.cs
- RotateTransform3D.cs
- ButtonField.cs
- ActivityExecutionFilter.cs
- WindowsToolbar.cs
- XmlArrayItemAttribute.cs
- ChannelManager.cs
- MSHTMLHost.cs
- SrgsItemList.cs
- ContentValidator.cs
- ConnectionPoolManager.cs
- RewritingProcessor.cs
- Win32KeyboardDevice.cs
- PackUriHelper.cs
- DataTableClearEvent.cs
- CustomCredentialPolicy.cs
- MethodExpression.cs
- DebugInfoGenerator.cs
- ClockGroup.cs
- Style.cs
- GeometryConverter.cs
- WebControlAdapter.cs
- TreeNodeBinding.cs
- DataGridViewRowEventArgs.cs
- DynamicRendererThreadManager.cs
- UriSection.cs
- PackagePart.cs
- ReadOnlyDictionary.cs
- DataKey.cs
- MdiWindowListItemConverter.cs
- Compiler.cs
- ExpressionLink.cs
- IntSumAggregationOperator.cs
- DecimalAnimation.cs
- DateTimeAutomationPeer.cs
- OleDbDataReader.cs
- WinFormsSpinner.cs
- DecoderNLS.cs
- PathHelper.cs
- CommandID.cs
- BulletDecorator.cs
- XmlSerializerFactory.cs
- AdRotator.cs
- CellQuery.cs
- CryptoApi.cs
- CssStyleCollection.cs
- URI.cs
- EnumValidator.cs
- NodeLabelEditEvent.cs
- TrustManagerMoreInformation.cs
- XPathAncestorQuery.cs
- SamlAdvice.cs
- _LocalDataStoreMgr.cs
- ClientTargetSection.cs
- ErrorTableItemStyle.cs
- ServiceContractAttribute.cs
- EditBehavior.cs
- AndCondition.cs
- ACE.cs