diff options
author | midipix <writeonce@midipix.org> | 2017-01-06 10:15:11 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-01-07 09:02:30 -0500 |
commit | 0d309b364fdde867b244db13a6c3c491c5b573c2 (patch) | |
tree | 937c32a463bb898e24038cad88874b6cce95e244 /src/tty | |
parent | abc6f78b0efae0dc940e79be0d86a55271b7c22d (diff) | |
download | ntapi-0d309b364fdde867b244db13a6c3c491c5b573c2.tar.bz2 ntapi-0d309b364fdde867b244db13a6c3c491c5b573c2.tar.xz |
__ntapi_tty_create_session(): properly close the server ready event handle.
Diffstat (limited to 'src/tty')
-rw-r--r-- | src/tty/ntapi_tty_create_session.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/tty/ntapi_tty_create_session.c b/src/tty/ntapi_tty_create_session.c index dbc2842..6c57d39 100644 --- a/src/tty/ntapi_tty_create_session.c +++ b/src/tty/ntapi_tty_create_session.c @@ -9,14 +9,16 @@ #include "ntapi_impl.h" static int32_t __fastcall __tty_create_session_return( + void * hready, nt_create_process_params * params, int32_t status) { - if (status) + if (params->hprocess && status) __ntapi->zw_terminate_process( params->hprocess, NT_STATUS_UNEXPECTED_IO_ERROR); + __ntapi->zw_close(hready); __ntapi->zw_close(params->hprocess); __ntapi->zw_close(params->hthread); @@ -180,7 +182,7 @@ int32_t __stdcall __ntapi_tty_create_session( params.hsession = htty; if ((status = __ntapi->tt_create_native_process(¶ms))) - return status; + return __tty_create_session_return(ssattr.srv_ready,¶ms,status); __ntapi->zw_wait_for_multiple_objects( 2, @@ -195,17 +197,17 @@ int32_t __stdcall __ntapi_tty_create_session( &eready, sizeof(eready), &(size_t){0}))) - return __tty_create_session_return(¶ms,status); + return __tty_create_session_return(ssattr.srv_ready,¶ms,status); if (!eready.signal_state) - return __tty_create_session_return(¶ms,NT_STATUS_SYSTEM_PROCESS_TERMINATED); + return __tty_create_session_return(ssattr.srv_ready,¶ms,NT_STATUS_SYSTEM_PROCESS_TERMINATED); /* connect to subsystem */ if ((status = __ntapi->tty_connect( hport, &port_name->base_named_objects[0], NT_SECURITY_IMPERSONATION))) - return __tty_create_session_return(¶ms,status); + return __tty_create_session_return(ssattr.srv_ready,¶ms,status); /* finalize primary session */ if (type == NT_TTY_SESSION_PRIMARY) { @@ -219,5 +221,5 @@ int32_t __stdcall __ntapi_tty_create_session( sizeof(*port_name)); }; - return __tty_create_session_return(¶ms,NT_STATUS_SUCCESS); + return __tty_create_session_return(ssattr.srv_ready,¶ms,NT_STATUS_SUCCESS); } |