Jacek Caban : kernel32: Use PEB console handle in CONSOLE_HandleCtrlC to check console connection.

Alexandre Julliard julliard at winehq.org
Thu Aug 13 15:11:52 CDT 2020


Module: wine
Branch: master
Commit: 0451e44d957325e9de348b8701058e19ce47dc57
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0451e44d957325e9de348b8701058e19ce47dc57

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug 13 16:01:37 2020 +0200

kernel32: Use PEB console handle in CONSOLE_HandleCtrlC to check console connection.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/console.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index e7894e3b02..ab97144e98 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -659,9 +659,7 @@ LONG CALLBACK CONSOLE_HandleCtrlC( EXCEPTION_POINTERS *eptr )
     HANDLE thread;
 
     if (eptr->ExceptionRecord->ExceptionCode != CONTROL_C_EXIT) return EXCEPTION_CONTINUE_SEARCH;
-
-    /* FIXME: better test whether a console is attached to this process ??? */
-    if (CONSOLE_GetNumHistoryEntries() == (unsigned)-1) return EXCEPTION_CONTINUE_SEARCH;
+    if (!RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle)  return EXCEPTION_CONTINUE_SEARCH;
 
     /* check if we have to ignore ctrl-C events */
     if (!(NtCurrentTeb()->Peb->ProcessParameters->ConsoleFlags & 1))




More information about the wine-cvs mailing list