"dylib"如何调用主程序? [英] "dylib" how to call back the main program?

查看:85
本文介绍了"dylib"如何调用主程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个程序来拦截越狱iphone的呼叫.我使用了dylib拦截系统调用事件,但是如何调用我的主程序并处理该事件呢?

I was working with a program which was intercepting the calling from jailbreak iphone. I used a dylib to intercept the system call event , but how did i call back my main program and handle this event?

推荐答案

您可以使用CFNotificationCenter从dylib向应用程序发送Darwin通知.它的局限性在于无法传递用户数据,但您至少可以将事件通知给应用程序.有关更多信息,请参见 https://developer. apple.com/library/IOs/#documentation/CoreFoundation/Reference/CFNotificationCenterRef/Reference/reference.html

You can use CFNotificationCenter for sending Darwin notifications from your dylib to the app. It is limiting in that no user data can be passed around but you can at least notify the app of the event. More on that at https://developer.apple.com/library/IOs/#documentation/CoreFoundation/Reference/CFNotificationCenterRef/Reference/reference.html

 Example of registering and posting:


CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),NULL, &NotificationReceivedCallback,(CFStringRef)MyNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter() , CFSTR(MyNotificationString), NULL, NULL, YES); 

这篇关于"dylib"如何调用主程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