I frequently see code formatted like this:
push arg
push arg
(...)
mov ecx, arg
call function
If I need to call that function in Assembly, it's fine. But since I know how to consistently get the base of the functions, for the sake of organization and simplicity, I'd like to use typedefs in a DLL to call the functions.
The problem's that I have no idea how to make a call use ecx to pass data. Unless I'm mistaken, func(arg,arg)
will always assemble to two pushes and a call. If I don't use ecx the function crashes because it's a pointer to an object and it needs to be that. Is there any way to do this without inline assembly which I'd like to avoid?