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
- Int16Animation.cs
- CodeParameterDeclarationExpressionCollection.cs
- DiscoveryCallbackBehavior.cs
- ADMembershipUser.cs
- RelativeSource.cs
- TraceContextRecord.cs
- ResolveMatches11.cs
- sqlser.cs
- DataSetUtil.cs
- TreeChangeInfo.cs
- RankException.cs
- RoamingStoreFileUtility.cs
- AutoResetEvent.cs
- DSACryptoServiceProvider.cs
- NamespaceMapping.cs
- LocatorManager.cs
- Process.cs
- ResolveNameEventArgs.cs
- NoClickablePointException.cs
- StylusShape.cs
- MarginsConverter.cs
- MetadataArtifactLoaderCompositeResource.cs
- ToolStrip.cs
- SmtpLoginAuthenticationModule.cs
- Adorner.cs
- Trace.cs
- RuleSettingsCollection.cs
- HttpHandler.cs
- DataTemplateSelector.cs
- ButtonBaseDesigner.cs
- SelectedDatesCollection.cs
- AutomationAttributeInfo.cs
- TabControlEvent.cs
- TrackingProfile.cs
- CodeEventReferenceExpression.cs
- ManipulationPivot.cs
- ApplyTemplatesAction.cs
- XsltInput.cs
- FreezableOperations.cs
- DetailsViewPageEventArgs.cs
- ZipIOExtraFieldZip64Element.cs
- XmlSchemaSimpleTypeUnion.cs
- WebRequestModuleElementCollection.cs
- CultureNotFoundException.cs
- SerializationTrace.cs
- VectorValueSerializer.cs
- TextBox.cs
- DriveInfo.cs
- TextEndOfLine.cs
- MeshGeometry3D.cs
- DocumentCollection.cs
- OneWayBindingElement.cs
- GrammarBuilderBase.cs
- DebugView.cs
- HandoffBehavior.cs
- SmtpException.cs
- OleDbInfoMessageEvent.cs
- ConnectionsZone.cs
- RuleSettings.cs
- EventsTab.cs
- ProjectionCamera.cs
- WebConfigurationManager.cs
- SelectionProcessor.cs
- ReflectionPermission.cs
- RegionInfo.cs
- ResourceWriter.cs
- DataRowCollection.cs
- FontUnitConverter.cs
- BufferedWebEventProvider.cs
- PathFigureCollectionValueSerializer.cs
- UserMapPath.cs
- ReadWriteSpinLock.cs
- NativeMethods.cs
- InstanceCreationEditor.cs
- CallbackValidator.cs
- IteratorAsyncResult.cs
- OleDbMetaDataFactory.cs
- RegistrySecurity.cs
- ContentPresenter.cs
- ListViewItem.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- DbParameterCollectionHelper.cs
- PlatformNotSupportedException.cs
- HandledEventArgs.cs
- UnsafeNativeMethods.cs
- StringConcat.cs
- COM2ExtendedBrowsingHandler.cs
- ContextMenu.cs
- ISAPIWorkerRequest.cs
- CacheEntry.cs
- StylusPointProperties.cs
- SystemGatewayIPAddressInformation.cs
- PropertyGridView.cs
- PolyLineSegment.cs
- FixedNode.cs
- BitmapEffect.cs
- Thumb.cs
- METAHEADER.cs
- Transform3D.cs
- SegmentInfo.cs