thumb16 thumb32 arm32 inlineHook in Android
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Add Application.mk in example Jun 30, 2016
include Fix issue 11 Aug 16, 2017
Android.mk Add example Jan 18, 2016
Application.mk Add asm.S Jan 14, 2016
README.md Add example Jan 18, 2016
inlineHook.c Fix ‘undefined pid’ in getAllTids() function Oct 29, 2018
relocate.c fixed a bug that would crash on the relocated trampoline: the thumb b… Oct 23, 2018
relocate.h Add multithread processing Jan 23, 2016

README.md

Android-Inline-Hook

thumb16 thumb32 arm32 inlineHook

Build

ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk NDK_APPLICATION_MK=./Application.mk

Example

#include <stdio.h>

#include "inlineHook.h"

int (*old_puts)(const char *) = NULL;

int new_puts(const char *string)
{
    old_puts("inlineHook success");
}

int hook()
{
    if (registerInlineHook((uint32_t) puts, (uint32_t) new_puts, (uint32_t **) &old_puts) != ELE7EN_OK) {
        return -1;
    }
    if (inlineHook((uint32_t) puts) != ELE7EN_OK) {
        return -1;
    }

    return 0;
}

int unHook()
{
    if (inlineUnHook((uint32_t) puts) != ELE7EN_OK) {
        return -1;
    }

    return 0;
}

int main()
{
    puts("test");
    hook();
    puts("test");
    unHook();
    puts("test");
}

Contact

If you find any bugs, please contact me(ele7enxxh@qq.com)