server: Add an apc_param_t type to store APC client-side parameters.

This commit is contained in:
Alexandre Julliard 2008-12-15 13:29:38 +01:00
parent 93488b19dc
commit dc7f170495
7 changed files with 31 additions and 26 deletions

View File

@ -23,6 +23,7 @@ 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 long apc_param_t;
typedef unsigned __int64 file_pos_t;
struct request_header
@ -164,7 +165,7 @@ typedef struct
void *arg;
void *apc;
obj_handle_t event;
unsigned long cvalue;
apc_param_t cvalue;
} async_data_t;
@ -260,7 +261,7 @@ typedef union
{
enum apc_type type;
void (__stdcall *func)(unsigned long,unsigned long,unsigned long);
unsigned long args[3];
apc_param_t args[3];
} user;
struct
{
@ -4224,8 +4225,8 @@ struct add_completion_request
{
struct request_header __header;
obj_handle_t handle;
unsigned long ckey;
unsigned long cvalue;
apc_param_t ckey;
apc_param_t cvalue;
unsigned long information;
unsigned int status;
};
@ -4244,8 +4245,8 @@ struct remove_completion_request
struct remove_completion_reply
{
struct reply_header __header;
unsigned long ckey;
unsigned long cvalue;
apc_param_t ckey;
apc_param_t cvalue;
unsigned long information;
unsigned int status;
};
@ -4270,7 +4271,7 @@ struct set_completion_info_request
struct request_header __header;
obj_handle_t handle;
obj_handle_t chandle;
unsigned long ckey;
apc_param_t ckey;
};
struct set_completion_info_reply
{
@ -4283,7 +4284,7 @@ struct add_fd_completion_request
{
struct request_header __header;
obj_handle_t handle;
unsigned long cvalue;
apc_param_t cvalue;
unsigned int status;
unsigned long information;
};

View File

@ -43,7 +43,7 @@ struct async
unsigned int timeout_status; /* status to report upon timeout */
struct event *event;
struct completion *completion;
unsigned long comp_key;
apc_param_t comp_key;
async_data_t data; /* data for async I/O call */
};
@ -266,8 +266,8 @@ void async_set_result( struct object *obj, unsigned int status, unsigned long to
memset( &data, 0, sizeof(data) );
data.type = APC_USER;
data.user.func = async->data.apc;
data.user.args[0] = (unsigned long)async->data.arg;
data.user.args[1] = (unsigned long)async->data.iosb;
data.user.args[0] = (apc_param_t)async->data.arg;
data.user.args[1] = (apc_param_t)async->data.iosb;
data.user.args[2] = 0;
thread_queue_apc( async->thread, NULL, &data );
}

View File

