diff options
Diffstat (limited to 'src/envmodule.cpp')
| -rw-r--r-- | src/envmodule.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/envmodule.cpp b/src/envmodule.cpp index 8d348b5e..5be52de6 100644 --- a/src/envmodule.cpp +++ b/src/envmodule.cpp @@ -545,23 +545,20 @@ void findChildren(Process& parent, const std::vector<Process>& processes) Process getProcessTreeFromProcess(HANDLE h) { + Process root; + const auto parentPID = ::GetProcessId(h); const auto v = getRunningProcesses(); - Process root; for (auto&& p : v) { if (p.pid() == parentPID) { - root = p; + Process child = p; + findChildren(child, v); + root.addChild(child); break; } } - if (root.pid() == 0) { - return {}; - } - - findChildren(root, v); - return root; } |
