IsProcessInJob 与 GetCurrentProcess 远离 true
(Visual Studio 2010 - C++) 您好,
我正在尝试将作业设置为进程,但AssignProcessToJobObject 返回ACCESS_DENIED 并且IsProcessInJob 返回TRUE。
我在调用 CreateProcess (Suspended) 后立即调用 IsProcessInJob 到进程,并尝试使用我的进程调用 IsProcessInJob(主入口点后几行),它返回 true。
void main()
{
BOOL bIsInJob;
IsProcessInJob( GetCurrentProcess(), NULL, &bIsInJob );
printf( "IsProcessInJob (me): %s\n", bIsInJob ? "true" : "false" );
// RET True ! inside and outside IDE
...
以前有人看过吗?
感谢您的任何帮助。 资料来源: 当父进程被终止时终止子进程 如何自动销毁 Windows 中的子进程?
(Visual Studio 2010 - C++)
Hello,
I'm trying to set a JOB to a process, but AssignProcessToJobObject returns ACCESS_DENIED and IsProcessInJob returns TRUE.
I call IsProcessInJob to a process immediately after call CreateProcess (Suspended) end tried call IsProcessInJob with my process (a few lines after main entry point) and it returns true.
void main()
{
BOOL bIsInJob;
IsProcessInJob( GetCurrentProcess(), NULL, &bIsInJob );
printf( "IsProcessInJob (me): %s\n", bIsInJob ? "true" : "false" );
// RET True ! inside and outside IDE
...
Someone saw it before?
Thanks for any help.
Sources:
Kill child process when parent process is killed
How do I automatically destroy child processes in Windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了。
由于某种原因,我的进程是 Explorer.exe 的子进程,然后 Explorer 为我的进程设置了一个作业,记事本(我的子进程)继承了该作业。
直到使用 ProcessExplorer 才找到。我在进程列表中看不到我的进程,当我在 Winlogon->Explorer 下面找到时,我明白了。
解决方案:CREATE_BREAKAWAY_FROM_JOB
感谢您的评论、耐心和时间。
I found.
For some reason, my process was child of Explorer.exe then Explorer set a job to my process and the notepad (my child) inherits this job.
I could not find until see with ProcessExplorer. I can not saw my process in process list, when i find below Winlogon->Explorer, i understood.
Resolution: CREATE_BREAKAWAY_FROM_JOB
Thanks for your comments, patience and time.