Blame src/tty/ntapi_tty_query_information_service.c

a1e25a
/********************************************************/
a1e25a
/*  ntapi: Native API core library                      */
64e606
/*  Copyright (C) 2013--2021  SysDeer Technologies, LLC */
a1e25a
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
a1e25a
/********************************************************/
a1e25a
a1e25a
#include <psxtypes/psxtypes.h>
a1e25a
#include <ntapi/nt_tty.h>
a1e25a
#include <ntapi/nt_guid.h>
a1e25a
#include <ntapi/ntapi.h>
a1e25a
#include "ntapi_impl.h"
a1e25a
a1e25a
int32_t	__stdcall __ntapi_tty_query_information_service(
a1e25a
	__in	void *			hport,
a1e25a
	__out	nt_io_status_block *	iosb,
a1e25a
	__out	nt_tty_service_info *	svcinfo,
a1e25a
	__in	const nt_guid *		guid,
a1e25a
	__in	uint32_t		key,
a1e25a
	__in	uint32_t		id)
a1e25a
{
a1e25a
	int32_t			status;
a1e25a
	nt_tty_service_msg	msg;
a1e25a
a1e25a
	__ntapi->tt_aligned_block_memset(
a1e25a
		&msg,0,sizeof(msg));
a1e25a
a1e25a
	msg.header.msg_type		= NT_LPC_NEW_MESSAGE;
a1e25a
	msg.header.data_size		= sizeof(msg.data);
a1e25a
	msg.header.msg_size		= sizeof(msg);
a1e25a
	msg.data.ttyinfo.opcode		= NT_TTY_QUERY_INFORMATION_SERVICE;
a1e25a
	msg.data.svcinfo.key		= key;
a1e25a
	msg.data.svcinfo.id		= id;
a1e25a
a1e25a
	__ntapi->tt_guid_copy(
a1e25a
		&msg.data.svcinfo.attr.guid,
a1e25a
		guid);
a1e25a
a1e25a
	if (!hport)
a1e25a
		hport = __ntapi_internals()->hport_tty_session;
a1e25a
a1e25a
	if ((status = __ntapi->zw_request_wait_reply_port(hport,&msg,&msg)))
a1e25a
		return status;
a1e25a
	else if (msg.data.ttyinfo.status)
a1e25a
		return msg.data.ttyinfo.status;
a1e25a
a1e25a
	__ntapi->tt_generic_memcpy(
a1e25a
		svcinfo,
a1e25a
		&msg.data.svcinfo,
a1e25a
		sizeof(*svcinfo));
a1e25a
a1e25a
	iosb->status = NT_STATUS_SUCCESS;
a1e25a
	iosb->info   = sizeof(*svcinfo);
a1e25a
a1e25a
	return NT_STATUS_SUCCESS;
a1e25a
}