Make sure that GetMessagePos and GetMessageTime return sane values
for all messages.
diff --git a/server/main.c b/server/main.c
index 02b6244..03123b9 100644
--- a/server/main.c
+++ b/server/main.c
@@ -21,8 +21,6 @@
int debug_level = 0;
int persistent_server = 0;
-unsigned int server_start_ticks = 0;
-
/* parse-line args */
/* FIXME: should probably use getopt, and add a (more complete?) help option */
@@ -87,14 +85,6 @@
signal( SIGABRT, sigterm_handler );
}
-/* get server start ticks used to calculate GetTickCount() in Wine clients */
-static void get_start_ticks(void)
-{
- struct timeval t;
- gettimeofday( &t, NULL );
- server_start_ticks = (t.tv_sec * 1000) + (t.tv_usec / 1000);
-}
-
int main( int argc, char *argv[] )
{
parse_args( argc, argv );
@@ -103,7 +93,6 @@
setvbuf( stderr, NULL, _IOLBF, 0 );
if (debug_level) fprintf( stderr, "Server: starting (pid=%ld)\n", (long) getpid() );
- get_start_ticks();
init_registry();
select_loop();
close_registry();
diff --git a/server/queue.c b/server/queue.c
index 4cf92e0..c1c0e78 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -908,7 +908,7 @@
req->lparam = 0;
req->x = 0;
req->y = 0;
- req->time = 0;
+ req->time = get_tick_count();
req->info = 0;
return;
}
@@ -924,7 +924,7 @@
req->lparam = timer->lparam;
req->x = 0;
req->y = 0;
- req->time = 0;
+ req->time = get_tick_count();
req->info = 0;
return;
}
diff --git a/server/request.c b/server/request.c
index 1867ddf..b7207a1 100644
--- a/server/request.c
+++ b/server/request.c
@@ -71,6 +71,7 @@
struct thread *current = NULL; /* thread handling the current request */
unsigned int global_error = 0; /* global error code for when no thread is current */
+unsigned int server_start_ticks = 0; /* tick count offset from server startup */
static struct master_socket *master_socket; /* the master socket object */
@@ -316,6 +317,14 @@
return -1;
}
+/* get current tick count to return to client */
+unsigned int get_tick_count(void)
+{
+ struct timeval t;
+ gettimeofday( &t, NULL );
+ return (t.tv_sec * 1000) + (t.tv_usec / 1000) - server_start_ticks;
+}
+
static void master_socket_dump( struct object *obj, int verbose )
{
struct master_socket *sock = (struct master_socket *)obj;
@@ -460,6 +469,9 @@
msghdr.msg_iov = &myiovec;
msghdr.msg_iovlen = 1;
+ /* init startup ticks */
+ server_start_ticks = get_tick_count();
+
/* go in the background */
switch(fork())
{
diff --git a/server/request.h b/server/request.h
index 6202c00..aae7aea 100644
--- a/server/request.h
+++ b/server/request.h
@@ -37,6 +37,7 @@
extern int send_client_fd( struct process *process, int fd, handle_t handle );
extern void read_request( struct thread *thread );
extern void send_reply( struct thread *thread, union generic_request *request );
+extern unsigned int get_tick_count(void);
extern void open_master_socket(void);
extern void close_master_socket(void);
extern void lock_master_socket( int locked );