Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataBoundLiteralControl.cs
- BitmapPalettes.cs
- XmlSerializer.cs
- PartialTrustVisibleAssembly.cs
- AnnotationResource.cs
- ObjectConverter.cs
- TcpTransportElement.cs
- HwndMouseInputProvider.cs
- WpfKnownType.cs
- XamlWriter.cs
- TextPenaltyModule.cs
- ToolStripDropDownMenu.cs
- SizeConverter.cs
- Filter.cs
- TagNameToTypeMapper.cs
- FreezableDefaultValueFactory.cs
- LineServicesRun.cs
- SqlProviderManifest.cs
- ItemsChangedEventArgs.cs
- ObjectNotFoundException.cs
- WpfGeneratedKnownTypes.cs
- TextRunProperties.cs
- ToolboxItem.cs
- BaseTemplateCodeDomTreeGenerator.cs
- BevelBitmapEffect.cs
- StdValidatorsAndConverters.cs
- Material.cs
- CodePropertyReferenceExpression.cs
- RowVisual.cs
- SettingsPropertyWrongTypeException.cs
- UnionCodeGroup.cs
- BuildProvider.cs
- UInt32Converter.cs
- HttpCachePolicyBase.cs
- AssemblyName.cs
- DrawingGroup.cs
- AudioDeviceOut.cs
- SmtpReplyReaderFactory.cs
- Activity.cs
- DataKey.cs
- CellPartitioner.cs
- HttpRuntime.cs
- DesignTimeParseData.cs
- DbgUtil.cs
- EdmRelationshipRoleAttribute.cs
- InputBuffer.cs
- SponsorHelper.cs
- BuilderPropertyEntry.cs
- BuildProvider.cs
- UniqueEventHelper.cs
- SBCSCodePageEncoding.cs
- EventPrivateKey.cs
- NetDataContractSerializer.cs
- TextServicesCompartmentContext.cs
- ExpressionLexer.cs
- HtmlEmptyTagControlBuilder.cs
- GenerateScriptTypeAttribute.cs
- EditCommandColumn.cs
- MemoryFailPoint.cs
- cookie.cs
- DebugView.cs
- HtmlProps.cs
- WmpBitmapDecoder.cs
- ObjectKeyFrameCollection.cs
- BamlLocalizer.cs
- MultiPageTextView.cs
- UnsafeNativeMethods.cs
- MenuItemCollection.cs
- XamlPointCollectionSerializer.cs
- FrameworkRichTextComposition.cs
- Attachment.cs
- TypeToken.cs
- Vector3DAnimationUsingKeyFrames.cs
- StylusShape.cs
- TextElement.cs
- ContextStaticAttribute.cs
- ReadOnlyAttribute.cs
- ReadOnlyPropertyMetadata.cs
- SHA1CryptoServiceProvider.cs
- HtmlEncodedRawTextWriter.cs
- ListViewPagedDataSource.cs
- PrintDialogException.cs
- PeerApplicationLaunchInfo.cs
- WebPart.cs
- SafeNativeMethods.cs
- LogFlushAsyncResult.cs
- ScopelessEnumAttribute.cs
- MachineSettingsSection.cs
- ExpressionBuilderContext.cs
- DataAdapter.cs
- SvcMapFileSerializer.cs
- MetadataPropertyCollection.cs
- DataGridTextBox.cs
- EntityViewGenerator.cs
- Convert.cs
- GridViewItemAutomationPeer.cs
- GridViewUpdatedEventArgs.cs
- LineBreak.cs
- XmlIlTypeHelper.cs
- ProvidersHelper.cs