/** * Function description * * @return 0 on success, otherwise a Win32 error code */ static UINT remdesk_recv_ctl_verify_password_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header) { int status; int cbExpertBlobW = 0; WCHAR* expertBlobW = NULL; REMDESK_CTL_VERIFY_PASSWORD_PDU pdu; UINT error; if (Stream_GetRemainingLength(s) < 8) { WLog_ERR(TAG, "Stream_GetRemainingLength failed!"); return ERROR_INVALID_DATA; } pdu.expertBlob = NULL; expertBlobW = (WCHAR*) Stream_Pointer(s); cbExpertBlobW = header->DataLength - 4; status = ConvertFromUnicode(CP_UTF8, 0, expertBlobW, cbExpertBlobW / 2, &pdu.expertBlob, 0, NULL, NULL); if (status <= 0) { WLog_ERR(TAG, "ConvertFromUnicode failed!"); return ERROR_INTERNAL_ERROR; } WLog_INFO(TAG, "ExpertBlob: %s", pdu.expertBlob); if ((error = remdesk_send_ctl_result_pdu(context, 0))) WLog_ERR(TAG, "remdesk_send_ctl_result_pdu failed with error %"PRIu32"!", error); return error; }
/** * Function description * * @return 0 on success, otherwise a Win32 error code */ static UINT remdesk_recv_ctl_remote_control_desktop_pdu( RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header) { int status; int cchStringW; WCHAR* pStringW; UINT32 msgLength; int cbRaConnectionStringW = 0; WCHAR* raConnectionStringW = NULL; REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu; UINT error; msgLength = header->DataLength - 4; pStringW = (WCHAR*) Stream_Pointer(s); raConnectionStringW = pStringW; cchStringW = 0; while ((msgLength > 0) && pStringW[cchStringW]) { msgLength -= 2; cchStringW++; } if (pStringW[cchStringW] || !cchStringW) return ERROR_INVALID_DATA; cchStringW++; cbRaConnectionStringW = cchStringW * 2; pdu.raConnectionString = NULL; status = ConvertFromUnicode(CP_UTF8, 0, raConnectionStringW, cbRaConnectionStringW / 2, &pdu.raConnectionString, 0, NULL, NULL); if (status <= 0) { WLog_ERR(TAG, "ConvertFromUnicode failed!"); return ERROR_INTERNAL_ERROR; } WLog_INFO(TAG, "RaConnectionString: %s", pdu.raConnectionString); free(pdu.raConnectionString); if ((error = remdesk_send_ctl_result_pdu(context, 0))) WLog_ERR(TAG, "remdesk_send_ctl_result_pdu failed with error %"PRIu32"!", error); return error; }
static int remdesk_recv_ctl_remote_control_desktop_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header) { int status; int cchStringW; WCHAR* pStringW; UINT32 msgLength; int cbRaConnectionStringW = 0; WCHAR* raConnectionStringW = NULL; REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu; msgLength = header->DataLength - 4; pStringW = (WCHAR*) Stream_Pointer(s); raConnectionStringW = pStringW; cchStringW = 0; while ((msgLength > 0) && pStringW[cchStringW]) { msgLength -= 2; cchStringW++; } if (pStringW[cchStringW] || !cchStringW) return -1; cchStringW++; cbRaConnectionStringW = cchStringW * 2; pdu.raConnectionString = NULL; status = ConvertFromUnicode(CP_UTF8, 0, raConnectionStringW, cbRaConnectionStringW / 2, &pdu.raConnectionString, 0, NULL, NULL); if (status <= 0) return -1; printf("RaConnectionString: %s\n", pdu.raConnectionString); free(pdu.raConnectionString); remdesk_send_ctl_result_pdu(context, 0); return 1; }
static int remdesk_recv_ctl_verify_password_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header) { int status; int cbExpertBlobW = 0; WCHAR* expertBlobW = NULL; REMDESK_CTL_VERIFY_PASSWORD_PDU pdu; if (Stream_GetRemainingLength(s) < 8) return -1; pdu.expertBlob = NULL; expertBlobW = (WCHAR*) Stream_Pointer(s); cbExpertBlobW = header->DataLength - 4; status = ConvertFromUnicode(CP_UTF8, 0, expertBlobW, cbExpertBlobW / 2, &pdu.expertBlob, 0, NULL, NULL); printf("ExpertBlob: %s\n", pdu.expertBlob); remdesk_send_ctl_result_pdu(context, 0); return 1; }