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
- LayoutEditorPart.cs
- SqlXmlStorage.cs
- Collection.cs
- XmlReturnReader.cs
- RuntimeHandles.cs
- MarkupWriter.cs
- IconBitmapDecoder.cs
- LinqDataView.cs
- MouseButton.cs
- RtType.cs
- RelationshipConverter.cs
- AnnouncementService.cs
- SpecularMaterial.cs
- PerformanceCounterLib.cs
- DBProviderConfigurationHandler.cs
- InputEventArgs.cs
- NumberFunctions.cs
- PolicyManager.cs
- WebFaultClientMessageInspector.cs
- GenericPrincipal.cs
- EditorPartCollection.cs
- _AuthenticationState.cs
- ServerProtocol.cs
- FactoryMaker.cs
- XmlSignatureProperties.cs
- InteropBitmapSource.cs
- IPAddress.cs
- DurableOperationAttribute.cs
- BitmapEffectDrawingContextWalker.cs
- AuthenticatingEventArgs.cs
- AmbientValueAttribute.cs
- Interop.cs
- InvokePatternIdentifiers.cs
- ContainerParagraph.cs
- EmptyControlCollection.cs
- TextChange.cs
- StructuredType.cs
- RunInstallerAttribute.cs
- PathHelper.cs
- FunctionNode.cs
- ExpressionBindingCollection.cs
- ParserStreamGeometryContext.cs
- PriorityRange.cs
- FileDataSourceCache.cs
- AtomEntry.cs
- ProfilePropertySettings.cs
- ScrollEventArgs.cs
- DynamicResourceExtensionConverter.cs
- ImageListUtils.cs
- EdmSchemaError.cs
- BaseTemplateCodeDomTreeGenerator.cs
- ObjectListComponentEditor.cs
- Input.cs
- StrongNameIdentityPermission.cs
- Rotation3D.cs
- TypeSystem.cs
- XhtmlBasicSelectionListAdapter.cs
- ACE.cs
- TheQuery.cs
- TreeViewItemAutomationPeer.cs
- RunInstallerAttribute.cs
- MergePropertyDescriptor.cs
- SchemaInfo.cs
- BinaryObjectInfo.cs
- DesignerCommandAdapter.cs
- MbpInfo.cs
- EpmSyndicationContentSerializer.cs
- login.cs
- StylusButtonCollection.cs
- TdsParameterSetter.cs
- GeneralTransform3DGroup.cs
- TextDpi.cs
- DbProviderSpecificTypePropertyAttribute.cs
- AxImporter.cs
- CommonRemoteMemoryBlock.cs
- EnumMemberAttribute.cs
- ModelTypeConverter.cs
- CacheManager.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- RequestCachePolicy.cs
- KeyFrames.cs
- TextDecorationLocationValidation.cs
- UnsafeNativeMethods.cs
- ConfigXmlDocument.cs
- HiddenField.cs
- SystemIPAddressInformation.cs
- FixedSOMElement.cs
- DataIdProcessor.cs
- TextParaLineResult.cs
- Boolean.cs
- CodeAccessPermission.cs
- StringBuilder.cs
- EdmConstants.cs
- GridViewCancelEditEventArgs.cs
- HttpCapabilitiesBase.cs
- WsdlBuildProvider.cs
- EventLogPermissionAttribute.cs
- AttributeQuery.cs
- HttpAsyncResult.cs
- TemplateControlCodeDomTreeGenerator.cs