“dylib” how to call back the main program?

て烟熏妆下的殇ゞ 提交于 2019-12-11 09:46:49

问题


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?


回答1:


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); 


来源:https://stackoverflow.com/questions/9123202/dylib-how-to-call-back-the-main-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!