public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: console: Modify ConEmu cygwin connector hook.
Date: Mon,  1 Aug 2022 23:16:41 +0000 (GMT)	[thread overview]
Message-ID: <20220801231641.E45B23857C7E@sourceware.org> (raw)

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

commit 7a469e6dd5e211a9bc7697e9330513edad8f2690
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 | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 41b3fd6b8..b5594a673 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -3988,7 +3988,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
@@ -4031,21 +4031,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;
-#ifdef __x86_64__
-  if (strcasecmp(p, "ConEmuHk64.dll") == 0)
-#else
-  if (strcasecmp(p, "ConEmuHk.dll") == 0)
-#endif
+  if (strcmp(n, "RequestTermConnector") == 0)
     fhandler_console::set_disable_master_thread (true);
-  return LoadLibraryA_Orig (m);
+  return GetProcAddress_Orig (h, n);
 }
 
 void
@@ -4074,7 +4065,7 @@ fhandler_console::fixup_after_fork_exec (bool execing)
 static void
 hook_conemu_cygwin_connector()
 {
-  DO_HOOK (NULL, LoadLibraryA);
+  DO_HOOK (NULL, GetProcAddress);
 }
 
 // #define WINSTA_ACCESS (WINSTA_READATTRIBUTES | STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | WINSTA_CREATEDESKTOP | WINSTA_EXITWINDOWS)


                 reply	other threads:[~2022-08-01 23:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220801231641.E45B23857C7E@sourceware.org \
    --to=tyan0@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).