scrmem_open_from_win_image()

Obtain a handle to Screen buffer memory from a win_image_t

Synopsis:

#include <scrmem/scrmem_open.h>
errno_t scrmem_open_from_win_image(struct scrmem **scrmem_out, const struct win_image *image, int accmode, const struct _client_info *client)

Arguments:

scrmem_out
A pointer to a location where this function, if successful, writes a pointer that represents the reference being held.
image
A pointer to the image metadata. It won't be accessed after this function returns.
accmode
The access mode to use. Pass O_RDONLY, O_RDWR, or O_WRONLY (from fcntl.h).
client
A pointer to information about the client requesting access. This is used to validate that the client has the required permissions. If NULL, no extra checks are done. The structure isn't be accessed after this function returns, and future permission changes don't affect existing references.

Library:

libscrmem

Description:

The scrmem_open_from_win_image() function obtains a handle to Screen buffer memory from a win_image_t. If the image has an embedded file descriptor, it is duplicated and a memory object is created from it. Otherwise, the buffer identifier will be extracted and passed to scrmem_open().

Returns:

EOK
A handle was stored at *scrmem_out.
EACCES
The object cannot be opened in the requested mode (by the specified client, if not NULL).
EBADF
The image contains an invalid file descriptor.
EMFILE
No file descriptors are available in this process.
ENFILE
No file descriptors are available in the system.
ENOENT
The image contains an invalid buffer identifier.
EINVAL
An invalid parameter value was specified.
EPERM
The client is NULL and accmode specifies a disallowed access mode.
Page updated: