kernel32: ReadConsoleW should wait for at least one character before returning.
This commit is contained in:
parent
979a43e49d
commit
c9700896fe
|
@ -1359,17 +1359,20 @@ BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer,
|
||||||
/* FIXME: should we read at least 1 char? The SDK does not say */
|
/* FIXME: should we read at least 1 char? The SDK does not say */
|
||||||
/* wait for at least one available input record (it doesn't mean we'll have
|
/* wait for at least one available input record (it doesn't mean we'll have
|
||||||
* chars stored in xbuf...)
|
* chars stored in xbuf...)
|
||||||
|
*
|
||||||
|
* Although SDK doc keeps silence about 1 char, SDK examples assume
|
||||||
|
* that we should wait for at least one character (not key). --KS
|
||||||
*/
|
*/
|
||||||
charsread = 0;
|
charsread = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (read_console_input(hConsoleInput, &ir, timeout) != rci_gotone) break;
|
if (read_console_input(hConsoleInput, &ir, timeout) != rci_gotone) break;
|
||||||
timeout = 0;
|
|
||||||
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown &&
|
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown &&
|
||||||
ir.Event.KeyEvent.uChar.UnicodeChar &&
|
ir.Event.KeyEvent.uChar.UnicodeChar &&
|
||||||
!(ir.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
!(ir.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
||||||
{
|
{
|
||||||
xbuf[charsread++] = ir.Event.KeyEvent.uChar.UnicodeChar;
|
xbuf[charsread++] = ir.Event.KeyEvent.uChar.UnicodeChar;
|
||||||
|
timeout = 0;
|
||||||
}
|
}
|
||||||
} while (charsread < nNumberOfCharsToRead);
|
} while (charsread < nNumberOfCharsToRead);
|
||||||
/* nothing has been read */
|
/* nothing has been read */
|
||||||
|
|
Loading…
Reference in New Issue