DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 44UD6d9A2107400 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=eCHH3yHy X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1868B385E830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1717074398; bh=vYIn1rmPFdimFsMllLcTNNBqor4q0mVIF4Mre6CbpOA=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=eCHH3yHyHf/e4nJnwuetEpRfELtuSV1Iv0TzYQgmnEnDvSKaXyFIkWK9sxcdMN63i ktSvfc2QE/TphdSDAWjQFp4SUix2oyWUimZN0EZuBAK0cQ5mULJTWV6wX6b8bTXaUU Io1YlqGcP4Q8I0gmIrT27pakqAVdTvfIW9g9Jqqk= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 14F80385B529 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 14F80385B529 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717074333; cv=none; b=nw2jGdL9JbU11Nm0DzbtLCRUEZFxL+CxEZV4WJ5KtBH5/JXA1m3BsFH+heyf6F8M9/Q/fNFUHxYfEvJLQ+q5pLn5hiAD6VARnPIRXLj6ap4dQwVpPNwJ2/byWpwf0gWMwXq3s590StamtNcbXRb3Wez59L0+sGnCyac3sEwrJ+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717074333; c=relaxed/simple; bh=7qUKK2zzMRdFlfgyTqu3HqLOUV0QWOYM0jgj452cb4o=; h=Message-ID:Date:MIME-Version:From:Subject:To; b=uepdeGX7W9drf2dnuq52Lmj030ul+nNfOVglKGwNHLHS748pProSVwY4+VFpj2F1x06QgxsoJ9ENrxmm6fklekk/glDTkCkuZiIQRQToGuNEEG9z8EKx6XX48CAL4O+jWzdj0SBb3rKD3Vmb95GZ9O6l4Y40U4ykdfDlUILx4E8= ARC-Authentication-Results: i=1; server2.sourceware.org X-SNCR-Rigid: 656684A015A4597D X-Originating-IP: [86.139.167.83] X-OWM-Source-IP: 86.139.167.83 X-OWM-Env-Sender: jon DOT turney AT dronecode DOT org DOT uk X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvledrvdekgedgheejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfhuffvvehfjggtgfesthejredttddvjeenucfhrhhomheplfhonhcuvfhurhhnvgihuceojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqnecuggftrfgrthhtvghrnhepheffgfegkeeuudetiefgkeevtdekfefgleffvddtheelfeeugfdtkeefheekheevnecukfhppeekiedrudefledrudeijedrkeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurddutdelngdpihhnvghtpeekiedrudefledrudeijedrkeefpdhmrghilhhfrhhomhepjhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukhdpnhgspghrtghpthhtohepvddprhgtphhtthhopegthihgfihinhestgihghifihhnrdgtohhmpdhrtghpthhtohepmhgrrhhtihhnrdhlrdifvghgvgesghhmrghilhdrtghomhdprhgvvhfkrfephhhoshhtkeeiqddufeelqdduieejqdekfedrrhgrnhhgvgekiedqudefledrsghttggvnhhtrhgrlhhplhhushdrtghomhdprghuthhhpghushgvrhepjhhonhhtuhhrnhgvhiessghtihhnthgvrhhnvghtrdgtohhm pdhgvghokffrpefiuedpoffvtefjohhsthepshgrqdhprhguqdhrghhouhhtqddttddu X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Message-ID: Date: Thu, 30 May 2024 14:05:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: LD_PRELOAD for Win32? To: Martin Wege Cc: cygwin AT cygwin DOT com References: Content-Language: en-US In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jon Turney via Cygwin Reply-To: Jon Turney Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On 25/05/2024 22:55, Martin Wege via Cygwin wrote: > Hello, > > Does Cygwin or Win32 have something like LD_PRELOAD, so I can > override/substitute functions in a DLL or EXE, like it is common for > UNIX/Linux ELF shared libraries? This is not generally available on Win32, due to limitations of the PE file format. (basically, the import table lists symbols which are imported, and where they are imported from, so the module (shared library or executable) which provides a given symbol is determined when the module is *linked*, not when it is loaded. However, when googling "cygwin LD_PRELOAD" (which surely you must have done before asking this question?) I discover that there's some voodoo in the cygwin DLL (hookapi.cc) which claims to do something like that, but it seems (i) this requires the preloaded DLL to explicitly hook functions it's overriding, and (ii) maybe only works on functions imported by the running executable. It would be nice to have some documentation for that, and/or a simple example which could serve as a testcase. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple