/*********************************************************/
/* toksvc: a framework-native token broker service */
/* Copyright (C) 2020 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.TOKSVC. */
/*********************************************************/
#include <psxtypes/psxtypes.h>
#include <ntapi/ntapi.h>
#include <toksvc/toksvc.h>
#include "toksvc_daemon_impl.h"
#include "toksvc_driver_impl.h"
int32_t __stdcall toks_daemon_connect(struct toks_daemon_ctx * dctx)
{
nt_tty_port_msg * msg;
void * hport;
msg = &dctx->reply;
msg->ttyinfo.exarg = 0;
hport = 0;
ntapi->zw_accept_connect_port(
&hport,
msg->header.client_id.process_id,
&msg->header,
NT_LPC_ACCEPT_CONNECTION,0,0);
return ntapi->zw_complete_connect_port(hport);
}