OpenJobObjectA function (winbase.h)

Opens an existing job object.

Syntax

HANDLE OpenJobObjectA(
  [in] DWORD  dwDesiredAccess,
  [in] BOOL   bInheritHandle,
  [in] LPCSTR lpName
);

Parameters

[in] dwDesiredAccess

The access to the job object. This parameter can be one or more of the job object access rights. This access right is checked against any security descriptor for the object.

[in] bInheritHandle

If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.

[in] lpName

The name of the job to be opened. Name comparisons are case sensitive.

This function can open objects in a private namespace. For more information, see Object Namespaces.

Terminal Services:  The name can have a "Global" or "Local" prefix to explicitly open the object in the global or session namespace. The remainder of the name can contain any character except the backslash character (\). For more information, see Kernel Object Namespaces.

Return value

If the function succeeds, the return value is a handle to the job. The handle provides the requested access to the job.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

An error of ERROR_FILE_NOT_FOUND indicates that the job specified in lpName does not exist.

Remarks

To associate a process with a job, use the AssignProcessToJobObject function.

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 winbase.h (include Windows.h, Jobapi2.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

AssignProcessToJobObject

Job Objects

Process and Thread Functions