On Nov 25 11:21, Jeremy Drake via Cygwin-patches wrote:
> From: Jeremy Drake <cyg...@jdrake.com>
> 
> This was already used in the FAST_CWD check, and could be used in a
> couple other places.
> 
> I found the "emulated"/process value returned from the function largely
> useless, so I did not cache it.  It is useless because, as the docs say,
> it is set to IMAGE_FILE_MACHINE_UNKNOWN (0) if the process is not
> running under WOW64, but Microsoft also doesn't consider x64-on-ARM64 to
> be WOW64, so it is set to 0 regardless if the process is ARM64 or x64.
> You can tell the difference via
> GetProcessInformation(ProcessMachineTypeInfo), but for the current
> process even that's overkill: what we really want to know is the
> IMAGE_FILE_MACHINE_* constant for the Cygwin dll itself, which is
> conveniently located in memory already, so make an accessor function to
> access that.  (It could also be cached in a member variable for a
> simpler accessor, and looked up in init).
> 
> Signed-off-by: Jeremy Drake <cyg...@jdrake.com>
> ---
> v2: rename current_module_machine to cygwin_machine, adjust comment and
> remove ifdefs from fallback case when IsWow64Process2 fails.
> 
>  winsup/cygwin/local_includes/wincap.h |  3 +++
>  winsup/cygwin/path.cc                 |  6 ++----
>  winsup/cygwin/wincap.cc               | 22 ++++++++++++++++++++++
>  3 files changed, 27 insertions(+), 4 deletions(-)
> [...]
> +extern const IMAGE_DOS_HEADER
> +dosheader __asm__ ("__image_base__");

On second thought, shouldn't we just use GetModuleHandle ("cygwin1.dll")
instead of going asm here?


Thanks,
Corinna

Reply via email to