Module: wine Branch: master Commit: 7744443febb04213cf014b007a83744a66544d6c URL: http://source.winehq.org/git/wine.git/?a=commit;h=7744443febb04213cf014b007a...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Mar 14 12:28:38 2007 +0100
ntdll: Add a wrapper to call the thread entry point for broken apps.
---
dlls/ntdll/thread.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 9656331..d0871a1 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -349,6 +349,26 @@ static PUNHANDLED_EXCEPTION_FILTER get_unhandled_exception_filter(void) return unhandled_exception_filter; }
+#ifdef __i386__ +/* wrapper for apps that don't declare the thread function correctly */ +extern DWORD call_thread_entry_point( PRTL_THREAD_START_ROUTINE entry, void *arg ); +__ASM_GLOBAL_FUNC(call_thread_entry_point, + "pushl %ebp\n\t" + "movl %esp,%ebp\n\t" + "subl $4,%esp\n\t" + "pushl 12(%ebp)\n\t" + "movl 8(%ebp),%eax\n\t" + "call *%eax\n\t" + "leave\n\t" + "ret" ); +#else +static inline DWORD call_thread_entry_point( PRTL_THREAD_START_ROUTINE entry, void *arg ) +{ + LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)rtl_func; + return func( arg ); +} +#endif + /*********************************************************************** * call_thread_func * @@ -356,16 +376,15 @@ static PUNHANDLED_EXCEPTION_FILTER get_unhandled_exception_filter(void) */ static void DECLSPEC_NORETURN call_thread_func( PRTL_THREAD_START_ROUTINE rtl_func, void *arg ) { - LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)rtl_func; DWORD exit_code; BOOL last;
MODULE_DllThreadAttach( NULL );
if (TRACE_ON(relay)) - DPRINTF( "%04x:Starting thread proc %p (arg=%p)\n", GetCurrentThreadId(), func, arg ); + DPRINTF( "%04x:Starting thread proc %p (arg=%p)\n", GetCurrentThreadId(), rtl_func, arg );
- exit_code = func( arg ); + exit_code = call_thread_entry_point( rtl_func, arg );
/* send the exit code to the server */ SERVER_START_REQ( terminate_thread )