public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Jeremy Drake <cygwin@jdrake.com>
To: cygwin-patches@cygwin.com
Subject: Re: [RFC] FAST_CWD warnings on ARM64 insider preview
Date: Wed, 19 May 2021 11:02:08 -0700 (PDT)	[thread overview]
Message-ID: <alpine.BSO.2.21.2105191040270.14962@resin.csoft.net> (raw)
In-Reply-To: <YKTfJ2kVCsV+yT3g@calimero.vinschen.de>

On Wed, 19 May 2021, Corinna Vinschen wrote:

> > +#ifndef IMAGE_FILE_MACHINE_ARM64
> > +#define IMAGE_FILE_MACHINE_ARM64 0xAA64
> > +#endif
>
> IMAGE_FILE_MACHINE_ARM64 is already defined for some time in winnt.h
> so we won't need the ifdef.

OK.  Was just matching what was done with PROCESSOR_ARCHITECTURE_ARM64.

> > +      typedef BOOL (WINAPI * IsWow64Process2_t)(HANDLE hProcess, USHORT *pProcessMachine, USHORT *pNativeMachine);
> > +      IsWow64Process2_t pfnIsWow64Process2 = (IsWow64Process2_t)GetProcAddress(GetModuleHandle("kernel32.dll"), "IsWow64Process2");
> > +      if (pfnIsWow64Process2 && pfnIsWow64Process2(GetCurrentProcess(), &procmachine, &nativemachine) && nativemachine == IMAGE_FILE_MACHINE_ARM64)
>
> We're having the autoload mechanism for that, i. e., your patch can get
> rid of the GetModuleHandle/GetProcAddress preliminaries entirely.
>
> By using the LoadDLLfuncEx() expression, failure to load the function
> will result in a return value of FALSE with GetLastError ==
> ERROR_PROC_NOT_FOUND, so this is safe on older systems.

Nice.

> It's easier to understand with a full example, so I took the liberty to
> rewrite your patch accordingly.  Since the idea and the basic work is
> yours, I'd push this under your name, see below.

Looks good.  Thanks

  reply	other threads:[~2021-05-19 18:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 18:56 Jeremy Drake
2021-05-19  9:49 ` Corinna Vinschen
2021-05-19 18:02   ` Jeremy Drake [this message]
2021-05-20  7:17     ` Corinna Vinschen

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=alpine.BSO.2.21.2105191040270.14962@resin.csoft.net \
    --to=cygwin@jdrake.com \
    --cc=cygwin-patches@cygwin.com \
    /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).