[PATCH] console: fix output for console handles opened with GENERIC_WRITE access

Martin Wilck Martin.Wilck at particle-dynamics.de
Thu Nov 11 19:21:40 CST 2010


Writing to a console handle obtained with a requested access mode
GENERIC_WRITE
produces no output. This happens because get_console_mode() requires
FILE_READ_PROPERTIES access on the handle, which a handle created with
GENERIC_WRITE doesn't have.

This affects many Microsoft console applications, e.g. nmake and cl from
VC++
express 2005.

It can be tested with the following minimal test program (compiled with
VC 2005 & run with native mscvr80):

int main(void)
{
        _cprintf("Hi.\n");
        return 0;
}

This behaves as follows:

trace:console:OpenConsoleW (L"CONOUT$", 0x40000000, 0, 3)
0009: open_console( from=0001, access=40000000, attributes=00000000,
share=3 )
0009: open_console() = 0 { handle=0028 }
trace:console:WriteConsoleW 0x2b L"H" 1 0x33fb78 (nil)
0009: get_console_mode( handle=0028 )
0009: get_console_mode() = ACCESS_DENIED { mode=0, is_bare=0 }

Because of the ACCESS_DENIED, this program produces no output on current
wine.
This patch fixies this with a new map_access() function for the console.

Signed-off-by: Martin Wilck <martin.wilck at particle-dynamics.de>
---
 server/console.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-console-fix-output-for-console-handles-opened-with-G.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20101112/3400676e/attachment.bin>


More information about the wine-patches mailing list