kernel32/tests: Close process / thread handles.

Signed-off-by: Mark Jansen <mark.jansen@reactos.org>
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Mark Jansen 2018-02-23 12:16:58 +01:00 committed by Alexandre Julliard
parent 5c2523c6f3
commit 85f515292a
1 changed files with 30 additions and 0 deletions

View File

@ -618,6 +618,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
GetStartupInfoA(&si); GetStartupInfoA(&si);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
@ -656,6 +658,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
@ -694,6 +698,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", si.lpDesktop); okChildString("StartupInfoA", "lpDesktop", si.lpDesktop);
@ -732,6 +738,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
@ -770,6 +778,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
@ -810,6 +820,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
@ -848,6 +860,8 @@ static void test_Startup(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
@ -888,6 +902,8 @@ static void test_CommandLine(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("Arguments", "argcA", 5); okChildInt("Arguments", "argcA", 5);
okChildString("Arguments", "argvA4", "C:\\Program Files\\my nice app.exe"); okChildString("Arguments", "argvA4", "C:\\Program Files\\my nice app.exe");
@ -909,6 +925,8 @@ static void test_CommandLine(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildInt("Arguments", "argcA", 7); okChildInt("Arguments", "argcA", 7);
okChildString("Arguments", "argvA4", "a\"b\\"); okChildString("Arguments", "argvA4", "a\"b\\");
@ -930,6 +948,8 @@ static void test_CommandLine(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
sprintf(buffer, "./%s", exename); sprintf(buffer, "./%s", exename);
okChildString("Arguments", "argvA0", buffer); okChildString("Arguments", "argvA0", buffer);
release_memory(); release_memory();
@ -945,6 +965,8 @@ static void test_CommandLine(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
sprintf(buffer, ".\\%s", exename); sprintf(buffer, ".\\%s", exename);
okChildString("Arguments", "argvA0", buffer); okChildString("Arguments", "argvA0", buffer);
release_memory(); release_memory();
@ -965,6 +987,8 @@ static void test_CommandLine(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
if (p) sprintf(buffer, "..%s/%s", p, exename); if (p) sprintf(buffer, "..%s/%s", p, exename);
else sprintf(buffer, "./%s", exename); else sprintf(buffer, "./%s", exename);
okChildString("Arguments", "argvA0", buffer); okChildString("Arguments", "argvA0", buffer);
@ -988,6 +1012,8 @@ static void test_CommandLine(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
sprintf(buffer, "tests/process.c dump %s", resfile); sprintf(buffer, "tests/process.c dump %s", resfile);
okChildString("Arguments", "argvA0", "dummy"); okChildString("Arguments", "argvA0", "dummy");
okChildString("Arguments", "CommandLineA", buffer2); okChildString("Arguments", "CommandLineA", buffer2);
@ -1085,6 +1111,8 @@ static void test_Directory(void)
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
/* child process has changed result file, so let profile functions know about it */ /* child process has changed result file, so let profile functions know about it */
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
okChildIString("Misc", "CurrDirA", windir); okChildIString("Misc", "CurrDirA", windir);
release_memory(); release_memory();
@ -1093,6 +1121,8 @@ static void test_Directory(void)
/* search PATH for the exe if directory is NULL */ /* search PATH for the exe if directory is NULL */
ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
ok(TerminateProcess(info.hProcess, 0), "Child process termination\n"); ok(TerminateProcess(info.hProcess, 0), "Child process termination\n");
CloseHandle(info.hThread);
CloseHandle(info.hProcess);
/* if any directory is provided, don't search PATH, error on bad directory */ /* if any directory is provided, don't search PATH, error on bad directory */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);