Code:
/ FX-1434 / FX-1434 / 1.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
- WindowsServiceCredential.cs
- XmlEncodedRawTextWriter.cs
- SqlExpressionNullability.cs
- XmlNamespaceManager.cs
- OperatingSystem.cs
- JsonQueryStringConverter.cs
- BuildTopDownAttribute.cs
- WizardStepBase.cs
- DPTypeDescriptorContext.cs
- DataColumnPropertyDescriptor.cs
- XPathQilFactory.cs
- StyleXamlParser.cs
- QueryComponents.cs
- SqlExpressionNullability.cs
- InvariantComparer.cs
- CheckBoxAutomationPeer.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- DropShadowBitmapEffect.cs
- Trace.cs
- EqualityComparer.cs
- MenuItemCollectionEditor.cs
- QuotedStringFormatReader.cs
- dbenumerator.cs
- UnsafeNativeMethodsMilCoreApi.cs
- CellCreator.cs
- SQLDateTime.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- WinEventHandler.cs
- AbandonedMutexException.cs
- TextEmbeddedObject.cs
- BinHexEncoder.cs
- DataGridViewCheckBoxCell.cs
- ComNativeDescriptor.cs
- StreamSecurityUpgradeAcceptor.cs
- PanelStyle.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- SmtpSection.cs
- RenderCapability.cs
- SmtpLoginAuthenticationModule.cs
- ReflectTypeDescriptionProvider.cs
- SystemInformation.cs
- EventLogPermissionEntry.cs
- TextAutomationPeer.cs
- DetailsViewUpdateEventArgs.cs
- CrossSiteScriptingValidation.cs
- UnmanagedHandle.cs
- UnauthorizedAccessException.cs
- NameValueCache.cs
- PrintDocument.cs
- FixedStringLookup.cs
- XPathSelectionIterator.cs
- DesignerHelpers.cs
- CapiSymmetricAlgorithm.cs
- formatter.cs
- EllipseGeometry.cs
- Application.cs
- ComAdminInterfaces.cs
- ProfileParameter.cs
- TextMetrics.cs
- LoginAutoFormat.cs
- controlskin.cs
- GroupBox.cs
- CreateRefExpr.cs
- ConnectAlgorithms.cs
- DocumentXPathNavigator.cs
- ArgIterator.cs
- ModuleConfigurationInfo.cs
- UInt16Storage.cs
- Control.cs
- BitmapPalettes.cs
- MemberRelationshipService.cs
- serverconfig.cs
- Lease.cs
- WaitHandleCannotBeOpenedException.cs
- QueryPageSettingsEventArgs.cs
- EditingCommands.cs
- CssTextWriter.cs
- StringAttributeCollection.cs
- HandlerBase.cs
- RotateTransform.cs
- PLINQETWProvider.cs
- RevocationPoint.cs
- XmlSchemaValidator.cs
- UmAlQuraCalendar.cs
- TimeSpanParse.cs
- TemplateBamlRecordReader.cs
- Token.cs
- DataSourceProvider.cs
- WebPartConnectionsCancelEventArgs.cs
- ListViewGroupCollectionEditor.cs
- ColumnMap.cs
- DeclaredTypeValidator.cs
- NamedPipeHostedTransportConfiguration.cs
- TextBreakpoint.cs
- SimpleExpression.cs
- PassportIdentity.cs
- ViewSimplifier.cs
- DrawingGroup.cs
- LayoutEvent.cs
- ResourceExpressionBuilder.cs