Skip to content

ubelstahl/dynhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

DynHook

x86 Dynamic Relocation Hooking Library for Unix & Unix-Like Operating Systems.

Usage

#include <stdio.h>
#include <dlfcn.h>
#include <dynhook.h>

DynHook_t hook;

typedef void ( *somefunc_t )( int var1 );
void somefunc_hook ( int var1 ) {
    printf( "Works\n" );
    ( ( somefunc_t )hook->original )( var1 );
    DynHook_free( hook );
}

void main () {
    void *handle = dlopen( "somelib.so", 1 );
    hook = DynHook_new( handle, "somefunc", ( void* )somefunc_hook );
}

Usage (with macros)

#include <stdio.h>
#include <dlfcn.h>
#include <dynhook.h>

DynHook_DefHook( void, somefunc, int var1 ) {
    printf( "Works\n" );
    DynHook_Super( somefunc, var1 );
    DynHook_Stop( somefunc );
}

void main () {
    void *handle = dlopen( "somelib.so", 1 );
    DynHook_Start( handle, "somefunc", somefunc );
}

About

x86 Dynamic Relocation Hooking Library for Unix & Unix-Like Operating Systems

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages