public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.
@ 2019-09-06 17:42 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2019-09-06 17:42 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f39a694c463c1a1ea14e60f5d03652d94e6f76ee

commit f39a694c463c1a1ea14e60f5d03652d94e6f76ee
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Fri Sep 6 22:01:27 2019 +0900

    Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.
    
    - Win32 API SetConsoleCursorPosition() injects ANSI escape sequence
      to pseudo console. Therefore, it should be added to the API list
      to be hooked.

Diff:
---
 winsup/cygwin/fhandler_tty.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 2533e56..3ffd64e 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -156,6 +156,7 @@ DEF_HOOK (WriteConsoleOutputW);
 DEF_HOOK (WriteConsoleOutputCharacterA);
 DEF_HOOK (WriteConsoleOutputCharacterW);
 DEF_HOOK (WriteConsoleOutputAttribute);
+DEF_HOOK (SetConsoleCursorPosition);
 DEF_HOOK (SetConsoleTextAttribute);
 DEF_HOOK (WriteConsoleInputA);
 DEF_HOOK (WriteConsoleInputW);
@@ -242,6 +243,13 @@ WriteConsoleOutputAttribute_Hooked
   return WriteConsoleOutputAttribute_Orig (h, a, l, c, n);
 }
 static BOOL WINAPI
+SetConsoleCursorPosition_Hooked
+     (HANDLE h, COORD c)
+{
+  set_ishybrid_and_switch_to_pcon (h);
+  return SetConsoleCursorPosition_Orig (h, c);
+}
+static BOOL WINAPI
 SetConsoleTextAttribute_Hooked
      (HANDLE h, WORD a)
 {
@@ -2952,6 +2960,7 @@ fhandler_pty_slave::fixup_after_exec ()
       DO_HOOK (NULL, WriteConsoleOutputCharacterA);
       DO_HOOK (NULL, WriteConsoleOutputCharacterW);
       DO_HOOK (NULL, WriteConsoleOutputAttribute);
+      DO_HOOK (NULL, SetConsoleCursorPosition);
       DO_HOOK (NULL, SetConsoleTextAttribute);
       DO_HOOK (NULL, WriteConsoleInputA);
       DO_HOOK (NULL, WriteConsoleInputW);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-06 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 17:42 [newlib-cygwin] Cygwin: pty: Make SetConsoleCursorPosition() to be hooked Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).