From 30230fae5f74bf0f2233f4b6eb9b09f086a21bc4 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Fri, 29 Jan 2016 00:19:42 +0100 Subject: [PATCH] shell32/tests: Check the child process exit code and close the process handle. Signed-off-by: Francois Gouget Signed-off-by: Alexandre Julliard --- dlls/shell32/tests/shlexec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index a950cde5225..06308153769 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -26,8 +26,6 @@ * - ShellExecute("foo.shlexec") with no path should work if foo.shlexec is * in the PATH * - 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 * we could check */ @@ -597,13 +595,20 @@ static INT_PTR shell_execute_ex_(const char* file, int line, if (rc > 32) { - int wait_rc; + DWORD wait_rc, rc; if (sei.hProcess!=NULL) { wait_rc=WaitForSingleObject(sei.hProcess, 5000); okShell_(file, line)(wait_rc==WAIT_OBJECT_0, "WaitForSingleObject(hProcess) returned %d\n", 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); if (!_todo_wait)