问题
I'm using Code::Blocks to code, but one of the code I referenced is from Visual C++,so I have difficulties on the difference...:(
the full code are here
NAKED void ijlWrite()
{
__asm {
PUSH EBP
MOV EBP, ESP
MOV EAX, DWORD PTR SS:[EBP+8h]
MOV ECX, ssQuality
MOV DWORD PTR DS:[EAX+50h], ECX
MOV EDX, DWORD PTR SS:[EBP+0Ch]
PUSH EDX
MOV EAX, DWORD PTR SS:[EBP+08h]
PUSH EAX
CALL lpfnIJLWrite //a global variable
POP EBP
RETN
}
}
I'll be very grateful if you translate them all.
P.S. I also don't know how to translate RETN. how to do it? The cheatsheet doesn't have such things:(
回答1:
MOV EAX, DWORD PTR SS:[EBP+8h]
is equivalent to
movl %ss:8(%ebp), %eax
You just swap the order of the source and destination, the DWORD
translates to an l
suffix. The %ss:
prefix is strictly unnecessary, it's the default when using EBP
based memory access.
回答2:
Can't you just write the function in C++? A little more type information would help, but how about this?
void ijlWrite(int* p, int i)
{
p[80] = ssQuality;
lpfnIJLWrite(p, i);
}
回答3:
I think it's
movl %ss:8(%ebp), %eax
See this for a quick reference.
来源:https://stackoverflow.com/questions/6160975/whats-the-meaning-of-mov-eax-dword-ptr-ssebp8h-and-how-can-i-translate-it