From: Piotr Caban piotr@codeweavers.com
--- dlls/d3d11/tests/d3d11.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index c3b65a82372..3c1cf932a04 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -2341,9 +2341,7 @@ static void test_create_device(void) startup.cb = sizeof(startup); ok(CreateProcessA(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess failed.\n");
- wait_child_process(info.hProcess); - CloseHandle(info.hProcess); - CloseHandle(info.hThread); + wait_child_process(&info); }
static void test_device_interfaces(const D3D_FEATURE_LEVEL feature_level)
From: Piotr Caban piotr@codeweavers.com
--- dlls/dinput/tests/joystick8.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 9b2bcb814d7..fc33ba981e4 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -107,9 +107,7 @@ static void run_in_desktop_( const char *file, int line, char **argv, ok_(file, line)( ret, "CreateProcessA failed, error %lu\n", GetLastError() ); if (!ret) return;
- wait_child_process( info.hProcess ); - CloseHandle( info.hThread ); - CloseHandle( info.hProcess ); + wait_child_process( &info );
if (input) {
From: Piotr Caban piotr@codeweavers.com
--- dlls/imm32/tests/imm32.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 5b4e194c367..bd303def376 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -8071,9 +8071,7 @@ static void test_ime_ui_window( const char *argv0 ) startup.cb = sizeof(startup); CreateProcessA( NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info );
- wait_child_process( info.hProcess ); - CloseHandle( info.hProcess ); - CloseHandle( info.hThread ); + wait_child_process( &info ); }
START_TEST(imm32)
From: Piotr Caban piotr@codeweavers.com
--- dlls/kernel32/tests/console.c | 4 +--- dlls/kernel32/tests/process.c | 28 ++++++++++++---------------- dlls/kernel32/tests/virtual.c | 8 ++------ 3 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 35ea04a2d5f..3c3538041f4 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -4312,9 +4312,7 @@ static void test_FreeConsole(HANDLE input, HANDLE orig_output) /* Test that our handles are now designaled in the child. */ SetEvent(parent_event);
- CloseHandle(info.hThread); - wait_child_process(info.hProcess); - CloseHandle(info.hProcess); + wait_child_process(&info);
ret = WriteConsoleInputW(input, &ir, 1, &size); ok(ret, "got error %lu\n", GetLastError()); diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index ce47b4ad2d7..7bc62fb54d3 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -1208,14 +1208,14 @@ static void test_Toolhelp(void) get_file_name(resfile); sprintf(buffer, ""%s" process nested "%s"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess failed\n"); - wait_child_process(&info); + ret = WaitForSingleObject(info.hProcess, 1000); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", ret);
process = OpenProcess(PROCESS_ALL_ACCESS_NT4, FALSE, info.dwProcessId); ok(process != NULL, "OpenProcess failed %lu\n", GetLastError()); CloseHandle(process);
- CloseHandle(info.hProcess); - CloseHandle(info.hThread); + wait_child_process(&info);
for (i = 0; i < 20; i++) { @@ -2674,6 +2674,7 @@ static void test_IsProcessInJob(void) HANDLE job, job2; PROCESS_INFORMATION pi; BOOL ret, out; + DWORD dwret;
if (!pIsProcessInJob) { @@ -2726,7 +2727,8 @@ static void test_IsProcessInJob(void) ok(out, "IsProcessInJob returned out=%u\n", out);
TerminateProcess(pi.hProcess, 0); - wait_child_process(pi.hProcess); + dwret = WaitForSingleObject(pi.hProcess, 1000); + ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", dwret);
out = FALSE; ret = pIsProcessInJob(pi.hProcess, job, &out); @@ -2735,8 +2737,7 @@ static void test_IsProcessInJob(void) test_assigned_proc(job, 0); test_accounting(job, 1, 0, 0);
- CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); + wait_child_process(&pi); CloseHandle(job); CloseHandle(job2); } @@ -2780,7 +2781,8 @@ static void test_TerminateJobObject(void)
/* Test adding an already terminated process to a job object */ create_process("exit", &pi); - wait_child_process(pi.hProcess); + dwret = WaitForSingleObject(pi.hProcess, 1000); + ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", dwret);
SetLastError(0xdeadbeef); ret = pAssignProcessToJobObject(job, pi.hProcess); @@ -2789,9 +2791,7 @@ static void test_TerminateJobObject(void) test_assigned_proc(job, 0); test_accounting(job, 1, 0, 0);
- CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - + wait_child_process(&pi); CloseHandle(job); }
@@ -2970,19 +2970,15 @@ static void test_CompletionPort(void) test_completion(port, JOB_OBJECT_MSG_NEW_PROCESS, (DWORD_PTR)job, pi.dwProcessId, 0);
TerminateProcess(pi.hProcess, 0); - wait_child_process(pi.hProcess); + wait_child_process(&pi);
test_completion(port, JOB_OBJECT_MSG_EXIT_PROCESS, (DWORD_PTR)job, pi.dwProcessId, 0); TerminateProcess(pi2.hProcess, 0); - wait_child_process(pi2.hProcess); - CloseHandle(pi2.hProcess); - CloseHandle(pi2.hThread); + wait_child_process(&pi2);
test_completion(port, JOB_OBJECT_MSG_EXIT_PROCESS, (DWORD_PTR)job, pi2.dwProcessId, 0); test_completion(port, JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO, (DWORD_PTR)job, 0, 100);
- CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); CloseHandle(job); CloseHandle(port); } diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index d0553b19966..d85e4d6203f 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -4419,9 +4419,7 @@ static void test_shared_memory(BOOL is_child) sprintf(cmdline, ""%s" virtual sharedmem", argv[0]); ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); ok(ret, "CreateProcess(%s) error %ld\n", cmdline, GetLastError()); - wait_child_process(pi.hProcess); - CloseHandle(pi.hThread); - CloseHandle(pi.hProcess); + wait_child_process(&pi); }
UnmapViewOfFile(p); @@ -4459,9 +4457,7 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access) sprintf(cmdline, ""%s" virtual sharedmemro %lx", argv[0], child_access); ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); ok(ret, "CreateProcess(%s) error %ld\n", cmdline, GetLastError()); - wait_child_process(pi.hProcess); - CloseHandle(pi.hThread); - CloseHandle(pi.hProcess); + wait_child_process(&pi);
if(child_access & FILE_MAP_WRITE) ok(*p == 0xdeadbeef, "*p = %lx, expected 0xdeadbeef\n", *p);
From: Piotr Caban piotr@codeweavers.com
--- dlls/mfplat/tests/mfplat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 4a6ffd1632b..759ffe0431b 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -75,9 +75,7 @@ static void run_child_test(const char *name) sprintf(path_name, "%s mfplat %s", argv[0], name); ok(CreateProcessA( NULL, path_name, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess failed.\n" ); - wait_child_process(info.hProcess); - CloseHandle(info.hProcess); - CloseHandle(info.hThread); + wait_child_process(&info); }
DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19);
From: Piotr Caban piotr@codeweavers.com
--- dlls/user32/tests/sysparams.c | 4 +--- dlls/user32/tests/win.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index 870b7f1cc93..0ffa9716be0 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -187,9 +187,7 @@ static void run_in_process_( const char *file, int line, char **argv, const char ok_(file, line)( ret, "CreateProcessA failed, error %lu\n", GetLastError() ); if (!ret) return;
- wait_child_process( info.hProcess ); - CloseHandle( info.hThread ); - CloseHandle( info.hProcess ); + wait_child_process( &info ); }
static BOOL get_reg_dword(HKEY base, const char *key_name, const char *value_name, DWORD *value) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 46dcf34cc0e..a3953377558 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -13781,9 +13781,7 @@ static void test_startupinfo_showwindow( char **argv ) sprintf( cmdline, "%s %s showwindow_proc %d", argv[0], argv[1], i ); ret = CreateProcessA( NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &sa, &info ); ok( ret, "got error %lu\n", GetLastError() ); - wait_child_process( info.hProcess ); - CloseHandle( info.hProcess ); - CloseHandle( info.hThread ); + wait_child_process( &info ); } }
From: Piotr Caban piotr@codeweavers.com
--- dlls/win32u/tests/d3dkmt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/win32u/tests/d3dkmt.c b/dlls/win32u/tests/d3dkmt.c index 5b76832538b..000f91d31cb 100644 --- a/dlls/win32u/tests/d3dkmt.c +++ b/dlls/win32u/tests/d3dkmt.c @@ -130,9 +130,7 @@ static void run_in_process_( const char *file, int line, const char *args ) ok_(file, line)( ret, "CreateProcessA failed, error %lu\n", GetLastError() ); if (!ret) return;
- wait_child_process( info.hProcess ); - CloseHandle( info.hThread ); - CloseHandle( info.hProcess ); + wait_child_process( &info ); }
#define check_d3dkmt_global( a ) check_d3dkmt_global_( __LINE__, a )
From: Piotr Caban piotr@codeweavers.com
--- dlls/windowscodecs/tests/info.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c index 15dcde5fd9d..b2dcf1ab532 100644 --- a/dlls/windowscodecs/tests/info.c +++ b/dlls/windowscodecs/tests/info.c @@ -66,9 +66,7 @@ static void run_child_test(const char *name) sprintf(path_name, "%s info %s", argv[0], name); ok(CreateProcessA( NULL, path_name, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess failed.\n" ); - wait_child_process(info.hProcess); - CloseHandle(info.hProcess); - CloseHandle(info.hThread); + wait_child_process(&info); }
static HRESULT get_component_info(const GUID *clsid, IWICComponentInfo **result)
From: Piotr Caban piotr@codeweavers.com
--- programs/timeout/tests/timeout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/programs/timeout/tests/timeout.c b/programs/timeout/tests/timeout.c index 2ac4131b211..c526b4b08c6 100644 --- a/programs/timeout/tests/timeout.c +++ b/programs/timeout/tests/timeout.c @@ -152,9 +152,7 @@ static void test_ctrlc_intermediate(int argc, char** argv, const char* name) CREATE_NEW_PROCESS_GROUP | CREATE_NEW_CONSOLE, NULL, NULL, &startup, &info), "CreateProcess failed.\n"); - wait_child_process(info.hProcess); - CloseHandle(info.hProcess); - CloseHandle(info.hThread); + wait_child_process(&info); }
START_TEST(timeout)
The kernel32:process test is flaky and failure is not caused by this patch. It sometimes fails, e.g. https://test.winehq.org/data/833f57698015a9e0c9d0606d8a99254c36c9b9d8/win200...
Sorry about this mess. I wrote the base patch some time ago, and then forgot that HANDLE is a void pointer >_>
This merge request was approved by Elizabeth Figura.