OpenJobObject

[This is preliminary documentation and subject to change.]

The OpenJobObject function opens an existing job object.

HANDLE OpenJobObject(
  DWORD dwDesiredAccess,
  BOOL bInheritHandles,
  LPCTSTR lpName
);

Parameters

dwDesiredAccess
Specifies the desired access mode to the job object. This parameter can be one or more of the following values.
Value Meaning
MAXIMUM_ALLOWED Specifies maximum access rights to the job object that are valid for the caller.
JOB_OBJECT_ASSIGN_PROCESS Specifies the assign process access right to the object. Allows processes to be assigned to the job.
JOB_OBJECT_SET_ATTRIBUTES Specifies the set attribute access right to the object. Allows job object attributes to be set.
JOB_OBJECT_QUERY Specifies the query access right to the object. Allows job object attributes and accounting information to be queried.
JOB_OBJECT_TERMINATE Specifies the terminate access right to the object. Allows termination of all processes in the job object.
JOB_OBJECT_SET_SECURITY_ATTRIBUTES Specifies the security attributes access right to the object. Allows security limitations on all processes in the job object to be set.
JOB_OBJECT_ALL_ACCESS Specifies the full access right to the job object.

bInheritHandle
Specifies whether the returned handle is inherited when a new process is created. If this parameter is TRUE, the new process inherits the handle.
lpName
Pointer to a null-terminated string specifying the name of the job object to be opened. Name comparisons are case sensitive.

Return Values

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

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

Remarks

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

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winbase.h.
  Import Library: Use kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Processes and Threads Overview, Process and Thread Functions, AssignProcessToJobObject