Skip to content

Feature Request: Support for Mid-Function Hooking Without Parameter Qualification #9

@AlexAdasCca

Description

@AlexAdasCca

Description

First, thank you for creating such an excellent hooking library. I've spent some time learning how to use DynoHook, which works well in most scenarios. However, I was wondering if there's a way to use it without specifying an ICallingConvention with parameter qualification.

In certain cases where we don't need to specify function parameters (e.g., when hooking mid-execution flow at a specific code location rather than at function entry), DynoHook doesn't appear to support this use case optimally.

Proposed Use Case: Mid-Function Hooking

  1. Use Zydis + user-defined signatures(scan code) to identify hook locations (typically before call or jmp instructions)
  2. Hook exactly once at the target location without affecting all call points
  3. Pass a lambda callback that can:
    • Access pre-interrupt context (registers/stack pointers)
    • Flexibly modify original function behavior

Reference Implementation

This technique (known as mid-function hooking) is implemented in the SafetyHook project, which was designed with this capability in mind. An excellent article detailing this approach can be found here: SafetyHook: Mid-Function Hooking - Aixxe's Blog

SafetyHook repository: https://github.com/cursey/safetyhook

Feature Request

Could mid-function hooking support be added to DynoHook? I'd appreciate your insights on:

  • Implementation feasibility
  • Potential design approaches
  • Roadmap considerations

Once again, thank you for maintaining DynoHook — it's a fantastic project, and I really appreciate your work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions