http://bugs.winehq.org/show_bug.cgi?id=10907
Evgeniy Dushistov dushistov@mail.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dushistov@mail.ru
--- Comment #7 from Evgeniy Dushistov dushistov@mail.ru 2008-02-13 07:49:19 --- Patch below demonstrate the problem, which according to my opinion in testing: ir.Event.KeyEvent.uChar.AsciiChar != 0 _getch return value only if ir.Event.KeyEvent.uChar.AsciiChar not zero, which is wrong in case of "F1-F12", arrow keys and so on.
In "Window" looks like the retvalue in case of not character is wVirtualScanCode.
The only thing, not clear to me, is how to return the first of all "0" and only after that wVirtualScanCode.
PS kbhit looks like has the similar problem.
Index: wine-0.9.55/dlls/msvcrt/console.c =================================================================== --- wine-0.9.55.orig/dlls/msvcrt/console.c +++ wine-0.9.55/dlls/msvcrt/console.c @@ -105,12 +105,18 @@ int CDECL _getch(void) { /* Only interested in ASCII chars */ if (ir.EventType == KEY_EVENT && - ir.Event.KeyEvent.bKeyDown && - ir.Event.KeyEvent.uChar.AsciiChar) - { - retval = ir.Event.KeyEvent.uChar.AsciiChar; - break; - } + ir.Event.KeyEvent.bKeyDown) { + if (ir.Event.KeyEvent.uChar.AsciiChar) { + retval = ir.Event.KeyEvent.uChar.AsciiChar; + break; + } else { + retval = ir.Event.KeyEvent.wVirtualScanCode; + printf("KeyCode: %llu, ScanCode %llu\n", + (unsigned long long)ir.Event.KeyEvent.wVirtualKeyCode, + (unsigned long long)ir.Event.KeyEvent.wVirtualScanCode); + break; + } + } } else break;