Question about inserting assembly code in C++
Posted
by
Bruce
on Stack Overflow
See other posts from Stack Overflow
or by Bruce
Published on 2010-12-31T05:50:04Z
Indexed on
2010/12/31
5:54 UTC
Read the original article
Hit count: 195
I am working on VC++ compiler. I want to accomplish the following
The variables s.AddrFrame.Offset and s.AddrStack.Offset contain the value of EBP and ESP respectively. I want to extract the value of old EBP and the return address. Assuming the address EBP + 1 contains the old 32 bit EBP value and EBP + 5 the return address I wrote the following code:
unsigned int old_ebp = 0;
unsigned int ret_addr = 0;
__asm{
mov old_ebp, DWORD PTR [s.AddrFrame.Offset + 1]
mov ret_addr, DWORD PTR [s.AddrStack.Offset + 5]
}
But this is not compiling
xxxx.cpp(1130) : error C2415: improper operand type
Please Help
© Stack Overflow or respective owner