About N-CodeHook

N-CodeHook is a small template based C++ library which allows you to hook into functions via inline patching.
For some background info see the blog post or read the paper from the detours website on how inline patching works. Detours uses the same mechanism as N-CodeHook, but requires you to buy a license for the X64 version. Besides the IA32 version must not be used for commercial purposes.
N-CodeHook however is completely free and you can use it for whatever you like.
The distorm disassembler library is used to disassemble the first bytes of the function to be hooked.


10/30/2011 - v1.0.3

  • Bugfix: The library would make the hook crash when trying to patch a call instruction
  • Bugfix: If removing of hooks failed silently, the cleanup code could lead to an endless loop

11/16/2009 - v1.0.2

  • Bugfix: Builds with Unicode solutions
  • Bugfix: In some rare cases, an absolute jump could be written even if disassembling failed
  • Added: Inline hooks can be forced to use absolute jumps

07/07/2008 - v1.0.1

  • Bugfix: Minor bugfixes in hook cleanup code
  • Bugfix: Minor bugfixes in code for creating hooks

06/27/2008 - v1.0

  • First release
  • IA32 and X64 architectures are currently supported


The archive contains the whole library source code and can be downloaded from here.
If you are interested in API hooking you might also want to have a look at the N-InjectLib project, which also has an example on how to use both libraries.