From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fencepost.gnu.org (fencepost.gnu.org [IPv6:2001:470:142:3::e]) by sourceware.org (Postfix) with ESMTPS id 0842C3858D33; Sat, 21 Jan 2023 11:42:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0842C3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=L5Ry/iZsZ4YfqSAsqMaFr9YnrcV+Ep8NCSSUel4I74s=; b=QyW8fRfapIsn By0Hd70tXLaEPH6qLR013OLpFizsqvlJjq0gGeGsNbdCdXl88m44HXN7sKPiuKp69Ki8gmF7SbFfU 1xDNjVwYawx8trQEVCaYze9gKv1W4TkibXnFS8UmrH4ExoXP5j6wTKkd3KZlaWIBtCad0/nOLe3s3 9zMSnEOholZdUIdlDdGTNTxLGWazLOzh5Xg4vPJg5QqXj/nyjZBfqK3GKv9n2+0myR1MF9U4ROL1W v9KbutLGQmbnzvu45ICrcyFruHWnE5ZLcVGTXJh6kltoPpvhc2bJUw+QM6wjkrpbFwZt3CKAJucP9 Y1iK7pa18bXzR1ztgZHYAg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJCGA-0002St-MH; Sat, 21 Jan 2023 06:42:11 -0500 Date: Sat, 21 Jan 2023 13:42:13 +0200 Message-Id: <83pmb8ktbe.fsf@gnu.org> From: Eli Zaretskii To: Gabriel Ravier Cc: gcc@hazardy.de, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org In-Reply-To: (message from Gabriel Ravier on Sat, 21 Jan 2023 11:47:42 +0100) Subject: Re: [PATCH 3/4] libbacktrace: work with aslr on windows References: <20230120105409.54949-1-gcc@hazardy.de> <20230120105409.54949-3-gcc@hazardy.de> <83zgadmik1.fsf@gnu.org> <83k01hm2sm.fsf@gnu.org> <64148e01-15a1-0331-ad52-bf131403ed76@gmail.com> <83h6wkmt0t.fsf@gnu.org> X-Spam-Status: No, score=2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Date: Sat, 21 Jan 2023 11:47:42 +0100 > Cc: gcc@hazardy.de, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org > From: Gabriel Ravier > > > On 1/21/23 05:05, Eli Zaretskii wrote: > >> Date: Fri, 20 Jan 2023 21:39:56 +0100 > >> Cc: gcc@hazardy.de, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org > >> From: Gabriel Ravier > >> > >>>> - using wide APIs with Windows is generally considered to be a best > >>>> practice, even when not strictly needed (and in this case I can't see > >>>> any problem with doing so, unless maybe we want to code to work with > >>>> Windows 95 or something like that...) > >>> There's no reason to forcibly break GDB on platforms where wide APIs > >>> are not available. > >> Are there even any platforms that have GetModuleHandleA but not > >> GetModuleHandleW ? MSDN states that Windows XP and Windows Server 2003 > >> are the first versions to support both of the APIs, so if this is > >> supposed to work on Windows 98, for instance, whether we're using > >> GetModuleHandleA or GetModuleHandleW won't matter. > > I'm not sure I follow the logic. A program that calls > > GetModuleHandleW will refuse to start on Windows that doesn't have > > that API. So any version before XP is automatically excluded the > > moment you use code which calls that API directly (i.e. not through a > > function pointer or somesuch). > A program that calls GetModuleHandleA will also refuse to start on > Windows if it doesn't have that API. The set of Windows versions that do > not have GetModuleHandleA is, according to MSDN, the same as the set of > Windows versions that do not have GetModuleHandleW. MSDN lies (because it wants to pretend that older versions don't exist). Try this much more useful site: http://winapi.freetechsecrets.com/win32/WIN32GetModuleHandle.htm