https://git.reactos.org/?p=reactos.git;a=commitdiff;h=23de2099e017a7514d10a…
commit 23de2099e017a7514d10a5bc88fce9bac4003654
Author: James Woodcock <james_woodcock(a)yahoo.co.uk>
AuthorDate: Fri Apr 27 16:12:23 2018 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Apr 28 22:16:50 2018 +0200
[CMD] Don't pass CTRL-C to child processes.
CORE-11677
The standard Win32 Console Control Handler will give CTRL-C events to
processes spawned from cmd.exe. If cmd.exe calls GenerateConsolCtrlEvent()
then the child process will receive two CTRL-C events.
---
base/shell/cmd/cmd.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/base/shell/cmd/cmd.c b/base/shell/cmd/cmd.c
index d9a03a265e..89a2b1b699 100644
--- a/base/shell/cmd/cmd.c
+++ b/base/shell/cmd/cmd.c
@@ -429,7 +429,7 @@ Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
NULL,
NULL,
TRUE,
- 0, /* CREATE_NEW_PROCESS_GROUP */
+ 0,
NULL,
NULL,
&stui,
@@ -1459,26 +1459,16 @@ BOOL WINAPI BreakHandler(DWORD dwCtrlType)
{
DWORD dwWritten;
INPUT_RECORD rec;
- static BOOL SelfGenerated = FALSE;
if ((dwCtrlType != CTRL_C_EVENT) &&
(dwCtrlType != CTRL_BREAK_EVENT))
{
return FALSE;
}
- else
- {
- if (SelfGenerated)
- {
- SelfGenerated = FALSE;
- return TRUE;
- }
- }
if (!TryEnterCriticalSection(&ChildProcessRunningLock))
{
- SelfGenerated = TRUE;
- GenerateConsoleCtrlEvent (dwCtrlType, 0);
+ /* Child process is running and will have received the control event */
return TRUE;
}
else