[PATCH 1/3] kernel32/tests: Add test for GetConsoleProcessList.
Jacek Caban
jacek at codeweavers.com
Tue Feb 8 15:21:56 CST 2022
Hi Roman,
On 2/4/22 19:03, Roman Pišl wrote:
> Signed-off-by: Roman Pišl <rpisl at seznam.cz>
> ---
> dlls/kernel32/tests/console.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
> index e4d9d43f4c4..94a0a370462 100644
> --- a/dlls/kernel32/tests/console.c
> +++ b/dlls/kernel32/tests/console.c
> @@ -1304,8 +1304,8 @@ static void test_GetConsoleProcessList(void)
> GetLastError());
>
> /* We should only have 1 process but only for these specific unit tests as
> - * we created our own console. An AttachConsole(ATTACH_PARENT_PROCESS) would
> - * give us two processes for example.
> + * we created our own console. An AttachConsole(ATTACH_PARENT_PROCESS)
> + * gives us two processes - see test_AttachConsole.
> */
> list = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD));
>
> @@ -4354,6 +4354,20 @@ static void test_AttachConsole_child(DWORD console_pid)
> res = AttachConsole(ATTACH_PARENT_PROCESS);
> ok(res, "AttachConsole failed: %u\n", GetLastError());
>
> + if (pGetConsoleProcessList)
> + {
> + DWORD list[2];
> + DWORD pid = GetCurrentProcessId();
> + SetLastError(0xdeadbeef);
> + len = pGetConsoleProcessList(list, 2);
> + todo_wine
> + ok(len == 2, "Expected 2, got %d\n", len);
> + todo_wine
> + ok(list[0] == console_pid || list[1] == console_pid, "Parent PID not in list\n");
> + todo_wine
> + ok(list[0] == pid || list[1] == pid, "PID not in list\n");
> + }
> +
> ok(pipe_in != GetStdHandle(STD_INPUT_HANDLE), "std handle not set to console\n");
> ok(pipe_out != GetStdHandle(STD_OUTPUT_HANDLE), "std handle not set to console\n");
This test looks fine, but it would be also interesting to pass length 1
here. We have an opportunity to test STATUS_BUFFER_TOO_SMALL now (that
was not possible when only one process was on the list).
Thanks,
Jacek
More information about the wine-devel
mailing list