Re: X11DRV: GetKeyNameTextW returns a wrong length
I don't think "lpBuffer[nSize - 1] = 0;" is safe to remove. If nSize is too small, the resulting string may not be NULL-terminated. Patch-sending guidelines are at http://www.winehq.org/site/sending_patches. Your patch is more likely to be committed if you write a conformance test (although it may be enough in this case to send a patch that obviously works, since this is documented behavior). The appropriate place for that in the wine source is probably dlls/user32/tests. See http://www.winehq.org/site/docs/winedev-guide/testing for guidelines on conformance tests. Vincent Povirk On Thu, Nov 27, 2008 at 3:42 PM, Nils Hoyer <Privat(a)nils-hoyer.de> wrote:
http://bugs.winehq.org/show_bug.cgi?id=16195#c0
This is my first sending of a Wine patch - and first usage of a patch at all. I'm sorry, if I made any mistake...
GetKeyNameTextW results a 1 instead of a the lengh of the Text. This patch fixes this bug.
--- keyboard.old 2008-11-27 16:53:15.000000000 +0100 +++ keyboard.c 2008-11-26 21:19:01.000000000 +0100 @@ -2328,11 +2328,7 @@ TRACE("found scan=%04x keyc=%04x keysym=%04x string=%s\n", scanCode, keyc, (int)keys, name); if (lpBuffer && nSize && name) - { - MultiByteToWideChar(CP_UNIXCP, 0, name, -1, lpBuffer, nSize); - lpBuffer[nSize - 1] = 0; - return 1; - } + return MultiByteToWideChar(CP_UNIXCP, 0, name, -1, lpBuffer, nSize) - 1; }
/* Finally issue WARN for unknown keys */
Vincent Povirk wrote:
--- keyboard.old 2008-11-27 16:53:15.000000000 +0100 +++ keyboard.c 2008-11-26 21:19:01.000000000 +0100
All patches have to be generated from the top of the source tree (if you not using git). This patch is invalid. Vitaliy
participants (2)
-
Vincent Povirk -
Vitaliy Margolen