It's probably bad form to answer your own question, but the person who answered this for me is not on this forum, so I figured I'd at least provide an update for posterity. Thanks go to Biswa96
https://github.com/msys2/MINGW-packages/discussions/8991
Calling GetProcessInformation
with ProcessMachineTypeInfo
appears to tell me what I want to know, but unfortunately it doesn't seem to be present in 20H2 or 21H1, only in the Insider Preview. So my answer came out something like
if (!pIsWow64Process2(process, &process_arch, &native_arch))
return FALSE;
/* The value will be IMAGE_FILE_MACHINE_UNKNOWN if the target process
* is not a WOW64 process
*/
if (process_arch == IMAGE_FILE_MACHINE_UNKNOWN)
{
struct _PROCESS_MACHINE_INFORMATION
{
/* 0x0000 */ USHORT ProcessMachine;
/* 0x0002 */ USHORT Res0;
/* 0x0004 */ DWORD MachineAttributes;
} /* size: 0x0008 */ process_machine_info;
is_wow = FALSE;
/* However, x86_64 on ARM64 claims not to be WOW64, so we have to
* dig harder... */
/*#define ProcessMachineTypeInfo 9*/
if (pGetProcessInformation &&
pGetProcessInformation(process, (PROCESS_INFORMATION_CLASS)9,
&process_machine_info, sizeof(process_machine_info)))
process_arch = process_machine_info.ProcessMachine;
else
process_arch = native_arch;
}
else
{
is_wow = TRUE;
}
return TRUE;