Francois Gouget : kernel32/tests: Check if CreateProcess() resets STARTUPINFO/PROCESS_INFORMATION.
Alexandre Julliard
julliard at winehq.org
Mon Feb 24 15:23:53 CST 2020
Module: wine
Branch: master
Commit: 8adca32727ff40b845f4a517c43ed40da0143e4d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8adca32727ff40b845f4a517c43ed40da0143e4d
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Mon Feb 24 05:04:00 2020 +0100
kernel32/tests: Check if CreateProcess() resets STARTUPINFO/PROCESS_INFORMATION.
Our test framework depends on CreateProcess() initializing the
hProcess field in case of a failure. The process tests depend on it
not modifying the STARTUPINFO fields.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/process.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 46d7245777..b32560358d 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -895,10 +895,31 @@ static void test_CommandLine(void)
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
+ /* failure case */
+ strcpy(buffer, "\"t:\\NotADir\\NotAFile.exe\"");
+ memset(&info, 0xa, sizeof(info));
+ ok(!CreateProcessA(buffer, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess unexpectedly succeeded\n");
+ /* Check that the effective STARTUPINFOA parameters are not modified */
+ ok(startup.cb == sizeof(startup), "unexpected cb %d\n", startup.cb);
+ ok(startup.lpDesktop == NULL, "lpDesktop is not NULL\n");
+ ok(startup.lpTitle == NULL, "lpTitle is not NULL\n");
+ ok(startup.dwFlags == STARTF_USESHOWWINDOW, "unexpected dwFlags %04x\n", startup.dwFlags);
+ ok(startup.wShowWindow == SW_SHOWNORMAL, "unexpected wShowWindow %d\n", startup.wShowWindow);
+ ok(!info.hProcess, "unexpected hProcess %p\n", info.hProcess);
+ ok(!info.hThread, "unexpected hThread %p\n", info.hThread);
+ ok(!info.dwProcessId, "unexpected dwProcessId %04x\n", info.dwProcessId);
+ ok(!info.dwThreadId, "unexpected dwThreadId %04x\n", info.dwThreadId);
+
/* the basics */
get_file_name(resfile);
sprintf(buffer, "\"%s\" process dump \"%s\" \"C:\\Program Files\\my nice app.exe\" \"\"\"\"", selfname, resfile);
ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
+ /* Check that the effective STARTUPINFOA parameters are not modified */
+ ok(startup.cb == sizeof(startup), "unexpected cb %d\n", startup.cb);
+ ok(startup.lpDesktop == NULL, "lpDesktop is not NULL\n");
+ ok(startup.lpTitle == NULL, "lpTitle is not NULL\n");
+ ok(startup.dwFlags == STARTF_USESHOWWINDOW, "unexpected dwFlags %04x\n", startup.dwFlags);
+ ok(startup.wShowWindow == SW_SHOWNORMAL, "unexpected wShowWindow %d\n", startup.wShowWindow);
/* 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 */
@@ -914,11 +935,6 @@ static void test_CommandLine(void)
release_memory();
DeleteFileA(resfile);
- memset(&startup, 0, sizeof(startup));
- startup.cb = sizeof(startup);
- startup.dwFlags = STARTF_USESHOWWINDOW;
- startup.wShowWindow = SW_SHOWNORMAL;
-
/* test main()'s quotes handling */
get_file_name(resfile);
sprintf(buffer, "\"%s\" process dump \"%s\" \"a\\\"b\\\\\" c\\\" d", selfname, resfile);
More information about the wine-cvs
mailing list