From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sa-prd-fep-049.btinternet.com (mailomta14-sa.btinternet.com [213.120.69.20]) by sourceware.org (Postfix) with ESMTPS id C6663385B834 for ; Tue, 24 Mar 2020 23:56:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C6663385B834 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=jon.turney@dronecode.org.uk Received: from sa-prd-rgout-005.btmx-prd.synchronoss.net ([10.2.38.8]) by sa-prd-fep-049.btinternet.com with ESMTP id <20200324235608.FMTS28510.sa-prd-fep-049.btinternet.com@sa-prd-rgout-005.btmx-prd.synchronoss.net>; Tue, 24 Mar 2020 23:56:08 +0000 Authentication-Results: btinternet.com; auth=pass (PLAIN) smtp.auth=jonturney@btinternet.com X-Originating-IP: [31.51.206.134] X-OWM-Source-IP: 31.51.206.134 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedugedrudehvddgudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheplfhonhcuvfhurhhnvgihuceojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqnecukfhppeefuddrhedurddvtdeirddufeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurdduudejngdpihhnvghtpeefuddrhedurddvtdeirddufeegpdhmrghilhhfrhhomhepoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqecuuefqffgjpeekuefkvffokffogfdprhgtphhtthhopeeoghgusgdqphgrthgthhgvshesshhouhhrtggvfigrrhgvrdhorhhgqedprhgtphhtthhopeeoshhssghsshgrseihrghhohhordguvgeq X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from [192.168.1.117] (31.51.206.134) by sa-prd-rgout-005.btmx-prd.synchronoss.net (5.8.340) (authenticated as jonturney@btinternet.com) id 5E3A290C07994ACC; Tue, 24 Mar 2020 23:56:08 +0000 Subject: Re: [PATCH v2] Fix WOW64 process system DLL paths To: Hannes Domani , gdb-patches@sourceware.org References: <20200324192351.3904-1-ssbssa.ref@yahoo.de> <20200324192351.3904-1-ssbssa@yahoo.de> From: Jon Turney Message-ID: Date: Tue, 24 Mar 2020 23:56:07 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200324192351.3904-1-ssbssa@yahoo.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2020 23:56:11 -0000 On 24/03/2020 19:23, Hannes Domani via Gdb-patches wrote: > GetModuleFileNameEx returns for some DLLs of WOW64 processes > the path inside the 64bit system directory instead of the 32bit > syswow64 directory. > > Problem happens e.g. with dbghelp.dll: > > (gdb) start > Temporary breakpoint 1 at 0x415a00: file fiber.cpp, line 430. > Starting program: C:\src\tests\fiber.exe > warning: `C:\Windows\system32\dbghelp.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386. > > Temporary breakpoint 1, main () at fiber.cpp:430 > 430 { > (gdb) info sharedlibrary > From To Syms Read Shared Object Library > 0x77070000 0x771d4d20 Yes (*) C:\Windows\SysWOW64\ntdll.dll > 0x74dc0000 0x74ebad9c Yes (*) C:\Windows\syswow64\kernel32.dll > 0x75341000 0x75386a18 Yes (*) C:\Windows\syswow64\KernelBase.dll > 0x6f6a1000 0x6f7c48fc Yes (*) C:\Windows\system32\dbghelp.dll > 0x74d01000 0x74dab2c4 Yes (*) C:\Windows\syswow64\msvcrt.dll > (*): Shared library is missing debugging information. > > This detects this situation and converts the DLL path to the > syswow64 equivalent. > [...] > #else > name = dll_name; > #endif > +#ifdef __x86_64__ > + /* Convert the DLL path of WOW64 processes returned by > + GetModuleFileNameEx from the 64bit system directory to the > + 32bit syswow64 directory if necessary. */ > + std::string syswow_dll_path; > + if (wow64_process > + && strncasecmp (name, system_dir, system_dir_len) == 0 > + && strchr (name + system_dir_len, '\\') == nullptr) > + { > + syswow_dll_path = syswow_dir; > + syswow_dll_path += name + system_dir_len; > + name = syswow_dll_path.c_str(); > + } > +#endif > DLLs we become aware of via handle_load_dll() don't get this treatment. Can you share your reasoning about that?