Make sure that a CTRL+C doesn't carry over to another command. Modified: trunk/reactos/subsys/system/cmd/cmd.c _____
Modified: trunk/reactos/subsys/system/cmd/cmd.c --- trunk/reactos/subsys/system/cmd/cmd.c 2005-12-06 18:39:17 UTC (rev 19932) +++ trunk/reactos/subsys/system/cmd/cmd.c 2005-12-06 19:11:08 UTC (rev 19933) @@ -681,8 +681,6 @@
} } } - /* Just in case a CTRL+C slipped through a command */ - bCtrlBreak = FALSE; free(com); }
@@ -1449,7 +1447,7 @@ ConOutPuts (commandline); }
- if (*commandline && !CheckCtrlBreak(BREAK_INPUT)) + if (!CheckCtrlBreak(BREAK_INPUT) && *commandline) { ParseCommandLine (commandline); if (bEcho && !bIgnoreEcho && (!bIsBatch || bEchoThisLine)) @@ -1473,22 +1471,7 @@ INPUT_RECORD rec; static BOOL SelfGenerated = FALSE;
- rec.EventType = KEY_EVENT; - rec.Event.KeyEvent.bKeyDown = TRUE; - rec.Event.KeyEvent.wRepeatCount = 1; - rec.Event.KeyEvent.wVirtualKeyCode = _T('C'); - rec.Event.KeyEvent.wVirtualScanCode = _T('C') - 35; - rec.Event.KeyEvent.uChar.AsciiChar = _T('C'); - rec.Event.KeyEvent.uChar.UnicodeChar = _T('C'); - rec.Event.KeyEvent.dwControlKeyState = RIGHT_CTRL_PRESSED; - - WriteConsoleInput( - hIn, - &rec, - 1, - &dwWritten); - - if ((dwCtrlType != CTRL_C_EVENT) && + if ((dwCtrlType != CTRL_C_EVENT) && (dwCtrlType != CTRL_BREAK_EVENT)) { return FALSE; @@ -1509,6 +1492,22 @@ return TRUE; }
+ + rec.EventType = KEY_EVENT; + rec.Event.KeyEvent.bKeyDown = TRUE; + rec.Event.KeyEvent.wRepeatCount = 1; + rec.Event.KeyEvent.wVirtualKeyCode = _T('C'); + rec.Event.KeyEvent.wVirtualScanCode = _T('C') - 35; + rec.Event.KeyEvent.uChar.AsciiChar = _T('C'); + rec.Event.KeyEvent.uChar.UnicodeChar = _T('C'); + rec.Event.KeyEvent.dwControlKeyState = RIGHT_CTRL_PRESSED; + + WriteConsoleInput( + hIn, + &rec, + 1, + &dwWritten); + bCtrlBreak = TRUE; /* FIXME: Handle batch files */