From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 63650385802B; Mon, 1 Aug 2022 23:14:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63650385802B Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Modify ConEmu cygwin connector hook. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: d5229f821160c9e9875c4b662f5be097b7cf6d18 X-Git-Newrev: bfee9c6ab0c3c9a5742e84509d01ec6472aa62c4 Message-Id: <20220801231423.63650385802B@sourceware.org> Date: Mon, 1 Aug 2022 23:14:23 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2022 23:14:23 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dbfee9c6ab0c= 3c9a5742e84509d01ec6472aa62c4 commit bfee9c6ab0c3c9a5742e84509d01ec6472aa62c4 Author: Takashi Yano Date: Tue Aug 2 07:42:53 2022 +0900 Cygwin: console: Modify ConEmu cygwin connector hook. =20 - 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_con= sole.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 */ =20 static BOOL WINAPI CreateProcessA_Hooked @@ -4029,17 +4029,12 @@ ContinueDebugEvent_Hooked } =20 /* 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 =3D strrchr(m, '\\'))) - p++; - else - p =3D m; - if (strcasecmp(p, "ConEmuHk64.dll") =3D=3D 0) + if (strcmp(n, "RequestTermConnector") =3D=3D 0) fhandler_console::set_disable_master_thread (true); - return LoadLibraryA_Orig (m); + return GetProcAddress_Orig (h, n); } =20 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); } =20 /* Ugly workaround to create invisible console required since Windows 7.