| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| int32_t __stdcall __ntapi_tty_join_session( |
| __out void ** hport, |
| __out nt_port_name * port_name, |
| __in nt_port_attr * port_attr, |
| __in nt_tty_session_type type) |
| { |
| nt_status status; |
| ntapi_internals * __internals; |
| |
| |
| __internals = __ntapi_internals(); |
| |
| if (type == NT_TTY_SESSION_PRIMARY) { |
| hport = hport ? hport : &__internals->hport_tty_session; |
| port_name = port_name ? port_name : __internals->subsystem; |
| } |
| |
| |
| __ntapi->tt_port_name_from_attr( |
| port_name, |
| port_attr); |
| |
| |
| if ((status = __ntapi->tty_connect( |
| hport, |
| (wchar16_t *)port_name, |
| NT_SECURITY_IMPERSONATION))) |
| return status; |
| |
| |
| if (type == NT_TTY_SESSION_PRIMARY) { |
| if (hport != &__internals->hport_tty_session) |
| __internals->hport_tty_session = *hport; |
| |
| if (__internals->rtdata) |
| __internals->rtdata->hsession = *hport; |
| |
| if (port_name != __internals->subsystem) |
| __ntapi->tt_memcpy_utf16( |
| __internals->subsystem->base_named_objects, |
| port_name->base_named_objects, |
| sizeof(*port_name)); |
| }; |
| |
| return status; |
| } |