A bit of refactoring to be able to find some issue...

This commit is contained in:
Krom, Robertus 2020-02-18 16:32:51 +01:00
commit 42cd533862
308 changed files with 2705 additions and 2454 deletions

View file

@ -0,0 +1,31 @@
using System;
using System.Security;
using System.Security.Permissions;
using Microsoft.Win32.SafeHandles;
namespace GreenshotPlugin.UnmanagedHelpers
{
/// <summary>
/// A SafeHandle class implementation for the hIcon
/// </summary>
public class SafeIconHandle : SafeHandleZeroOrMinusOneIsInvalid {
/// <summary>
/// Needed for marshalling return values
/// </summary>
[SecurityCritical]
public SafeIconHandle() : base(true)
{
}
public SafeIconHandle(IntPtr hIcon) : base(true) {
SetHandle(hIcon);
}
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
protected override bool ReleaseHandle() {
return User32.DestroyIcon(handle);
}
}
}