Blame src/tty/ntapi_tty_client_session_disconnect.c

029ed1
/********************************************************/
029ed1
/*  ntapi: Native API core library                      */
029ed1
/*  Copyright (C) 2013--2017  Z. Gilboa                 */
029ed1
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
029ed1
/********************************************************/
029ed1
029ed1
#include <psxtypes/psxtypes.h>
029ed1
#include <ntapi/nt_tty.h>
029ed1
#include <ntapi/ntapi.h>
029ed1
#include "ntapi_impl.h"
029ed1
029ed1
typedef struct _nt_tty_disconnect_msg {
029ed1
	nt_port_message			header;
029ed1
	struct {
029ed1
		nt_tty_msg_info		ttyinfo;
029ed1
	} data;
029ed1
} nt_tty_disconnect_msg;
029ed1
029ed1
int32_t __stdcall __ntapi_tty_client_session_disconnect(void * hport)
029ed1
{
029ed1
	int32_t			status;
029ed1
	nt_tty_disconnect_msg	msg;
029ed1
029ed1
	hport = hport ? hport :  __ntapi_internals()->hport_tty_session;
029ed1
029ed1
	__ntapi->tt_aligned_block_memset(
029ed1
		&msg,0,sizeof(msg));
029ed1
029ed1
	msg.header.msg_type	= NT_LPC_NEW_MESSAGE;
029ed1
	msg.header.data_size	= sizeof(msg.data);
029ed1
	msg.header.msg_size	= sizeof(msg);
029ed1
	msg.data.ttyinfo.opcode	= NT_TTY_CLIENT_SESSION_DISCONNECT;
029ed1
029ed1
	if ((status = __ntapi->zw_request_wait_reply_port(hport,&msg,&msg)))
029ed1
		return status;
029ed1
029ed1
	return msg.data.ttyinfo.status;
029ed1
}