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
- XslAstAnalyzer.cs
- XmlNodeWriter.cs
- RegexMatch.cs
- DrawingBrush.cs
- ResourceDefaultValueAttribute.cs
- DBConcurrencyException.cs
- AutomationPatternInfo.cs
- TextPointer.cs
- __FastResourceComparer.cs
- OracleSqlParser.cs
- ColumnCollection.cs
- IndexerHelper.cs
- ObjectDataSourceChooseTypePanel.cs
- DecoderExceptionFallback.cs
- MetadataArtifactLoaderResource.cs
- RIPEMD160Managed.cs
- AssociationTypeEmitter.cs
- LayoutTableCell.cs
- NoPersistScope.cs
- VarRemapper.cs
- PropertyManager.cs
- ArglessEventHandlerProxy.cs
- ConnectionPoint.cs
- OleDbConnectionInternal.cs
- Logging.cs
- EngineSiteSapi.cs
- COSERVERINFO.cs
- CustomBindingElementCollection.cs
- GraphicsState.cs
- CrossContextChannel.cs
- QilVisitor.cs
- PageClientProxyGenerator.cs
- UnaryQueryOperator.cs
- StyleHelper.cs
- PointCollection.cs
- ServiceRouteHandler.cs
- ControlIdConverter.cs
- Focus.cs
- MultiByteCodec.cs
- GreenMethods.cs
- SecurityKeyIdentifier.cs
- cookiecollection.cs
- IgnoreDataMemberAttribute.cs
- ImageInfo.cs
- RealizationDrawingContextWalker.cs
- Rectangle.cs
- WorkflowViewManager.cs
- EastAsianLunisolarCalendar.cs
- UniformGrid.cs
- AssociationTypeEmitter.cs
- UnknownExceptionActionHelper.cs
- SmtpNtlmAuthenticationModule.cs
- BitmapInitialize.cs
- DataPointer.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- ParserHooks.cs
- UTF7Encoding.cs
- BehaviorEditorPart.cs
- StickyNoteContentControl.cs
- LinqDataSourceEditData.cs
- MulticastNotSupportedException.cs
- Vector3DConverter.cs
- PrintPreviewDialog.cs
- BindingOperations.cs
- SQLBinary.cs
- SemanticBasicElement.cs
- WeakReference.cs
- CodeDomExtensionMethods.cs
- StaticTextPointer.cs
- FormView.cs
- NetStream.cs
- TypeDependencyAttribute.cs
- ConnectionConsumerAttribute.cs
- SemanticResolver.cs
- DeviceFilterEditorDialog.cs
- AssemblyAttributes.cs
- ToolStripSeparatorRenderEventArgs.cs
- ScrollItemPatternIdentifiers.cs
- WebPermission.cs
- CapabilitiesPattern.cs
- DbConnectionPoolGroupProviderInfo.cs
- LockCookie.cs
- ZipIOExtraFieldElement.cs
- MediaElementAutomationPeer.cs
- ListBox.cs
- HtmlUtf8RawTextWriter.cs
- PackageStore.cs
- SpellerError.cs
- TypeDescriptionProviderAttribute.cs
- Maps.cs
- List.cs
- AppSettingsReader.cs
- SQLConvert.cs
- MemberPath.cs
- RootDesignerSerializerAttribute.cs
- CacheRequest.cs
- HttpDictionary.cs
- Italic.cs
- ColumnClickEvent.cs
- TextServicesCompartment.cs