Revise Unsafe Calling Convention

This commit is contained in:
Kevin Zhang 2021-12-05 21:49:09 -06:00
parent 21c19b4314
commit 055751603d
2 changed files with 3 additions and 3 deletions

View file

@ -57,7 +57,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey
return state;
}
[MethodImpl(MethodImplOptions.NoInlining)]
[UnmanagedCallersOnly]
private static IntPtr LowLevelKeyboardProc(int nCode, UIntPtr wParam, IntPtr lParam)
{
bool continues = true;

View file

@ -10,7 +10,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey
private const int WH_KEYBOARD_LL = 13;
public static IntPtr SetHook(delegate*<int, UIntPtr, IntPtr, IntPtr> proc)
public static IntPtr SetHook(delegate* unmanaged<int, UIntPtr, IntPtr, IntPtr> proc)
{
using (Process curProcess = Process.GetCurrentProcess())
using (ProcessModule curModule = curProcess.MainModule)
@ -20,7 +20,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey
}
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SetWindowsHookEx(int idHook, delegate*<int, UIntPtr, IntPtr, IntPtr> lpfn, IntPtr hMod, uint dwThreadId);
public static extern IntPtr SetWindowsHookEx(int idHook, delegate* unmanaged<int, UIntPtr, IntPtr, IntPtr> lpfn, IntPtr hMod, uint dwThreadId);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]