When I looking at exe file with Ida I see
call dword ptr [ebp -70p]
What is that? Why this function calling by ebp and not call sub_0xabcd
How can I know which function is that to enter to this function and see what happen there?
Reverse Engineering Stack Exchange is a question and answer site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation. It only takes a minute to sign up.
Sign up to join this communityThere could be a huge number of reasons for this ranging from something as innocuous as a method pointer being a local variable to obfuscation (highly unlikely with the assembly you showed). As for how to follow it, you can either BP the call and follow it or track the frame pointer to see what it's set to.
call
instruction with local variable suggests it may be function pointer.
But function pointer can be used in many cases. The simplest example is a raw
C style function pointer.
cl.exe /MDd file.c
#include <stdio.h>
void func(int a) {
printf("%d\n", a);
}
int main(void) {
void (*func_ptr)(int) = &func;
(*func_ptr)(10);
}
mov dword ptr [ebp-4], offset func ; move function pointer to stack
push 10 ; push 10 for first parameter
call dword ptr [ebp-4] ; call the function pointer
add esp, 4
Other cases:
GetProcAddress()
function which gets the address of an exported function.How to know what happen there? Load it in a debugger. Set a breakpoint in that indirect call and follow its execution procedure. Judge other subroutines also.
ebp -70p
. ? By the way why dword indicative for poiner to function?