有人可以帮我吗?我正在尝试创建一个作业对象,JOB_OBJECT_SECURITY_ONLY_TOKEN
但SetInformationJobObject
总是失败,错误代码为 6(无效句柄)。这是我的代码:
HANDLE Job( CreateJobObject( NULL, NULL ) );
if( !Job )
{
wprintf( L"Could not create job object, error %d\n", GetLastError() );
return 1;
}
JOBOBJECT_SECURITY_LIMIT_INFORMATION SecLimit = { 0 };
SecLimit.SecurityLimitFlags = JOB_OBJECT_SECURITY_ONLY_TOKEN;
if ( !SetInformationJobObject( Job, JobObjectSecurityLimitInformation, &SecLimit, sizeof( SecLimit ) ) )
{
wprintf( L"Could not associate job with IO completion port, error %d\n", GetLastError() );
return 1;
}
我正在尝试在 XP 上运行这个应用程序!谢谢!