server: Remove support for creating bare consoles.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
26c715f85b
commit
79cb33e192
|
@ -1807,8 +1807,6 @@ struct alloc_console_request
|
||||||
unsigned int access;
|
unsigned int access;
|
||||||
unsigned int attributes;
|
unsigned int attributes;
|
||||||
process_id_t pid;
|
process_id_t pid;
|
||||||
int input_fd;
|
|
||||||
char __pad_28[4];
|
|
||||||
};
|
};
|
||||||
struct alloc_console_reply
|
struct alloc_console_reply
|
||||||
{
|
{
|
||||||
|
@ -1882,7 +1880,7 @@ struct create_console_output_request
|
||||||
unsigned int access;
|
unsigned int access;
|
||||||
unsigned int attributes;
|
unsigned int attributes;
|
||||||
unsigned int share;
|
unsigned int share;
|
||||||
int fd;
|
char __pad_28[4];
|
||||||
};
|
};
|
||||||
struct create_console_output_reply
|
struct create_console_output_reply
|
||||||
{
|
{
|
||||||
|
@ -6283,7 +6281,7 @@ union generic_reply
|
||||||
|
|
||||||
/* ### protocol_version begin ### */
|
/* ### protocol_version begin ### */
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 644
|
#define SERVER_PROTOCOL_VERSION 645
|
||||||
|
|
||||||
/* ### protocol_version end ### */
|
/* ### protocol_version end ### */
|
||||||
|
|
||||||
|
|
|
@ -685,7 +685,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
|
||||||
req->access = GENERIC_READ | GENERIC_WRITE;
|
req->access = GENERIC_READ | GENERIC_WRITE;
|
||||||
req->attributes = 0;
|
req->attributes = 0;
|
||||||
req->pid = pid;
|
req->pid = pid;
|
||||||
req->input_fd = -1;
|
|
||||||
|
|
||||||
ret = !wine_server_call_err( req );
|
ret = !wine_server_call_err( req );
|
||||||
con_in = wine_server_ptr_handle( reply->handle_in );
|
con_in = wine_server_ptr_handle( reply->handle_in );
|
||||||
|
@ -711,7 +710,6 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
|
||||||
req->access = GENERIC_WRITE|GENERIC_READ;
|
req->access = GENERIC_WRITE|GENERIC_READ;
|
||||||
req->attributes = 0;
|
req->attributes = 0;
|
||||||
req->share = FILE_SHARE_READ|FILE_SHARE_WRITE;
|
req->share = FILE_SHARE_READ|FILE_SHARE_WRITE;
|
||||||
req->fd = -1;
|
|
||||||
ret = !wine_server_call_err( req );
|
ret = !wine_server_call_err( req );
|
||||||
con_out = wine_server_ptr_handle( reply->handle_out );
|
con_out = wine_server_ptr_handle( reply->handle_out );
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,15 +569,13 @@ static struct object *create_console_input_events(void)
|
||||||
return &evt->obj;
|
return &evt->obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct object *create_console_input( int fd )
|
static struct object *create_console_input(void)
|
||||||
{
|
{
|
||||||
struct console_input *console_input;
|
struct console_input *console_input;
|
||||||
|
|
||||||
if (!(console_input = alloc_object( &console_input_ops )))
|
if (!(console_input = alloc_object( &console_input_ops )))
|
||||||
{
|
|
||||||
if (fd != -1) close( fd );
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
console_input->renderer = NULL;
|
console_input->renderer = NULL;
|
||||||
console_input->mode = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
|
console_input->mode = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
|
||||||
ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | ENABLE_INSERT_MODE |
|
ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | ENABLE_INSERT_MODE |
|
||||||
|
@ -606,21 +604,13 @@ static struct object *create_console_input( int fd )
|
||||||
|
|
||||||
if (!console_input->history || !console_input->event)
|
if (!console_input->history || !console_input->event)
|
||||||
{
|
{
|
||||||
if (fd != -1) close( fd );
|
|
||||||
console_input->history_size = 0;
|
console_input->history_size = 0;
|
||||||
release_object( console_input );
|
release_object( console_input );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (fd != -1) /* bare console */
|
|
||||||
{
|
|
||||||
console_input->fd = create_anonymous_fd( &console_input_fd_ops, fd, &console_input->obj,
|
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
console_input->fd = alloc_pseudo_fd( &console_input_fd_ops, &console_input->obj,
|
console_input->fd = alloc_pseudo_fd( &console_input_fd_ops, &console_input->obj,
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT );
|
FILE_SYNCHRONOUS_IO_NONALERT );
|
||||||
}
|
|
||||||
if (!console_input->fd)
|
if (!console_input->fd)
|
||||||
{
|
{
|
||||||
release_object( console_input );
|
release_object( console_input );
|
||||||
|
@ -730,7 +720,7 @@ static void set_active_screen_buffer( struct console_input *console_input, struc
|
||||||
console_input_events_append( console_input, &evt );
|
console_input_events_append( console_input, &evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct object *create_console_output( struct console_input *console_input, int fd )
|
static struct object *create_console_output( struct console_input *console_input )
|
||||||
{
|
{
|
||||||
struct screen_buffer *screen_buffer;
|
struct screen_buffer *screen_buffer;
|
||||||
int i;
|
int i;
|
||||||
|
@ -742,10 +732,8 @@ static struct object *create_console_output( struct console_input *console_input
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(screen_buffer = alloc_object( &screen_buffer_ops )))
|
if (!(screen_buffer = alloc_object( &screen_buffer_ops )))
|
||||||
{
|
|
||||||
if (fd != -1) close( fd );
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
screen_buffer->id = ++console_input->last_id;
|
screen_buffer->id = ++console_input->last_id;
|
||||||
screen_buffer->mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
|
screen_buffer->mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
|
||||||
screen_buffer->input = console_input;
|
screen_buffer->input = console_input;
|
||||||
|
@ -774,10 +762,6 @@ static struct object *create_console_output( struct console_input *console_input
|
||||||
init_async_queue( &screen_buffer->ioctl_q );
|
init_async_queue( &screen_buffer->ioctl_q );
|
||||||
list_add_head( &screen_buffer_list, &screen_buffer->entry );
|
list_add_head( &screen_buffer_list, &screen_buffer->entry );
|
||||||
|
|
||||||
if (fd != -1)
|
|
||||||
screen_buffer->fd = create_anonymous_fd( &screen_buffer_fd_ops, fd, &screen_buffer->obj,
|
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT );
|
|
||||||
else
|
|
||||||
screen_buffer->fd = alloc_pseudo_fd( &screen_buffer_fd_ops, &screen_buffer->obj,
|
screen_buffer->fd = alloc_pseudo_fd( &screen_buffer_fd_ops, &screen_buffer->obj,
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT );
|
FILE_SYNCHRONOUS_IO_NONALERT );
|
||||||
if (!screen_buffer->fd)
|
if (!screen_buffer->fd)
|
||||||
|
@ -1746,8 +1730,8 @@ static struct object *console_server_lookup_name( struct object *obj, struct uni
|
||||||
set_error( STATUS_INVALID_HANDLE );
|
set_error( STATUS_INVALID_HANDLE );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(server->console = (struct console_input *)create_console_input( -1 ))) return NULL;
|
if (!(server->console = (struct console_input *)create_console_input())) return NULL;
|
||||||
if (!(screen_buffer = (struct screen_buffer *)create_console_output( server->console, -1 )))
|
if (!(screen_buffer = (struct screen_buffer *)create_console_output( server->console )))
|
||||||
{
|
{
|
||||||
release_object( server->console );
|
release_object( server->console );
|
||||||
server->console = NULL;
|
server->console = NULL;
|
||||||
|
@ -2519,7 +2503,7 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name->len = 0;
|
name->len = 0;
|
||||||
return create_console_output( current->process->console, -1 );
|
return create_console_output( current->process->console );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name->len == sizeof(serverW) && !memcmp( name->str, serverW, name->len ))
|
if (name->len == sizeof(serverW) && !memcmp( name->str, serverW, name->len ))
|
||||||
|
@ -2566,52 +2550,29 @@ DECL_HANDLER(alloc_console)
|
||||||
{
|
{
|
||||||
struct process *process;
|
struct process *process;
|
||||||
struct console_input *console;
|
struct console_input *console;
|
||||||
int fd;
|
|
||||||
int attach = 0;
|
int attach = 0;
|
||||||
|
|
||||||
if (req->input_fd != -1)
|
|
||||||
{
|
|
||||||
if ((fd = thread_get_inflight_fd( current, req->input_fd )) == -1)
|
|
||||||
{
|
|
||||||
set_error( STATUS_INVALID_PARAMETER );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else fd = -1;
|
|
||||||
|
|
||||||
switch (req->pid)
|
switch (req->pid)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/* console to be attached to parent process */
|
/* console to be attached to parent process */
|
||||||
if (!(process = get_process_from_id( current->process->parent_id )))
|
if (!(process = get_process_from_id( current->process->parent_id )))
|
||||||
{
|
{
|
||||||
if (fd != -1) close( fd );
|
|
||||||
set_error( STATUS_ACCESS_DENIED );
|
set_error( STATUS_ACCESS_DENIED );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
attach = 1;
|
attach = 1;
|
||||||
break;
|
break;
|
||||||
case 0xffffffff:
|
|
||||||
/* console to be attached to current process */
|
|
||||||
process = current->process;
|
|
||||||
grab_object( process );
|
|
||||||
attach = 1;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
/* console to be attached to req->pid */
|
/* console to be attached to req->pid */
|
||||||
if (!(process = get_process_from_id( req->pid )))
|
if (!(process = get_process_from_id( req->pid ))) return;
|
||||||
{
|
|
||||||
if (fd != -1) close( fd );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attach && process->console)
|
if (attach && process->console)
|
||||||
{
|
{
|
||||||
if (fd != -1) close( fd );
|
|
||||||
set_error( STATUS_ACCESS_DENIED );
|
set_error( STATUS_ACCESS_DENIED );
|
||||||
}
|
}
|
||||||
else if ((console = (struct console_input*)create_console_input( fd )))
|
else if ((console = (struct console_input*)create_console_input()))
|
||||||
{
|
{
|
||||||
if ((reply->handle_in = alloc_handle( current->process, console, req->access,
|
if ((reply->handle_in = alloc_handle( current->process, console, req->access,
|
||||||
req->attributes )) && attach)
|
req->attributes )) && attach)
|
||||||
|
@ -2655,31 +2616,11 @@ DECL_HANDLER(create_console_output)
|
||||||
{
|
{
|
||||||
struct console_input *console;
|
struct console_input *console;
|
||||||
struct object *screen_buffer;
|
struct object *screen_buffer;
|
||||||
int fd;
|
|
||||||
|
|
||||||
if (req->fd != -1)
|
|
||||||
{
|
|
||||||
if ((fd = thread_get_inflight_fd( current, req->fd )) == -1)
|
|
||||||
{
|
|
||||||
set_error( STATUS_INVALID_HANDLE );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else fd = -1;
|
|
||||||
if (!(console = console_input_get( req->handle_in, FILE_WRITE_PROPERTIES )))
|
if (!(console = console_input_get( req->handle_in, FILE_WRITE_PROPERTIES )))
|
||||||
{
|
|
||||||
if (fd != -1) close( fd );
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (console_input_is_bare( console ) ^ (fd != -1))
|
|
||||||
{
|
|
||||||
if (fd != -1) close( fd );
|
|
||||||
release_object( console );
|
|
||||||
set_error( STATUS_INVALID_HANDLE );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen_buffer = create_console_output( console, fd );
|
screen_buffer = create_console_output( console );
|
||||||
if (screen_buffer)
|
if (screen_buffer)
|
||||||
{
|
{
|
||||||
/* FIXME: should store sharing and test it when opening the CONOUT$ device
|
/* FIXME: should store sharing and test it when opening the CONOUT$ device
|
||||||
|
|
|
@ -1450,7 +1450,6 @@ enum server_fd_type
|
||||||
unsigned int access; /* wanted access rights */
|
unsigned int access; /* wanted access rights */
|
||||||
unsigned int attributes; /* object attributes */
|
unsigned int attributes; /* object attributes */
|
||||||
process_id_t pid; /* pid of process which shall be attached to the console */
|
process_id_t pid; /* pid of process which shall be attached to the console */
|
||||||
int input_fd; /* if pid=-1 (bare console to current process), fd for input */
|
|
||||||
@REPLY
|
@REPLY
|
||||||
obj_handle_t handle_in; /* handle to console input */
|
obj_handle_t handle_in; /* handle to console input */
|
||||||
@END
|
@END
|
||||||
|
@ -1492,7 +1491,6 @@ enum server_fd_type
|
||||||
unsigned int access; /* wanted access rights */
|
unsigned int access; /* wanted access rights */
|
||||||
unsigned int attributes; /* object attributes */
|
unsigned int attributes; /* object attributes */
|
||||||
unsigned int share; /* sharing credentials */
|
unsigned int share; /* sharing credentials */
|
||||||
int fd; /* for bare consoles, fd the screen-buffer is attached to */
|
|
||||||
@REPLY
|
@REPLY
|
||||||
obj_handle_t handle_out; /* handle to the screen buffer */
|
obj_handle_t handle_out; /* handle to the screen buffer */
|
||||||
@END
|
@END
|
||||||
|
|
|
@ -1091,8 +1091,7 @@ C_ASSERT( sizeof(struct set_socket_deferred_request) == 24 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, access) == 12 );
|
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, access) == 12 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, attributes) == 16 );
|
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, attributes) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, pid) == 20 );
|
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, pid) == 20 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct alloc_console_request, input_fd) == 24 );
|
C_ASSERT( sizeof(struct alloc_console_request) == 24 );
|
||||||
C_ASSERT( sizeof(struct alloc_console_request) == 32 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct alloc_console_reply, handle_in) == 8 );
|
C_ASSERT( FIELD_OFFSET(struct alloc_console_reply, handle_in) == 8 );
|
||||||
C_ASSERT( sizeof(struct alloc_console_reply) == 16 );
|
C_ASSERT( sizeof(struct alloc_console_reply) == 16 );
|
||||||
C_ASSERT( sizeof(struct free_console_request) == 16 );
|
C_ASSERT( sizeof(struct free_console_request) == 16 );
|
||||||
|
@ -1111,7 +1110,6 @@ C_ASSERT( FIELD_OFFSET(struct create_console_output_request, handle_in) == 12 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, access) == 16 );
|
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, access) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, attributes) == 20 );
|
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, attributes) == 20 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, share) == 24 );
|
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, share) == 24 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_console_output_request, fd) == 28 );
|
|
||||||
C_ASSERT( sizeof(struct create_console_output_request) == 32 );
|
C_ASSERT( sizeof(struct create_console_output_request) == 32 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_console_output_reply, handle_out) == 8 );
|
C_ASSERT( FIELD_OFFSET(struct create_console_output_reply, handle_out) == 8 );
|
||||||
C_ASSERT( sizeof(struct create_console_output_reply) == 16 );
|
C_ASSERT( sizeof(struct create_console_output_reply) == 16 );
|
||||||
|
|
|
@ -2020,7 +2020,6 @@ static void dump_alloc_console_request( const struct alloc_console_request *req
|
||||||
fprintf( stderr, " access=%08x", req->access );
|
fprintf( stderr, " access=%08x", req->access );
|
||||||
fprintf( stderr, ", attributes=%08x", req->attributes );
|
fprintf( stderr, ", attributes=%08x", req->attributes );
|
||||||
fprintf( stderr, ", pid=%04x", req->pid );
|
fprintf( stderr, ", pid=%04x", req->pid );
|
||||||
fprintf( stderr, ", input_fd=%d", req->input_fd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_alloc_console_reply( const struct alloc_console_reply *req )
|
static void dump_alloc_console_reply( const struct alloc_console_reply *req )
|
||||||
|
@ -2066,7 +2065,6 @@ static void dump_create_console_output_request( const struct create_console_outp
|
||||||
fprintf( stderr, ", access=%08x", req->access );
|
fprintf( stderr, ", access=%08x", req->access );
|
||||||
fprintf( stderr, ", attributes=%08x", req->attributes );
|
fprintf( stderr, ", attributes=%08x", req->attributes );
|
||||||
fprintf( stderr, ", share=%08x", req->share );
|
fprintf( stderr, ", share=%08x", req->share );
|
||||||
fprintf( stderr, ", fd=%d", req->fd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_create_console_output_reply( const struct create_console_output_reply *req )
|
static void dump_create_console_output_reply( const struct create_console_output_reply *req )
|
||||||
|
|
Loading…
Reference in New Issue