博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AssignProcessToJobObject 错误码5 的解决办法
阅读量:4049 次
发布时间:2019-05-25

本文共 1163 字,大约阅读时间需要 3 分钟。

在windows 调试中可以正常在job中关联 子进程,并且在主进程异常退出时,子进程同时退出,子进程的创建 使用 CreateProcess方法;

!!!!!!但是 !!!!!!!

问题:

在双击执行exe(编译产生的执行程序)时,却出现报错:AssignProcessToJobObject FAIL,errCode:5

解决办法:

修改CreateProcess中的 dwCreationFlags 参数

BOOL CreateProcessA(  LPCSTR                lpApplicationName,  LPSTR                 lpCommandLine,  LPSECURITY_ATTRIBUTES lpProcessAttributes,  LPSECURITY_ATTRIBUTES lpThreadAttributes,  BOOL                  bInheritHandles,  DWORD                 dwCreationFlags,  LPVOID                lpEnvironment,  LPCSTR                lpCurrentDirectory,  LPSTARTUPINFOA        lpStartupInfo,  LPPROCESS_INFORMATION lpProcessInformation);

如下:

if (CreateProcess(_T(“子进程”), _T(""), NULL, NULL, FALSE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &info, &processInfo))

原因:

A process can be associated only with a single job. A process inherits limits from the job it is associated with and adds its accounting information to the job. If a process is associated with a job, all processes it creates are associated with that job by default. To create a process that is not part of the same job, call the CreateProcess function with the CREATE_BREAKAWAY_FROM_JOB flag.

MSDN :

转载地址:http://hinci.baihongyu.com/

你可能感兴趣的文章
图像量化函数
查看>>
Linux 服务器上搭建SVN服务端
查看>>
每天学一点python——GUI遍历文件夹
查看>>
小白也能看懂的Yolov4训练过程
查看>>
yolov4评估自己的模型
查看>>
Linux配置darknet训练yolov4模型
查看>>
基于深度学习图像分割的研究综述(1)
查看>>
Transformer加油站!
查看>>
异常检测(二)——MVTec AD -A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection
查看>>
异常检测(三):PaDiM: a Patch Distribution Modeling Framework for Anomaly Detection and Localization
查看>>
Qt /INCLUDE:?warp_size@cuda@at@@YAHXZ
查看>>
Faster-RCNN网络详解
查看>>
Litorch+VS2017+Qt环境配置教程
查看>>
yolo训练精简版
查看>>
基于GB28181RTPoverTCP的发送程序拾遗
查看>>
Android入门知识要点
查看>>
libcurl异步请求+http长连接池
查看>>
2440机器码
查看>>
c语言内存分配
查看>>
结构体file_operations
查看>>