32 lines
681 B
C#
32 lines
681 B
C#
using System.Runtime.ConstrainedExecution;
|
|
using System.Security;
|
|
|
|
namespace YY.Admin.Tools.Interop;
|
|
|
|
internal sealed class IconHandle : WpfSafeHandle
|
|
{
|
|
[SecurityCritical]
|
|
private IconHandle() : base(true, CommonHandles.Icon)
|
|
{
|
|
}
|
|
|
|
[SecurityCritical]
|
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
|
protected override bool ReleaseHandle()
|
|
{
|
|
return InteropMethods.DestroyIcon(handle);
|
|
}
|
|
|
|
[SecurityCritical, SecuritySafeCritical]
|
|
internal static IconHandle GetInvalidIcon()
|
|
{
|
|
return new();
|
|
}
|
|
|
|
[SecurityCritical]
|
|
internal IntPtr CriticalGetHandle()
|
|
{
|
|
return handle;
|
|
}
|
|
}
|