You can use the IsWow64Process API IsWow64Process to determine if a process runs under 32-bit emulation on a 64-bit OS.
Here is the pinvoke link
Update . I compared this a bit with the following results:
- Enumerating all processes using
Process.GetProcesses() takes most of the time, approx. 12 ms on my laptop having 93 processes. - Getting the handle and making an
IsWow64Process call took approx. 0.1 ms per process on the same laptop. - Getting all processes using WMI takes approx. 520 ms on one laptop (93 processes also work).
Basically: if you cope with the fact that the process may disappear after you get the list, and before you manage to request it, using the pinvoke method seems to me faster and faster than using WMI. Although WMI may be less intrusive (from a process point of view).
source share