예제 #1
0
static int read_touch_contact_data(RdpeiServerContext *context, wStream *s, RDPINPUT_CONTACT_DATA *contactData)
{
	if (Stream_GetRemainingLength(s) < 1)
		return -1;

	Stream_Read_UINT8(s, contactData->contactId);
	if (!rdpei_read_2byte_unsigned(s, &contactData->fieldsPresent) ||
		!rdpei_read_4byte_signed(s, &contactData->x) ||
		!rdpei_read_4byte_signed(s, &contactData->y) ||
		!rdpei_read_4byte_unsigned(s, &contactData->contactFlags))
		return -1;

	if (contactData->fieldsPresent & CONTACT_DATA_CONTACTRECT_PRESENT)
	{
		if (!rdpei_read_2byte_signed(s, &contactData->contactRectLeft) ||
			!rdpei_read_2byte_signed(s, &contactData->contactRectTop) ||
			!rdpei_read_2byte_signed(s, &contactData->contactRectRight) ||
			!rdpei_read_2byte_signed(s, &contactData->contactRectBottom))
			return -1;
	}

	if ((contactData->fieldsPresent & CONTACT_DATA_ORIENTATION_PRESENT) &&
			!rdpei_read_4byte_unsigned(s, &contactData->orientation))
		return -1;

	if ((contactData->fieldsPresent & CONTACT_DATA_PRESSURE_PRESENT) &&
			!rdpei_read_4byte_unsigned(s, &contactData->pressure))
		return -1;

	return 0;
}
예제 #2
0
static int read_touch_event(RdpeiServerContext *context, wStream *s)
{
	UINT32 frameCount;
	int i, ret;
	RDPINPUT_TOUCH_EVENT *event = &context->priv->touchEvent;
	RDPINPUT_TOUCH_FRAME *frame;

	ret = -1;
	if (!rdpei_read_4byte_unsigned(s, &event->encodeTime) || !rdpei_read_2byte_unsigned(s, &frameCount))
		return -1;

	event->frameCount = frameCount;
	event->frames = frame = calloc(event->frameCount, sizeof(RDPINPUT_TOUCH_FRAME));
	if (!event->frames)
		return -1;

	for (i = 0; i < frameCount; i++, frame++)
	{
		if (read_touch_frame(context, s, frame) < 0)
		{
			event->frameCount = i;
			goto out_cleanup;
		}
	}

	if (context->onTouchEvent)
		context->onTouchEvent(context, event);

	ret = 0;

out_cleanup:
	touch_event_reset(event);
	return ret;
}
예제 #3
0
파일: rdpei_main.c 프로젝트: BUGgs/FreeRDP
/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT read_touch_contact_data(RdpeiServerContext *context, wStream *s, RDPINPUT_CONTACT_DATA *contactData)
{
	if (Stream_GetRemainingLength(s) < 1)
	{
		WLog_ERR(TAG, "Not enought data!");
		return ERROR_INVALID_DATA;
	}

	Stream_Read_UINT8(s, contactData->contactId);
	if (!rdpei_read_2byte_unsigned(s, &contactData->fieldsPresent) ||
		!rdpei_read_4byte_signed(s, &contactData->x) ||
		!rdpei_read_4byte_signed(s, &contactData->y) ||
		!rdpei_read_4byte_unsigned(s, &contactData->contactFlags))
	{
		WLog_ERR(TAG, "rdpei_read_ failed!");
		return ERROR_INTERNAL_ERROR;
	}

	if (contactData->fieldsPresent & CONTACT_DATA_CONTACTRECT_PRESENT)
	{
		if (!rdpei_read_2byte_signed(s, &contactData->contactRectLeft) ||
			!rdpei_read_2byte_signed(s, &contactData->contactRectTop) ||
			!rdpei_read_2byte_signed(s, &contactData->contactRectRight) ||
			!rdpei_read_2byte_signed(s, &contactData->contactRectBottom))
		{
			WLog_ERR(TAG, "rdpei_read_ failed!");
			return ERROR_INTERNAL_ERROR;
		}
	}

	if ((contactData->fieldsPresent & CONTACT_DATA_ORIENTATION_PRESENT) &&
			!rdpei_read_4byte_unsigned(s, &contactData->orientation))
	{
		WLog_ERR(TAG, "rdpei_read_ failed!");
		return ERROR_INTERNAL_ERROR;
	}


	if ((contactData->fieldsPresent & CONTACT_DATA_PRESSURE_PRESENT) &&
			!rdpei_read_4byte_unsigned(s, &contactData->pressure))
	{
		WLog_ERR(TAG, "rdpei_read_ failed!");
		return ERROR_INTERNAL_ERROR;
	}

	return CHANNEL_RC_OK;
}
예제 #4
0
파일: rdpei_main.c 프로젝트: BUGgs/FreeRDP
/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT read_touch_event(RdpeiServerContext *context, wStream *s)
{
	UINT32 frameCount;
	int i;
	RDPINPUT_TOUCH_EVENT *event = &context->priv->touchEvent;
	RDPINPUT_TOUCH_FRAME *frame;
	UINT error = CHANNEL_RC_OK;

	if (!rdpei_read_4byte_unsigned(s, &event->encodeTime) || !rdpei_read_2byte_unsigned(s, &frameCount))
	{
		WLog_ERR(TAG, "rdpei_read_ failed!");
		return ERROR_INTERNAL_ERROR;
	}

	event->frameCount = frameCount;
	event->frames = frame = calloc(event->frameCount, sizeof(RDPINPUT_TOUCH_FRAME));
	if (!event->frames)
	{
		WLog_ERR(TAG, "calloc failed!");
		return CHANNEL_RC_NO_MEMORY;
	}

	for (i = 0; i < frameCount; i++, frame++)
	{
		if ((error = read_touch_frame(context, s, frame)))
		{
			WLog_ERR(TAG, "read_touch_contact_data failed with error %lu!", error);
			event->frameCount = i;
			goto out_cleanup;
		}
	}


	IFCALLRET(context->onTouchEvent, error, context, event);
	if (error)
		WLog_ERR(TAG, "context->onTouchEvent failed with error %lu", error);

out_cleanup:
	touch_event_reset(event);
	return error;
}