Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InvokerUtil.cs
- ArithmeticLiteral.cs
- PreviewPageInfo.cs
- ColorConverter.cs
- DataGridViewDataErrorEventArgs.cs
- MonthCalendar.cs
- X509Chain.cs
- PathNode.cs
- NullableDecimalAverageAggregationOperator.cs
- ThreadStartException.cs
- ListViewInsertEventArgs.cs
- WindowClosedEventArgs.cs
- DefaultIfEmptyQueryOperator.cs
- remotingproxy.cs
- OleDbRowUpdatingEvent.cs
- ShutDownListener.cs
- ItemCollection.cs
- Vector3DAnimationUsingKeyFrames.cs
- DefaultEvaluationContext.cs
- Italic.cs
- PagesChangedEventArgs.cs
- BoundConstants.cs
- SafeTokenHandle.cs
- ObjectDataProvider.cs
- X509ScopedServiceCertificateElement.cs
- SwitchAttribute.cs
- Clipboard.cs
- EntityContainerEmitter.cs
- Comparer.cs
- IERequestCache.cs
- PinnedBufferMemoryStream.cs
- FreezableOperations.cs
- ToolStripTemplateNode.cs
- Hashtable.cs
- WindowsListViewItemCheckBox.cs
- XslCompiledTransform.cs
- SchemaMapping.cs
- RelativeSource.cs
- DataListItemCollection.cs
- RegexMatchCollection.cs
- SafeViewOfFileHandle.cs
- path.cs
- FontStyle.cs
- DataColumnMapping.cs
- XhtmlConformanceSection.cs
- HtmlTableRow.cs
- RegisteredScript.cs
- WebPartVerb.cs
- SqlProviderManifest.cs
- DispatcherHookEventArgs.cs
- ClientBuildManager.cs
- SecurityManager.cs
- VariableQuery.cs
- SessionSwitchEventArgs.cs
- PropertySet.cs
- EncoderParameters.cs
- ToggleButtonAutomationPeer.cs
- SafeEventLogReadHandle.cs
- ActivityExecutionContextCollection.cs
- MsmqTransportSecurityElement.cs
- HebrewCalendar.cs
- DesignerCommandSet.cs
- XmlWrappingReader.cs
- PointAnimationClockResource.cs
- AnnotationHelper.cs
- StringArrayConverter.cs
- ClientUrlResolverWrapper.cs
- DocumentEventArgs.cs
- Underline.cs
- StaticSiteMapProvider.cs
- SerializationException.cs
- SqlPersonalizationProvider.cs
- CubicEase.cs
- RuleInfoComparer.cs
- AspNetHostingPermission.cs
- WindowsRegion.cs
- TextEditorLists.cs
- WindowsTab.cs
- XmlObjectSerializerReadContextComplexJson.cs
- StructuralType.cs
- VoiceChangeEventArgs.cs
- AttachmentService.cs
- XmlAnyAttributeAttribute.cs
- SamlSubjectStatement.cs
- SocketPermission.cs
- RunClient.cs
- SubMenuStyleCollection.cs
- ConfigXmlCDataSection.cs
- DataGridViewBand.cs
- StrongNameUtility.cs
- AttributeCollection.cs
- DurableServiceAttribute.cs
- OutputCacheSettingsSection.cs
- MenuStrip.cs
- LineVisual.cs
- VerticalAlignConverter.cs
- StandardToolWindows.cs
- JapaneseCalendar.cs
- GeneralTransform3DGroup.cs
- ToolBar.cs