Advertisement
Guest User

Untitled

a guest
May 21st, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     void *handle = dlopen("/usr/lib/libsubstitute.dylib", RTLD_NOW); //libsubstitute dylib. Nothing much.
  2.     if (!handle) {
  3.         logToFile("[ERROR] %s", dlerror()); //No error happens here. Assume we're good
  4.         return;
  5.     }
  6.  
  7.     int (*substitute_hook_functions)(const struct substitute_function_hook *hooks, size_t nhooks, struct substitute_function_hook_record **recordp, int options) = dlsym(handle, "substitute_hook_functions");
  8.    
  9.     if (!substitute_hook_functions) {
  10.         logToFile("[ERROR] %s", dlerror()); //No error happens here. Assume we're good
  11.         return;
  12.     }
  13.    
  14.     struct substitute_function_hook psp_fake_hook;
  15.    psp_fake_hook.function = posix_spawn;
  16.     psp_fake_hook.replacement = fake_psx_spawn;
  17.     psp_fake_hook.old_ptr = &old_psx_spawn;
  18.     psp_fake_hook.options = 0;
  19.     substitute_hook_functions(&psp_fake_hook, 1, NULL, SUBSTITUTE_NO_THREAD_SAFETY);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement