CreateProcess functionCreates a new process and its primary thread. The new process runs in the security context of the calling process. If the calling process is impersonating another user, the new process uses the token for the calling process, not the impersonation token. To run the new process in the security context of the user represented by the impersonation token, use the CreateProcessAsUser or CreateProcessWithLogonW function.
msdn上有完整例子:Taking a Snapshot and Viewing Processes你的要求可能稍有不同但是改改例子还是很容易的,不过就是用列表记录下所以进程信息,然后判断里面theParentProcessId == 你需要的父进程id的那些进程而已
If the calling process is impersonating another user, the new process uses the token for the calling process, not the impersonation token. To run the new process in the security context of the user represented by the impersonation token, use the CreateProcessAsUser or CreateProcessWithLogonW function.
>>>不是这样的,进程A和进程B是同级的,不存在进程Bj进程A的子进程这一说。