Skip to content

Thordin/vtable-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vtable-hook

C++ Vtable Hooking Library. Only requires a header.

Supports Windows and Linux.

Example

#include "vtablehook.h"
#include <stdio.h>

class Object {
        public:
        int member;

        Object(int init) {
                member = init;
        }

        virtual void Foo() {
                printf("Bar\n");
        }
};

#ifdef WIN32
void __fastcall FooHook(Object* that) {
#elif __linux__
void FooHook(Object* that) {
#endif
        printf("Hooked %i\n", that->member);
}

int main() {
        Object* o = new Object(123);
        o->Foo(); // prints Bar

        vtablehook_hook(o, (void*)FooHook, 0);
        o->Foo(); // prints Hooked 123

        return 0;
}

About

C++ Vtable Hooking Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published