mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
A bit of refactoring to be able to find some issue...
This commit is contained in:
parent
bef29df3db
commit
42cd533862
308 changed files with 2705 additions and 2454 deletions
31
GreenshotPlugin/UnmanagedHelpers/SafeIconHandle.cs
Normal file
31
GreenshotPlugin/UnmanagedHelpers/SafeIconHandle.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue