Commit 640773aa authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

kernelbase: Use ioctl for WriteConsoleInputW implementation.

parent d04baa29
...@@ -1501,9 +1501,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputA( HANDLE handle, const INPUT_REC ...@@ -1501,9 +1501,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputA( HANDLE handle, const INPUT_REC
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW( HANDLE handle, const INPUT_RECORD *buffer, BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW( HANDLE handle, const INPUT_RECORD *buffer,
DWORD count, DWORD *written ) DWORD count, DWORD *written )
{ {
DWORD events_written = 0;
BOOL ret;
TRACE( "(%p,%p,%d,%p)\n", handle, buffer, count, written ); TRACE( "(%p,%p,%d,%p)\n", handle, buffer, count, written );
if (count > 0 && !buffer) if (count > 0 && !buffer)
...@@ -1511,21 +1508,17 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW( HANDLE handle, const INPUT_REC ...@@ -1511,21 +1508,17 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleInputW( HANDLE handle, const INPUT_REC
SetLastError( ERROR_INVALID_ACCESS ); SetLastError( ERROR_INVALID_ACCESS );
return FALSE; return FALSE;
} }
SERVER_START_REQ( write_console_input )
{
req->handle = console_handle_unmap( handle );
wine_server_add_data( req, buffer, count * sizeof(INPUT_RECORD) );
if ((ret = !wine_server_call_err( req ))) events_written = reply->written;
}
SERVER_END_REQ;
if (written) *written = events_written; if (!DeviceIoControl( handle, IOCTL_CONDRV_WRITE_INPUT, (void *)buffer, count * sizeof(*buffer), NULL, 0, NULL, NULL ))
else return FALSE;
if (!written)
{ {
SetLastError( ERROR_INVALID_ACCESS ); SetLastError( ERROR_INVALID_ACCESS );
ret = FALSE; return FALSE;
} }
return ret; *written = count;
return TRUE;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
/* console input ioctls */ /* console input ioctls */
#define IOCTL_CONDRV_READ_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 10, METHOD_BUFFERED, FILE_READ_ACCESS) #define IOCTL_CONDRV_READ_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_CONDRV_WRITE_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 11, METHOD_BUFFERED, FILE_WRITE_PROPERTIES)
#define IOCTL_CONDRV_PEEK CTL_CODE(FILE_DEVICE_CONSOLE, 12, METHOD_BUFFERED, FILE_READ_ACCESS) #define IOCTL_CONDRV_PEEK CTL_CODE(FILE_DEVICE_CONSOLE, 12, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_CONDRV_GET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_BUFFERED, FILE_READ_PROPERTIES) #define IOCTL_CONDRV_GET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_BUFFERED, FILE_READ_PROPERTIES)
......
...@@ -1537,6 +1537,9 @@ static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ...@@ -1537,6 +1537,9 @@ static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async
return read_console_input( console, async, 1 ); return read_console_input( console, async, 1 );
} }
case IOCTL_CONDRV_WRITE_INPUT:
return write_console_input( console, get_req_data_size() / sizeof(INPUT_RECORD), get_req_data() ) != -1;
case IOCTL_CONDRV_PEEK: case IOCTL_CONDRV_PEEK:
if (get_reply_max_size() % sizeof(INPUT_RECORD)) if (get_reply_max_size() % sizeof(INPUT_RECORD))
{ {
......
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