看了“我对c++中thunk一种实现技术的分析”一文,有点不同的想法.
#pragma pack(push,1) 【程序编程相关:指针的爱情】原代码如下: 【推荐阅读:禁止/启用屏幕保护及系统热键等】struct thunk 【扩展信息:深入浅出 CPropertySheet】// structure to store the machine code{ char m_jmp; // op code of jmp instruction unsigned long m_relproc; // relative jmp};
#pragma pack(pop)//this type of structure can contain then thunk code, which can be executed on the fly. lets take a look at the simple case in which we are going to execute our required function by thunk.
//program 77
#include <iostream>
#include <windows.h>
using namespace std;
class c;
c* g_pc = null;
typedef void(*pfun)();
class c{
public:
int a; int b; float bbj; thunk m_thunk;//virtual void g(){};
... 下一页