Initial commit
Nothing has actually been tested yet.
This commit is contained in:
18
src/dlhook.h
Normal file
18
src/dlhook.h
Normal 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
|
||||
Reference in New Issue
Block a user