在VC中如何获取eip寄存器的当前值并保存到一int变量中 如题。高手请帮忙,回答后马上结帖给分 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 int value;__asm{push eaxxor eax, eaxmov eax, eipmov value, eaxpop eax}汇编忘得七七八八了。不一定能对。 mov eax, eip不对,eip这个寄存器不能直接读取的 调用一个函数,在函数内将eip取出了(应该在堆栈内) 为什么 要 得到 eip ?hml999(蓝色999) 的方法不错 hml999的方法偶试过,好像eip在堆栈中的位置并不是很固定,如我用以下函数:int geteip(){ int i; return *(&i + 2);}在不优化时是对的,优化之后就不对了 BOOL GetThreadContext( HANDLE hThread, // handle to thread with context LPCONTEXT lpContext // address of context structure);CONTEXT结构为CPU可用的寄存器包含一个成员,定认在winnt.h中 lbird(★郑恒★) ( ) 的方法可以读取线程中下一条指令的eip。 int value; __asm { mov value, ebp } std::cout<<int(value + 4);乱写的,不要笑我啊,我一点不懂,只知道call xxx(push eip)之后就是push ebp,然后mov ebp,esp则说明ebp位置的东西是ebp,然后就是eip,所有把ebp+4应该就是eip把? 哦,不对,好像应该是+8int value;__asm{ mov value, ebp}std::cout<<int(value + 8); 还是? int * pValue; __asm { mov pValue, ebp } std::cout<<*(pValue + 4); 如果是这样的话,应该是 int Value; __asm { push eax sub eax,eax mov eax, [ebp + 4] mov Value, eax pop eax } std::cout<<Value; __asm{ mov eax, $} 我试过了:unsigned int temp;__asm{ push eax;lable: mov eax, label; mov temp, eax; pop eax;}cout<<temp<<endl; push eippop eax __asm{ call lable:;lable: pop EAX; } kevin_wang,我按你的方法:我试过了:unsigned int temp;__asm{ push eax;lable: mov eax, label; mov temp, eax; pop eax;}cout<<temp<<endl;好像不对 int iEIP;_asm{ push eax call get_cur_eipget_cur_eip: pop eax sub eax,5 // sub "call get_cur_eip" length mov iEIP,eax pop eax} VS2008中这个在哪里设置啊?? 执行存储过程的疑问~~ (高手请进)请问OnKeyDown函数里不能实现TextOut吗? 给特定格式文件添加图标 asp服务端不能运行OCX 只能运行dll(不带界面的)? CAsyncSocket通信 怎样在VC中调用FORTRAN程序? Acess数据库问题 谁能给我CJLibrary609或608的安装版本要带例子的。在此谢了 消息响应响应函数的while循环的成员变量值不会变化 请问谁知道微软的 Speech SDK 5.0怎么下载呀? 如何在对生成的变量名对应的变量赋值
__asm
{
push eax
xor eax, eaxmov eax, eip
mov value, eaxpop eax
}汇编忘得七七八八了。不一定能对。
int geteip()
{
int i;
return *(&i + 2);
}
在不优化时是对的,优化之后就不对了
HANDLE hThread, // handle to thread with context
LPCONTEXT lpContext // address of context structure
);
CONTEXT结构为CPU可用的寄存器包含一个成员,定认在winnt.h中
__asm
{
mov value, ebp
} std::cout<<int(value + 4);乱写的,不要笑我啊,我一点不懂,只知道
call xxx(push eip)之后就是push ebp,然后mov ebp,esp则说明ebp位置的东西是ebp,然后就是eip,所有把ebp+4应该就是eip把?
__asm
{
mov value, ebp
}std::cout<<int(value + 8);
__asm
{
mov pValue, ebp
} std::cout<<*(pValue + 4);
__asm
{
push eax
sub eax,eax
mov eax, [ebp + 4]
mov Value, eax
pop eax
} std::cout<<Value;
mov eax, $}
unsigned int temp;
__asm{
push eax;
lable:
mov eax, label;
mov temp, eax;
pop eax;
}
cout<<temp<<endl;
pop eax
call lable:;
lable:
pop EAX;
}
unsigned int temp;
__asm{
push eax;
lable:
mov eax, label;
mov temp, eax;
pop eax;
}
cout<<temp<<endl;好像不对
{
push eax
call get_cur_eip
get_cur_eip:
pop eax
sub eax,5 // sub "call get_cur_eip" length
mov iEIP,eax
pop eax
}