From 9ff782961b9cca63bd97780aaa28d2bd5104f058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 14 Jul 2013 16:57:26 +0000 Subject: [PATCH] [KERNEL32] Fix some broken logic: we can duplicate console handles only if both the source and the target processes are in fact the current process. svn path=/trunk/; revision=59486 --- reactos/dll/win32/kernel32/client/handle.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/kernel32/client/handle.c b/reactos/dll/win32/kernel32/client/handle.c index 8c18a87be31..885ea8808cc 100644 --- a/reactos/dll/win32/kernel32/client/handle.c +++ b/reactos/dll/win32/kernel32/client/handle.c @@ -170,7 +170,11 @@ DuplicateHandle(IN HANDLE hSourceProcessHandle, ((hSourceHandle != NtCurrentProcess()) && (hSourceHandle != NtCurrentThread()))) { - if ((hSourceProcessHandle != NtCurrentProcess()) && + /* + * We can duplicate console handles only if both the source + * and the target processes are in fact the current process. + */ + if ((hSourceProcessHandle != NtCurrentProcess()) || (hTargetProcessHandle != NtCurrentProcess())) { BaseSetLastNTError(STATUS_INVALID_PARAMETER);