Export (0) Print
Expand All
Expand Minimize
2 out of 2 rated this helpful - Rate this topic

SetInformationJobObject function

Sets limits for a job object.

Syntax


BOOL WINAPI SetInformationJobObject(
  _In_  HANDLE hJob,
  _In_  JOBOBJECTINFOCLASS JobObjectInfoClass,
  _In_  LPVOID lpJobObjectInfo,
  _In_  DWORD cbJobObjectInfoLength
);

Parameters

hJob [in]

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.

JobObjectInfoClass [in]

The information class for the limits to be set. This parameter can be one of the following values.

ValueMeaning
JobObjectAssociateCompletionPortInformation
7

The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_ASSOCIATE_COMPLETION_PORT structure.

JobObjectBasicLimitInformation
2

The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_LIMIT_INFORMATION structure.

JobObjectBasicUIRestrictions
4

The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_UI_RESTRICTIONS structure.

JobObjectCpuRateControlInformation
15

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.

JobObjectEndOfJobTimeInformation
6

The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_END_OF_JOB_TIME_INFORMATION structure.

JobObjectExtendedLimitInformation
9

The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure.

JobObjectGroupInformation
11

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.

JobObjectGroupInformationEx
14

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.

JobObjectNotificationLimitInformation
12

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.

JobObjectSecurityLimitInformation
5

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.

 

lpJobObjectInfo [in]

The limits or job state to be set for the job. The format of this data depends on the value of JobObjectInfoClass.

cbJobObjectInfoLength [in]

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

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.

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:  You can 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

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

Job Objects
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_NOTIFICATION_LIMIT_INFORMATION
JOBOBJECT_EXTENDED_LIMIT_INFORMATION
JOBOBJECT_SECURITY_LIMIT_INFORMATION
Process and Thread Functions
Process Security and Access Rights
QueryInformationJobObject

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.