QueryInformationJobObject function (jobapi2.h)

Retrieves limit and job state information from the job object.

Syntax

BOOL QueryInformationJobObject(
  [in, optional]  HANDLE             hJob,
  [in]            JOBOBJECTINFOCLASS JobObjectInformationClass,
  [out]           LPVOID             lpJobObjectInformation,
  [in]            DWORD              cbJobObjectInformationLength,
  [out, optional] LPDWORD            lpReturnLength
);

Parameters

[in, optional] hJob

A handle to the job whose information is being queried. The CreateJobObject or OpenJobObject function returns this handle. The handle must have the JOB_OBJECT_QUERY access right. For more information, see Job Object Security and Access Rights.

If this value is NULL and the calling process is associated with a job, the job associated with the calling process is used. If the job is nested, the immediate job of the calling process is used.

[in] JobObjectInformationClass

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

Value Meaning
JobObjectBasicAccountingInformation
1
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_ACCOUNTING_INFORMATION structure.
JobObjectBasicAndIoAccountingInformation
8
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION structure.
JobObjectBasicLimitInformation
2
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_LIMIT_INFORMATION structure.
JobObjectBasicProcessIdList
3
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_PROCESS_ID_LIST 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 buffer that receives the list of processor groups to which the job is currently assigned. The variable pointed to by the lpReturnLength 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 receives an array of GROUP_AFFINITY structures that indicate the affinity of the job in the processor groups to which the job is currently assigned. The variable pointed to by the lpReturnLength 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.

JobObjectLimitViolationInformation
13
The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_LIMIT_VIOLATION_INFORMATION structure.

Windows 7, Windows Server 2008 R2, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This flag is not supported.

JobObjectLimitViolationInformation2
34
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.

JobObjectNetRateControlInformation
32
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.

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.

JobObjectNotificationLimitInformation2
33
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.

JobObjectSecurityLimitInformation
5
This flag is not supported. Applications must set security limits individually for each process. Windows Server 2003 and Windows XP:  The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_SECURITY_LIMIT_INFORMATION structure.

[out] lpJobObjectInformation

The limit or job state information. The format of this data depends on the value of the JobObjectInfoClass parameter.

[in] cbJobObjectInformationLength

The count of the job information being queried, in bytes. This value depends on the value of the JobObjectInfoClass parameter.

[out, optional] lpReturnLength

A pointer to a variable that receives the length of data written to the structure pointed to by the lpJobObjectInfo parameter. Specify NULL to not receive this information.

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 QueryInformationJobObject to obtain the current limits and modify them. Use the SetInformationJobObject function to set new limits.

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_BASIC_ACCOUNTING_INFORMATION

JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION

JOBOBJECT_BASIC_LIMIT_INFORMATION

JOBOBJECT_BASIC_PROCESS_ID_LIST

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

Job Objects

Process and Thread Functions

SetInformationJobObject