Theos tweak MSHookFunction

时间:2025-03-02 13:07:32
#import "substrate.h"

static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
} static void entry(void) __attribute__ ((constructor));
static void entry(void) {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}
OR
#import "substrate.h"

static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
return s_orig_fopen(filename, mode);
} %ctor {
MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}