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
- DispatcherHooks.cs
- SaveCardRequest.cs
- ConstrainedDataObject.cs
- PackWebRequest.cs
- DebugHandleTracker.cs
- StickyNote.cs
- ByeOperationCD1AsyncResult.cs
- SqlServer2KCompatibilityAnnotation.cs
- PreviewPrintController.cs
- ResolveDuplexCD1AsyncResult.cs
- X509IssuerSerialKeyIdentifierClause.cs
- DesignerForm.cs
- DesignerWidgets.cs
- StylusOverProperty.cs
- DocumentSequence.cs
- MetadataArtifactLoaderFile.cs
- EventData.cs
- FormViewUpdateEventArgs.cs
- ClientTargetSection.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- HtmlMeta.cs
- HashAlgorithm.cs
- WebServiceEnumData.cs
- TraceEventCache.cs
- ErrorWrapper.cs
- CommandEventArgs.cs
- ToolStripRenderEventArgs.cs
- ListenDesigner.cs
- FormViewRow.cs
- UserControlFileEditor.cs
- BinaryKeyIdentifierClause.cs
- DescendantOverDescendantQuery.cs
- Int32RectValueSerializer.cs
- Vector3DCollection.cs
- BaseTemplateBuildProvider.cs
- MetadataArtifactLoader.cs
- SqlUDTStorage.cs
- SqlCommandSet.cs
- DurationConverter.cs
- HtmlGenericControl.cs
- TableFieldsEditor.cs
- EdmConstants.cs
- EncodingTable.cs
- MessageContractImporter.cs
- AuthenticationManager.cs
- cookiecontainer.cs
- DoubleLinkList.cs
- RuntimeResourceSet.cs
- ClientRoleProvider.cs
- SqlParameterCollection.cs
- GrammarBuilderPhrase.cs
- AccessViolationException.cs
- DataTableExtensions.cs
- CompareInfo.cs
- BitmapMetadata.cs
- JsonQueryStringConverter.cs
- HtmlInputFile.cs
- FunctionMappingTranslator.cs
- namescope.cs
- StorageConditionPropertyMapping.cs
- MulticastDelegate.cs
- HostingPreferredMapPath.cs
- DataControlFieldHeaderCell.cs
- CharAnimationBase.cs
- CorrelationKeyCalculator.cs
- AutoScrollExpandMessageFilter.cs
- NativeCompoundFileAPIs.cs
- Event.cs
- wgx_render.cs
- ObjectQueryProvider.cs
- QilInvokeLateBound.cs
- TransformFinalBlockRequest.cs
- CustomValidator.cs
- HGlobalSafeHandle.cs
- XamlFigureLengthSerializer.cs
- AssemblyBuilder.cs
- Assembly.cs
- PeerApplicationLaunchInfo.cs
- ModelTreeEnumerator.cs
- ResourceManagerWrapper.cs
- ExceptionWrapper.cs
- SerializerDescriptor.cs
- SqlDependencyListener.cs
- Operator.cs
- SelectionEditor.cs
- DeflateEmulationStream.cs
- MatrixAnimationBase.cs
- HtmlMeta.cs
- XslNumber.cs
- Clock.cs
- CompModSwitches.cs
- FontFamilyIdentifier.cs
- LocalizeDesigner.cs
- PropertyRecord.cs
- ObjectResult.cs
- CheckBox.cs
- ErrorLog.cs
- SingleStorage.cs
- Query.cs
- ReliabilityContractAttribute.cs