kernel32: Fix writing to a pipe in WriteConsoleW().

Francois Gouget fgouget at
Thu Sep 1 09:22:17 CDT 2011

On Wed, 24 Aug 2011, Eric Pouech wrote:
> you can safely provide the patches with protecting WriteConsole and friends
> with a if (!is_console_handle(???)) return FALSE; line

Would something like the attached patch be ok?
As far as I can see all the other APIs pretty much immediately pass the 
handle to wineserver which I expect will complain if it's not a console 

Further notes:
 * Performing the 'console handle check' locally would likely be faster 
   but, except for WriteConsole maybe, this should usually be the case 
   and is probably not performance critical anyway.
 * There are a few cases where we check for invalid parameters and 
   return an error before the handle is checked by wineserver. It's 
   possible that in such cases Windows checks the handle first. But 
   unless we know of applications that need the right error code in 
   these corner cases it does not justify adding an explicit check.

Francois Gouget <fgouget at>    
    I haven't lost my mind, it's backed up on tape around here somewhere...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: console.diff
Type: text/x-diff
Size: 2252 bytes
Desc: console.diff
URL: <>

More information about the wine-devel mailing list