shell32/tests: Check the child process exit code and close the process handle.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2016-01-29 00:19:42 +01:00 committed by Alexandre Julliard
parent 3a9b09aa7d
commit 30230fae5f
1 changed files with 8 additions and 3 deletions

View File

@ -26,8 +26,6 @@
* - ShellExecute("foo.shlexec") with no path should work if foo.shlexec is * - ShellExecute("foo.shlexec") with no path should work if foo.shlexec is
* in the PATH * in the PATH
* - test associations that use %l, %L or "%1" instead of %1 * - test associations that use %l, %L or "%1" instead of %1
* - we may want to test ShellExecuteEx() instead of ShellExecute()
* and then we could also check its return value
* - ShellExecuteEx() also calls SetLastError() with meaningful values which * - ShellExecuteEx() also calls SetLastError() with meaningful values which
* we could check * we could check
*/ */
@ -597,13 +595,20 @@ static INT_PTR shell_execute_ex_(const char* file, int line,
if (rc > 32) if (rc > 32)
{ {
int wait_rc; DWORD wait_rc, rc;
if (sei.hProcess!=NULL) if (sei.hProcess!=NULL)
{ {
wait_rc=WaitForSingleObject(sei.hProcess, 5000); wait_rc=WaitForSingleObject(sei.hProcess, 5000);
okShell_(file, line)(wait_rc==WAIT_OBJECT_0, okShell_(file, line)(wait_rc==WAIT_OBJECT_0,
"WaitForSingleObject(hProcess) returned %d\n", "WaitForSingleObject(hProcess) returned %d\n",
wait_rc); wait_rc);
wait_rc = GetExitCodeProcess(sei.hProcess, &rc);
okShell_(file, line)(wait_rc, "GetExitCodeProcess() failed le=%u\n", GetLastError());
if (!_todo_wait)
okShell_(file, line)(rc == 0, "child returned %u\n", rc);
else todo_wine
okShell_(file, line)(rc == 0, "child returned %u\n", rc);
CloseHandle(sei.hProcess);
} }
wait_rc=WaitForSingleObject(hEvent, 5000); wait_rc=WaitForSingleObject(hEvent, 5000);
if (!_todo_wait) if (!_todo_wait)