mirror of https://github.com/FreeRDP/FreeRDP
Fixed conversion and return checks.
* Fix some missing argument checks for function pointer implementations * Fix broken return value check for client->SendChannelData * Updated const correctness for function pointer implementations
This commit is contained in:
parent
b3179174ec
commit
0f729d2b2c
|
@ -49,10 +49,10 @@
|
|||
|
||||
#define TAG FREERDP_TAG("core.channels")
|
||||
|
||||
BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, const BYTE* data, int size)
|
||||
BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, const BYTE* data, size_t size)
|
||||
{
|
||||
DWORD i;
|
||||
int left;
|
||||
size_t left;
|
||||
wStream* s;
|
||||
UINT32 flags;
|
||||
size_t chunkSize;
|
||||
|
@ -84,7 +84,7 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, const BYTE* data, int s
|
|||
if (!s)
|
||||
return FALSE;
|
||||
|
||||
if (left > (int)rdp->settings->VirtualChannelChunkSize)
|
||||
if (left > rdp->settings->VirtualChannelChunkSize)
|
||||
{
|
||||
chunkSize = rdp->settings->VirtualChannelChunkSize;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
#include <freerdp/api.h>
|
||||
#include "client.h"
|
||||
|
||||
FREERDP_LOCAL BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, const BYTE* data, int size);
|
||||
FREERDP_LOCAL BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId);
|
||||
FREERDP_LOCAL BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, const BYTE* data,
|
||||
size_t size);
|
||||
FREERDP_LOCAL BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId,
|
||||
size_t packetLength);
|
||||
FREERDP_LOCAL BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 channelId);
|
||||
|
||||
#endif /* FREERDP_LIB_CORE_CHANNELS_H */
|
||||
|
|
|
@ -488,9 +488,18 @@ int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id)
|
|||
return status;
|
||||
}
|
||||
|
||||
static int freerdp_send_channel_data(freerdp* instance, UINT16 channelId, BYTE* data, int size)
|
||||
static int freerdp_send_channel_data(freerdp* instance, UINT16 channelId, const BYTE* data,
|
||||
int size)
|
||||
{
|
||||
return rdp_send_channel_data(instance->context->rdp, channelId, data, size);
|
||||
if (size < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "%s: size has invalid value %d", __FUNCTION__, size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!rdp_send_channel_data(instance->context->rdp, channelId, data, (size_t)size))
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL freerdp_disconnect(freerdp* instance)
|
||||
|
|
|
@ -108,14 +108,8 @@ static BOOL freerdp_peer_virtual_channel_close(freerdp_peer* client, HANDLE hCha
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int freerdp_peer_virtual_channel_read(freerdp_peer* client, HANDLE hChannel, BYTE* buffer,
|
||||
UINT32 length)
|
||||
{
|
||||
return 0; /* this needs to be implemented by the server application */
|
||||
}
|
||||
|
||||
static int freerdp_peer_virtual_channel_write(freerdp_peer* client, HANDLE hChannel, BYTE* buffer,
|
||||
UINT32 length)
|
||||
static int freerdp_peer_virtual_channel_write(freerdp_peer* client, HANDLE hChannel,
|
||||
const BYTE* buffer, UINT32 length)
|
||||
{
|
||||
wStream* s;
|
||||
UINT32 flags;
|
||||
|
@ -745,7 +739,14 @@ static void freerdp_peer_disconnect(freerdp_peer* client)
|
|||
static int freerdp_peer_send_channel_data(freerdp_peer* client, UINT16 channelId, const BYTE* data,
|
||||
int size)
|
||||
{
|
||||
return rdp_send_channel_data(client->context->rdp, channelId, data, size);
|
||||
if (size < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "%s: invalid size %d", __FUNCTION__, size);
|
||||
return -1;
|
||||
}
|
||||
if (!rdp_send_channel_data(client->context->rdp, channelId, data, (size_t)size))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL freerdp_peer_is_write_blocked(freerdp_peer* peer)
|
||||
|
|
|
@ -1350,11 +1350,8 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
|
|||
{
|
||||
rdp->inPackets++;
|
||||
|
||||
if (!freerdp_channel_process(rdp->instance, s, channelId))
|
||||
{
|
||||
WLog_ERR(TAG, "rdp_recv_tpkt_pdu: freerdp_channel_process() fail");
|
||||
if (!freerdp_channel_process(rdp->instance, s, channelId, length))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -1601,7 +1598,7 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
|
|||
return status;
|
||||
}
|
||||
|
||||
int rdp_send_channel_data(rdpRdp* rdp, UINT16 channelId, const BYTE* data, int size)
|
||||
BOOL rdp_send_channel_data(rdpRdp* rdp, UINT16 channelId, const BYTE* data, size_t size)
|
||||
{
|
||||
return freerdp_channel_send(rdp, channelId, data, size);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,8 @@ FREERDP_LOCAL int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s);
|
|||
|
||||
FREERDP_LOCAL BOOL rdp_send(rdpRdp* rdp, wStream* s, UINT16 channelId);
|
||||
|
||||
FREERDP_LOCAL int rdp_send_channel_data(rdpRdp* rdp, UINT16 channelId, const BYTE* data, int size);
|
||||
FREERDP_LOCAL BOOL rdp_send_channel_data(rdpRdp* rdp, UINT16 channelId, const BYTE* data,
|
||||
size_t size);
|
||||
|
||||
FREERDP_LOCAL wStream* rdp_message_channel_pdu_init(rdpRdp* rdp);
|
||||
FREERDP_LOCAL BOOL rdp_send_message_channel_pdu(rdpRdp* rdp, wStream* s, UINT16 sec_flags);
|
||||
|
|
|
@ -478,6 +478,7 @@ BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
|
|||
|
||||
while (MessageQueue_Peek(vcm->queue, &message, TRUE))
|
||||
{
|
||||
int rc;
|
||||
BYTE* buffer;
|
||||
UINT32 length;
|
||||
UINT16 channelId;
|
||||
|
@ -485,7 +486,8 @@ BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
|
|||
buffer = (BYTE*)message.wParam;
|
||||
length = (UINT32)(UINT_PTR)message.lParam;
|
||||
|
||||
if (vcm->client->SendChannelData(vcm->client, channelId, buffer, length) == FALSE)
|
||||
rc = vcm->client->SendChannelData(vcm->client, channelId, buffer, length);
|
||||
if (rc < 0)
|
||||
{
|
||||
status = FALSE;
|
||||
}
|
||||
|
|
|
@ -198,9 +198,8 @@ static BOOL pf_server_adjust_monitor_layout(freerdp_peer* peer)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 channelId,
|
||||
const BYTE* data, int size, int flags,
|
||||
int totalSize)
|
||||
static int pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 channelId,
|
||||
const BYTE* data, int size, int flags, int totalSize)
|
||||
{
|
||||
pServerContext* ps = (pServerContext*)peer->context;
|
||||
pClientContext* pc = ps->pdata->pc;
|
||||
|
@ -222,7 +221,7 @@ static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 chann
|
|||
ev.data_len = size;
|
||||
|
||||
if (!pf_modules_run_filter(FILTER_TYPE_SERVER_PASSTHROUGH_CHANNEL_DATA, pdata, &ev))
|
||||
return FALSE;
|
||||
return -1;
|
||||
|
||||
client_channel_id = (UINT64)HashTable_GetItemValue(pc->vc_ids, (void*)channel_name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue