-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Description
#include <funchook.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static int (*getpid_func)();
static int getpid_hook() {
printf("origin getpid==%d\n",getpid_func());
return 0;
}
int main() {
funchook_t *funchook = funchook_create();
getpid_func = getpid;
funchook_prepare(funchook, (void**)&getpid_func, getpid_hook);
if (funchook_install(funchook, 0) != FUNCHOOK_ERROR_SUCCESS) {
printf("%s\n", funchook_error_message(funchook));
}
printf("%d\n",getpid());
return 0;
}
output
Failed to unprotect memory 0xffff876d7000 (size=4096, prot=read,write,exec) <- 0xffff876d76b0 (size=8, error=Invalid argument)
3358211
Metadata
Metadata
Assignees
Labels
No labels