typedef int (*pLogonErrorInfo)(freerdp* instance, UINT32 data, UINT32 type);
- typedef int (*pSendChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
- int size);
+ typedef BOOL (*pSendChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
+ size_t size);
typedef int (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, BYTE* data, int size,
int flags, int totalSize);
typedef BOOL (*psPeerAdjustMonitorsLayout)(freerdp_peer* peer);
typedef BOOL (*psPeerClientCapabilities)(freerdp_peer* peer);
-typedef int (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
- int size);
+typedef BOOL (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
+ size_t size);
typedef int (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
size_t size, UINT32 flags, size_t totalSize);
return status;
}
-static int freerdp_send_channel_data(freerdp* instance, UINT16 channelId, const BYTE* data,
- int size)
+static BOOL freerdp_send_channel_data(freerdp* instance, UINT16 channelId, const BYTE* data,
+ size_t 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;
+ return rdp_send_channel_data(instance->context->rdp, channelId, data, size);
}
BOOL freerdp_disconnect(freerdp* instance)
/** Allocator function for the rdp_freerdp structure.
* @return an allocated structure filled with 0s. Need to be deallocated using freerdp_free()
*/
-freerdp* freerdp_new()
+freerdp* freerdp_new(void)
{
freerdp* instance;
instance = (freerdp*)calloc(1, sizeof(freerdp));
transport_disconnect(transport);
}
-static int freerdp_peer_send_channel_data(freerdp_peer* client, UINT16 channelId, const BYTE* data,
- int size)
+static BOOL freerdp_peer_send_channel_data(freerdp_peer* client, UINT16 channelId, const BYTE* data,
+ size_t 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;
+ return rdp_send_channel_data(client->context->rdp, channelId, data, size);
}
static BOOL freerdp_peer_is_write_blocked(freerdp_peer* peer)
while (MessageQueue_Peek(vcm->queue, &message, TRUE))
{
- int rc;
BYTE* buffer;
UINT32 length;
UINT16 channelId;
buffer = (BYTE*)message.wParam;
length = (UINT32)(UINT_PTR)message.lParam;
- rc = vcm->client->SendChannelData(vcm->client, channelId, buffer, length);
- if (rc < 0)
+ if (!vcm->client->SendChannelData(vcm->client, channelId, buffer, length))
{
status = FALSE;
}
return TRUE;
}
-static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channelId, BYTE* data,
- int size, int flags, int totalSize)
+static int pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channelId, BYTE* data,
+ int size, int flags, int totalSize)
{
pClientContext* pc = (pClientContext*)instance->context;
pServerContext* ps = pc->pdata->ps;
ev.data_len = size;
if (!pf_modules_run_filter(FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_DATA, pdata, &ev))
- return FALSE;
+ return -1;
server_channel_id = (UINT64)HashTable_GetItemValue(ps->vc_ids, (void*)channel_name);
- return ps->context.peer->SendChannelData(ps->context.peer, (UINT16)server_channel_id,
- data, size);
+ if (!ps->context.peer->SendChannelData(ps->context.peer, (UINT16)server_channel_id,
+ data, size))
+ return -1;
+ return 0;
}
}
client_channel_id = (UINT64)HashTable_GetItemValue(pc->vc_ids, (void*)channel_name);
- return pc->context.instance->SendChannelData(
- pc->context.instance, (UINT16)client_channel_id, (BYTE*)data, size);
+ if (!pc->context.instance->SendChannelData(
+ pc->context.instance, (UINT16)client_channel_id, (BYTE*)data, size))
+ return -1;
+ return 0;
}
}