On May 19 11:02, Jeremy Drake via Cygwin-patches wrote:
> 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

Pushed.

Thanks,
Corinna

Reply via email to