mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
System timer proc thunk creation moved out of if1632/thunk.c.
This commit is contained in:
parent
f0a1c2f741
commit
974fd10c69
@ -7,6 +7,9 @@
|
|||||||
#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 "builtin16.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(system)
|
DEFAULT_DEBUG_CHANNEL(system)
|
||||||
@ -119,6 +122,29 @@ WORD WINAPI CreateSystemTimer( WORD rate, SYSTEMTIMERPROC callback )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SYSTEM_CallSystemTimerProc( FARPROC16 proc, WORD timer )
|
||||||
|
{
|
||||||
|
CONTEXT86 context;
|
||||||
|
memset( &context, '\0', sizeof(context) );
|
||||||
|
|
||||||
|
CS_reg( &context ) = SELECTOROF( proc );
|
||||||
|
EIP_reg( &context ) = OFFSETOF( proc );
|
||||||
|
EBP_reg( &context ) = OFFSETOF( NtCurrentTeb()->cur_stack )
|
||||||
|
+ (WORD)&((STACK16FRAME*)0)->bp;
|
||||||
|
|
||||||
|
AX_reg( &context ) = timer;
|
||||||
|
|
||||||
|
CallTo16RegisterShort( &context, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc )
|
||||||
|
{
|
||||||
|
FARPROC thunk = THUNK_Alloc( proc, (RELAY)SYSTEM_CallSystemTimerProc );
|
||||||
|
WORD timer = CreateSystemTimer( rate, (SYSTEMTIMERPROC)thunk );
|
||||||
|
if (!timer) THUNK_Free( thunk );
|
||||||
|
return timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* KillSystemTimer (SYSTEM.3)
|
* KillSystemTimer (SYSTEM.3)
|
||||||
@ -127,8 +153,12 @@ WORD WINAPI CreateSystemTimer( WORD rate, SYSTEMTIMERPROC callback )
|
|||||||
*/
|
*/
|
||||||
WORD WINAPI SYSTEM_KillSystemTimer( WORD timer )
|
WORD WINAPI SYSTEM_KillSystemTimer( WORD timer )
|
||||||
{
|
{
|
||||||
if (!timer || (timer > NB_SYS_TIMERS)) return timer; /* Error */
|
if ( !timer || timer > NB_SYS_TIMERS || !SYS_Timers[timer-1].callback )
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user