summaryrefslogtreecommitdiffhomepage
path: root/src/pty/ntapi_pty_fd.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-08-14 00:38:16 +0300
committermidipix <writeonce@midipix.org>2015-09-26 11:17:01 -0400
commitefc01e81a13322864775f13003a22c786dc357ed (patch)
treea376e339003fca93a1eaa8dd9d1f808071cfa277 /src/pty/ntapi_pty_fd.c
parent188aac80bc344c30d15e82931391c833953fd432 (diff)
downloadntapi-efc01e81a13322864775f13003a22c786dc357ed.tar.bz2
ntapi-efc01e81a13322864775f13003a22c786dc357ed.tar.xz
pty inheritance: client-side implementation.
Diffstat (limited to 'src/pty/ntapi_pty_fd.c')
-rw-r--r--src/pty/ntapi_pty_fd.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/pty/ntapi_pty_fd.c b/src/pty/ntapi_pty_fd.c
index ee0b426..bb7e77e 100644
--- a/src/pty/ntapi_pty_fd.c
+++ b/src/pty/ntapi_pty_fd.c
@@ -213,6 +213,51 @@ int32_t __stdcall __ntapi_pty_open(
return NT_STATUS_SUCCESS;
}
+int32_t __stdcall __ntapi_pty_inherit(
+ __in void * hport,
+ __out nt_pty ** pty,
+ __in nt_pty_client_info * client_info)
+{
+ int32_t status;
+ nt_iosb iosb;
+ nt_pty_inherit_info inherit;
+ nt_pty * ctx;
+
+ inherit.any[0] = client_info->any[0];
+ inherit.any[1] = client_info->any[1];
+ inherit.any[2] = client_info->any[2];
+ inherit.any[3] = client_info->any[3];
+
+ if ((status = __ntapi_pty_query(
+ hport,&iosb,
+ &inherit,sizeof(inherit),
+ NT_PTY_INHERIT_INFORMATION)))
+ return status;
+
+ /* control block */
+ if ((status = __ntapi_pty_alloc(&ctx)))
+ return status;
+
+ __ntapi_tt_guid_copy(
+ &ctx->guid,
+ &inherit.guid);
+
+ ctx->access = inherit.access;
+ ctx->flags = inherit.flags;
+ ctx->share = inherit.share;
+ ctx->options = inherit.options;
+
+ ctx->luid.low = inherit.luid.low;
+ ctx->luid.high = inherit.luid.high;
+
+ if ((status = __ntapi_pty_connect(hport,ctx,&iosb)))
+ return status;
+
+ *pty = ctx;
+
+ return NT_STATUS_SUCCESS;
+}
+
int32_t __stdcall __ntapi_pty_reopen(
__in void * hport,
__in nt_pty * pty)