Blame src/client/toks_client_release.c

7e6632
/*********************************************************/
7e6632
/*  toksvc: a framework-native token broker service      */
d91fa0
/*  Copyright (C) 2020  SysDeer Technologies, LLC        */
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;
8b933d
	struct _nt_tty_sync_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
8b933d
	msg.data.syncinfo.ipckeys[0] = keys->key[0];
8b933d
	msg.data.syncinfo.ipckeys[1] = keys->key[1];
8b933d
	msg.data.syncinfo.ipckeys[2] = keys->key[2];
8b933d
	msg.data.syncinfo.ipckeys[3] = keys->key[3];
8b933d
	msg.data.syncinfo.ipckeys[4] = keys->key[4];
8b933d
	msg.data.syncinfo.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
}