Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Win32 / SafeHandles / SafeMemoryMappedFileHandle.cs / 1305376 / SafeMemoryMappedFileHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeMemoryMappedFileHandle ** ** Purpose: Safe handle wrapping a file mapping object handle ** ** Date: Febuary 7, 2007 ** ===========================================================*/ using System; using System.Runtime.Versioning; using System.Security.Permissions; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { // Reliability notes: // ReleaseHandle has reliability guarantee of Cer.Success, as defined by SafeHandle. // It gets prepared as a CER at instance construction time. This safe handle doesn't // need to override IsInvalid because the one it inherits from // SafeHandleZeroOrMinusOneIsInvalid is correct. //// #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 public sealed class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle() : base(true) { } [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return UnsafeNativeMethods.CloseHandle(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeMemoryMappedFileHandle ** ** Purpose: Safe handle wrapping a file mapping object handle ** ** Date: Febuary 7, 2007 ** ===========================================================*/ using System; using System.Runtime.Versioning; using System.Security.Permissions; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { // Reliability notes: // ReleaseHandle has reliability guarantee of Cer.Success, as defined by SafeHandle. // It gets prepared as a CER at instance construction time. This safe handle doesn't // need to override IsInvalid because the one it inherits from // SafeHandleZeroOrMinusOneIsInvalid is correct. //// // #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 public sealed class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle() : base(true) { } [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeMemoryMappedFileHandle(IntPtr handle, bool ownsHandle) : base(ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { return UnsafeNativeMethods.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
- SafeEventLogWriteHandle.cs
- StateMachine.cs
- RenderTargetBitmap.cs
- ExpressionBindingsDialog.cs
- _NetworkingPerfCounters.cs
- GradientStop.cs
- WebRequestModuleElementCollection.cs
- MessageSmuggler.cs
- BaseDataListActionList.cs
- ErrorTableItemStyle.cs
- DbBuffer.cs
- SRDisplayNameAttribute.cs
- PrimitiveType.cs
- ConfigViewGenerator.cs
- SecurityToken.cs
- MsmqAppDomainProtocolHandler.cs
- WrappingXamlSchemaContext.cs
- SparseMemoryStream.cs
- SqlDataSourceSummaryPanel.cs
- TextServicesPropertyRanges.cs
- ValidationEventArgs.cs
- XmlDataContract.cs
- SmiEventSink_DeferedProcessing.cs
- CacheAxisQuery.cs
- MatrixTransform3D.cs
- SrgsSubset.cs
- CodeTypeReference.cs
- XamlVector3DCollectionSerializer.cs
- UriTemplateClientFormatter.cs
- DisableDpiAwarenessAttribute.cs
- ValidationResult.cs
- RemoveStoryboard.cs
- XsdDuration.cs
- TdsValueSetter.cs
- GenericUriParser.cs
- MessageBox.cs
- SyndicationItemFormatter.cs
- ScriptReference.cs
- SystemPens.cs
- RC2CryptoServiceProvider.cs
- RequestReplyCorrelator.cs
- SchemaImporterExtensionElement.cs
- MissingFieldException.cs
- ZipIOLocalFileDataDescriptor.cs
- TimeIntervalCollection.cs
- TimeoutValidationAttribute.cs
- TextParagraph.cs
- TextCharacters.cs
- SpellerHighlightLayer.cs
- PackagingUtilities.cs
- InvokeProviderWrapper.cs
- Scheduler.cs
- SQLDecimal.cs
- ProviderSettings.cs
- CompilerGlobalScopeAttribute.cs
- DoubleCollectionConverter.cs
- SourceSwitch.cs
- MergeLocalizationDirectives.cs
- DbProviderManifest.cs
- ImageField.cs
- DataServices.cs
- HttpCookiesSection.cs
- NoClickablePointException.cs
- ColorMatrix.cs
- BufferModeSettings.cs
- CreateDataSourceDialog.cs
- XpsFilter.cs
- CanExecuteRoutedEventArgs.cs
- SqlErrorCollection.cs
- BamlResourceDeserializer.cs
- XmlStreamNodeWriter.cs
- HtmlTableCellCollection.cs
- BamlRecordHelper.cs
- DashStyles.cs
- PolyLineSegment.cs
- FixedSOMContainer.cs
- CombinedGeometry.cs
- UICuesEvent.cs
- ObjectSelectorEditor.cs
- ChangePassword.cs
- ObjectDataSourceEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- ToolStripPanelRow.cs
- FormatVersion.cs
- contentDescriptor.cs
- StateMachine.cs
- RectAnimationClockResource.cs
- XamlSerializationHelper.cs
- TagPrefixCollection.cs
- CategoryGridEntry.cs
- XPathDocumentIterator.cs
- XamlSerializerUtil.cs
- Dump.cs
- StringReader.cs
- SqlFunctionAttribute.cs
- DefaultPropertyAttribute.cs
- SystemColorTracker.cs
- FixedTextContainer.cs
- SrgsRulesCollection.cs
- OletxResourceManager.cs