Fixes for CharSet marshaling, this caused problems with the IE Capturing.

This commit is contained in:
RKrom 2014-06-20 17:29:27 +02:00
parent d1c7ee5e87
commit aad04bc9d7
7 changed files with 16 additions and 16 deletions

View file

@ -362,7 +362,7 @@ namespace Greenshot.Helpers {
/// </summary>
public class CopyDataChannel : IDisposable {
#region Unmanaged Code
[DllImport("user32", CharSet=CharSet.Unicode, SetLastError = true)]
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)]
private extern static IntPtr GetProp(IntPtr hwnd, string lpString);
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)]
private extern static bool SetProp(IntPtr hwnd, string lpString, IntPtr hData);

View file

@ -84,7 +84,7 @@ namespace GreenshotPlugin.Controls {
[DllImport("user32.dll", SetLastError = true)]
private static extern uint MapVirtualKey(uint uCode, uint uMapType);
[DllImport("user32.dll", EntryPoint = "GetKeyNameTextW", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern int GetKeyNameText(uint lParam, [Out] StringBuilder lpString, int nSize);
// These variables store the current hotkey and modifier(s)

View file

@ -583,7 +583,7 @@ namespace GreenshotPlugin.Core {
/// http://www.pinvoke.net/default.aspx/credui.CredUIPromptForCredentialsW
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/creduipromptforcredentials.asp
/// </summary>
[DllImport("credui", EntryPoint="CredUIPromptForCredentialsW", CharSet=CharSet.Unicode)]
[DllImport("credui", CharSet=CharSet.Unicode)]
public static extern ReturnCodes PromptForCredentials(
ref INFO creditUR,
string targetName,
@ -601,7 +601,7 @@ namespace GreenshotPlugin.Core {
/// http://www.pinvoke.net/default.aspx/credui.CredUIConfirmCredentials
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/creduiconfirmcredentials.asp
/// </summary>
[DllImport("credui.dll", EntryPoint="CredUIConfirmCredentialsW", CharSet=CharSet.Unicode)]
[DllImport("credui.dll", CharSet=CharSet.Unicode)]
public static extern ReturnCodes ConfirmCredentials(string targetName, bool confirm);
}
}

View file

@ -96,16 +96,16 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static class GDIplus {
private static ILog LOG = LogManager.GetLogger(typeof(GDIplus));
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true)]
private static extern int GdipBitmapApplyEffect(IntPtr bitmap, IntPtr effect, ref RECT rectOfInterest, bool useAuxData, IntPtr auxData, int auxDataSize);
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true)]
private static extern int GdipDrawImageFX(IntPtr graphics, IntPtr bitmap, ref RECTF source, IntPtr matrix, IntPtr effect, IntPtr imageAttributes, GpUnit srcUnit);
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true)]
private static extern int GdipSetEffectParameters(IntPtr effect, IntPtr parameters, uint size);
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true)]
private static extern int GdipCreateEffect(Guid guid, out IntPtr effect);
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
[DllImport("gdiplus.dll", SetLastError = true, ExactSpelling = true)]
private static extern int GdipDeleteEffect(IntPtr effect);
private static Guid BlurEffectGuid = new Guid("{633C80A4-1843-482B-9EF2-BE2834C5FDD4}");

View file

@ -57,7 +57,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern int ResumeThread(IntPtr hThread);
[DllImport("kernel32", SetLastError = true)]
public static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32", SetLastError = true, CharSet=CharSet.Unicode)]
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool QueryFullProcessImageName(IntPtr hProcess, uint dwFlags, StringBuilder lpExeName, ref uint lpdwSize);
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint QueryDosDevice(string lpDeviceName, StringBuilder lpTargetPath, uint uuchMax);

View file

@ -30,7 +30,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
/// </summary>
public class PsAPI {
private static readonly ILog LOG = LogManager.GetLogger(typeof(PsAPI));
[DllImport("psapi", SetLastError = true, CharSet=CharSet.Unicode)]
[DllImport("psapi", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, uint nSize);
[DllImport("psapi", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint GetProcessImageFileName(IntPtr hProcess, StringBuilder lpImageFileName, uint nSize);

View file

@ -71,7 +71,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern int ShowWindow(IntPtr hWnd, ShowWindowCommand nCmdShow);
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)]
public extern static int GetWindowText(IntPtr hWnd, StringBuilder lpString, int cch);
[DllImport("user32", CharSet = CharSet.Auto, SetLastError = true)]
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)]
public extern static int GetWindowTextLength(IntPtr hWnd);
[DllImport("user32", SetLastError = true)]
public static extern uint GetSysColor(int nIndex);
@ -137,7 +137,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern bool ShowScrollBar(IntPtr hwnd, ScrollBarDirection scrollBar, bool show);
[DllImport("user32", SetLastError = true)]
public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, bool bRedraw);
[DllImport("user32", SetLastError=true, EntryPoint = "PostMessageA")]
[DllImport("user32", SetLastError=true)]
public static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32", SetLastError = true)]
public static extern RegionResult GetWindowRgn(IntPtr hWnd, SafeHandle hRgn);
@ -157,7 +157,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern IntPtr GetClipboardOwner();
[DllImport("user32", SetLastError = true)]
public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
[DllImport("user32", SetLastError = true, CharSet = CharSet.Auto)]
[DllImport("user32", SetLastError = true)]
public static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);
// Added for WinEventHook logic, Greenshot 1.2
@ -181,9 +181,9 @@ namespace GreenshotPlugin.UnmanagedHelpers {
///
[DllImport("user32", SetLastError = true)]
public static extern uint GetGuiResources(IntPtr hProcess, uint uiFlags);
[DllImport("user32", EntryPoint = "RegisterWindowMessageA", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint RegisterWindowMessage(string lpString);
[DllImport("user32", SetLastError=true, CharSet=CharSet.Auto)]
[DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out UIntPtr lpdwResult);
[DllImport("user32", SetLastError = true)]
public static extern bool GetPhysicalCursorPos(out POINT cursorLocation);