I have come across the following instructions:
mov ecx, [ebp + var_4]
imul ecx, 4
call dword_1423d4[ecx]
Can someone explain to me what it possibly means or point me in the right direction? Why is the call made to a variable?
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 communityI have come across the following instructions:
mov ecx, [ebp + var_4]
imul ecx, 4
call dword_1423d4[ecx]
Can someone explain to me what it possibly means or point me in the right direction? Why is the call made to a variable?
dword_1423d4
is a pointer to a global array of 32-bit function pointers.
var_4
is an index into this array.
The call
instruction calls the function at index var_4
in the dword_1423d4
function array.
switch
statements are typically compiled to use jmp
, not call
, but I suppose a compiler might choose the latter in some circumstances.
Jun 25, 2013 at 21:53
switch
statement (or anything aside from a real function call, for that matter) on x86 implemented with a call
instruction.
Jun 28, 2013 at 5:41
What immediately comes to mind is some type of virtualization layer accessing an IAT or IVT. I absolutely agree with the previous answer that this is a call to a function vector in an array of function pointers. I also agree that it does not look like a switch statement. That's what takes me down the interrupt vector table/address table.