33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
using System;
|
|
using System.Runtime.ConstrainedExecution;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Microsoft.Win32.SafeHandles
|
|
{
|
|
/// <summary>Provides a base class for Win32 safe handle implementations in which the value of either 0 or -1 indicates an invalid handle.</summary>
|
|
// Token: 0x02000070 RID: 112
|
|
public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle, IDisposable
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid" /> class, specifying whether the handle is to be reliably released. </summary>
|
|
/// <param name="ownsHandle">true to reliably release the handle during the finalization phase; false to prevent reliable release (not recommended).</param>
|
|
// Token: 0x060006ED RID: 1773 RVA: 0x000154E0 File Offset: 0x000136E0
|
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
|
protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle)
|
|
: base((IntPtr)0, ownsHandle)
|
|
{
|
|
}
|
|
|
|
/// <summary>Gets a value that indicates whether the handle is invalid.</summary>
|
|
/// <returns>true if the handle is not valid; otherwise, false.</returns>
|
|
// Token: 0x170000D0 RID: 208
|
|
// (get) Token: 0x060006EE RID: 1774 RVA: 0x000154F0 File Offset: 0x000136F0
|
|
public override bool IsInvalid
|
|
{
|
|
get
|
|
{
|
|
return this.handle == (IntPtr)(-1) || this.handle == (IntPtr)0;
|
|
}
|
|
}
|
|
}
|
|
}
|