I'm just learning ASM/x86, so please bear with me.
Question
I noticed the following in the program I'm inspecting, and I'm thinking that it is passing a parameter to the function that gets called:
mov [ebp-04],00000005
call <some function call here>
As far as I can tell, this seems to be setting the second byte from the top of the stack to the value 5
.
Is this effectively passing a parameter of 5 to the function?
Would it resemble the following in C
:
void someFunction(int num); //function declaration
someFunction(5); //In some context
If it is passing a single parameter of 5 to the function, why is it set as the second byte (-04), and not the top of the stack? What is at the top of the stack? Am I interpreting this all wrong?
EDIT
The top of the function is where ebp
gets set:
push ebp
mov ebp,esp
push -01
push 184
mov eax,fs:[00000000]
... //bunch more pushes and movs with eax and ecx into [ebp-offset]
... //a couple of jump if equals
... //some more push and movs
lea ecx,[ebp-1C]
mov [ebp-04],00000005
call <some function>
Here is the called function:
mov edx,[ecx]
mov eax,[ecx+08]
sub eax,edx
test edx,edx
je <label1>
cmp eax,00000080
jna <label2>
push edx
call <another function>
add esp,04
ret
label2:
push eax
push edx
call <yet another function>
add esp,08
label1:
ret