views:

44

answers:

1

I need a tool which will discover whether an arbitrary process is running in x86 or x64 mode on a machine. I need to do this programatically from C++, based on a process ID.

There has to be some way to do this (as you can clearly see it from the task manager). Does anyone know of a windows api that will tell you, given a process ID, whether the application is running under wow64?

Another approach would be to figure out, based on the process id, the executable name/path that is running and try to read the PE headers out of the file. Does anyone have a code snippet that would accomplish that?

+3  A: 

There is a WinAPI function, IsWow64Process.

James McNellis
+1. Note that you need a handle to the process to use this function, and as a result it's likely you'll need administrative privies, and you'll need to take the SE_DEBUG_NAME privilege.
Billy ONeal