user32: Return the cursor position in send_hardware_message and use it to update the driver's position.
diff --git a/server/protocol.def b/server/protocol.def
index 91a59b2..73f2d8e 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2032,6 +2032,10 @@
     unsigned int    flags;     /* flags (see below) */
 @REPLY
     int             wait;      /* do we need to wait for a reply? */
+    int             prev_x;    /* previous cursor position */
+    int             prev_y;
+    int             new_x;     /* new cursor position */
+    int             new_y;
     VARARG(keystate,bytes);    /* global state array for all the keys */
 @END
 #define SEND_HWMSG_INJECTED    0x01
diff --git a/server/queue.c b/server/queue.c
index 20d3e41..2cd82b4 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2204,6 +2204,9 @@
         }
     }
 
+    reply->prev_x = desktop->cursor.x;
+    reply->prev_y = desktop->cursor.y;
+
     switch (req->input.type)
     {
     case INPUT_MOUSE:
@@ -2219,6 +2222,9 @@
         set_error( STATUS_INVALID_PARAMETER );
     }
     if (thread) release_object( thread );
+
+    reply->new_x = desktop->cursor.x;
+    reply->new_y = desktop->cursor.y;
     set_reply_data( desktop->keystate, size );
     release_object( desktop );
 }
diff --git a/server/request.h b/server/request.h
index ac69461..c1cca4c 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1391,7 +1391,11 @@
 C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, flags) == 48 );
 C_ASSERT( sizeof(struct send_hardware_message_request) == 56 );
 C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, wait) == 8 );
-C_ASSERT( sizeof(struct send_hardware_message_reply) == 16 );
+C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_x) == 12 );
+C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_y) == 16 );
+C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, new_x) == 20 );
+C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, new_y) == 24 );
+C_ASSERT( sizeof(struct send_hardware_message_reply) == 32 );
 C_ASSERT( FIELD_OFFSET(struct get_message_request, flags) == 12 );
 C_ASSERT( FIELD_OFFSET(struct get_message_request, get_win) == 16 );
 C_ASSERT( FIELD_OFFSET(struct get_message_request, get_first) == 20 );
diff --git a/server/trace.c b/server/trace.c
index 4a50232..b8dc316 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2452,6 +2452,10 @@
 static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req )
 {
     fprintf( stderr, " wait=%d", req->wait );
+    fprintf( stderr, ", prev_x=%d", req->prev_x );
+    fprintf( stderr, ", prev_y=%d", req->prev_y );
+    fprintf( stderr, ", new_x=%d", req->new_x );
+    fprintf( stderr, ", new_y=%d", req->new_y );
     dump_varargs_bytes( ", keystate=", cur_size );
 }