- 1 year ago
C++: IsWow64Process2: What valid WOW64 process architecture values can be returned via the pProcessMachine parameter?
The IsWow64Process2
function is used to determine the process architecture on a WOW64 system. The pProcessMachine
parameter is an output parameter that receives the process architecture value.
The valid values that can be returned via the pProcessMachine
parameter are defined in the PROCESS_MACHINE_INFORMATION
structure, which is passed as the lpProcessMachine
argument to IsWow64Process2
. The possible values are:
PROCESS_MACHINE_AMD64
(0x8664): The process is running in 64-bit mode on a 64-bit system (x64 architecture).PROCESS_MACHINE_ARM
(0x1C04): The process is running on an ARM processor.PROCESS_MACHINE_ARM64
(0xAA64): The process is running on an ARM64 processor.PROCESS_MACHINE_IA32_ON_WIN64
(0x200): The process is running in 32-bit mode on a 64-bit system (x86 architecture).
These values represent the different supported architectures on a WOW64 system. Note that IsWow64Process2
is available starting from Windows 8.1 and Windows Server 2012 R2.
Here's an example of how you can use IsWow64Process2
to determine the process architecture:
cpp#include <Windows.h>
#include <iostream>
int main()
{
BOOL isWow64 = FALSE;
USHORT processMachine = 0;
if (IsWow64Process2(GetCurrentProcess(), &processMachine) && processMachine != 0)
{
if (processMachine == PROCESS_MACHINE_AMD64)
std::cout << "Process is running in 64-bit mode on a 64-bit system (x64 architecture).\n";
else if (processMachine == PROCESS_MACHINE_ARM)
std::cout << "Process is running on an ARM processor.\n";
else if (processMachine == PROCESS_MACHINE_ARM64)
std::cout << "Process is running on an ARM64 processor.\n";
else if (processMachine == PROCESS_MACHINE_IA32_ON_WIN64)
std::cout << "Process is running in 32-bit mode on a 64-bit system (x86 architecture).\n";
else
std::cout << "Unknown process architecture.\n";
}
else
{
std::cout << "Failed to determine process architecture.\n";
}
return 0;
}
This example checks the process architecture using IsWow64Process2
and prints the corresponding architecture message.
Keep in mind that IsWow64Process2
requires the application to have appropriate privileges to query the process architecture.