From b58ee586e7f74c81df3f2d9c8dba6ac86a3701bf Mon Sep 17 00:00:00 2001 From: "zihao.jiang" Date: Sat, 29 Oct 2016 00:28:10 +0800 Subject: [PATCH] keeping the old callback and adding the new one at the end of the struct, so that it can be potentially binary compatible. --- include/freerdp/peer.h | 4 +++- libfreerdp/core/peer.c | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/freerdp/peer.h b/include/freerdp/peer.h index 7bc7f19..fff7b8e 100644 --- a/include/freerdp/peer.h +++ b/include/freerdp/peer.h @@ -34,6 +34,7 @@ typedef void (*psPeerContextFree)(freerdp_peer* peer, rdpContext* context); typedef BOOL (*psPeerInitialize)(freerdp_peer* peer); typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* peer, void** rfds, int* rcount); +typedef HANDLE(*psPeerGetEventHandle)(freerdp_peer* peer); typedef DWORD (*psPeerGetEventHandles)(freerdp_peer* peer, HANDLE* events, DWORD count); typedef HANDLE(*psPeerGetReceiveEventHandle)(freerdp_peer* peer); typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer); @@ -79,7 +80,7 @@ struct rdp_freerdp_peer psPeerInitialize Initialize; psPeerGetFileDescriptor GetFileDescriptor; - psPeerGetEventHandles GetEventHandles; + psPeerGetEventHandle GetEventHandle; psPeerGetReceiveEventHandle GetReceiveEventHandle; psPeerCheckFileDescriptor CheckFileDescriptor; psPeerClose Close; @@ -111,6 +112,7 @@ struct rdp_freerdp_peer psPeerIsWriteBlocked IsWriteBlocked; psPeerDrainOutputBuffer DrainOutputBuffer; psPeerHasMoreToRead HasMoreToRead; + psPeerGetEventHandles GetEventHandles; }; #ifdef __cplusplus diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index 82fc964..b845c65 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -248,6 +248,14 @@ static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount) return TRUE; } +static HANDLE freerdp_peer_get_event_handle(freerdp_peer* client) +{ + HANDLE hEvent = NULL; + rdpTransport* transport = client->context->rdp->transport; + BIO_get_event(transport->frontBio, &hEvent); + return hEvent; +} + static DWORD freerdp_peer_get_event_handles(freerdp_peer* client, HANDLE* events, DWORD count) { DWORD nCount = 0; @@ -807,6 +815,7 @@ freerdp_peer* freerdp_peer_new(int sockfd) client->ContextSize = sizeof(rdpContext); client->Initialize = freerdp_peer_initialize; client->GetFileDescriptor = freerdp_peer_get_fds; + client->GetEventHandle = freerdp_peer_get_event_handle; client->GetEventHandles = freerdp_peer_get_event_handles; client->CheckFileDescriptor = freerdp_peer_check_fds; client->Close = freerdp_peer_close; -- 2.7.4