SetInformationJobObject function (jobapi2.h)
Sets limits for a job object.
Syntax
BOOL SetInformationJobObject(
[in] HANDLE hJob,
[in] JOBOBJECTINFOCLASS JobObjectInformationClass,
[in] LPVOID lpJobObjectInformation,
[in] DWORD cbJobObjectInformationLength
);
Parameters
[in] hJob
A 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. For more information, see Job Object Security and Access Rights.
[in] JobObjectInformationClass
The information class for the limits to be set. This parameter can be one of the following values.
Value | Meaning |
---|---|
|
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_ASSOCIATE_COMPLETION_PORT structure. |
|
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_LIMIT_INFORMATION structure. |
|
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_UI_RESTRICTIONS structure. |
|
The lpJobObjectInfo parameter is a pointer to a
JOBOBJECT_CPU_RATE_CONTROL_INFORMATION
structure.
Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. If Dynamic Fair Share Scheduling (DFSS) is enabled, the CPU rate cannot be set and SetInformationJobObject will fail with error code 50 ("The request is not supported"). |
|
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_END_OF_JOB_TIME_INFORMATION structure. |
|
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure. |
|
The lpJobObjectInfo parameter is a pointer to a
USHORT value that specifies the list of
processor groups to assign the job to. The
cbJobObjectInfoLength parameter is set to the size of the group data. Divide this
value by sizeof(USHORT) to determine the number of groups.
Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. |
|
The lpJobObjectInfo parameter is a pointer to a buffer that contains an array
of GROUP_AFFINITY structures that specify the
affinity of the job for the processor groups to which
the job is currently assigned. The cbJobObjectInfoLength parameter is set to the
size of the group affinity data. Divide this value by
sizeof(GROUP_AFFINITY) to determine the number of groups.
Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. |
|
The lpJobObjectInfo parameter is a pointer to a
JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2
structure.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. |
|
The lpJobObjectInfo parameter is a pointer to a
JOBOBJECT_NET_RATE_CONTROL_INFORMATION
structure.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. |
|
The lpJobObjectInfo parameter is a pointer to a
JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION
structure.
Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. |
|
The lpJobObjectInfo parameter is a pointer to a
JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2
structure.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This flag is not supported. |
|
This flag is not supported. Applications must set security limitations individually for each process.
Windows Server 2003 and Windows XP: 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. |
[in] lpJobObjectInformation
The limits or job state to be set for the job. The format of this data depends on the value of JobObjectInfoClass.
[in] cbJobObjectInformationLength
The size of the job information being set, in bytes.
Return value
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
Use the SetInformationJobObject function to set several limits in a single call. 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.
You must set security limits individually for each process associated with a job object, rather than setting them for the job object itself. For information, see Process Security and Access Rights.
Windows Server 2003 and Windows XP: Use the SetInformationJobObject function to set security limits for the job object.
To compile an application that uses this function, define _WIN32_WINNT as 0x0500 or later. For more information, see Using the Windows Headers.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | jobapi2.h (include Windows.h) |
Library | Kernel32.lib |
DLL | Kernel32.dll |
See also
JOBOBJECT_ASSOCIATE_COMPLETION_PORT
JOBOBJECT_BASIC_LIMIT_INFORMATION
JOBOBJECT_BASIC_UI_RESTRICTIONS
JOBOBJECT_CPU_RATE_CONTROL_INFORMATION
JOBOBJECT_END_OF_JOB_TIME_INFORMATION
JOBOBJECT_EXTENDED_LIMIT_INFORMATION
JOBOBJECT_LIMIT_VIOLATION_INFORMATION
JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2
JOBOBJECT_NET_RATE_CONTROL_INFORMATION
JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION
JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2
JOBOBJECT_SECURITY_LIMIT_INFORMATION