blob: f30918ed461996eb41450b47fa1d77a9295e7229 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <substrate.h>
#include <stdio.h>
#include <assert.h>
#include <dlfcn.h>
#include <time.h>
int main() {
const char *foundation = "/System/Library/Frameworks/Foundation.framework/Foundation";
dlopen(foundation, RTLD_LAZY);
MSImageRef im = MSGetImageByName(foundation);
assert(im);
int (*f)(int);
MSHookSymbol(f, "_absolute_from_gregorian", im);
assert(f(12345) < 0);
clock_t a = clock();
MSHookSymbol(f, "_absolute_from_gregorian");
clock_t b = clock();
printf("%ld\n", (long) (b - a));
assert(f(12345) < 0);
}
|