kernel32: Correct the last error of CreateProcessW with an empty command line string.
This commit is contained in:
parent
645e59c490
commit
7c2c6a575c
|
@ -1824,6 +1824,7 @@ static LPWSTR get_file_name( LPCWSTR appname, LPWSTR cmdline, LPWSTR buffer,
|
||||||
sprintfW( ret, quotesW, name );
|
sprintfW( ret, quotesW, name );
|
||||||
strcatW( ret, p );
|
strcatW( ret, p );
|
||||||
}
|
}
|
||||||
|
else if (!ret) SetLastError( ERROR_FILE_NOT_FOUND );
|
||||||
|
|
||||||
done:
|
done:
|
||||||
HeapFree( GetProcessHeap(), 0, name );
|
HeapFree( GetProcessHeap(), 0, name );
|
||||||
|
|
|
@ -955,6 +955,40 @@ static void test_CommandLine(void)
|
||||||
ok(GetLastError() == ERROR_PATH_NOT_FOUND ||
|
ok(GetLastError() == ERROR_PATH_NOT_FOUND ||
|
||||||
broken(GetLastError() == ERROR_ACCESS_DENIED) /* Win98 */,
|
broken(GetLastError() == ERROR_ACCESS_DENIED) /* Win98 */,
|
||||||
"Expected ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
|
"Expected ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
/* Test empty command line parameter. */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = CreateProcessA(NULL, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
||||||
|
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
||||||
|
GetLastError() == ERROR_PATH_NOT_FOUND /* NT4 */ ||
|
||||||
|
GetLastError() == ERROR_BAD_PATHNAME /* Win98 */,
|
||||||
|
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
strcpy(buffer, "doesnotexist.exe");
|
||||||
|
strcpy(buffer2, "does not exist.exe");
|
||||||
|
|
||||||
|
/* Test nonexistent application name. */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = CreateProcessA(buffer, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
||||||
|
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = CreateProcessA(buffer2, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
||||||
|
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
/* Test nonexistent command line parameter. */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
||||||
|
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = CreateProcessA(NULL, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
|
||||||
|
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_Directory(void)
|
static void test_Directory(void)
|
||||||
|
|
Loading…
Reference in New Issue