From a86a02225625aae3b2f5dbb315b867a434804292 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 19 Mar 2004 02:07:16 +0000 Subject: [PATCH] Added workaround for broken dlls that modify ebx in their entry point (reported by Christian Costa). --- dlls/ntdll/loader.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 95482080ee1..97d0d6f6af2 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -127,6 +127,37 @@ inline static void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) while (len--) *dst++ = (unsigned char)*src++; } + +/************************************************************************* + * call_dll_entry_point + * + * Some brain-damaged dlls (ir32_32.dll for instance) modify ebx in + * their entry point, so we need a small asm wrapper. + */ +#ifdef __i386__ +extern BOOL call_dll_entry_point( DLLENTRYPROC proc, void *module, UINT reason, void *reserved ); +__ASM_GLOBAL_FUNC(call_dll_entry_point, + "pushl %ebp\n\t" + "movl %esp,%ebp\n\t" + "pushl %ebx\n\t" + "pushl 20(%ebp)\n\t" + "pushl 16(%ebp)\n\t" + "pushl 12(%ebp)\n\t" + "movl 8(%ebp),%eax\n\t" + "call *%eax\n\t" + "leal -4(%ebp),%esp\n\t" + "popl %ebx\n\t" + "popl %ebp\n\t" + "ret" ); +#else /* __i386__ */ +static inline BOOL call_dll_entry_point( DLLENTRYPROC proc, void *module, + UINT reason, void *reserved ) +{ + return proc( module, reason, reserved ); +} +#endif /* __i386__ */ + + /************************************************************************* * get_modref * @@ -690,7 +721,7 @@ static BOOL MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved ) else TRACE("(%p %s,%s,%p) - CALL\n", module, debugstr_w(wm->ldr.BaseDllName.Buffer), reason_names[reason], lpReserved ); - retv = entry( module, reason, lpReserved ); + retv = call_dll_entry_point( entry, module, reason, lpReserved ); /* 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 -- 2.11.4.GIT