Skip to content
forked from macote/Winook

Winook - .NET thread-level hooks library

License

Notifications You must be signed in to change notification settings

PeteyPii/Winook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nuget

Winook is a Windows library that let you install thread-level hooks inside processes. This library offers an alternative to solutions that use global hooks. With thread-level hooks, performance and management issues can be avoided.

Information

Winook uses host processes and dll injection to setup hooks. Both 32-bit and 64-bit support host applications and dlls are included.

Features

  • 32-bit and 64-bit dynamic support
  • Mouse and keyboard specific message handlers
    • Extensive keyboard modifiers support
  • Mouse message filtering at dll level
    • Ability to ignore mouse move messages to improve performance

Application

  • Game Helpers
    • Winook can be used in game helpers. In-game keboard and mouse events can be tied to event handlers in your application. For example, Winook is used in Poe Lurker to provide additional trading functionality.
  • Application Inspection
    • Winook can be used as a telemetry inspection tool.
  • Other Uses
    • Please share how you use Winook!

Limitation

  • This library doesn't work with UWP (Windows Store) apps like Windows 10's Calculator.

Installation

NuGet

Install-Package Winook

Usage

_process = Process.Start(@"c:\windows\notepad.exe");
//_process = Process.Start(@"c:\windows\syswow64\notepad.exe"); // works also with 32-bit

_mouseHook = new MouseHook(_process.Id);
//_mouseHook = new MouseHook(_process.Id, MouseMessageTypes.IgnoreMove);
_mouseHook.MessageReceived += MouseHook_MessageReceived;
//_mouseHook.LeftButtonUp += MouseHook_LeftButtonUp;
//_mouseHook.AddHandler(MouseMessageCode.NCLeftButtonUp, MouseHook_NCLButtonUp);
_mouseHook.InstallAsync();

_keyboardHook = new KeyboardHook(_process.Id);
_keyboardHook.MessageReceived += KeyboardHook_MessageReceived;
//_keyboardHook.AddHandler(KeyCode.Y, Modifiers.ControlShift, KeyboardHook_ControlShiftY);
_keyboardHook.InstallAsync();

...

private void MouseHook_MessageReceived(object sender, MouseMessageEventArgs e)
{
    Debug.WriteLine($"Code: {e.MessageCode}; X: {e.X}; Y: {e.Y}; Delta: {e.Delta}");
}

private void KeyboardHook_MessageReceived(object sender, KeyboardMessageEventArgs e)
{
    Debug.Write($"Code: {e.KeyValue}; Modifiers: {e.Modifiers:x}; Flags: {e.Flags:x}; ");
    Debug.WriteLine($"Shift: {e.Shift}; Control: {e.Control}; Alt: {e.Alt}; Direction: {e.Direction}");
}

License

MIT

Acknowledgements

Thanks to C1rdec for the inspiration and motivation. I created this initially to help him with his project.

About

Winook - .NET thread-level hooks library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 55.3%
  • C++ 41.3%
  • Makefile 3.0%
  • Other 0.4%