When IDA realizes a function relies on the this* pointer it often places as the second variable. Severely mucking up things. I was wondering is there away to fix this and maybe in turn help type identification.

I tried writing a h file but the original code is in c++


1 Answer 1


You can freely define the calling convention if required, see:


Relevant excerpt:

IDA supports the user-defined calling convention. In this calling convention, the user can explicitly specify the locations of arguments and the return value. For example:

   int __usercall func@<ebx>(int x, int y@<esi>);

denotes a function with 2 arguments: the first argument is passed on the stack and the second argument is passed in the ESI register and the return value is stored in the EBX register.

You can access the type definition by pressing Y by default, when on a function name (and paste the above, for example).

  • Thanks for the reply. I was wondering if there is a way to achieve this via script. As I have near a thousand functions in need of changing May 17, 2018 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.