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; }
/** * 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; }