mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-18 09:16:17 +00:00
start: Wrap child inside a job so it gets killed when start.exe terminates.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50869 Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
53b179dcc1
commit
a1abb524fe
|
@ -676,7 +676,24 @@ done:
|
|||
|
||||
if (sei.fMask & SEE_MASK_NOCLOSEPROCESS) {
|
||||
DWORD exitcode;
|
||||
HANDLE hJob;
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info;
|
||||
|
||||
SetConsoleCtrlHandler(NULL, TRUE);
|
||||
hJob = CreateJobObjectA(NULL, NULL);
|
||||
/* Create a job where the child is associated... if the start.exe terminates
|
||||
* before the child, the job will be terminated, and the child will be terminated as well.
|
||||
* (The idea is to allow to kill (from a Unix standpoint) a created Windows
|
||||
* process (here start.exe), and that the unix-kill of start.exe will be also terminate
|
||||
* start.exe's child process).
|
||||
*/
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.BasicLimitInformation.LimitFlags =
|
||||
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE |
|
||||
JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;
|
||||
SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &info, sizeof(info));
|
||||
AssignProcessToJobObject(hJob, sei.hProcess);
|
||||
|
||||
WaitForSingleObject(sei.hProcess, INFINITE);
|
||||
GetExitCodeProcess(sei.hProcess, &exitcode);
|
||||
ExitProcess(exitcode);
|
||||
|
|
Loading…
Reference in a new issue