Commit 31282b3f authored by Alexandre Julliard's avatar Alexandre Julliard

server: Define an lparam_t type for message parameters that can hold all sorts of data.

parent 696512b6
...@@ -22,6 +22,7 @@ typedef unsigned int process_id_t; ...@@ -22,6 +22,7 @@ typedef unsigned int process_id_t;
typedef unsigned int thread_id_t; typedef unsigned int thread_id_t;
typedef unsigned int data_size_t; typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t; typedef unsigned int ioctl_code_t;
typedef unsigned long lparam_t;
typedef unsigned __int64 file_pos_t; typedef unsigned __int64 file_pos_t;
struct request_header struct request_header
...@@ -171,8 +172,8 @@ typedef struct ...@@ -171,8 +172,8 @@ typedef struct
struct callback_msg_data struct callback_msg_data
{ {
void *callback; void *callback;
unsigned long data; lparam_t data;
unsigned long result; lparam_t result;
}; };
struct winevent_msg_data struct winevent_msg_data
...@@ -2449,8 +2450,8 @@ struct send_message_request ...@@ -2449,8 +2450,8 @@ struct send_message_request
int flags; int flags;
user_handle_t win; user_handle_t win;
unsigned int msg; unsigned int msg;
unsigned long wparam; lparam_t wparam;
unsigned long lparam; lparam_t lparam;
timeout_t timeout; timeout_t timeout;
/* VARARG(data,message_data); */ /* VARARG(data,message_data); */
}; };
...@@ -2492,9 +2493,9 @@ struct send_hardware_message_request ...@@ -2492,9 +2493,9 @@ struct send_hardware_message_request
user_handle_t win; user_handle_t win;
unsigned int msg; unsigned int msg;
unsigned int time; unsigned int time;
unsigned long wparam; lparam_t wparam;
unsigned long lparam; lparam_t lparam;
unsigned long info; lparam_t info;
int x; int x;
int y; int y;
}; };
...@@ -2522,9 +2523,9 @@ struct get_message_reply ...@@ -2522,9 +2523,9 @@ struct get_message_reply
user_handle_t win; user_handle_t win;
int type; int type;
unsigned int msg; unsigned int msg;
unsigned long wparam; lparam_t wparam;
unsigned long lparam; lparam_t lparam;
unsigned long info; lparam_t info;
int x; int x;
int y; int y;
unsigned int time; unsigned int time;
...@@ -2539,7 +2540,7 @@ struct get_message_reply ...@@ -2539,7 +2540,7 @@ struct get_message_reply
struct reply_message_request struct reply_message_request
{ {
struct request_header __header; struct request_header __header;
unsigned long result; lparam_t result;
int remove; int remove;
/* VARARG(data,bytes); */ /* VARARG(data,bytes); */
}; };
...@@ -2572,7 +2573,7 @@ struct get_message_reply_request ...@@ -2572,7 +2573,7 @@ struct get_message_reply_request
struct get_message_reply_reply struct get_message_reply_reply
{ {
struct reply_header __header; struct reply_header __header;
unsigned long result; lparam_t result;
/* VARARG(data,bytes); */ /* VARARG(data,bytes); */
}; };
...@@ -2584,13 +2585,13 @@ struct set_win_timer_request ...@@ -2584,13 +2585,13 @@ struct set_win_timer_request
user_handle_t win; user_handle_t win;
unsigned int msg; unsigned int msg;
unsigned int rate; unsigned int rate;
unsigned long id; lparam_t id;
unsigned long lparam; lparam_t lparam;
}; };
struct set_win_timer_reply struct set_win_timer_reply
{ {
struct reply_header __header; struct reply_header __header;
unsigned long id; lparam_t id;
}; };
...@@ -2600,7 +2601,7 @@ struct kill_win_timer_request ...@@ -2600,7 +2601,7 @@ struct kill_win_timer_request
struct request_header __header; struct request_header __header;
user_handle_t win; user_handle_t win;
unsigned int msg; unsigned int msg;
unsigned long id; lparam_t id;
}; };
struct kill_win_timer_reply struct kill_win_timer_reply
{ {
...@@ -2857,10 +2858,10 @@ struct set_window_info_request ...@@ -2857,10 +2858,10 @@ struct set_window_info_request
unsigned int id; unsigned int id;
int is_unicode; int is_unicode;
void* instance; void* instance;
unsigned long user_data; lparam_t user_data;
int extra_offset; int extra_offset;
data_size_t extra_size; data_size_t extra_size;
unsigned long extra_value; lparam_t extra_value;
}; };
struct set_window_info_reply struct set_window_info_reply
{ {
...@@ -2869,8 +2870,8 @@ struct set_window_info_reply ...@@ -2869,8 +2870,8 @@ struct set_window_info_reply
unsigned int old_ex_style; unsigned int old_ex_style;
unsigned int old_id; unsigned int old_id;
void* old_instance; void* old_instance;
unsigned long old_user_data; lparam_t old_user_data;
unsigned long old_extra_value; lparam_t old_extra_value;
}; };
#define SET_WIN_STYLE 0x01 #define SET_WIN_STYLE 0x01
#define SET_WIN_EXSTYLE 0x02 #define SET_WIN_EXSTYLE 0x02
...@@ -3692,7 +3693,7 @@ struct set_class_info_request ...@@ -3692,7 +3693,7 @@ struct set_class_info_request
void* instance; void* instance;
int extra_offset; int extra_offset;
data_size_t extra_size; data_size_t extra_size;
unsigned long extra_value; lparam_t extra_value;
}; };
struct set_class_info_reply struct set_class_info_reply
{ {
...@@ -3702,7 +3703,7 @@ struct set_class_info_reply ...@@ -3702,7 +3703,7 @@ struct set_class_info_reply
int old_extra; int old_extra;
int old_win_extra; int old_win_extra;
void* old_instance; void* old_instance;
unsigned long old_extra_value; lparam_t old_extra_value;
}; };
#define SET_CLASS_ATOM 0x0001 #define SET_CLASS_ATOM 0x0001
#define SET_CLASS_STYLE 0x0002 #define SET_CLASS_STYLE 0x0002
......
...@@ -38,6 +38,7 @@ typedef unsigned int process_id_t; ...@@ -38,6 +38,7 @@ typedef unsigned int process_id_t;
typedef unsigned int thread_id_t; typedef unsigned int thread_id_t;
typedef unsigned int data_size_t; typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t; typedef unsigned int ioctl_code_t;
typedef unsigned long lparam_t;
typedef unsigned __int64 file_pos_t; typedef unsigned __int64 file_pos_t;
struct request_header struct request_header
...@@ -187,8 +188,8 @@ typedef struct ...@@ -187,8 +188,8 @@ typedef struct
struct callback_msg_data struct callback_msg_data
{ {
void *callback; /* callback function */ void *callback; /* callback function */
unsigned long data; /* user data for callback */ lparam_t data; /* user data for callback */
unsigned long result; /* message result */ lparam_t result; /* message result */
}; };
struct winevent_msg_data struct winevent_msg_data
...@@ -1821,8 +1822,8 @@ enum char_info_mode ...@@ -1821,8 +1822,8 @@ enum char_info_mode
int flags; /* message flags (see below) */ int flags; /* message flags (see below) */
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
unsigned int msg; /* message code */ unsigned int msg; /* message code */
unsigned long wparam; /* parameters */ lparam_t wparam; /* parameters */
unsigned long lparam; /* parameters */ lparam_t lparam; /* parameters */
timeout_t timeout; /* timeout for reply */ timeout_t timeout; /* timeout for reply */
VARARG(data,message_data); /* message data for sent messages */ VARARG(data,message_data); /* message data for sent messages */
@END @END
...@@ -1852,9 +1853,9 @@ enum message_type ...@@ -1852,9 +1853,9 @@ enum message_type
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
unsigned int msg; /* message code */ unsigned int msg; /* message code */
unsigned int time; /* message time */ unsigned int time; /* message time */
unsigned long wparam; /* parameters */ lparam_t wparam; /* parameters */
unsigned long lparam; /* parameters */ lparam_t lparam; /* parameters */
unsigned long info; /* extra info */ lparam_t info; /* extra info */
int x; /* x position */ int x; /* x position */
int y; /* y position */ int y; /* y position */
@END @END
...@@ -1873,9 +1874,9 @@ enum message_type ...@@ -1873,9 +1874,9 @@ enum message_type
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
int type; /* message type */ int type; /* message type */
unsigned int msg; /* message code */ unsigned int msg; /* message code */
unsigned long wparam; /* parameters */ lparam_t wparam; /* parameters */
unsigned long lparam; /* parameters */ lparam_t lparam; /* parameters */
unsigned long info; /* extra info */ lparam_t info; /* extra info */
int x; /* x position */ int x; /* x position */
int y; /* y position */ int y; /* y position */
unsigned int time; /* message time */ unsigned int time; /* message time */
...@@ -1888,7 +1889,7 @@ enum message_type ...@@ -1888,7 +1889,7 @@ enum message_type
/* Reply to a sent message */ /* Reply to a sent message */
@REQ(reply_message) @REQ(reply_message)
unsigned long result; /* message result */ lparam_t result; /* message result */
int remove; /* should we remove the message? */ int remove; /* should we remove the message? */
VARARG(data,bytes); /* message data for sent messages */ VARARG(data,bytes); /* message data for sent messages */
@END @END
...@@ -1906,7 +1907,7 @@ enum message_type ...@@ -1906,7 +1907,7 @@ enum message_type
@REQ(get_message_reply) @REQ(get_message_reply)
int cancel; /* cancel message if not ready? */ int cancel; /* cancel message if not ready? */
@REPLY @REPLY
unsigned long result; /* message result */ lparam_t result; /* message result */
VARARG(data,bytes); /* message data for sent messages */ VARARG(data,bytes); /* message data for sent messages */
@END @END
...@@ -1916,10 +1917,10 @@ enum message_type ...@@ -1916,10 +1917,10 @@ enum message_type
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
unsigned int msg; /* message to post */ unsigned int msg; /* message to post */
unsigned int rate; /* timer rate in ms */ unsigned int rate; /* timer rate in ms */
unsigned long id; /* timer id */ lparam_t id; /* timer id */
unsigned long lparam; /* message lparam (callback proc) */ lparam_t lparam; /* message lparam (callback proc) */
@REPLY @REPLY
unsigned long id; /* timer id */ lparam_t id; /* timer id */
@END @END
...@@ -1927,7 +1928,7 @@ enum message_type ...@@ -1927,7 +1928,7 @@ enum message_type
@REQ(kill_win_timer) @REQ(kill_win_timer)
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
unsigned int msg; /* message to post */ unsigned int msg; /* message to post */
unsigned long id; /* timer id */ lparam_t id; /* timer id */
@END @END
...@@ -2104,17 +2105,17 @@ enum message_type ...@@ -2104,17 +2105,17 @@ enum message_type
unsigned int id; /* window id */ unsigned int id; /* window id */
int is_unicode; /* ANSI or unicode */ int is_unicode; /* ANSI or unicode */
void* instance; /* creator instance */ void* instance; /* creator instance */
unsigned long user_data; /* user-specific data */ lparam_t user_data; /* user-specific data */
int extra_offset; /* offset to set in extra bytes */ int extra_offset; /* offset to set in extra bytes */
data_size_t extra_size; /* size to set in extra bytes */ data_size_t extra_size; /* size to set in extra bytes */
unsigned long extra_value; /* value to set in extra bytes */ lparam_t extra_value; /* value to set in extra bytes */
@REPLY @REPLY
unsigned int old_style; /* old window style */ unsigned int old_style; /* old window style */
unsigned int old_ex_style; /* old window extended style */ unsigned int old_ex_style; /* old window extended style */
unsigned int old_id; /* old window id */ unsigned int old_id; /* old window id */
void* old_instance; /* old creator instance */ void* old_instance; /* old creator instance */
unsigned long old_user_data; /* old user-specific data */ lparam_t old_user_data; /* old user-specific data */
unsigned long old_extra_value; /* old value in extra bytes */ lparam_t old_extra_value; /* old value in extra bytes */
@END @END
#define SET_WIN_STYLE 0x01 #define SET_WIN_STYLE 0x01
#define SET_WIN_EXSTYLE 0x02 #define SET_WIN_EXSTYLE 0x02
...@@ -2667,14 +2668,14 @@ enum message_type ...@@ -2667,14 +2668,14 @@ enum message_type
void* instance; /* module instance */ void* instance; /* module instance */
int extra_offset; /* offset to set in extra bytes */ int extra_offset; /* offset to set in extra bytes */
data_size_t extra_size; /* size to set in extra bytes */ data_size_t extra_size; /* size to set in extra bytes */
unsigned long extra_value; /* value to set in extra bytes */ lparam_t extra_value; /* value to set in extra bytes */
@REPLY @REPLY
atom_t old_atom; /* previous class atom */ atom_t old_atom; /* previous class atom */
unsigned int old_style; /* previous class style */ unsigned int old_style; /* previous class style */
int old_extra; /* previous number of class extra bytes */ int old_extra; /* previous number of class extra bytes */
int old_win_extra; /* previous number of window extra bytes */ int old_win_extra; /* previous number of window extra bytes */
void* old_instance; /* previous module instance */ void* old_instance; /* previous module instance */
unsigned long old_extra_value; /* old value in extra bytes */ lparam_t old_extra_value; /* old value in extra bytes */
@END @END
#define SET_CLASS_ATOM 0x0001 #define SET_CLASS_ATOM 0x0001
#define SET_CLASS_STYLE 0x0002 #define SET_CLASS_STYLE 0x0002
......
...@@ -57,7 +57,7 @@ struct message_result ...@@ -57,7 +57,7 @@ struct message_result
struct msg_queue *receiver; /* receiver queue */ struct msg_queue *receiver; /* receiver queue */
int replied; /* has it been replied to? */ int replied; /* has it been replied to? */
unsigned int error; /* error code to pass back to sender */ unsigned int error; /* error code to pass back to sender */
unsigned long result; /* reply result */ lparam_t result; /* reply result */
struct message *callback_msg; /* message to queue for callback */ struct message *callback_msg; /* message to queue for callback */
void *data; /* message reply data */ void *data; /* message reply data */
unsigned int data_size; /* size of message reply data */ unsigned int data_size; /* size of message reply data */
...@@ -70,9 +70,9 @@ struct message ...@@ -70,9 +70,9 @@ struct message
enum message_type type; /* message type */ enum message_type type; /* message type */
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
unsigned int msg; /* message code */ unsigned int msg; /* message code */
unsigned long wparam; /* parameters */ lparam_t wparam; /* parameters */
unsigned long lparam; /* parameters */ lparam_t lparam; /* parameters */
unsigned long info; /* extra info */ lparam_t info; /* extra info */
int x; /* x position */ int x; /* x position */
int y; /* y position */ int y; /* y position */
unsigned int time; /* message time */ unsigned int time; /* message time */
...@@ -89,8 +89,8 @@ struct timer ...@@ -89,8 +89,8 @@ struct timer
unsigned int rate; /* timer rate in ms */ unsigned int rate; /* timer rate in ms */
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
unsigned int msg; /* message to post */ unsigned int msg; /* message to post */
unsigned long id; /* timer id */ lparam_t id; /* timer id */
unsigned long lparam; /* lparam for message */ lparam_t lparam; /* lparam for message */
}; };
struct thread_input struct thread_input
...@@ -127,7 +127,7 @@ struct msg_queue ...@@ -127,7 +127,7 @@ struct msg_queue
struct message_result *recv_result; /* stack of received messages waiting for result */ struct message_result *recv_result; /* stack of received messages waiting for result */
struct list pending_timers; /* list of pending timers */ struct list pending_timers; /* list of pending timers */
struct list expired_timers; /* list of expired timers */ struct list expired_timers; /* list of expired timers */
unsigned long next_timer_id; /* id for the next timer with a 0 window */ lparam_t next_timer_id; /* id for the next timer with a 0 window */
struct timeout_user *timeout; /* timeout for next timer to expire */ struct timeout_user *timeout; /* timeout for next timer to expire */
struct thread_input *input; /* thread input descriptor */ struct thread_input *input; /* thread input descriptor */
struct hook_table *hooks; /* hook table */ struct hook_table *hooks; /* hook table */
...@@ -442,8 +442,7 @@ static inline void remove_result_from_sender( struct message_result *result ) ...@@ -442,8 +442,7 @@ static inline void remove_result_from_sender( struct message_result *result )
} }
/* store the message result in the appropriate structure */ /* store the message result in the appropriate structure */
static void store_message_result( struct message_result *res, unsigned long result, static void store_message_result( struct message_result *res, lparam_t result, unsigned int error )
unsigned int error )
{ {
res->result = result; res->result = result;
res->error = error; res->error = error;
...@@ -631,7 +630,7 @@ static void receive_message( struct msg_queue *queue, struct message *msg, ...@@ -631,7 +630,7 @@ static void receive_message( struct msg_queue *queue, struct message *msg,
} }
/* set the result of the current received message */ /* set the result of the current received message */
static void reply_message( struct msg_queue *queue, unsigned long result, static void reply_message( struct msg_queue *queue, lparam_t result,
unsigned int error, int remove, const void *data, data_size_t len ) unsigned int error, int remove, const void *data, data_size_t len )
{ {
struct message_result *res = queue->recv_result; struct message_result *res = queue->recv_result;
...@@ -1009,7 +1008,7 @@ static void set_next_timer( struct msg_queue *queue ) ...@@ -1009,7 +1008,7 @@ static void set_next_timer( struct msg_queue *queue )
/* find a timer from its window and id */ /* find a timer from its window and id */
static struct timer *find_timer( struct msg_queue *queue, user_handle_t win, static struct timer *find_timer( struct msg_queue *queue, user_handle_t win,
unsigned int msg, unsigned long id ) unsigned int msg, lparam_t id )
{ {
struct list *ptr; struct list *ptr;
...@@ -1481,8 +1480,7 @@ void queue_cleanup_window( struct thread *thread, user_handle_t win ) ...@@ -1481,8 +1480,7 @@ void queue_cleanup_window( struct thread *thread, user_handle_t win )
} }
/* post a message to a window; used by socket handling */ /* post a message to a window; used by socket handling */
void post_message( user_handle_t win, unsigned int message, void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lparam_t lparam )
unsigned long wparam, unsigned long lparam )
{ {
struct message *msg; struct message *msg;
struct thread *thread = get_window_thread( win ); struct thread *thread = get_window_thread( win );
...@@ -1927,7 +1925,7 @@ DECL_HANDLER(set_win_timer) ...@@ -1927,7 +1925,7 @@ DECL_HANDLER(set_win_timer)
struct msg_queue *queue; struct msg_queue *queue;
struct thread *thread = NULL; struct thread *thread = NULL;
user_handle_t win = 0; user_handle_t win = 0;
unsigned long id = req->id; lparam_t id = req->id;
if (req->win) if (req->win)
{ {
......
...@@ -278,8 +278,8 @@ static void sock_wake_up( struct sock *sock, int pollev ) ...@@ -278,8 +278,8 @@ static void sock_wake_up( struct sock *sock, int pollev )
int event = event_bitorder[i]; int event = event_bitorder[i];
if (sock->pmask & (1 << event)) if (sock->pmask & (1 << event))
{ {
unsigned int lparam = (1 << event) | (sock->errors[event] << 16); lparam_t lparam = (1 << event) | (sock->errors[event] << 16);
post_message( sock->window, sock->message, (unsigned long)sock->wparam, lparam ); post_message( sock->window, sock->message, sock->wparam, lparam );
} }
} }
sock->pmask = 0; sock->pmask = 0;
......
...@@ -92,7 +92,7 @@ extern int init_thread_queue( struct thread *thread ); ...@@ -92,7 +92,7 @@ extern int init_thread_queue( struct thread *thread );
extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to ); extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to );
extern void detach_thread_input( struct thread *thread_from ); extern void detach_thread_input( struct thread *thread_from );
extern void post_message( user_handle_t win, unsigned int message, extern void post_message( user_handle_t win, unsigned int message,
unsigned long wparam, unsigned long lparam ); lparam_t wparam, lparam_t lparam );
extern void post_win_event( struct thread *thread, unsigned int event, extern void post_win_event( struct thread *thread, unsigned int event,
user_handle_t win, unsigned int object_id, user_handle_t win, unsigned int object_id,
unsigned int child_id, void *proc, unsigned int child_id, void *proc,
......
...@@ -83,7 +83,7 @@ struct window ...@@ -83,7 +83,7 @@ struct window
unsigned int color_key; /* color key for a layered window */ unsigned int color_key; /* color key for a layered window */
unsigned int alpha; /* alpha value for a layered window */ unsigned int alpha; /* alpha value for a layered window */
unsigned int layered_flags; /* flags for a layered window */ unsigned int layered_flags; /* flags for a layered window */
unsigned long user_data; /* user-specific data */ lparam_t user_data; /* user-specific data */
WCHAR *text; /* window caption text */ WCHAR *text; /* window caption text */
unsigned int paint_flags; /* various painting flags */ unsigned int paint_flags; /* various painting flags */
int prop_inuse; /* number of in-use window properties */ int prop_inuse; /* number of in-use window properties */
......
...@@ -37,6 +37,7 @@ my %formats = ...@@ -37,6 +37,7 @@ my %formats =
"user_handle_t" => "%08x", "user_handle_t" => "%08x",
"process_id_t" => "%04x", "process_id_t" => "%04x",
"thread_id_t" => "%04x", "thread_id_t" => "%04x",
"lparam_t" => "%lx",
"timeout_t" => "&dump_timeout", "timeout_t" => "&dump_timeout",
"rectangle_t" => "&dump_rectangle", "rectangle_t" => "&dump_rectangle",
"char_info_t" => "&dump_char_info", "char_info_t" => "&dump_char_info",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment