Commit 10aaff92 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

conhost: Fix ctrl-c handling.

parent cb33d402
...@@ -1502,22 +1502,16 @@ NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *recor ...@@ -1502,22 +1502,16 @@ NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *recor
console->records = new_rec; console->records = new_rec;
console->record_size = console->record_size * 2 + count; console->record_size = console->record_size * 2 + count;
} }
memcpy( console->records + console->record_count, records, count * sizeof(INPUT_RECORD) );
if (console->mode & ENABLE_PROCESSED_INPUT) if (console->mode & ENABLE_PROCESSED_INPUT)
{ {
unsigned int i = 0; unsigned int i;
while (i < count) for (i = 0; i < count; i++)
{ {
unsigned int event; unsigned int event;
if (map_to_ctrlevent(console, &records[i], &event)) if (map_to_ctrlevent( console, &records[i], &event ))
{ {
if (i != count - 1)
memcpy( &console->records[console->record_count + i],
&console->records[console->record_count + i + 1],
(count - i - 1) * sizeof(INPUT_RECORD) );
count--;
if (records[i].Event.KeyEvent.bKeyDown) if (records[i].Event.KeyEvent.bKeyDown)
{ {
struct condrv_ctrl_event ctrl_event; struct condrv_ctrl_event ctrl_event;
...@@ -1527,13 +1521,17 @@ NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *recor ...@@ -1527,13 +1521,17 @@ NTSTATUS write_console_input( struct console *console, const INPUT_RECORD *recor
ctrl_event.group_id = 0; ctrl_event.group_id = 0;
NtDeviceIoControlFile( console->server, NULL, NULL, NULL, &io, IOCTL_CONDRV_CTRL_EVENT, NtDeviceIoControlFile( console->server, NULL, NULL, NULL, &io, IOCTL_CONDRV_CTRL_EVENT,
&ctrl_event, sizeof(ctrl_event), NULL, 0 ); &ctrl_event, sizeof(ctrl_event), NULL, 0 );
} }
} }
else i++; else
console->records[console->record_count++] = records[i];
} }
} }
else
{
memcpy( console->records + console->record_count, records, count * sizeof(INPUT_RECORD) );
console->record_count += count; console->record_count += count;
}
return flush ? process_console_input( console ) : STATUS_SUCCESS; return flush ? process_console_input( console ) : STATUS_SUCCESS;
} }
...@@ -1768,6 +1766,11 @@ static DWORD WINAPI tty_input( void *param ) ...@@ -1768,6 +1766,11 @@ static DWORD WINAPI tty_input( void *param )
switch (ch) switch (ch)
{ {
case 3: /* end of text */ case 3: /* end of text */
if (console->is_unix && (console->mode & ENABLE_PROCESSED_INPUT))
{
key_press( console, ch, 'C', LEFT_CTRL_PRESSED );
break;
}
LeaveCriticalSection( &console_section ); LeaveCriticalSection( &console_section );
goto done; goto done;
case '\n': case '\n':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment