rail: keep extendedSpiSupported flag synced

This commit is contained in:
Kobi Mizrachi 2019-12-10 12:03:30 +02:00 committed by akallabeth
parent 5565b366b0
commit 7af2483626
5 changed files with 16 additions and 7 deletions

View File

@ -172,6 +172,7 @@ static UINT rail_send_client_sysparam(RailClientContext* context, RAIL_SYSPARAM_
size_t length = RAIL_SYSPARAM_ORDER_LENGTH;
railPlugin* rail;
UINT error;
BOOL extendedSpiSupported;
if (!context || !sysparam)
return ERROR_INVALID_PARAMETER;
@ -219,9 +220,8 @@ static UINT rail_send_client_sysparam(RailClientContext* context, RAIL_SYSPARAM_
return CHANNEL_RC_NO_MEMORY;
}
if ((error = rail_write_sysparam_order(
s, sysparam,
(rail->channelFlags & TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED) != 0)))
extendedSpiSupported = rail_is_extended_spi_supported(rail->channelFlags);
if ((error = rail_write_sysparam_order(s, sysparam, extendedSpiSupported)))
{
WLog_ERR(TAG, "rail_write_client_sysparam_order failed with error %" PRIu32 "!", error);
Stream_Free(s, TRUE);

View File

@ -498,11 +498,13 @@ static UINT rail_recv_server_sysparam_order(railPlugin* rail, wStream* s)
RailClientContext* context = rail_get_client_interface(rail);
RAIL_SYSPARAM_ORDER sysparam;
UINT error;
BOOL extendedSpiSupported;
if (!context || !s)
return ERROR_INVALID_PARAMETER;
if ((error = rail_read_sysparam_order(s, &sysparam, FALSE)))
extendedSpiSupported = rail_is_extended_spi_supported(rail->channelFlags);
if ((error = rail_read_sysparam_order(s, &sysparam, extendedSpiSupported)))
{
WLog_ERR(TAG, "rail_read_sysparam_order failed with error %" PRIu32 "!", error);
return error;

View File

@ -567,3 +567,8 @@ UINT rail_write_sysparam_order(wStream* s, const RAIL_SYSPARAM_ORDER* sysparam,
return error;
}
BOOL rail_is_extended_spi_supported(UINT32 channelFlags)
{
return channelFlags & TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED;
}

View File

@ -71,5 +71,6 @@ UINT rail_write_unicode_string_value(wStream* s, const RAIL_UNICODE_STRING* unic
UINT rail_read_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam, BOOL extendedSpiSupported);
UINT rail_write_sysparam_order(wStream* s, const RAIL_SYSPARAM_ORDER* sysparam,
BOOL extendedSpiSupported);
BOOL rail_is_extended_spi_supported(UINT32 channelsFlags);
#endif /* FREERDP_CHANNEL_RAIL_COMMON_H */

View File

@ -334,8 +334,7 @@ static UINT rail_send_server_sysparam(RailServerContext* context,
if (!priv)
return ERROR_INVALID_PARAMETER;
extendedSpiSupported =
!((priv->channelFlags & TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED) == 0);
extendedSpiSupported = rail_is_extended_spi_supported(context->priv->channelFlags);
s = rail_pdu_init(RAIL_SYSPARAM_ORDER_LENGTH);
if (!s)
@ -986,11 +985,13 @@ static UINT rail_recv_client_sysparam_order(RailServerContext* context,
RAIL_SYSPARAM_ORDER* sysparam, wStream* s)
{
UINT error;
BOOL extendedSpiSupported;
if (!context || !sysparam || !s)
return ERROR_INVALID_PARAMETER;
if ((error = rail_read_sysparam_order(s, sysparam, FALSE)))
extendedSpiSupported = rail_is_extended_spi_supported(context->priv->channelFlags);
if ((error = rail_read_sysparam_order(s, sysparam, extendedSpiSupported)))
{
WLog_ERR(TAG, "rail_read_sysparam_order failed with error %" PRIu32 "!", error);
return error;