summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tty/ntapi_tty_create_session.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/tty/ntapi_tty_create_session.c b/src/tty/ntapi_tty_create_session.c
index e878160..dbc2842 100644
--- a/src/tty/ntapi_tty_create_session.c
+++ b/src/tty/ntapi_tty_create_session.c
@@ -42,6 +42,7 @@ int32_t __stdcall __ntapi_tty_create_session(
nt_runtime_data ssattr;
nt_runtime_data_block rtblock;
nt_create_process_params params;
+ nt_event_basic_information eready;
wchar16_t __attr_aligned__(8) __tty_image_name_fallback[] = {
'\\','?','?','\\',
@@ -181,12 +182,24 @@ int32_t __stdcall __ntapi_tty_create_session(
if ((status = __ntapi->tt_create_native_process(&params)))
return status;
- if ((status = __ntapi->zw_wait_for_single_object(
+ __ntapi->zw_wait_for_multiple_objects(
+ 2,
+ (void *[]){ssattr.srv_ready,params.hprocess},
+ NT_WAIT_ANY,
+ NT_SYNC_NON_ALERTABLE,
+ 0);
+
+ if ((status = __ntapi->zw_query_event(
ssattr.srv_ready,
- NT_SYNC_NON_ALERTABLE,
- 0)))
+ NT_EVENT_BASIC_INFORMATION,
+ &eready,
+ sizeof(eready),
+ &(size_t){0})))
return __tty_create_session_return(&params,status);
+ if (!eready.signal_state)
+ return __tty_create_session_return(&params,NT_STATUS_SYSTEM_PROCESS_TERMINATED);
+
/* connect to subsystem */
if ((status = __ntapi->tty_connect(
hport,