From c2e319ed20d3e0e5b263960edff237702896e1f8 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 13 Oct 2020 16:29:47 +0200 Subject: [PATCH] server: Remove no longer needed server-side console input ioctls. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- server/console.c | 275 ----------------------------------------------- 1 file changed, 275 deletions(-) diff --git a/server/console.c b/server/console.c index d602afec1f2..be730b5a60c 100644 --- a/server/console.c +++ b/server/console.c @@ -888,105 +888,6 @@ static void propagate_console_signal( struct console_input *console, enum_processes(propagate_console_signal_cb, &csi); } -/* retrieve a pointer to the console input records */ -static int read_console_input( struct console_input *console, struct async *async, int flush ) -{ - struct iosb *iosb = async_get_iosb( async ); - data_size_t count; - - count = min( iosb->out_size / sizeof(INPUT_RECORD), console->recnum ); - if (count) - { - if (!(iosb->out_data = malloc( count * sizeof(INPUT_RECORD) ))) - { - set_error( STATUS_NO_MEMORY ); - release_object( iosb ); - return 0; - } - iosb->out_size = iosb->result = count * sizeof(INPUT_RECORD); - memcpy( iosb->out_data, console->records, iosb->result ); - iosb->status = STATUS_SUCCESS; - async_terminate( async, STATUS_ALERTED ); - } - else - { - async_terminate( async, STATUS_SUCCESS ); - } - - release_object( iosb ); - - if (flush && count) - { - if (console->recnum > count) - { - INPUT_RECORD *new_rec; - memmove( console->records, console->records + count, (console->recnum - count) * sizeof(*console->records) ); - console->recnum -= count; - new_rec = realloc( console->records, console->recnum * sizeof(*console->records) ); - if (new_rec) console->records = new_rec; - } - else - { - console->recnum = 0; - free( console->records ); - console->records = NULL; - reset_event( console->event ); - } - } - - return 1; -} - -/* add input events to a console input queue */ -static int write_console_input( struct console_input* console, int count, - const INPUT_RECORD *records ) -{ - INPUT_RECORD *new_rec; - struct async *async; - - if (!count) return 1; - if (!(new_rec = realloc( console->records, - (console->recnum + count) * sizeof(INPUT_RECORD) ))) - { - set_error( STATUS_NO_MEMORY ); - return 0; - } - console->records = new_rec; - memcpy( new_rec + console->recnum, records, count * sizeof(INPUT_RECORD) ); - - if (console->mode & ENABLE_PROCESSED_INPUT) - { - int i = 0; - while (i < count) - { - if (records[i].EventType == KEY_EVENT && - records[i].Event.KeyEvent.uChar.UnicodeChar == 'C' - 64 && - !(records[i].Event.KeyEvent.dwControlKeyState & ENHANCED_KEY)) - { - if (i != count - 1) - memcpy( &console->records[console->recnum + i], - &console->records[console->recnum + i + 1], - (count - i - 1) * sizeof(INPUT_RECORD) ); - count--; - if (records[i].Event.KeyEvent.bKeyDown) - { - /* send SIGINT to all processes attached to this console */ - propagate_console_signal( console, CTRL_C_EVENT, 0 ); - } - } - else i++; - } - } - console->recnum += count; - while (console->recnum && (async = find_pending_async( &console->read_q ))) - { - read_console_input( console, async, 1 ); - release_object( async ); - } - if (console->recnum) set_event( console->event ); - return 1; -} - /* dumb dump */ static void console_input_dump( struct object *obj, int verbose ) { @@ -1219,182 +1120,6 @@ static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async * switch (code) { - case IOCTL_CONDRV_GET_MODE: - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (get_reply_max_size() != sizeof(console->mode)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - return set_reply_data( &console->mode, sizeof(console->mode) ) != NULL; - - case IOCTL_CONDRV_SET_MODE: - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (get_req_data_size() != sizeof(console->mode)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - console->mode = *(unsigned int *)get_req_data(); - return 1; - - case IOCTL_CONDRV_READ_INPUT: - { - int blocking = 0; - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (get_reply_max_size() % sizeof(INPUT_RECORD)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - if (get_req_data_size()) - { - if (get_req_data_size() != sizeof(int)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - blocking = *(int *)get_req_data(); - } - set_error( STATUS_PENDING ); - if (blocking && !console->recnum) - { - queue_async( &console->read_q, async ); - return 1; - } - return read_console_input( console, async, 1 ); - } - - case IOCTL_CONDRV_WRITE_INPUT: - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - return write_console_input( console, get_req_data_size() / sizeof(INPUT_RECORD), get_req_data() ); - - case IOCTL_CONDRV_PEEK: - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (get_reply_max_size() % sizeof(INPUT_RECORD)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - set_error( STATUS_PENDING ); - return read_console_input( console, async, 0 ); - - case IOCTL_CONDRV_GET_INPUT_INFO: - { - struct condrv_input_info info; - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (get_reply_max_size() != sizeof(info)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - info.input_cp = console->input_cp; - info.output_cp = console->output_cp; - info.history_mode = console->history_mode; - info.history_size = console->history_size; - info.history_index = console->history_index; - info.edition_mode = console->edition_mode; - info.input_count = console->recnum; - info.win = console->win; - return set_reply_data( &info, sizeof(info) ) != NULL; - } - - case IOCTL_CONDRV_SET_INPUT_INFO: - { - const struct condrv_input_info_params *params = get_req_data(); - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (get_req_data_size() != sizeof(*params)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - if (params->mask & SET_CONSOLE_INPUT_INFO_HISTORY_MODE) - { - console->history_mode = params->info.history_mode; - } - if ((params->mask & SET_CONSOLE_INPUT_INFO_HISTORY_SIZE) && - console->history_size != params->info.history_size) - { - struct history_line **mem = NULL; - int i, delta; - - if (params->info.history_size) - { - if (!(mem = mem_alloc( params->info.history_size * sizeof(*mem) ))) return 0; - memset( mem, 0, params->info.history_size * sizeof(*mem) ); - } - - delta = (console->history_index > params->info.history_size) ? - (console->history_index - params->info.history_size) : 0; - - for (i = delta; i < console->history_index; i++) - { - mem[i - delta] = console->history[i]; - console->history[i] = NULL; - } - console->history_index -= delta; - - for (i = 0; i < console->history_size; i++) - free( console->history[i] ); - free( console->history ); - console->history = mem; - console->history_size = params->info.history_size; - } - if (params->mask & SET_CONSOLE_INPUT_INFO_EDITION_MODE) - { - console->edition_mode = params->info.edition_mode; - } - if (params->mask & SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE) - { - console->input_cp = params->info.input_cp; - } - if (params->mask & SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE) - { - console->output_cp = params->info.output_cp; - } - if (params->mask & SET_CONSOLE_INPUT_INFO_WIN) - { - console->win = params->info.win; - } - return 1; - } - - case IOCTL_CONDRV_GET_TITLE: - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (!console->title_len) return 1; - return set_reply_data( console->title, min( console->title_len, get_reply_max_size() )) != NULL; - - case IOCTL_CONDRV_SET_TITLE: - { - data_size_t len = get_req_data_size(); - struct condrv_renderer_event evt; - WCHAR *title = NULL; - - if (console->server) - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); - if (len % sizeof(WCHAR)) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - - if (len && !(title = memdup( get_req_data(), len ))) return 0; - free( console->title ); - console->title = title; - console->title_len = len; - evt.event = CONSOLE_RENDERER_TITLE_EVENT; - console_input_events_append( console, &evt ); - return 1; - } - case IOCTL_CONDRV_CTRL_EVENT: { const struct condrv_ctrl_event *event = get_req_data();