1
0

Initial commit

Nothing has actually been tested yet.
This commit is contained in:
Patrick Gaskin
2020-04-22 00:13:02 -04:00
commit 7e5320ff6f
18 changed files with 692 additions and 0 deletions

18
src/dlhook.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef NMI_DLHOOK_H
#define NMI_DLHOOK_H
#ifdef __cplusplus
extern "C" {
#endif
// nmi_dlhook takes a lib handle from dlopen and redirects the specified symbol
// to another, returning a pointer to the original one. Only calls from within
// that library itself are affected (because it replaces that library's GOT). If
// an error occurs, NULL is returned and if err is a valid pointer, it is set to
// a malloc'd string describing it. This function requires glibc and Linux. It
// should work on any architecture, and it should be resilient to most errors.
void *nmi_dlhook(void *handle, const char *symname, void *target, char **err_out);
#ifdef __cplusplus
}
#endif
#endif