[PATCH v3 4/4] dlls/kernel32/tests: added tests for CreateProcess on a shell_no_window console
Eric Pouech
eric.pouech at gmail.com
Wed Apr 6 10:02:37 CDT 2022
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
---
dlls/kernel32/tests/console.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 72e4f123377..a74170a898c 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include "wine/test.h"
+#include "wine/condrv.h"
static void (WINAPI *pClosePseudoConsole)(HPCON);
static HRESULT (WINAPI *pCreatePseudoConsole)(COORD,HANDLE,HANDLE,DWORD,HPCON*);
@@ -4716,6 +4717,7 @@ static DWORD check_child_console_bits(const char* exec, DWORD flags)
#define CP_WITH_WINDOW 0x04 /* child has a console window */
#define CP_ALONE 0x08 /* whether child is the single process attached to console */
#define CP_GROUP_LEADER 0x10 /* whether the child is the process group leader */
+#define CP_PSEUDO_HANDLE 0x20 /* whether the ConsoleHandle is a pseudo handle */
static void test_CreateProcessCUI(void)
{
@@ -4760,6 +4762,41 @@ static void test_CreateProcessCUI(void)
res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW);
ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res);
+ /* testing also Wine's only shell_no_window pseudo console */
+ if (!strcmp(winetest_platform, "wine"))
+ {
+ RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle = CONSOLE_HANDLE_SHELL_NO_WINDOW;
+ res = check_child_console_bits(guiexec, 0);
+ todo_wine
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(guiexec, DETACHED_PROCESS);
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE);
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(guiexec, CREATE_NO_WINDOW);
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(guiexec, DETACHED_PROCESS | CREATE_NO_WINDOW);
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW);
+ ok(res == 0, "Unexpected result %x\n", res);
+
+ res = check_child_console_bits(cuiexec, 0);
+ /* most of the *Console* calls should fail */
+ ok(res == (CP_WITH_HANDLE | CP_PSEUDO_HANDLE), "Unexpected result %x\n", res);
+ res = check_child_console_bits(cuiexec, DETACHED_PROCESS);
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE);
+ ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res);
+ res = check_child_console_bits(cuiexec, CREATE_NO_WINDOW);
+ ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_ALONE), "Unexpected result %x\n", res);
+ res = check_child_console_bits(cuiexec, DETACHED_PROCESS | CREATE_NO_WINDOW);
+ ok(res == 0, "Unexpected result %x\n", res);
+ res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW);
+ ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res);
+
+ FreeConsole();
+ }
+
AllocConsole();
res = check_child_console_bits(guiexec, 0);
@@ -4831,6 +4868,7 @@ START_TEST(console)
exit_code |= CP_ALONE;
if (RtlGetCurrentPeb()->ProcessParameters->ProcessGroupId == GetCurrentProcessId())
exit_code |= CP_GROUP_LEADER;
+ if (HandleToUlong(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle) & 3) exit_code |= CP_PSEUDO_HANDLE;
ExitProcess(exit_code);
}
More information about the wine-devel
mailing list