Files
Dec2017-Script-Dump/mscorlib/Microsoft/Win32/SafeHandles/SafeFileHandle.cs
T
2026-06-04 11:42:34 +02:00

35 lines
1.2 KiB
C#

using System;
using System.IO;
namespace Microsoft.Win32.SafeHandles
{
/// <summary>Represents a wrapper class for a file handle. </summary>
// Token: 0x0200006E RID: 110
public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
/// <summary>Initializes a new instance of the <see cref="T:Microsoft.Win32.SafeHandles.SafeFileHandle" /> class. </summary>
/// <param name="preexistingHandle">An <see cref="T:System.IntPtr" /> object that represents the pre-existing handle to use.</param>
/// <param name="ownsHandle">true to reliably release the handle during the finalization phase; false to prevent reliable release (not recommended).</param>
// Token: 0x060006E8 RID: 1768 RVA: 0x00015480 File Offset: 0x00013680
public SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle)
: base(ownsHandle)
{
base.SetHandle(preexistingHandle);
}
// Token: 0x060006E9 RID: 1769 RVA: 0x00015490 File Offset: 0x00013690
internal SafeFileHandle()
: base(true)
{
}
// Token: 0x060006EA RID: 1770 RVA: 0x0001549C File Offset: 0x0001369C
protected override bool ReleaseHandle()
{
MonoIOError monoIOError;
MonoIO.Close(this.handle, out monoIOError);
return monoIOError == MonoIOError.ERROR_SUCCESS;
}
}
}