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.
This commit is contained in:
Takashi Yano 2019-09-06 22:01:27 +09:00 committed by Ken Brown
parent b38e10fdbe
commit 381b74f6b4
1 changed files with 9 additions and 0 deletions

View File

@ -156,6 +156,7 @@ DEF_HOOK (WriteConsoleOutputW);
DEF_HOOK (WriteConsoleOutputCharacterA); DEF_HOOK (WriteConsoleOutputCharacterA);
DEF_HOOK (WriteConsoleOutputCharacterW); DEF_HOOK (WriteConsoleOutputCharacterW);
DEF_HOOK (WriteConsoleOutputAttribute); DEF_HOOK (WriteConsoleOutputAttribute);
DEF_HOOK (SetConsoleCursorPosition);
DEF_HOOK (SetConsoleTextAttribute); DEF_HOOK (SetConsoleTextAttribute);
DEF_HOOK (WriteConsoleInputA); DEF_HOOK (WriteConsoleInputA);
DEF_HOOK (WriteConsoleInputW); DEF_HOOK (WriteConsoleInputW);
@ -242,6 +243,13 @@ WriteConsoleOutputAttribute_Hooked
return WriteConsoleOutputAttribute_Orig (h, a, l, c, n); return WriteConsoleOutputAttribute_Orig (h, a, l, c, n);
} }
static BOOL WINAPI 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 SetConsoleTextAttribute_Hooked
(HANDLE h, WORD a) (HANDLE h, WORD a)
{ {
@ -2952,6 +2960,7 @@ fhandler_pty_slave::fixup_after_exec ()
DO_HOOK (NULL, WriteConsoleOutputCharacterA); DO_HOOK (NULL, WriteConsoleOutputCharacterA);
DO_HOOK (NULL, WriteConsoleOutputCharacterW); DO_HOOK (NULL, WriteConsoleOutputCharacterW);
DO_HOOK (NULL, WriteConsoleOutputAttribute); DO_HOOK (NULL, WriteConsoleOutputAttribute);
DO_HOOK (NULL, SetConsoleCursorPosition);
DO_HOOK (NULL, SetConsoleTextAttribute); DO_HOOK (NULL, SetConsoleTextAttribute);
DO_HOOK (NULL, WriteConsoleInputA); DO_HOOK (NULL, WriteConsoleInputA);
DO_HOOK (NULL, WriteConsoleInputW); DO_HOOK (NULL, WriteConsoleInputW);