Module: wine Branch: master Commit: 645e59c490bcbd57a4a97a076295e171c44a80c1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=645e59c490bcbd57a4a97a0762...
Author: Andrew Nguyen arethusa26@gmail.com Date: Mon May 18 05:07:10 2009 -0500
kernel32: Correct the last error of CreateProcessW with an empty application name string.
---
dlls/kernel32/process.c | 9 ++------- dlls/kernel32/tests/process.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 8f486e0..9e6aeaa 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -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; }
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 6aac615..479a376 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -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)