From 457ece155fac012567d34c40639e8769968d7791 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Thu, 27 Oct 2005 10:25:49 +0000 Subject: [PATCH] Test for argv handling. --- dlls/kernel/tests/process.c | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/dlls/kernel/tests/process.c b/dlls/kernel/tests/process.c index 3052bd7576..b28f28d61a 100644 --- a/dlls/kernel/tests/process.c +++ b/dlls/kernel/tests/process.c @@ -693,9 +693,10 @@ static void test_Startup(void) static void test_CommandLine(void) { - char buffer[MAX_PATH]; + char buffer[MAX_PATH], fullpath[MAX_PATH], *lpFilePart, *p; PROCESS_INFORMATION info; STARTUPINFOA startup; + DWORD len; memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); @@ -740,6 +741,49 @@ static void test_CommandLine(void) okChildString("Arguments", "CommandLineA", buffer); release_memory(); assert(DeleteFileA(resfile) != 0); + + /* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0]*/ + get_file_name(resfile); + sprintf(buffer, "./%s tests/process.c %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); + sprintf(buffer, "./%s", selfname); + okChildString("Arguments", "argvA0", buffer); + release_memory(); + assert(DeleteFileA(resfile) != 0); + + get_file_name(resfile); + sprintf(buffer, ".\\%s tests/process.c %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); + sprintf(buffer, ".\\%s", selfname); + okChildString("Arguments", "argvA0", buffer); + release_memory(); + assert(DeleteFileA(resfile) != 0); + + get_file_name(resfile); + len = GetFullPathNameA(selfname, MAX_PATH, fullpath, &lpFilePart); + assert ( lpFilePart != 0); + *(lpFilePart -1 ) = 0; + p = strrchr(fullpath, '\\'); + assert (p); + sprintf(buffer, "..%s/%s tests/process.c %s \"a\\\"b\\\\\" c\\\" d", p, 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); + sprintf(buffer, "..%s/%s", p, selfname); + okChildString("Arguments", "argvA0", buffer); + release_memory(); + assert(DeleteFileA(resfile) != 0); + } static void test_Directory(void) -- 2.32.0.93.g670b81a890