Platform SDK: DLLs, Processes, and Threads

UserHandleGrantAccess

The UserHandleGrantAccess function grants or denies access to a handle to a User object to a job that has a user-interface restriction. When access is granted, all processes associated with the job can subsequently recognize and use the handle. When access is denied, the processes can no longer use the handle. For more information see User Objects.

BOOL UserHandleGrantAccess(
  HANDLE hUserHandle,  // handle to User object
  HANDLE hJob,         // handle to job
  BOOL bGrant          // access granted or denied
);

Parameters

hUserHandle
[in] Handle to a User object.
hJob
[in] Handle to the job to be granted access to the User handle. The CreateJobObject or OpenJobObject function returns this handle.
bGrant
[in] Specifies whether access is to be denied or granted to hUserHandle. If bGrant is TRUE, all processes associated with the job can recognize and use the handle. If bGrant is FALSE, the processes can no longer use the handle.

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

The UserHandleGrantAccess function can be called only from a process not associated with the job specified by the hJob parameter. The User handle must not be owned by a process or thread associated with the job.

To create user-interface restrictions, call the SetInformationJobObject function with the JobObjectBasicUIRestrictions job information class.

Requirements

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

See Also

Processes and Threads Overview, Process and Thread Functions, CreateJobObject, OpenJobObject, SetInformationJobObject