Alexandre Julliard : server: Make timer callback function and argument client_ptr_t instead of void pointers .
Alexandre Julliard
julliard at winehq.org
Tue Dec 30 06:56:55 CST 2008
Module: wine
Branch: master
Commit: 9b92a59115d151dc59e527fd3c5bed502df19013
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b92a59115d151dc59e527fd3c5bed502df19013
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 29 17:43:01 2008 +0100
server: Make timer callback function and argument client_ptr_t instead of void pointers.
---
dlls/ntdll/sync.c | 10 +++++++---
include/wine/server_protocol.h | 12 ++++++------
server/protocol.def | 10 +++++-----
server/timer.c | 6 +++---
server/trace.c | 13 +++++++++----
5 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index a5767f3..d38d510 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -671,8 +671,8 @@ NTSTATUS WINAPI NtSetTimer(IN HANDLE handle,
req->handle = wine_server_obj_handle( handle );
req->period = period;
req->expire = when->QuadPart;
- req->callback = callback;
- req->arg = callback_arg;
+ req->callback = wine_server_client_ptr( callback );
+ req->arg = wine_server_client_ptr( callback_arg );
status = wine_server_call( req );
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;
break;
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;
break;
+ }
case APC_ASYNC_IO:
result->type = call->type;
result->async_io.status = call->async_io.func( call->async_io.user,
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 07b72d7..a65932e 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -277,10 +277,10 @@ typedef union
} user;
struct
{
- enum apc_type type;
- void (__stdcall *func)(void*, unsigned int, unsigned int);
+ enum apc_type type;
+ client_ptr_t func;
timeout_t time;
- void *arg;
+ client_ptr_t arg;
} timer;
struct
{
@@ -2203,9 +2203,9 @@ struct set_timer_request
struct request_header __header;
obj_handle_t handle;
timeout_t expire;
+ client_ptr_t callback;
+ client_ptr_t arg;
int period;
- void* callback;
- void* arg;
};
struct set_timer_reply
{
@@ -5052,6 +5052,6 @@ union generic_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 */
diff --git a/server/protocol.def b/server/protocol.def
index c0212e2..ca32a41 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -293,10 +293,10 @@ typedef union
} user;
struct
{
- enum apc_type type; /* APC_TIMER */
- void (__stdcall *func)(void*, unsigned int, unsigned int);
+ enum apc_type type; /* APC_TIMER */
+ client_ptr_t func; /* void (__stdcall *func)(void*, unsigned int, unsigned int); */
timeout_t time; /* absolute time of expiration */
- void *arg; /* user argument */
+ client_ptr_t arg; /* user argument */
} timer;
struct
{
@@ -1669,9 +1669,9 @@ enum char_info_mode
@REQ(set_timer)
obj_handle_t handle; /* handle to the timer */
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 */
- void* callback; /* callback function */
- void* arg; /* callback argument */
@REPLY
int signaled; /* was the timer signaled before this call ? */
@END
diff --git a/server/timer.c b/server/timer.c
index 5afe663..b38eae7 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -46,8 +46,8 @@ struct timer
timeout_t when; /* next expiration */
struct timeout_user *timeout; /* timeout user */
struct thread *thread; /* thread that set the APC function */
- void *callback; /* callback APC function */
- void *arg; /* callback argument */
+ client_ptr_t callback; /* callback APC function */
+ client_ptr_t arg; /* callback argument */
};
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 */
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 );
if (timer->manual)
diff --git a/server/trace.c b/server/trace.c
index 7e3ccf5..a986d95 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -125,7 +125,8 @@ static void dump_apc_call( const apc_call_t *call )
case APC_TIMER:
fprintf( stderr, "APC_TIMER,time=" );
dump_timeout( &call->timer.time );
- fprintf( stderr, ",arg=%p", call->timer.arg );
+ fprintf( stderr, ",arg=" );
+ dump_uint64( &call->timer.arg );
break;
case APC_ASYNC_IO:
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=" );
dump_timeout( &req->expire );
fprintf( stderr, "," );
- fprintf( stderr, " period=%d,", req->period );
- fprintf( stderr, " callback=%p,", req->callback );
- fprintf( stderr, " arg=%p", req->arg );
+ fprintf( stderr, " callback=" );
+ dump_uint64( &req->callback );
+ 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 )
More information about the wine-cvs
mailing list