diff options
author | midipix <writeonce@midipix.org> | 2017-01-01 18:39:21 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-01-07 09:02:19 -0500 |
commit | 47aaf28e9060c837e3c0d3a7ac009c434f95eda7 (patch) | |
tree | a1858207244d2da4c576d185836f096fd22e75d3 | |
parent | e47608b7ec59407d5bca7def446137b41e54ee64 (diff) | |
download | ntapi-47aaf28e9060c837e3c0d3a7ac009c434f95eda7.tar.bz2 ntapi-47aaf28e9060c837e3c0d3a7ac009c434f95eda7.tar.xz |
pty interfaces: added __ntapi_pty_open_pair().
-rw-r--r-- | include/ntapi/nt_tty.h | 10 | ||||
-rw-r--r-- | include/ntapi/ntapi.h | 1 | ||||
-rw-r--r-- | src/internal/ntapi.c | 1 | ||||
-rw-r--r-- | src/internal/ntapi_fnapi.h | 1 | ||||
-rw-r--r-- | src/pty/ntapi_pty_fd.c | 51 |
5 files changed, 58 insertions, 6 deletions
diff --git a/include/ntapi/nt_tty.h b/include/ntapi/nt_tty.h index 06dbd08..b0d9205 100644 --- a/include/ntapi/nt_tty.h +++ b/include/ntapi/nt_tty.h @@ -407,6 +407,16 @@ typedef int32_t __stdcall ntapi_pty_open( __in uint32_t open_options); +typedef int32_t __stdcall ntapi_pty_open_pair( + __in void * hport, + __out nt_pty ** pty, + __in uint32_t desired_access, + __in nt_object_attributes* obj_attr, + __out nt_iosb * iosb, + __in uint32_t share_access, + __in uint32_t open_options); + + typedef int32_t __stdcall ntapi_pty_reopen( __in void * hport, __in nt_pty * pty); diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h index 5b19340..780f11b 100644 --- a/include/ntapi/ntapi.h +++ b/include/ntapi/ntapi.h @@ -523,6 +523,7 @@ typedef struct _ntapi_vtbl { ntapi_tty_vms_query * tty_vms_query; ntapi_tty_vms_request * tty_vms_request; ntapi_pty_open * pty_open; + ntapi_pty_open_pair * pty_open_pair; ntapi_pty_reopen * pty_reopen; ntapi_pty_inherit * pty_inherit; ntapi_pty_inherit_runtime_ctty * pty_inherit_runtime_ctty; 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, |