Why does thunk not demand as many parameters as function?

405 views Asked by At

I'm dealing with the following thunk in Ghidra:

enter image description here

Now when I double-click the thunked function, Ghidra takes me to the real function, and I can see that it expects 2 parameters ("param_1" and "param_2").

enter image description here

Why is it allowed to call it with a single parameter ("&LAB_30007a18") only?

Thank you!

1

There are 1 answers

0
j-ratz On

You showed the definition for the thunked function, but not the thunk. The thunk's signature may only include 1 param instead of 2. If so, fix that. Otherwise, the Decompiler may be confused by something earlier in the calling function (e.g., the 2nd param passed to the thunk is the return value from a previous call to a function that is currently defined as having a void return type).

The Decompiler can produce odd-looking results when functions are defined with incorrect parameters or return types.