Blame src/tty/ntapi_tty_connect.c

dd89bb
/********************************************************/
dd89bb
/*  ntapi: Native API core library                      */
dd89bb
/*  Copyright (C) 2013,2014,2015  Z. Gilboa             */
dd89bb
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
dd89bb
/********************************************************/
dd89bb
dd89bb
#include <psxtypes/psxtypes.h>
dd89bb
#include <ntapi/nt_object.h>
dd89bb
#include <ntapi/nt_port.h>
dd89bb
#include <ntapi/nt_string.h>
dd89bb
#include <ntapi/ntapi.h>
dd89bb
#include "ntapi_impl.h"
dd89bb
dd89bb
int32_t __stdcall __ntapi_tty_connect(
dd89bb
	__out	void **			hport,
dd89bb
	__in	wchar16_t *		tty_port_name,
dd89bb
	__in	int32_t			impersonation_level)
dd89bb
{
dd89bb
	nt_object_attributes		oa;
dd89bb
	nt_unicode_string		name;
dd89bb
	nt_security_quality_of_service	sqos;
dd89bb
dd89bb
	__ntapi->tt_init_unicode_string_from_utf16(
dd89bb
		&name,tty_port_name);
dd89bb
dd89bb
	sqos.length 			= sizeof(sqos);
dd89bb
	sqos.impersonation_level	= impersonation_level;
dd89bb
	sqos.context_tracking_mode	= NT_SECURITY_TRACKING_DYNAMIC;
dd89bb
	sqos.effective_only		= 1;
dd89bb
dd89bb
	oa.len		= sizeof(oa);
dd89bb
	oa.root_dir	= (void *)0;
dd89bb
	oa.obj_name	= &nam;;
dd89bb
	oa.obj_attr	= 0;
dd89bb
	oa.sec_desc	= (nt_security_descriptor *)0;
dd89bb
	oa.sec_qos	= &sqo;;
dd89bb
dd89bb
	return __ntapi->zw_connect_port(
dd89bb
		hport,
dd89bb
		&name,
dd89bb
		&sqos,
dd89bb
		(nt_port_section_write *)0,
dd89bb
		(nt_port_section_read *)0,
dd89bb
		(uint32_t *)0,
dd89bb
		(void *)0,
dd89bb
		(uint32_t *)0);
dd89bb
}