Merge pull request #6360 from kubistika/proxy_rail_handshake_ex_flags_sync

server: proxy: rail: handshake ex flags sync
This commit is contained in:
Kobi 2020-07-07 15:54:08 +03:00 committed by GitHub
commit 5667c12be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -297,8 +297,6 @@ static UINT rail_send_server_handshake_ex(RailServerContext* context,
if (!context || !handshakeEx || !context->priv)
return ERROR_INVALID_PARAMETER;
/* Save channel flags to context */
context->priv->channelFlags = handshakeEx->railHandshakeFlags;
s = rail_pdu_init(RAIL_HANDSHAKE_EX_ORDER_LENGTH);
if (!s)
@ -307,6 +305,8 @@ static UINT rail_send_server_handshake_ex(RailServerContext* context,
return CHANNEL_RC_NO_MEMORY;
}
rail_server_set_handshake_ex_flags(context, handshakeEx->railHandshakeFlags);
rail_write_handshake_ex_order(s, handshakeEx);
error = rail_server_send_pdu(context, s, TS_RAIL_ORDER_HANDSHAKE_EX);
Stream_Free(s, TRUE);
@ -1522,6 +1522,17 @@ void rail_server_context_free(RailServerContext* context)
free(context);
}
void rail_server_set_handshake_ex_flags(RailServerContext* context, DWORD flags)
{
RailServerPrivate* priv;
if (!context || !context->priv)
return;
priv = context->priv;
priv->channelFlags = flags;
}
UINT rail_server_handle_messages(RailServerContext* context)
{
UINT status = CHANNEL_RC_OK;

View File

@ -141,6 +141,7 @@ extern "C"
FREERDP_API RailServerContext* rail_server_context_new(HANDLE vcm);
FREERDP_API void rail_server_context_free(RailServerContext* context);
FREERDP_API UINT rail_server_handle_messages(RailServerContext* context);
FREERDP_API void rail_server_set_handshake_ex_flags(RailServerContext* context, DWORD flags);
#ifdef __cplusplus
}

View File

@ -38,6 +38,15 @@ BOOL pf_rail_context_init(pServerContext* ps)
return FALSE;
}
/*
* when mstsc reconnects, it doesn't wait for a second handshake, so update all handshake flags
* to be SET, then set them again when the remote server sends his handshake.
*/
rail_server_set_handshake_ex_flags(rail,
TS_RAIL_ORDER_HANDSHAKEEX_FLAGS_HIDEF |
TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED |
TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_SNAP_ARRANGE_SUPPORTED);
rail->rdpcontext = (rdpContext*)ps;
return TRUE;
}