Abort input event send if the connection terminated

This commit is contained in:
akallabeth 2022-06-24 16:26:51 +02:00 committed by akallabeth
parent 488a0d1edd
commit 3d07eee3ac
1 changed files with 38 additions and 0 deletions

View File

@ -91,6 +91,10 @@ static BOOL input_send_synchronize_event(rdpInput* input, UINT32 flags)
return FALSE;
rdp = input->context->rdp;
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_SYNC);
if (!s)
@ -119,6 +123,10 @@ static BOOL input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
return FALSE;
rdp = input->context->rdp;
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
s = rdp_client_input_pdu_init(rdp, INPUT_EVENT_SCANCODE);
if (!s)
@ -143,6 +151,9 @@ static BOOL input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UIN
if (!input || !input->context)
return FALSE;
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
if (!freerdp_settings_get_bool(input->context->settings, FreeRDP_UnicodeInput))
{
WLog_WARN(TAG, "Unicode input not supported by server.");
@ -176,6 +187,9 @@ static BOOL input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT
rdp = input->context->rdp;
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
if (!freerdp_settings_get_bool(input->context->settings, FreeRDP_HasHorizontalWheel))
{
if (flags & PTR_FLAGS_HWHEEL)
@ -216,6 +230,9 @@ static BOOL input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT1
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
if (!freerdp_settings_get_bool(input->context->settings, FreeRDP_HasExtendedMouseEvent))
{
WLog_WARN(TAG,
@ -285,6 +302,9 @@ static BOOL input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags)
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
/* The FastPath Synchronization eventFlags has identical values as SlowPath */
s = fastpath_input_pdu_init(rdp->fastpath, (BYTE)flags, FASTPATH_INPUT_EVENT_SYNC);
@ -306,6 +326,9 @@ static BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UI
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0;
eventFlags |= (flags & KBD_FLAGS_EXTENDED) ? FASTPATH_INPUT_KBDFLAGS_EXTENDED : 0;
eventFlags |= (flags & KBD_FLAGS_EXTENDED1) ? FASTPATH_INPUT_KBDFLAGS_PREFIX_E1 : 0;
@ -332,6 +355,9 @@ static BOOL input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 f
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
if (!freerdp_settings_get_bool(input->context->settings, FreeRDP_UnicodeInput))
{
WLog_WARN(TAG, "Unicode input not supported by server.");
@ -360,6 +386,9 @@ static BOOL input_send_fastpath_mouse_event(rdpInput* input, UINT16 flags, UINT1
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
if (!freerdp_settings_get_bool(input->context->settings, FreeRDP_HasHorizontalWheel))
{
if (flags & PTR_FLAGS_HWHEEL)
@ -393,6 +422,9 @@ static BOOL input_send_fastpath_extended_mouse_event(rdpInput* input, UINT16 fla
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
if (!freerdp_settings_get_bool(input->context->settings, FreeRDP_HasExtendedMouseEvent))
{
WLog_WARN(TAG,
@ -423,6 +455,9 @@ static BOOL input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleSta
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
s = fastpath_input_pdu_init_header(rdp->fastpath);
if (!s)
@ -459,6 +494,9 @@ static BOOL input_send_fastpath_keyboard_pause_event(rdpInput* input)
rdp = input->context->rdp;
WINPR_ASSERT(rdp);
if (freerdp_shall_disconnect_context(input->context))
return FALSE;
s = fastpath_input_pdu_init_header(rdp->fastpath);
if (!s)