Skip to content

Minimal .NET wrapper for TsudaKageyu's MinHook

License

Notifications You must be signed in to change notification settings

goatcorp/MinSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MinSharp Nuget

Minimalistic .NET API wrapper for the minimalistic x86/x64 API Hooking Library for Windows by TsudaKageyu.

Example

private delegate int MessageBoxWDelegate(
  IntPtr hWnd,
  [MarshalAs(UnmanagedType.LPWStr)] string text,
  [MarshalAs(UnmanagedType.LPWStr)] string caption,
  NativeFunctions.MessageBoxType type);

IntPtr pTarget = [...]; // Find address of target function

var hook = new Hook<MessageBoxWDelegate>(pTarget, MessageBoxWDetour);
hook.Enable();

private int MessageBoxWDetour(IntPtr hwnd, string text, string caption, NativeFunctions.MessageBoxType type)
{
    Console.WriteLine($"Hook triggered: {hwnd:X} {text} {caption} {type}");
    return this.messageBoxMinHook.Original(hwnd, text, caption, type);
}

Attribution

MinHook by TsudaKageyu under BSD 2-Clause, with modifications by m417z
Note: The MinHook binary that ships with MinSharp is based on m417z's multihook branch.

About

Minimal .NET wrapper for TsudaKageyu's MinHook

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages