Code style changed.

This commit is contained in:
ivan-83 2015-05-02 06:26:08 +03:00
parent 92662a1854
commit 0fda0eb0de
11 changed files with 280 additions and 138 deletions

View File

@ -90,20 +90,23 @@ int tsmf_platform_create(TSMFGstreamerDecoder* decoder)
return -1; return -1;
hdl = calloc(1, sizeof(struct X11Handle)); hdl = calloc(1, sizeof(struct X11Handle));
if (!hdl) { if (!hdl)
{
WLog_ERR(TAG, "Could not allocate handle."); WLog_ERR(TAG, "Could not allocate handle.");
return -1; return -1;
} }
decoder->platform = hdl; decoder->platform = hdl;
hdl->shmid = shm_open(get_shm_id(), (O_RDWR | O_CREAT), (PROT_READ | PROT_WRITE)); hdl->shmid = shm_open(get_shm_id(), (O_RDWR | O_CREAT), (PROT_READ | PROT_WRITE));
if (hdl->shmid == -1) { if (hdl->shmid == -1)
{
WLog_ERR(TAG, "failed to get access to shared memory - shmget(%s): %i - %s", get_shm_id(), errno, strerror(errno)); WLog_ERR(TAG, "failed to get access to shared memory - shmget(%s): %i - %s", get_shm_id(), errno, strerror(errno));
return -2; return -2;
} }
hdl->xfwin = mmap(0, sizeof(void *), PROT_READ | PROT_WRITE, MAP_SHARED, hdl->shmid, 0); hdl->xfwin = mmap(0, sizeof(void *), PROT_READ | PROT_WRITE, MAP_SHARED, hdl->shmid, 0);
if (hdl->xfwin == MAP_FAILED) { if (hdl->xfwin == MAP_FAILED)
{
WLog_ERR(TAG, "shmat failed!"); WLog_ERR(TAG, "shmat failed!");
return -3; return -3;
} }

View File

@ -45,11 +45,14 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const
return NULL; return NULL;
} }
if (!audio->Open(audio, device)) { if (!audio->Open(audio, device))
{
audio->Free(audio); audio->Free(audio);
audio = NULL; audio = NULL;
WLog_ERR(TAG, "failed to open, name: %s, device: %s", name, device); WLog_ERR(TAG, "failed to open, name: %s, device: %s", name, device);
} else { }
else
{
WLog_DBG(TAG, "name: %s, device: %s", name, device); WLog_DBG(TAG, "name: %s, device: %s", name, device);
} }
@ -82,9 +85,12 @@ ITSMFAudioDevice* tsmf_load_audio_device(const char* name, const char* device)
#endif #endif
} }
if (audio == NULL) { if (audio == NULL)
{
WLog_ERR(TAG, "no sound device."); WLog_ERR(TAG, "no sound device.");
} else { }
else
{
WLog_DBG(TAG, "name: %s, device: %s", name, device); WLog_DBG(TAG, "name: %s, device: %s", name, device);
} }

View File

