I am writing an C# plug-in for an auditing application, which need to fetch a list of 32 bit applications running inside a 64-bit OS. I got stuck up at this point on how to identify a 32-bit process.
Please help me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
IsWow64Processwindows API call to determine if a process is running under 32bit emulation on a 64bit OS.Here is the pinvoke link
Update: I benchmarked this a little bit, with the following results:
Process.GetProcesses()takes the majority of the time with approx. 12ms on my laptop having 93 processes runningIsWow64Processcall took approx. 0.1ms per process on the same laptop.Basically: If you can cope with the fact that the process might go away after you obtained the list and before you managed to query it then using the pinvoke way seems faster and snappier to me than using WMI. Although WMI might be the less intrusive way (from a process standpoint of view).