Merge pull request #3482 from realjiangms/fix_gfx_win8

server/shadow: Fix regression with rdp8.0
This commit is contained in:
David Fort 2016-09-09 11:16:29 +02:00 committed by GitHub
commit 1855e36179
2 changed files with 40 additions and 7 deletions

View File

@ -716,6 +716,12 @@ BOOL freerdp_peer_context_new(freerdp_peer* client)
update_register_server_callbacks(client->update); update_register_server_callbacks(client->update);
autodetect_register_server_callbacks(client->autodetect); autodetect_register_server_callbacks(client->autodetect);
if (!(context->errorDescription = calloc(1, 500)))
{
WLog_ERR(TAG, "calloc failed!");
goto fail_error_description;
}
if (!transport_attach(rdp->transport, client->sockfd)) if (!transport_attach(rdp->transport, client->sockfd))
goto fail_transport_attach; goto fail_transport_attach;
@ -734,6 +740,8 @@ BOOL freerdp_peer_context_new(freerdp_peer* client)
WLog_ERR(TAG, "ContextNew callback failed"); WLog_ERR(TAG, "ContextNew callback failed");
fail_transport_attach: fail_transport_attach:
free(context->errorDescription);
fail_error_description:
rdp_free(client->context->rdp); rdp_free(client->context->rdp);
fail_rdp: fail_rdp:
metrics_free(context->metrics); metrics_free(context->metrics);
@ -750,7 +758,20 @@ void freerdp_peer_context_free(freerdp_peer* client)
{ {
IFCALL(client->ContextFree, client, client->context); IFCALL(client->ContextFree, client, client->context);
if (client->context)
{
free(client->context->errorDescription);
client->context->errorDescription = NULL;
rdp_free(client->context->rdp);
client->context->rdp = NULL;
metrics_free(client->context->metrics); metrics_free(client->context->metrics);
client->context->metrics = NULL;
free(client->context);
client->context = NULL;
}
} }
freerdp_peer* freerdp_peer_new(int sockfd) freerdp_peer* freerdp_peer_new(int sockfd)
@ -798,10 +819,5 @@ void freerdp_peer_free(freerdp_peer* client)
if (!client) if (!client)
return; return;
if (client->context)
{
rdp_free(client->context->rdp);
free(client->context);
}
free(client); free(client);
} }

View File

@ -53,7 +53,10 @@ static UINT rdpgfx_caps_advertise(RdpgfxServerContext* context, RDPGFX_CAPS_ADVE
return context->CapsConfirm(context, &pdu); return context->CapsConfirm(context, &pdu);
} }
else if (pdu.capsSet->version == RDPGFX_CAPVERSION_81) }
for (index = 0; index < capsAdvertise->capsSetCount; index++)
{
if (pdu.capsSet->version == RDPGFX_CAPVERSION_81)
{ {
if (settings) if (settings)
{ {
@ -66,6 +69,20 @@ static UINT rdpgfx_caps_advertise(RdpgfxServerContext* context, RDPGFX_CAPS_ADVE
return context->CapsConfirm(context, &pdu); return context->CapsConfirm(context, &pdu);
} }
} }
for (index = 0; index < capsAdvertise->capsSetCount; index++)
{
if (pdu.capsSet->version == RDPGFX_CAPVERSION_8)
{
if (settings)
{
flags = pdu.capsSet->flags;
settings->GfxThinClient = (flags & RDPGFX_CAPS_FLAG_THINCLIENT);
settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE);
}
return context->CapsConfirm(context, &pdu);
}
}
return CHANNEL_RC_UNSUPPORTED_VERSION; return CHANNEL_RC_UNSUPPORTED_VERSION;
} }