kernelbase: Move Unicode conversion from WriteConsoleA to conhost.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
073b6dc240
commit
4cc4ea449b
|
@ -1634,17 +1634,12 @@ BOOL WINAPI ReadConsoleW( HANDLE handle, void *buffer, DWORD length, DWORD *coun
|
|||
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA( HANDLE handle, const void *buffer, DWORD length,
|
||||
DWORD *written, void *reserved )
|
||||
{
|
||||
UINT cp = GetConsoleOutputCP();
|
||||
LPWSTR strW;
|
||||
DWORD lenW;
|
||||
BOOL ret;
|
||||
|
||||
if (written) *written = 0;
|
||||
lenW = MultiByteToWideChar( cp, 0, buffer, length, NULL, 0 );
|
||||
if (!(strW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) ))) return FALSE;
|
||||
MultiByteToWideChar( cp, 0, buffer, length, strW, lenW );
|
||||
ret = WriteConsoleW( handle, strW, lenW, written, 0 );
|
||||
HeapFree( GetProcessHeap(), 0, strW );
|
||||
TRACE( "(%p,%s,%d,%p,%p)\n", handle, debugstr_an(buffer, length), length, written, reserved );
|
||||
|
||||
ret = console_ioctl( handle, IOCTL_CONDRV_WRITE_FILE, (void *)buffer, length, NULL, 0, NULL );
|
||||
if (written) *written = ret ? length : 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,13 +43,14 @@
|
|||
|
||||
/* console output ioctls */
|
||||
#define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_WRITE_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
#define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||||
|
||||
/* console connection ioctls */
|
||||
#define IOCTL_CONDRV_BIND_PID CTL_CODE(FILE_DEVICE_CONSOLE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
|
|
@ -2292,6 +2292,22 @@ static NTSTATUS screen_buffer_ioctl( struct screen_buffer *screen_buffer, unsign
|
|||
if (in_size % sizeof(WCHAR) || *out_size) return STATUS_INVALID_PARAMETER;
|
||||
return write_console( screen_buffer, in_data, in_size / sizeof(WCHAR) );
|
||||
|
||||
case IOCTL_CONDRV_WRITE_FILE:
|
||||
{
|
||||
unsigned int len;
|
||||
WCHAR *buf;
|
||||
NTSTATUS status;
|
||||
|
||||
len = MultiByteToWideChar( screen_buffer->console->output_cp, 0, in_data, in_size,
|
||||
NULL, 0 );
|
||||
if (!len) return STATUS_SUCCESS;
|
||||
if (!(buf = malloc( len * sizeof(WCHAR) ))) return STATUS_NO_MEMORY;
|
||||
MultiByteToWideChar( screen_buffer->console->output_cp, 0, in_data, in_size, buf, len );
|
||||
status = write_console( screen_buffer, buf, len );
|
||||
free( buf );
|
||||
return status;
|
||||
}
|
||||
|
||||
case IOCTL_CONDRV_WRITE_OUTPUT:
|
||||
if ((*out_size != sizeof(DWORD) && *out_size != sizeof(SMALL_RECT)) ||
|
||||
in_size < sizeof(struct condrv_output_params))
|
||||
|
|
Loading…
Reference in New Issue