SafePEFileHandle.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / Microsoft / Win32 / SafeHandles / SafePEFileHandle.cs / 1305376 / SafePEFileHandle.cs

                            // ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 

using System; 
using System.Reflection; 
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution; 
using System.Runtime.InteropServices;
using System.Security;

namespace Microsoft.Win32.SafeHandles 
{
    ///  
    ///     Handle to a VM PEFile * 
    /// 
    [SecurityCritical] 
    internal sealed class SafePEFileHandle : SafeHandleZeroOrMinusOneIsInvalid
    {
        private SafePEFileHandle() : base(true)
        { 
        }
 
        [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] 
        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
        [SuppressUnmanagedCodeSecurity] 
        private static extern void ReleaseSafePEFileHandle(IntPtr peFile);

        [SecurityCritical]
        protected override bool ReleaseHandle() 
        {
            ReleaseSafePEFileHandle(handle); 
            return true; 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 

using System; 
using System.Reflection; 
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution; 
using System.Runtime.InteropServices;
using System.Security;

namespace Microsoft.Win32.SafeHandles 
{
    ///  
    ///     Handle to a VM PEFile * 
    /// 
    [SecurityCritical] 
    internal sealed class SafePEFileHandle : SafeHandleZeroOrMinusOneIsInvalid
    {
        private SafePEFileHandle() : base(true)
        { 
        }
 
        [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] 
        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
        [SuppressUnmanagedCodeSecurity] 
        private static extern void ReleaseSafePEFileHandle(IntPtr peFile);

        [SecurityCritical]
        protected override bool ReleaseHandle() 
        {
            ReleaseSafePEFileHandle(handle); 
            return true; 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK