Hi,
When executing the DllMain of the native IR32_32.DLL (VFW), Wine crashes. After some investigations, I found that a part of the code uses the EBX register at one point without saving and restore it afterwards. Since this register contains the PLT pointer for standard unix functions like libc ones, this does not take a long time for Wine to crashing. I tested with the ugly hack attached that saves and restores the EBX register between the call to DllMain and that fixed the problem and the DLL works fine then.
Can someone tell me what happens?
Thanks in advance, Christian
Index: loader.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/loader.c,v retrieving revision 1.66 diff -u -r1.66 loader.c --- loader.c 16 Mar 2004 03:10:07 -0000 1.66 +++ loader.c 17 Mar 2004 21:19:39 -0000 @@ -690,7 +690,9 @@ else TRACE("(%p %s,%s,%p) - CALL\n", module, debugstr_w(wm->ldr.BaseDllName.Buffer), reason_names[reason], lpReserved );
+ __asm("push %ebx"); retv = entry( module, reason, lpReserved ); + __asm("pop %ebx");
/* The state of the module list may have changed due to the call to the dll. We cannot assume that this module has not been
On Wed, 17 Mar 2004 22:37:01 +0000, Christian Costa wrote:
When executing the DllMain of the native IR32_32.DLL (VFW), Wine crashes. After some investigations, I found that a part of the code uses the EBX register at one point without saving and restore it afterwards.
What calling convention is the entrypoint declared with? I thought EBX was a register that had to be saved/restored according to the ABI and the windows compilers would always do that?
On Wed, Mar 17, 2004 at 10:37:01PM +0000, Christian Costa wrote:
Hi,
When executing the DllMain of the native IR32_32.DLL (VFW), Wine crashes. After some investigations, I found that a part of the code uses the EBX register at one point without saving and restore it afterwards. Since this register contains the PLT pointer for standard unix functions like libc ones, this does not take a long time for Wine to crashing. I tested with the ugly hack attached that saves and restores the EBX register between the call to DllMain and that fixed the problem and the DLL works fine then.
This might happen.
Your fix is not really ok, you must not modify the stackpointer in asm statements.
Try using: __asm__ __volatile__ ("":::"ebx");
after entry(), which tells the compiler that ebx has been scrapped.
Ciao, Marcus
Christian Costa titan.costa@wanadoo.fr writes:
When executing the DllMain of the native IR32_32.DLL (VFW), Wine crashes. After some investigations, I found that a part of the code uses the EBX register at one point without saving and restore it afterwards. Since this register contains the PLT pointer for standard unix functions like libc ones, this does not take a long time for Wine to crashing.
Is the dll really modifying ebx explicitly? Isn't it rather a consequence of a stack overflow or some similar bug?