summaryrefslogtreecommitdiffhomepage
path: root/src/tty/ntapi_tty_connect.c
blob: 2c6c34b7c80cdb232584b385481ec3d340d5613e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/********************************************************/
/*  ntapi: Native API core library                      */
/*  Copyright (C) 2013--2021  SysDeer Technologies, LLC */
/*  Released under GPLv2 and GPLv3; see COPYING.NTAPI.  */
/********************************************************/

#include <psxtypes/psxtypes.h>
#include <ntapi/nt_object.h>
#include <ntapi/nt_port.h>
#include <ntapi/nt_string.h>
#include <ntapi/ntapi.h>
#include "ntapi_impl.h"

int32_t __stdcall __ntapi_tty_connect(
	__out	void **			hport,
	__in	wchar16_t *		tty_port_name,
	__in	int32_t			impersonation_level)
{
	nt_unicode_string		name;
	nt_security_quality_of_service	sqos;

	__ntapi->tt_init_unicode_string_from_utf16(
		&name,tty_port_name);

	sqos.length 			= sizeof(sqos);
	sqos.impersonation_level	= impersonation_level;
	sqos.context_tracking_mode	= NT_SECURITY_TRACKING_DYNAMIC;
	sqos.effective_only		= 1;

	return __ntapi->zw_connect_port(
		hport,&name,&sqos,
		0,0,0,0,0);
}