Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
 SetInformationJobObject Function
SetInformationJobObject Function

Sets limits for a job object.

Syntax

C++
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.

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.

JobObjectSecurityLimitInformation
5

This flag is not supported. Applications must set security limitations individually for each process.

Windows Server 2003 and Windows XP/2000:   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.
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/2000:  This flag is not supported.

 

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 limitations 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/2000:   You can use the SetInformationJobObject function to set security limitations 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 clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

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

Send comments about this topic to Microsoft

Build date: 10/8/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker