From 47aaf28e9060c837e3c0d3a7ac009c434f95eda7 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 1 Jan 2017 18:39:21 +0000 Subject: pty interfaces: added __ntapi_pty_open_pair(). --- src/internal/ntapi.c | 1 + src/internal/ntapi_fnapi.h | 1 + src/pty/ntapi_pty_fd.c | 51 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 47 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c index a4f6ac8..8456569 100644 --- a/src/internal/ntapi.c +++ b/src/internal/ntapi.c @@ -298,6 +298,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl) __ntapi->tty_vms_query = __ntapi_tty_vms_query; __ntapi->tty_vms_request = __ntapi_tty_vms_request; __ntapi->pty_open = __ntapi_pty_open; + __ntapi->pty_open_pair = __ntapi_pty_open_pair; __ntapi->pty_reopen = __ntapi_pty_reopen; __ntapi->pty_inherit = __ntapi_pty_inherit; __ntapi->pty_inherit_runtime_ctty = __ntapi_pty_inherit_runtime_ctty; diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h index 6b90734..1e2c8f4 100644 --- a/src/internal/ntapi_fnapi.h +++ b/src/internal/ntapi_fnapi.h @@ -187,6 +187,7 @@ ntapi_tty_request_peer __ntapi_tty_request_peer; ntapi_tty_vms_query __ntapi_tty_vms_query; ntapi_tty_vms_request __ntapi_tty_vms_request; ntapi_pty_open __ntapi_pty_open; +ntapi_pty_open_pair __ntapi_pty_open_pair; ntapi_pty_reopen __ntapi_pty_reopen; ntapi_pty_inherit __ntapi_pty_inherit; ntapi_pty_inherit_runtime_ctty __ntapi_pty_inherit_runtime_ctty; diff --git a/src/pty/ntapi_pty_fd.c b/src/pty/ntapi_pty_fd.c index 3071482..b35804e 100644 --- a/src/pty/ntapi_pty_fd.c +++ b/src/pty/ntapi_pty_fd.c @@ -167,14 +167,15 @@ static int32_t __ntapi_pty_connect( } -int32_t __stdcall __ntapi_pty_open( +static int32_t __ntapi_pty_open_impl( void * hport, nt_pty ** pty, uint32_t desired_access, nt_object_attributes* obj_attr, nt_iosb * iosb, uint32_t share_access, - uint32_t open_options) + uint32_t open_options, + nt_pty * rpty) { int32_t status; nt_guid guid; @@ -221,10 +222,12 @@ int32_t __stdcall __ntapi_pty_open( ctx->options = open_options; /* pts */ - if (obj_attr->root_dir) { - ctx->hpty = ((nt_pty *)obj_attr->root_dir)->hpty; - ctx->luid.high = ((nt_pty *)obj_attr->root_dir)->luid.high; - ctx->luid.low = ((nt_pty *)obj_attr->root_dir)->luid.low; + if (rpty) { + ctx->hpty = rpty->hpty; + ctx->luid.high = rpty->luid.high; + ctx->luid.low = rpty->luid.low; + } else { + ctx->hpty = obj_attr->root_dir; } if ((status = __ntapi_pty_connect(hport,ctx,iosb))) @@ -235,6 +238,42 @@ int32_t __stdcall __ntapi_pty_open( return NT_STATUS_SUCCESS; } +int32_t __stdcall __ntapi_pty_open( + void * hport, + nt_pty ** pty, + uint32_t desired_access, + nt_object_attributes* obj_attr, + nt_iosb * iosb, + uint32_t share_access, + uint32_t open_options) +{ + return __ntapi_pty_open_impl( + hport,pty, + desired_access, + obj_attr,iosb, + share_access, + open_options, + (nt_pty *)obj_attr->root_dir); +} + +int32_t __stdcall __ntapi_pty_open_pair( + void * hport, + nt_pty ** pty, + uint32_t desired_access, + nt_object_attributes* obj_attr, + nt_iosb * iosb, + uint32_t share_access, + uint32_t open_options) +{ + return __ntapi_pty_open_impl( + hport,pty, + desired_access, + obj_attr,iosb, + share_access, + open_options, + 0); +} + int32_t __stdcall __ntapi_pty_inherit( __in void * hport, __out nt_pty ** pty, -- cgit v1.2.3