How to capture information from a 64-bit process that is running?

Asked

Viewed 135 times

2

Well, I need help to capture the information of a running process. I can accomplish this task by accessing the mainmodule 32-bit processes, however, I cannot do the same with 64-bit processes. I don’t know if the reason is I’m trying to access such information through a 32-bit application. I can access the mainmodule 64-bit processes, however, the return is null.

foreach (Process clsProcess in Process.GetProcesses())
        {
            //Capturando a descrição de um processo em execução
            string nomeProd = clsProcess.MainModule.FileVersionInfo.FileDescription.ToString();
        }

As stated, it works perfectly on a 32-bit computer, as it does not contain 64-bit programs. However, I am developing the application for both types(32 and 64), and I need help to capture the information of a 64-bit process.

2 answers

2


How about generating a 64-bit application and being happy like that? This is the most suitable solution.

If you still want to continue on 32 bits and just don’t want the error to stop the application, just capture the exception Win32Exception. Take the 32-bit processes and ignore the 64-bit.

In general it takes administrator privilege to perform this. Still you will not have access to all processes, this is normal, so capturing this exception is important.

There’s a response in the OS that uses the Windows API directly and can help. I don’t know if it helps you.

There’s a solution in the OS written in VB.NET using System.Management which can also help.

I hope this at least leads one way.

  • Yeah, I just... Now I have a 32 and a 64 but, after I switched to 64 Bites, a description error occurred "A single Valid machine type compatible with the input type library must be specified". File - Tlbimp. Do you know what it can be? The application runs normally, because I have already packed the dlls and everything. But, this error remains.

  • @Wesley.Rain don’t know, see if this helps: http://stackoverflow.com/q/2450509/221800

0

If your application is written in managed code, it can be compiled to "Any CPU", so it will behave according to the running operating system.
You will get process information running in 32 and 64 bit.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.