Blame src/service/toks_service_abort.c

520f51
/*********************************************************/
520f51
/*  toksvc: a framework-native token broker service      */
520f51
/*  Copyright (C) 2020  Z. Gilboa                        */
520f51
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
520f51
/*********************************************************/
520f51
520f51
#include <psxtypes/psxtypes.h>
520f51
#include <ntapi/ntapi.h>
520f51
520f51
#include <toksvc/toksvc.h>
520f51
#include "toksvc_driver_impl.h"
520f51
#include "toksvc_daemon_impl.h"
520f51
520f51
int32_t toks_service_abort(struct toks_driver_ctx * dctx)
520f51
{
520f51
	int32_t			status;
520f51
	void *			hport;
8b933d
	struct _nt_tty_sync_msg	msg;
520f51
520f51
	hport = toks_get_driver_hservice(dctx);
520f51
520f51
	ntapi->tt_aligned_block_memset(
520f51
		&msg,0,sizeof(msg));
520f51
520f51
	msg.header.msg_type	= NT_LPC_NEW_MESSAGE;
520f51
	msg.header.data_size	= sizeof(msg.data);
520f51
	msg.header.msg_size	= sizeof(msg);
520f51
	msg.data.ttyinfo.opcode	= TOKS_DAEMON_ABORT;
520f51
520f51
	if ((status = ntapi->zw_request_wait_reply_port(hport,&msg,&msg)))
520f51
		return status;
520f51
520f51
	return (msg.data.ttyinfo.status)
520f51
		? msg.data.ttyinfo.status
520f51
		: NT_STATUS_SUCCESS;
520f51
}