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

This commit is contained in:
Alexandre Julliard 2008-12-10 16:01:50 +01:00
parent 696512b6cb
commit 31282b3f63
7 changed files with 63 additions and 62 deletions

View File

@ -22,6 +22,7 @@ typedef unsigned int process_id_t;
typedef unsigned int thread_id_t;
typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t;
typedef unsigned long lparam_t;
typedef unsigned __int64 file_pos_t;
struct request_header
@ -171,8 +172,8 @@ typedef struct
struct callback_msg_data
{
void *callback;
unsigned long data;
unsigned long result;
lparam_t data;
lparam_t result;
};
struct winevent_msg_data
@ -2449,8 +2450,8 @@ struct send_message_request
int flags;
user_handle_t win;
unsigned int msg;
unsigned long wparam;
unsigned long lparam;
lparam_t wparam;
lparam_t lparam;
timeout_t timeout;
/* VARARG(data,message_data); */
};
@ -2492,9 +2493,9 @@ struct send_hardware_message_request
user_handle_t win;
unsigned int msg;
unsigned int time;
unsigned long wparam;
unsigned long lparam;
unsigned long info;
lparam_t wparam;
lparam_t lparam;
lparam_t info;
int x;
int y;
};
@ -2522,9 +2523,9 @@ struct get_message_reply
user_handle_t win;
int type;
unsigned int msg;
unsigned long wparam;
unsigned long lparam;
unsigned long info;
lparam_t wparam;
lparam_t lparam;
lparam_t info;
int x;
int y;
unsigned int time;
@ -2539,7 +2540,7 @@ struct get_message_reply
struct reply_message_request
{
struct request_header __header;
unsigned long result;
lparam_t result;
int remove;
/* VARARG(data,bytes); */
};
@ -2572,7 +2573,7 @@ struct get_message_reply_request
struct get_message_reply_reply
{
struct reply_header __header;
unsigned long result;
lparam_t result;
/* VARARG(data,bytes); */
};
@ -2584,13 +2585,13 @@ struct set_win_timer_request
user_handle_t win;
unsigned int msg;
unsigned int rate;
unsigned long id;
unsigned long lparam;
lparam_t id;
lparam_t lparam;
};
struct set_win_timer_reply
{
struct reply_header __header;
unsigned long id;
lparam_t id;
};
@ -2600,7 +2601,7 @@ struct kill_win_timer_request
struct request_header __header;
user_handle_t win;
unsigned int msg;
unsigned long id;
lparam_t id;
};
struct kill_win_timer_reply
{
@ -2857,10 +2858,10 @@ struct set_window_info_request
unsigned int id;
int is_unicode;
void* instance;
unsigned long user_data;
lparam_t user_data;
int extra_offset;
data_size_t extra_size;
unsigned long extra_value;
lparam_t extra_value;
};
struct set_window_info_reply
{
@ -2869,8 +2870,8 @@ struct set_window_info_reply
unsigned int old_ex_style;
unsigned int old_id;
void* old_instance;
unsigned long old_user_data;
unsigned long old_extra_value;
lparam_t old_user_data;
lparam_t old_extra_value;
};
#define SET_WIN_STYLE 0x01
#define SET_WIN_EXSTYLE 0x02
@ -3692,7 +3693,7 @@ struct set_class_info_request
void* instance;
int extra_offset;
data_size_t extra_size;
unsigned long extra_value;
lparam_t extra_value;
};
struct set_class_info_reply
{
@ -3702,7 +3703,7 @@ struct set_class_info_reply
int old_extra;
int old_win_extra;
void* old_instance;
unsigned long old_extra_value;
lparam_t old_extra_value;
};
#define SET_CLASS_ATOM 0x0001
#define SET_CLASS_STYLE 0x0002

View File

