Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
paring | 3978d3c656 |
|
@ -31,7 +31,7 @@ namespace SkyHook
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the hook is active now.
|
/// Whether the hook is active now.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isHookActive => SkyHookNative.HookIsRunning();
|
public bool isHookActive;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Your callback for each key updated events.
|
/// Your callback for each key updated events.
|
||||||
|
@ -90,12 +90,13 @@ namespace SkyHook
|
||||||
_callback = HookCallback;
|
_callback = HookCallback;
|
||||||
|
|
||||||
var result = SkyHookNative.StartHook(_callback);
|
var result = SkyHookNative.StartHook(_callback);
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
exception = new SkyHookException(result);
|
exception = new SkyHookException(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isHookActive = true;
|
||||||
started = true;
|
started = true;
|
||||||
|
|
||||||
_mre.WaitOne();
|
_mre.WaitOne();
|
||||||
|
@ -112,7 +113,6 @@ namespace SkyHook
|
||||||
|
|
||||||
while (!started && exception == null)
|
while (!started && exception == null)
|
||||||
{
|
{
|
||||||
Thread.Yield();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
|
@ -134,6 +134,8 @@ namespace SkyHook
|
||||||
{
|
{
|
||||||
_mre.Set();
|
_mre.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isHookActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -29,12 +29,5 @@ namespace SkyHook
|
||||||
/// <returns><c>null</c> if no error, or an error message.</returns>
|
/// <returns><c>null</c> if no error, or an error message.</returns>
|
||||||
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern string StopHook();
|
public static extern string StopHook();
|
||||||
|
|
||||||
/// <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 = "hook_is_running", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern bool HookIsRunning();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue