jperez
jperez

Reputation: 1060

C# Get processes opened by other process

I'm looking for a way to see if a process starts/triggers other processes.Google chrome is a good example for what i'm looking for:

Process p = new Process();
p.StartInfo.FileName = "chrome.exe";
p.Start();

When starting chrome it will have a PID but it seems like this process just triggers other (background) processes and then ends immediately (no PID reference?).

I could assume that any 'chrome' process with a StartTime > p.StartTime could be part of what is triggered but I don't think this is the best way to go. This process could for example start other processes with different names.

Is there a way to 'follow' everything what is triggered from the first process start?

Upvotes: 1

Views: 1710

Answers (1)

sithereal
sithereal

Reputation: 1686

You can P/Invoke NtQueryInformationProcess API function to find processes by the parent handles.

Upvotes: 1

Related Questions