Export (0) Print
Expand All
Expand Minimize

QueryInformationJobObject function

Retrieves limit and job state information from the job object.

Syntax


BOOL WINAPI QueryInformationJobObject(
  _In_opt_   HANDLE hJob,
  _In_       JOBOBJECTINFOCLASS JobObjectInfoClass,
  _Out_      LPVOID lpJobObjectInfo,
  _In_       DWORD cbJobObjectInfoLength,
  _Out_opt_  LPDWORD lpReturnLength
);

Parameters

hJob [in, optional]

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.

JobObjectInfoClass [in]

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

ValueMeaning
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.

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 limits individually for each process.

Windows Server 2003 and Windows XP:  The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_SECURITY_LIMIT_INFORMATION structure.

 

lpJobObjectInfo [out]

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

cbJobObjectInfoLength [in]

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

lpReturnLength [out, optional]

A pointer to a variable that receives the length of data written to the structure pointed to by the lpJobObjectInfo parameter. If you do not want to receive this information, specify NULL.

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 QueryInformationJobObject to obtain the current limits, modify them, then 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

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_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_NOTIFICATION_LIMIT_INFORMATION
JOBOBJECT_SECURITY_LIMIT_INFORMATION
Process and Thread Functions
SetInformationJobObject

 

 

Community Additions

ADD
Show:
© 2014 Microsoft