[This is preliminary documentation and subject to change.]
The OpenJobObjectToken function opens an existing job object and retrieves the token associated with the job object. By using this function, a process can read the accounting and limit information for a job object without needing an open handle to the job object.
BOOL OpenJobObjectToken(
HANDLE hJob,
ACCESS_MASK DesiredAccess,
HANDLE *phToken
);
If this value is NULL and the process is associated with a job object, the job object associated with the process is used.
Value | Meaning |
---|---|
TOKEN_ADJUST_DEFAULT | Required to change the default ACL, primary group, or owner of an access token. |
TOKEN_ADJUST_GROUPS | Required to change the groups specified in a token. |
TOKEN_ADJUST_PRIVILEGES | Required to change the privileges specified in a token. |
TOKEN_ALL_ACCESS | Combines the STANDARD_RIGHTS_REQUIRED access rights with all access rights for tokens. |
TOKEN_ASSIGN_PRIMARY | Required to attach a primary token to a process, along with the SE_CREATE_TOKEN_NAME privilege. |
TOKEN_DUPLICATE | Required to duplicate a token. |
TOKEN_EXECUTE | Combines the STANDARD_RIGHTS_EXECUTE access rights with the TOKEN_IMPERSONATE access right. |
TOKEN_IMPERSONATE | Required to attach an impersonation token to a process. |
TOKEN_QUERY | Required to query the contents of a token. |
TOKEN_QUERY_SOURCE | Required to query the source of a token. |
TOKEN_READ | Combines the STANDARD_RIGHTS_READ access rights with the TOKEN_QUERY access right. |
TOKEN_WRITE | Combines the STANDARD_RIGHTS_WRITE access rights with the TOKEN_ADJUST_PRIVILEGES, TOKEN_ADJUST_GROUPS, and TOKEN_ADJUST_DEFAULT access rights. |
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.
To associate a process with a job object, use the AssignProcessToJobObject function.
To set security limitations for the job object, see the JOBOBJECT_SECURITY_LIMIT_INFORMATION structure.
Windows NT: Requires version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Processes and Threads Overview, Process and Thread Functions, AssignProcessToJobObject, JOBOBJECT_SECURITY_LIMIT_INFORMATION