Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS9.3.2计算函数地址的方法要加一个偏移 #19

Open
liaogang opened this issue Mar 5, 2019 · 0 comments
Open

iOS9.3.2计算函数地址的方法要加一个偏移 #19

liaogang opened this issue Mar 5, 2019 · 0 comments

Comments

@liaogang
Copy link

liaogang commented Mar 5, 2019

uint32_t dylib_count = _dyld_image_count();
uint64_t slide = 0;
for (int i = 0; i < dylib_count; i ++) {
    const char * name = _dyld_get_image_name(i);
    if ([[NSString stringWithUTF8String:name] isEqualToString:path]) {
        
        slide = _dyld_get_image_vmaddr_slide(i);
    }
}

//经过实际测试,我要减掉这个常数才会得到正确的函数地址,我只试了一个app,别的不敢说
uint64_t offset = 0xFFFFC000; 
typedef __int64 (*MyFunc)(id a1, __int64 a2, __int64 a3, __int64 a4);

myfunc = (MyFunc)(slide + 0x1027B70BC - offset) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant