Merge pull request #5935 from akallabeth/shadow_server_mstsc_fix

Fixed shadow server with mstsc as client.
This commit is contained in:
Norbert Federa 2020-03-03 13:26:16 +01:00 committed by GitHub
commit 20ff1a5b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 13 deletions

View File

@ -223,6 +223,8 @@ static BOOL wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 le
channel->dvc_total_length);
channel->dvc_total_length = 0;
}
else
ret = TRUE;
}
else
{

View File

@ -2139,6 +2139,8 @@ BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
BOOL update_read_suppress_output(rdpUpdate* update, wStream* s)
{
RECTANGLE_16* prect = NULL;
RECTANGLE_16 rect = { 0 };
BYTE allowDisplayUpdates;
if (Stream_GetRemainingLength(s) < 4)
@ -2147,12 +2149,20 @@ BOOL update_read_suppress_output(rdpUpdate* update, wStream* s)
Stream_Read_UINT8(s, allowDisplayUpdates);
Stream_Seek(s, 3); /* pad3Octects */
if (allowDisplayUpdates > 0 && Stream_GetRemainingLength(s) < 8)
return FALSE;
if (allowDisplayUpdates > 0)
{
if (Stream_GetRemainingLength(s) < sizeof(RECTANGLE_16))
return FALSE;
Stream_Read_UINT16(s, rect.left);
Stream_Read_UINT16(s, rect.top);
Stream_Read_UINT16(s, rect.right);
Stream_Read_UINT16(s, rect.bottom);
prect = &rect;
}
if (update->context->settings->SuppressOutput)
IFCALL(update->SuppressOutput, update->context, allowDisplayUpdates,
allowDisplayUpdates > 0 ? (RECTANGLE_16*)Stream_Pointer(s) : NULL);
IFCALL(update->SuppressOutput, update->context, allowDisplayUpdates, prect);
else
WLog_Print(update->log, WLOG_WARN, "ignoring suppress output request from client");

View File

@ -423,8 +423,9 @@ static BOOL shadow_client_refresh_request(rdpShadowClient* client)
return MessageQueue_Dispatch(MsgPipe->In, &message);
}
static BOOL shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_16* areas)
static BOOL shadow_client_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
rdpShadowClient* client = (rdpShadowClient*)context;
RECTANGLE_16* rects;
/* It is invalid if we have area count but no actual area */
@ -452,8 +453,9 @@ static BOOL shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECT
return shadow_client_refresh_request(client);
}
static BOOL shadow_client_suppress_output(rdpShadowClient* client, BYTE allow, RECTANGLE_16* area)
static BOOL shadow_client_suppress_output(rdpContext* context, BYTE allow, const RECTANGLE_16* area)
{
rdpShadowClient* client = (rdpShadowClient*)context;
RECTANGLE_16 region;
client->suppressOutput = allow ? FALSE : TRUE;
@ -497,7 +499,7 @@ static BOOL shadow_client_activate(freerdp_peer* peer)
}
/* Update full screen in next update */
return shadow_client_refresh_rect(client, 0, NULL);
return shadow_client_refresh_rect(&client->context, 0, NULL);
}
static BOOL shadow_client_logon(freerdp_peer* peer, SEC_WINNT_AUTH_IDENTITY* identity,
@ -583,8 +585,9 @@ static INLINE void shadow_client_common_frame_acknowledge(rdpShadowClient* clien
client->encoder->lastAckframeId = frameId;
}
static BOOL shadow_client_surface_frame_acknowledge(rdpShadowClient* client, UINT32 frameId)
static BOOL shadow_client_surface_frame_acknowledge(rdpContext* context, UINT32 frameId)
{
rdpShadowClient* client = (rdpShadowClient*)context;
shadow_client_common_frame_acknowledge(client, frameId);
/*
* Reset queueDepth for legacy none RDPGFX acknowledge
@ -689,7 +692,7 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
#endif
/* Request full screen update for new gfx channel */
if (!shadow_client_refresh_rect((rdpShadowClient*)context->custom, 0, NULL))
if (!shadow_client_refresh_rect(&client->context, 0, NULL))
return rc;
if (shadow_client_caps_test_version(context, h264, capsAdvertise->capsSets,
@ -1646,10 +1649,9 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
peer->Logon = shadow_client_logon;
shadow_input_register_callbacks(peer->input);
peer->Initialize(peer);
peer->update->RefreshRect = (pRefreshRect)shadow_client_refresh_rect;
peer->update->SuppressOutput = (pSuppressOutput)shadow_client_suppress_output;
peer->update->SurfaceFrameAcknowledge =
(pSurfaceFrameAcknowledge)shadow_client_surface_frame_acknowledge;
peer->update->RefreshRect = shadow_client_refresh_rect;
peer->update->SuppressOutput = shadow_client_suppress_output;
peer->update->SurfaceFrameAcknowledge = shadow_client_surface_frame_acknowledge;
if ((!client->vcm) || (!subsystem->updateEvent))
goto out;