I'm using CreateProcess to exec Notepad.exe, but the process parent of notepad is my own AP. When I closed my own AP, the process parent of notepad became to explorer. How would I do to put explorer as process parent for this new opened process?
我正在使用CreateProcess来执行Notepad.exe,但记事本的进程父进程是我自己的AP。当我关闭自己的AP时,记事本的进程父母成了探险家。如何将资源管理器作为此新打开过程的进程父级?
3 个解决方案
#1
This question makes no sense. Windows does not have a real parent child relationship between processes in the way other OS's might. Incidentally, some in formation about the launching process is kept, but, outside of the CreateProcess launch code, that duplicates handles and the environment from the parent process, there is no further special relationship between the processes. They run, completely independently, as peers.
这个问题毫无意义。 Windows在其他操作系统可能的方式之间没有真正的父子关系。顺便提一下,保留了一些有关启动过程的信息,但是,在CreateProcess启动代码之外,它复制了来自父进程的句柄和环境,这些进程之间没有进一步的特殊关系。它们完全独立地作为同伴运行。
Some taskmanagers do show a heirachical relationship implying that parent child relationships persist, but ultimately thats just derived by scanning the list of processes creation info to see if matches can be found that imply other processes were their creator - and hence parent.
一些任务管理员确实表现出一种意味着父子关系持续存在的神秘关系,但最终只能通过扫描进程创建信息列表来查看是否可以找到匹配,这意味着其他进程是他们的创建者 - 因此也就是父进程。
#2
Try using CreateRemoteThread() to create a new thread inside the address space of explorer.exe (if it is running), and then have that thread launch Notepad.
尝试使用CreateRemoteThread()在explorer.exe的地址空间内创建一个新线程(如果它正在运行),然后让该线程启动记事本。
#3
There is no built in way to set explorer.exe as the parent process right away. However, from what I can tell you can use p/invoke to make some calls to accomplish this.
没有内置的方法可以立即将explorer.exe设置为父进程。但是,据我所知,您可以使用p / invoke进行一些调用来完成此任务。
Here is an article about the implementation using p/invoke to start as another user. THis gets you the intro to the p/invoke process. Then here is an article that talks about launching a non-child process. You can combine the information from the two to accomplish your desired goal.
这是一篇关于使用p / invoke作为另一个用户启动的实现的文章。这将为您提供p / invoke过程的介绍。接下来是一篇关于启动非子进程的文章。您可以结合两者中的信息来实现您期望的目标。
#1
This question makes no sense. Windows does not have a real parent child relationship between processes in the way other OS's might. Incidentally, some in formation about the launching process is kept, but, outside of the CreateProcess launch code, that duplicates handles and the environment from the parent process, there is no further special relationship between the processes. They run, completely independently, as peers.
这个问题毫无意义。 Windows在其他操作系统可能的方式之间没有真正的父子关系。顺便提一下,保留了一些有关启动过程的信息,但是,在CreateProcess启动代码之外,它复制了来自父进程的句柄和环境,这些进程之间没有进一步的特殊关系。它们完全独立地作为同伴运行。
Some taskmanagers do show a heirachical relationship implying that parent child relationships persist, but ultimately thats just derived by scanning the list of processes creation info to see if matches can be found that imply other processes were their creator - and hence parent.
一些任务管理员确实表现出一种意味着父子关系持续存在的神秘关系,但最终只能通过扫描进程创建信息列表来查看是否可以找到匹配,这意味着其他进程是他们的创建者 - 因此也就是父进程。
#2
Try using CreateRemoteThread() to create a new thread inside the address space of explorer.exe (if it is running), and then have that thread launch Notepad.
尝试使用CreateRemoteThread()在explorer.exe的地址空间内创建一个新线程(如果它正在运行),然后让该线程启动记事本。
#3
There is no built in way to set explorer.exe as the parent process right away. However, from what I can tell you can use p/invoke to make some calls to accomplish this.
没有内置的方法可以立即将explorer.exe设置为父进程。但是,据我所知,您可以使用p / invoke进行一些调用来完成此任务。
Here is an article about the implementation using p/invoke to start as another user. THis gets you the intro to the p/invoke process. Then here is an article that talks about launching a non-child process. You can combine the information from the two to accomplish your desired goal.
这是一篇关于使用p / invoke作为另一个用户启动的实现的文章。这将为您提供p / invoke过程的介绍。接下来是一篇关于启动非子进程的文章。您可以结合两者中的信息来实现您期望的目标。