diff --git a/GreenshotCore/GreenshotCore.csproj b/GreenshotCore/GreenshotCore.csproj index 08aee65bd..636cc2e72 100644 --- a/GreenshotCore/GreenshotCore.csproj +++ b/GreenshotCore/GreenshotCore.csproj @@ -91,6 +91,7 @@ + diff --git a/GreenshotCore/Helpers/CredentialsHelper.cs b/GreenshotCore/Helpers/CredentialsHelper.cs index 6da3cfad8..c1df46d3d 100644 --- a/GreenshotCore/Helpers/CredentialsHelper.cs +++ b/GreenshotCore/Helpers/CredentialsHelper.cs @@ -20,12 +20,14 @@ */ using System; using System.Drawing; -using System.Runtime.InteropServices; using System.Reflection; +using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Windows.Forms; +using Greenshot.UnmanagedHelpers; + /// /// The following code comes from: http://www.developerfusion.com/code/4693/using-the-credential-management-api/ /// and is slightly modified so it works for us. @@ -423,10 +425,12 @@ namespace Greenshot.Helpers { password, CREDUI.MAX_PASSWORD_LENGTH, ref saveChecked, flags - ); + ); // clean up resources - if (this.Banner != null) GDI32.DeleteObject(info.hbmBanner); + if (this.Banner != null) { + GDI32.DeleteObject(info.hbmBanner); + } // set the accessors from the api call parameters this.Name = name.ToString(); @@ -514,14 +518,6 @@ namespace Greenshot.Helpers { } } - public sealed class GDI32 { - private GDI32() { - } - - [DllImport("gdi32.dll", EntryPoint="DeleteObject")] - public static extern bool DeleteObject(IntPtr hObject); - } - public sealed class CREDUI { private CREDUI() { }