2022-11-03 20:55:22 +09:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
namespace SkyHook
|
|
|
|
{
|
2022-11-06 22:16:34 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Native method calls for SkyHook.
|
|
|
|
/// </summary>
|
|
|
|
internal static class SkyHookNative
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The native callback handled by <see cref="SkyHookManager"/>.
|
|
|
|
/// </summary>
|
|
|
|
public delegate void Callback(SkyHookEvent ev);
|
2022-11-03 20:55:22 +09:00
|
|
|
|
2022-11-06 22:16:34 +09:00
|
|
|
private const string Lib = "skyhook";
|
2022-11-03 20:55:22 +09:00
|
|
|
|
2022-11-06 22:16:34 +09:00
|
|
|
/// <summary>
|
|
|
|
/// The native version of <see cref="SkyHookManager.StartHook"/> method handled by <see cref="SkyHookManager"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="callback">A native callback.</param>
|
|
|
|
/// <returns><c>null</c> if no error, or an error message.</returns>
|
|
|
|
[DllImport(Lib, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern string StartHook(Callback callback);
|
2022-11-03 20:55:22 +09:00
|
|
|
|
2022-11-06 22:16:34 +09:00
|
|
|
/// <summary>
|
|
|
|
/// The native version of <see cref="SkyHookManager.StopHook"/> method handled by <see cref="SkyHookManager"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns><c>null</c> if no error, or an error message.</returns>
|
|
|
|
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern string StopHook();
|
|
|
|
}
|
2022-11-06 22:47:16 +09:00
|
|
|
}
|