Name: Anonymous 2010-09-26 3:48
Does anyone know to call a __thiscall function from C code? It's not a problem of garbled symbols (I have its address), it's a problem of passing this pointer in ecx. I thought declaring function as __stdcall and storing stuff in ecx with assembly magic would work, like this:
__asm { mov ecx,self }
res=sub(a2,a3,a4,a5,a6,a7);
But code generated by visual studio overwrites ecx:
dinput8.dll:66551153 mov ecx, [esp+10h] # my code
dinput8.dll:66551157 mov ecx, [esp+120h] # automatically generated by msvcs, thanks a lot
dinput8.dll:6655115E mov edx, [esp+11Ch]
dinput8.dll:66551165 push esi
dinput8.dll:66551166 push edi
dinput8.dll:66551167 push ebx
dinput8.dll:66551168 push ebp
dinput8.dll:66551169 push ecx
dinput8.dll:6655116A push edx
dinput8.dll:6655116B call off_66553344
Any ideas? I'd even be fine with writing some fake C++ class and calling its method, but unfortunately you can't specify an address of method of class when calling it...
__asm { mov ecx,self }
res=sub(a2,a3,a4,a5,a6,a7);
But code generated by visual studio overwrites ecx:
dinput8.dll:66551153 mov ecx, [esp+10h] # my code
dinput8.dll:66551157 mov ecx, [esp+120h] # automatically generated by msvcs, thanks a lot
dinput8.dll:6655115E mov edx, [esp+11Ch]
dinput8.dll:66551165 push esi
dinput8.dll:66551166 push edi
dinput8.dll:66551167 push ebx
dinput8.dll:66551168 push ebp
dinput8.dll:66551169 push ecx
dinput8.dll:6655116A push edx
dinput8.dll:6655116B call off_66553344
Any ideas? I'd even be fine with writing some fake C++ class and calling its method, but unfortunately you can't specify an address of method of class when calling it...