diff options
-rw-r--r-- | include/ntapi/nt_tty.h | 4 | ||||
-rw-r--r-- | include/ntapi/ntapi.h | 1 | ||||
-rw-r--r-- | project/common.mk | 1 | ||||
-rw-r--r-- | src/internal/ntapi.c | 1 | ||||
-rw-r--r-- | src/internal/ntapi_fnapi.h | 1 | ||||
-rw-r--r-- | src/tty/ntapi_tty_client_session_disconnect.c | 38 |
6 files changed, 46 insertions, 0 deletions
diff --git a/include/ntapi/nt_tty.h b/include/ntapi/nt_tty.h index 22c24a4..387c8b6 100644 --- a/include/ntapi/nt_tty.h +++ b/include/ntapi/nt_tty.h @@ -438,6 +438,10 @@ typedef int32_t __stdcall ntapi_tty_connect( __in int32_t impersonation_level); +typedef int32_t __stdcall ntapi_tty_client_session_disconnect( + __in void * hport); + + typedef int32_t __stdcall ntapi_tty_client_session_query( __in void * hport, __out nt_tty_session_info * sessioninfo); diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h index eff9c94..7e8208c 100644 --- a/include/ntapi/ntapi.h +++ b/include/ntapi/ntapi.h @@ -536,6 +536,7 @@ typedef struct _ntapi_vtbl { ntapi_tty_create_session * tty_create_session; ntapi_tty_join_session * tty_join_session; ntapi_tty_connect * tty_connect; + ntapi_tty_client_session_disconnect * tty_client_session_disconnect; ntapi_tty_client_session_query * tty_client_session_query; ntapi_tty_client_session_set * tty_client_session_set; ntapi_tty_client_process_register * tty_client_process_register; diff --git a/project/common.mk b/project/common.mk index 65d6713..a8e0cd9 100644 --- a/project/common.mk +++ b/project/common.mk @@ -94,6 +94,7 @@ COMMON_SRCS = \ src/thread/ntapi_tt_create_thread.c \ src/token/ntapi_tt_token_privilege.c \ src/tty/ntapi_tty_client_process_register.c \ + src/tty/ntapi_tty_client_session_disconnect.c \ src/tty/ntapi_tty_client_session_query.c \ src/tty/ntapi_tty_client_session_set.c \ src/tty/ntapi_tty_connect.c \ diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c index 8e3c4b9..42812c0 100644 --- a/src/internal/ntapi.c +++ b/src/internal/ntapi.c @@ -327,6 +327,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl) __ntapi->tty_create_session = __ntapi_tty_create_session; __ntapi->tty_join_session = __ntapi_tty_join_session; __ntapi->tty_connect = __ntapi_tty_connect; + __ntapi->tty_client_session_disconnect = __ntapi_tty_client_session_disconnect; __ntapi->tty_client_session_query = __ntapi_tty_client_session_query; __ntapi->tty_client_session_set = __ntapi_tty_client_session_set; __ntapi->tty_client_process_register = __ntapi_tty_client_process_register; diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h index 9fa215c..39f8ac3 100644 --- a/src/internal/ntapi_fnapi.h +++ b/src/internal/ntapi_fnapi.h @@ -199,6 +199,7 @@ ntapi_vfd_dev_name_init __ntapi_vfd_dev_name_init; ntapi_tty_create_session __ntapi_tty_create_session; ntapi_tty_join_session __ntapi_tty_join_session; ntapi_tty_connect __ntapi_tty_connect; +ntapi_tty_client_session_disconnect __ntapi_tty_client_session_disconnect; ntapi_tty_client_session_query __ntapi_tty_client_session_query; ntapi_tty_client_session_set __ntapi_tty_client_session_set; ntapi_tty_client_process_register __ntapi_tty_client_process_register; diff --git a/src/tty/ntapi_tty_client_session_disconnect.c b/src/tty/ntapi_tty_client_session_disconnect.c new file mode 100644 index 0000000..e977749 --- /dev/null +++ b/src/tty/ntapi_tty_client_session_disconnect.c @@ -0,0 +1,38 @@ +/********************************************************/ +/* ntapi: Native API core library */ +/* Copyright (C) 2013--2017 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */ +/********************************************************/ + +#include <psxtypes/psxtypes.h> +#include <ntapi/nt_tty.h> +#include <ntapi/ntapi.h> +#include "ntapi_impl.h" + +typedef struct _nt_tty_disconnect_msg { + nt_port_message header; + struct { + nt_tty_msg_info ttyinfo; + } data; +} nt_tty_disconnect_msg; + +int32_t __stdcall __ntapi_tty_client_session_disconnect(void * hport) +{ + int32_t status; + nt_tty_disconnect_msg msg; + + hport = hport ? hport : __ntapi_internals()->hport_tty_session; + + __ntapi->tt_aligned_block_memset( + &msg,0,sizeof(msg)); + + msg.header.msg_type = NT_LPC_NEW_MESSAGE; + msg.header.data_size = sizeof(msg.data); + msg.header.msg_size = sizeof(msg); + msg.data.ttyinfo.opcode = NT_TTY_CLIENT_SESSION_DISCONNECT; + + if ((status = __ntapi->zw_request_wait_reply_port(hport,&msg,&msg))) + return status; + + return msg.data.ttyinfo.status; +} |