Blame src/client/toks_client_release.c

7e6632
/*********************************************************/
7e6632
/*  toksvc: a framework-native token broker service      */
7e6632
/*  Copyright (C) 2020  Z. Gilboa                        */
7e6632
/*  Released under GPLv2 and GPLv3; see COPYING.TOKSVC.  */
7e6632
/*********************************************************/
7e6632
7e6632
#include <psxtypes/psxtypes.h>
7e6632
#include <ntapi/ntapi.h>
7e6632
7e6632
#include <toksvc/toksvc.h>
7e6632
#include "toksvc_driver_impl.h"
7e6632
#include "toksvc_daemon_impl.h"
7e6632
7e6632
int32_t toks_client_release(struct toks_driver_ctx * dctx)
7e6632
{
7e6632
	int32_t			status;
7e6632
	void *			hport;
7e6632
	struct _nt_tty_ipc_msg	msg;
7e6632
	struct _nt_port_keys *	keys;
7e6632
7e6632
	hport = toks_get_driver_hservice(dctx);
7e6632
	keys  = toks_get_driver_keys(dctx);
7e6632
7e6632
	ntapi->tt_aligned_block_memset(
7e6632
		&msg,0,sizeof(msg));
7e6632
7e6632
	msg.header.msg_type	= NT_LPC_NEW_MESSAGE;
7e6632
	msg.header.data_size	= sizeof(msg.data);
7e6632
	msg.header.msg_size	= sizeof(msg);
7e6632
	msg.data.ttyinfo.opcode	= TOKS_DAEMON_RELEASE;
7e6632
7e6632
	msg.data.ipcinfo.ipckeys[0] = keys->key[0];
7e6632
	msg.data.ipcinfo.ipckeys[1] = keys->key[1];
7e6632
	msg.data.ipcinfo.ipckeys[2] = keys->key[2];
7e6632
	msg.data.ipcinfo.ipckeys[3] = keys->key[3];
7e6632
	msg.data.ipcinfo.ipckeys[4] = keys->key[4];
7e6632
	msg.data.ipcinfo.ipckeys[5] = keys->key[5];
7e6632
7e6632
	if ((status = ntapi->zw_request_wait_reply_port(hport,&msg,&msg)))
7e6632
		return status;
7e6632
7e6632
	return (msg.data.ttyinfo.status)
7e6632
		? msg.data.ttyinfo.status
7e6632
		: NT_STATUS_SUCCESS;
7e6632
}