Home > Backend Development > C++ > Why Does SetInformationJobObject Fail with Error 24 or 87 in .NET's CreateJobObject Implementation?

Why Does SetInformationJobObject Fail with Error 24 or 87 in .NET's CreateJobObject Implementation?

DDD
Release: 2024-12-31 19:03:15
Original
626 people have browsed it

Why Does SetInformationJobObject Fail with Error 24 or 87 in .NET's CreateJobObject Implementation?

Working example of CreateJobObject/SetInformationJobObject pinvoke in .net?

Problem:
In this example, the CreateJobObject/AssignProcessToJobObject functions appear to work correctly, but SetInformationJobObject consistently fails with error 24 or 87. Despite adjustments based on platform architecture and careful consideration of structure definitions, the underlying issue remains unsolved.

Solution:
The solution provided by Matt Howells, along with additional modifications and a custom Job class, offers a comprehensive solution that resolves the SetInformationJobObject failure.

Job Class Implementation:
The custom Job class includes methods for creating, closing, and assigning processes to the job. It utilizes PInvoke routines for interfacing with CreateJobObject, SetInformationJobObject, AssignProcessToJobObject, and other relevant functions.

Key Points:

  • The JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure incorporates the JOBOBJECT_BASIC_LIMIT_INFORMATION structure, enabling comprehensive job limit configuration.
  • Extended information is successfully set using SetInformationJobObject.
  • Detailed information and helper classes, such as IO_COUNTERS, SECURITY_ATTRIBUTES, and JobObjectInfoType, provide a granular understanding of job management concepts.

The above is the detailed content of Why Does SetInformationJobObject Fail with Error 24 or 87 in .NET's CreateJobObject Implementation?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template