From 5b96cf964953757d98df8a36dd263de829c0328d Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 19 Jun 2018 13:04:38 +0000 Subject: __ntapi_pty_query(): refactor in anticipation of NT_PTY_OFD_INFORMATION. --- src/pty/ntapi_pty_query.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/pty/ntapi_pty_query.c b/src/pty/ntapi_pty_query.c index 329516a..725172c 100644 --- a/src/pty/ntapi_pty_query.c +++ b/src/pty/ntapi_pty_query.c @@ -21,7 +21,7 @@ int32_t __stdcall __ntapi_pty_query( int32_t status; void * hport; nt_pty_sigctl_msg msg; - uintptr_t * info; + nt_pty_client_info * anyinfo; if (pty_info_class>=NT_PTY_INFORMATION_CAP) return NT_STATUS_INVALID_INFO_CLASS; @@ -44,19 +44,21 @@ int32_t __stdcall __ntapi_pty_query( msg.header.msg_size = sizeof(msg); msg.data.ttyinfo.opcode = NT_TTY_PTY_QUERY; - if (pty_info_class == NT_PTY_CLIENT_INFORMATION) { - hport = pty->hport; - msg.data.ctlinfo.hpty = pty->hpty; - msg.data.ctlinfo.luid.high = pty->luid.high; - msg.data.ctlinfo.luid.low = pty->luid.low; - msg.data.ctlinfo.ctlcode = pty_info_class; - - __ntapi->tt_guid_copy( - &msg.data.ctlinfo.guid, - &pty->guid); - - } else { - return NT_STATUS_INVALID_INFO_CLASS; + switch (pty_info_class) { + case NT_PTY_CLIENT_INFORMATION: + hport = pty->hport; + msg.data.ctlinfo.hpty = pty->hpty; + msg.data.ctlinfo.luid.high = pty->luid.high; + msg.data.ctlinfo.luid.low = pty->luid.low; + msg.data.ctlinfo.ctlcode = pty_info_class; + + __ntapi->tt_guid_copy( + &msg.data.ctlinfo.guid, + &pty->guid); + break; + + default: + return NT_STATUS_INVALID_INFO_CLASS; } if ((status = __ntapi->zw_request_wait_reply_port(hport,&msg,&msg))) @@ -65,15 +67,15 @@ int32_t __stdcall __ntapi_pty_query( else if (msg.data.ttyinfo.status) return msg.data.ttyinfo.status; - iosb->info = msg.data.ctlinfo.iosb.info; - iosb->status = msg.data.ctlinfo.iosb.status; - if (pty_info_class == NT_PTY_CLIENT_INFORMATION) { - info = (uintptr_t *)pty_info; - info[0] = msg.data.ctlinfo.ctxarg[0]; - info[1] = msg.data.ctlinfo.ctxarg[1]; - info[2] = msg.data.ctlinfo.ctxarg[2]; - info[3] = msg.data.ctlinfo.ctxarg[3]; + anyinfo = (nt_pty_client_info *)pty_info; + anyinfo->any[0] = msg.data.ctlinfo.ctxarg[0]; + anyinfo->any[1] = msg.data.ctlinfo.ctxarg[1]; + anyinfo->any[2] = msg.data.ctlinfo.ctxarg[2]; + anyinfo->any[3] = msg.data.ctlinfo.ctxarg[3]; + + iosb->status = NT_STATUS_SUCCESS; + iosb->info = sizeof(*anyinfo); } -- cgit v1.2.3