jmpews / Dobby

a lightweight, multi-platform, multi-architecture hook framework.
Apache License 2.0
3.98k stars 822 forks source link

how to hook strstr overload function #48

Closed lozn00 closed 5 years ago

lozn00 commented 5 years ago

error: address of overloaded function 'strstr' does not match required type 'void' ZzReplace((void ) strstr, (void ) fake_strstr, (void **) &origin_strstr);

lozn00 commented 5 years ago

cannot hook typedef const char *(*strstr_override_const)(const char *h, const char *n);

only enable hook typedef char *(*strstr_override)(char *h, const char *n); call if call strstr("a","a")canot catch info

c code

inline __always_inline
const char* strstr(const char* h, const char* n) __prefer_this_overload {
    return __bionic_strstr(h, n);
}
inline __always_inline
char* strstr(char* h, const char* n) __prefer_this_overload { //enable hook
    return __bionic_strstr(h, n);
}