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
- x509utils.cs
- IProvider.cs
- TriggerBase.cs
- CaseStatement.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ContainerFilterService.cs
- HwndTarget.cs
- FormatSettings.cs
- CodeIdentifiers.cs
- webclient.cs
- LookupNode.cs
- MarkupExtensionParser.cs
- StagingAreaInputItem.cs
- DataServiceProviderWrapper.cs
- DXD.cs
- Logging.cs
- CodeRemoveEventStatement.cs
- SerializationStore.cs
- LocalValueEnumerator.cs
- SQLInt16Storage.cs
- HotSpotCollection.cs
- PartialCachingControl.cs
- WebPart.cs
- AnnotationStore.cs
- PeerCollaboration.cs
- WmlListAdapter.cs
- UserPersonalizationStateInfo.cs
- DataTrigger.cs
- DataRow.cs
- XmlDataLoader.cs
- SizeIndependentAnimationStorage.cs
- XmlSecureResolver.cs
- SynchronizedDispatch.cs
- FlagsAttribute.cs
- TiffBitmapEncoder.cs
- EnumerableRowCollection.cs
- ParserOptions.cs
- httpserverutility.cs
- GiveFeedbackEvent.cs
- Slider.cs
- PathNode.cs
- IIS7UserPrincipal.cs
- ToolboxItem.cs
- SqlStream.cs
- MaskedTextBox.cs
- InternalConfigEventArgs.cs
- ClientTargetSection.cs
- Bits.cs
- CodeThrowExceptionStatement.cs
- GroupBoxRenderer.cs
- CorrelationExtension.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- XamlTypeMapper.cs
- EmptyElement.cs
- GridLength.cs
- ACE.cs
- CompositeCollectionView.cs
- SortExpressionBuilder.cs
- Vector3D.cs
- InstanceKeyNotReadyException.cs
- SerialErrors.cs
- Flattener.cs
- ASCIIEncoding.cs
- CultureSpecificStringDictionary.cs
- ImageIndexConverter.cs
- LayoutSettings.cs
- XPathAncestorQuery.cs
- QueryHandler.cs
- XmlReflectionMember.cs
- WindowInteropHelper.cs
- FloaterBaseParagraph.cs
- CorrelationManager.cs
- HostedHttpRequestAsyncResult.cs
- ServicePointManager.cs
- FixUpCollection.cs
- InteropAutomationProvider.cs
- ProviderException.cs
- SafeSecurityHelper.cs
- FlowPosition.cs
- SoapEnumAttribute.cs
- WindowsListViewScroll.cs
- BuildResultCache.cs
- DrawingGroupDrawingContext.cs
- ToolStripItemClickedEventArgs.cs
- RequiredFieldValidator.cs
- ReferenceSchema.cs
- TypeDescriptionProviderAttribute.cs
- ToolStripManager.cs
- KoreanCalendar.cs
- DesignBindingPropertyDescriptor.cs
- FilterableAttribute.cs
- ButtonBaseAdapter.cs
- LayoutTableCell.cs
- SafeRegistryHandle.cs
- HtmlHistory.cs
- CompilerTypeWithParams.cs
- Selection.cs
- Color.cs
- DoubleIndependentAnimationStorage.cs
- PowerStatus.cs