diff --git a/include/freerdp/peer.h b/include/freerdp/peer.h index fff7b8ef3..4b2afe0de 100644 --- a/include/freerdp/peer.h +++ b/include/freerdp/peer.h @@ -47,6 +47,7 @@ typedef BOOL (*psPeerCapabilities)(freerdp_peer* peer); typedef BOOL (*psPeerPostConnect)(freerdp_peer* peer); typedef BOOL (*psPeerActivate)(freerdp_peer* peer); typedef BOOL (*psPeerLogon)(freerdp_peer* peer, SEC_WINNT_AUTH_IDENTITY* identity, BOOL automatic); +typedef BOOL (*psPeerAdjustMonitorsLayout)(freerdp_peer* peer); typedef int (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, BYTE* data, int size); typedef int (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, BYTE* data, int size, @@ -61,6 +62,7 @@ typedef int (*psPeerVirtualChannelWrite)(freerdp_peer* peer, HANDLE hChannel, BY typedef void* (*psPeerVirtualChannelGetData)(freerdp_peer* peer, HANDLE hChannel); typedef int (*psPeerVirtualChannelSetData)(freerdp_peer* peer, HANDLE hChannel, void* data); + struct rdp_freerdp_peer { rdpContext* context; @@ -113,6 +115,7 @@ struct rdp_freerdp_peer psPeerDrainOutputBuffer DrainOutputBuffer; psPeerHasMoreToRead HasMoreToRead; psPeerGetEventHandles GetEventHandles; + psPeerAdjustMonitorsLayout AdjustMonitorsLayout; }; #ifdef __cplusplus diff --git a/libfreerdp/core/activation.c b/libfreerdp/core/activation.c index 2db0566a0..0f4a90a85 100644 --- a/libfreerdp/core/activation.c +++ b/libfreerdp/core/activation.c @@ -365,11 +365,13 @@ BOOL rdp_server_accept_client_control_pdu(rdpRdp* rdp, wStream* s) BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, wStream* s) { rdpSettings *settings = rdp->settings; + freerdp_peer *peer = rdp->context->peer; if (!rdp_recv_client_font_list_pdu(s)) return FALSE; - if (settings->SupportMonitorLayoutPdu && settings->MonitorCount) + if (settings->SupportMonitorLayoutPdu && settings->MonitorCount && peer->AdjustMonitorsLayout && + peer->AdjustMonitorsLayout(peer)) { /* client supports the monitorLayout PDU, let's send him the monitors if any */ wStream *st; @@ -386,8 +388,6 @@ BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, wStream* s) } r = rdp_send_data_pdu(rdp, st, DATA_PDU_TYPE_MONITOR_LAYOUT, 0); - Stream_Free(st, TRUE); - if (!r) return FALSE; } diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index 0063ddc84..8737eba55 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -575,7 +575,7 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) { WLog_ERR(TAG, "peer_recv_callback: CONNECTION_STATE_LICENSING - license_send_valid_client_error_packet() fail"); - return FALSE; + return -1; } rdp_server_transition_to_state(rdp, CONNECTION_STATE_CAPABILITIES_EXCHANGE); @@ -585,7 +585,9 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra) case CONNECTION_STATE_CAPABILITIES_EXCHANGE: if (!rdp->AwaitCapabilities) { - IFCALL(client->Capabilities, client); + + if (client->Capabilities && !client->Capabilities(client)) + return -1; if (!rdp_send_demand_active(rdp)) {