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
- PreviewControlDesigner.cs
- JsonWriterDelegator.cs
- SignHashRequest.cs
- WsdlContractConversionContext.cs
- TagPrefixInfo.cs
- TriggerActionCollection.cs
- OdbcError.cs
- ProgressBarHighlightConverter.cs
- DNS.cs
- Menu.cs
- DbDataAdapter.cs
- ExpressionVisitorHelpers.cs
- RegexMatchCollection.cs
- SignatureHelper.cs
- PerformanceCounterManager.cs
- StrokeCollection.cs
- FilterableAttribute.cs
- ExclusiveHandleList.cs
- TableItemPatternIdentifiers.cs
- KeyValueSerializer.cs
- DelayedRegex.cs
- SqlDeflator.cs
- FileController.cs
- XmlSchemaComplexType.cs
- ApplicationDirectoryMembershipCondition.cs
- UInt32Converter.cs
- EvidenceBase.cs
- DirtyTextRange.cs
- ImageMapEventArgs.cs
- ConstraintCollection.cs
- ControlEvent.cs
- ReturnEventArgs.cs
- xamlnodes.cs
- XmlSchemaAnyAttribute.cs
- KeyFrames.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ClientData.cs
- UTF7Encoding.cs
- TablePattern.cs
- CodeTypeDeclarationCollection.cs
- Freezable.cs
- LazyLoadBehavior.cs
- SystemEvents.cs
- CookieParameter.cs
- EdmRelationshipRoleAttribute.cs
- printdlgexmarshaler.cs
- QilIterator.cs
- RadioButton.cs
- WebZone.cs
- BaseParaClient.cs
- SingleAnimationBase.cs
- ProfileGroupSettings.cs
- RowToFieldTransformer.cs
- WebPartExportVerb.cs
- ConcurrentBag.cs
- HttpSessionStateWrapper.cs
- BindingWorker.cs
- RSAPKCS1KeyExchangeFormatter.cs
- SapiRecoInterop.cs
- ParenthesizePropertyNameAttribute.cs
- SessionState.cs
- BamlTreeMap.cs
- Propagator.cs
- InvokeCompletedEventArgs.cs
- ToolStripCustomTypeDescriptor.cs
- MergePropertyDescriptor.cs
- HashLookup.cs
- QilXmlWriter.cs
- SqlWorkflowInstanceStoreLock.cs
- RoutedUICommand.cs
- WorkflowInstanceRecord.cs
- SpoolingTask.cs
- Classification.cs
- AttributeAction.cs
- CodeMethodReturnStatement.cs
- CompositeActivityValidator.cs
- PipelineComponent.cs
- NativeMethodsCLR.cs
- WebBrowser.cs
- TableLayoutCellPaintEventArgs.cs
- WebPartHelpVerb.cs
- LinqDataSourceDeleteEventArgs.cs
- OLEDB_Enum.cs
- AutomationPeer.cs
- Rotation3D.cs
- XPathSelectionIterator.cs
- XmlSchemaParticle.cs
- ForeignKeyFactory.cs
- GridLength.cs
- WorkflowInstanceQuery.cs
- _LazyAsyncResult.cs
- HttpContext.cs
- UInt16.cs
- CachedPathData.cs
- oledbmetadatacolumnnames.cs
- CornerRadius.cs
- SafeTokenHandle.cs
- PtsContext.cs
- PropertyValueUIItem.cs
- BaseDataListActionList.cs