I encountered the following assembly version of a C code (Practical Malware Analysis by Michael Sikorski, Chapter 5). I simply do not understand how it accesses the command line parameters.
cmp [ebp+argc], 3
...
mov eax, [ebp+argv]
I understand what this code does:
mov ecx, [esp+4] ; argc
mov edx, [esp+8] ; argv
Function arguments are put on the top on stack, and they are accessed with their address relative to the top of stack. But what means ebp+argc
and ebp+argv
?