Skip to content

A VMT hook implementation in Zig. Works on x64 and x86 architectures. Windows only.

License

Notifications You must be signed in to change notification settings

xxhertz/zig-vmt-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To get started:

// Fetch the library via `zig fetch --save=vmthook git+https://github.com/xxhertz/zig-vmt-hook#main`
// build.zig
const vmthook_dep = b.dependency("vmthook", .{});
// for dll/lib
lib.root_module.addImport("vmthook", vmthook_dep.module("hooking"));
// for exe
exe.addImport("vmthook", vmthook_dep.module("hooking"));
// for modules
exe.addImport("vmthook", vmthook_dep.module("hooking"));
// Import the library
const hooking = @import("vmthook");
// Initialize the library at runtime
hooking.init(allocator);
// Hook a function
original_func = @ptrCast(hooking.virtual_hook(vtable, 10, &hook));
// Release all hooks
hooking.deinit();

This works for both x86 and x64, you can see examples in my recent projects:

About

A VMT hook implementation in Zig. Works on x64 and x86 architectures. Windows only.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages