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/pty/ntapi_pty_fd.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) (limited to 'src/pty') 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