Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / dll / win32 / kernel32 / client / handle.c
index 8c18a87..885ea88 100644 (file)
@@ -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);