diff --git a/src/pty/ptyc_spawn.c b/src/pty/ptyc_spawn.c index f4f026b..f94af2d 100644 --- a/src/pty/ptyc_spawn.c +++ b/src/pty/ptyc_spawn.c @@ -74,10 +74,25 @@ int __stdcall ptyc_spawn(struct ptyc_driver_ctx * dctx) rtctx.stdout_type = NT_FILE_TYPE_PTY; rtctx.stderr_type = NT_FILE_TYPE_PTY; - rtctx.ptyany[0] = clctx->clinfo.any[0]; - rtctx.ptyany[1] = clctx->clinfo.any[1]; - rtctx.ptyany[2] = clctx->clinfo.any[2]; - rtctx.ptyany[3] = clctx->clinfo.any[3]; + rtctx.ptyin [0] = clctx->clinfo.any[0]; + rtctx.ptyin [1] = clctx->clinfo.any[1]; + rtctx.ptyin [2] = clctx->clinfo.any[2]; + rtctx.ptyin [3] = clctx->clinfo.any[3]; + + rtctx.ptyout[0] = clctx->clinfo.any[0]; + rtctx.ptyout[1] = clctx->clinfo.any[1]; + rtctx.ptyout[2] = clctx->clinfo.any[2]; + rtctx.ptyout[3] = clctx->clinfo.any[3]; + + rtctx.ptyerr[0] = clctx->clinfo.any[0]; + rtctx.ptyerr[1] = clctx->clinfo.any[1]; + rtctx.ptyerr[2] = clctx->clinfo.any[2]; + rtctx.ptyerr[3] = clctx->clinfo.any[3]; + + rtctx.ptyctl[0] = clctx->clinfo.any[0]; + rtctx.ptyctl[1] = clctx->clinfo.any[1]; + rtctx.ptyctl[2] = clctx->clinfo.any[2]; + rtctx.ptyctl[3] = clctx->clinfo.any[3]; /* hoppla */ if ((status = ntapi->tt_spawn_native_process(&sparams))) diff --git a/src/ptycon.c b/src/ptycon.c index 5c8fe76..20a9aa8 100644 --- a/src/ptycon.c +++ b/src/ptycon.c @@ -46,7 +46,6 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp) nt_runtime_data * rtdata; nt_port_attr port_attr; nt_pty_client_info client_info; - nt_pty * hpty; nt_iosb iosb; /* rtdata */ @@ -100,35 +99,20 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp) return status; /* pty */ - client_info.any[0] = rtdata->ptyany[0]; - client_info.any[1] = rtdata->ptyany[1]; - client_info.any[2] = rtdata->ptyany[2]; - client_info.any[3] = rtdata->ptyany[3]; - - status = ntapi->pty_inherit( - rtdata->hsession, - &hpty, - &client_info); - - /* ntaio */ - if (status == NT_STATUS_SUCCESS) { - if (rtdata->stdin_type == NT_FILE_TYPE_PTY) - rtdata->hstdin = hpty; - - if (rtdata->stdout_type == NT_FILE_TYPE_PTY) - rtdata->hstdout = hpty; - - if (rtdata->stderr_type == NT_FILE_TYPE_PTY) - rtdata->hstderr = hpty; + if ((status = ntapi->pty_inherit_runtime_ctty( + rtdata->hsession, + rtdata))) + return status; - /* ctty identification */ + /* ctty identification */ + if (rtdata->hctty) { client_info.any[0] = 0; client_info.any[1] = 0; client_info.any[2] = 0; client_info.any[3] = 0; if ((status = ntapi->pty_set( - hpty,&iosb, + rtdata->hctty,&iosb, &client_info,sizeof(client_info), NT_PTY_CLIENT_INFORMATION))) return status;