Test for argv handling.

This commit is contained in:
Uwe Bonnes 2005-10-27 10:25:49 +00:00 committed by Alexandre Julliard
parent e1008c386f
commit 457ece155f
1 changed files with 45 additions and 1 deletions

View File

@ -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)