views:

1314

answers:

3

I am trying to write a C# program to retrieve a complete process list. However I find that an application open a window but I don't see it in the process tab of WinXP task manager, I see it in task tab. In addition, I also cannot get its information using my C# code.

static void showProcesses()
{
    Process[] procs = Process.GetProcesses();

    foreach (Process proc in procs)
    {
        Console.WriteLine(proc.ProcessName);
    }
}

I browse many forums but I can only find the methods to hide a process, and I don't find any method for showing hidden processes... Do anyone have idea how to retrieve hidden process information?

Many thanks.

+1  A: 

There are no hidden processes on Windows. Only processes you do not have (security) rights to see.

A process running as an administrator (in Vista/Win7/Win2k8 would need to be elevated) will always be able to see all processes.

However, a console application that lists the processes may well exit before Task Manager's display refreshes, and thus won't be seen. This is likely with a simple program even with update speed set to "high".

You need to keep your process around until Task manager has updated its display. The simplest way would be do add the following statements to the end of your Main method:

Console.Write("Press ENTER to exit");
Console.ReadLine();
Richard
A: 

I'm not sure what you mean. The code above lists the same number of processes as pslist. When you talk about methods to hide a process are you talking about root kits? If so they usually work by changing how the list commands work. I.e. the processes are in fact being enumerated, but the info is not displayed to the user.

Brian Rasmussen
A: 

it works just fine all you need is add :

Console.Write("Press ENTER to exit");
Console.ReadLine();

at the end or start project with ctrl + F5

Yassir