Platform SDK: DLLs, Processes, and Threads

SetInformationJobObject

The SetInformationJobObject function sets limits for a job object.

BOOL SetInformationJobObject(
  HANDLE hJob,                           // handle to job
  JOBOBJECTINFOCLASS JobObjectInfoClass, // information class
  LPVOID lpJobObjectInfo,                // limit information
  DWORD cbJobObjectInfoLength            // size of limit information
);

Parameters

hJob
[in] Handle to the job whose limits are being set. The CreateJobObject or OpenJobObject function returns this handle. The handle must have the JOB_OBJECT_SET_ATTRIBUTES access right associated with it. For more information, see Job Object Security and Access Rights.
JobObjectInfoClass
[in] Specifies the information class for limits to be set. This parameter can be one of the following values.
Value Meaning
JobObjectAssociateCompletionPortInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_ASSOCIATE_COMPLETION_PORT structure.
JobObjectBasicLimitInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_LIMIT_INFORMATION structure.
JobObjectBasicUIRestrictions The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_UI_RESTRICTIONS structure.
JobObjectEndOfJobTimeInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_END_OF_JOB_TIME_INFORMATION structure.
JobObjectExtendedLimitInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure.
JobObjectSecurityLimitInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_SECURITY_LIMIT_INFORMATION structure. The hJob handle must have the JOB_OBJECT_SET_SECURITY_ATTRIBUTES access right associated with it.

lpJobObjectInfo
[in] Specifies the limits to be set for the job. The format of this data depends on the value of JobObjectInfoClass.
cbJobObjectInfoLength
[in] Specifies the count, in bytes, of the job information being set.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

You can use the SetInformationJobObject function to set several limits in a single call. If you want to establish the limits one at a time or change a subset of the limits, call the QueryInformationJobObject function to obtain the current limits, modify these limits, and then call SetInformationJobObject.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Processes and Threads Overview, Process and Thread Functions, JOBOBJECT_ASSOCIATE_COMPLETION_PORT, JOBOBJECT_BASIC_LIMIT_INFORMATION, JOBOBJECT_BASIC_UI_RESTRICTIONS, JOBOBJECT_END_OF_JOB_TIME_INFORMATION, JOBOBJECT_EXTENDED_LIMIT_INFORMATION, JOBOBJECT_SECURITY_LIMIT_INFORMATION , QueryInformationJobObject