Platform SDK: DLLs, Processes, and Threads

QueryInformationJobObject

The QueryInformationJobObject function retrieves limit and job state information from the job object.

BOOL QueryInformationJobObject(
  HANDLE hJob,                           // handle to job
  JOBOBJECTINFOCLASS JobObjectInfoClass, // information class
  LPVOID lpJobObjectInfo,                // limit information
  DWORD cbJobObjectInfoLength,           // limit information size
  LPDWORD lpReturnLength                 // data written
);

Parameters

hJob
[in] 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 associated with it. 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.

JobObjectInfoClass
[in] Specifies the information class for limits to be queried. This parameter can be one of the following values.
Value Meaning
JobObjectBasicAccountingInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_ACCOUNTING_INFORMATION structure.
JobObjectBasicAndIoAccountingInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION structure.
JobObjectBasicLimitInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_LIMIT_INFORMATION structure.
JobObjectBasicProcessIdList The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_PROCESS_ID_LIST structure.
JobObjectBasicUIRestrictions The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_BASIC_UI_RESTRICTIONS structure.
JobObjectExtendedLimitInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure.
JobObjectSecurityLimitInformation The lpJobObjectInfo parameter is a pointer to a JOBOBJECT_SECURITY_LIMIT_INFORMATION structure.

lpJobObjectInfo
[out] Receives the limit information. The format of this data depends on the value of the JobObjectInfoClass parameter.
cbJobObjectInfoLength
[in] Specifies the count, in bytes, of the job information being queried.
lpReturnLength
[out] 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 Values

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.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Processes and Threads Overview, Process and Thread Functions, JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION, JOBOBJECT_BASIC_LIMIT_INFORMATION, JOBOBJECT_BASIC_PROCESS_ID_LIST, JOBOBJECT_BASIC_UI_RESTRICTIONS, JOBOBJECT_EXTENDED_LIMIT_INFORMATION, JOBOBJECT_SECURITY_LIMIT_INFORMATION, SetInformationJobObject