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

offsets in c.c file #1

Closed
iHTCboy opened this issue Oct 13, 2021 · 1 comment
Closed

offsets in c.c file #1

iHTCboy opened this issue Oct 13, 2021 · 1 comment

Comments

@iHTCboy
Copy link

iHTCboy commented Oct 13, 2021

Hello, can offsets be abbreviated as this:

void * normal_function1(const char * arg1, int arg2) {
    
    //long long offset = (long long)dyld_stub_binder - (long long)dlopen;
    //return ((void *(*)(const char *, int))((long long)dyld_stub_binder - offset))(arg1, arg2);
    
    return ((void *(*)(const char *, int))((long long)dlopen))(arg1, arg2);
}

void * normal_function2(void * arg1, const char * arg2) {
    
    //long long offset = (long long)dyld_stub_binder - (long long)dlsym;
    //return ((void *(*)(void *, const char *))((long long)dyld_stub_binder - offset))(arg1, arg2);

    return ((void *(*)(void *, const char *))((long long)dlsym))(arg1, arg2);
}

It can work, but I don’t know if there are potential risks? thanks~

@illusionofchaos
Copy link
Owner

You can actually call dlopen and dlsym directly, but the purpose of calling them by using their location in memory instead of referencing them is to avoid detection by Apple. Your version references these symbols, so Apple will be able to see that and reject the binary when you try to submit it into the App Store.

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

2 participants