From a54084a00f88eb30088cfed6194b118fa3b20984 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 10 Mar 1999 17:49:26 +0000 Subject: [PATCH] Temporary fix: Activate 16-bit system timer callback routines, but skip calling them if timer signal occured while current thread was holding the Win16Lock (to prevent 16-bit stack corruption). --- if1632/thunk.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/if1632/thunk.c b/if1632/thunk.c index 4a05d1ed86a..fbc98ce6158 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -17,6 +17,7 @@ #include "process.h" #include "stackframe.h" #include "selectors.h" +#include "syslevel.h" #include "task.h" #include "except.h" #include "win.h" @@ -821,7 +822,7 @@ void WINAPI WIN16_keybd_event( CONTEXT *context ) /*********************************************************************** * WIN16_CreateSystemTimer (SYSTEM.2) */ -static void CALLBACK THUNK_CallSystemTimerProc( FARPROC16 proc, WORD timer ) +static void THUNK_CallSystemTimerProc( FARPROC16 proc, WORD timer ) { CONTEXT context; memset( &context, '\0', sizeof(context) ); @@ -833,23 +834,23 @@ static void CALLBACK THUNK_CallSystemTimerProc( FARPROC16 proc, WORD timer ) AX_reg( &context ) = timer; + if ( _ConfirmWin16Lock() ) + { + FIXME( system, "Skipping timer %d callback because timer signal " + "arrived while we own the Win16Lock!\n", timer ); + return; + } + CallTo16_sreg_( &context, 0 ); - /* FIXME: This does not work if the signal occurs while some thread + /* FIXME: This does not work if the signal occurs while this thread is currently in 16-bit code. With the current structure of the Wine thunking code, this seems to be hard to fix ... */ } WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc ) { THUNK *thunk = THUNK_Alloc( proc, (RELAY)THUNK_CallSystemTimerProc ); - WORD timer = 0; - -#if 1 - FIXME(system,"are currently broken, returning 0.\n"); -#else - timer = CreateSystemTimer( rate, (SYSTEMTIMERPROC)thunk ); -#endif - + WORD timer = CreateSystemTimer( rate, (SYSTEMTIMERPROC)thunk ); if (!timer) THUNK_Free( thunk ); return timer; }