|
|
dd89bb |
/********************************************************/
|
|
|
dd89bb |
/* ntapi: Native API core library */
|
|
|
64e606 |
/* Copyright (C) 2013--2021 SysDeer Technologies, LLC */
|
|
|
dd89bb |
/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
|
|
|
dd89bb |
/********************************************************/
|
|
|
dd89bb |
|
|
|
dd89bb |
#include <psxtypes/psxtypes.h>
|
|
|
dd89bb |
#include <ntapi/nt_tty.h>
|
|
|
dd89bb |
#include <ntapi/ntapi.h>
|
|
|
dd89bb |
#include "ntapi_impl.h"
|
|
|
dd89bb |
|
|
|
c16244 |
#define __MSGBUF_ELEMENTS (NT_LPC_MAX_MSG_DATA_SIZE/sizeof(uintptr_t)) + 1
|
|
|
c16244 |
|
|
|
c16244 |
int32_t __stdcall __ntapi_tty_query_information_server(
|
|
|
dd89bb |
__in void * hport,
|
|
|
c16244 |
__out nt_io_status_block * iosb,
|
|
|
c16244 |
__out void * tty_info,
|
|
|
c16244 |
__in uint32_t tty_info_length,
|
|
|
c16244 |
__in int tty_info_class)
|
|
|
dd89bb |
{
|
|
|
c16244 |
int32_t status;
|
|
|
c16244 |
nt_tty_server_msg * msg;
|
|
|
c16244 |
uintptr_t msgbuf[__MSGBUF_ELEMENTS];
|
|
|
dd89bb |
|
|
|
dd89bb |
__ntapi->tt_aligned_block_memset(
|
|
|
c16244 |
msgbuf,0,
|
|
|
c16244 |
sizeof(msgbuf));
|
|
|
c16244 |
|
|
|
c16244 |
msg = (nt_tty_server_msg *)msgbuf;
|
|
|
c16244 |
msg->header.msg_type = NT_LPC_NEW_MESSAGE;
|
|
|
c16244 |
msg->header.data_size = sizeof(msg->data);
|
|
|
c16244 |
msg->header.msg_size = sizeof(*msg);
|
|
|
c16244 |
msg->data.ttyinfo.opcode = NT_TTY_QUERY_INFORMATION_SERVER;
|
|
|
c16244 |
msg->data.srvinfo.info_class = tty_info_class;
|
|
|
dd89bb |
|
|
|
c16244 |
if (!hport)
|
|
|
c16244 |
hport = __ntapi_internals()->hport_tty_session;
|
|
|
dd89bb |
|
|
|
c16244 |
if ((status = __ntapi->zw_request_wait_reply_port(hport,msg,msg)))
|
|
|
dd89bb |
return status;
|
|
|
c16244 |
else if (msg->data.ttyinfo.status)
|
|
|
c16244 |
return msg->data.ttyinfo.status;
|
|
|
c16244 |
|
|
|
c16244 |
if (tty_info_length < msg->data.srvinfo.info_length)
|
|
|
c16244 |
return NT_STATUS_BUFFER_TOO_SMALL;
|
|
|
c16244 |
|
|
|
c16244 |
__ntapi->tt_generic_memcpy(
|
|
|
c16244 |
tty_info,
|
|
|
c16244 |
msg->data.srvinfo.info_buffer,
|
|
|
c16244 |
msg->data.srvinfo.info_length);
|
|
|
dd89bb |
|
|
|
c16244 |
iosb->status = NT_STATUS_SUCCESS;
|
|
|
c16244 |
iosb->info = msg->data.srvinfo.info_length;
|
|
|
dd89bb |
|
|
|
dd89bb |
return NT_STATUS_SUCCESS;
|
|
|
dd89bb |
}
|