IsProcessInJob function (jobapi.h)

Determines whether the process is running in the specified job.

Syntax

BOOL IsProcessInJob(
  [in]           HANDLE ProcessHandle,
  [in, optional] HANDLE JobHandle,
  [out]          PBOOL  Result
);

Parameters

[in] ProcessHandle

A handle to the process to be tested. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights.

Windows Server 2003 and Windows XP:  The handle must have the PROCESS_QUERY_INFORMATION access right.

[in, optional] JobHandle

A handle to the job. If this parameter is NULL, the function tests if the process is running under any job.

If this parameter is not NULL, the handle must have the JOB_OBJECT_QUERY access right. For more information, see Job Object Security and Access Rights.

[out] Result

A pointer to a value that receives TRUE if the process is running in the job, and FALSE otherwise.

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

An application cannot obtain a handle to the job object in which it is running unless it has the name of the job object. However, an application can call the QueryInformationJobObject function with NULL to obtain information about the job object.

To compile an application that uses this function, define _WIN32_WINNT as 0x0501 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 jobapi.h
Library Kernel32.lib
DLL Kernel32.dll

See also

AssignProcessToJobObject

Job Objects

Process and Thread Functions

QueryInformationJobObject