This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,133 @@
using System;
using System.Runtime.ConstrainedExecution;
namespace System.Runtime.InteropServices
{
/// <summary>Represents a wrapper class for handle resources.</summary>
// Token: 0x02000305 RID: 773
public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.CriticalHandle" /> class with the specified invalid handle value.</summary>
/// <param name="invalidHandleValue">The value of an invalid handle (usually 0 or -1).</param>
/// <exception cref="T:System.TypeLoadException">The derived class resides in an assembly without unmanaged code access permission.</exception>
// Token: 0x060021E0 RID: 8672 RVA: 0x00079274 File Offset: 0x00077474
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
protected CriticalHandle(IntPtr invalidHandleValue)
{
this.handle = invalidHandleValue;
}
/// <summary>Frees all resources associated with the handle.</summary>
// Token: 0x060021E1 RID: 8673 RVA: 0x00079284 File Offset: 0x00077484
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
~CriticalHandle()
{
this.Dispose(false);
}
/// <summary>Marks the handle for releasing and freeing resources.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x060021E2 RID: 8674 RVA: 0x000792C0 File Offset: 0x000774C0
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public void Close()
{
this.Dispose(true);
}
/// <summary>Releases all resources used by the <see cref="T:System.Runtime.InteropServices.CriticalHandle" />. </summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x060021E3 RID: 8675 RVA: 0x000792CC File Offset: 0x000774CC
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public void Dispose()
{
this.Dispose(true);
}
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Runtime.InteropServices.CriticalHandle" /> class specifying whether to perform a normal dispose operation.</summary>
/// <param name="disposing">true for a normal dispose operation; false to finalize the handle.</param>
// Token: 0x060021E4 RID: 8676 RVA: 0x000792D8 File Offset: 0x000774D8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
protected virtual void Dispose(bool disposing)
{
if (this._disposed)
{
return;
}
this._disposed = true;
if (this.IsInvalid)
{
return;
}
if (disposing && !this.IsInvalid && !this.ReleaseHandle())
{
GC.SuppressFinalize(this);
}
}
/// <summary>When overridden in a derived class, executes the code required to free the handle.</summary>
/// <returns>true if the handle is released successfully; otherwise, in the event of a catastrophic failure, false. In this case, it generates a releaseHandleFailed MDA Managed Debugging Assistant.</returns>
// Token: 0x060021E5 RID: 8677
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
protected abstract bool ReleaseHandle();
/// <summary>Sets the handle to the specified pre-existing handle.</summary>
/// <param name="handle">The pre-existing handle to use.</param>
// Token: 0x060021E6 RID: 8678 RVA: 0x0007932C File Offset: 0x0007752C
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
protected void SetHandle(IntPtr handle)
{
this.handle = handle;
}
/// <summary>Marks a handle as invalid.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x060021E7 RID: 8679 RVA: 0x00079338 File Offset: 0x00077538
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public void SetHandleAsInvalid()
{
this._disposed = true;
}
/// <summary>Gets a value indicating whether the handle is closed.</summary>
/// <returns>true if the handle is closed; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x17000646 RID: 1606
// (get) Token: 0x060021E8 RID: 8680 RVA: 0x00079344 File Offset: 0x00077544
public bool IsClosed
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get
{
return this._disposed;
}
}
/// <summary>When overridden in a derived class, gets a value indicating whether the handle value is invalid.</summary>
/// <returns>true if the handle is valid; otherwise, false.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x17000647 RID: 1607
// (get) Token: 0x060021E9 RID: 8681
public abstract bool IsInvalid
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
get;
}
/// <summary>Specifies the handle to be wrapped.</summary>
// Token: 0x04000CF7 RID: 3319
protected IntPtr handle;
// Token: 0x04000CF8 RID: 3320
private bool _disposed;
}
}