server: Make timer callback function and argument client_ptr_t instead of void pointers.

This commit is contained in:
Alexandre Julliard 2008-12-29 17:43:01 +01:00
parent cc55fd317a
commit 9b92a59115
5 changed files with 30 additions and 21 deletions

View File

@ -671,8 +671,8 @@ NTSTATUS WINAPI NtSetTimer(IN HANDLE handle,
req->handle = wine_server_obj_handle( handle ); req->handle = wine_server_obj_handle( handle );
req->period = period; req->period = period;
req->expire = when->QuadPart; req->expire = when->QuadPart;
req->callback = callback; req->callback = wine_server_client_ptr( callback );
req->arg = callback_arg; req->arg = wine_server_client_ptr( callback_arg );
status = wine_server_call( req ); status = wine_server_call( req );
if (state) *state = reply->signaled; if (state) *state = reply->signaled;
} }
@ -856,9 +856,13 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
user_apc = TRUE; user_apc = TRUE;
break; break;
case APC_TIMER: case APC_TIMER:
call->timer.func( call->timer.arg, (DWORD)call->timer.time, (DWORD)(call->timer.time >> 32) ); {
void (WINAPI *func)(void*, unsigned int, unsigned int) = wine_server_get_ptr( call->timer.func );
func( wine_server_get_ptr( call->timer.arg ),
(DWORD)call->timer.time, (DWORD)(call->timer.time >> 32) );
user_apc = TRUE; user_apc = TRUE;
break; break;
}
case APC_ASYNC_IO: case APC_ASYNC_IO:
result->type = call->type; result->type = call->type;
result->async_io.status = call->async_io.func( call->async_io.user, result->async_io.status = call->async_io.func( call->async_io.user,

View File

@ -277,10 +277,10 @@ typedef union
} user; } user;
struct struct
{ {
enum apc_type type; enum apc_type type;
void (__stdcall *func)(void*, unsigned int, unsigned int); client_ptr_t func;
timeout_t time; timeout_t time;
void *arg; client_ptr_t arg;
} timer; } timer;
struct struct
{ {
@ -2203,9 +2203,9 @@ struct set_timer_request
struct request_header __header; struct request_header __header;
obj_handle_t handle; obj_handle_t handle;
timeout_t expire; timeout_t expire;
client_ptr_t callback;
client_ptr_t arg;
int period; int period;
void* callback;
void* arg;
}; };
struct set_timer_reply struct set_timer_reply
{ {
@ -5052,6 +5052,6 @@ union generic_reply
struct set_window_layered_info_reply set_window_layered_info_reply; struct set_window_layered_info_reply set_window_layered_info_reply;
}; };
#define SERVER_PROTOCOL_VERSION 362 #define SERVER_PROTOCOL_VERSION 363
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -293,10 +293,10 @@ typedef union
} user; } user;
struct struct
{ {
enum apc_type type; /* APC_TIMER */ enum apc_type type; /* APC_TIMER */
void (__stdcall *func)(void*, unsigned int, unsigned int); client_ptr_t func; /* void (__stdcall *func)(void*, unsigned int, unsigned int); */
timeout_t time; /* absolute time of expiration */ timeout_t time; /* absolute time of expiration */
void *arg; /* user argument */ client_ptr_t arg; /* user argument */
} timer; } timer;
struct struct
{ {
@ -1669,9 +1669,9 @@ enum char_info_mode
@REQ(set_timer) @REQ(set_timer)
obj_handle_t handle; /* handle to the timer */ obj_handle_t handle; /* handle to the timer */
timeout_t expire; /* next expiration absolute time */ timeout_t expire; /* next expiration absolute time */
client_ptr_t callback; /* callback function */
client_ptr_t arg; /* callback argument */
int period; /* timer period in ms */ int period; /* timer period in ms */
void* callback; /* callback function */
void* arg; /* callback argument */
@REPLY @REPLY
int signaled; /* was the timer signaled before this call ? */ int signaled; /* was the timer signaled before this call ? */
@END @END

View File

@ -46,8 +46,8 @@ struct timer
timeout_t when; /* next expiration */ timeout_t when; /* next expiration */
struct timeout_user *timeout; /* timeout user */ struct timeout_user *timeout; /* timeout user */
struct thread *thread; /* thread that set the APC function */ struct thread *thread; /* thread that set the APC function */
void *callback; /* callback APC function */ client_ptr_t callback; /* callback APC function */
void *arg; /* callback argument */ client_ptr_t arg; /* callback argument */
}; };
static void timer_dump( struct object *obj, int verbose ); static void timer_dump( struct object *obj, int verbose );
@ -160,7 +160,7 @@ static int cancel_timer( struct timer *timer )
/* set the timer expiration and period */ /* set the timer expiration and period */
static int set_timer( struct timer *timer, timeout_t expire, unsigned int period, static int set_timer( struct timer *timer, timeout_t expire, unsigned int period,
void *callback, void *arg ) client_ptr_t callback, client_ptr_t arg )
{ {
int signaled = cancel_timer( timer ); int signaled = cancel_timer( timer );
if (timer->manual) if (timer->manual)

View File

@ -125,7 +125,8 @@ static void dump_apc_call( const apc_call_t *call )
case APC_TIMER: case APC_TIMER:
fprintf( stderr, "APC_TIMER,time=" ); fprintf( stderr, "APC_TIMER,time=" );
dump_timeout( &call->timer.time ); dump_timeout( &call->timer.time );
fprintf( stderr, ",arg=%p", call->timer.arg ); fprintf( stderr, ",arg=" );
dump_uint64( &call->timer.arg );
break; break;
case APC_ASYNC_IO: case APC_ASYNC_IO:
fprintf( stderr, "APC_ASYNC_IO,func=%p,user=%p,sb=%p,status=%s", fprintf( stderr, "APC_ASYNC_IO,func=%p,user=%p,sb=%p,status=%s",
@ -2166,9 +2167,13 @@ static void dump_set_timer_request( const struct set_timer_request *req )
fprintf( stderr, " expire=" ); fprintf( stderr, " expire=" );
dump_timeout( &req->expire ); dump_timeout( &req->expire );
fprintf( stderr, "," ); fprintf( stderr, "," );
fprintf( stderr, " period=%d,", req->period ); fprintf( stderr, " callback=" );
fprintf( stderr, " callback=%p,", req->callback ); dump_uint64( &req->callback );
fprintf( stderr, " arg=%p", req->arg ); fprintf( stderr, "," );
fprintf( stderr, " arg=" );
dump_uint64( &req->arg );
fprintf( stderr, "," );
fprintf( stderr, " period=%d", req->period );
} }
static void dump_set_timer_reply( const struct set_timer_reply *req ) static void dump_set_timer_reply( const struct set_timer_reply *req )