static void cliprdr_process_receive(rdpSvcPlugin* plugin, wStream* s) { UINT16 msgType; UINT16 msgFlags; UINT32 dataLen; cliprdrPlugin* cliprdr = (cliprdrPlugin*) plugin; Stream_Read_UINT16(s, msgType); Stream_Read_UINT16(s, msgFlags); Stream_Read_UINT32(s, dataLen); DEBUG_CLIPRDR("msgType: %s (%d), msgFlags: %d dataLen: %d", CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen); #ifdef WITH_DEBUG_CLIPRDR winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(s), dataLen + 8); #endif switch (msgType) { case CB_CLIP_CAPS: cliprdr_process_clip_caps(cliprdr, s, dataLen, msgFlags); break; case CB_MONITOR_READY: cliprdr_process_monitor_ready(cliprdr, s, dataLen, msgFlags); break; case CB_FORMAT_LIST: cliprdr_process_format_list(cliprdr, s, dataLen, msgFlags); break; case CB_FORMAT_LIST_RESPONSE: cliprdr_process_format_list_response(cliprdr, s, dataLen, msgFlags); break; case CB_FORMAT_DATA_REQUEST: cliprdr_process_format_data_request(cliprdr, s, dataLen, msgFlags); break; case CB_FORMAT_DATA_RESPONSE: cliprdr_process_format_data_response(cliprdr, s, dataLen, msgFlags); break; case CB_FILECONTENTS_REQUEST: cliprdr_process_filecontents_request(cliprdr, s, dataLen, msgFlags); break; case CB_FILECONTENTS_RESPONSE: cliprdr_process_filecontents_response(cliprdr, s, dataLen, msgFlags); break; case CB_LOCK_CLIPDATA: cliprdr_process_lock_clipdata(cliprdr, s, dataLen, msgFlags); break; case CB_UNLOCK_CLIPDATA: cliprdr_process_unlock_clipdata(cliprdr, s, dataLen, msgFlags); break; default: WLog_ERR(TAG, "unknown msgType %d", msgType); break; } }
/** * Function description * * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_order_recv(cliprdrPlugin* cliprdr, wStream* s) { UINT16 msgType; UINT16 msgFlags; UINT32 dataLen; UINT error; Stream_Read_UINT16(s, msgType); /* msgType (2 bytes) */ Stream_Read_UINT16(s, msgFlags); /* msgFlags (2 bytes) */ Stream_Read_UINT32(s, dataLen); /* dataLen (4 bytes) */ #ifdef WITH_DEBUG_CLIPRDR WLog_DBG(TAG, "msgType: %s (%d), msgFlags: %d dataLen: %d", CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen); winpr_HexDump(TAG, WLOG_DEBUG, Stream_Buffer(s), dataLen + 8); #endif switch (msgType) { case CB_CLIP_CAPS: if ((error = cliprdr_process_clip_caps(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_clip_caps failed with error %lu!", error); break; case CB_MONITOR_READY: if ((error = cliprdr_process_monitor_ready(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_monitor_ready failed with error %lu!", error); break; case CB_FORMAT_LIST: if ((error = cliprdr_process_format_list(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_format_list failed with error %lu!", error); break; case CB_FORMAT_LIST_RESPONSE: if ((error = cliprdr_process_format_list_response(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_format_list_response failed with error %lu!", error); break; case CB_FORMAT_DATA_REQUEST: if ((error = cliprdr_process_format_data_request(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_format_data_request failed with error %lu!", error); break; case CB_FORMAT_DATA_RESPONSE: if ((error = cliprdr_process_format_data_response(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_format_data_response failed with error %lu!", error); break; case CB_FILECONTENTS_REQUEST: if ((error = cliprdr_process_filecontents_request(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_filecontents_request failed with error %lu!", error); break; case CB_FILECONTENTS_RESPONSE: if ((error = cliprdr_process_filecontents_response(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_filecontents_response failed with error %lu!", error); break; case CB_LOCK_CLIPDATA: if ((error = cliprdr_process_lock_clipdata(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_lock_clipdata failed with error %lu!", error); break; case CB_UNLOCK_CLIPDATA: if ((error = cliprdr_process_unlock_clipdata(cliprdr, s, dataLen, msgFlags))) WLog_ERR(TAG, "cliprdr_process_lock_clipdata failed with error %lu!", error); break; default: error = CHANNEL_RC_BAD_PROC; WLog_ERR(TAG, "unknown msgType %d", msgType); break; } Stream_Free(s, TRUE); return error; }