I believe I understand the difference between STDCALL and CDECL but I'm wondering if I can find some clarification within this code.
I understand that in STDCALL the CALLEE is responsible for cleaning up the stack, and I understand that in CDECL the CALLER is responsible for cleaning up the stack.
I also understand that "cleaning up the stack" basically means re-setting the stack pointer, but I guess my confusion comes in at this line of code where the value of esp is being moved into ebp, the base pointer. If that function is happening, is that the same thing as "cleaning up the stack" ? Or does it have to be something moving into ESP specifically?
Here is the code I'm looking at
main PROC
push 4
push 5
call sub_12
push 5
call sub_48
add esp, 4
INVOKE ExitProcess, 0
main endp
sub_12 PROC
push ebp
mov ebp, esp
mov eax, 10
mul DWORD PTR [ebp+12]
pop ebp
ret 8
sub_12 endp
sub_48 PROC
push ebp
mov ebp, esp
mov eax, [ebp+8]
mul DWORD PTR [ebp+8]
pop ebp
ret
sub_48 endp
My original answer is that sub_12 and sub_48 are both CDECL because the Caller is responsible for cleaning up the stack. But now I keep looking at the [mov ebp, esp] instructions and I'm wondering if this is actually an example of an STDCALL.
Does anyone have any hints for me or some extra piece of information that I might seem to be lacking?