Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- WebPartEditVerb.cs
- XsdBuilder.cs
- TextTreeRootTextBlock.cs
- CoreSwitches.cs
- EditorPartChrome.cs
- ListItem.cs
- QueryOperationResponseOfT.cs
- AsyncOperationManager.cs
- InteropAutomationProvider.cs
- Zone.cs
- Compress.cs
- dbenumerator.cs
- SqlUDTStorage.cs
- TypedMessageConverter.cs
- VirtualPathExtension.cs
- KnownBoxes.cs
- ExtenderControl.cs
- Nullable.cs
- processwaithandle.cs
- ConversionContext.cs
- TypeBrowserDialog.cs
- SelectorAutomationPeer.cs
- Message.cs
- SqlMethodCallConverter.cs
- InheritanceUI.cs
- ClientOptions.cs
- PolicyImporterElementCollection.cs
- CodeExporter.cs
- Internal.cs
- LocalizableAttribute.cs
- SerializationInfo.cs
- GiveFeedbackEvent.cs
- EditorZoneDesigner.cs
- ObjectDataSourceView.cs
- SHA512CryptoServiceProvider.cs
- DeleteHelper.cs
- DifferencingCollection.cs
- NextPreviousPagerField.cs
- EventWaitHandle.cs
- WindowsPrincipal.cs
- DoubleAnimationClockResource.cs
- Clock.cs
- ItemType.cs
- EntityContainerAssociationSet.cs
- TextTreeInsertElementUndoUnit.cs
- InvalidPropValue.cs
- COM2PictureConverter.cs
- SimpleType.cs
- Input.cs
- DocumentOrderQuery.cs
- LocalizableAttribute.cs
- WebPart.cs
- FilterQuery.cs
- BindValidator.cs
- PEFileReader.cs
- FixedSOMFixedBlock.cs
- PagesSection.cs
- BamlLocalizationDictionary.cs
- Rotation3DAnimationBase.cs
- IProvider.cs
- MatrixKeyFrameCollection.cs
- BitmapFrameDecode.cs
- InteropEnvironment.cs
- CodeAttachEventStatement.cs
- EnvelopedSignatureTransform.cs
- CodePageUtils.cs
- ADConnectionHelper.cs
- ClientTargetSection.cs
- BinaryFormatter.cs
- WindowsFormsSynchronizationContext.cs
- CodeNamespaceImport.cs
- SerTrace.cs
- TableSectionStyle.cs
- ArrangedElement.cs
- PerfCounters.cs
- ListViewDataItem.cs
- QueryHandler.cs
- xml.cs
- TableSectionStyle.cs
- ECDsa.cs
- SHA1Managed.cs
- Privilege.cs
- BrowserTree.cs
- PropertyValueUIItem.cs
- documentsequencetextview.cs
- StrongNameIdentityPermission.cs
- IResourceProvider.cs
- TreeViewItemAutomationPeer.cs
- PrintController.cs
- WorkerRequest.cs
- CharStorage.cs
- Stack.cs
- HtmlTableRow.cs
- NetworkInterface.cs
- TextTreePropertyUndoUnit.cs
- ReadOnlyDataSourceView.cs
- NativeMethods.cs
- QueryOutputWriter.cs
- AbstractExpressions.cs
- FormViewUpdatedEventArgs.cs