diff options
author | midipix <writeonce@midipix.org> | 2018-06-19 13:04:38 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-06-19 18:57:43 -0400 |
commit | 5b96cf964953757d98df8a36dd263de829c0328d (patch) | |
tree | 0f1afcffaef97bbf2d3d695fd93d7ba5b5cdbb6d | |
parent | 57636446c36f9f7ae3121dee57731429e49a1a06 (diff) | |
download | ntapi-5b96cf964953757d98df8a36dd263de829c0328d.tar.bz2 ntapi-5b96cf964953757d98df8a36dd263de829c0328d.tar.xz |
__ntapi_pty_query(): refactor in anticipation of NT_PTY_OFD_INFORMATION.
-rw-r--r-- | src/pty/ntapi_pty_query.c | 46 |
1 files 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); } |