Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / clr / src / BCL / Microsoft / Win32 / SafeHandles / SafeViewOfFileHandle.cs / 1 / SafeViewOfFileHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeViewOfFileHandle ** ** ** A wrapper for file handles ** ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeViewOfFileHandle() : base(true) {} // 0 is an Invalid Handle [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { if (Win32Native.UnmapViewOfFile(handle)) { handle = IntPtr.Zero; return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeViewOfFileHandle ** ** ** A wrapper for file handles ** ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Runtime.Versioning; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; namespace Microsoft.Win32.SafeHandles { internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeViewOfFileHandle() : base(true) {} // 0 is an Invalid Handle [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)] internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) { SetHandle(handle); } [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] override protected bool ReleaseHandle() { if (Win32Native.UnmapViewOfFile(handle)) { handle = IntPtr.Zero; return true; } return false; } } } // 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
- MetadataArtifactLoaderXmlReaderWrapper.cs
- SiteMapSection.cs
- HttpCapabilitiesEvaluator.cs
- UnsignedPublishLicense.cs
- RadialGradientBrush.cs
- DependencyObjectType.cs
- UnknownWrapper.cs
- XmlNullResolver.cs
- XmlHierarchicalEnumerable.cs
- CodeDOMUtility.cs
- Vector3DIndependentAnimationStorage.cs
- PackageRelationship.cs
- CollectionChangedEventManager.cs
- LogicalExpr.cs
- IndexedWhereQueryOperator.cs
- CompositeTypefaceMetrics.cs
- GridView.cs
- DataAdapter.cs
- AuthenticationModuleElement.cs
- XsltInput.cs
- MatrixCamera.cs
- CapabilitiesSection.cs
- PartialList.cs
- OracleCommand.cs
- HandlerBase.cs
- PageAsyncTask.cs
- Point4DConverter.cs
- CodeGenerator.cs
- BeginStoryboard.cs
- ConfigXmlSignificantWhitespace.cs
- MissingSatelliteAssemblyException.cs
- ComponentRenameEvent.cs
- MetadataCache.cs
- SchemaEntity.cs
- Style.cs
- ImageConverter.cs
- PositiveTimeSpanValidator.cs
- NotCondition.cs
- InputLanguageCollection.cs
- CollectionViewGroupInternal.cs
- XmlTextAttribute.cs
- PersonalizationEntry.cs
- ErrorsHelper.cs
- ReachPageContentSerializerAsync.cs
- EmptyControlCollection.cs
- DecoratedNameAttribute.cs
- EditorAttribute.cs
- Subtract.cs
- CheckBoxRenderer.cs
- FrameworkReadOnlyPropertyMetadata.cs
- Attributes.cs
- NullableBoolConverter.cs
- OperatingSystemVersionCheck.cs
- TextBoxBase.cs
- SafeCloseHandleCritical.cs
- RangeExpression.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- PropertyMappingExceptionEventArgs.cs
- EdmToObjectNamespaceMap.cs
- AuthenticationException.cs
- XmlSignatureManifest.cs
- SubtreeProcessor.cs
- DataGridViewTopRowAccessibleObject.cs
- PriorityBindingExpression.cs
- SignedInfo.cs
- SequenceFullException.cs
- ButtonField.cs
- FigureParagraph.cs
- AutomationEventArgs.cs
- CreateSequenceResponse.cs
- EntityDataSourceState.cs
- CmsInterop.cs
- ObjectListDataBindEventArgs.cs
- WebPartCancelEventArgs.cs
- ColumnResult.cs
- SelectionChangedEventArgs.cs
- StylusCaptureWithinProperty.cs
- InvalidFilterCriteriaException.cs
- AvtEvent.cs
- ManualResetEvent.cs
- MessageQueueAccessControlEntry.cs
- ControlParameter.cs
- HyperLinkStyle.cs
- Image.cs
- XmlILConstructAnalyzer.cs
- Activator.cs
- FileDialog_Vista.cs
- GenericEnumConverter.cs
- Attribute.cs
- ObjectDataSourceChooseTypePanel.cs
- PerformanceCounterPermissionEntryCollection.cs
- X509PeerCertificateElement.cs
- CodeTryCatchFinallyStatement.cs
- EntitySqlQueryBuilder.cs
- Graph.cs
- CompilerLocalReference.cs
- XmlDownloadManager.cs
- EmbeddedMailObjectsCollection.cs
- SplineKeyFrames.cs
- XmlDictionaryString.cs