hook

Classes, exceptions, and methods to hook functions on Windows.

class pyjectify.windows.modules.hook.Hook(process: ProcessHandle)[source]

This class provides methods to hook functions of the target process

trampoline(target: int, size: int) int[source]

Set up a trampoline to the target function with specified size

Parameters:
  • target – the target address of the function the trampoline will jump to

  • size – the size of the bytes of the original function to copy in the trampoline before jumping

Returns:

The address of the trampoline

Warning

For classic inline hooks, the size must be superior to the length of the jump code (7 bytes for 32-bits and 12 bytes for 64-bytes) and must correspond to the size of the first complete instructions of the original function

inline(target: int, hook: int) None[source]

Set up an inline hook to the target function

Parameters:
  • target – address of the function to hook

  • hook – address of the hooking function