mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Send CTRL_CLOSE_EVENT to processes attached to a console when that console
is closed. Default handle the event by terminating the process. svn path=/trunk/; revision=10812
This commit is contained in:
parent
5f870e152c
commit
fb16e656c4
4 changed files with 12 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: console.c,v 1.79 2004/08/28 22:14:08 navaraf Exp $
|
||||
/* $Id: console.c,v 1.80 2004/09/10 22:14:52 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -41,12 +41,10 @@ BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event)
|
|||
{
|
||||
case CTRL_C_EVENT:
|
||||
DPRINT("Ctrl-C Event\n");
|
||||
ExitProcess(0);
|
||||
break;
|
||||
|
||||
case CTRL_BREAK_EVENT:
|
||||
DPRINT("Ctrl-Break Event\n");
|
||||
ExitProcess(0);
|
||||
break;
|
||||
|
||||
case CTRL_SHUTDOWN_EVENT:
|
||||
|
@ -61,7 +59,7 @@ BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event)
|
|||
DPRINT("Ctrl Logoff Event\n");
|
||||
break;
|
||||
}
|
||||
// ExitProcess((UINT)&ExitCode);
|
||||
ExitProcess(0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: conio.h,v 1.4 2004/08/22 20:52:28 navaraf Exp $
|
||||
/* $Id: conio.h,v 1.5 2004/09/10 22:14:52 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -99,6 +99,7 @@ void FASTCALL ConioPhysicalToLogical(PCSRSS_SCREEN_BUFFER Buff,
|
|||
LONG *LogicalX,
|
||||
LONG *LogicalY);
|
||||
VOID FASTCALL ConioDrawConsole(PCSRSS_CONSOLE Console);
|
||||
VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData);
|
||||
|
||||
/* api/conio.c */
|
||||
CSR_API(CsrWriteConsole);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: conio.c,v 1.14 2004/08/25 10:37:14 hbirr Exp $
|
||||
/* $Id: conio.c,v 1.15 2004/09/10 22:14:52 gvg Exp $
|
||||
*
|
||||
* reactos/subsys/csrss/win32csr/conio.c
|
||||
*
|
||||
|
@ -63,12 +63,12 @@ ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Con
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC VOID FASTCALL
|
||||
CsrConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
|
||||
VOID FASTCALL
|
||||
ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
|
||||
{
|
||||
HANDLE Process, Thread;
|
||||
|
||||
DPRINT("CsrConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ProcessId);
|
||||
DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ProcessId);
|
||||
|
||||
if (ProcessData->CtrlDispatcher)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ CsrConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
|
|||
return;
|
||||
}
|
||||
|
||||
DPRINT("CsrConsoleCtrlEvent Process Handle = %x\n", Process);
|
||||
DPRINT("ConioConsoleCtrlEvent Process Handle = %x\n", Process);
|
||||
|
||||
Thread = CreateRemoteThread(Process, NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) ProcessData->CtrlDispatcher,
|
||||
|
@ -988,7 +988,7 @@ ConioProcessChar(PCSRSS_CONSOLE Console,
|
|||
{
|
||||
current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry);
|
||||
current_entry = current_entry->Flink;
|
||||
CsrConsoleCtrlEvent((DWORD)CTRL_C_EVENT, current);
|
||||
ConioConsoleCtrlEvent((DWORD)CTRL_C_EVENT, current);
|
||||
}
|
||||
HeapFree(Win32CsrApiHeap, 0, KeyEventRecord);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: guiconsole.c,v 1.19 2004/08/24 17:25:17 navaraf Exp $
|
||||
/* $Id: guiconsole.c,v 1.20 2004/09/10 22:14:52 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -571,8 +571,6 @@ GuiConsoleHandleClose(HWND hWnd)
|
|||
PGUI_CONSOLE_DATA GuiData;
|
||||
PLIST_ENTRY current_entry;
|
||||
PCSRSS_PROCESS_DATA current;
|
||||
HANDLE Process;
|
||||
BOOL Result;
|
||||
|
||||
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
||||
|
||||
|
@ -584,18 +582,7 @@ GuiConsoleHandleClose(HWND hWnd)
|
|||
current = CONTAINING_RECORD(current_entry, CSRSS_PROCESS_DATA, ProcessEntry);
|
||||
current_entry = current_entry->Flink;
|
||||
|
||||
Process = OpenProcess(PROCESS_DUP_HANDLE, FALSE, current->ProcessId);
|
||||
if (NULL == Process)
|
||||
{
|
||||
DPRINT1("Failed for handle duplication\n");
|
||||
continue;
|
||||
}
|
||||
Result = TerminateProcess(Process, 0);
|
||||
CloseHandle(Process);
|
||||
if (!Result)
|
||||
{
|
||||
DPRINT1("Failed to terminate process %d\n", current->ProcessId);
|
||||
}
|
||||
ConioConsoleCtrlEvent(CTRL_CLOSE_EVENT, current);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&Console->Header.Lock);
|
||||
|
|
Loading…
Reference in a new issue