Blob Blame History Raw
/*********************************************************/
/*  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/nt_tty.h>

#include <toksvc/toksvc.h>
#include "toksvc_driver_impl.h"
#include "toksvc_log_impl.h"

void toks_log_lpc_request(
	const struct toks_driver_ctx *  dctx,
	const nt_tty_port_msg *  msg)
{
	TOKS_LOG_LEVEL(dctx,0);

	nt_cid cid;
	char   path[2048];

	cid.process_id = msg->header.client_id.process_id;
	cid.thread_id  = msg->header.client_id.thread_id;

	toks_log_get_arbitrary_process_name(
		&cid,path,sizeof(path));

	toks_log_header(
		dctx,
		TOKS_LOG_ENTRY_SERVER_INFO,
		"LPC request from %s (syspid %d, systid %d), "
		"data_size=%u, msg_size=%u, "
		"msg_type=%u, msg_id=%u\n",
		toks_log_basename(path),
		cid.process_id,
		cid.thread_id,
		msg->header.data_size,
		msg->header.msg_size,
		msg->header.msg_type,
		msg->header.msg_id);

	if (cid.process_id)
		toks_log_write(
			dctx,
			TOKS_LOG_ENTRY_SUB_LEVEL_2,
			"%s.\n",path);
}