mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
- Fix cmd's cgetchar() function so it only returns on a key being pressed, not released.
- Remove ConInDummy function that was called after a line is input. Presumably its purpose was to consume the event of Enter being released, so that that event wouldn't affect the command, but that didn't help when other keys were pressed as well. Anyway, it shouldn't be necessary any more. - Use correct codepage for reading batch files. svn path=/trunk/; revision=40311
This commit is contained in:
parent
edf6d65008
commit
dcb067a51f
3 changed files with 4 additions and 35 deletions
|
@ -449,7 +449,6 @@ BOOL ReadCommand (LPTSTR str, INT maxlen)
|
|||
#endif
|
||||
str[charcount++] = _T('\n');
|
||||
str[charcount] = _T('\0');
|
||||
ConInDummy ();
|
||||
ConOutChar (_T('\n'));
|
||||
bReturn = TRUE;
|
||||
break;
|
||||
|
|
|
@ -49,17 +49,6 @@ VOID ConInEnable (VOID)
|
|||
}
|
||||
|
||||
|
||||
VOID ConInDummy (VOID)
|
||||
{
|
||||
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
|
||||
INPUT_RECORD dummy;
|
||||
DWORD dwRead;
|
||||
|
||||
if (hInput == INVALID_HANDLE_VALUE)
|
||||
WARN ("Invalid input handle!!!\n");
|
||||
ReadConsoleInput (hInput, &dummy, 1, &dwRead);
|
||||
}
|
||||
|
||||
VOID ConInFlush (VOID)
|
||||
{
|
||||
FlushConsoleInputBuffer (GetStdHandle (STD_INPUT_HANDLE));
|
||||
|
|
|
@ -43,39 +43,20 @@ TCHAR cgetchar (VOID)
|
|||
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
|
||||
INPUT_RECORD irBuffer;
|
||||
DWORD dwRead;
|
||||
/*
|
||||
|
||||
do
|
||||
{
|
||||
ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
|
||||
if ((irBuffer.EventType == KEY_EVENT) &&
|
||||
(irBuffer.Event.KeyEvent.bKeyDown == TRUE))
|
||||
{
|
||||
if ((irBuffer.Event.KeyEvent.dwControlKeyState &
|
||||
(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) &
|
||||
(irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C'))
|
||||
bCtrlBreak = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (TRUE);
|
||||
*/
|
||||
do
|
||||
{
|
||||
ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
|
||||
|
||||
if (irBuffer.EventType == KEY_EVENT)
|
||||
{
|
||||
if (irBuffer.Event.KeyEvent.dwControlKeyState &
|
||||
(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))
|
||||
{
|
||||
if (irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C')
|
||||
{
|
||||
// if (irBuffer.Event.KeyEvent.bKeyDown == TRUE)
|
||||
// {
|
||||
bCtrlBreak = TRUE;
|
||||
break;
|
||||
// }
|
||||
bCtrlBreak = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((irBuffer.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
|
||||
|
@ -538,7 +519,7 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
|
|||
|
||||
lpString[len++] = '\0';
|
||||
#ifdef _UNICODE
|
||||
MultiByteToWideChar(CP_ACP, 0, lpString, -1, lpBuffer, len);
|
||||
MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len);
|
||||
cmd_free(lpString);
|
||||
#endif
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue