Fixes to formatting

This commit is contained in:
Your Name
2022-08-01 08:10:45 +01:00
parent 7b6743f14c
commit e9cb939956
3 changed files with 17 additions and 13 deletions

View File

@ -38,15 +38,16 @@ extern mach_port_t mach_task_self();
extern GumAddress gum_darwin_find_entrypoint(mach_port_t task); extern GumAddress gum_darwin_find_entrypoint(mach_port_t task);
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
typedef struct { typedef struct {
void (**preinit_array)(void);
void (**init_array)(void); void (**preinit_array)(void);
void (**fini_array)(void); void (**init_array)(void);
void (**fini_array)(void);
} structors_array_t; } structors_array_t;
extern void __libc_init(void* raw_args, extern void __libc_init(void *raw_args, void (*onexit)(void) __unused,
void (*onexit)(void) __unused, int (*slingshot)(int, char **, char **),
int (*slingshot)(int, char **, char **), structors_array_t const *const structors);
structors_array_t const * const structors);
#else #else
extern int __libc_start_main(int (*main)(int, char **, char **), int argc, extern int __libc_start_main(int (*main)(int, char **, char **), int argc,
char **ubp_av, void (*init)(void), char **ubp_av, void (*init)(void),
@ -291,17 +292,19 @@ static void intercept_main(void) {
intercept_hook(main, on_main, NULL); intercept_hook(main, on_main, NULL);
} }
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
static void on_libc_init(void* raw_args, static void on_libc_init(void *raw_args, void (*onexit)(void) __unused,
void (*onexit)(void) __unused, int (*slingshot)(int, char **, char **),
int (*slingshot)(int, char**, char**), structors_array_t const *const structors) {
structors_array_t const * const structors){
main_fn = slingshot; main_fn = slingshot;
intercept_unhook_self(); intercept_unhook_self();
intercept_hook(slingshot, on_main, NULL); intercept_hook(slingshot, on_main, NULL);
return __libc_init(raw_args, onexit, slingshot, structors); return __libc_init(raw_args, onexit, slingshot, structors);
} }
static void intercept_main(void) { static void intercept_main(void) {
intercept_hook(__libc_init, on_libc_init, NULL); intercept_hook(__libc_init, on_libc_init, NULL);

View File

@ -301,12 +301,13 @@ void prefetch_init(void) {
* This doesn't work on Android, so we skip it. Would could end up leaking * This doesn't work on Android, so we skip it. Would could end up leaking
* shared memory regions though. * shared memory regions though.
*/ */
#ifndef __ANDROID__ #ifndef __ANDROID__
if (shmctl(prefetch_shm_id, IPC_RMID, NULL) < 0) { if (shmctl(prefetch_shm_id, IPC_RMID, NULL) < 0) {
FFATAL("shmctl (IPC_RMID) < 0 - errno: %d\n", errno); FFATAL("shmctl (IPC_RMID) < 0 - errno: %d\n", errno);
} }
#endif #endif
/* Clear it, not sure it's necessary, just seems like good practice */ /* Clear it, not sure it's necessary, just seems like good practice */