Commit 4f8b800f authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

system.drv16: Remove the 32-bit timer callback support.

Also merge CreateSystemTimer() with WIN16_CreateSystemTimer() and rename it to CreateSystemTimer16() for consistency.
parent 4c357492
......@@ -34,7 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(system);
typedef struct
{
SYSTEMTIMERPROC callback; /* NULL if not in use */
FARPROC16 callback16;
INT rate;
INT ticks;
......@@ -49,6 +48,7 @@ static HANDLE SYS_timer;
static HANDLE SYS_thread;
static int SYS_timers_disabled;
/***********************************************************************
* SYSTEM_TimerTick
*/
......@@ -59,11 +59,23 @@ static void CALLBACK SYSTEM_TimerTick( LPVOID arg, DWORD low, DWORD high )
if (SYS_timers_disabled) return;
for (i = 0; i < NB_SYS_TIMERS; i++)
{
if (!SYS_Timers[i].callback) continue;
if (!SYS_Timers[i].callback16) continue;
if ((SYS_Timers[i].ticks -= SYS_TIMER_RATE) <= 0)
{
FARPROC16 proc = SYS_Timers[i].callback16;
CONTEXT86 context;
SYS_Timers[i].ticks += SYS_Timers[i].rate;
SYS_Timers[i].callback( i+1 );
memset( &context, 0, sizeof(context) );
context.SegFs = wine_get_fs();
context.SegGs = wine_get_gs();
context.SegCs = SELECTOROF( proc );
context.Eip = OFFSETOF( proc );
context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME, bp);
context.Eax = i + 1;
WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)&context );
}
}
}
......@@ -150,51 +162,23 @@ DWORD WINAPI InquireSystem16( WORD code, WORD arg )
/***********************************************************************
* CreateSystemTimer (SYSTEM.2)
*/
WORD WINAPI CreateSystemTimer( WORD rate, SYSTEMTIMERPROC callback )
WORD WINAPI CreateSystemTimer16( WORD rate, FARPROC16 proc )
{
int i;
for (i = 0; i < NB_SYS_TIMERS; i++)
if (!SYS_Timers[i].callback) /* Found one */
if (!SYS_Timers[i].callback16) /* Found one */
{
SYS_Timers[i].rate = (UINT)rate * 1000;
if (SYS_Timers[i].rate < SYS_TIMER_RATE)
SYS_Timers[i].rate = SYS_TIMER_RATE;
SYS_Timers[i].ticks = SYS_Timers[i].rate;
SYS_Timers[i].callback = callback;
SYS_Timers[i].callback16 = proc;
if (++SYS_NbTimers == 1) SYSTEM_StartTicks();
return i + 1; /* 0 means error */
}
return 0;
}
/**********************************************************************/
static void call_timer_proc16( WORD timer )
{
CONTEXT86 context;
FARPROC16 proc = SYS_Timers[timer-1].callback16;
memset( &context, 0, sizeof(context) );
context.SegFs = wine_get_fs();
context.SegGs = wine_get_gs();
context.SegCs = SELECTOROF( proc );
context.Eip = OFFSETOF( proc );
context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME,bp);
context.Eax = timer;
WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)&context );
}
/**********************************************************************/
WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc )
{
WORD ret = CreateSystemTimer( rate, call_timer_proc16 );
if (ret) SYS_Timers[ret - 1].callback16 = proc;
return ret;
}
/***********************************************************************
* KillSystemTimer (SYSTEM.3)
......@@ -203,9 +187,9 @@ WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc )
*/
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].callback16 )
return timer; /* Error */
SYS_Timers[timer-1].callback = NULL;
SYS_Timers[timer-1].callback16 = 0;
if (!--SYS_NbTimers) SYSTEM_StopTicks();
return 0;
}
......
1 pascal InquireSystem(word word) InquireSystem16
2 pascal -ret16 CreateSystemTimer(word segptr) WIN16_CreateSystemTimer
2 pascal -ret16 CreateSystemTimer(word segptr) CreateSystemTimer16
3 pascal -ret16 KillSystemTimer(word) SYSTEM_KillSystemTimer
4 pascal -ret16 EnableSystemTimers() EnableSystemTimers16
5 pascal -ret16 DisableSystemTimers() DisableSystemTimers16
......
......@@ -961,12 +961,7 @@ INT16 WINAPI lstrcmpi16(LPCSTR,LPCSTR);
/* undocumented functions */
typedef VOID (*SYSTEMTIMERPROC)(WORD);
void WINAPI ConvertDialog32To16(LPCVOID,DWORD,LPVOID);
WORD WINAPI CreateSystemTimer(WORD,SYSTEMTIMERPROC);
VOID WINAPI DisableSystemTimers16(void);
VOID WINAPI EnableSystemTimers16(void);
BOOL16 WINAPI EnumTaskWindows16(HTASK16,WNDENUMPROC16,LPARAM);
BOOL16 WINAPI GrayString16(HDC16,HBRUSH16,GRAYSTRINGPROC16,LPARAM,
INT16,INT16,INT16,INT16,INT16);
......
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