Sebastian Lackner sebastian@fds-team.de wrote:
+extern LRESULT WNDENUMPROC_wrapper( WNDENUMPROC proc, HWND hwnd, LPARAM lparam ); +__ASM_GLOBAL_FUNC( WNDENUMPROC_wrapper,
"pushl %ebp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
"movl %esp,%ebp\n\t"
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
"pushl %edi\n\t"
__ASM_CFI(".cfi_rel_offset %edi,-4\n\t")
"pushl %esi\n\t"
__ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
"pushl %ebx\n\t"
__ASM_CFI(".cfi_rel_offset %ebx,-12\n\t")
"pushl 16(%ebp)\n\t"
"pushl 12(%ebp)\n\t"
"movl 8(%ebp),%eax\n\t"
"call *%eax\n\t"
There is no need to safe edi/esi/ebx when the purpose is just to be compatible with cdecl calling conventions. Also, you should try to keep the stack aligned, like most other assembler wrappers do.
I just copied the wrapper code from hook.c and adapted number of parameters, winproc.c uses a similar wrapper.
Does it also work with something like: http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/dinput/dinput_main.c#l... ?
I was never able to reproduce the problem myself under Linux, just guessed what happened from the backtrace and the suggested patch worked under MacOSX, so I won't be able to test, but yes, this wrapper looks a lot simpler.