[PATCH 0/1] Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/1] Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.

Takashi Yano
- Win32 API SetConsoleCursorPosition() injects ANSI escape sequence
  to pseudo console. Therefore, it should be added to the API list
  to be hooked.

Takashi Yano (1):
  Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.

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

--
2.21.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1] Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.

Takashi Yano
- Win32 API SetConsoleCursorPosition() injects ANSI escape sequence
  to pseudo console. Therefore, it should be added to the API list
  to be hooked.
---
 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 150530c5e..de1c1ae6f 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)
 {
@@ -2960,6 +2968,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);
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/1] Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.

Ken Brown-6
In reply to this post by Takashi Yano
On 9/6/2019 9:01 AM, Takashi Yano wrote:
> - Win32 API SetConsoleCursorPosition() injects ANSI escape sequence
>    to pseudo console. Therefore, it should be added to the API list
>    to be hooked.
>
> Takashi Yano (1):
>    Cygwin: pty: Make SetConsoleCursorPosition() to be hooked.
>
>   winsup/cygwin/fhandler_tty.cc | 9 +++++++++
>   1 file changed, 9 insertions(+)

Pushed.

Thanks.

Ken