@ -504,19 +504,22 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb
total_device = libusb_get_device_list(NULL, &libusb_list); total_device = libusb_get_device_list(NULL, &libusb_list);
/* Look for device. */ /* Look for device. */
error = -1; error = -1;
for (i = 0; i < total_device; i ++) { for (i = 0; i < total_device; i ++)
{
if ((bus_number != libusb_get_bus_number(libusb_list[i])) || if ((bus_number != libusb_get_bus_number(libusb_list[i])) ||
(dev_number != libusb_get_device_address(libusb_list[i]))) (dev_number != libusb_get_device_address(libusb_list[i])))
continue; continue;
error = libusb_open(libusb_list[i], &pdev->hub_handle); error = libusb_open(libusb_list[i], &pdev->hub_handle);
if (error < 0) { if (error < 0)
{
WLog_ERR(TAG,"libusb_open error: %i - %s", error, libusb_strerror(error)); WLog_ERR(TAG,"libusb_open error: %i - %s", error, libusb_strerror(error));
break; break;
} }
/* get port number */ /* get port number */
error = libusb_get_port_numbers(libusb_list[i], port_numbers, sizeof(port_numbers)); error = libusb_get_port_numbers(libusb_list[i], port_numbers, sizeof(port_numbers));
libusb_close(pdev->hub_handle); libusb_close(pdev->hub_handle);
if (error < 1) { /* Prevent open hub, treat as error. */ if (error < 1)
{ /* Prevent open hub, treat as error. */
WLog_ERR(TAG,"libusb_get_port_numbers error: %i - %s", error, libusb_strerror(error)); WLog_ERR(TAG,"libusb_get_port_numbers error: %i - %s", error, libusb_strerror(error));
break; break;
} }
@ -529,9 +532,11 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb
break; break;
} }
/* Look for device hub. */ /* Look for device hub. */
if (error == 0) { if (error == 0)
{
error = -1; error = -1;
for (i = 0; i < total_device; i ++) { for (i = 0; i < total_device; i ++)
{
if ((bus_number != libusb_get_bus_number(libusb_list[i])) || if ((bus_number != libusb_get_bus_number(libusb_list[i])) ||
(1 != libusb_get_device_address(libusb_list[i]))) /* Root hub allways first on bus. */ (1 != libusb_get_device_address(libusb_list[i]))) /* Root hub allways first on bus. */
continue; continue;

View File

@ -449,13 +449,15 @@ static char *devd_get_val(char *buf, size_t buf_size, const char *val_name, size
char *ret, *buf_end, *ptr; char *ret, *buf_end, *ptr;
buf_end = (buf + buf_size); buf_end = (buf + buf_size);
for (ret = buf; ret != NULL && ret < buf_end;) { for (ret = buf; ret != NULL && ret < buf_end;)
{
ret = memmem(ret, (buf_end - ret), val_name, val_name_size); ret = memmem(ret, (buf_end - ret), val_name, val_name_size);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
/* Found. */ /* Found. */
/* Check: space before or buf+1. */ /* Check: space before or buf+1. */
if ((buf + 1) < ret && ret[-1] != ' ') { if ((buf + 1) < ret && ret[-1] != ' ')
{
ret += val_name_size; ret += val_name_size;
continue; continue;
} }
@ -500,7 +502,8 @@ static void *urbdrc_search_usb_device(void *arg) {
WLog_DBG(TAG, "urbdrc_search_usb_device - devd: start"); WLog_DBG(TAG, "urbdrc_search_usb_device - devd: start");
devd_skt = socket(PF_LOCAL, SOCK_SEQPACKET, 0); devd_skt = socket(PF_LOCAL, SOCK_SEQPACKET, 0);
if (devd_skt == -1) { if (devd_skt == -1)
{
WLog_ERR(TAG, "Can't create devd socket: error = %i", errno); WLog_ERR(TAG, "Can't create devd socket: error = %i", errno);
goto err_out; goto err_out;
} }
@ -508,7 +511,8 @@ static void *urbdrc_search_usb_device(void *arg) {
sun.sun_family = PF_LOCAL; sun.sun_family = PF_LOCAL;
sun.sun_len = sizeof(sun); sun.sun_len = sizeof(sun);
strlcpy(sun.sun_path, "/var/run/devd.seqpacket.pipe", sizeof(sun.sun_path)); strlcpy(sun.sun_path, "/var/run/devd.seqpacket.pipe", sizeof(sun.sun_path));
if (-1 == connect(devd_skt, (struct sockaddr*)&sun, sizeof(sun))) { if (-1 == connect(devd_skt, (struct sockaddr*)&sun, sizeof(sun)))
{
WLog_ERR(TAG, "Can't connect devd socket: error = %i - %s", errno, strerror(errno)); WLog_ERR(TAG, "Can't connect devd socket: error = %i - %s", errno, strerror(errno));
goto err_out; goto err_out;
} }
@ -519,13 +523,15 @@ static void *urbdrc_search_usb_device(void *arg) {
listobj[0] = searchman->term_event; listobj[0] = searchman->term_event;
listobj[1] = mon_fd; listobj[1] = mon_fd;
while (WaitForMultipleObjects(2, listobj, FALSE, INFINITE) != WAIT_OBJECT_0) { while (WaitForMultipleObjects(2, listobj, FALSE, INFINITE) != WAIT_OBJECT_0)
{
WLog_DBG(TAG, "======= SEARCH ======= "); WLog_DBG(TAG, "======= SEARCH ======= ");
/* !system=USB subsystem=DEVICE type=ATTACH ugen=ugen3.3 cdev=ugen3.3 vendor=0x046d product=0x082d devclass=0xef devsubclass=0x02 sernum="6E7D726F" release=0x0011 mode=host port=4 parent=ugen3.1 */ /* !system=USB subsystem=DEVICE type=ATTACH ugen=ugen3.3 cdev=ugen3.3 vendor=0x046d product=0x082d devclass=0xef devsubclass=0x02 sernum="6E7D726F" release=0x0011 mode=host port=4 parent=ugen3.1 */
/* !system=USB subsystem=DEVICE type=DETACH ugen=ugen3.3 cdev=ugen3.3 vendor=0x046d product=0x082d devclass=0xef devsubclass=0x02 sernum="6E7D726F" release=0x0011 mode=host port=4 parent=ugen3.1 */ /* !system=USB subsystem=DEVICE type=DETACH ugen=ugen3.3 cdev=ugen3.3 vendor=0x046d product=0x082d devclass=0xef devsubclass=0x02 sernum="6E7D726F" release=0x0011 mode=host port=4 parent=ugen3.1 */
data_size = read(devd_skt, buf, (sizeof(buf) - 1)); data_size = read(devd_skt, buf, (sizeof(buf) - 1));
if (data_size == -1) { if (data_size == -1)
{
WLog_ERR(TAG, "devd socket read: error = %i", errno); WLog_ERR(TAG, "devd socket read: error = %i", errno);
break; break;
} }
@ -578,7 +584,8 @@ static void *urbdrc_search_usb_device(void *arg) {
/* Handle event. */ /* Handle event. */
dvc_channel = NULL; dvc_channel = NULL;
switch (action) { switch (action)
{
case 0: /* ATTACH */ case 0: /* ATTACH */
sdev = NULL; sdev = NULL;
success = 0; success = 0;
@ -604,10 +611,12 @@ static void *urbdrc_search_usb_device(void *arg) {
dvc_channel = channel_mgr->FindChannelById(channel_mgr, urbdrc->first_channel_id); dvc_channel = channel_mgr->FindChannelById(channel_mgr, urbdrc->first_channel_id);
searchman->rewind(searchman); searchman->rewind(searchman);
while (dvc_channel && searchman->has_next(searchman)) { while (dvc_channel && searchman->has_next(searchman))
{
sdev = searchman->get_next(searchman); sdev = searchman->get_next(searchman);
if (sdev->idVendor == idVendor && if (sdev->idVendor == idVendor &&
sdev->idProduct == idProduct) { sdev->idProduct == idProduct)
{
WLog_VRB(TAG, "Searchman Found Device: %04x:%04x", WLog_VRB(TAG, "Searchman Found Device: %04x:%04x",
sdev->idVendor, sdev->idProduct); sdev->idVendor, sdev->idProduct);
found = 1; found = 1;
@ -615,18 +624,21 @@ static void *urbdrc_search_usb_device(void *arg) {
} }
} }
if (!found && udevman->isAutoAdd(udevman)) { if (!found && udevman->isAutoAdd(udevman))
{
WLog_VRB(TAG, "Auto Find Device: %04x:%04x ", WLog_VRB(TAG, "Auto Find Device: %04x:%04x ",
idVendor, idProduct); idVendor, idProduct);
found = 2; found = 2;
} }
if (found) { if (found)
{
success = udevman->register_udevice(udevman, busnum, devnum, success = udevman->register_udevice(udevman, busnum, devnum,
searchman->UsbDevice, 0, 0, UDEVMAN_FLAG_ADD_BY_ADDR); searchman->UsbDevice, 0, 0, UDEVMAN_FLAG_ADD_BY_ADDR);
} }
if (success) { if (success)
{
searchman->UsbDevice ++; searchman->UsbDevice ++;
usleep(400000); usleep(400000);
@ -643,19 +655,23 @@ static void *urbdrc_search_usb_device(void *arg) {
usleep(500000); usleep(500000);
udevman->loading_lock(udevman); udevman->loading_lock(udevman);
udevman->rewind(udevman); udevman->rewind(udevman);
while(udevman->has_next(udevman)) { while (udevman->has_next(udevman))
{
pdev = udevman->get_next(udevman); pdev = udevman->get_next(udevman);
if (pdev->get_bus_number(pdev) == busnum && if (pdev->get_bus_number(pdev) == busnum &&
pdev->get_dev_number(pdev) == devnum) { pdev->get_dev_number(pdev) == devnum)
{
dvc_channel = channel_mgr->FindChannelById(channel_mgr, pdev->get_channel_id(pdev)); dvc_channel = channel_mgr->FindChannelById(channel_mgr, pdev->get_channel_id(pdev));
if (dvc_channel == NULL) { if (dvc_channel == NULL)
{
WLog_ERR(TAG, "SEARCH: dvc_channel %d is NULL!!", pdev->get_channel_id(pdev)); WLog_ERR(TAG, "SEARCH: dvc_channel %d is NULL!!", pdev->get_channel_id(pdev));
func_close_udevice(searchman, pdev); func_close_udevice(searchman, pdev);
break; break;
} }
if (!pdev->isSigToEnd(pdev)) { if (!pdev->isSigToEnd(pdev))
{
dvc_channel->Write(dvc_channel, 0, NULL, NULL); dvc_channel->Write(dvc_channel, 0, NULL, NULL);
pdev->SigToEnd(pdev); pdev->SigToEnd(pdev);
} }
@ -668,7 +684,10 @@ static void *urbdrc_search_usb_device(void *arg) {
udevman->loading_unlock(udevman); udevman->loading_unlock(udevman);
usleep(300000); usleep(300000);
if (pdev && on_close && dvc_channel && pdev->isSigToEnd(pdev) && !(pdev->isChannelClosed(pdev))) { if (pdev && on_close && dvc_channel &&
pdev->isSigToEnd(pdev) &&
!(pdev->isChannelClosed(pdev)))
{
dvc_channel->Close(dvc_channel); dvc_channel->Close(dvc_channel);
} }
break; break;

View File

@ -262,7 +262,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
switch (updateCode) switch (updateCode)
{ {
case FASTPATH_UPDATETYPE_ORDERS: case FASTPATH_UPDATETYPE_ORDERS:
if (!fastpath_recv_orders(fastpath, s)) { if (!fastpath_recv_orders(fastpath, s))
{
WLog_DBG(TAG, "FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()"); WLog_DBG(TAG, "FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()");
return -1; return -1;
} }
@ -270,7 +271,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
case FASTPATH_UPDATETYPE_BITMAP: case FASTPATH_UPDATETYPE_BITMAP:
case FASTPATH_UPDATETYPE_PALETTE: case FASTPATH_UPDATETYPE_PALETTE:
if (!fastpath_recv_update_common(fastpath, s)) { if (!fastpath_recv_update_common(fastpath, s))
{
WLog_DBG(TAG, "FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()"); WLog_DBG(TAG, "FASTPATH_UPDATETYPE_ORDERS - fastpath_recv_orders()");
return -1; return -1;
} }
@ -300,7 +302,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
break; break;
case FASTPATH_UPDATETYPE_PTR_POSITION: case FASTPATH_UPDATETYPE_PTR_POSITION:
if (!update_read_pointer_position(s, &pointer->pointer_position)) { if (!update_read_pointer_position(s, &pointer->pointer_position))
{
WLog_DBG(TAG, "FASTPATH_UPDATETYPE_PTR_POSITION - update_read_pointer_position()"); WLog_DBG(TAG, "FASTPATH_UPDATETYPE_PTR_POSITION - update_read_pointer_position()");
return -1; return -1;
} }
@ -308,7 +311,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
break; break;
case FASTPATH_UPDATETYPE_COLOR: case FASTPATH_UPDATETYPE_COLOR:
if (!update_read_pointer_color(s, &pointer->pointer_color, 24)) { if (!update_read_pointer_color(s, &pointer->pointer_color, 24))
{
WLog_DBG(TAG, "FASTPATH_UPDATETYPE_COLOR - update_read_pointer_color()"); WLog_DBG(TAG, "FASTPATH_UPDATETYPE_COLOR - update_read_pointer_color()");
return -1; return -1;
} }
@ -316,7 +320,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
break; break;
case FASTPATH_UPDATETYPE_CACHED: case FASTPATH_UPDATETYPE_CACHED:
if (!update_read_pointer_cached(s, &pointer->pointer_cached)) { if (!update_read_pointer_cached(s, &pointer->pointer_cached))
{
WLog_DBG(TAG, "FASTPATH_UPDATETYPE_CACHED - update_read_pointer_cached()"); WLog_DBG(TAG, "FASTPATH_UPDATETYPE_CACHED - update_read_pointer_cached()");
return -1; return -1;
} }
@ -324,7 +329,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
break; break;
case FASTPATH_UPDATETYPE_POINTER: case FASTPATH_UPDATETYPE_POINTER:
if (!update_read_pointer_new(s, &pointer->pointer_new)) { if (!update_read_pointer_new(s, &pointer->pointer_new))
{
WLog_DBG(TAG, "FASTPATH_UPDATETYPE_POINTER - update_read_pointer_new()"); WLog_DBG(TAG, "FASTPATH_UPDATETYPE_POINTER - update_read_pointer_new()");
return -1; return -1;
} }
@ -383,7 +389,8 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
Stream_Read_UINT16(s, size); Stream_Read_UINT16(s, size);
if (Stream_GetRemainingLength(s) < size) { if (Stream_GetRemainingLength(s) < size)
{
WLog_DBG(TAG, "Stream_GetRemainingLength() < size"); WLog_DBG(TAG, "Stream_GetRemainingLength() < size");
return -1; return -1;
} }
@ -424,7 +431,8 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
totalSize = size; totalSize = size;
status = fastpath_recv_update(fastpath, updateCode, totalSize, cs); status = fastpath_recv_update(fastpath, updateCode, totalSize, cs);
if (status < 0) { if (status < 0)
{
WLog_DBG(TAG, "fastpath_recv_update_data: fastpath_recv_update() - %i", status); WLog_DBG(TAG, "fastpath_recv_update_data: fastpath_recv_update() - %i", status);
goto out_fail; goto out_fail;
} }
@ -520,7 +528,8 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
Stream_Release(fastpath->updateData); Stream_Release(fastpath->updateData);
if (status < 0) { if (status < 0)
{
WLog_DBG(TAG, "fastpath_recv_update_data: fastpath_recv_update() - %i", status); WLog_DBG(TAG, "fastpath_recv_update_data: fastpath_recv_update() - %i", status);
goto out_fail; goto out_fail;
} }

View File

@ -244,13 +244,15 @@ BOOL freerdp_check_event_handles(rdpContext* context)
status = freerdp_check_fds(context->instance); status = freerdp_check_fds(context->instance);
if (!status) { if (!status)
{
WLog_DBG(TAG, "freerdp_check_fds() - %i", status); WLog_DBG(TAG, "freerdp_check_fds() - %i", status);
return FALSE; return FALSE;
} }
status = freerdp_channels_check_fds(context->channels, context->instance); status = freerdp_channels_check_fds(context->channels, context->instance);
if (!status) { if (!status)
{
WLog_DBG(TAG, "freerdp_channels_check_fds() - %i", status); WLog_DBG(TAG, "freerdp_channels_check_fds() - %i", status);
return FALSE; return FALSE;
} }

View File

@ -499,7 +499,8 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
{ {
BYTE byte; BYTE byte;
if (Stream_GetRemainingLength(s) < 1) { if (Stream_GetRemainingLength(s) < 1)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
} }
@ -512,7 +513,8 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
if (byte & 0x80) if (byte & 0x80)
{ {
if (Stream_GetRemainingLength(s) < 1) { if (Stream_GetRemainingLength(s) < 1)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
} }
@ -726,7 +728,8 @@ static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int
zeroBitsSize = ((number + 3) / 4); zeroBitsSize = ((number + 3) / 4);
if (Stream_GetRemainingLength(s) < zeroBitsSize) { if (Stream_GetRemainingLength(s) < zeroBitsSize)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < %i", zeroBitsSize); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < %i", zeroBitsSize);
return FALSE; return FALSE;
} }
@ -741,12 +744,14 @@ static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int
if (i % 4 == 0) if (i % 4 == 0)
flags = zeroBits[i / 4]; flags = zeroBits[i / 4];
if ((~flags & 0x80) && !update_read_delta(s, &points[i].x)) { if ((~flags & 0x80) && !update_read_delta(s, &points[i].x))
{
WLog_DBG(TAG, "update_read_delta(x) failed"); WLog_DBG(TAG, "update_read_delta(x) failed");
return FALSE; return FALSE;
} }
if ((~flags & 0x40) && !update_read_delta(s, &points[i].y)) { if ((~flags & 0x40) && !update_read_delta(s, &points[i].y))
{
WLog_DBG(TAG, "update_read_delta(y) failed"); WLog_DBG(TAG, "update_read_delta(y) failed");
return FALSE; return FALSE;
} }
@ -1345,14 +1350,16 @@ BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo, POLYLINE_ORDE
{ {
DELTA_POINT *new_points; DELTA_POINT *new_points;
if (Stream_GetRemainingLength(s) < 1) { if (Stream_GetRemainingLength(s) < 1)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
} }
Stream_Read_UINT8(s, polyline->cbData); Stream_Read_UINT8(s, polyline->cbData);
new_points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * new_num); new_points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * new_num);
if (!new_points) { if (!new_points)
{
WLog_DBG(TAG, "realloc(%i) failed", new_num); WLog_DBG(TAG, "realloc(%i) failed", new_num);
return FALSE; return FALSE;
} }
@ -3148,7 +3155,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
} }
if (!update_read_field_flags(s, &(orderInfo->fieldFlags), flags, if (!update_read_field_flags(s, &(orderInfo->fieldFlags), flags,
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType])) { PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo->orderType]))
{
WLog_DBG(TAG, "update_read_field_flags() failed"); WLog_DBG(TAG, "update_read_field_flags() failed");
return FALSE; return FALSE;
} }
@ -3157,7 +3165,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
{ {
if (!(flags & ORDER_ZERO_BOUNDS_DELTAS)) if (!(flags & ORDER_ZERO_BOUNDS_DELTAS))
{ {
if (!update_read_bounds(s, &orderInfo->bounds)) { if (!update_read_bounds(s, &orderInfo->bounds))
{
WLog_DBG(TAG, "update_read_bounds() failed"); WLog_DBG(TAG, "update_read_bounds() failed");
return FALSE; return FALSE;
} }
@ -3175,7 +3184,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
switch (orderInfo->orderType) switch (orderInfo->orderType)
{ {
case ORDER_TYPE_DSTBLT: case ORDER_TYPE_DSTBLT:
if (!update_read_dstblt_order(s, orderInfo, &(primary->dstblt))) { if (!update_read_dstblt_order(s, orderInfo, &(primary->dstblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_DSTBLT - update_read_dstblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_DSTBLT - update_read_dstblt_order() failed");
return FALSE; return FALSE;
} }
@ -3184,7 +3194,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_PATBLT: case ORDER_TYPE_PATBLT:
if (!update_read_patblt_order(s, orderInfo, &(primary->patblt))) { if (!update_read_patblt_order(s, orderInfo, &(primary->patblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_PATBLT - update_read_patblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_PATBLT - update_read_patblt_order() failed");
return FALSE; return FALSE;
} }
@ -3193,7 +3204,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_SCRBLT: case ORDER_TYPE_SCRBLT:
if (!update_read_scrblt_order(s, orderInfo, &(primary->scrblt))) { if (!update_read_scrblt_order(s, orderInfo, &(primary->scrblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_SCRBLT - update_read_scrblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_SCRBLT - update_read_scrblt_order() failed");
return FALSE; return FALSE;
} }
@ -3202,7 +3214,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_OPAQUE_RECT: case ORDER_TYPE_OPAQUE_RECT:
if (!update_read_opaque_rect_order(s, orderInfo, &(primary->opaque_rect))) { if (!update_read_opaque_rect_order(s, orderInfo, &(primary->opaque_rect)))
{
WLog_DBG(TAG, "ORDER_TYPE_OPAQUE_RECT - update_read_opaque_rect_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_OPAQUE_RECT - update_read_opaque_rect_order() failed");
return FALSE; return FALSE;
} }
@ -3211,7 +3224,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_DRAW_NINE_GRID: case ORDER_TYPE_DRAW_NINE_GRID:
if (!update_read_draw_nine_grid_order(s, orderInfo, &(primary->draw_nine_grid))) { if (!update_read_draw_nine_grid_order(s, orderInfo, &(primary->draw_nine_grid)))
{
WLog_DBG(TAG, "ORDER_TYPE_DRAW_NINE_GRID - update_read_draw_nine_grid_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_DRAW_NINE_GRID - update_read_draw_nine_grid_order() failed");
return FALSE; return FALSE;
} }
@ -3220,7 +3234,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MULTI_DSTBLT: case ORDER_TYPE_MULTI_DSTBLT:
if (!update_read_multi_dstblt_order(s, orderInfo, &(primary->multi_dstblt))) { if (!update_read_multi_dstblt_order(s, orderInfo, &(primary->multi_dstblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_MULTI_DSTBLT - update_read_multi_dstblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MULTI_DSTBLT - update_read_multi_dstblt_order() failed");
return FALSE; return FALSE;
} }
@ -3229,7 +3244,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MULTI_PATBLT: case ORDER_TYPE_MULTI_PATBLT:
if (!update_read_multi_patblt_order(s, orderInfo, &(primary->multi_patblt))) { if (!update_read_multi_patblt_order(s, orderInfo, &(primary->multi_patblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_MULTI_PATBLT - update_read_multi_patblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MULTI_PATBLT - update_read_multi_patblt_order() failed");
return FALSE; return FALSE;
} }
@ -3238,7 +3254,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MULTI_SCRBLT: case ORDER_TYPE_MULTI_SCRBLT:
if (!update_read_multi_scrblt_order(s, orderInfo, &(primary->multi_scrblt))) { if (!update_read_multi_scrblt_order(s, orderInfo, &(primary->multi_scrblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_MULTI_SCRBLT - update_read_multi_scrblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MULTI_SCRBLT - update_read_multi_scrblt_order() failed");
return FALSE; return FALSE;
} }
@ -3247,7 +3264,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MULTI_OPAQUE_RECT: case ORDER_TYPE_MULTI_OPAQUE_RECT:
if (!update_read_multi_opaque_rect_order(s, orderInfo, &(primary->multi_opaque_rect))) { if (!update_read_multi_opaque_rect_order(s, orderInfo, &(primary->multi_opaque_rect)))
{
WLog_DBG(TAG, "ORDER_TYPE_MULTI_OPAQUE_RECT - update_read_multi_opaque_rect_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MULTI_OPAQUE_RECT - update_read_multi_opaque_rect_order() failed");
return FALSE; return FALSE;
} }
@ -3256,7 +3274,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MULTI_DRAW_NINE_GRID: case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
if (!update_read_multi_draw_nine_grid_order(s, orderInfo, &(primary->multi_draw_nine_grid))) { if (!update_read_multi_draw_nine_grid_order(s, orderInfo, &(primary->multi_draw_nine_grid)))
{
WLog_DBG(TAG, "ORDER_TYPE_MULTI_DRAW_NINE_GRID - update_read_multi_draw_nine_grid_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MULTI_DRAW_NINE_GRID - update_read_multi_draw_nine_grid_order() failed");
return FALSE; return FALSE;
} }
@ -3265,7 +3284,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_LINE_TO: case ORDER_TYPE_LINE_TO:
if (!update_read_line_to_order(s, orderInfo, &(primary->line_to))) { if (!update_read_line_to_order(s, orderInfo, &(primary->line_to)))
{
WLog_DBG(TAG, "ORDER_TYPE_LINE_TO - update_read_line_to_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_LINE_TO - update_read_line_to_order() failed");
return FALSE; return FALSE;
} }
@ -3274,7 +3294,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_POLYLINE: case ORDER_TYPE_POLYLINE:
if (!update_read_polyline_order(s, orderInfo, &(primary->polyline))) { if (!update_read_polyline_order(s, orderInfo, &(primary->polyline)))
{
WLog_DBG(TAG, "ORDER_TYPE_POLYLINE - update_read_polyline_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_POLYLINE - update_read_polyline_order() failed");
return FALSE; return FALSE;
} }
@ -3283,7 +3304,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MEMBLT: case ORDER_TYPE_MEMBLT:
if (!update_read_memblt_order(s, orderInfo, &(primary->memblt))) { if (!update_read_memblt_order(s, orderInfo, &(primary->memblt)))
{
WLog_DBG(TAG, "ORDER_TYPE_MEMBLT - update_read_memblt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MEMBLT - update_read_memblt_order() failed");
return FALSE; return FALSE;
} }
@ -3292,7 +3314,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_MEM3BLT: case ORDER_TYPE_MEM3BLT:
if (!update_read_mem3blt_order(s, orderInfo, &(primary->mem3blt))) { if (!update_read_mem3blt_order(s, orderInfo, &(primary->mem3blt)))
{
WLog_DBG(TAG, "ORDER_TYPE_MEM3BLT - update_read_mem3blt_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_MEM3BLT - update_read_mem3blt_order() failed");
return FALSE; return FALSE;
} }
@ -3301,7 +3324,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_SAVE_BITMAP: case ORDER_TYPE_SAVE_BITMAP:
if (!update_read_save_bitmap_order(s, orderInfo, &(primary->save_bitmap))) { if (!update_read_save_bitmap_order(s, orderInfo, &(primary->save_bitmap)))
{
WLog_DBG(TAG, "ORDER_TYPE_SAVE_BITMAP - update_read_save_bitmap_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_SAVE_BITMAP - update_read_save_bitmap_order() failed");
return FALSE; return FALSE;
} }
@ -3310,7 +3334,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GLYPH_INDEX: case ORDER_TYPE_GLYPH_INDEX:
if (!update_read_glyph_index_order(s, orderInfo, &(primary->glyph_index))) { if (!update_read_glyph_index_order(s, orderInfo, &(primary->glyph_index)))
{
WLog_DBG(TAG, "ORDER_TYPE_GLYPH_INDEX - update_read_glyph_index_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GLYPH_INDEX - update_read_glyph_index_order() failed");
return FALSE; return FALSE;
} }
@ -3319,7 +3344,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_FAST_INDEX: case ORDER_TYPE_FAST_INDEX:
if (!update_read_fast_index_order(s, orderInfo, &(primary->fast_index))) { if (!update_read_fast_index_order(s, orderInfo, &(primary->fast_index)))
{
WLog_DBG(TAG, "ORDER_TYPE_FAST_INDEX - update_read_fast_index_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_FAST_INDEX - update_read_fast_index_order() failed");
return FALSE; return FALSE;
} }
@ -3328,7 +3354,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_FAST_GLYPH: case ORDER_TYPE_FAST_GLYPH:
if (!update_read_fast_glyph_order(s, orderInfo, &(primary->fast_glyph))) { if (!update_read_fast_glyph_order(s, orderInfo, &(primary->fast_glyph)))
{
WLog_DBG(TAG, "ORDER_TYPE_FAST_GLYPH - update_read_fast_glyph_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_FAST_GLYPH - update_read_fast_glyph_order() failed");
return FALSE; return FALSE;
} }
@ -3337,7 +3364,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_POLYGON_SC: case ORDER_TYPE_POLYGON_SC:
if (!update_read_polygon_sc_order(s, orderInfo, &(primary->polygon_sc))) { if (!update_read_polygon_sc_order(s, orderInfo, &(primary->polygon_sc)))
{
WLog_DBG(TAG, "ORDER_TYPE_POLYGON_SC - update_read_polygon_sc_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_POLYGON_SC - update_read_polygon_sc_order() failed");
return FALSE; return FALSE;
} }
@ -3346,7 +3374,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_POLYGON_CB: case ORDER_TYPE_POLYGON_CB:
if (!update_read_polygon_cb_order(s, orderInfo, &(primary->polygon_cb))) { if (!update_read_polygon_cb_order(s, orderInfo, &(primary->polygon_cb)))
{
WLog_DBG(TAG, "ORDER_TYPE_POLYGON_CB - update_read_polygon_cb_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_POLYGON_CB - update_read_polygon_cb_order() failed");
return FALSE; return FALSE;
} }
@ -3355,7 +3384,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_ELLIPSE_SC: case ORDER_TYPE_ELLIPSE_SC:
if (!update_read_ellipse_sc_order(s, orderInfo, &(primary->ellipse_sc))) { if (!update_read_ellipse_sc_order(s, orderInfo, &(primary->ellipse_sc)))
{
WLog_DBG(TAG, "ORDER_TYPE_ELLIPSE_SC - update_read_ellipse_sc_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_ELLIPSE_SC - update_read_ellipse_sc_order() failed");
return FALSE; return FALSE;
} }
@ -3364,7 +3394,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_ELLIPSE_CB: case ORDER_TYPE_ELLIPSE_CB:
if (!update_read_ellipse_cb_order(s, orderInfo, &(primary->ellipse_cb))) { if (!update_read_ellipse_cb_order(s, orderInfo, &(primary->ellipse_cb)))
{
WLog_DBG(TAG, "ORDER_TYPE_ELLIPSE_CB - update_read_ellipse_cb_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_ELLIPSE_CB - update_read_ellipse_cb_order() failed");
return FALSE; return FALSE;
} }
@ -3393,7 +3424,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
rdpContext* context = update->context; rdpContext* context = update->context;
rdpSecondaryUpdate* secondary = update->secondary; rdpSecondaryUpdate* secondary = update->secondary;
if (Stream_GetRemainingLength(s) < 5) { if (Stream_GetRemainingLength(s) < 5)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 5"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 5");
return FALSE; return FALSE;
} }
@ -3414,7 +3446,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
switch (orderType) switch (orderType)
{ {
case ORDER_TYPE_BITMAP_UNCOMPRESSED: case ORDER_TYPE_BITMAP_UNCOMPRESSED:
if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), FALSE, extraFlags)) { if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), FALSE, extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED - update_read_cache_bitmap_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED - update_read_cache_bitmap_order() failed");
return FALSE; return FALSE;
} }
@ -3423,7 +3456,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_CACHE_BITMAP_COMPRESSED: case ORDER_TYPE_CACHE_BITMAP_COMPRESSED:
if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), TRUE, extraFlags)) { if (!update_read_cache_bitmap_order(s, &(secondary->cache_bitmap_order), TRUE, extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_CACHE_BITMAP_COMPRESSED - update_read_cache_bitmap_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CACHE_BITMAP_COMPRESSED - update_read_cache_bitmap_order() failed");
return FALSE; return FALSE;
} }
@ -3432,7 +3466,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2: case ORDER_TYPE_BITMAP_UNCOMPRESSED_V2:
if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), FALSE, extraFlags)) { if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), FALSE, extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_BITMAP_UNCOMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed");
return FALSE; return FALSE;
} }
@ -3441,7 +3476,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_BITMAP_COMPRESSED_V2: case ORDER_TYPE_BITMAP_COMPRESSED_V2:
if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), TRUE, extraFlags)) { if (!update_read_cache_bitmap_v2_order(s, &(secondary->cache_bitmap_v2_order), TRUE, extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V2 - update_read_cache_bitmap_v2_order() failed");
return FALSE; return FALSE;
} }
@ -3450,7 +3486,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_BITMAP_COMPRESSED_V3: case ORDER_TYPE_BITMAP_COMPRESSED_V3:
if (!update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), extraFlags)) { if (!update_read_cache_bitmap_v3_order(s, &(secondary->cache_bitmap_v3_order), extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V3 - update_read_cache_bitmap_v3_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_BITMAP_COMPRESSED_V3 - update_read_cache_bitmap_v3_order() failed");
return FALSE; return FALSE;
} }
@ -3459,7 +3496,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_CACHE_COLOR_TABLE: case ORDER_TYPE_CACHE_COLOR_TABLE:
if (!update_read_cache_color_table_order(s, &(secondary->cache_color_table_order), extraFlags)) { if (!update_read_cache_color_table_order(s, &(secondary->cache_color_table_order), extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_CACHE_COLOR_TABLE - update_read_cache_color_table_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CACHE_COLOR_TABLE - update_read_cache_color_table_order() failed");
return FALSE; return FALSE;
} }
@ -3470,7 +3508,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_CACHE_GLYPH: case ORDER_TYPE_CACHE_GLYPH:
if (secondary->glyph_v2) if (secondary->glyph_v2)
{ {
if (!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags)) { if (!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_v2_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_v2_order() failed");
return FALSE; return FALSE;
} }
@ -3479,7 +3518,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
} }
else else
{ {
if (!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags)) { if (!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CACHE_GLYPH - update_read_cache_glyph_order() failed");
return FALSE; return FALSE;
} }
@ -3489,7 +3529,8 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_CACHE_BRUSH: case ORDER_TYPE_CACHE_BRUSH:
if (!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags)) { if (!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags))
{
WLog_DBG(TAG, "ORDER_TYPE_CACHE_BRUSH - update_read_cache_brush_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CACHE_BRUSH - update_read_cache_brush_order() failed");
return FALSE; return FALSE;
} }
@ -3524,7 +3565,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
switch (orderType) switch (orderType)
{ {
case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP: case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
if (!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap))) { if (!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap)))
{
WLog_DBG(TAG, "ORDER_TYPE_CREATE_OFFSCREEN_BITMAP - update_read_create_offscreen_bitmap_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CREATE_OFFSCREEN_BITMAP - update_read_create_offscreen_bitmap_order() failed");
return FALSE; return FALSE;
} }
@ -3533,7 +3575,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_SWITCH_SURFACE: case ORDER_TYPE_SWITCH_SURFACE:
if (!update_read_switch_surface_order(s, &(altsec->switch_surface))) { if (!update_read_switch_surface_order(s, &(altsec->switch_surface)))
{
WLog_DBG(TAG, "ORDER_TYPE_SWITCH_SURFACE - update_read_switch_surface_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_SWITCH_SURFACE - update_read_switch_surface_order() failed");
return FALSE; return FALSE;
} }
@ -3542,7 +3585,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_CREATE_NINE_GRID_BITMAP: case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
if (!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap))) { if (!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap)))
{
WLog_DBG(TAG, "ORDER_TYPE_CREATE_NINE_GRID_BITMAP - update_read_create_nine_grid_bitmap_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_CREATE_NINE_GRID_BITMAP - update_read_create_nine_grid_bitmap_order() failed");
return FALSE; return FALSE;
} }
@ -3551,7 +3595,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_FRAME_MARKER: case ORDER_TYPE_FRAME_MARKER:
if (!update_read_frame_marker_order(s, &(altsec->frame_marker))) { if (!update_read_frame_marker_order(s, &(altsec->frame_marker)))
{
WLog_DBG(TAG, "ORDER_TYPE_FRAME_MARKER - update_read_frame_marker_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_FRAME_MARKER - update_read_frame_marker_order() failed");
return FALSE; return FALSE;
} }
@ -3561,7 +3606,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_STREAM_BITMAP_FIRST: case ORDER_TYPE_STREAM_BITMAP_FIRST:
if (!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first))) { if (!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first)))
{
WLog_DBG(TAG, "ORDER_TYPE_STREAM_BITMAP_FIRST - update_read_stream_bitmap_first_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_STREAM_BITMAP_FIRST - update_read_stream_bitmap_first_order() failed");
return FALSE; return FALSE;
} }
@ -3570,7 +3616,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_STREAM_BITMAP_NEXT: case ORDER_TYPE_STREAM_BITMAP_NEXT:
if (!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next))) { if (!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next)))
{
WLog_DBG(TAG, "ORDER_TYPE_STREAM_BITMAP_NEXT - update_read_stream_bitmap_next_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_STREAM_BITMAP_NEXT - update_read_stream_bitmap_next_order() failed");
return FALSE; return FALSE;
} }
@ -3579,7 +3626,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GDIPLUS_FIRST: case ORDER_TYPE_GDIPLUS_FIRST:
if (!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first))) { if (!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first)))
{
WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_FIRST - update_read_draw_gdiplus_first_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_FIRST - update_read_draw_gdiplus_first_order() failed");
return FALSE; return FALSE;
} }
@ -3588,7 +3636,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GDIPLUS_NEXT: case ORDER_TYPE_GDIPLUS_NEXT:
if (!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next))) { if (!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next)))
{
WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_NEXT - update_read_draw_gdiplus_next_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_NEXT - update_read_draw_gdiplus_next_order() failed");
return FALSE; return FALSE;
} }
@ -3597,7 +3646,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GDIPLUS_END: case ORDER_TYPE_GDIPLUS_END:
if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end))) { if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end)))
{
WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_END - update_read_draw_gdiplus_end_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_END - update_read_draw_gdiplus_end_order() failed");
return FALSE; return FALSE;
} }
@ -3606,7 +3656,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GDIPLUS_CACHE_FIRST: case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
if (!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first))) { if (!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first)))
{
WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_FIRST - update_read_draw_gdiplus_cache_first_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_FIRST - update_read_draw_gdiplus_cache_first_order() failed");
return FALSE; return FALSE;
} }
@ -3615,7 +3666,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GDIPLUS_CACHE_NEXT: case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
if (!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next))) { if (!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next)))
{
WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_NEXT - update_read_draw_gdiplus_cache_next_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_NEXT - update_read_draw_gdiplus_cache_next_order() failed");
return FALSE; return FALSE;
} }
@ -3624,7 +3676,8 @@ BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
break; break;
case ORDER_TYPE_GDIPLUS_CACHE_END: case ORDER_TYPE_GDIPLUS_CACHE_END:
if (!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end))) { if (!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end)))
{
WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_END - update_read_draw_gdiplus_cache_end_order() failed"); WLog_DBG(TAG, "ORDER_TYPE_GDIPLUS_CACHE_END - update_read_draw_gdiplus_cache_end_order() failed");
return FALSE; return FALSE;
} }
@ -3649,7 +3702,8 @@ BOOL update_recv_order(rdpUpdate* update, wStream* s)
{ {
BYTE controlFlags; BYTE controlFlags;
if (Stream_GetRemainingLength(s) < 1) { if (Stream_GetRemainingLength(s) < 1)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE; return FALSE;
} }

View File

@ -458,7 +458,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
switch (rdp->state) switch (rdp->state)
{ {
case CONNECTION_STATE_INITIAL: case CONNECTION_STATE_INITIAL:
if (!rdp_server_accept_nego(rdp, s)) { if (!rdp_server_accept_nego(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_INITIAL - rdp_server_accept_nego() fail"); WLog_DBG(TAG, "CONNECTION_STATE_INITIAL - rdp_server_accept_nego() fail");
return -1; return -1;
} }
@ -478,28 +479,32 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
break; break;
case CONNECTION_STATE_NEGO: case CONNECTION_STATE_NEGO:
if (!rdp_server_accept_mcs_connect_initial(rdp, s)) { if (!rdp_server_accept_mcs_connect_initial(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_NEGO - rdp_server_accept_mcs_connect_initial() fail"); WLog_DBG(TAG, "CONNECTION_STATE_NEGO - rdp_server_accept_mcs_connect_initial() fail");
return -1; return -1;
} }
break; break;
case CONNECTION_STATE_MCS_CONNECT: case CONNECTION_STATE_MCS_CONNECT:
if (!rdp_server_accept_mcs_erect_domain_request(rdp, s)) { if (!rdp_server_accept_mcs_erect_domain_request(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_MCS_CONNECT - rdp_server_accept_mcs_erect_domain_request() fail"); WLog_DBG(TAG, "CONNECTION_STATE_MCS_CONNECT - rdp_server_accept_mcs_erect_domain_request() fail");
return -1; return -1;
} }
break; break;
case CONNECTION_STATE_MCS_ERECT_DOMAIN: case CONNECTION_STATE_MCS_ERECT_DOMAIN:
if (!rdp_server_accept_mcs_attach_user_request(rdp, s)) { if (!rdp_server_accept_mcs_attach_user_request(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_MCS_ERECT_DOMAIN - rdp_server_accept_mcs_attach_user_request() fail"); WLog_DBG(TAG, "CONNECTION_STATE_MCS_ERECT_DOMAIN - rdp_server_accept_mcs_attach_user_request() fail");
return -1; return -1;
} }
break; break;
case CONNECTION_STATE_MCS_ATTACH_USER: case CONNECTION_STATE_MCS_ATTACH_USER:
if (!rdp_server_accept_mcs_channel_join_request(rdp, s)) { if (!rdp_server_accept_mcs_channel_join_request(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_MCS_ATTACH_USER - rdp_server_accept_mcs_channel_join_request() fail"); WLog_DBG(TAG, "CONNECTION_STATE_MCS_ATTACH_USER - rdp_server_accept_mcs_channel_join_request() fail");
return -1; return -1;
} }
@ -508,7 +513,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
case CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT: case CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT:
if (rdp->settings->UseRdpSecurityLayer) if (rdp->settings->UseRdpSecurityLayer)
{ {
if (!rdp_server_establish_keys(rdp, s)) { if (!rdp_server_establish_keys(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT - rdp_server_establish_keys() fail"); WLog_DBG(TAG, "CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT - rdp_server_establish_keys() fail");
return -1; return -1;
} }
@ -520,7 +526,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
break; break;
case CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE: case CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE:
if (!rdp_recv_client_info(rdp, s)) { if (!rdp_recv_client_info(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE - rdp_recv_client_info() fail"); WLog_DBG(TAG, "CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE - rdp_recv_client_info() fail");
return -1; return -1;
} }
@ -531,7 +538,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
break; break;
case CONNECTION_STATE_LICENSING: case CONNECTION_STATE_LICENSING:
if (!license_send_valid_client_error_packet(rdp->license)) { if (!license_send_valid_client_error_packet(rdp->license))
{
WLog_DBG(TAG, "CONNECTION_STATE_LICENSING - license_send_valid_client_error_packet() fail"); WLog_DBG(TAG, "CONNECTION_STATE_LICENSING - license_send_valid_client_error_packet() fail");
return FALSE; return FALSE;
} }
@ -547,7 +555,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
{ {
IFCALL(client->Capabilities, client); IFCALL(client->Capabilities, client);
if (!rdp_send_demand_active(rdp)) { if (!rdp_send_demand_active(rdp))
{
WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - rdp_send_demand_active() fail"); WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - rdp_send_demand_active() fail");
return -1; return -1;
} }
@ -556,7 +565,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
if (s) if (s)
{ {
if (peer_recv_pdu(client, s) < 0) { if (peer_recv_pdu(client, s) < 0)
{
WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail"); WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail");
return -1; return -1;
} }
@ -569,7 +579,8 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
* before receiving the Deactivate All PDU. We need to process them as usual. * before receiving the Deactivate All PDU. We need to process them as usual.
*/ */
if (peer_recv_pdu(client, s) < 0) { if (peer_recv_pdu(client, s) < 0)
{
WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail"); WLog_DBG(TAG, "CONNECTION_STATE_CAPABILITIES_EXCHANGE - peer_recv_pdu() fail");
return -1; return -1;
} }
@ -578,14 +589,16 @@ static int peer_recv_callback(rdpTransport* transport, wStream* s, void* extra)
break; break;
case CONNECTION_STATE_FINALIZATION: case CONNECTION_STATE_FINALIZATION:
if (peer_recv_pdu(client, s) < 0) { if (peer_recv_pdu(client, s) < 0)
{
WLog_DBG(TAG, "CONNECTION_STATE_FINALIZATION - peer_recv_pdu() fail"); WLog_DBG(TAG, "CONNECTION_STATE_FINALIZATION - peer_recv_pdu() fail");
return -1; return -1;
} }
break; break;
case CONNECTION_STATE_ACTIVE: case CONNECTION_STATE_ACTIVE:
if (peer_recv_pdu(client, s) < 0) { if (peer_recv_pdu(client, s) < 0)
{
WLog_DBG(TAG, "CONNECTION_STATE_ACTIVE - peer_recv_pdu() fail"); WLog_DBG(TAG, "CONNECTION_STATE_ACTIVE - peer_recv_pdu() fail");
return -1; return -1;
} }

View File

@ -767,7 +767,8 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s)
BYTE compressedType; BYTE compressedType;
UINT16 compressedLength; UINT16 compressedLength;
if (!rdp_read_share_data_header(s, &length, &type, &shareId, &compressedType, &compressedLength)) { if (!rdp_read_share_data_header(s, &length, &type, &shareId, &compressedType, &compressedLength))
{
WLog_DBG(TAG, "rdp_read_share_data_header() failed"); WLog_DBG(TAG, "rdp_read_share_data_header() failed");
return -1; return -1;
} }
@ -816,98 +817,112 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s)
switch (type) switch (type)
{ {
case DATA_PDU_TYPE_UPDATE: case DATA_PDU_TYPE_UPDATE:
if (!update_recv(rdp->update, cs)) { if (!update_recv(rdp->update, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_UPDATE - update_recv() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_UPDATE - update_recv() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_CONTROL: case DATA_PDU_TYPE_CONTROL:
if (!rdp_recv_server_control_pdu(rdp, cs)) { if (!rdp_recv_server_control_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_CONTROL - rdp_recv_server_control_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_CONTROL - rdp_recv_server_control_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_POINTER: case DATA_PDU_TYPE_POINTER:
if (!update_recv_pointer(rdp->update, cs)) { if (!update_recv_pointer(rdp->update, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_POINTER - update_recv_pointer() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_POINTER - update_recv_pointer() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_SYNCHRONIZE: case DATA_PDU_TYPE_SYNCHRONIZE:
if (!rdp_recv_synchronize_pdu(rdp, cs)) { if (!rdp_recv_synchronize_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_SYNCHRONIZE - rdp_recv_synchronize_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_SYNCHRONIZE - rdp_recv_synchronize_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_PLAY_SOUND: case DATA_PDU_TYPE_PLAY_SOUND:
if (!update_recv_play_sound(rdp->update, cs)) { if (!update_recv_play_sound(rdp->update, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_PLAY_SOUND - update_recv_play_sound() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_PLAY_SOUND - update_recv_play_sound() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_SHUTDOWN_DENIED: case DATA_PDU_TYPE_SHUTDOWN_DENIED:
if (!rdp_recv_server_shutdown_denied_pdu(rdp, cs)) { if (!rdp_recv_server_shutdown_denied_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_SHUTDOWN_DENIED - rdp_recv_server_shutdown_denied_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_SHUTDOWN_DENIED - rdp_recv_server_shutdown_denied_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_SAVE_SESSION_INFO: case DATA_PDU_TYPE_SAVE_SESSION_INFO:
if (!rdp_recv_save_session_info(rdp, cs)) { if (!rdp_recv_save_session_info(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_SAVE_SESSION_INFO - rdp_recv_save_session_info() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_SAVE_SESSION_INFO - rdp_recv_save_session_info() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_FONT_MAP: case DATA_PDU_TYPE_FONT_MAP:
if (!rdp_recv_font_map_pdu(rdp, cs)) { if (!rdp_recv_font_map_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_FONT_MAP - rdp_recv_font_map_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_FONT_MAP - rdp_recv_font_map_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS: case DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS:
if (!rdp_recv_server_set_keyboard_indicators_pdu(rdp, cs)) { if (!rdp_recv_server_set_keyboard_indicators_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS - rdp_recv_server_set_keyboard_indicators_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_SET_KEYBOARD_INDICATORS - rdp_recv_server_set_keyboard_indicators_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS: case DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS:
if (!rdp_recv_server_set_keyboard_ime_status_pdu(rdp, cs)) { if (!rdp_recv_server_set_keyboard_ime_status_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS - rdp_recv_server_set_keyboard_ime_status_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_SET_KEYBOARD_IME_STATUS - rdp_recv_server_set_keyboard_ime_status_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_SET_ERROR_INFO: case DATA_PDU_TYPE_SET_ERROR_INFO:
if (!rdp_recv_set_error_info_data_pdu(rdp, cs)) { if (!rdp_recv_set_error_info_data_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_SET_ERROR_INFO - rdp_recv_set_error_info_data_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_SET_ERROR_INFO - rdp_recv_set_error_info_data_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_ARC_STATUS: case DATA_PDU_TYPE_ARC_STATUS:
if (!rdp_recv_server_auto_reconnect_status_pdu(rdp, cs)) { if (!rdp_recv_server_auto_reconnect_status_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_ARC_STATUS - rdp_recv_server_auto_reconnect_status_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_ARC_STATUS - rdp_recv_server_auto_reconnect_status_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_STATUS_INFO: case DATA_PDU_TYPE_STATUS_INFO:
if (!rdp_recv_server_status_info_pdu(rdp, cs)) { if (!rdp_recv_server_status_info_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_STATUS_INFO - rdp_recv_server_status_info_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_STATUS_INFO - rdp_recv_server_status_info_pdu() failed");
goto out_fail; goto out_fail;
} }
break; break;
case DATA_PDU_TYPE_MONITOR_LAYOUT: case DATA_PDU_TYPE_MONITOR_LAYOUT:
if (!rdp_recv_monitor_layout_pdu(rdp, cs)) { if (!rdp_recv_monitor_layout_pdu(rdp, cs))
{
WLog_DBG(TAG, "DATA_PDU_TYPE_MONITOR_LAYOUT - rdp_recv_monitor_layout_pdu() failed"); WLog_DBG(TAG, "DATA_PDU_TYPE_MONITOR_LAYOUT - rdp_recv_monitor_layout_pdu() failed");
goto out_fail; goto out_fail;
} }
@ -1121,7 +1136,8 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
if (rdp->settings->UseRdpSecurityLayer) if (rdp->settings->UseRdpSecurityLayer)
{ {
if (!rdp_read_security_header(s, &securityFlags)) { if (!rdp_read_security_header(s, &securityFlags))
{
WLog_DBG(TAG, "rdp_read_security_header() fail"); WLog_DBG(TAG, "rdp_read_security_header() fail");
return -1; return -1;
} }
@ -1153,7 +1169,8 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
{ {
nextPosition = Stream_GetPosition(s); nextPosition = Stream_GetPosition(s);
if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) { if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource))
{
WLog_DBG(TAG, "rdp_read_share_control_header() fail"); WLog_DBG(TAG, "rdp_read_share_control_header() fail");
return -1; return -1;
} }
@ -1173,7 +1190,8 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
break; break;
case PDU_TYPE_DEACTIVATE_ALL: case PDU_TYPE_DEACTIVATE_ALL:
if (!rdp_recv_deactivate_all(rdp, s)) { if (!rdp_recv_deactivate_all(rdp, s))
{
WLog_DBG(TAG, "rdp_recv_deactivate_all() fail"); WLog_DBG(TAG, "rdp_recv_deactivate_all() fail");
return -1; return -1;
} }
@ -1202,7 +1220,8 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
} }
else else
{ {
if (!freerdp_channel_process(rdp->instance, s, channelId)) { if (!freerdp_channel_process(rdp->instance, s, channelId))
{
WLog_DBG(TAG, "freerdp_channel_process() fail"); WLog_DBG(TAG, "freerdp_channel_process() fail");
return -1; return -1;
} }
@ -1218,7 +1237,8 @@ static int rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s)
fastpath = rdp->fastpath; fastpath = rdp->fastpath;
if (!fastpath_read_header_rdp(fastpath, s, &length)) { if (!fastpath_read_header_rdp(fastpath, s, &length))
{
WLog_DBG(TAG, "fastpath_read_header_rdp() fail"); WLog_DBG(TAG, "fastpath_read_header_rdp() fail");
return -1; return -1;
} }
@ -1238,7 +1258,8 @@ static int rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s)
{ {
UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0; UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0;
if (!rdp_decrypt(rdp, s, length, flags)) { if (!rdp_decrypt(rdp, s, length, flags))
{
WLog_DBG(TAG, "rdp_decrypt() fail"); WLog_DBG(TAG, "rdp_decrypt() fail");
return -1; return -1;
} }
@ -1275,7 +1296,8 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
switch (rdp->state) switch (rdp->state)
{ {
case CONNECTION_STATE_NLA: case CONNECTION_STATE_NLA:
if (nla_recv_pdu(rdp->nla, s) < 1) { if (nla_recv_pdu(rdp->nla, s) < 1)
{
WLog_DBG(TAG, "CONNECTION_STATE_NLA - nla_recv_pdu() fail"); WLog_DBG(TAG, "CONNECTION_STATE_NLA - nla_recv_pdu() fail");
return -1; return -1;
} }
@ -1287,7 +1309,8 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
nla_free(rdp->nla); nla_free(rdp->nla);
rdp->nla = NULL; rdp->nla = NULL;
if (!mcs_client_begin(rdp->mcs)) { if (!mcs_client_begin(rdp->mcs))
{
WLog_DBG(TAG, "CONNECTION_STATE_NLA - mcs_client_begin() fail"); WLog_DBG(TAG, "CONNECTION_STATE_NLA - mcs_client_begin() fail");
return -1; return -1;
} }
@ -1334,7 +1357,8 @@ int rdp_recv_callback(rdpTransport* transport, wStream* s, void* extra)
break; break;
case CONNECTION_STATE_MCS_CHANNEL_JOIN: case CONNECTION_STATE_MCS_CHANNEL_JOIN:
if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s)) { if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s))
{
WLog_DBG(TAG, "CONNECTION_STATE_MCS_CHANNEL_JOIN - rdp_client_connect_mcs_channel_join_confirm() fail"); WLog_DBG(TAG, "CONNECTION_STATE_MCS_CHANNEL_JOIN - rdp_client_connect_mcs_channel_join_confirm() fail");
status = -1; status = -1;
} }
@ -1412,7 +1436,8 @@ int rdp_check_fds(rdpRdp* rdp)
status = tsg_check_event_handles(tsg); status = tsg_check_event_handles(tsg);
if (status < 0) { if (status < 0)
{
WLog_DBG(TAG, "tsg_check_event_handles() - %i", status); WLog_DBG(TAG, "tsg_check_event_handles() - %i", status);
return -1; return -1;
} }

View File

@ -791,7 +791,8 @@ int transport_check_fds(rdpTransport* transport)
return recv_status; return recv_status;
} }
if (recv_status < 0) { if (recv_status < 0)
{
WLog_DBG(TAG, "transport->ReceiveCallback() - %i", recv_status); WLog_DBG(TAG, "transport->ReceiveCallback() - %i", recv_status);
return -1; return -1;
} }

View File

@ -51,7 +51,8 @@ BOOL update_recv_orders(rdpUpdate* update, wStream* s)
{ {
UINT16 numberOrders; UINT16 numberOrders;
if (Stream_GetRemainingLength(s) < 6) { if (Stream_GetRemainingLength(s) < 6)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 6"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 6");
return FALSE; return FALSE;
} }
@ -62,7 +63,8 @@ BOOL update_recv_orders(rdpUpdate* update, wStream* s)
while (numberOrders > 0) while (numberOrders > 0)
{ {
if (!update_recv_order(update, s)) { if (!update_recv_order(update, s))
{
WLog_DBG(TAG, "update_recv_order() failed"); WLog_DBG(TAG, "update_recv_order() failed");
return FALSE; return FALSE;
} }
@ -491,7 +493,8 @@ BOOL update_recv(rdpUpdate* update, wStream* s)
UINT16 updateType; UINT16 updateType;
rdpContext* context = update->context; rdpContext* context = update->context;
if (Stream_GetRemainingLength(s) < 2) { if (Stream_GetRemainingLength(s) < 2)
{
WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 2"); WLog_DBG(TAG, "Stream_GetRemainingLength(s) < 2");
return FALSE; return FALSE;
} }
@ -513,7 +516,8 @@ BOOL update_recv(rdpUpdate* update, wStream* s)
break; break;
case UPDATE_TYPE_BITMAP: case UPDATE_TYPE_BITMAP:
if (!update_read_bitmap_update(update, s, &update->bitmap_update)) { if (!update_read_bitmap_update(update, s, &update->bitmap_update))
{
WLog_DBG(TAG, "UPDATE_TYPE_BITMAP - update_read_bitmap_update() failed"); WLog_DBG(TAG, "UPDATE_TYPE_BITMAP - update_read_bitmap_update() failed");
return FALSE; return FALSE;
} }
@ -521,7 +525,8 @@ BOOL update_recv(rdpUpdate* update, wStream* s)
break; break;
case UPDATE_TYPE_PALETTE: case UPDATE_TYPE_PALETTE:
if (!update_read_palette(update, s, &update->palette_update)) { if (!update_read_palette(update, s, &update->palette_update))
{
WLog_DBG(TAG, "UPDATE_TYPE_PALETTE - update_read_palette() failed"); WLog_DBG(TAG, "UPDATE_TYPE_PALETTE - update_read_palette() failed");
return FALSE; return FALSE;
} }