Commit 88ff58ee authored by Alexandre Julliard's avatar Alexandre Julliard

Store the 16-bit callback in the timer structure instead of using a

thunk.
parent 9fcd89a5
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "services.h" #include "services.h"
#include "callback.h"
#include "stackframe.h" #include "stackframe.h"
#include "builtin16.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(system); DEFAULT_DEBUG_CHANNEL(system);
...@@ -19,6 +17,7 @@ DEFAULT_DEBUG_CHANNEL(system); ...@@ -19,6 +17,7 @@ DEFAULT_DEBUG_CHANNEL(system);
typedef struct typedef struct
{ {
SYSTEMTIMERPROC callback; /* NULL if not in use */ SYSTEMTIMERPROC callback; /* NULL if not in use */
FARPROC16 callback16;
INT rate; INT rate;
INT ticks; INT ticks;
} SYSTEM_TIMER; } SYSTEM_TIMER;
...@@ -126,9 +125,11 @@ WORD WINAPI CreateSystemTimer( WORD rate, SYSTEMTIMERPROC callback ) ...@@ -126,9 +125,11 @@ WORD WINAPI CreateSystemTimer( WORD rate, SYSTEMTIMERPROC callback )
/**********************************************************************/ /**********************************************************************/
static void SYSTEM_CallSystemTimerProc( FARPROC16 proc, WORD timer ) static void call_timer_proc16( WORD timer )
{ {
CONTEXT86 context; CONTEXT86 context;
FARPROC16 proc = SYS_Timers[timer-1].callback16;
memset( &context, '\0', sizeof(context) ); memset( &context, '\0', sizeof(context) );
context.SegCs = SELECTOROF( proc ); context.SegCs = SELECTOROF( proc );
...@@ -145,10 +146,9 @@ static void SYSTEM_CallSystemTimerProc( FARPROC16 proc, WORD timer ) ...@@ -145,10 +146,9 @@ static void SYSTEM_CallSystemTimerProc( FARPROC16 proc, WORD timer )
WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc ) WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc )
{ {
FARPROC thunk = THUNK_Alloc( proc, (RELAY)SYSTEM_CallSystemTimerProc ); WORD ret = CreateSystemTimer( rate, call_timer_proc16 );
WORD timer = CreateSystemTimer( rate, (SYSTEMTIMERPROC)thunk ); if (ret) SYS_Timers[ret - 1].callback16 = proc;
if (!timer) THUNK_Free( thunk ); return ret;
return timer;
} }
...@@ -161,10 +161,7 @@ WORD WINAPI SYSTEM_KillSystemTimer( WORD timer ) ...@@ -161,10 +161,7 @@ WORD WINAPI SYSTEM_KillSystemTimer( WORD timer )
{ {
if ( !timer || timer > NB_SYS_TIMERS || !SYS_Timers[timer-1].callback ) if ( !timer || timer > NB_SYS_TIMERS || !SYS_Timers[timer-1].callback )
return timer; /* Error */ return timer; /* Error */
THUNK_Free( (FARPROC)SYS_Timers[timer-1].callback );
SYS_Timers[timer-1].callback = NULL; SYS_Timers[timer-1].callback = NULL;
if (!--SYS_NbTimers) SYSTEM_StopTicks(); if (!--SYS_NbTimers) SYSTEM_StopTicks();
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment