0

我试图绕过二进制可执行文件中的成员函数。我只知道函数签名和方法的 VA。在 Detours Express 3.0 中包含的“方法”示例的帮助下,我想出了这个:

class Detour
{
public:
    void mine_target(const char* text)
    {
        printf("text = %s\n", text);
        (this->*real_target)(text);
    }

    static void (Detour::*real_target)(const char* text);
};

void (Detour::*real_target)(const char* text) 
    = (void (Detour::*)(const char*))0x401010;

这给了我错误:

error C2440: 'type cast' : cannot convert from 'int' to 'void (__thiscall Detour:: *)(const char *)'
             There are no conversions from integral values to pointer-to-member values
4

1 回答 1

1

拦截/挂钩函数的技术不适用于指向成员的指针。根据您的编译器和类设计(继承结构),需要一些额外的字节来表示此类指针的类数据 - 自由函数指针不需要这些。

于 2013-05-23T15:23:45.410 回答