summaryrefslogtreecommitdiff
path: root/tools/defines.c
blob: 44edc28bf9c7b68af67630fc7de3b74afc2c60c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdint.h>
#include <stdio.h>
#include <dlfcn.h>
//#include <CoreFoundation/CoreFoundation.h>

uintptr_t get_dyld_shc_slide(void) {
	return _dyld_get_image_vmaddr_slide(1);
}

uint32_t dlsym_cf(char* s) {
	return dlsym(dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", RTLD_NOW), s) - get_dyld_shc_slide();
}

void fuck(char* s) {
	printf("var %s_addr = 0x%08x;\n", s, dlsym_cf(s));
}

extern uint32_t bootstrap_port;


int main(int argc, char* argv[]) {
	printf("#define PRINTF_ADDR 0x%x\n", dlsym(RTLD_DEFAULT, "printf"));
//	printf("%x %x %x %x %x %x %x %x\n", RTLD_NOW, dlsym_cf("kCFTypeDictionaryKeyCallBacks"), 0x41414141);//, &kCFTypeDictionaryValueCallBacks, kCFNumberSInt32Type);
	fuck("CFDictionaryCreateMutable");
	fuck("kCFTypeDictionaryKeyCallBacks");
	fuck("kCFTypeDictionaryValueCallBacks");
//	fuck("kCFNumberSInt32Type");
	fuck("CFDictionarySetValue");
	fuck("CFNumberCreate");
	printf("%x %x %x %x %x\n", SEEK_SET, SEEK_CUR, SEEK_END, RTLD_DEFAULT, bootstrap_port);
	return 0;
}