public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [setup - the official Cygwin setup program] branch master, updated. release_2.893
@ 2018-07-26 21:47 jturney
0 siblings, 0 replies; only message in thread
From: jturney @ 2018-07-26 21:47 UTC (permalink / raw)
To: cygwin-apps-cvs
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=f378fb54ceaa4e27d53cede22f806e8798f5a04d
commit f378fb54ceaa4e27d53cede22f806e8798f5a04d
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Tue Jul 24 22:18:51 2018 +0100
Teach bitness reporting in user-agent string about WoW64 on ARM64
Diff:
---
nio-ie5.cc | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/nio-ie5.cc b/nio-ie5.cc
index 6fada0f..6202c01 100644
--- a/nio-ie5.cc
+++ b/nio-ie5.cc
@@ -31,6 +31,10 @@
#include "getopt++/StringOption.h"
#include <sstream>
+#ifndef IMAGE_FILE_MACHINE_ARM64
+#define IMAGE_FILE_MACHINE_ARM64 0xAA64
+#endif
+
static StringOption UserAgent ("", '\0', "user-agent", "User agent string for HTTP requests");
const std::string &
@@ -48,9 +52,30 @@ determine_default_useragent(void)
#ifdef __x86_64__
bitness = "Win64";
#else
+ typedef BOOL (WINAPI *PFNISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *);
+ PFNISWOW64PROCESS2 pfnIsWow64Process2 = (PFNISWOW64PROCESS2)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process2");
+
typedef BOOL (WINAPI *PFNISWOW64PROCESS)(HANDLE, PBOOL);
PFNISWOW64PROCESS pfnIsWow64Process = (PFNISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
- if (pfnIsWow64Process) {
+
+ std::stringstream native_desc;
+
+ USHORT processMachine, nativeMachine;
+ if ((pfnIsWow64Process2) &&
+ (pfnIsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine))) {
+ switch (nativeMachine)
+ {
+ case IMAGE_FILE_MACHINE_AMD64:
+ bitness = "WoW64";
+ break;
+ case IMAGE_FILE_MACHINE_ARM64:
+ bitness = "WoW64-ARM64";
+ break;
+ default:
+ native_desc << "WoW64-" << std::hex << nativeMachine;
+ bitness = native_desc.str();
+ }
+ } else if (pfnIsWow64Process) {
BOOL bIsWow64 = FALSE;
if (pfnIsWow64Process(GetCurrentProcess(), &bIsWow64))
bitness = bIsWow64 ? "WoW64" : "Win32";
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-26 21:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-26 21:47 [setup - the official Cygwin setup program] branch master, updated. release_2.893 jturney
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).