首页
社区
课程
招聘
[求助]basic_string中的data方法内联汇编怎么调用?
发表于: 2009-9-15 15:45 4377

[求助]basic_string中的data方法内联汇编怎么调用?

2009-9-15 15:45
4377
看到这么一段汇编代码

call    00532080
lea     ecx, dword ptr ss:[esp+8]
call    dword ptr ds:[<&MSVCP80.std::basic_string<char,std>;  MSVCP80.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::data

这里面用到的这个模板方法应该怎么在内联汇编中调用呢?
我用

const char *(__thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char>>:: *bbmm)(void) const;

bbmm=&basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::data;

__asm
{
call    bbmm
}

这样调用指向的并不是MSVCP80中的那个data所在的地址。
难道必须通过硬编码的形式将data所在的地址写入调用吗?

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (5)
雪    币: 251
活跃值: (15)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
地址好像没问题,不过你的this在哪儿
2009-9-15 16:07
0
雪    币: 63
活跃值: (17)
能力值: ( LV8,RANK:130 )
在线值:
发帖
回帖
粉丝
3
准备ecx指针
模板方法也是要实例化的.
得到地址 string::data
call dword ptr XXX
就可以
2009-9-15 16:08
0
雪    币: 92
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
不是很明白……
ECX的指针指的是?
还有
call dword ptr XXX
的意思是不是
call dword ptr bbmm?这样好像和call bbmm一样

我总是感觉好像没有指向正确的地址,程序中也没有导入msvcp80这个动态库
2009-9-15 16:22
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
C++的code生成的代码中,this指针不是通过压入堆栈的方式传递,而是将其放在ECX中
2009-9-16 11:05
0
雪    币: 92
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
嗯,晓得了……谢谢
2009-9-16 11:41
0
游客
登录 | 注册 方可回帖
返回
//