Blame src/internal/ptycon_ioctl_impl.h

538c8a
#ifndef PTYCON_IOCTL_IMPL_H
538c8a
#define PTYCON_IOCTL_IMPL_H
538c8a
538c8a
#include <ntapi/ntapi.h>
538c8a
538c8a
static int32_t ptyc_grant(nt_pty * hptm)
538c8a
{
538c8a
	nt_tty_sigctl_info	ctlinfo;
538c8a
	nt_iosb			iosb;
538c8a
538c8a
	ntapi->tt_aligned_block_memset(
538c8a
		&ctlinfo,0,sizeof(ctlinfo));
538c8a
538c8a
	return ntapi->pty_ioctl(
538c8a
		hptm,
538c8a
		0,0,0,
538c8a
		&iosb,TTY_TIOCSPTLCK,
538c8a
		&ctlinfo,sizeof(ctlinfo),
538c8a
		&ctlinfo,sizeof(ctlinfo));
538c8a
}
538c8a
d918be
static int32_t ptyc_set_client_info(
d918be
	nt_pty *		hpty,
d918be
	nt_pty_client_info *	clinfo)
d918be
{
d918be
	int32_t			status;
d918be
	nt_iosb			iosb;
d918be
	nt_large_integer	ticks;
d918be
	nt_large_integer	freq;
d918be
	nt_pty_client_info	ptyinfo;
d918be
d918be
	if ((status = ntapi->zw_query_performance_counter(
d918be
			&ticks,&freq)))
d918be
		return status;
d918be
d918be
	ptyinfo.any[0] = (ticks.ulow << 19) | (ticks.ulow >> 13);
d918be
d918be
	if ((status = ntapi->zw_query_performance_counter(
d918be
			&ticks,&freq)))
d918be
		return status;
d918be
d918be
	ptyinfo.any[1] = (ticks.ulow << 15) | (ticks.ulow >> 17);
d918be
d918be
	if ((status = ntapi->zw_query_performance_counter(
d918be
			&ticks,&freq)))
d918be
		return status;
d918be
d918be
	ptyinfo.any[1] = (ticks.ulow << 11) | (ticks.ulow >> 21);
d918be
d918be
	if ((status = ntapi->zw_query_performance_counter(
d918be
			&ticks,&freq)))
d918be
		return status;
d918be
d918be
	ptyinfo.any[1] = (ticks.ulow << 17) | (ticks.ulow >> 15);
d918be
d918be
	if ((status = ntapi->pty_set(
d918be
			hpty,&iosb,
d918be
			&ptyinfo,sizeof(ptyinfo),
d918be
			NT_PTY_CLIENT_INFORMATION)))
d918be
		return status;
d918be
d918be
	clinfo->any[0] = ptyinfo.any[0];
d918be
	clinfo->any[1] = ptyinfo.any[1];
d918be
	clinfo->any[2] = ptyinfo.any[2];
d918be
	clinfo->any[3] = ptyinfo.any[3];
d918be
d918be
	return NT_STATUS_SUCCESS;
d918be
}
d918be
538c8a
#endif