@ -79,8 +79,8 @@ static const struct object_ops completion_ops =
struct comp_msg
{
struct list queue_entry;
unsigned long ckey;
unsigned long cvalue;
apc_param_t ckey;
apc_param_t cvalue;
unsigned long information;
unsigned int status;
};
@ -141,7 +141,8 @@ struct completion *get_completion_obj( struct process *process, obj_handle_t han
return (struct completion *) get_handle_obj( process, handle, access, &completion_ops );
}
void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information )
void add_completion( struct completion *completion, apc_param_t ckey, apc_param_t cvalue,
unsigned int status, unsigned long information )
{
struct comp_msg *msg = mem_alloc( sizeof( *msg ) );

View File

@ -199,7 +199,7 @@ struct fd
struct async_queue *write_q; /* async writers of this fd */
struct async_queue *wait_q; /* other async waiters of this fd */
struct completion *completion; /* completion object attached to this fd */
unsigned long comp_key; /* completion key to set in completion events */
apc_param_t comp_key; /* completion key to set in completion events */
};
static void fd_dump( struct object *obj, int verbose );
@ -1940,7 +1940,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
return fd;
}
void fd_assign_completion( struct fd *fd, struct completion **p_port, unsigned long *p_key )
void fd_assign_completion( struct fd *fd, struct completion **p_port, apc_param_t *p_key )
{
*p_key = fd->comp_key;
*p_port = fd->completion ? (struct completion *)grab_object( fd->completion ) : NULL;

View File

@ -124,7 +124,8 @@ extern struct object *create_dir_obj( struct fd *fd );
/* completion */
extern struct completion *get_completion_obj( struct process *process, obj_handle_t handle, unsigned int access );
extern void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information );
extern void add_completion( struct completion *completion, apc_param_t ckey, apc_param_t cvalue,
unsigned int status, unsigned long information );
/* serial port functions */
@ -141,7 +142,7 @@ extern void async_set_result( struct object *obj, unsigned int status, unsigned
extern int async_waiting( struct async_queue *queue );
extern void async_terminate( struct async *async, unsigned int status );
extern void async_wake_up( struct async_queue *queue, unsigned int status );
extern void fd_assign_completion( struct fd *fd, struct completion **p_port, unsigned long *p_key );
extern void fd_assign_completion( struct fd *fd, struct completion **p_port, apc_param_t *p_key );
/* access rights that require Unix read permission */
#define FILE_UNIX_READ_ACCESS (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA)

View File

@ -39,6 +39,7 @@ 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 long apc_param_t;
typedef unsigned __int64 file_pos_t;
struct request_header
@ -180,7 +181,7 @@ typedef struct
void *arg; /* opaque user data to pass to callback */
void *apc; /* user apc to call */
obj_handle_t event; /* event to signal when done */
unsigned long cvalue; /* completion value to use for completion events */
apc_param_t cvalue; /* completion value to use for completion events */
} async_data_t;
/* structures for extra message data */
@ -276,7 +277,7 @@ typedef union
{
enum apc_type type; /* APC_USER */
void (__stdcall *func)(unsigned long,unsigned long,unsigned long);
unsigned long args[3]; /* arguments for user function */
apc_param_t args[3]; /* arguments for user function */
} user;
struct
{
@ -3031,8 +3032,8 @@ enum message_type
/* add completion to completion port */
@REQ(add_completion)
obj_handle_t handle; /* port handle */
unsigned long ckey; /* completion key */
unsigned long cvalue; /* completion value */
apc_param_t ckey; /* completion key */
apc_param_t cvalue; /* completion value */
unsigned long information; /* IO_STATUS_BLOCK Information */
unsigned int status; /* completion result */
@END
@ -3042,8 +3043,8 @@ enum message_type
@REQ(remove_completion)
obj_handle_t handle; /* port handle */
@REPLY
unsigned long ckey; /* completion key */
unsigned long cvalue; /* completion value */
apc_param_t ckey; /* completion key */
apc_param_t cvalue; /* completion value */
unsigned long information; /* IO_STATUS_BLOCK Information */
unsigned int status; /* completion result */
@END
@ -3061,14 +3062,14 @@ enum message_type
@REQ(set_completion_info)
obj_handle_t handle; /* object handle */
obj_handle_t chandle; /* port handle */
unsigned long ckey; /* completion key */
apc_param_t ckey; /* completion key */
@END
/* check for associated completion and push msg */
@REQ(add_fd_completion)
obj_handle_t handle; /* async' object */
unsigned long cvalue; /* completion value */
apc_param_t cvalue; /* completion value */
unsigned int status; /* completion status */
unsigned long information; /* IO_STATUS_BLOCK Information */
@END

View File

@ -38,6 +38,7 @@ my %formats =
"process_id_t" => [ 4, 4, "%04x" ],
"thread_id_t" => [ 4, 4, "%04x" ],
"lparam_t" => [ 4, 4, "%lx" ],
"apc_param_t" => [ 4, 4, "%lx" ],
"timeout_t" => [ 8, 8, "&dump_timeout" ],
"rectangle_t" => [ 16, 4, "&dump_rectangle" ],
"char_info_t" => [ 4, 2, "&dump_char_info" ],