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
- ExceptionWrapper.cs
- DataGridViewColumn.cs
- ConstrainedDataObject.cs
- UnhandledExceptionEventArgs.cs
- SecurityState.cs
- RuntimeHelpers.cs
- DecodeHelper.cs
- SqlUdtInfo.cs
- SafeHandle.cs
- AppSettingsExpressionBuilder.cs
- XmlSchemaGroup.cs
- XmlSchemaSimpleContentExtension.cs
- TickBar.cs
- BooleanStorage.cs
- BaseDataBoundControl.cs
- RadioButtonBaseAdapter.cs
- Error.cs
- EntityDataSourceConfigureObjectContext.cs
- XmlElementAttributes.cs
- DesignOnlyAttribute.cs
- PointHitTestParameters.cs
- AttributeCollection.cs
- DocumentViewer.cs
- Encoder.cs
- TemplateKeyConverter.cs
- RuleConditionDialog.cs
- UpdateException.cs
- AuthenticationManager.cs
- XmlSigningNodeWriter.cs
- FieldAccessException.cs
- StorageModelBuildProvider.cs
- MaskedTextProvider.cs
- DataPagerCommandEventArgs.cs
- PriorityQueue.cs
- FormatException.cs
- SamlAttribute.cs
- PaintEvent.cs
- ConfigurationManagerInternal.cs
- NullableConverter.cs
- SafeTimerHandle.cs
- ProcessHostConfigUtils.cs
- TargetException.cs
- WorkflowRuntimeServiceElement.cs
- DataTableExtensions.cs
- PointKeyFrameCollection.cs
- SchemaImporterExtensionElement.cs
- ValidationEventArgs.cs
- XmlSchemas.cs
- SymLanguageType.cs
- NullableDoubleAverageAggregationOperator.cs
- OuterGlowBitmapEffect.cs
- AmbientLight.cs
- CompletedAsyncResult.cs
- HierarchicalDataBoundControl.cs
- IdentitySection.cs
- Oci.cs
- CubicEase.cs
- ContextItem.cs
- QuaternionKeyFrameCollection.cs
- WsrmFault.cs
- TransformDescriptor.cs
- MailSettingsSection.cs
- FlowDocumentView.cs
- InvalidOleVariantTypeException.cs
- ConfigXmlAttribute.cs
- Int32CAMarshaler.cs
- Matrix.cs
- OdbcConnectionHandle.cs
- WebPartConnectionCollection.cs
- ConfigurationManager.cs
- PlaceHolder.cs
- FrameSecurityDescriptor.cs
- HttpConfigurationSystem.cs
- ProxyWebPartManager.cs
- ObjectDataSourceStatusEventArgs.cs
- InternalBufferOverflowException.cs
- PieceDirectory.cs
- PatternMatchRules.cs
- RegexParser.cs
- SymLanguageType.cs
- FixedSOMSemanticBox.cs
- SectionVisual.cs
- KeyNameIdentifierClause.cs
- ColorBuilder.cs
- DirtyTextRange.cs
- ProjectionPathBuilder.cs
- Transform3D.cs
- RTTypeWrapper.cs
- DataGridViewTopLeftHeaderCell.cs
- PenThreadWorker.cs
- UmAlQuraCalendar.cs
- GregorianCalendarHelper.cs
- ExceptionHandlers.cs
- ModuleBuilderData.cs
- DesignerValidatorAdapter.cs
- WebConfigurationFileMap.cs
- Vector.cs
- UpdatePanelControlTrigger.cs
- CollectionChangeEventArgs.cs
- EpmCustomContentSerializer.cs