http://bugs.winehq.org/show_bug.cgi?id=10907
Summary: getch() function does not get arrows, home, end, ins etc. Product: Wine Version: 0.9.51. Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: wine-dos AssignedTo: wine-bugs@winehq.org ReportedBy: mail2benny@gmail.com
Created an attachment (id=9820) --> (http://bugs.winehq.org/attachment.cgi?id=9820) The program which exploits the bug
The getch() function does not get arrows, home, end, ins etc. in wine console. I've written a program which exploits the bug, run it on wine console and on Win Vista or some other Win versions (not tested) and press some arrows or home or something. You'll get the picture. I hope :)
The program is compiled in Dev-C++ 4.9.9.2 It uses conio.h and libconio.a (which will be uploaded in a zip) Source will be uploaded too, although its fairly small
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #1 from Benny mail2benny@gmail.com 2007-12-27 08:09:51 --- Created an attachment (id=9821) --> (http://bugs.winehq.org/attachment.cgi?id=9821) The Source of the "getch" program.
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #2 from Benny mail2benny@gmail.com 2007-12-27 08:12:11 --- Created an attachment (id=9823) --> (http://bugs.winehq.org/attachment.cgi?id=9823) conio.h and libconio.a
These are necessary to compile the source in Dev-C++ 4.9.9.2
http://bugs.winehq.org/show_bug.cgi?id=10907
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |download, source
--- Comment #3 from Austin English austinenglish@gmail.com 2007-12-27 09:33:32 --- Confirming in wine 0.9.51, ubuntu feisty.
http://bugs.winehq.org/show_bug.cgi?id=10907
Benny mail2benny@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|wine-dos |wine-console
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #4 from Vijay Kamuju infyquest@gmail.com 2007-12-31 16:03:26 --- http://msdn2.microsoft.com/en-us/library/Aa297934.aspx I think you need to press twice. check the above link. Its some internal problem, handling the input some debuging is requirred
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #5 from Benny mail2benny@gmail.com 2007-12-31 22:00:12 --- Pressing any button twice does not solve the problem. . . nothing happens (wine). The bug does not occur in windows even if you press the button once. Therefore I think this is another problem. (Not completely sure though, at this moment)
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #6 from Dmitry Timoshkov dmitry@codeweavers.com 2008-01-01 03:24:18 --- (In reply to comment #4)
http://msdn2.microsoft.com/en-us/library/Aa297934.aspx I think you need to press twice. check the above link. Its some internal problem, handling the input some debuging is requirred
Please make slightly a bit more effort to investigate the situation before adding useless comments.
http://bugs.winehq.org/show_bug.cgi?id=10907
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|_obsolete_console |-unknown
http://bugs.winehq.org/show_bug.cgi?id=10907
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |msvcrt
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;
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #8 from Benny mail2benny@gmail.com 2008-02-18 15:22:03 --- Shouldn't we work with VK's instead off AsciiChars?
http://bugs.winehq.org/show_bug.cgi?id=10907
Eric Pouech eric.pouech@orange.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@orange.fr
--- Comment #9 from Eric Pouech eric.pouech@orange.fr 2008-05-30 04:04:51 --- some fixes have been committed to git tree please retest
http://bugs.winehq.org/show_bug.cgi?id=10907
Benny mail2benny@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mail2benny@gmail.com
--- Comment #10 from Benny mail2benny@gmail.com 2008-05-31 19:20:32 --- Tested the fixes in WINE-1.0-RC3 "msvcrt: Properly handle the extended keys in getch()." It seems only the arrow-down is supported now. I created a program to test with source. Will be uploaded after this.
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #11 from Benny mail2benny@gmail.com 2008-05-31 19:22:29 --- Created an attachment (id=13543) --> (http://bugs.winehq.org/attachment.cgi?id=13543) Executable showing what special key is pressed, if supported.
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #12 from Benny mail2benny@gmail.com 2008-05-31 19:24:00 --- Created an attachment (id=13544) --> (http://bugs.winehq.org/attachment.cgi?id=13544) Source of executable showing what special key is pressed, if supported.
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #13 from Benny mail2benny@gmail.com 2008-06-01 14:18:46 --- Could, this be a keyboard layout problem?
http://bugs.winehq.org/show_bug.cgi?id=10907
--- Comment #14 from Eric Pouech eric.pouech@orange.fr 2008-06-01 15:05:30 --- I sent an update to the committed version (likely I sent the wrong version for inclusion)
http://bugs.winehq.org/show_bug.cgi?id=10907
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, testcase
http://bugs.winehq.org/show_bug.cgi?id=10907
Benny mail2benny@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #15 from Benny mail2benny@gmail.com 2008-06-06 11:35:49 --- Arrows and Insert, Home, Page-UP, Page-Down, End, Delete. Work in Wine-1.0-rc4! I don't know if other keys should be supported or not, don't have a windows around at the moment... However, I think it is fixed, thanks! If keys need to be added consider re-opening.
http://bugs.winehq.org/show_bug.cgi?id=10907
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #16 from Dmitry Timoshkov dmitry@codeweavers.com 2008-06-06 21:57:50 --- Closing.