kernel32: Correct the last error of CreateProcessW with an empty application name string.

This commit is contained in:
Andrew Nguyen 2009-05-18 05:07:10 -05:00 committed by Alexandre Julliard
parent 6c27fa1038
commit 645e59c490
2 changed files with 22 additions and 7 deletions

View File

@ -210,15 +210,10 @@ static HANDLE open_exe_file( const WCHAR *name )
{
WCHAR buffer[MAX_PATH];
/* file doesn't exist, check for builtin */
if (!contains_path( name )) goto error;
if (!get_builtin_path( name, NULL, buffer, sizeof(buffer) )) goto error;
handle = 0;
if (contains_path( name ) && get_builtin_path( name, NULL, buffer, sizeof(buffer) ))
handle = 0;
}
return handle;
error:
SetLastError( ERROR_FILE_NOT_FOUND );
return INVALID_HANDLE_VALUE;
}

View File

@ -935,6 +935,26 @@ static void test_CommandLine(void)
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
buffer[0] = '\0';
/* Test empty application name parameter. */
SetLastError(0xdeadbeef);
ret = CreateProcessA(buffer, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
ok(GetLastError() == ERROR_PATH_NOT_FOUND ||
broken(GetLastError() == ERROR_ACCESS_DENIED) /* Win98 */,
"Expected ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
buffer2[0] = '\0';
/* Test empty application name and command line parameters. */
SetLastError(0xdeadbeef);
ret = CreateProcessA(buffer, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
ok(GetLastError() == ERROR_PATH_NOT_FOUND ||
broken(GetLastError() == ERROR_ACCESS_DENIED) /* Win98 */,
"Expected ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
}
static void test_Directory(void)