有没有C++类方法Hook例子

我参考了http://bbs.iosre.com/t/hook-c/136这篇讨论,想尝试对一个C++写的iOS手游进行逆向。发现还是有一些不懂的问题,想请教下。

类似这种C++类

我自己写的Tweak.xm代码为

#include <substrate.h>
CIosAppContainer (*original_getInstance)(void);
CIosAppContainer *replace_getInstance(void) {
	printf("haha");
	return original_getInstance();
}
%ctor {
	printf("ctor");
	MSHookFunction((void *)GetInstance,(void *)replace_getInstance,(void * *)&original_getInstance);
}

Makefile

THEOS_DEVICE_IP = 192.168.0.109
THEOS_DEVICE_PORT = 22
ARCHS = armv7 
TARGET = iphone:latest:7.0
ADDITIONAL_OBJCFLAGS = -fobjc-arc

include ~/Desktop/iosre/theos/makefiles/common.mk

TWEAK_NAME = str
str_FILES = Tweak.xm
str_FRAMEWORKS = UIKit 

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
	install.exec "killall -9 stritz"

编译结果是

Tweak.xm:3:1: error: unknown type name 'CIosAppContainer'
CIosAppContainer (*original_getInstance)(void);
^
Tweak.xm:5:1: error: unknown type name 'CIosAppContainer'
CIosAppContainer *replace_getInstance(void) {
^
Tweak.xm:12:25: error: use of undeclared identifier 'GetInstance'
        MSHookFunction((void *)GetInstance,(void *)replace_getInstance,(void * *)&original_getInstance);

这种手写的C++类应该怎么Hook呢? 有大神说要用“ MSFindSymbol来找到符号地址” 有没有例子演示下,网上关于这个的资料很难找。谢谢大神们

书上写了啊,没仔细看书哦

在哪里写了???

MSFindSymbol

例子GitHub随便一搜就有 https://github.com/search?q=MSFindSymbol&type=Code&utf8=✓

哦你们真可爱

顺便建议先从c++ 基础学起

4.1.1节有详细介绍

呃呃 sorry 看书看得太快了,观看例子了