
Originally Posted by
xiaoyao
dose it support cdecl dll api?
In the snippet above Pfn is a cdecl function pointer to _ultow function in msvcrt DLL
Code:
hLib = LoadLibrary("msvcrt")
Pfn = GetProcAddress(hLib, "_ultow")
Implementing your CallCdecl, CallCdecl2, CallCdecl3 and CallCdecl4 is trivial using the Call_ultow function as a model but you cannot get rid of its Spacer parameter easy.
The extra paramter is needed to simplify the thunk to 21 bytes only but feel free to enhance it with rep movsb and all the other necessary instructions to shuffle the parameters on the stack as discussed above. This would allow indeed not having an extra optional Spacer parameter on your CallCdeclXxx functions.
cheers,
</wqw>