[PATCH 4/5] [kernel] Support opening of console for read (try 2)
Alexandre Julliard
julliard at winehq.org
Tue Nov 20 04:59:52 CST 2012
Ann and Jason Edmeades <jason at edmeades.me.uk> writes:
> +BOOL WINAPI write_console_input( HANDLE handle, const INPUT_RECORD *buffer,
> + DWORD count, LPDWORD written )
> +{
> + BOOL result = WriteConsoleInputW(handle, buffer, count, written);
> +
> + /* If this fails with access denied */
> + if (!result && GetLastError() == ERROR_ACCESS_DENIED)
> + {
> + HANDLE hConRW = CreateFileW(coninW, GENERIC_READ | GENERIC_WRITE,
> + FILE_SHARE_READ, NULL, OPEN_EXISTING,
> + FILE_ATTRIBUTE_NORMAL, 0);
> + if (hConRW != INVALID_HANDLE_VALUE)
> + {
> + result = WriteConsoleInputW(hConRW, buffer, count, written);
> + CloseHandle(hConRW);
> + }
That doesn't look right. There's no guarantee that the handle is for the
current process console.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list