kernel32: Use IOCTL_CONDRV_WRITE_CONSOLE in WriteConsoleW when possible.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-09-11 14:31:07 +02:00 committed by Alexandre Julliard
parent 5ced4a705a
commit ab6056d677
3 changed files with 15 additions and 2 deletions

View File

@ -794,6 +794,13 @@ BOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput, LPCVOID lpBuffer, DWORD nNumber
if (lpNumberOfCharsWritten) *lpNumberOfCharsWritten = 0;
if (DeviceIoControl(hConsoleOutput, IOCTL_CONDRV_WRITE_CONSOLE, (void *)lpBuffer,
nNumberOfCharsToWrite * sizeof(WCHAR), NULL, 0, NULL, NULL))
{
if (lpNumberOfCharsWritten) *lpNumberOfCharsWritten = nNumberOfCharsToWrite;
return TRUE;
}
if ((fd = get_console_bare_fd(hConsoleOutput)) != -1)
{
char* ptr;

View File

@ -2106,8 +2106,13 @@ static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *
}
default:
set_error( STATUS_INVALID_HANDLE );
return 0;
if (!screen_buffer->input || !screen_buffer->input->server || code >> 16 != FILE_DEVICE_CONSOLE)
{
set_error( STATUS_INVALID_HANDLE );
return 0;
}
return queue_host_ioctl( screen_buffer->input->server, code, screen_buffer->id,
async, &screen_buffer->ioctl_q );
}
}

View File

@ -128,6 +128,7 @@ static void dump_ioctl_code( const char *prefix, const ioctl_code_t *code )
CASE(IOCTL_CONDRV_READ_OUTPUT);
CASE(IOCTL_CONDRV_SET_MODE);
CASE(IOCTL_CONDRV_SET_OUTPUT_INFO);
CASE(IOCTL_CONDRV_WRITE_CONSOLE);
CASE(IOCTL_CONDRV_WRITE_INPUT);
CASE(IOCTL_CONDRV_WRITE_OUTPUT);
CASE(FSCTL_DISMOUNT_VOLUME);