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
- TypeResolvingOptions.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- DataColumnChangeEvent.cs
- ClientScriptManagerWrapper.cs
- ByteStack.cs
- BevelBitmapEffect.cs
- UriExt.cs
- HtmlButton.cs
- DiagnosticTrace.cs
- StateRuntime.cs
- XmlSchemaType.cs
- FlowDocumentPage.cs
- HttpDebugHandler.cs
- ToolStripGripRenderEventArgs.cs
- ListViewGroup.cs
- RowToFieldTransformer.cs
- CounterCreationData.cs
- UnknownWrapper.cs
- RowParagraph.cs
- FileChangesMonitor.cs
- DataGridCell.cs
- SingleTagSectionHandler.cs
- XomlCompiler.cs
- FilterQueryOptionExpression.cs
- IntMinMaxAggregationOperator.cs
- TransformDescriptor.cs
- GraphicsContext.cs
- ColorMatrix.cs
- IImplicitResourceProvider.cs
- SmtpCommands.cs
- ZipFileInfo.cs
- TileModeValidation.cs
- GiveFeedbackEvent.cs
- MessageBox.cs
- GridPattern.cs
- MultilineStringConverter.cs
- ping.cs
- EndPoint.cs
- TileModeValidation.cs
- SqlUserDefinedAggregateAttribute.cs
- FrameworkReadOnlyPropertyMetadata.cs
- _NtlmClient.cs
- Misc.cs
- FacetChecker.cs
- DocumentCollection.cs
- WebPermission.cs
- uribuilder.cs
- StylusPoint.cs
- NodeInfo.cs
- Or.cs
- HtmlShimManager.cs
- XmlHelper.cs
- ApplicationHost.cs
- UInt64Storage.cs
- Timer.cs
- LocatorBase.cs
- Automation.cs
- ToolStripDropDownItem.cs
- OperatingSystem.cs
- XsltException.cs
- TrustManagerMoreInformation.cs
- CryptoConfig.cs
- TdsValueSetter.cs
- IgnoreDataMemberAttribute.cs
- XmlSchemaAttributeGroup.cs
- HitTestDrawingContextWalker.cs
- ColumnPropertiesGroup.cs
- MSG.cs
- DBDataPermissionAttribute.cs
- TraceUtility.cs
- DataServiceKeyAttribute.cs
- OTFRasterizer.cs
- PolicyUnit.cs
- DataSourceCacheDurationConverter.cs
- _Connection.cs
- SoapObjectInfo.cs
- Logging.cs
- DbgCompiler.cs
- CaseStatement.cs
- StoryFragments.cs
- DockPanel.cs
- WindowsSecurityTokenAuthenticator.cs
- ConfigXmlComment.cs
- Clock.cs
- MetaDataInfo.cs
- DES.cs
- ActivityCollectionMarkupSerializer.cs
- GroupBoxRenderer.cs
- MatrixCamera.cs
- BaseServiceProvider.cs
- WpfXamlType.cs
- PropertyManager.cs
- UITypeEditor.cs
- ApplicationTrust.cs
- RangeValidator.cs
- SrgsNameValueTag.cs
- WindowsGraphics2.cs
- SiteMap.cs
- DbCommandTree.cs
- JournalEntry.cs