Blame src/tty/ntapi_tty_query_information_section.c

1b6aec
/********************************************************/
1b6aec
/*  ntapi: Native API core library                      */
59d585
/*  Copyright (C) 2013--2021  Z. Gilboa                 */
1b6aec
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
1b6aec
/********************************************************/
1b6aec
1b6aec
#include <psxtypes/psxtypes.h>
1b6aec
#include <ntapi/nt_tty.h>
1b6aec
#include <ntapi/nt_guid.h>
1b6aec
#include <ntapi/ntapi.h>
1b6aec
#include "ntapi_impl.h"
1b6aec
1b6aec
int32_t	__stdcall __ntapi_tty_query_information_section(
1b6aec
	__in	void *			hport,
1b6aec
	__out	nt_io_status_block *	iosb,
1b6aec
	__out	nt_tty_section_info *	secinfo,
1b6aec
	__in	const nt_guid *		guid)
1b6aec
{
1b6aec
	int32_t			status;
1b6aec
	nt_tty_section_msg	msg;
1b6aec
1b6aec
	__ntapi->tt_aligned_block_memset(
1b6aec
		&msg,0,sizeof(msg));
1b6aec
1b6aec
	msg.header.msg_type		= NT_LPC_NEW_MESSAGE;
1b6aec
	msg.header.data_size		= sizeof(msg.data);
1b6aec
	msg.header.msg_size		= sizeof(msg);
1b6aec
	msg.data.ttyinfo.opcode		= NT_TTY_QUERY_INFORMATION_SECTION;
1b6aec
1b6aec
	if (guid)
1b6aec
		__ntapi->tt_guid_copy(
1b6aec
			&msg.data.secinfo.attr.guid,
1b6aec
			guid);
1b6aec
1b6aec
	if (!hport)
1b6aec
		hport = __ntapi_internals()->hport_tty_session;
1b6aec
1b6aec
	if ((status = __ntapi->zw_request_wait_reply_port(hport,&msg,&msg)))
1b6aec
		return status;
1b6aec
	else if (msg.data.ttyinfo.status)
1b6aec
		return msg.data.ttyinfo.status;
1b6aec
1b6aec
	__ntapi->tt_generic_memcpy(
1b6aec
		secinfo,
1b6aec
		&msg.data.secinfo,
1b6aec
		sizeof(*secinfo));
1b6aec
1b6aec
	iosb->status = NT_STATUS_SUCCESS;
1b6aec
	iosb->info   = sizeof(*secinfo);
1b6aec
1b6aec
	return NT_STATUS_SUCCESS;
1b6aec
}