server: Introduce get_next_console_request request.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d902c33306
commit
898e121b2e
|
@ -1938,6 +1938,24 @@ struct send_console_signal_reply
|
|||
|
||||
|
||||
|
||||
struct get_next_console_request_request
|
||||
{
|
||||
struct request_header __header;
|
||||
obj_handle_t handle;
|
||||
int signal;
|
||||
unsigned int status;
|
||||
/* VARARG(out_data,bytes); */
|
||||
};
|
||||
struct get_next_console_request_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
unsigned int code;
|
||||
data_size_t out_size;
|
||||
/* VARARG(in_data,bytes); */
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct read_directory_changes_request
|
||||
{
|
||||
struct request_header __header;
|
||||
|
@ -5520,6 +5538,7 @@ enum request
|
|||
REQ_get_console_input_history,
|
||||
REQ_create_console_output,
|
||||
REQ_send_console_signal,
|
||||
REQ_get_next_console_request,
|
||||
REQ_read_directory_changes,
|
||||
REQ_read_change,
|
||||
REQ_create_mapping,
|
||||
|
@ -5809,6 +5828,7 @@ union generic_request
|
|||
struct get_console_input_history_request get_console_input_history_request;
|
||||
struct create_console_output_request create_console_output_request;
|
||||
struct send_console_signal_request send_console_signal_request;
|
||||
struct get_next_console_request_request get_next_console_request_request;
|
||||
struct read_directory_changes_request read_directory_changes_request;
|
||||
struct read_change_request read_change_request;
|
||||
struct create_mapping_request create_mapping_request;
|
||||
|
@ -6096,6 +6116,7 @@ union generic_reply
|
|||
struct get_console_input_history_reply get_console_input_history_reply;
|
||||
struct create_console_output_reply create_console_output_reply;
|
||||
struct send_console_signal_reply send_console_signal_reply;
|
||||
struct get_next_console_request_reply get_next_console_request_reply;
|
||||
struct read_directory_changes_reply read_directory_changes_reply;
|
||||
struct read_change_reply read_change_reply;
|
||||
struct create_mapping_reply create_mapping_reply;
|
||||
|
@ -6312,7 +6333,7 @@ union generic_reply
|
|||
|
||||
/* ### protocol_version begin ### */
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 637
|
||||
#define SERVER_PROTOCOL_VERSION 638
|
||||
|
||||
/* ### protocol_version end ### */
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ struct console_server
|
|||
struct object obj; /* object header */
|
||||
struct console_input *console; /* attached console */
|
||||
struct list queue; /* ioctl queue */
|
||||
int busy; /* flag if server processing an ioctl */
|
||||
};
|
||||
|
||||
static void console_server_dump( struct object *obj, int verbose );
|
||||
|
@ -1635,6 +1636,7 @@ static struct object *create_console_server( void )
|
|||
|
||||
if (!(server = alloc_object( &console_server_ops ))) return NULL;
|
||||
server->console = NULL;
|
||||
server->busy = 0;
|
||||
list_init( &server->queue );
|
||||
|
||||
return &server->obj;
|
||||
|
@ -2379,3 +2381,88 @@ DECL_HANDLER(get_console_wait_event)
|
|||
}
|
||||
else set_error( STATUS_INVALID_PARAMETER );
|
||||
}
|
||||
|
||||
/* retrieve the next pending console ioctl request */
|
||||
DECL_HANDLER(get_next_console_request)
|
||||
{
|
||||
struct console_host_ioctl *ioctl = NULL;
|
||||
struct console_server *server;
|
||||
struct iosb *iosb = NULL;
|
||||
|
||||
|
||||
server = (struct console_server *)get_handle_obj( current->process, req->handle, 0, &console_server_ops );
|
||||
if (!server) return;
|
||||
|
||||
if (!server->console)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
release_object( server );
|
||||
return;
|
||||
}
|
||||
|
||||
if (req->signal) set_event( server->console->event);
|
||||
else reset_event( server->console->event );
|
||||
|
||||
/* set result of previous ioctl, if any */
|
||||
if (server->busy)
|
||||
{
|
||||
unsigned int status = req->status;
|
||||
ioctl = LIST_ENTRY( list_head( &server->queue ), struct console_host_ioctl, entry );
|
||||
list_remove( &ioctl->entry );
|
||||
if (ioctl->async)
|
||||
{
|
||||
iosb = async_get_iosb( ioctl->async );
|
||||
iosb->status = req->status;
|
||||
iosb->out_size = min( iosb->out_size, get_req_data_size() );
|
||||
if (iosb->out_size)
|
||||
{
|
||||
if ((iosb->out_data = memdup( get_req_data(), iosb->out_size )))
|
||||
{
|
||||
iosb->result = iosb->out_size;
|
||||
status = STATUS_ALERTED;
|
||||
}
|
||||
else if (!status)
|
||||
{
|
||||
iosb->status = STATUS_NO_MEMORY;
|
||||
iosb->out_size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
console_host_ioctl_terminate( ioctl, status );
|
||||
if (iosb) release_object( iosb );
|
||||
server->busy = 0;
|
||||
}
|
||||
|
||||
/* return the next ioctl */
|
||||
if (!list_empty( &server->queue ))
|
||||
{
|
||||
ioctl = LIST_ENTRY( list_head( &server->queue ), struct console_host_ioctl, entry );
|
||||
iosb = ioctl->async ? async_get_iosb( ioctl->async ) : NULL;
|
||||
|
||||
if (!iosb || get_reply_max_size() >= iosb->in_size)
|
||||
{
|
||||
reply->code = ioctl->code;
|
||||
|
||||
if (iosb)
|
||||
{
|
||||
reply->out_size = iosb->out_size;
|
||||
set_reply_data_ptr( iosb->in_data, iosb->in_size );
|
||||
iosb->in_data = NULL;
|
||||
}
|
||||
|
||||
server->busy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
reply->out_size = iosb->in_size;
|
||||
set_error( STATUS_BUFFER_OVERFLOW );
|
||||
}
|
||||
if (iosb) release_object( iosb );
|
||||
}
|
||||
else
|
||||
{
|
||||
set_error( STATUS_PENDING );
|
||||
}
|
||||
|
||||
release_object( server );
|
||||
}
|
||||
|
|
|
@ -1522,6 +1522,19 @@ enum server_fd_type
|
|||
@END
|
||||
|
||||
|
||||
/* Retrieve the next pending console ioctl request */
|
||||
@REQ(get_next_console_request)
|
||||
obj_handle_t handle; /* console server handle */
|
||||
int signal; /* server signal state */
|
||||
unsigned int status; /* status of previous ioctl */
|
||||
VARARG(out_data,bytes); /* out_data of previous ioctl */
|
||||
@REPLY
|
||||
unsigned int code; /* ioctl code */
|
||||
data_size_t out_size; /* ioctl output size */
|
||||
VARARG(in_data,bytes); /* ioctl in_data */
|
||||
@END
|
||||
|
||||
|
||||
/* enable directory change notifications */
|
||||
@REQ(read_directory_changes)
|
||||
unsigned int filter; /* notification filter */
|
||||
|
|
|
@ -189,6 +189,7 @@ DECL_HANDLER(append_console_input_history);
|
|||
DECL_HANDLER(get_console_input_history);
|
||||
DECL_HANDLER(create_console_output);
|
||||
DECL_HANDLER(send_console_signal);
|
||||
DECL_HANDLER(get_next_console_request);
|
||||
DECL_HANDLER(read_directory_changes);
|
||||
DECL_HANDLER(read_change);
|
||||
DECL_HANDLER(create_mapping);
|
||||
|
@ -477,6 +478,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
|
|||
(req_handler)req_get_console_input_history,
|
||||
(req_handler)req_create_console_output,
|
||||
(req_handler)req_send_console_signal,
|
||||
(req_handler)req_get_next_console_request,
|
||||
(req_handler)req_read_directory_changes,
|
||||
(req_handler)req_read_change,
|
||||
(req_handler)req_create_mapping,
|
||||
|
@ -1132,6 +1134,13 @@ C_ASSERT( sizeof(struct create_console_output_reply) == 16 );
|
|||
C_ASSERT( FIELD_OFFSET(struct send_console_signal_request, signal) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_console_signal_request, group_id) == 16 );
|
||||
C_ASSERT( sizeof(struct send_console_signal_request) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_next_console_request_request, handle) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_next_console_request_request, signal) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_next_console_request_request, status) == 20 );
|
||||
C_ASSERT( sizeof(struct get_next_console_request_request) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_next_console_request_reply, code) == 8 );
|
||||
C_ASSERT( FIELD_OFFSET(struct get_next_console_request_reply, out_size) == 12 );
|
||||
C_ASSERT( sizeof(struct get_next_console_request_reply) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct read_directory_changes_request, filter) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct read_directory_changes_request, subtree) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct read_directory_changes_request, want_data) == 20 );
|
||||
|
|
|
@ -2094,6 +2094,21 @@ static void dump_send_console_signal_request( const struct send_console_signal_r
|
|||
fprintf( stderr, ", group_id=%04x", req->group_id );
|
||||
}
|
||||
|
||||
static void dump_get_next_console_request_request( const struct get_next_console_request_request *req )
|
||||
{
|
||||
fprintf( stderr, " handle=%04x", req->handle );
|
||||
fprintf( stderr, ", signal=%d", req->signal );
|
||||
fprintf( stderr, ", status=%08x", req->status );
|
||||
dump_varargs_bytes( ", out_data=", cur_size );
|
||||
}
|
||||
|
||||
static void dump_get_next_console_request_reply( const struct get_next_console_request_reply *req )
|
||||
{
|
||||
fprintf( stderr, " code=%08x", req->code );
|
||||
fprintf( stderr, ", out_size=%u", req->out_size );
|
||||
dump_varargs_bytes( ", in_data=", cur_size );
|
||||
}
|
||||
|
||||
static void dump_read_directory_changes_request( const struct read_directory_changes_request *req )
|
||||
{
|
||||
fprintf( stderr, " filter=%08x", req->filter );
|
||||
|
@ -4485,6 +4500,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
|||
(dump_func)dump_get_console_input_history_request,
|
||||
(dump_func)dump_create_console_output_request,
|
||||
(dump_func)dump_send_console_signal_request,
|
||||
(dump_func)dump_get_next_console_request_request,
|
||||
(dump_func)dump_read_directory_changes_request,
|
||||
(dump_func)dump_read_change_request,
|
||||
(dump_func)dump_create_mapping_request,
|
||||
|
@ -4770,6 +4786,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
|||
(dump_func)dump_get_console_input_history_reply,
|
||||
(dump_func)dump_create_console_output_reply,
|
||||
NULL,
|
||||
(dump_func)dump_get_next_console_request_reply,
|
||||
NULL,
|
||||
(dump_func)dump_read_change_reply,
|
||||
(dump_func)dump_create_mapping_reply,
|
||||
|
@ -5055,6 +5072,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
|||
"get_console_input_history",
|
||||
"create_console_output",
|
||||
"send_console_signal",
|
||||
"get_next_console_request",
|
||||
"read_directory_changes",
|
||||
"read_change",
|
||||
"create_mapping",
|
||||
|
|
Loading…
Reference in New Issue