Trang web này cho thấy làm thế nào để vá một chương trình C Mục tiêu hiện có: http://www.culater.net/wiki/moin.cgi/CocoaReverseEngineering
Cụ thể đặt ra:
[[B class] poseAsClass:[A class]];
và phương pháp swizzling:
/**
* Renames the selector for a given method.
* Searches for a method with _oldSelector and reassigned _newSelector to that
* implementation.
* @return NO on an error and the methods were not swizzled
*/
BOOL DTRenameSelector(Class _class, SEL _oldSelector, SEL _newSelector)
{
Method method = nil;
// First, look for the methods
method = class_getInstanceMethod(_class, _oldSelector);
if (method == nil)
return NO;
method->method_name = _newSelector;
return YES;
}
// *** Example ***
// never implemented, just here to silence a compiler warning
@interface WebInternalImage (PHWebInternalImageSwizzle)
- (void) _webkit_scheduleFrame;
@end
@implementation WebInternalImage (PHWebInternalImage)
+ (void) initialize
{
DTRenameSelector([self class], @selector(scheduleFrame), @selector (_webkit_scheduleFrame));
DTRenameSelector([self class], @selector(_ph_scheduleFrame), @selector(scheduleFrame));
}
- (void) _ph_scheduleFrame
{
// do something crazy...
...
// call the "super" method - this method doesn't exist until runtime
[self _webkit_scheduleFrame];
}
@end
(mã được sao chép từ http://www.culater.net/wiki/moin.cgi/CocoaReverseEngineering)
Phần nào của OS X? Đó là một con thú khổng lồ, nhiều phần là mã nguồn mở nên không cần kỹ thuật đảo ngược. Cụ thể hơn và bạn có thể nhận được một số câu trả lời. –
Kỹ thuật đảo ngược một phần đáng kể của phần mềm là một vấn đề * lớn * và * cứng *. Hộp đen kỹ thuật đảo ngược là tồi tệ hơn. Nếu bạn phải hỏi, bạn có thể thấy nhiệm vụ khá khó khăn ... – dmckee
@Andrew McGregor - Vâng, hầu hết các công cụ không có giấy tờ, như sửa đổi Spaces hoặc hoán đổi màn hình chính như tôi đã liên kết trong hai ứng dụng. – chrisgoyal