mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHELL32_APITEST] ShellExecCmdLine: Do **NOT** use TerminateProcess to close the opened windows.
This design, introduced in 418edcd2b
, is fundamentally flawed as it
can also close windows unrelated to the running test (e.g. windows
of programs that the user can start, while the test is running).
But since we cannot do much better, mitigate instead the other main
problem of this design: Just use PostMessageW(WM_CLOSE), as it used
to be, instead of TerminateProcess().
Indeed, using TerminateProcess() otherwise could kill unrelated
processes the test hasn't created. In particular it could kill the
csrss.exe system process if, during the testing procedure, a hard-error
popup shows up.
And this is precisely the case when this test runs with limited memory,
and a hard-error
"Insufficient system resources exist to complete the requested service."
arises.
This commit is contained in:
parent
307ce1a503
commit
4bf32102ab
1 changed files with 1 additions and 7 deletions
|
@ -609,13 +609,7 @@ static void CleanupNewlyCreatedWindows(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bFound)
|
if (!bFound)
|
||||||
{
|
PostMessageW(s_wi1.phwnd[i1], WM_CLOSE, 0, 0);
|
||||||
DWORD dwPID;
|
|
||||||
GetWindowThreadProcessId(s_wi1.phwnd[i1], &dwPID);
|
|
||||||
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, TRUE, dwPID);
|
|
||||||
TerminateProcess(hProcess, -1);
|
|
||||||
CloseHandle(hProcess);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(s_wi1.phwnd);
|
free(s_wi1.phwnd);
|
||||||
ZeroMemory(&s_wi1, sizeof(s_wi1));
|
ZeroMemory(&s_wi1, sizeof(s_wi1));
|
||||||
|
|
Loading…
Reference in a new issue