Input events are only allowed after a connection was established
(connection state is active)
This check aborts input sending when done before that.
(cherry picked from commit
102869f6a860140174da9dd3189babf6966c9149)
return "UNKNOWN";
}
}
+
+int rdp_client_get_state(rdpRdp* rdp)
+{
+ if (!rdp)
+ return -1;
+ return rdp->state;
+}
FREERDP_LOCAL int rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL int rdp_client_transition_to_state(rdpRdp* rdp, int state);
FREERDP_LOCAL const char* rdp_client_connection_state_string(int state);
+FREERDP_LOCAL int rdp_client_get_state(rdpRdp* rdp);
FREERDP_LOCAL BOOL rdp_server_accept_nego(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL BOOL rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, wStream* s);
return s;
}
-BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNumEvents)
+BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, size_t iNumEvents)
{
+ int state;
BOOL rc = FALSE;
rdpRdp* rdp;
UINT16 length;
if (!s)
return FALSE;
- if (!fastpath || !fastpath->rdp)
+ if (!fastpath)
+ goto fail;
+
+ rdp = fastpath->rdp;
+ state = rdp_client_get_state(rdp);
+ if (state != CONNECTION_STATE_ACTIVE)
+ {
+ WLog_WARN(TAG, "[%s] called before activation [%s]", __FUNCTION__,
+ rdp_client_connection_state_string(state));
goto fail;
+ }
/*
* A maximum of 15 events are allowed per request
if (iNumEvents > 15)
goto fail;
- rdp = fastpath->rdp;
length = Stream_GetPosition(s);
if (length >= (2 << 14))
FREERDP_LOCAL wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags,
BYTE eventCode);
FREERDP_LOCAL BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s,
- int iEventCount);
+ size_t iEventCount);
FREERDP_LOCAL BOOL fastpath_send_input_pdu(rdpFastPath* fastpath, wStream* s);
FREERDP_LOCAL wStream* fastpath_update_pdu_init(rdpFastPath* fastpath);