diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index d7d3148928e..b8323b4b6cb 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -536,7 +536,7 @@ static void test_Startup(void) startup.wShowWindow = SW_SHOWNORMAL; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -574,7 +574,7 @@ static void test_Startup(void) startup.dwFillAttribute = 0xA55A; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -612,7 +612,7 @@ static void test_Startup(void) startup.dwFillAttribute = 0xA55A; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -650,7 +650,7 @@ static void test_Startup(void) startup.dwFillAttribute = 0xA55A; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -688,7 +688,7 @@ static void test_Startup(void) startup.dwFillAttribute = 0xA55A; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -728,7 +728,7 @@ static void test_Startup(void) startup.dwFillAttribute = 0xA55A; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -766,7 +766,7 @@ static void test_Startup(void) startup.dwFillAttribute = 0xA55A; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -806,16 +806,16 @@ static void test_CommandLine(void) /* the basics */ get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\" \"C:\\Program Files\\my nice app.exe\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" \"C:\\Program Files\\my nice app.exe\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ 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 */ WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - okChildInt("Arguments", "argcA", 4); - okChildString("Arguments", "argvA3", "C:\\Program Files\\my nice app.exe"); - okChildString("Arguments", "argvA4", NULL); + okChildInt("Arguments", "argcA", 5); + okChildString("Arguments", "argvA4", "C:\\Program Files\\my nice app.exe"); + okChildString("Arguments", "argvA5", NULL); okChildString("Arguments", "CommandLineA", buffer); release_memory(); assert(DeleteFileA(resfile) != 0); @@ -827,18 +827,18 @@ static void test_CommandLine(void) /* from François */ get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ 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 */ WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - okChildInt("Arguments", "argcA", 6); - okChildString("Arguments", "argvA3", "a\"b\\"); - okChildString("Arguments", "argvA4", "c\""); - okChildString("Arguments", "argvA5", "d"); - okChildString("Arguments", "argvA6", NULL); + okChildInt("Arguments", "argcA", 7); + okChildString("Arguments", "argvA4", "a\"b\\"); + okChildString("Arguments", "argvA5", "c\""); + okChildString("Arguments", "argvA6", "d"); + okChildString("Arguments", "argvA7", NULL); okChildString("Arguments", "CommandLineA", buffer); release_memory(); assert(DeleteFileA(resfile) != 0); @@ -846,7 +846,7 @@ static void test_CommandLine(void) /* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0]*/ get_file_name(resfile); /* Use exename to avoid buffer containing things like 'C:' */ - sprintf(buffer, "./%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile); + sprintf(buffer, "./%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -861,7 +861,7 @@ static void test_CommandLine(void) get_file_name(resfile); /* Use exename to avoid buffer containing things like 'C:' */ - sprintf(buffer, ".\\%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile); + sprintf(buffer, ".\\%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -880,8 +880,8 @@ static void test_CommandLine(void) *(lpFilePart -1 ) = 0; p = strrchr(fullpath, '\\'); /* Use exename to avoid buffer containing things like 'C:' */ - if (p) sprintf(buffer, "..%s/%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", p, exename, resfile); - else sprintf(buffer, "./%s tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile); + if (p) sprintf(buffer, "..%s/%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", p, exename, resfile); + else sprintf(buffer, "./%s tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", exename, resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -904,7 +904,7 @@ static void test_CommandLine(void) /* Use exename to avoid buffer containing things like 'C:' */ if (p) sprintf(buffer, "..%s/%s", p, exename); else sprintf(buffer, "./%s", exename); - sprintf(buffer2, "dummy tests/process.c \"%s\" \"a\\\"b\\\\\" c\\\" d", resfile); + sprintf(buffer2, "dummy tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", resfile); SetLastError(0xdeadbeef); ret = CreateProcessA(buffer, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info); ok(ret, "CreateProcess (%s) failed : %d\n", buffer, GetLastError()); @@ -912,7 +912,7 @@ static void test_CommandLine(void) 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 */ WritePrivateProfileStringA(NULL, NULL, NULL, resfile); - sprintf(buffer, "tests/process.c %s", resfile); + sprintf(buffer, "tests/process.c dump %s", resfile); okChildString("Arguments", "argvA0", "dummy"); okChildString("Arguments", "CommandLineA", buffer2); okChildStringWA("Arguments", "CommandLineW", buffer2); @@ -1002,7 +1002,7 @@ static void test_Directory(void) /* the basics */ get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); GetWindowsDirectoryA( windir, sizeof(windir) ); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, windir, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ @@ -1109,7 +1109,7 @@ static void test_Environment(void) /* the basics */ get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n"); @@ -1128,7 +1128,7 @@ static void test_Environment(void) /* the basics */ get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); child_env_len = 0; ptr = env; @@ -1196,7 +1196,7 @@ static void test_SuspendFlag(void) startup.wShowWindow = SW_SHOWNORMAL; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup, &info), "CreateProcess\n"); ok(GetExitCodeThread(info.hThread, &exit_status) && exit_status == STILL_ACTIVE, "thread still running\n"); @@ -1246,7 +1246,7 @@ static void test_DebuggingFlag(void) startup.wShowWindow = SW_SHOWNORMAL; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n"); /* get all startup events up to the entry point break exception */ @@ -1344,7 +1344,7 @@ static void test_Console(void) cpOut = GetConsoleOutputCP(); get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\" console", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" console", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ @@ -1458,7 +1458,7 @@ static void test_Console(void) startup.hStdError = hChildOutInh; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\" stdhandle", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" stdhandle", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &startup, &info), "CreateProcess\n"); ok(CloseHandle(hChildInInh), "Closing handle\n"); ok(CloseHandle(hChildOutInh), "Closing handle\n"); @@ -1495,7 +1495,7 @@ static void test_ExitCode(void) startup.wShowWindow = SW_SHOWNORMAL; get_file_name(resfile); - sprintf(buffer, "\"%s\" tests/process.c \"%s\" exit_code", selfname, resfile); + sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" exit_code", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), "CreateProcess\n"); /* wait for child to terminate */ @@ -2125,9 +2125,15 @@ START_TEST(process) ok(b, "Basic init of CreateProcess test\n"); if (!b) return; - if (myARGC >= 3) + if (myARGC >= 4) { - doChild(myARGV[2], (myARGC == 3) ? NULL : myARGV[3]); + if (!strcmp(myARGV[2], "dump")) + { + doChild(myARGV[3], (myARGC >= 5) ? myARGV[4] : NULL); + return; + } + + ok(0, "Unexpected command %s\n", myARGV[2]); return; } test_TerminateProcess();