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
- HtmlInputCheckBox.cs
- ObjectStateEntry.cs
- BuildResultCache.cs
- DataGridViewHeaderCell.cs
- SoapAttributeOverrides.cs
- BackgroundWorker.cs
- DataGridViewColumnStateChangedEventArgs.cs
- AnonymousIdentificationSection.cs
- XmlSchemaValidationException.cs
- SmtpClient.cs
- CodeDirectoryCompiler.cs
- DataBoundLiteralControl.cs
- StringDictionaryCodeDomSerializer.cs
- x509utils.cs
- X509Certificate2.cs
- File.cs
- IntSumAggregationOperator.cs
- DefaultParameterValueAttribute.cs
- CharAnimationBase.cs
- ListViewDeleteEventArgs.cs
- LiteralControl.cs
- CharAnimationUsingKeyFrames.cs
- TypedReference.cs
- CachedFontFace.cs
- DownloadProgressEventArgs.cs
- CompilerErrorCollection.cs
- SelectionPatternIdentifiers.cs
- ErasingStroke.cs
- DataContractSerializerElement.cs
- HtmlHead.cs
- StyleSheetRefUrlEditor.cs
- ThreadStateException.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- GACIdentityPermission.cs
- TypedElement.cs
- XmlElement.cs
- ExpressionConverter.cs
- IdentityModelStringsVersion1.cs
- FloaterParagraph.cs
- _WebProxyDataBuilder.cs
- TextEditorDragDrop.cs
- PathData.cs
- EndpointIdentityConverter.cs
- DBSchemaRow.cs
- Encoding.cs
- RootBrowserWindow.cs
- Int32Rect.cs
- CommandHelper.cs
- xml.cs
- BridgeDataReader.cs
- TPLETWProvider.cs
- QueryOutputWriter.cs
- HtmlShim.cs
- ChangeProcessor.cs
- MapPathBasedVirtualPathProvider.cs
- EntityContainerEntitySet.cs
- Perspective.cs
- QueryCacheKey.cs
- CacheAxisQuery.cs
- AddDataControlFieldDialog.cs
- PerformanceCounterPermissionAttribute.cs
- DataList.cs
- _NegotiateClient.cs
- InternalCache.cs
- XmlElement.cs
- VariableBinder.cs
- MDIClient.cs
- CacheDependency.cs
- ListParagraph.cs
- DBDataPermissionAttribute.cs
- Resources.Designer.cs
- SwitchExpression.cs
- CompModSwitches.cs
- Sentence.cs
- COM2EnumConverter.cs
- FrameworkRichTextComposition.cs
- DebugViewWriter.cs
- DeclarativeCatalogPart.cs
- RedistVersionInfo.cs
- DesignTimeParseData.cs
- ListMarkerLine.cs
- SecurityPolicySection.cs
- DispatcherObject.cs
- CustomErrorsSection.cs
- Events.cs
- CheckBoxPopupAdapter.cs
- ObjectAssociationEndMapping.cs
- DataControlLinkButton.cs
- CheckBoxFlatAdapter.cs
- ToolStripDesignerAvailabilityAttribute.cs
- FontDialog.cs
- IndexObject.cs
- CultureTable.cs
- CodeVariableReferenceExpression.cs
- Vector3DCollectionValueSerializer.cs
- KnownTypeAttribute.cs
- ViewCellSlot.cs
- PropertyValueChangedEvent.cs
- CustomPopupPlacement.cs
- ToolStripGrip.cs