@ -38,6 +38,7 @@ typedef unsigned int process_id_t;
typedef unsigned int thread_id_t;
typedef unsigned int data_size_t;
typedef unsigned int ioctl_code_t;
typedef unsigned long lparam_t;
typedef unsigned __int64 file_pos_t;
struct request_header
@ -187,8 +188,8 @@ typedef struct
struct callback_msg_data
{
void *callback; /* callback function */
unsigned long data; /* user data for callback */
unsigned long result; /* message result */
lparam_t data; /* user data for callback */
lparam_t result; /* message result */
};
struct winevent_msg_data
@ -1821,8 +1822,8 @@ enum char_info_mode
int flags; /* message flags (see below) */
user_handle_t win; /* window handle */
unsigned int msg; /* message code */
unsigned long wparam; /* parameters */
unsigned long lparam; /* parameters */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
timeout_t timeout; /* timeout for reply */
VARARG(data,message_data); /* message data for sent messages */
@END
@ -1852,9 +1853,9 @@ enum message_type
user_handle_t win; /* window handle */
unsigned int msg; /* message code */
unsigned int time; /* message time */
unsigned long wparam; /* parameters */
unsigned long lparam; /* parameters */
unsigned long info; /* extra info */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
lparam_t info; /* extra info */
int x; /* x position */
int y; /* y position */
@END
@ -1873,9 +1874,9 @@ enum message_type
user_handle_t win; /* window handle */
int type; /* message type */
unsigned int msg; /* message code */
unsigned long wparam; /* parameters */
unsigned long lparam; /* parameters */
unsigned long info; /* extra info */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
lparam_t info; /* extra info */
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
@ -1888,7 +1889,7 @@ enum message_type
/* Reply to a sent message */
@REQ(reply_message)
unsigned long result; /* message result */
lparam_t result; /* message result */
int remove; /* should we remove the message? */
VARARG(data,bytes); /* message data for sent messages */
@END
@ -1906,7 +1907,7 @@ enum message_type
@REQ(get_message_reply)
int cancel; /* cancel message if not ready? */
@REPLY
unsigned long result; /* message result */
lparam_t result; /* message result */
VARARG(data,bytes); /* message data for sent messages */
@END
@ -1916,10 +1917,10 @@ enum message_type
user_handle_t win; /* window handle */
unsigned int msg; /* message to post */
unsigned int rate; /* timer rate in ms */
unsigned long id; /* timer id */
unsigned long lparam; /* message lparam (callback proc) */
lparam_t id; /* timer id */
lparam_t lparam; /* message lparam (callback proc) */
@REPLY
unsigned long id; /* timer id */
lparam_t id; /* timer id */
@END
@ -1927,7 +1928,7 @@ enum message_type
@REQ(kill_win_timer)
user_handle_t win; /* window handle */
unsigned int msg; /* message to post */
unsigned long id; /* timer id */
lparam_t id; /* timer id */
@END
@ -2104,17 +2105,17 @@ enum message_type
unsigned int id; /* window id */
int is_unicode; /* ANSI or unicode */
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 */
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
unsigned int old_style; /* old window style */
unsigned int old_ex_style; /* old window extended style */
unsigned int old_id; /* old window id */
void* old_instance; /* old creator instance */
unsigned long old_user_data; /* old user-specific data */
unsigned long old_extra_value; /* old value in extra bytes */
lparam_t old_user_data; /* old user-specific data */
lparam_t old_extra_value; /* old value in extra bytes */
@END
#define SET_WIN_STYLE 0x01
#define SET_WIN_EXSTYLE 0x02
@ -2667,14 +2668,14 @@ enum message_type
void* instance; /* module instance */
int extra_offset; /* offset 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
atom_t old_atom; /* previous class atom */
unsigned int old_style; /* previous class style */
int old_extra; /* previous number of class extra bytes */
int old_win_extra; /* previous number of window extra bytes */
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
#define SET_CLASS_ATOM 0x0001
#define SET_CLASS_STYLE 0x0002

View File

@ -57,7 +57,7 @@ struct message_result
struct msg_queue *receiver; /* receiver queue */
int replied; /* has it been replied to? */
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 */
void *data; /* message reply data */
unsigned int data_size; /* size of message reply data */
@ -70,9 +70,9 @@ struct message
enum message_type type; /* message type */
user_handle_t win; /* window handle */
unsigned int msg; /* message code */
unsigned long wparam; /* parameters */
unsigned long lparam; /* parameters */
unsigned long info; /* extra info */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
lparam_t info; /* extra info */
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
@ -89,8 +89,8 @@ struct timer
unsigned int rate; /* timer rate in ms */
user_handle_t win; /* window handle */
unsigned int msg; /* message to post */
unsigned long id; /* timer id */
unsigned long lparam; /* lparam for message */
lparam_t id; /* timer id */
lparam_t lparam; /* lparam for message */
};
struct thread_input
@ -127,7 +127,7 @@ struct msg_queue
struct message_result *recv_result; /* stack of received messages waiting for result */
struct list pending_timers; /* list of pending 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 thread_input *input; /* thread input descriptor */
struct hook_table *hooks; /* hook table */
@ -442,8 +442,7 @@ static inline void remove_result_from_sender( struct message_result *result )
}
/* store the message result in the appropriate structure */
static void store_message_result( struct message_result *res, unsigned long result,
unsigned int error )
static void store_message_result( struct message_result *res, lparam_t result, unsigned int error )
{
res->result = result;
res->error = error;
@ -631,7 +630,7 @@ static void receive_message( struct msg_queue *queue, struct message *msg,
}
/* 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 )
{
struct message_result *res = queue->recv_result;
@ -1009,7 +1008,7 @@ static void set_next_timer( struct msg_queue *queue )
/* find a timer from its window and id */
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;
@ -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 */
void post_message( user_handle_t win, unsigned int message,
unsigned long wparam, unsigned long lparam )
void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lparam_t lparam )
{
struct message *msg;
struct thread *thread = get_window_thread( win );
@ -1927,7 +1925,7 @@ DECL_HANDLER(set_win_timer)
struct msg_queue *queue;
struct thread *thread = NULL;
user_handle_t win = 0;
unsigned long id = req->id;
lparam_t id = req->id;
if (req->win)
{

View File

@ -278,8 +278,8 @@ static void sock_wake_up( struct sock *sock, int pollev )
int event = event_bitorder[i];
if (sock->pmask & (1 << event))
{
unsigned int lparam = (1 << event) | (sock->errors[event] << 16);
post_message( sock->window, sock->message, (unsigned long)sock->wparam, lparam );
lparam_t lparam = (1 << event) | (sock->errors[event] << 16);
post_message( sock->window, sock->message, sock->wparam, lparam );
}
}
sock->pmask = 0;

View File

@ -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 void detach_thread_input( struct thread *thread_from );
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,
user_handle_t win, unsigned int object_id,
unsigned int child_id, void *proc,

View File

@ -83,7 +83,7 @@ struct window
unsigned int color_key; /* color key for a layered window */
unsigned int alpha; /* alpha value 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 */
unsigned int paint_flags; /* various painting flags */
int prop_inuse; /* number of in-use window properties */

View File

@ -37,6 +37,7 @@ my %formats =
"user_handle_t" => "%08x",
"process_id_t" => "%04x",
"thread_id_t" => "%04x",
"lparam_t" => "%lx",
"timeout_t" => "&dump_timeout",
"rectangle_t" => "&dump_rectangle",
"char_info_t" => "&dump_char_info",