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
- SelfSignedCertificate.cs
- OAVariantLib.cs
- basevalidator.cs
- RootBrowserWindowAutomationPeer.cs
- InternalsVisibleToAttribute.cs
- BaseValidator.cs
- DSASignatureFormatter.cs
- DetailsViewUpdateEventArgs.cs
- TreeViewCancelEvent.cs
- ChtmlTextWriter.cs
- BitSet.cs
- DataGridViewColumn.cs
- InternalControlCollection.cs
- ProxySimple.cs
- DataBindingCollectionEditor.cs
- TrackBarRenderer.cs
- EditingScope.cs
- SqlRowUpdatedEvent.cs
- ProviderConnectionPoint.cs
- TransformerConfigurationWizardBase.cs
- ListViewTableCell.cs
- MatrixTransform.cs
- StatusBar.cs
- LongCountAggregationOperator.cs
- EncodingDataItem.cs
- PropertyPanel.cs
- ListItemDetailViewAttribute.cs
- OpCellTreeNode.cs
- DelegatedStream.cs
- ProgressBarRenderer.cs
- GeneralTransform3DTo2D.cs
- KeyValueConfigurationElement.cs
- XmlSchemaAttribute.cs
- CorePropertiesFilter.cs
- AssemblyEvidenceFactory.cs
- StringOutput.cs
- FlowLayout.cs
- SimpleHandlerBuildProvider.cs
- SmtpLoginAuthenticationModule.cs
- PseudoWebRequest.cs
- CharAnimationUsingKeyFrames.cs
- BuildResult.cs
- cookieexception.cs
- XmlSchemaType.cs
- DnsElement.cs
- TypeElement.cs
- FieldDescriptor.cs
- Library.cs
- WebControlsSection.cs
- AxHostDesigner.cs
- BinHexEncoder.cs
- BitmapEffect.cs
- TreeNode.cs
- IncrementalReadDecoders.cs
- sqlcontext.cs
- TextDecorationCollection.cs
- ReachPageContentSerializer.cs
- DBDataPermissionAttribute.cs
- ApplicationInfo.cs
- PtsPage.cs
- XNodeValidator.cs
- MDIClient.cs
- UserNamePasswordClientCredential.cs
- DbParameterHelper.cs
- TreePrinter.cs
- DrawTreeNodeEventArgs.cs
- DataSourceControl.cs
- ColumnClickEvent.cs
- DecoderFallback.cs
- ToolStripLocationCancelEventArgs.cs
- SqlCharStream.cs
- Quaternion.cs
- MethodImplAttribute.cs
- StackSpiller.Temps.cs
- SafePointer.cs
- ImageListUtils.cs
- TimerEventSubscription.cs
- AudioDeviceOut.cs
- ApplicationSecurityInfo.cs
- StateFinalizationDesigner.cs
- AccessDataSource.cs
- ClockController.cs
- UpdateProgress.cs
- FixedSOMImage.cs
- WebControl.cs
- AssemblyCollection.cs
- TypeReference.cs
- DecoderExceptionFallback.cs
- XmlNamedNodeMap.cs
- InternalTypeHelper.cs
- PingReply.cs
- NullableConverter.cs
- DbXmlEnabledProviderManifest.cs
- GACIdentityPermission.cs
- PropertyItemInternal.cs
- Mouse.cs
- DBSchemaTable.cs
- RegexInterpreter.cs
- PathSegment.cs
- ToolBarDesigner.cs