public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: console: Modify ConEmu cygwin connector hook.
@ 2022-08-01 23:14 Takashi Yano
  0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2022-08-01 23:14 UTC (permalink / raw)
  To: cygwin-cvs

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

commit bfee9c6ab0c3c9a5742e84509d01ec6472aa62c4
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Tue Aug 2 07:42:53 2022 +0900

    Cygwin: console: Modify ConEmu cygwin connector hook.
    
    - Previously, LoadLibraryA() is hooked for ConEmu cygwin connector.
      With this patch, GetProcAddress() for "RequestTermConnector" is
      hooked instead which is more essential for ConEmu cygwin connector.

Diff:
---
 winsup/cygwin/fhandler_console.cc | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index d17f03acf..e3d87331f 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -3986,7 +3986,7 @@ fhandler_console::set_console_mode_to_native ()
 DEF_HOOK (CreateProcessA);
 DEF_HOOK (CreateProcessW);
 DEF_HOOK (ContinueDebugEvent);
-DEF_HOOK (LoadLibraryA); /* Hooked for ConEmu cygwin connector */
+DEF_HOOK (GetProcAddress); /* Hooked for ConEmu cygwin connector */
 
 static BOOL WINAPI
 CreateProcessA_Hooked
@@ -4029,17 +4029,12 @@ ContinueDebugEvent_Hooked
 }
 
 /* Hooked for ConEmu cygwin connector */
-static HMODULE WINAPI
-LoadLibraryA_Hooked (LPCSTR m)
+static FARPROC WINAPI
+GetProcAddress_Hooked (HMODULE h, LPCSTR n)
 {
-  const char *p;
-  if ((p = strrchr(m, '\\')))
-    p++;
-  else
-    p = m;
-  if (strcasecmp(p, "ConEmuHk64.dll") == 0)
+  if (strcmp(n, "RequestTermConnector") == 0)
     fhandler_console::set_disable_master_thread (true);
-  return LoadLibraryA_Orig (m);
+  return GetProcAddress_Orig (h, n);
 }
 
 void
@@ -4068,7 +4063,7 @@ fhandler_console::fixup_after_fork_exec (bool execing)
 static void
 hook_conemu_cygwin_connector()
 {
-  DO_HOOK (NULL, LoadLibraryA);
+  DO_HOOK (NULL, GetProcAddress);
 }
 
 /* Ugly workaround to create invisible console required since Windows 7.


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

only message in thread, other threads:[~2022-08-01 23:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 23:14 [newlib-cygwin] Cygwin: console: Modify ConEmu cygwin connector hook Takashi Yano

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).