Merge branch 'egfx' of https://github.com/awakecoding/freerdp into egfx_new

Conflicts:
	channels/drdynvc/client/dvcman.c
	include/freerdp/codec/h264.h
	libfreerdp/codec/h264.c		after this merge h264 doesn't work anymore!!
	libfreerdp/utils/svc_plugin.c
This commit is contained in:
erbth 2014-09-08 16:56:45 +02:00
commit cbc8b3a7e1
568 changed files with 18733 additions and 6884 deletions

View File

@ -263,6 +263,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINPR_EXPORTS -DFREERDP_EXPORTS")
if(NOT IOS)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(execinfo.h HAVE_EXECINFO_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(sys/modem.h HAVE_SYS_MODEM_H)

View File

@ -72,7 +72,7 @@ static BOOL audin_alsa_set_params(AudinALSADevice* alsa, snd_pcm_t* capture_hand
if ((error = snd_pcm_hw_params_malloc(&hw_params)) < 0)
{
DEBUG_WARN("snd_pcm_hw_params_malloc (%s)",
CLOG_ERR("snd_pcm_hw_params_malloc (%s)",
snd_strerror(error));
return FALSE;
}
@ -206,7 +206,7 @@ static void* audin_alsa_thread_func(void* arg)
{
if ((error = snd_pcm_open(&capture_handle, alsa->device_name, SND_PCM_STREAM_CAPTURE, 0)) < 0)
{
DEBUG_WARN("snd_pcm_open (%s)", snd_strerror(error));
CLOG_ERR("snd_pcm_open (%s)", snd_strerror(error));
break;
}
@ -226,7 +226,7 @@ static void* audin_alsa_thread_func(void* arg)
}
else if (error < 0)
{
DEBUG_WARN("snd_pcm_readi (%s)", snd_strerror(error));
CLOG_ERR("snd_pcm_readi (%s)", snd_strerror(error));
break;
}

View File

@ -133,7 +133,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
DEBUG_DVC("NumFormats %d", NumFormats);
if ((NumFormats < 1) || (NumFormats > 1000))
{
DEBUG_WARN("bad NumFormats %d", NumFormats);
CLOG_ERR("bad NumFormats %d", NumFormats);
return 1;
}
Stream_Seek_UINT32(s); /* cbSizeFormatsPacket */
@ -262,7 +262,7 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStr
if (initialFormat >= (UINT32) callback->formats_count)
{
DEBUG_WARN("invalid format index %d (total %d)",
CLOG_ERR("invalid format index %d (total %d)",
initialFormat, callback->formats_count);
return 1;
}
@ -293,7 +293,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
if (NewFormat >= (UINT32) callback->formats_count)
{
DEBUG_WARN("invalid format index %d (total %d)",
CLOG_ERR("invalid format index %d (total %d)",
NewFormat, callback->formats_count);
return 1;
}
@ -340,7 +340,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
break;
default:
DEBUG_WARN("unknown MessageId=0x%x", MessageId);
CLOG_ERR("unknown MessageId=0x%x", MessageId);
error = 1;
break;
}
@ -429,7 +429,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi
if (audin->device)
{
DEBUG_WARN("existing device, abort.");
CLOG_ERR("existing device, abort.");
return;
}
@ -454,7 +454,7 @@ static BOOL audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, ADDI
if (entry(&entryPoints) != 0)
{
DEBUG_WARN("%s entry returns error.", name);
CLOG_ERR("%s entry returns error.", name);
return FALSE;
}
@ -613,7 +613,7 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
if (audin->device == NULL)
{
DEBUG_WARN("no sound device.");
CLOG_ERR("no sound device.");
}
return error;

View File

@ -27,13 +27,13 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/audin.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif /* FREERDP_AUDIN_CLIENT_MAIN_H */

View File

@ -96,7 +96,7 @@ static void* audin_opensles_thread_func(void* arg)
int rc = android_RecIn(opensles->stream, buffer.s, raw_size);
if (rc < 0)
{
DEBUG_WARN("android_RecIn %d", rc);
CLOG_ERR("android_RecIn %d", rc);
continue;
}
@ -250,7 +250,7 @@ static void audin_opensles_set_format(IAudinDevice* device,
break;
default:
DEBUG_WARN("Encoding '%d' [%08X] not supported",
CLOG_ERR("Encoding '%d' [%08X] not supported",
(format->wFormatTag),
format->wFormatTag);
return;
@ -309,7 +309,7 @@ static void audin_opensles_close(IAudinDevice* device)
* ignore duplicate requests. */
if (!opensles->stopEvent)
{
DEBUG_WARN("[ERROR] function called without matching open.");
CLOG_ERR("[ERROR] function called without matching open.");
return;
}

View File

@ -362,7 +362,7 @@ int android_RecIn(OPENSL_STREAM *p,short *buffer,int size)
e = Queue_Dequeue(p->queue);
if (!e)
{
DEBUG_WARN("[ERROR] got e=%p from queue", e);
CLOG_ERR("[ERROR] got e=%p from queue", e);
return -1;
}

View File

@ -94,7 +94,7 @@ static BOOL audin_pulse_connect(IAudinDevice* device)
if (pa_context_connect(pulse->context, NULL, 0, NULL))
{
DEBUG_WARN("pa_context_connect failed (%d)",
CLOG_ERR("pa_context_connect failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
@ -102,7 +102,7 @@ static BOOL audin_pulse_connect(IAudinDevice* device)
if (pa_threaded_mainloop_start(pulse->mainloop) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)",
CLOG_ERR("pa_threaded_mainloop_start failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
@ -113,7 +113,7 @@ static BOOL audin_pulse_connect(IAudinDevice* device)
break;
if (!PA_CONTEXT_IS_GOOD(state))
{
DEBUG_WARN("bad context state (%d)",
CLOG_ERR("bad context state (%d)",
pa_context_errno(pulse->context));
break;
}
@ -297,7 +297,7 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length
*/
if (pulse->buffer == NULL)
{
/* fprintf(stderr, "%s: ignoring input, pulse buffer not ready.\n", __func__); */
/* CLOG_ERR( "%s: ignoring input, pulse buffer not ready.\n", __func__); */
return;
}
@ -415,7 +415,7 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
&buffer_attr, PA_STREAM_ADJUST_LATENCY) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_stream_connect_playback failed (%d)",
CLOG_ERR("pa_stream_connect_playback failed (%d)",
pa_context_errno(pulse->context));
return;
}
@ -427,7 +427,7 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
break;
if (!PA_STREAM_IS_GOOD(state))
{
DEBUG_WARN("bad stream state (%d)",
CLOG_ERR("bad stream state (%d)",
pa_context_errno(pulse->context));
break;
}
@ -512,7 +512,7 @@ int freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEnt
if (!pulse->mainloop)
{
DEBUG_WARN("pa_threaded_mainloop_new failed");
CLOG_ERR("pa_threaded_mainloop_new failed");
audin_pulse_free((IAudinDevice*) pulse);
return 1;
}
@ -521,7 +521,7 @@ int freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEnt
if (!pulse->context)
{
DEBUG_WARN("pa_context_new failed");
CLOG_ERR("pa_context_new failed");
audin_pulse_free((IAudinDevice*) pulse);
return 1;
}

View File

@ -34,6 +34,7 @@
#include <freerdp/codec/audio.h>
#include <freerdp/channels/wtsvc.h>
#include <freerdp/server/audin.h>
#include <freerdp/channels/log.h>
#define MSG_SNDIN_VERSION 0x01
#define MSG_SNDIN_FORMATS 0x02
@ -385,7 +386,7 @@ static void* audin_server_thread_func(void* arg)
break;
default:
fprintf(stderr, "audin_server_thread_func: unknown MessageId %d\n", MessageId);
CLOG_ERR( "audin_server_thread_func: unknown MessageId %d\n", MessageId);
break;
}
}

View File

@ -140,7 +140,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT
}
if (num_formats * 36 != length)
DEBUG_WARN("dataLen %d not divided by 36!", length);
CLOG_ERR("dataLen %d not divided by 36!", length);
ascii = (flags & CB_ASCII_NAMES) ? TRUE : FALSE;

View File

@ -36,6 +36,7 @@
#include "cliprdr_main.h"
#include "cliprdr_format.h"
#ifdef WITH_DEBUG_CLIPRDR
static const char* const CB_MSG_TYPE_STRINGS[] =
{
"",
@ -51,6 +52,7 @@ static const char* const CB_MSG_TYPE_STRINGS[] =
"CB_LOCK_CLIPDATA"
"CB_UNLOCK_CLIPDATA"
};
#endif
CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr)
{
@ -85,7 +87,7 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
Stream_SetPosition(s, pos);
#ifdef WITH_DEBUG_CLIPRDR
printf("Cliprdr Sending (%d bytes)\n", dataLen + 8);
CLOG_DBG("Cliprdr Sending (%d bytes)\n", dataLen + 8);
winpr_HexDump(Stream_Buffer(s), dataLen + 8);
#endif
@ -99,18 +101,18 @@ static void cliprdr_process_connect(rdpSvcPlugin* plugin)
void cliprdr_print_general_capability_flags(UINT32 flags)
{
fprintf(stderr, "generalFlags (0x%08X) {\n", flags);
CLOG_ERR( "generalFlags (0x%08X) {\n", flags);
if (flags & CB_USE_LONG_FORMAT_NAMES)
fprintf(stderr, "\tCB_USE_LONG_FORMAT_NAMES\n");
CLOG_ERR( "\tCB_USE_LONG_FORMAT_NAMES\n");
if (flags & CB_STREAM_FILECLIP_ENABLED)
fprintf(stderr, "\tCB_STREAM_FILECLIP_ENABLED\n");
CLOG_ERR( "\tCB_STREAM_FILECLIP_ENABLED\n");
if (flags & CB_FILECLIP_NO_FILE_PATHS)
fprintf(stderr, "\tCB_FILECLIP_NO_FILE_PATHS\n");
CLOG_ERR( "\tCB_FILECLIP_NO_FILE_PATHS\n");
if (flags & CB_CAN_LOCK_CLIPDATA)
fprintf(stderr, "\tCB_CAN_LOCK_CLIPDATA\n");
CLOG_ERR( "\tCB_CAN_LOCK_CLIPDATA\n");
fprintf(stderr, "}\n");
CLOG_ERR( "}\n");
}
static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream* s)
@ -196,7 +198,7 @@ static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, UINT16
break;
default:
DEBUG_WARN("unknown cliprdr capability set: %d", capabilitySetType);
CLOG_ERR("unknown cliprdr capability set: %d", capabilitySetType);
break;
}
}
@ -378,7 +380,7 @@ static void cliprdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
break;
default:
DEBUG_WARN("unknown msgType %d", msgType);
CLOG_ERR("unknown msgType %d", msgType);
break;
}
}
@ -494,7 +496,7 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, wMessage* event)
break;
default:
DEBUG_WARN("unknown event type %d", GetMessageType(event->id));
CLOG_ERR("unknown event type %d", GetMessageType(event->id));
break;
}

View File

@ -23,7 +23,7 @@
#include <winpr/stream.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/utils/svc_plugin.h>
struct cliprdr_plugin
@ -45,9 +45,9 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* data_out);
CliprdrClientContext* cliprdr_get_client_interface(cliprdrPlugin* cliprdr);
#ifdef WITH_DEBUG_CLIPRDR
#define DEBUG_CLIPRDR(fmt, ...) DEBUG_CLASS(CLIPRDR, fmt, ## __VA_ARGS__)
#define DEBUG_CLIPRDR(fmt, ...) CLOG_CLASS(CLIPRDR, fmt, ## __VA_ARGS__)
#else
#define DEBUG_CLIPRDR(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_CLIPRDR(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif /* __CLIPRDR_MAIN_H */

View File

@ -25,6 +25,7 @@
#include <winpr/print.h>
#include <winpr/stream.h>
#include <freerdp/channels/log.h>
#include "cliprdr_main.h"
/**
@ -70,7 +71,7 @@ static int cliprdr_server_send_capabilities(CliprdrServerContext* context)
CLIPRDR_HEADER header;
ULONG written;
printf("CliprdrServerSendCapabilities\n");
CLOG_DBG("CliprdrServerSendCapabilities\n");
header.msgType = CB_CLIP_CAPS;
header.msgFlags = 0;
@ -111,7 +112,7 @@ static int cliprdr_server_send_monitor_ready(CliprdrServerContext* context)
CLIPRDR_HEADER header;
ULONG written;
printf("CliprdrServerSendMonitorReady\n");
CLOG_DBG("CliprdrServerSendMonitorReady\n");
header.msgType = CB_MONITOR_READY;
header.msgFlags = 0;
@ -139,7 +140,7 @@ static int cliprdr_server_send_format_list_response(CliprdrServerContext* contex
CLIPRDR_HEADER header;
ULONG written;
printf("CliprdrServerSendFormatListResponse\n");
CLOG_DBG("CliprdrServerSendFormatListResponse\n");
header.msgType = CB_FORMAT_LIST_RESPONSE;
header.msgFlags = CB_RESPONSE_OK;
@ -207,7 +208,7 @@ static int cliprdr_server_receive_temporary_directory(CliprdrServerContext* cont
ConvertFromUnicode(CP_UTF8, 0, wszTempDir, -1,
&(context->priv->ClientTemporaryDirectory), 0, NULL, NULL);
printf("ClientTemporaryDirectory: %s\n", context->priv->ClientTemporaryDirectory);
CLOG_DBG("ClientTemporaryDirectory: %s\n", context->priv->ClientTemporaryDirectory);
return 0;
}
@ -252,7 +253,7 @@ static int cliprdr_server_receive_long_format_list(CliprdrServerContext* context
int length;
int position;
printf("%s\n", __FUNCTION__);
CLOG_DBG("%s\n", __FUNCTION__);
position = Stream_GetPosition(s);
Stream_SetPosition(s, Stream_Length(s));
@ -305,7 +306,7 @@ static int cliprdr_server_receive_long_format_list(CliprdrServerContext* context
for (i = 0; i < context->priv->ClientFormatNameCount; i++)
{
printf("Format %d: Id: 0x%04X Name: %s Length: %d\n", i,
CLOG_DBG("Format %d: Id: 0x%04X Name: %s Length: %d\n", i,
context->priv->ClientFormatNames[i].id,
context->priv->ClientFormatNames[i].name,
context->priv->ClientFormatNames[i].length);
@ -316,7 +317,7 @@ static int cliprdr_server_receive_long_format_list(CliprdrServerContext* context
static int cliprdr_server_receive_short_format_list(CliprdrServerContext* context, wStream* s, CLIPRDR_HEADER* header)
{
printf("%s: unimplemented\n", __FUNCTION__);
CLOG_DBG("%s: unimplemented\n", __FUNCTION__);
return 0;
}
@ -340,7 +341,7 @@ static int cliprdr_server_receive_format_list(CliprdrServerContext* context, wSt
static int cliprdr_server_receive_pdu(CliprdrServerContext* context, wStream* s, CLIPRDR_HEADER* header)
{
printf("CliprdrServerReceivePdu: msgType: %d msgFlags: 0x%08X dataLen: %d\n",
CLOG_DBG("CliprdrServerReceivePdu: msgType: %d msgFlags: 0x%08X dataLen: %d\n",
header->msgType, header->msgFlags, header->dataLen);
switch (header->msgType)
@ -379,7 +380,7 @@ static int cliprdr_server_receive_pdu(CliprdrServerContext* context, wStream* s,
break;
default:
printf("Unexpected clipboard PDU type: %d\n", header->msgType);
CLOG_DBG("Unexpected clipboard PDU type: %d\n", header->msgType);
break;
}

View File

@ -101,7 +101,7 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback
Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */
//fprintf(stderr, "NumMonitors: %d\n", NumMonitors);
//CLOG_ERR( "NumMonitors: %d\n", NumMonitors);
for (index = 0; index < NumMonitors; index++)
{
@ -125,14 +125,14 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback
Stream_Write_UINT32(s, Monitors[index].DeviceScaleFactor); /* DeviceScaleFactor (4 bytes) */
#if 0
fprintf(stderr, "\t: Flags: 0x%04X\n", Monitors[index].Flags);
fprintf(stderr, "\t: Left: %d\n", Monitors[index].Left);
fprintf(stderr, "\t: Top: %d\n", Monitors[index].Top);
fprintf(stderr, "\t: Width: %d\n", Monitors[index].Width);
fprintf(stderr, "\t: Height: %d\n", Monitors[index].Height);
fprintf(stderr, "\t: PhysicalWidth: %d\n", Monitors[index].PhysicalWidth);
fprintf(stderr, "\t: PhysicalHeight: %d\n", Monitors[index].PhysicalHeight);
fprintf(stderr, "\t: Orientation: %d\n", Monitors[index].Orientation);
CLOG_ERR( "\t: Flags: 0x%04X\n", Monitors[index].Flags);
CLOG_ERR( "\t: Left: %d\n", Monitors[index].Left);
CLOG_ERR( "\t: Top: %d\n", Monitors[index].Top);
CLOG_ERR( "\t: Width: %d\n", Monitors[index].Width);
CLOG_ERR( "\t: Height: %d\n", Monitors[index].Height);
CLOG_ERR( "\t: PhysicalWidth: %d\n", Monitors[index].PhysicalWidth);
CLOG_ERR( "\t: PhysicalHeight: %d\n", Monitors[index].PhysicalHeight);
CLOG_ERR( "\t: Orientation: %d\n", Monitors[index].Orientation);
#endif
}
@ -158,8 +158,8 @@ int disp_recv_display_control_caps_pdu(DISP_CHANNEL_CALLBACK* callback, wStream*
Stream_Read_UINT32(s, disp->MaxMonitorAreaFactorA); /* MaxMonitorAreaFactorA (4 bytes) */
Stream_Read_UINT32(s, disp->MaxMonitorAreaFactorB); /* MaxMonitorAreaFactorB (4 bytes) */
//fprintf(stderr, "DisplayControlCapsPdu: MaxNumMonitors: %d MaxMonitorAreaFactorA: %d MaxMonitorAreaFactorB: %d\n",
// disp->MaxNumMonitors, disp->MaxMonitorAreaFactorA, disp->MaxMonitorAreaFactorB);
//CLOG_ERR( "DisplayControlCapsPdu: MaxNumMonitors: %d MaxMonitorWidth: %d MaxMonitorHeight: %d\n",
// disp->MaxNumMonitors, disp->MaxMonitorWidth, disp->MaxMonitorHeight);
return 0;
}
@ -175,7 +175,7 @@ int disp_recv_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
Stream_Read_UINT32(s, type); /* Type (4 bytes) */
Stream_Read_UINT32(s, length); /* Length (4 bytes) */
//fprintf(stderr, "Type: %d Length: %d\n", type, length);
//CLOG_ERR( "Type: %d Length: %d\n", type, length);
switch (type)
{

View File

@ -27,7 +27,7 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/disp.h>

View File

@ -130,7 +130,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
if (status != CHANNEL_RC_OK)
{
drdynvc->channel_error = status;
DEBUG_WARN("VirtualChannelWrite failed %d", status);
CLOG_ERR("VirtualChannelWrite failed %d", status);
return 1;
}
@ -145,7 +145,7 @@ int drdynvc_push_event(drdynvcPlugin* drdynvc, wMessage* event)
if (status != CHANNEL_RC_OK)
{
DEBUG_WARN("pVirtualChannelEventPush failed %d", status);
CLOG_ERR("pVirtualChannelEventPush failed %d", status);
return 1;
}
@ -165,7 +165,7 @@ static int drdynvc_send_capability_response(drdynvcPlugin* drdynvc)
if (status != CHANNEL_RC_OK)
{
DEBUG_WARN("VirtualChannelWrite failed %d", status);
CLOG_ERR("VirtualChannelWrite failed %d", status);
return 1;
}
@ -270,7 +270,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
if (status != CHANNEL_RC_OK)
{
DEBUG_WARN("VirtualChannelWrite failed %d", status);
CLOG_ERR("VirtualChannelWrite failed %d", status);
return 1;
}
@ -329,7 +329,7 @@ static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbC
if (error != CHANNEL_RC_OK)
{
DEBUG_WARN("VirtualChannelWrite failed %d", error);
CLOG_ERR("VirtualChannelWrite failed %d", error);
return 1;
}
@ -376,7 +376,7 @@ static void drdynvc_process_receive(rdpSvcPlugin* plugin, wStream* s)
break;
default:
DEBUG_WARN("unknown drdynvc cmd 0x%x", Cmd);
CLOG_ERR("unknown drdynvc cmd 0x%x", Cmd);
break;
}
}

View File

@ -26,12 +26,12 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif

View File

@ -71,7 +71,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
}
else
{
DEBUG_WARN("Maximum DVC listener number reached.");
CLOG_ERR("Maximum DVC listener number reached.");
return 1;
}
}
@ -89,7 +89,7 @@ static int dvcman_push_event(IWTSVirtualChannelManager* pChannelMgr, wMessage* p
}
else
{
DEBUG_WARN("event_type %d push failed.", GetMessageType(pEvent->id));
CLOG_ERR("event_type %d push failed.", GetMessageType(pEvent->id));
}
return status;
@ -108,7 +108,7 @@ static int dvcman_register_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const cha
}
else
{
DEBUG_WARN("Maximum DVC plugin number reached.");
CLOG_ERR("Maximum DVC plugin number reached.");
return 1;
}
}
@ -218,7 +218,7 @@ int dvcman_load_addin(IWTSVirtualChannelManager* pChannelMgr, ADDIN_ARGV* args,
DVCMAN_ENTRY_POINTS entryPoints;
PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL;
fprintf(stderr, "Loading Dynamic Virtual Channel %s\n", args->argv[0]);
CLOG_ERR( "Loading Dynamic Virtual Channel %s\n", args->argv[0]);
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY) freerdp_load_channel_addin_entry(args->argv[0],
NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
@ -388,7 +388,7 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 Channel
}
else
{
DEBUG_WARN("channel rejected by plugin");
CLOG_ERR("channel rejected by plugin");
free(channel);
return 1;
@ -409,7 +409,7 @@ int dvcman_open_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId
if (!channel)
{
DEBUG_WARN("ChannelId %d not found!", ChannelId);
CLOG_ERR("ChannelId %d not found!", ChannelId);
return 1;
}
@ -434,7 +434,7 @@ int dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelI
if (!channel)
{
DEBUG_WARN("ChannelId %d not found!", ChannelId);
CLOG_ERR("ChannelId %d not found!", ChannelId);
return 1;
}
@ -468,7 +468,7 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UI
if (!channel)
{
DEBUG_WARN("ChannelId %d not found!", ChannelId);
CLOG_ERR("ChannelId %d not found!", ChannelId);
return 1;
}
@ -476,6 +476,7 @@ int dvcman_receive_channel_data_first(IWTSVirtualChannelManager* pChannelMgr, UI
Stream_Release(channel->dvc_data);
channel->dvc_data = StreamPool_Take(channel->dvcman->pool, length);
channel->dvc_data_length = length;
return 0;
}
@ -491,7 +492,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C
if (!channel)
{
DEBUG_WARN("ChannelId %d not found!", ChannelId);
CLOG_ERR("ChannelId %d not found!", ChannelId);
return 1;
}
@ -500,7 +501,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C
/* Fragmented data */
if (Stream_GetPosition(channel->dvc_data) + dataSize > (UINT32) Stream_Length(channel->dvc_data))
{
DEBUG_WARN("data exceeding declared length!");
CLOG_ERR("data exceeding declared length!");
Stream_Release(channel->dvc_data);
channel->dvc_data = NULL;
return 1;
@ -508,7 +509,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C
Stream_Write(channel->dvc_data, Stream_Pointer(data), dataSize);
if (((size_t) Stream_GetPosition(channel->dvc_data)) >= Stream_Length(channel->dvc_data))
if (((size_t) Stream_GetPosition(channel->dvc_data)) >= channel->dvc_data_length)
{
Stream_SealLength(channel->dvc_data);
Stream_SetPosition(channel->dvc_data, 0);

View File

@ -82,6 +82,7 @@ struct _DVCMAN_CHANNEL
IWTSVirtualChannelCallback* channel_callback;
wStream* dvc_data;
UINT32 dvc_data_length;
CRITICAL_SECTION lock;
};
typedef struct _DVCMAN_CHANNEL DVCMAN_CHANNEL;

View File

@ -49,7 +49,14 @@
#endif
#ifdef HAVE_FCNTL_H
#define __USE_GNU /* for O_PATH */
#include <fcntl.h>
#undef __USE_GNU
#endif
#ifdef _WIN32
#pragma comment(lib, "Shlwapi.lib")
#include <Shlwapi.h>
#endif
#include "drive_file.h"
@ -187,6 +194,11 @@ static BOOL drive_file_init(DRIVE_FILE* file, UINT32 DesiredAccess, UINT32 Creat
if (STAT(file->fullpath, &st) == 0)
{
file->is_dir = (S_ISDIR(st.st_mode) ? TRUE : FALSE);
if (!file->is_dir && !S_ISREG(st.st_mode))
{
file->err = EPERM;
return TRUE;
}
#ifndef WIN32
if (st.st_size > (unsigned long) 0x07FFFFFFF)
largeFile = TRUE;
@ -301,6 +313,25 @@ DRIVE_FILE* drive_file_new(const char* base_path, const char* path, UINT32 id,
return NULL;
}
#if defined(__linux__) && defined(O_PATH)
if (file->fd < 0 && file->err == EACCES)
{
/**
* We have no access permissions for the file or directory but if the
* peer is only interested in reading the object's attributes we can try
* to obtain a file descriptor who's only purpose is to perform
* operations that act purely at the file descriptor level.
* See open(2)
**/
{
if ((file->fd = OPEN(file->fullpath, O_PATH)) >= 0)
{
file->err = 0;
}
}
}
#endif
return file;
}
@ -425,6 +456,29 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
return TRUE;
}
int dir_empty(const char *path)
{
#ifdef _WIN32
return PathIsDirectoryEmptyA(path);
#else
struct dirent *dp;
int empty = 1;
DIR *dir = opendir(path);
if (dir == NULL) //Not a directory or doesn't exist
return 1;
while ((dp = readdir(dir)) != NULL) {
if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
continue; /* Skip . and .. */
empty = 0;
break;
}
closedir(dir);
return empty;
#endif
}
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input)
{
char* s = NULL;
@ -433,7 +487,11 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
int status;
char* fullpath;
struct STAT st;
#if defined(__linux__) && !defined(ANDROID)
struct timespec tv[2];
#else
struct timeval tv[2];
#endif
UINT64 LastWriteTime;
UINT32 FileAttributes;
UINT32 FileNameLength;
@ -454,14 +512,20 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
return FALSE;
tv[0].tv_sec = st.st_atime;
tv[0].tv_usec = 0;
tv[1].tv_sec = (LastWriteTime > 0 ? FILE_TIME_RDP_TO_SYSTEM(LastWriteTime) : st.st_mtime);
tv[1].tv_usec = 0;
#ifndef WIN32
/* TODO on win32 */
#ifdef ANDROID
tv[0].tv_usec = 0;
tv[1].tv_usec = 0;
utimes(file->fullpath, tv);
#elif defined (__linux__)
tv[0].tv_nsec = 0;
tv[1].tv_nsec = 0;
futimens(file->fd, tv);
#else
tv[0].tv_usec = 0;
tv[1].tv_usec = 0;
futimes(file->fd, tv);
#endif
@ -492,6 +556,9 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
case FileDispositionInformation:
/* http://msdn.microsoft.com/en-us/library/cc232098.aspx */
/* http://msdn.microsoft.com/en-us/library/cc241371.aspx */
if (file->is_dir && !dir_empty(file->fullpath))
break;
if (Length)
Stream_Read_UINT8(input, file->delete_pending);
else

View File

@ -117,6 +117,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input);
BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,
const char* path, wStream* output);
int dir_empty(const char *path);
extern UINT sys_code_page;

View File

@ -346,6 +346,9 @@ static void drive_process_irp_set_information(DRIVE_DEVICE* drive, IRP* irp)
}
if (file->is_dir && !dir_empty(file->fullpath))
irp->IoStatus = STATUS_DIRECTORY_NOT_EMPTY;
Stream_Write_UINT32(irp->output, Length);
irp->Complete(irp);

View File

@ -27,12 +27,12 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif /* __ECHO_MAIN_H */

View File

@ -29,6 +29,7 @@
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <winpr/sysinfo.h>
#include <freerdp/server/echo.h>
@ -166,7 +167,7 @@ static void* echo_server_thread_func(void* arg)
break;
}
IFCALL(echo->context.Response, &echo->context, (PCHAR) Stream_Buffer(s), BytesReturned);
IFCALL(echo->context.Response, &echo->context, (BYTE *) Stream_Buffer(s), BytesReturned);
}
Stream_Free(s, TRUE);

View File

@ -17,6 +17,8 @@
define_channel_client("encomsp")
include_directories(..)
set(${MODULE_PREFIX}_SRCS
encomsp_main.c
encomsp_main.h)

View File

@ -24,10 +24,50 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/encomsp.h>
#include "encomsp_main.h"
static int encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
if (Stream_GetRemainingLength(s) < ENCOMSP_ORDER_HEADER_SIZE)
return -1;
Stream_Read_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Read_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
static int encomsp_write_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
Stream_Write_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Write_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
static int encomsp_read_unicode_string(wStream* s, ENCOMSP_UNICODE_STRING* str)
{
ZeroMemory(str, sizeof(ENCOMSP_UNICODE_STRING));
if (Stream_GetRemainingLength(s) < 2)
return -1;
Stream_Read_UINT16(s, str->cchString); /* cchString (2 bytes) */
if (str->cchString > 1024)
return -1;
if (Stream_GetRemainingLength(s) < (size_t) (str->cchString * 2))
return -1;
Stream_Read(s, &(str->wString), (str->cchString * 2)); /* String (variable) */
return 1;
}
EncomspClientContext* encomsp_get_client_interface(encomspPlugin* encomsp)
{
EncomspClientContext* pInterface;
@ -59,46 +99,7 @@ int encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s)
return 1;
}
int encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
if (Stream_GetRemainingLength(s) < ENCOMSP_ORDER_HEADER_SIZE)
return -1;
Stream_Read_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Read_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
int encomsp_write_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
Stream_Write_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Write_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
int encomsp_read_unicode_string(wStream* s, ENCOMSP_UNICODE_STRING* str)
{
ZeroMemory(str, sizeof(ENCOMSP_UNICODE_STRING));
if (Stream_GetRemainingLength(s) < 2)
return -1;
Stream_Read_UINT16(s, str->cchString); /* cchString (2 bytes) */
if (str->cchString > 1024)
return -1;
if (Stream_GetRemainingLength(s) < (str->cchString * 2))
return -1;
Stream_Read(s, &(str->wString), (str->cchString * 2)); /* String (variable) */
return 1;
}
int encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -125,7 +126,7 @@ int encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -139,7 +140,7 @@ int encomsp_recv_filter_updated_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_
return 1;
}
int encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -170,7 +171,7 @@ int encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream* s, ENC
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -184,7 +185,7 @@ int encomsp_recv_application_created_pdu(encomspPlugin* encomsp, wStream* s, ENC
return 1;
}
int encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -211,7 +212,7 @@ int encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream* s, ENC
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -225,7 +226,7 @@ int encomsp_recv_application_removed_pdu(encomspPlugin* encomsp, wStream* s, ENC
return 1;
}
int encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -257,7 +258,7 @@ int encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -271,7 +272,7 @@ int encomsp_recv_window_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_
return 1;
}
int encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -298,7 +299,7 @@ int encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -312,7 +313,7 @@ int encomsp_recv_window_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_
return 1;
}
int encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -339,7 +340,7 @@ int encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORD
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -353,7 +354,7 @@ int encomsp_recv_show_window_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORD
return 1;
}
int encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -385,7 +386,7 @@ int encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream* s, ENC
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -399,7 +400,7 @@ int encomsp_recv_participant_created_pdu(encomspPlugin* encomsp, wStream* s, ENC
return 1;
}
int encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -428,7 +429,7 @@ int encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream* s, ENC
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -442,7 +443,7 @@ int encomsp_recv_participant_removed_pdu(encomspPlugin* encomsp, wStream* s, ENC
return 1;
}
int encomsp_recv_change_participant_control_level_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_change_participant_control_level_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -470,7 +471,7 @@ int encomsp_recv_change_participant_control_level_pdu(encomspPlugin* encomsp, wS
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -484,7 +485,7 @@ int encomsp_recv_change_participant_control_level_pdu(encomspPlugin* encomsp, wS
return 1;
}
int encomsp_send_change_participant_control_level_pdu(EncomspClientContext* context, ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
static int encomsp_send_change_participant_control_level_pdu(EncomspClientContext* context, ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
{
wStream* s;
encomspPlugin* encomsp;
@ -508,7 +509,7 @@ int encomsp_send_change_participant_control_level_pdu(EncomspClientContext* cont
return 1;
}
int encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -530,7 +531,7 @@ int encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStream* s,
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -544,7 +545,7 @@ int encomsp_recv_graphics_stream_paused_pdu(encomspPlugin* encomsp, wStream* s,
return 1;
}
int encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
static int encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
EncomspClientContext* context;
@ -566,7 +567,7 @@ int encomsp_recv_graphics_stream_resumed_pdu(encomspPlugin* encomsp, wStream* s,
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
if (Stream_GetRemainingLength(s) < (size_t) ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
@ -590,7 +591,7 @@ static int encomsp_process_receive(encomspPlugin* encomsp, wStream* s)
if (encomsp_read_header(s, &header) < 0)
return -1;
//printf("EncomspReceive: Type: %d Length: %d\n", header.Type, header.Length);
//CLOG_DBG("EncomspReceive: Type: %d Length: %d\n", header.Type, header.Length);
switch (header.Type)
{
@ -722,7 +723,7 @@ int encomsp_send(encomspPlugin* encomsp, wStream* s)
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
fprintf(stderr, "encomsp_send: VirtualChannelWrite failed %d\n", status);
CLOG_ERR( "encomsp_send: VirtualChannelWrite failed %d\n", status);
}
return status;
@ -754,7 +755,7 @@ static void encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp,
{
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{
fprintf(stderr, "encomsp_plugin_process_received: read error\n");
CLOG_ERR( "encomsp_plugin_process_received: read error\n");
}
encomsp->data_in = NULL;
@ -774,7 +775,7 @@ static VOID VCAPITYPE encomsp_virtual_channel_open_event(DWORD openHandle, UINT
if (!encomsp)
{
fprintf(stderr, "encomsp_virtual_channel_open_event: error no match\n");
CLOG_ERR( "encomsp_virtual_channel_open_event: error no match\n");
return;
}
@ -834,7 +835,7 @@ static void encomsp_virtual_channel_event_connected(encomspPlugin* encomsp, LPVO
if (status != CHANNEL_RC_OK)
{
fprintf(stderr, "encomsp_virtual_channel_event_connected: open failed: status: %d\n", status);
CLOG_ERR( "encomsp_virtual_channel_event_connected: open failed: status: %d\n", status);
return;
}
@ -872,7 +873,7 @@ static VOID VCAPITYPE encomsp_virtual_channel_init_event(LPVOID pInitHandle, UIN
if (!encomsp)
{
fprintf(stderr, "encomsp_virtual_channel_init_event: error no match\n");
CLOG_ERR( "encomsp_virtual_channel_init_event: error no match\n");
return;
}

View File

@ -17,6 +17,8 @@
define_channel_server("encomsp")
include_directories(..)
set(${MODULE_PREFIX}_SRCS
encomsp_main.c
encomsp_main.h)

View File

@ -27,9 +27,113 @@
#include "encomsp_main.h"
static int encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
if (Stream_GetRemainingLength(s) < ENCOMSP_ORDER_HEADER_SIZE)
return -1;
Stream_Read_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Read_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
#if 0
static int encomsp_write_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
{
Stream_Write_UINT16(s, header->Type); /* Type (2 bytes) */
Stream_Write_UINT16(s, header->Length); /* Length (2 bytes) */
return 1;
}
static int encomsp_read_unicode_string(wStream* s, ENCOMSP_UNICODE_STRING* str)
{
ZeroMemory(str, sizeof(ENCOMSP_UNICODE_STRING));
if (Stream_GetRemainingLength(s) < 2)
return -1;
Stream_Read_UINT16(s, str->cchString); /* cchString (2 bytes) */
if (str->cchString > 1024)
return -1;
if (Stream_GetRemainingLength(s) < (str->cchString * 2))
return -1;
Stream_Read(s, &(str->wString), (str->cchString * 2)); /* String (variable) */
return 1;
}
#endif
static int encomsp_recv_change_participant_control_level_pdu(EncomspServerContext* context, wStream* s, ENCOMSP_ORDER_HEADER* header)
{
int beg, end;
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU pdu;
beg = ((int) Stream_GetPosition(s)) - ENCOMSP_ORDER_HEADER_SIZE;
CopyMemory(&pdu, header, sizeof(ENCOMSP_ORDER_HEADER));
if (Stream_GetRemainingLength(s) < 6)
return -1;
Stream_Read_UINT16(s, pdu.Flags); /* Flags (2 bytes) */
Stream_Read_UINT32(s, pdu.ParticipantId); /* ParticipantId (4 bytes) */
end = (int) Stream_GetPosition(s);
if ((beg + header->Length) < end)
return -1;
if ((beg + header->Length) > end)
{
if (Stream_GetRemainingLength(s) < ((beg + header->Length) - end))
return -1;
Stream_SetPosition(s, (beg + header->Length));
}
if (context->ChangeParticipantControlLevel)
{
return context->ChangeParticipantControlLevel(context, &pdu);
}
return 1;
}
static int encomsp_server_receive_pdu(EncomspServerContext* context, wStream* s)
{
return 0;
int status = 1;
ENCOMSP_ORDER_HEADER header;
while (Stream_GetRemainingLength(s) > 0)
{
if (encomsp_read_header(s, &header) < 0)
return -1;
printf("EncomspReceive: Type: %d Length: %d\n", header.Type, header.Length);
switch (header.Type)
{
case ODTYPE_PARTICIPANT_CTRL_CHANGED:
status = encomsp_recv_change_participant_control_level_pdu(context, s, &header);
break;
default:
status = -1;
break;
}
if (status < 0)
return -1;
}
return status;
}
static void* encomsp_server_thread(void* arg)
@ -41,6 +145,7 @@ static void* encomsp_server_thread(void* arg)
HANDLE events[8];
HANDLE ChannelEvent;
DWORD BytesReturned;
ENCOMSP_ORDER_HEADER* header;
EncomspServerContext* context;
context = (EncomspServerContext*) arg;
@ -82,9 +187,17 @@ static void* encomsp_server_thread(void* arg)
break;
}
if (0)
if (Stream_GetPosition(s) >= ENCOMSP_ORDER_HEADER_SIZE)
{
encomsp_server_receive_pdu(context, s);
header = (ENCOMSP_ORDER_HEADER*) Stream_Buffer(s);
if (header->Length >= Stream_GetPosition(s))
{
Stream_SealLength(s);
Stream_SetPosition(s, 0);
encomsp_server_receive_pdu(context, s);
Stream_SetPosition(s, 0);
}
}
}

View File

@ -23,9 +23,9 @@
rdpPrinterDriver* printer_win_get_driver(void);
#ifdef WITH_DEBUG_WINPR
#define DEBUG_WINPR(fmt, ...) DEBUG_CLASS(WINPR, fmt, ## __VA_ARGS__)
#define DEBUG_WINPR(fmt, ...) CLOG_CLASS(WINPR, fmt, ## __VA_ARGS__)
#else
#define DEBUG_WINPR(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_WINPR(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif

View File

@ -28,6 +28,7 @@
#include <winpr/crt.h>
#include <freerdp/utils/rail.h>
#include <freerdp/channels/log.h>
#include "rail_orders.h"
@ -522,7 +523,7 @@ BOOL rail_order_recv(railPlugin* rail, wStream* s)
}
default:
fprintf(stderr, "Unknown RAIL PDU order reveived.");
CLOG_ERR( "Unknown RAIL PDU order reveived.");
break;
}

View File

@ -32,6 +32,7 @@
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/log.h>
#include "rdpdr_main.h"
@ -122,7 +123,7 @@ BOOL devman_load_device_service(DEVMAN* devman, RDPDR_DEVICE* device)
if (!ServiceName)
return FALSE;
fprintf(stderr, "Loading device service %s (static)\n", ServiceName);
CLOG_ERR( "Loading device service %s (static)\n", ServiceName);
entry = (PDEVICE_SERVICE_ENTRY) freerdp_load_channel_addin_entry(ServiceName, NULL, "DeviceServiceEntry", 0);
if (!entry)

View File

@ -31,6 +31,7 @@
#include <freerdp/types.h>
#include <freerdp/constants.h>
#include <freerdp/channels/log.h>
#include <freerdp/channels/rdpdr.h>
#ifdef _WIN32
@ -451,7 +452,7 @@ static void* drive_hotplug_thread_func(void* arg)
if (mfd < 0)
{
fprintf(stderr, "ERROR: Unable to open /proc/mounts.");
CLOG_ERR( "ERROR: Unable to open /proc/mounts.");
return NULL;
}
@ -662,7 +663,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
count++;
fprintf(stderr, "registered device #%d: %s (type=%d id=%d)\n",
CLOG_ERR( "registered device #%d: %s (type=%d id=%d)\n",
count, device->name, device->type, device->id);
}
}
@ -845,7 +846,7 @@ int rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
fprintf(stderr, "rdpdr_send: VirtualChannelWrite failed %d\n", status);
CLOG_ERR( "rdpdr_send: VirtualChannelWrite failed %d\n", status);
}
return status;
@ -883,7 +884,7 @@ static void rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
{
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{
fprintf(stderr, "svc_plugin_process_received: read error\n");
CLOG_ERR( "svc_plugin_process_received: read error\n");
}
rdpdr->data_in = NULL;
@ -903,7 +904,7 @@ static VOID VCAPITYPE rdpdr_virtual_channel_open_event(DWORD openHandle, UINT ev
if (!rdpdr)
{
fprintf(stderr, "rdpdr_virtual_channel_open_event: error no match\n");
CLOG_ERR( "rdpdr_virtual_channel_open_event: error no match\n");
return;
}
@ -963,7 +964,7 @@ static void rdpdr_virtual_channel_event_connected(rdpdrPlugin* rdpdr, LPVOID pDa
if (status != CHANNEL_RC_OK)
{
fprintf(stderr, "rdpdr_virtual_channel_event_connected: open failed: status: %d\n", status);
CLOG_ERR( "rdpdr_virtual_channel_event_connected: open failed: status: %d\n", status);
return;
}
@ -1009,7 +1010,7 @@ static VOID VCAPITYPE rdpdr_virtual_channel_init_event(LPVOID pInitHandle, UINT
if (!rdpdr)
{
fprintf(stderr, "rdpdr_virtual_channel_init_event: error no match\n");
CLOG_ERR( "rdpdr_virtual_channel_init_event: error no match\n");
return;
}

View File

@ -25,6 +25,7 @@
#include <winpr/print.h>
#include <winpr/stream.h>
#include <freerdp/channels/log.h>
#include "rdpdr_main.h"
static UINT32 g_ClientId = 0;
@ -36,7 +37,7 @@ static int rdpdr_server_send_announce_request(RdpdrServerContext* context)
RDPDR_HEADER header;
ULONG written;
printf("RdpdrServerSendAnnounceRequest\n");
CLOG_DBG("RdpdrServerSendAnnounceRequest\n");
header.Component = RDPDR_CTYP_CORE;
header.PacketId = PAKID_CORE_SERVER_ANNOUNCE;
@ -69,7 +70,7 @@ static int rdpdr_server_receive_announce_response(RdpdrServerContext* context, w
Stream_Read_UINT16(s, VersionMinor); /* VersionMinor (2 bytes) */
Stream_Read_UINT32(s, ClientId); /* ClientId (4 bytes) */
printf("Client Announce Response: VersionMajor: 0x%04X VersionMinor: 0x%04X ClientId: 0x%04X\n",
CLOG_DBG("Client Announce Response: VersionMajor: 0x%04X VersionMinor: 0x%04X ClientId: 0x%04X\n",
VersionMajor, VersionMinor, ClientId);
context->priv->ClientId = ClientId;
@ -109,7 +110,7 @@ static int rdpdr_server_receive_client_name_request(RdpdrServerContext* context,
Stream_Seek(s, ComputerNameLen);
printf("ClientComputerName: %s\n", context->priv->ClientComputerName);
CLOG_DBG("ClientComputerName: %s\n", context->priv->ClientComputerName);
return 0;
}
@ -298,7 +299,7 @@ static int rdpdr_server_send_core_capability_request(RdpdrServerContext* context
UINT16 numCapabilities;
ULONG written;
printf("RdpdrServerSendCoreCapabilityRequest\n");
CLOG_DBG("RdpdrServerSendCoreCapabilityRequest\n");
header.Component = RDPDR_CTYP_CORE;
header.PacketId = PAKID_CORE_SERVER_CAPABILITY;
@ -364,7 +365,7 @@ static int rdpdr_server_receive_core_capability_response(RdpdrServerContext* con
break;
default:
printf("Unknown capabilityType %d\n", capabilityHeader.CapabilityType);
CLOG_DBG("Unknown capabilityType %d\n", capabilityHeader.CapabilityType);
Stream_Seek(s, capabilityHeader.CapabilityLength - RDPDR_CAPABILITY_HEADER_LENGTH);
break;
}
@ -380,7 +381,7 @@ static int rdpdr_server_send_client_id_confirm(RdpdrServerContext* context)
RDPDR_HEADER header;
ULONG written;
printf("RdpdrServerSendClientIdConfirm\n");
CLOG_DBG("RdpdrServerSendClientIdConfirm\n");
header.Component = RDPDR_CTYP_CORE;
header.PacketId = PAKID_CORE_CLIENTID_CONFIRM;
@ -416,7 +417,7 @@ static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext*
Stream_Read_UINT32(s, DeviceCount); /* DeviceCount (4 bytes) */
printf("%s: DeviceCount: %d\n", __FUNCTION__, DeviceCount);
CLOG_DBG("%s: DeviceCount: %d\n", __FUNCTION__, DeviceCount);
for (i = 0; i < DeviceCount; i++)
{
@ -425,7 +426,7 @@ static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext*
Stream_Read(s, PreferredDosName, 8); /* PreferredDosName (8 bytes) */
Stream_Read_UINT32(s, DeviceDataLength); /* DeviceDataLength (4 bytes) */
printf("Device %d Name: %s Id: 0x%04X DataLength: %d\n",
CLOG_DBG("Device %d Name: %s Id: 0x%04X DataLength: %d\n",
i, PreferredDosName, DeviceId, DeviceDataLength);
switch (DeviceId)
@ -462,7 +463,7 @@ static int rdpdr_server_send_user_logged_on(RdpdrServerContext* context)
RDPDR_HEADER header;
ULONG written;
printf("%s\n", __FUNCTION__);
CLOG_DBG("%s\n", __FUNCTION__);
header.Component = RDPDR_CTYP_CORE;
header.PacketId = PAKID_CORE_USER_LOGGEDON;
@ -483,7 +484,7 @@ static int rdpdr_server_send_user_logged_on(RdpdrServerContext* context)
static int rdpdr_server_receive_pdu(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header)
{
printf("RdpdrServerReceivePdu: Component: 0x%04X PacketId: 0x%04X\n",
CLOG_DBG("RdpdrServerReceivePdu: Component: 0x%04X PacketId: 0x%04X\n",
header->Component, header->PacketId);
winpr_HexDump(Stream_Buffer(s), Stream_Length(s));
@ -545,7 +546,7 @@ static int rdpdr_server_receive_pdu(RdpdrServerContext* context, wStream* s, RDP
}
else
{
printf("Unknown RDPDR_HEADER.Component: 0x%04X\n", header->Component);
CLOG_DBG("Unknown RDPDR_HEADER.Component: 0x%04X\n", header->Component);
return -1;
}

View File

@ -201,7 +201,7 @@ int rdpei_send_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s, UINT16 eventId,
status = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s), Stream_Buffer(s), NULL);
#ifdef WITH_DEBUG_RDPEI
fprintf(stderr, "rdpei_send_pdu: eventId: %d (%s) length: %d status: %d\n",
CLOG_ERR( "rdpei_send_pdu: eventId: %d (%s) length: %d status: %d\n",
eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength, status);
#endif
@ -239,17 +239,17 @@ int rdpei_send_cs_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback)
void rdpei_print_contact_flags(UINT32 contactFlags)
{
if (contactFlags & CONTACT_FLAG_DOWN)
printf(" CONTACT_FLAG_DOWN");
CLOG_DBG(" CONTACT_FLAG_DOWN");
if (contactFlags & CONTACT_FLAG_UPDATE)
printf(" CONTACT_FLAG_UPDATE");
CLOG_DBG(" CONTACT_FLAG_UPDATE");
if (contactFlags & CONTACT_FLAG_UP)
printf(" CONTACT_FLAG_UP");
CLOG_DBG(" CONTACT_FLAG_UP");
if (contactFlags & CONTACT_FLAG_INRANGE)
printf(" CONTACT_FLAG_INRANGE");
CLOG_DBG(" CONTACT_FLAG_INRANGE");
if (contactFlags & CONTACT_FLAG_INCONTACT)
printf(" CONTACT_FLAG_INCONTACT");
CLOG_DBG(" CONTACT_FLAG_INCONTACT");
if (contactFlags & CONTACT_FLAG_CANCELED)
printf(" CONTACT_FLAG_CANCELED");
CLOG_DBG(" CONTACT_FLAG_CANCELED");
}
int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
@ -259,8 +259,8 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
RDPINPUT_CONTACT_DATA* contact;
#ifdef WITH_DEBUG_RDPEI
printf("contactCount: %d\n", frame->contactCount);
printf("frameOffset: 0x%08X\n", (UINT32) frame->frameOffset);
CLOG_DBG("contactCount: %d\n", frame->contactCount);
CLOG_DBG("frameOffset: 0x%08X\n", (UINT32) frame->frameOffset);
#endif
rdpei_write_2byte_unsigned(s, frame->contactCount); /* contactCount (TWO_BYTE_UNSIGNED_INTEGER) */
@ -284,13 +284,13 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
contact->contactRectBottom = contact->y + rectSize;
#ifdef WITH_DEBUG_RDPEI
printf("contact[%d].contactId: %d\n", index, contact->contactId);
printf("contact[%d].fieldsPresent: %d\n", index, contact->fieldsPresent);
printf("contact[%d].x: %d\n", index, contact->x);
printf("contact[%d].y: %d\n", index, contact->y);
printf("contact[%d].contactFlags: 0x%04X", index, contact->contactFlags);
CLOG_DBG("contact[%d].contactId: %d\n", index, contact->contactId);
CLOG_DBG("contact[%d].fieldsPresent: %d\n", index, contact->fieldsPresent);
CLOG_DBG("contact[%d].x: %d\n", index, contact->x);
CLOG_DBG("contact[%d].y: %d\n", index, contact->y);
CLOG_DBG("contact[%d].contactFlags: 0x%04X", index, contact->contactFlags);
rdpei_print_contact_flags(contact->contactFlags);
printf("\n");
CLOG_DBG("\n");
#endif
Stream_Write_UINT8(s, contact->contactId); /* contactId (1 byte) */
@ -371,7 +371,7 @@ int rdpei_recv_sc_ready_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
#if 0
if (protocolVersion != RDPINPUT_PROTOCOL_V10)
{
fprintf(stderr, "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion);
CLOG_ERR( "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion);
return -1;
}
#endif
@ -408,7 +408,7 @@ int rdpei_recv_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s)
Stream_Read_UINT32(s, pduLength); /* pduLength (4 bytes) */
#ifdef WITH_DEBUG_RDPEI
fprintf(stderr, "rdpei_recv_pdu: eventId: %d (%s) length: %d\n",
CLOG_ERR( "rdpei_recv_pdu: eventId: %d (%s) length: %d\n",
eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength);
#endif

View File

@ -27,7 +27,7 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/rdpei.h>
@ -100,9 +100,9 @@ struct _RDPINPUT_CONTACT_POINT
typedef struct _RDPINPUT_CONTACT_POINT RDPINPUT_CONTACT_POINT;
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif /* FREERDP_CHANNEL_RDPEI_CLIENT_MAIN_H */

View File

@ -37,6 +37,7 @@
#include <winpr/collections.h>
#include <freerdp/addin.h>
#include <freerdp/channels/log.h>
#include "rdpgfx_common.h"
#include "rdpgfx_codec.h"
@ -204,7 +205,7 @@ int rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s
pad = 340 - (RDPGFX_HEADER_SIZE + 12 + (pdu.monitorCount * 20));
if (Stream_GetRemainingLength(s) < pad)
if (Stream_GetRemainingLength(s) < (size_t) pad)
return -1;
Stream_Seek(s, pad); /* pad (total size is 340 bytes) */
@ -255,7 +256,7 @@ int rdpgfx_recv_cache_import_reply_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStrea
Stream_Read_UINT16(s, pdu.importedEntriesCount); /* cacheSlot (2 bytes) */
if (Stream_GetRemainingLength(s) < (pdu.importedEntriesCount * 2))
if (Stream_GetRemainingLength(s) < (size_t) (pdu.importedEntriesCount * 2))
return -1;
pdu.cacheSlots = (UINT16*) calloc(pdu.importedEntriesCount, sizeof(UINT16));
@ -526,7 +527,7 @@ int rdpgfx_recv_solid_fill_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
rdpgfx_read_color32(s, &(pdu.fillPixel)); /* fillPixel (4 bytes) */
Stream_Read_UINT16(s, pdu.fillRectCount); /* fillRectCount (2 bytes) */
if (Stream_GetRemainingLength(s) < (pdu.fillRectCount * 8))
if (Stream_GetRemainingLength(s) < (size_t) (pdu.fillRectCount * 8))
return -1;
pdu.fillRects = (RDPGFX_RECT16*) calloc(pdu.fillRectCount, sizeof(RDPGFX_RECT16));
@ -569,7 +570,7 @@ int rdpgfx_recv_surface_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStrea
rdpgfx_read_rect16(s, &(pdu.rectSrc)); /* rectSrc (8 bytes ) */
Stream_Read_UINT16(s, pdu.destPtsCount); /* destPtsCount (2 bytes) */
if (Stream_GetRemainingLength(s) < (pdu.destPtsCount * 4))
if (Stream_GetRemainingLength(s) < (size_t) (pdu.destPtsCount * 4))
return -1;
pdu.destPts = (RDPGFX_POINT16*) calloc(pdu.destPtsCount, sizeof(RDPGFX_POINT16));
@ -642,7 +643,7 @@ int rdpgfx_recv_cache_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream*
Stream_Read_UINT16(s, pdu.surfaceId); /* surfaceId (2 bytes) */
Stream_Read_UINT16(s, pdu.destPtsCount); /* destPtsCount (2 bytes) */
if (Stream_GetRemainingLength(s) < (pdu.destPtsCount * 4))
if (Stream_GetRemainingLength(s) < (size_t) (pdu.destPtsCount * 4))
return -1;
pdu.destPts = (RDPGFX_POINT16*) calloc(pdu.destPtsCount, sizeof(RDPGFX_POINT16));
@ -815,7 +816,7 @@ int rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
if (status < 0)
{
fprintf(stderr, "Error while parsing GFX cmdId: %s (0x%04X)\n",
CLOG_ERR( "Error while parsing GFX cmdId: %s (0x%04X)\n",
rdpgfx_get_cmd_id_string(header.cmdId), header.cmdId);
return -1;
}
@ -824,7 +825,7 @@ int rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
if (end != (beg + header.pduLength))
{
fprintf(stderr, "Unexpected gfx pdu end: Actual: %d, Expected: %d\n",
CLOG_ERR( "Unexpected gfx pdu end: Actual: %d, Expected: %d\n",
end, (beg + header.pduLength));
Stream_SetPosition(s, (beg + header.pduLength));
@ -846,13 +847,13 @@ static int rdpgfx_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
if (status < 0)
{
printf("zgfx_decompress failure! status: %d\n", status);
CLOG_DBG("zgfx_decompress failure! status: %d\n", status);
return 0;
}
s = Stream_New(pDstData, DstSize);
while (Stream_GetPosition(s) < Stream_Length(s))
while (((size_t) Stream_GetPosition(s)) < Stream_Length(s))
{
status = rdpgfx_recv_pdu(callback, s);

View File

@ -35,7 +35,7 @@
#include <freerdp/types.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include "rdpsnd_main.h"
@ -68,7 +68,7 @@ struct rdpsnd_alsa_plugin
#define SND_PCM_CHECK(_func, _status) \
if (_status < 0) \
{ \
fprintf(stderr, "%s: %d\n", _func, _status); \
CLOG_ERR( "%s: %d\n", _func, _status); \
return -1; \
}
@ -106,7 +106,7 @@ static int rdpsnd_alsa_set_hw_params(rdpsndAlsaPlugin* alsa)
if (alsa->buffer_size > buffer_size_max)
{
fprintf(stderr, "Warning: requested sound buffer size %d, got %d instead\n",
CLOG_ERR( "Warning: requested sound buffer size %d, got %d instead\n",
(int) alsa->buffer_size, (int) buffer_size_max);
alsa->buffer_size = buffer_size_max;
}
@ -262,7 +262,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa)
if (status < 0)
{
DEBUG_WARN("snd_mixer_open failed");
CLOG_ERR("snd_mixer_open failed");
return;
}
@ -270,7 +270,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa)
if (status < 0)
{
DEBUG_WARN("snd_mixer_attach failed");
CLOG_ERR("snd_mixer_attach failed");
snd_mixer_close(alsa->mixer_handle);
return;
}
@ -279,7 +279,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa)
if (status < 0)
{
DEBUG_WARN("snd_mixer_selem_register failed");
CLOG_ERR("snd_mixer_selem_register failed");
snd_mixer_close(alsa->mixer_handle);
return;
}
@ -288,7 +288,7 @@ static void rdpsnd_alsa_open_mixer(rdpsndAlsaPlugin* alsa)
if (status < 0)
{
DEBUG_WARN("snd_mixer_load failed");
CLOG_ERR("snd_mixer_load failed");
snd_mixer_close(alsa->mixer_handle);
return;
}
@ -310,7 +310,7 @@ static void rdpsnd_alsa_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, i
if (status < 0)
{
DEBUG_WARN("snd_pcm_open failed");
CLOG_ERR("snd_pcm_open failed");
}
else
{
@ -579,7 +579,7 @@ static void rdpsnd_alsa_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
}
else if (status < 0)
{
fprintf(stderr, "status: %d\n", status);
CLOG_ERR( "status: %d\n", status);
snd_pcm_close(alsa->pcm_handle);
alsa->pcm_handle = NULL;
rdpsnd_alsa_open((rdpsndDevicePlugin*) alsa, NULL, alsa->latency);
@ -600,7 +600,7 @@ static void rdpsnd_alsa_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
wave->wLatency = (UINT16) (wave->wLocalTimeB - wave->wLocalTimeA);
wave->wTimeStampB = wave->wTimeStampA + wave->wLatency;
//fprintf(stderr, "wTimeStampA: %d wTimeStampB: %d wLatency: %d\n", wave->wTimeStampA, wave->wTimeStampB, wave->wLatency);
//CLOG_ERR( "wTimeStampA: %d wTimeStampB: %d wLatency: %d\n", wave->wTimeStampA, wave->wTimeStampB, wave->wLatency);
}
static COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args[] =

View File

@ -37,7 +37,7 @@
#define reportResult(result,operation) (_reportResult((result),(operation),__FILE__,__LINE__))
static inline bool _reportResult(kern_return_t result, const char *operation, const char* file, int line) {
if ( result != ERR_SUCCESS ) {
printf("%s:%d: %s: %s\n", file, line, operation, mach_error_string(result));
CLOG_DBG("%s:%d: %s: %s\n", file, line, operation, mach_error_string(result));
return false;
}
return true;
@ -108,7 +108,7 @@ bool TPCircularBufferInit(TPCircularBuffer *buffer, int length) {
if ( virtualAddress != bufferAddress+buffer->length ) {
// If the memory is not contiguous, clean up both allocated buffers and try again
if ( retries-- == 0 ) {
printf("Couldn't map buffer memory to end of buffer\n");
CLOG_DBG("Couldn't map buffer memory to end of buffer\n");
return false;
}

View File

@ -121,7 +121,7 @@ static void rdpsnd_mac_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, in
if (status != 0)
{
fprintf(stderr, "AudioQueueNewOutput failure\n");
CLOG_ERR( "AudioQueueNewOutput failure\n");
return;
}
@ -135,7 +135,7 @@ static void rdpsnd_mac_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, in
if (status != 0)
{
printf("AudioQueueGetProperty failure: kAudioQueueProperty_DecodeBufferSizeFrames\n");
CLOG_DBG("AudioQueueGetProperty failure: kAudioQueueProperty_DecodeBufferSizeFrames\n");
}
for (index = 0; index < MAC_AUDIO_QUEUE_NUM_BUFFERS; index++)
@ -144,7 +144,7 @@ static void rdpsnd_mac_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format, in
if (status != 0)
{
fprintf(stderr, "AudioQueueAllocateBuffer failed\n");
CLOG_ERR( "AudioQueueAllocateBuffer failed\n");
}
}
@ -219,7 +219,7 @@ static void rdpsnd_mac_set_volume(rdpsndDevicePlugin* device, UINT32 value)
if (status != 0)
{
fprintf(stderr, "AudioQueueSetParameter kAudioQueueParam_Volume failed: %f\n", fVolume);
CLOG_ERR( "AudioQueueSetParameter kAudioQueueParam_Volume failed: %f\n", fVolume);
}
}
@ -238,7 +238,7 @@ static void rdpsnd_mac_start(rdpsndDevicePlugin* device)
if (status != 0)
{
fprintf(stderr, "AudioQueueStart failed\n");
CLOG_ERR( "AudioQueueStart failed\n");
}
mac->isPlaying = TRUE;

View File

@ -35,7 +35,7 @@
#include <freerdp/types.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include "opensl_io.h"
#include "rdpsnd_main.h"
@ -187,7 +187,7 @@ static void rdpsnd_opensles_open(rdpsndDevicePlugin* device,
assert(opensles->stream);
if (!opensles->stream)
DEBUG_WARN("android_OpenAudioDevice failed");
CLOG_ERR("android_OpenAudioDevice failed");
else
rdpsnd_opensles_set_volume(device, opensles->volume);
@ -364,7 +364,7 @@ static void rdpsnd_opensles_play(rdpsndDevicePlugin* device,
ret = android_AudioOut(opensles->stream, src.s, size / 2);
if (ret < 0)
DEBUG_WARN("android_AudioOut failed (%d)", ret);
CLOG_ERR("android_AudioOut failed (%d)", ret);
}
static void rdpsnd_opensles_start(rdpsndDevicePlugin* device)

View File

@ -45,7 +45,7 @@
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/constants.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/utils/signal.h>
#include "rdpsnd_main.h"
@ -195,13 +195,13 @@ void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
}
#if 0
fprintf(stderr, "Server ");
CLOG_ERR( "Server ");
rdpsnd_print_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
fprintf(stderr, "\n");
CLOG_ERR( "\n");
fprintf(stderr, "Client ");
CLOG_ERR( "Client ");
rdpsnd_print_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
fprintf(stderr, "\n");
CLOG_ERR( "\n");
#endif
}
@ -544,7 +544,7 @@ static void rdpsnd_recv_pdu(rdpsndPlugin* rdpsnd, wStream* s)
Stream_Seek_UINT8(s); /* bPad */
Stream_Read_UINT16(s, BodySize);
//fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);
//CLOG_ERR( "msgType %d BodySize %d\n", msgType, BodySize);
switch (msgType)
{
@ -569,7 +569,7 @@ static void rdpsnd_recv_pdu(rdpsndPlugin* rdpsnd, wStream* s)
break;
default:
DEBUG_WARN("unknown msgType %d", msgType);
CLOG_ERR("unknown msgType %d", msgType);
break;
}
@ -580,7 +580,7 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug
{
if (rdpsnd->device)
{
DEBUG_WARN("existing device, abort.");
CLOG_ERR("existing device, abort.");
return;
}
@ -606,7 +606,7 @@ static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, AD
if (entry(&entryPoints) != 0)
{
DEBUG_WARN("%s entry returns error.", name);
CLOG_ERR("%s entry returns error.", name);
return FALSE;
}
@ -795,7 +795,7 @@ static void rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
if (!rdpsnd->device)
{
DEBUG_WARN("no sound device.");
CLOG_ERR("no sound device.");
return;
}
@ -875,7 +875,7 @@ int rdpsnd_virtual_channel_write(rdpsndPlugin* rdpsnd, wStream* s)
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
fprintf(stderr, "rdpdr_virtual_channel_write: VirtualChannelWrite failed %d\n", status);
CLOG_ERR( "rdpdr_virtual_channel_write: VirtualChannelWrite failed %d\n", status);
}
return status;
@ -907,7 +907,7 @@ static void rdpsnd_virtual_channel_event_data_received(rdpsndPlugin* plugin,
{
if (Stream_Capacity(s) != Stream_GetPosition(s))
{
fprintf(stderr, "rdpsnd_virtual_channel_event_data_received: read error\n");
CLOG_ERR( "rdpsnd_virtual_channel_event_data_received: read error\n");
}
plugin->data_in = NULL;
@ -927,7 +927,7 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event(DWORD openHandle, UINT e
if (!plugin)
{
fprintf(stderr, "rdpsnd_virtual_channel_open_event: error no match\n");
CLOG_ERR( "rdpsnd_virtual_channel_open_event: error no match\n");
return;
}
@ -987,7 +987,7 @@ static void rdpsnd_virtual_channel_event_connected(rdpsndPlugin* plugin, LPVOID
if (status != CHANNEL_RC_OK)
{
fprintf(stderr, "rdpsnd_virtual_channel_event_connected: open failed: status: %d\n", status);
CLOG_ERR( "rdpsnd_virtual_channel_event_connected: open failed: status: %d\n", status);
return;
}
@ -1040,7 +1040,7 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_init_event(LPVOID pInitHandle, UINT
if (!plugin)
{
fprintf(stderr, "rdpsnd_virtual_channel_init_event: error no match\n");
CLOG_ERR( "rdpsnd_virtual_channel_init_event: error no match\n");
return;
}

View File

@ -27,7 +27,7 @@
#include <freerdp/client/rdpsnd.h>
#if defined(WITH_DEBUG_SND)
#define DEBUG_SND(fmt, ...) DEBUG_CLASS("rdpsnd", fmt, ## __VA_ARGS__)
#define DEBUG_SND(fmt, ...) CLOG_CLASS("rdpsnd", fmt, ## __VA_ARGS__)
#else
#define DEBUG_SND(fmt, ...) do { } while (0)
#endif

View File

@ -34,6 +34,7 @@
#include <freerdp/types.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/channels/log.h>
#include "rdpsnd_main.h"
@ -101,11 +102,11 @@ static void CALLBACK rdpsnd_winmm_callback_function(HWAVEOUT hwo, UINT uMsg, DWO
switch (uMsg)
{
case MM_WOM_OPEN:
fprintf(stderr, "MM_WOM_OPEN\n");
CLOG_ERR( "MM_WOM_OPEN\n");
break;
case MM_WOM_CLOSE:
fprintf(stderr, "MM_WOM_CLOSE\n");
CLOG_ERR( "MM_WOM_CLOSE\n");
break;
case MM_WOM_DONE:
@ -121,7 +122,7 @@ static void CALLBACK rdpsnd_winmm_callback_function(HWAVEOUT hwo, UINT uMsg, DWO
if (!wave)
return;
fprintf(stderr, "MM_WOM_DONE: dwBufferLength: %d cBlockNo: %d\n",
CLOG_ERR( "MM_WOM_DONE: dwBufferLength: %d cBlockNo: %d\n",
lpWaveHdr->dwBufferLength, wave->cBlockNo);
wave->wLocalTimeB = GetTickCount();
@ -155,7 +156,7 @@ static void rdpsnd_winmm_open(rdpsndDevicePlugin* device, AUDIO_FORMAT* format,
if (mmResult != MMSYSERR_NOERROR)
{
fprintf(stderr, "waveOutOpen failed: %d\n", mmResult);
CLOG_ERR( "waveOutOpen failed: %d\n", mmResult);
}
}
@ -172,7 +173,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device)
if (mmResult != MMSYSERR_NOERROR)
{
fprintf(stderr, "waveOutClose failure: %d\n", mmResult);
CLOG_ERR( "waveOutClose failure: %d\n", mmResult);
}
winmm->hWaveOut = NULL;
@ -299,7 +300,7 @@ void rdpsnd_winmm_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
if (mmResult != MMSYSERR_NOERROR)
{
fprintf(stderr, "waveOutPrepareHeader failure: %d\n", mmResult);
CLOG_ERR( "waveOutPrepareHeader failure: %d\n", mmResult);
return;
}
@ -307,7 +308,7 @@ void rdpsnd_winmm_wave_play(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
if (mmResult != MMSYSERR_NOERROR)
{
fprintf(stderr, "waveOutWrite failure: %d\n", mmResult);
CLOG_ERR( "waveOutWrite failure: %d\n", mmResult);
waveOutUnprepareHeader(winmm->hWaveOut, lpWaveHdr, sizeof(WAVEHDR));
return;
}

View File

@ -29,6 +29,8 @@
#include <winpr/print.h>
#include <winpr/stream.h>
#include <freerdp/channels/log.h>
#include "rdpsnd_main.h"
BOOL rdpsnd_server_send_formats(RdpsndServerContext* context, wStream* s)
@ -108,7 +110,7 @@ static BOOL rdpsnd_server_recv_quality_mode(RdpsndServerContext* context, wStrea
Stream_Read_UINT16(s, quality);
Stream_Seek_UINT16(s); // reserved
fprintf(stderr, "Client requested sound quality: %#0X\n", quality);
CLOG_ERR( "Client requested sound quality: %#0X\n", quality);
return TRUE;
}
@ -137,7 +139,7 @@ static BOOL rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
if (!context->num_client_formats)
{
fprintf(stderr, "%s: client doesn't support any format!\n", __FUNCTION__);
CLOG_ERR( "%s: client doesn't support any format!\n", __FUNCTION__);
return FALSE;
}
@ -174,7 +176,7 @@ static BOOL rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
if (!context->num_client_formats)
{
fprintf(stderr, "%s: client doesn't support any known format!\n", __FUNCTION__);
CLOG_ERR( "%s: client doesn't support any known format!\n", __FUNCTION__);
goto out_free;
}
@ -230,7 +232,7 @@ static BOOL rdpsnd_server_select_format(RdpsndServerContext* context, int client
if (client_format_index < 0 || client_format_index >= context->num_client_formats)
{
fprintf(stderr, "%s: index %d is not correct.\n", __FUNCTION__, client_format_index);
CLOG_ERR( "%s: index %d is not correct.\n", __FUNCTION__, client_format_index);
return FALSE;
}
@ -242,7 +244,7 @@ static BOOL rdpsnd_server_select_format(RdpsndServerContext* context, int client
if (format->nSamplesPerSec == 0)
{
fprintf(stderr, "%s: invalid Client Sound Format!!\n", __FUNCTION__);
CLOG_ERR( "%s: invalid Client Sound Format!!\n", __FUNCTION__);
return FALSE;
}
@ -475,7 +477,7 @@ static int rdpsnd_server_start(RdpsndServerContext* context)
if (!WTSVirtualChannelQuery(priv->ChannelHandle, WTSVirtualEventHandle, &buffer, &bytesReturned) || (bytesReturned != sizeof(HANDLE)))
{
fprintf(stderr, "%s: error during WTSVirtualChannelQuery(WTSVirtualEventHandle) or invalid returned size(%d)\n",
CLOG_ERR( "%s: error during WTSVirtualChannelQuery(WTSVirtualEventHandle) or invalid returned size(%d)\n",
__FUNCTION__, bytesReturned);
if (buffer)
WTSFreeMemory(buffer);
@ -631,7 +633,7 @@ BOOL rdpsnd_server_handle_messages(RdpsndServerContext *context)
if (GetLastError() == ERROR_NO_DATA)
return TRUE;
fprintf(stderr, "%s: channel connection closed\n", __FUNCTION__);
CLOG_ERR( "%s: channel connection closed\n", __FUNCTION__);
return FALSE;
}
priv->expectedBytes -= bytesReturned;
@ -659,7 +661,7 @@ BOOL rdpsnd_server_handle_messages(RdpsndServerContext *context)
/* when here we have the header + the body */
#ifdef WITH_DEBUG_SND
fprintf(stderr, "%s: message type %d\n", __FUNCTION__, priv->msgType);
CLOG_ERR( "%s: message type %d\n", __FUNCTION__, priv->msgType);
#endif
priv->expectedBytes = 4;
priv->waitingHeader = TRUE;
@ -685,7 +687,7 @@ BOOL rdpsnd_server_handle_messages(RdpsndServerContext *context)
break;
default:
fprintf(stderr, "%s: UNKOWN MESSAGE TYPE!! (%#0X)\n\n", __FUNCTION__, priv->msgType);
CLOG_ERR( "%s: UNKOWN MESSAGE TYPE!! (%#0X)\n\n", __FUNCTION__, priv->msgType);
ret = FALSE;
break;
}

View File

@ -26,6 +26,7 @@
#include <freerdp/assistance.h>
#include <freerdp/channels/log.h>
#include <freerdp/client/remdesk.h>
#include "remdesk_main.h"
@ -49,7 +50,7 @@ int remdesk_virtual_channel_write(remdeskPlugin* remdesk, wStream* s)
if (status != CHANNEL_RC_OK)
{
fprintf(stderr, "remdesk_virtual_channel_write: VirtualChannelWrite failed %d\n", status);
CLOG_ERR( "remdesk_virtual_channel_write: VirtualChannelWrite failed %d\n", status);
return -1;
}
@ -98,7 +99,7 @@ int remdesk_generate_expert_blob(remdeskPlugin* remdesk)
return 1;
}
int remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
static int remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int status;
UINT32 ChannelNameLen;
@ -133,7 +134,7 @@ int remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
return 1;
}
int remdesk_write_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
static int remdesk_write_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int index;
UINT32 ChannelNameLen;
@ -156,14 +157,14 @@ int remdesk_write_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
return 1;
}
int remdesk_write_ctl_header(wStream* s, REMDESK_CTL_HEADER* ctlHeader)
static int remdesk_write_ctl_header(wStream* s, REMDESK_CTL_HEADER* ctlHeader)
{
remdesk_write_channel_header(s, (REMDESK_CHANNEL_HEADER*) ctlHeader);
Stream_Write_UINT32(s, ctlHeader->msgType); /* msgType (4 bytes) */
return 1;
}
int remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader, UINT32 msgType, UINT32 msgSize)
static int remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader, UINT32 msgType, UINT32 msgSize)
{
ctlHeader->msgType = msgType;
strcpy(ctlHeader->ChannelName, REMDESK_CHANNEL_CTL_NAME);
@ -171,12 +172,12 @@ int remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader, UINT32 msgType, UI
return 1;
}
int remdesk_recv_ctl_server_announce_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header)
static int remdesk_recv_ctl_server_announce_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header)
{
return 1;
}
int remdesk_recv_ctl_version_info_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header)
static int remdesk_recv_ctl_version_info_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header)
{
UINT32 versionMajor;
UINT32 versionMinor;
@ -190,7 +191,7 @@ int remdesk_recv_ctl_version_info_pdu(remdeskPlugin* remdesk, wStream* s, REMDES
return 1;
}
int remdesk_send_ctl_version_info_pdu(remdeskPlugin* remdesk)
static int remdesk_send_ctl_version_info_pdu(remdeskPlugin* remdesk)
{
wStream* s;
REMDESK_CTL_VERSION_INFO_PDU pdu;
@ -214,7 +215,7 @@ int remdesk_send_ctl_version_info_pdu(remdeskPlugin* remdesk)
return 1;
}
int remdesk_recv_result_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header, UINT32 *pResult)
static int remdesk_recv_ctl_result_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header, UINT32 *pResult)
{
UINT32 result;
@ -225,12 +226,12 @@ int remdesk_recv_result_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_
*pResult = result;
//printf("RemdeskRecvResult: 0x%04X\n", result);
//CLOG_DBG("RemdeskRecvResult: 0x%04X\n", result);
return 1;
}
int remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk)
static int remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk)
{
int status;
wStream* s;
@ -282,7 +283,7 @@ int remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk)
return 1;
}
int remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* remdesk)
static int remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* remdesk)
{
int status;
wStream* s;
@ -316,7 +317,7 @@ int remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* remdesk)
return 1;
}
int remdesk_send_ctl_verify_password_pdu(remdeskPlugin* remdesk)
static int remdesk_send_ctl_verify_password_pdu(remdeskPlugin* remdesk)
{
int status;
wStream* s;
@ -355,7 +356,7 @@ int remdesk_send_ctl_verify_password_pdu(remdeskPlugin* remdesk)
return 1;
}
int remdesk_send_ctl_expert_on_vista_pdu(remdeskPlugin* remdesk)
static int remdesk_send_ctl_expert_on_vista_pdu(remdeskPlugin* remdesk)
{
int status;
wStream* s;
@ -385,7 +386,7 @@ int remdesk_send_ctl_expert_on_vista_pdu(remdeskPlugin* remdesk)
return 1;
}
int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header)
static int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int status = 1;
UINT32 msgType = 0;
@ -396,7 +397,7 @@ int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEA
Stream_Read_UINT32(s, msgType); /* msgType (4 bytes) */
//printf("msgType: %d\n", msgType);
//CLOG_DBG("msgType: %d\n", msgType);
switch (msgType)
{
@ -404,7 +405,7 @@ int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEA
break;
case REMDESK_CTL_RESULT:
status = remdesk_recv_result_pdu(remdesk, s, header, &result);
status = remdesk_recv_ctl_result_pdu(remdesk, s, header, &result);
break;
case REMDESK_CTL_AUTHENTICATE:
@ -461,7 +462,7 @@ int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEA
break;
default:
fprintf(stderr, "remdesk_recv_control_pdu: unknown msgType: %d\n", msgType);
CLOG_ERR( "remdesk_recv_control_pdu: unknown msgType: %d\n", msgType);
status = -1;
break;
}
@ -469,13 +470,13 @@ int remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s, REMDESK_CHANNEL_HEA
return status;
}
int remdesk_process_receive(remdeskPlugin* remdesk, wStream* s)
static int remdesk_process_receive(remdeskPlugin* remdesk, wStream* s)
{
int status = 1;
REMDESK_CHANNEL_HEADER header;
#if 0
printf("RemdeskReceive: %d\n", Stream_GetRemainingLength(s));
CLOG_DBG("RemdeskReceive: %d\n", Stream_GetRemainingLength(s));
winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s));
#endif
@ -585,7 +586,7 @@ int remdesk_send(remdeskPlugin* remdesk, wStream* s)
if (status != CHANNEL_RC_OK)
{
Stream_Free(s, TRUE);
fprintf(stderr, "remdesk_send: VirtualChannelWrite failed %d\n", status);
CLOG_ERR( "remdesk_send: VirtualChannelWrite failed %d\n", status);
}
return status;
@ -617,7 +618,7 @@ static void remdesk_virtual_channel_event_data_received(remdeskPlugin* remdesk,
{
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
{
fprintf(stderr, "remdesk_plugin_process_received: read error\n");
CLOG_ERR( "remdesk_plugin_process_received: read error\n");
}
remdesk->data_in = NULL;
@ -637,7 +638,7 @@ static VOID VCAPITYPE remdesk_virtual_channel_open_event(DWORD openHandle, UINT
if (!remdesk)
{
fprintf(stderr, "remdesk_virtual_channel_open_event: error no match\n");
CLOG_ERR( "remdesk_virtual_channel_open_event: error no match\n");
return;
}
@ -697,7 +698,7 @@ static void remdesk_virtual_channel_event_connected(remdeskPlugin* remdesk, LPVO
if (status != CHANNEL_RC_OK)
{
fprintf(stderr, "remdesk_virtual_channel_event_connected: open failed: status: %d\n", status);
CLOG_ERR( "remdesk_virtual_channel_event_connected: open failed: status: %d\n", status);
return;
}
@ -735,7 +736,7 @@ static VOID VCAPITYPE remdesk_virtual_channel_init_event(LPVOID pInitHandle, UIN
if (!remdesk)
{
fprintf(stderr, "remdesk_virtual_channel_init_event: error no match\n");
CLOG_ERR( "remdesk_virtual_channel_init_event: error no match\n");
return;
}

View File

@ -27,9 +27,391 @@
#include "remdesk_main.h"
int remdesk_virtual_channel_write(RemdeskServerContext* context, wStream* s)
{
BOOL status;
ULONG BytesWritten = 0;
status = WTSVirtualChannelWrite(context->priv->ChannelHandle,
(PCHAR) Stream_Buffer(s), Stream_Length(s), &BytesWritten);
return (status) ? 1 : -1;
}
static int remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int status;
UINT32 ChannelNameLen;
char* pChannelName = NULL;
if (Stream_GetRemainingLength(s) < 8)
return -1;
Stream_Read_UINT32(s, ChannelNameLen); /* ChannelNameLen (4 bytes) */
Stream_Read_UINT32(s, header->DataLength); /* DataLen (4 bytes) */
if (ChannelNameLen > 64)
return -1;
if ((ChannelNameLen % 2) != 0)
return -1;
if (Stream_GetRemainingLength(s) < ChannelNameLen)
return -1;
ZeroMemory(header->ChannelName, sizeof(header->ChannelName));
pChannelName = (char*) header->ChannelName;
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s),
ChannelNameLen / 2, &pChannelName, 32, NULL, NULL);
Stream_Seek(s, ChannelNameLen);
if (status <= 0)
return -1;
return 1;
}
static int remdesk_write_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int index;
UINT32 ChannelNameLen;
WCHAR ChannelNameW[32];
ZeroMemory(ChannelNameW, sizeof(ChannelNameW));
for (index = 0; index < 32; index++)
{
ChannelNameW[index] = (WCHAR) header->ChannelName[index];
}
ChannelNameLen = (strlen(header->ChannelName) + 1) * 2;
Stream_Write_UINT32(s, ChannelNameLen); /* ChannelNameLen (4 bytes) */
Stream_Write_UINT32(s, header->DataLength); /* DataLen (4 bytes) */
Stream_Write(s, ChannelNameW, ChannelNameLen); /* ChannelName (variable) */
return 1;
}
static int remdesk_write_ctl_header(wStream* s, REMDESK_CTL_HEADER* ctlHeader)
{
remdesk_write_channel_header(s, (REMDESK_CHANNEL_HEADER*) ctlHeader);
Stream_Write_UINT32(s, ctlHeader->msgType); /* msgType (4 bytes) */
return 1;
}
static int remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader, UINT32 msgType, UINT32 msgSize)
{
ctlHeader->msgType = msgType;
strcpy(ctlHeader->ChannelName, REMDESK_CHANNEL_CTL_NAME);
ctlHeader->DataLength = 4 + msgSize;
return 1;
}
static int remdesk_send_ctl_result_pdu(RemdeskServerContext* context, UINT32 result)
{
wStream* s;
REMDESK_CTL_RESULT_PDU pdu;
pdu.result = result;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_RESULT, 4);
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
Stream_Write_UINT32(s, pdu.result); /* result (4 bytes) */
Stream_SealLength(s);
remdesk_virtual_channel_write(context, s);
Stream_Free(s, TRUE);
return 1;
}
static int remdesk_send_ctl_version_info_pdu(RemdeskServerContext* context)
{
wStream* s;
REMDESK_CTL_VERSION_INFO_PDU pdu;
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_VERSIONINFO, 8);
pdu.versionMajor = 1;
pdu.versionMinor = 2;
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
Stream_Write_UINT32(s, pdu.versionMajor); /* versionMajor (4 bytes) */
Stream_Write_UINT32(s, pdu.versionMinor); /* versionMinor (4 bytes) */
Stream_SealLength(s);
remdesk_virtual_channel_write(context, s);
return 1;
}
static int remdesk_recv_ctl_version_info_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header)
{
UINT32 versionMajor;
UINT32 versionMinor;
if (Stream_GetRemainingLength(s) < 8)
return -1;
Stream_Read_UINT32(s, versionMajor); /* versionMajor (4 bytes) */
Stream_Read_UINT32(s, versionMinor); /* versionMinor (4 bytes) */
return 1;
}
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_authenticate_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int status;
int cchStringW;
WCHAR* pStringW;
UINT32 msgLength;
int cbExpertBlobW = 0;
WCHAR* expertBlobW = NULL;
int cbRaConnectionStringW = 0;
WCHAR* raConnectionStringW = NULL;
REMDESK_CTL_AUTHENTICATE_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;
pStringW += cchStringW;
expertBlobW = pStringW;
cchStringW = 0;
while ((msgLength > 0) && pStringW[cchStringW])
{
msgLength -= 2;
cchStringW++;
}
if (pStringW[cchStringW] || !cchStringW)
return -1;
cchStringW++;
cbExpertBlobW = cchStringW * 2;
pdu.raConnectionString = NULL;
status = ConvertFromUnicode(CP_UTF8, 0, raConnectionStringW,
cbRaConnectionStringW / 2, &pdu.raConnectionString, 0, NULL, NULL);
if (status <= 0)
return -1;
pdu.expertBlob = NULL;
status = ConvertFromUnicode(CP_UTF8, 0, expertBlobW,
cbExpertBlobW / 2, &pdu.expertBlob, 0, NULL, NULL);
if (status <= 0)
return -1;
printf("RaConnectionString: %s ExpertBlob: %s\n",
pdu.raConnectionString, pdu.expertBlob);
free(pdu.raConnectionString);
free(pdu.expertBlob);
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;
}
static int remdesk_recv_ctl_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int status = 1;
UINT32 msgType = 0;
if (Stream_GetRemainingLength(s) < 4)
return -1;
Stream_Read_UINT32(s, msgType); /* msgType (4 bytes) */
printf("msgType: %d\n", msgType);
switch (msgType)
{
case REMDESK_CTL_REMOTE_CONTROL_DESKTOP:
status = remdesk_recv_ctl_remote_control_desktop_pdu(context, s, header);
break;
case REMDESK_CTL_AUTHENTICATE:
status = remdesk_recv_ctl_authenticate_pdu(context, s, header);
break;
case REMDESK_CTL_DISCONNECT:
break;
case REMDESK_CTL_VERSIONINFO:
status = remdesk_recv_ctl_version_info_pdu(context, s, header);
break;
case REMDESK_CTL_ISCONNECTED:
break;
case REMDESK_CTL_VERIFY_PASSWORD:
status = remdesk_recv_ctl_verify_password_pdu(context, s, header);
break;
case REMDESK_CTL_EXPERT_ON_VISTA:
break;
case REMDESK_CTL_RANOVICE_NAME:
break;
case REMDESK_CTL_RAEXPERT_NAME:
break;
case REMDESK_CTL_TOKEN:
break;
default:
fprintf(stderr, "remdesk_recv_control_pdu: unknown msgType: %d\n", msgType);
status = -1;
break;
}
return status;
}
static int remdesk_server_receive_pdu(RemdeskServerContext* context, wStream* s)
{
return 0;
int status = 1;
REMDESK_CHANNEL_HEADER header;
#if 0
printf("RemdeskReceive: %d\n", Stream_GetRemainingLength(s));
winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s));
#endif
remdesk_read_channel_header(s, &header);
if (strcmp(header.ChannelName, "RC_CTL") == 0)
{
status = remdesk_recv_ctl_pdu(context, s, &header);
}
else if (strcmp(header.ChannelName, "70") == 0)
{
}
else if (strcmp(header.ChannelName, "71") == 0)
{
}
else if (strcmp(header.ChannelName, ".") == 0)
{
}
else if (strcmp(header.ChannelName, "1000.") == 0)
{
}
else if (strcmp(header.ChannelName, "RA_FX") == 0)
{
}
else
{
}
return 1;
}
static void* remdesk_server_thread(void* arg)
@ -38,6 +420,8 @@ static void* remdesk_server_thread(void* arg)
DWORD status;
DWORD nCount;
void* buffer;
UINT32* pHeader;
UINT32 PduLength;
HANDLE events[8];
HANDLE ChannelEvent;
DWORD BytesReturned;
@ -63,6 +447,8 @@ static void* remdesk_server_thread(void* arg)
events[nCount++] = ChannelEvent;
events[nCount++] = context->priv->StopEvent;
remdesk_send_ctl_version_info_pdu(context);
while (1)
{
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
@ -83,9 +469,18 @@ static void* remdesk_server_thread(void* arg)
Stream_EnsureRemainingCapacity(s, BytesReturned);
}
if (0)
if (Stream_GetPosition(s) >= 8)
{
remdesk_server_receive_pdu(context, s);
pHeader = (UINT32*) Stream_Buffer(s);
PduLength = pHeader[0] + pHeader[1] + 8;
if (PduLength >= Stream_GetPosition(s))
{
Stream_SealLength(s);
Stream_SetPosition(s, 0);
remdesk_server_receive_pdu(context, s);
Stream_SetPosition(s, 0);
}
}
}
@ -106,7 +501,7 @@ static int remdesk_server_start(RemdeskServerContext* context)
context->priv->Thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) remdesk_server_thread, (void*) context, 0, NULL);
return 0;
return 1;
}
static int remdesk_server_stop(RemdeskServerContext* context)
@ -116,7 +511,7 @@ static int remdesk_server_stop(RemdeskServerContext* context)
WaitForSingleObject(context->priv->Thread, INFINITE);
CloseHandle(context->priv->Thread);
return 0;
return 1;
}
RemdeskServerContext* remdesk_server_context_new(HANDLE vcm)
@ -136,7 +531,7 @@ RemdeskServerContext* remdesk_server_context_new(HANDLE vcm)
if (context->priv)
{
context->priv->Version = 1;
}
}

View File

@ -31,6 +31,8 @@ struct _remdesk_server_private
HANDLE Thread;
HANDLE StopEvent;
void* ChannelHandle;
UINT32 Version;
};
#endif /* FREERDP_CHANNEL_SERVER_REMDESK_MAIN_H */

View File

@ -372,7 +372,7 @@ void smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp)
}
else
{
fprintf(stderr, "Unexpected SmartCard IRP: MajorFunction 0x%08X MinorFunction: 0x%08X",
CLOG_ERR( "Unexpected SmartCard IRP: MajorFunction 0x%08X MinorFunction: 0x%08X",
irp->MajorFunction, irp->MinorFunction);
irp->IoStatus = STATUS_NOT_SUPPORTED;

View File

@ -21,7 +21,7 @@
#ifndef FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H
#define FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/channels/rdpdr.h>
#include <winpr/crt.h>

View File

@ -1142,7 +1142,7 @@ UINT32 smartcard_irp_device_control_decode(SMARTCARD_DEVICE* smartcard, SMARTCAR
smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId);
#if 0
printf("%s (0x%08X) FileId: %d CompletionId: %d\n",
CLOG_DBG("%s (0x%08X) FileId: %d CompletionId: %d\n",
smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId);
#endif

View File

@ -56,7 +56,7 @@ static BOOL tsmf_alsa_open_device(TSMFAlsaAudioDevice *alsa)
error = snd_pcm_open(&alsa->out_handle, alsa->device, SND_PCM_STREAM_PLAYBACK, 0);
if(error < 0)
{
DEBUG_WARN("failed to open device %s", alsa->device);
CLOG_ERR("failed to open device %s", alsa->device);
return FALSE;
}
DEBUG_TSMF("open device %s", alsa->device);
@ -95,7 +95,7 @@ static BOOL tsmf_alsa_set_format(ITSMFAudioDevice *audio,
error = snd_pcm_hw_params_malloc(&hw_params);
if(error < 0)
{
DEBUG_WARN("snd_pcm_hw_params_malloc failed");
CLOG_ERR("snd_pcm_hw_params_malloc failed");
return FALSE;
}
snd_pcm_hw_params_any(alsa->out_handle, hw_params);
@ -115,7 +115,7 @@ static BOOL tsmf_alsa_set_format(ITSMFAudioDevice *audio,
error = snd_pcm_sw_params_malloc(&sw_params);
if(error < 0)
{
DEBUG_WARN("snd_pcm_sw_params_malloc");
CLOG_ERR("snd_pcm_sw_params_malloc");
return FALSE;
}
snd_pcm_sw_params_current(alsa->out_handle, sw_params);

View File

@ -27,10 +27,12 @@
#include <winpr/crt.h>
#include <freerdp/channels/log.h>
#include <freerdp/utils/event.h>
#include <freerdp/client/tsmf.h>
#include <libavcodec/avcodec.h>
#include <libavutil/common.h>
#include "tsmf_constants.h"
#include "tsmf_decoder.h"
@ -47,6 +49,20 @@
#define MAX_AUDIO_FRAME_SIZE 192000
#endif
#if LIBAVCODEC_VERSION_MAJOR < 55
#define AV_CODEC_ID_VC1 CODEC_ID_VC1
#define AV_CODEC_ID_WMAV2 CODEC_ID_WMAV2
#define AV_CODEC_ID_WMAPRO CODEC_ID_WMAPRO
#define AV_CODEC_ID_MP3 CODEC_ID_MP3
#define AV_CODEC_ID_MP2 CODEC_ID_MP2
#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
#define AV_CODEC_ID_WMV3 CODEC_ID_WMV3
#define AV_CODEC_ID_AAC CODEC_ID_AAC
#define AV_CODEC_ID_H264 CODEC_ID_H264
#define AV_CODEC_ID_AC3 CODEC_ID_AC3
#endif
typedef struct _TSMFFFmpegDecoder
{
ITSMFDecoder iface;
@ -73,7 +89,7 @@ static BOOL tsmf_ffmpeg_init_context(ITSMFDecoder *decoder)
mdecoder->codec_context = avcodec_alloc_context3(NULL);
if(!mdecoder->codec_context)
{
DEBUG_WARN("avcodec_alloc_context failed.");
CLOG_ERR("avcodec_alloc_context failed.");
return FALSE;
}
return TRUE;
@ -127,7 +143,7 @@ static BOOL tsmf_ffmpeg_init_stream(ITSMFDecoder *decoder, const TS_AM_MEDIA_TYP
mdecoder->codec = avcodec_find_decoder(mdecoder->codec_id);
if(!mdecoder->codec)
{
DEBUG_WARN("avcodec_find_decoder failed.");
CLOG_ERR("avcodec_find_decoder failed.");
return FALSE;
}
mdecoder->codec_context->codec_id = mdecoder->codec_id;
@ -189,7 +205,7 @@ static BOOL tsmf_ffmpeg_prepare(ITSMFDecoder *decoder)
TSMFFFmpegDecoder *mdecoder = (TSMFFFmpegDecoder *) decoder;
if(avcodec_open2(mdecoder->codec_context, mdecoder->codec, NULL) < 0)
{
DEBUG_WARN("avcodec_open2 failed.");
CLOG_ERR("avcodec_open2 failed.");
return FALSE;
}
mdecoder->prepared = 1;
@ -213,28 +229,28 @@ static BOOL tsmf_ffmpeg_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *medi
switch(media_type->SubType)
{
case TSMF_SUB_TYPE_WVC1:
mdecoder->codec_id = CODEC_ID_VC1;
mdecoder->codec_id = AV_CODEC_ID_VC1;
break;
case TSMF_SUB_TYPE_WMA2:
mdecoder->codec_id = CODEC_ID_WMAV2;
mdecoder->codec_id = AV_CODEC_ID_WMAV2;
break;
case TSMF_SUB_TYPE_WMA9:
mdecoder->codec_id = CODEC_ID_WMAPRO;
mdecoder->codec_id = AV_CODEC_ID_WMAPRO;
break;
case TSMF_SUB_TYPE_MP3:
mdecoder->codec_id = CODEC_ID_MP3;
mdecoder->codec_id = AV_CODEC_ID_MP3;
break;
case TSMF_SUB_TYPE_MP2A:
mdecoder->codec_id = CODEC_ID_MP2;
mdecoder->codec_id = AV_CODEC_ID_MP2;
break;
case TSMF_SUB_TYPE_MP2V:
mdecoder->codec_id = CODEC_ID_MPEG2VIDEO;
mdecoder->codec_id = AV_CODEC_ID_MPEG2VIDEO;
break;
case TSMF_SUB_TYPE_WMV3:
mdecoder->codec_id = CODEC_ID_WMV3;
mdecoder->codec_id = AV_CODEC_ID_WMV3;
break;
case TSMF_SUB_TYPE_AAC:
mdecoder->codec_id = CODEC_ID_AAC;
mdecoder->codec_id = AV_CODEC_ID_AAC;
/* For AAC the pFormat is a HEAACWAVEINFO struct, and the codec data
is at the end of it. See
http://msdn.microsoft.com/en-us/library/dd757806.aspx */
@ -246,10 +262,10 @@ static BOOL tsmf_ffmpeg_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *medi
break;
case TSMF_SUB_TYPE_H264:
case TSMF_SUB_TYPE_AVC1:
mdecoder->codec_id = CODEC_ID_H264;
mdecoder->codec_id = AV_CODEC_ID_H264;
break;
case TSMF_SUB_TYPE_AC3:
mdecoder->codec_id = CODEC_ID_AC3;
mdecoder->codec_id = AV_CODEC_ID_AC3;
break;
default:
return FALSE;
@ -285,13 +301,13 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder *decoder, const BYTE *data, UI
#endif
if(len < 0)
{
DEBUG_WARN("data_size %d, avcodec_decode_video failed (%d)", data_size, len);
CLOG_ERR("data_size %d, avcodec_decode_video failed (%d)", data_size, len);
ret = FALSE;
}
else
if(!decoded)
{
DEBUG_WARN("data_size %d, no frame is decoded.", data_size);
CLOG_ERR("data_size %d, no frame is decoded.", data_size);
ret = FALSE;
}
else
@ -387,7 +403,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder *decoder, const BYTE *data, UI
#endif
if(len <= 0 || frame_size <= 0)
{
DEBUG_WARN("error decoding");
CLOG_ERR("error decoding");
break;
}
src += len;
@ -427,7 +443,7 @@ static BOOL tsmf_ffmpeg_decode(ITSMFDecoder *decoder, const BYTE *data, UINT32 d
case AVMEDIA_TYPE_AUDIO:
return tsmf_ffmpeg_decode_audio(decoder, data, data_size, extensions);
default:
DEBUG_WARN("unknown media type.");
CLOG_ERR("unknown media type.");
return FALSE;
}
}
@ -451,7 +467,7 @@ static UINT32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder *decoder)
case PIX_FMT_YUV420P:
return RDP_PIXFMT_I420;
default:
DEBUG_WARN("unsupported pixel format %u",
CLOG_ERR("unsupported pixel format %u",
mdecoder->codec_context->pix_fmt);
return (UINT32) -1;
}
@ -504,7 +520,7 @@ ITSMFDecoder *freerdp_tsmf_client_decoder_subsystem_entry(void)
avcodec_register_all();
initialized = TRUE;
}
fprintf(stderr, "TSMFDecoderEntry FFMPEG\n");
CLOG_ERR( "TSMFDecoderEntry FFMPEG\n");
decoder = (TSMFFFmpegDecoder *) malloc(sizeof(TSMFFFmpegDecoder));
ZeroMemory(decoder, sizeof(TSMFFFmpegDecoder));
decoder->iface.SetFormat = tsmf_ffmpeg_set_format;

View File

@ -87,7 +87,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder)
if (!hdl)
{
DEBUG_WARN("%s: Could not allocate handle.", __func__);
CLOG_ERR("%s: Could not allocate handle.", __func__);
return -1;
}
@ -97,7 +97,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder)
if (hdl->shmid < 0)
{
DEBUG_WARN("%s: failed to get access to shared memory - shmget()",
CLOG_ERR("%s: failed to get access to shared memory - shmget()",
__func__);
return -2;
}
@ -106,7 +106,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder)
if (hdl->xfwin == (int *)-1)
{
DEBUG_WARN("%s: shmat failed!", __func__);
CLOG_ERR("%s: shmat failed!", __func__);
return -3;
}
@ -114,7 +114,7 @@ int tsmf_platform_create(TSMFGstreamerDecoder *decoder)
if (!hdl->disp)
{
DEBUG_WARN("Failed to open display");
CLOG_ERR("Failed to open display");
return -4;
}
@ -140,7 +140,7 @@ int tsmf_platform_register_handler(TSMFGstreamerDecoder *decoder)
if (!bus)
{
DEBUG_WARN("gst_pipeline_get_bus failed!");
CLOG_ERR("gst_pipeline_get_bus failed!");
return 1;
}
@ -193,7 +193,7 @@ int tsmf_window_create(TSMFGstreamerDecoder *decoder)
if (!hdl->subwin)
{
DEBUG_WARN("Could not create subwindow!");
CLOG_ERR("Could not create subwindow!");
}
XMapWindow(hdl->disp, hdl->subwin);
@ -238,14 +238,14 @@ int tsmf_window_resize(TSMFGstreamerDecoder *decoder, int x, int y, int width,
if (!gst_video_overlay_set_render_rectangle(overlay, 0, 0, width, height))
{
DEBUG_WARN("Could not resize overlay!");
CLOG_ERR("Could not resize overlay!");
}
gst_video_overlay_expose(overlay);
#else
if (!gst_x_overlay_set_render_rectangle(overlay, 0, 0, width, height))
{
DEBUG_WARN("Could not resize overlay!");
CLOG_ERR("Could not resize overlay!");
}
gst_x_overlay_expose(overlay);

View File

@ -120,10 +120,10 @@ int tsmf_gstreamer_pipeline_set_state(TSMFGstreamerDecoder *mdecoder, GstState d
state_change = gst_element_set_state(mdecoder->pipe, desired_state);
if (state_change == GST_STATE_CHANGE_FAILURE)
DEBUG_WARN("%s: (%s) GST_STATE_CHANGE_FAILURE.", sname, name);
CLOG_ERR("%s: (%s) GST_STATE_CHANGE_FAILURE.", sname, name);
else if (state_change == GST_STATE_CHANGE_ASYNC)
{
DEBUG_WARN("%s: (%s) GST_STATE_CHANGE_ASYNC.", sname, name);
CLOG_ERR("%s: (%s) GST_STATE_CHANGE_ASYNC.", sname, name);
mdecoder->state = desired_state;
}
else
@ -142,7 +142,7 @@ static GstBuffer *tsmf_get_buffer_from_data(const void *raw_data, gsize size)
if (!data)
{
DEBUG_WARN("Could not allocate %"G_GSIZE_FORMAT" bytes of data.", size);
CLOG_ERR("Could not allocate %"G_GSIZE_FORMAT" bytes of data.", size);
return NULL;
}
@ -154,7 +154,7 @@ static GstBuffer *tsmf_get_buffer_from_data(const void *raw_data, gsize size)
if (!buffer)
{
DEBUG_WARN("Could not create GstBuffer");
CLOG_ERR("Could not create GstBuffer");
free(data);
return NULL;
}
@ -346,7 +346,7 @@ static BOOL tsmf_gstreamer_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *m
NULL);
break;
default:
DEBUG_WARN("unknown format:(%d).", media_type->SubType);
CLOG_ERR("unknown format:(%d).", media_type->SubType);
return FALSE;
}
@ -358,7 +358,7 @@ static BOOL tsmf_gstreamer_set_format(ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *m
if (!buffer)
{
DEBUG_WARN("could not allocate GstBuffer!");
CLOG_ERR("could not allocate GstBuffer!");
return FALSE;
}
@ -416,7 +416,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder)
if (!mdecoder->pipe)
{
DEBUG_WARN("Failed to create new pipe");
CLOG_ERR("Failed to create new pipe");
return FALSE;
}
@ -424,7 +424,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder)
if (!mdecoder->src)
{
DEBUG_WARN("Failed to get appsrc");
CLOG_ERR("Failed to get appsrc");
return FALSE;
}
@ -432,7 +432,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder)
if (!mdecoder->outsink)
{
DEBUG_WARN("Failed to get sink");
CLOG_ERR("Failed to get sink");
return FALSE;
}
@ -442,7 +442,7 @@ BOOL tsmf_gstreamer_pipeline_build(TSMFGstreamerDecoder *mdecoder)
if (!mdecoder->volume)
{
DEBUG_WARN("Failed to get volume");
CLOG_ERR("Failed to get volume");
return FALSE;
}
}
@ -482,7 +482,7 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN
if (!mdecoder)
{
DEBUG_WARN("Decoder not initialized!");
CLOG_ERR("Decoder not initialized!");
return FALSE;
}
@ -498,13 +498,13 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN
if (mdecoder->gst_caps == NULL)
{
DEBUG_WARN("tsmf_gstreamer_set_format not called or invalid format.");
CLOG_ERR("tsmf_gstreamer_set_format not called or invalid format.");
return FALSE;
}
if (!mdecoder->src)
{
DEBUG_WARN("failed to construct pipeline correctly. Unable to push buffer to source element.");
CLOG_ERR("failed to construct pipeline correctly. Unable to push buffer to source element.");
return FALSE;
}
@ -512,7 +512,7 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN
if (gst_buf == NULL)
{
DEBUG_WARN("tsmf_get_buffer_from_data(%p, %d) failed.", data, data_size);
CLOG_ERR("tsmf_get_buffer_from_data(%p, %d) failed.", data, data_size);
return FALSE;
}
@ -534,7 +534,7 @@ static BOOL tsmf_gstreamer_decodeEx(ITSMFDecoder *decoder, const BYTE *data, UIN
GST_SEEK_TYPE_SET, sample_time,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
{
DEBUG_WARN("seek failed");
CLOG_ERR("seek failed");
}
mdecoder->pipeline_start_time_valid = 0;
@ -608,7 +608,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro
if (mdecoder->paused)
{
DEBUG_WARN("%s: Ignoring control PAUSE, already received!", get_type(mdecoder));
CLOG_ERR("%s: Ignoring control PAUSE, already received!", get_type(mdecoder));
return;
}
@ -624,7 +624,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro
if (!mdecoder->paused && !mdecoder->shutdown)
{
DEBUG_WARN("%s: Ignoring control RESUME, already received!", get_type(mdecoder));
CLOG_ERR("%s: Ignoring control RESUME, already received!", get_type(mdecoder));
return;
}
@ -642,7 +642,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro
if (mdecoder->shutdown)
{
DEBUG_WARN("%s: Ignoring control STOP, already received!", get_type(mdecoder));
CLOG_ERR("%s: Ignoring control STOP, already received!", get_type(mdecoder));
return;
}
@ -656,7 +656,7 @@ static void tsmf_gstreamer_control(ITSMFDecoder *decoder, ITSMFControlMsg contro
gst_app_src_end_of_stream((GstAppSrc *)mdecoder->src);
}
else
DEBUG_WARN("Unknown control message %08x", control_msg);
CLOG_ERR("Unknown control message %08x", control_msg);
}
static BOOL tsmf_gstreamer_buffer_filled(ITSMFDecoder *decoder)

View File

@ -72,7 +72,7 @@ static BOOL tsmf_pulse_connect(TSMFPulseAudioDevice *pulse)
return FALSE;
if(pa_context_connect(pulse->context, NULL, 0, NULL))
{
DEBUG_WARN("pa_context_connect failed (%d)",
CLOG_ERR("pa_context_connect failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
@ -80,7 +80,7 @@ static BOOL tsmf_pulse_connect(TSMFPulseAudioDevice *pulse)
if(pa_threaded_mainloop_start(pulse->mainloop) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)",
CLOG_ERR("pa_threaded_mainloop_start failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
@ -120,19 +120,19 @@ static BOOL tsmf_pulse_open(ITSMFAudioDevice *audio, const char *device)
pulse->mainloop = pa_threaded_mainloop_new();
if(!pulse->mainloop)
{
DEBUG_WARN("pa_threaded_mainloop_new failed");
CLOG_ERR("pa_threaded_mainloop_new failed");
return FALSE;
}
pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
if(!pulse->context)
{
DEBUG_WARN("pa_context_new failed");
CLOG_ERR("pa_context_new failed");
return FALSE;
}
pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse);
if(tsmf_pulse_connect(pulse))
{
DEBUG_WARN("tsmf_pulse_connect failed");
CLOG_ERR("tsmf_pulse_connect failed");
return FALSE;
}
DEBUG_TSMF("open device %s", pulse->device);
@ -214,7 +214,7 @@ static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice *pulse)
if(!pulse->stream)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_stream_new failed (%d)",
CLOG_ERR("pa_stream_new failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
@ -233,7 +233,7 @@ static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice *pulse)
NULL, NULL) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_stream_connect_playback failed (%d)",
CLOG_ERR("pa_stream_connect_playback failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
@ -244,7 +244,7 @@ static BOOL tsmf_pulse_open_stream(TSMFPulseAudioDevice *pulse)
break;
if(!PA_STREAM_IS_GOOD(state))
{
DEBUG_WARN("bad stream state (%d)",
CLOG_ERR("bad stream state (%d)",
pa_context_errno(pulse->context));
break;
}

View File

@ -41,7 +41,7 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const
if (audio == NULL)
{
DEBUG_WARN("failed to call export function in %s", name);
CLOG_ERR("failed to call export function in %s", name);
return NULL;
}

View File

@ -264,21 +264,21 @@ static void tsmf_print_guid(const BYTE *guid)
#ifdef WITH_DEBUG_TSMF
int i;
for(i = 3; i >= 0; i--)
fprintf(stderr, "%02X", guid[i]);
fprintf(stderr, "-");
CLOG_ERR( "%02X", guid[i]);
CLOG_ERR( "-");
for(i = 5; i >= 4; i--)
fprintf(stderr, "%02X", guid[i]);
fprintf(stderr, "-");
CLOG_ERR( "%02X", guid[i]);
CLOG_ERR( "-");
for(i = 7; i >= 6; i--)
fprintf(stderr, "%02X", guid[i]);
fprintf(stderr, "-");
CLOG_ERR( "%02X", guid[i]);
CLOG_ERR( "-");
for(i = 8; i < 16; i++)
{
fprintf(stderr, "%02X", guid[i]);
CLOG_ERR( "%02X", guid[i]);
if(i == 9)
fprintf(stderr, "-");
CLOG_ERR( "-");
}
fprintf(stderr, "\n");
CLOG_ERR( "\n");
#endif
}

View File

@ -42,7 +42,7 @@ static ITSMFDecoder *tsmf_load_decoder_by_name(const char *name, TS_AM_MEDIA_TYP
decoder = entry();
if(decoder == NULL)
{
DEBUG_WARN("failed to call export function in %s", name);
CLOG_ERR("failed to call export function in %s", name);
return NULL;
}
if(!decoder->SetFormat(decoder, media_type))

View File

@ -80,7 +80,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN *ifman)
MMREDIR_CAPABILITY_PLATFORM_MF | MMREDIR_CAPABILITY_PLATFORM_DSHOW);
break;
default:
DEBUG_WARN("unknown capability type %d", CapabilityType);
CLOG_ERR("unknown capability type %d", CapabilityType);
break;
}
Stream_SetPosition(ifman->output, pos + cbCapabilityLength);
@ -236,7 +236,7 @@ int tsmf_ifman_shutdown_presentation(TSMF_IFMAN *ifman)
if(presentation)
tsmf_presentation_free(presentation);
else
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
Stream_EnsureRemainingCapacity(ifman->output, 4);
Stream_Write_UINT32(ifman->output, 0); /* Result */
ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB;
@ -261,7 +261,7 @@ int tsmf_ifman_on_stream_volume(TSMF_IFMAN *ifman)
}
else
{
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
}
ifman->output_pending = TRUE;
return 0;
@ -393,13 +393,13 @@ int tsmf_ifman_on_sample(TSMF_IFMAN *ifman)
presentation = tsmf_presentation_find_by_id(ifman->presentation_id);
if(presentation == NULL)
{
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
return 1;
}
stream = tsmf_stream_find_by_id(presentation, StreamId);
if(stream == NULL)
{
DEBUG_WARN("unknown stream id");
CLOG_ERR("unknown stream id");
return 1;
}
tsmf_stream_push_sample(stream, ifman->channel_callback,
@ -420,7 +420,7 @@ int tsmf_ifman_on_flush(TSMF_IFMAN *ifman)
presentation = tsmf_presentation_find_by_id(ifman->presentation_id);
if(presentation == NULL)
{
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
return 1;
}
tsmf_presentation_flush(presentation);
@ -460,7 +460,7 @@ int tsmf_ifman_on_playback_started(TSMF_IFMAN *ifman)
if(presentation)
tsmf_presentation_start(presentation);
else
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
Stream_EnsureRemainingCapacity(ifman->output, 16);
Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
Stream_Write_UINT32(ifman->output, 0); /* StreamId */
@ -480,7 +480,7 @@ int tsmf_ifman_on_playback_paused(TSMF_IFMAN *ifman)
if(presentation)
tsmf_presentation_paused(presentation);
else
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
return 0;
}
@ -494,7 +494,7 @@ int tsmf_ifman_on_playback_restarted(TSMF_IFMAN *ifman)
if(presentation)
tsmf_presentation_restarted(presentation);
else
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
return 0;
}
@ -506,7 +506,7 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN *ifman)
if(presentation)
tsmf_presentation_stop(presentation);
else
DEBUG_WARN("unknown presentation id");
CLOG_ERR("unknown presentation id");
Stream_EnsureRemainingCapacity(ifman->output, 16);
Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
Stream_Write_UINT32(ifman->output, 0); /* StreamId */

View File

@ -89,14 +89,14 @@ void tsmf_playback_ack(IWTSVirtualChannelCallback *pChannelCallback,
Stream_Write_UINT64(s, data_size); /* cbData */
DEBUG_TSMF("response size %d", (int) Stream_GetPosition(s));
if(!callback || !callback->channel || !callback->channel->Write)
DEBUG_WARN("callback=%p, channel=%p, write=%p", callback,
CLOG_ERR("callback=%p, channel=%p, write=%p", callback,
callback->channel, callback->channel->Write);
else
status = callback->channel->Write(callback->channel,
Stream_GetPosition(s), Stream_Buffer(s), NULL);
if(status)
{
DEBUG_WARN("response error %d", status);
CLOG_ERR("response error %d", status);
}
Stream_Free(s, TRUE);
}
@ -108,7 +108,7 @@ BOOL tsmf_push_event(IWTSVirtualChannelCallback *pChannelCallback, wMessage *eve
status = callback->channel_mgr->PushEvent(callback->channel_mgr, event);
if(status)
{
DEBUG_WARN("response error %d", status);
CLOG_ERR("response error %d", status);
return FALSE;
}
return TRUE;
@ -130,7 +130,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, w
/* 2.2.1 Shared Message Header (SHARED_MSG_HEADER) */
if(cbSize < 12)
{
DEBUG_WARN("invalid size. cbSize=%d", cbSize);
CLOG_ERR("invalid size. cbSize=%d", cbSize);
return 1;
}
@ -272,7 +272,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, w
}
if(status == -1)
{
DEBUG_WARN("InterfaceId 0x%X FunctionId 0x%X not processed.",
CLOG_ERR("InterfaceId 0x%X FunctionId 0x%X not processed.",
InterfaceId, FunctionId);
/* When a request is not implemented we return empty response indicating error */
}
@ -289,7 +289,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, w
status = callback->channel->Write(callback->channel, length, Stream_Buffer(output), NULL);
if(status)
{
DEBUG_WARN("response error %d", status);
CLOG_ERR("response error %d", status);
}
}
Stream_Free(output, TRUE);

View File

@ -271,7 +271,7 @@ TSMF_PRESENTATION *tsmf_presentation_new(const BYTE *guid, IWTSVirtualChannelCal
if (!presentation)
{
DEBUG_WARN("calloc failed");
CLOG_ERR("calloc failed");
return NULL;
}
@ -320,7 +320,7 @@ TSMF_PRESENTATION *tsmf_presentation_find_by_id(const BYTE *guid)
ArrayList_Unlock(presentation_list);
if (!found)
DEBUG_WARN("presentation id %s not found", guid_to_string(guid, guid_str, sizeof(guid_str)));
CLOG_ERR("presentation id %s not found", guid_to_string(guid, guid_str, sizeof(guid_str)));
return (found) ? presentation : NULL;
}
@ -902,7 +902,7 @@ TSMF_STREAM *tsmf_stream_new(TSMF_PRESENTATION *presentation, UINT32 stream_id)
if (stream)
{
DEBUG_WARN("duplicated stream id %d!", stream_id);
CLOG_ERR("duplicated stream id %d!", stream_id);
return NULL;
}
@ -910,7 +910,7 @@ TSMF_STREAM *tsmf_stream_new(TSMF_PRESENTATION *presentation, UINT32 stream_id)
if (!stream)
{
DEBUG_WARN("Calloc failed");
CLOG_ERR("Calloc failed");
return NULL;
}
@ -966,7 +966,7 @@ void tsmf_stream_set_format(TSMF_STREAM *stream, const char *name, wStream *s)
if (stream->decoder)
{
DEBUG_WARN("duplicated call");
CLOG_ERR("duplicated call");
return;
}
@ -1071,7 +1071,7 @@ void tsmf_stream_push_sample(TSMF_STREAM *stream, IWTSVirtualChannelCallback *pC
if (!sample)
{
DEBUG_WARN("calloc failed!");
CLOG_ERR("calloc failed!");
return;
}
@ -1087,7 +1087,7 @@ void tsmf_stream_push_sample(TSMF_STREAM *stream, IWTSVirtualChannelCallback *pC
if (!sample->data)
{
DEBUG_WARN("calloc failed!");
CLOG_ERR("calloc failed!");
free(sample);
return;
}

View File

@ -26,12 +26,12 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#ifdef WITH_DEBUG_TSMF
#define DEBUG_TSMF(fmt, ...) DEBUG_CLASS(TSMF, fmt, ## __VA_ARGS__)
#define DEBUG_TSMF(fmt, ...) CLOG_CLASS(TSMF, fmt, ## __VA_ARGS__)
#else
#define DEBUG_TSMF(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_TSMF(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
typedef struct _TS_AM_MEDIA_TYPE

View File

@ -237,7 +237,7 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da
{
case IOCTL_INTERNAL_USB_SUBMIT_URB: /** 0x00220003 */
LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_SUBMIT_URB"));
fprintf(stderr, " Function IOCTL_INTERNAL_USB_SUBMIT_URB: Unchecked\n");
CLOG_ERR( " Function IOCTL_INTERNAL_USB_SUBMIT_URB: Unchecked\n");
break;
case IOCTL_INTERNAL_USB_RESET_PORT: /** 0x00220007 */
@ -269,12 +269,12 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da
case IOCTL_INTERNAL_USB_CYCLE_PORT: /** 0x0022001F */
LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_CYCLE_PORT"));
fprintf(stderr, " Function IOCTL_INTERNAL_USB_CYCLE_PORT: Unchecked\n");
CLOG_ERR( " Function IOCTL_INTERNAL_USB_CYCLE_PORT: Unchecked\n");
break;
case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: /** 0x00220027 */
LLOGLN(urbdrc_debug, ("ioctl: IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION"));
fprintf(stderr, " Function IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: Unchecked\n");
CLOG_ERR( " Function IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION: Unchecked\n");
break;
default:
@ -448,7 +448,7 @@ static int urb_select_configuration(URBDRC_CHANNEL_CALLBACK* callback, BYTE* dat
if (transferDir == 0)
{
fprintf(stderr, "urb_select_configuration: not support transfer out\n");
CLOG_ERR( "urb_select_configuration: not support transfer out\n");
return -1;
}
@ -540,7 +540,7 @@ static int urb_select_interface(URBDRC_CHANNEL_CALLBACK* callback, BYTE* data, U
if (transferDir == 0)
{
fprintf(stderr, "urb_select_interface: not support transfer out\n");
CLOG_ERR( "urb_select_interface: not support transfer out\n");
return -1;
}
@ -1297,7 +1297,7 @@ static int urb_os_feature_descriptor_request(URBDRC_CHANNEL_CALLBACK * callback,
switch (transferDir)
{
case USBD_TRANSFER_DIRECTION_OUT:
fprintf(stderr, "Function urb_os_feature_descriptor_request: OUT Unchecked\n");
CLOG_ERR( "Function urb_os_feature_descriptor_request: OUT Unchecked\n");
memcpy(buffer, data + offset, OutputBufferSize);
break;
case USBD_TRANSFER_DIRECTION_IN:
@ -1700,7 +1700,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE
switch (transferDir)
{
case USBD_TRANSFER_DIRECTION_OUT:
fprintf(stderr, "Function urb_control_feature_request: OUT Unchecked\n");
CLOG_ERR( "Function urb_control_feature_request: OUT Unchecked\n");
memcpy(buffer, data + offset, OutputBufferSize);
bmRequestType |= 0x00;
break;
@ -1718,7 +1718,7 @@ static int urb_control_feature_request(URBDRC_CHANNEL_CALLBACK * callback, BYTE
bmRequest = 0x01; /* REQUEST_CLEAR_FEATURE */
break;
default:
fprintf(stderr, "urb_control_feature_request: Error Command %x\n", command);
CLOG_ERR( "urb_control_feature_request: Error Command %x\n", command);
zfree(out_data);
return -1;
}

View File

@ -201,7 +201,7 @@ static void func_iso_callback(struct libusb_transfer *transfer)
}
else
{
//fprintf(stderr, "actual length %d \n", act_len);
//CLOG_ERR( "actual length %d \n", act_len);
//exit(EXIT_FAILURE);
}
}
@ -362,7 +362,7 @@ static int func_config_release_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle
if (ret < 0)
{
fprintf(stderr, "config_release_all_interface: error num %d\n", ret);
CLOG_ERR( "config_release_all_interface: error num %d\n", ret);
return -1;
}
}
@ -380,7 +380,7 @@ static int func_claim_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle, int Num
if (ret < 0)
{
fprintf(stderr, "claim_all_interface: error num %d\n", ret);
CLOG_ERR( "claim_all_interface: error num %d\n", ret);
return -1;
}
}
@ -394,28 +394,28 @@ static void* print_transfer_status(enum libusb_transfer_status status)
switch (status)
{
case LIBUSB_TRANSFER_COMPLETED:
//fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_COMPLETED\n");
//CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_COMPLETED\n");
break;
case LIBUSB_TRANSFER_ERROR:
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_ERROR\n");
CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_ERROR\n");
break;
case LIBUSB_TRANSFER_TIMED_OUT:
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_TIMED_OUT\n");
CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_TIMED_OUT\n");
break;
case LIBUSB_TRANSFER_CANCELLED:
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_CANCELLED\n");
CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_CANCELLED\n");
break;
case LIBUSB_TRANSFER_STALL:
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_STALL\n");
CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_STALL\n");
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_NO_DEVICE\n");
CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_NO_DEVICE\n");
break;
case LIBUSB_TRANSFER_OVERFLOW:
fprintf(stderr, "Transfer Status: LIBUSB_TRANSFER_OVERFLOW\n");
CLOG_ERR( "Transfer Status: LIBUSB_TRANSFER_OVERFLOW\n");
break;
default:
fprintf(stderr, "Transfer Status: Get unknow error num %d (0x%x)\n",
CLOG_ERR( "Transfer Status: Get unknow error num %d (0x%x)\n",
status, status);
}
return 0;
@ -426,28 +426,28 @@ static void print_status(enum libusb_transfer_status status)
switch (status)
{
case LIBUSB_TRANSFER_COMPLETED:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_COMPLETED\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_COMPLETED\n");
break;
case LIBUSB_TRANSFER_ERROR:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_ERROR\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_ERROR\n");
break;
case LIBUSB_TRANSFER_TIMED_OUT:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_TIMED_OUT\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_TIMED_OUT\n");
break;
case LIBUSB_TRANSFER_CANCELLED:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_CANCELLED\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_CANCELLED\n");
break;
case LIBUSB_TRANSFER_STALL:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_STALL\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_STALL\n");
break;
case LIBUSB_TRANSFER_NO_DEVICE:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_NO_DEVICE\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_NO_DEVICE\n");
break;
case LIBUSB_TRANSFER_OVERFLOW:
fprintf(stderr, "Transfer status: LIBUSB_TRANSFER_OVERFLOW\n");
CLOG_ERR( "Transfer status: LIBUSB_TRANSFER_OVERFLOW\n");
break;
default:
fprintf(stderr, "Transfer status: unknow status %d(0x%x)\n", status, status);
CLOG_ERR( "Transfer status: unknow status %d(0x%x)\n", status, status);
break;
}
}
@ -484,7 +484,7 @@ static LIBUSB_DEVICE_DESCRIPTOR* udev_new_descript(LIBUSB_DEVICE* libusb_dev)
if (ret < 0)
{
fprintf(stderr, "libusb_get_device_descriptor: ERROR!!\n");
CLOG_ERR( "libusb_get_device_descriptor: ERROR!!\n");
free(descriptor);
return NULL;
}
@ -654,7 +654,7 @@ static int libusb_udev_select_interface(IUDEVICE* idev, BYTE InterfaceNumber, BY
if (error < 0)
{
fprintf(stderr, "%s: Set interface altsetting get error num %d\n",
CLOG_ERR( "%s: Set interface altsetting get error num %d\n",
__func__, error);
}
}
@ -681,7 +681,7 @@ static MSUSB_CONFIG_DESCRIPTOR* libusb_udev_complete_msconfig_setup(IUDEVICE* id
LibusbConfig = pdev->LibusbConfig;
if (LibusbConfig->bNumInterfaces != MsConfig->NumInterfaces)
{
fprintf(stderr, "Select Configuration: Libusb NumberInterfaces(%d) is different "
CLOG_ERR( "Select Configuration: Libusb NumberInterfaces(%d) is different "
"with MsConfig NumberInterfaces(%d)\n",
LibusbConfig->bNumInterfaces, MsConfig->NumInterfaces);
}
@ -827,7 +827,7 @@ static int libusb_udev_select_configuration(IUDEVICE* idev, UINT32 bConfiguratio
ret = libusb_set_configuration(libusb_handle, bConfigurationValue);
if (ret < 0){
fprintf(stderr, "libusb_set_configuration: ERROR number %d!!\n", ret);
CLOG_ERR( "libusb_set_configuration: ERROR number %d!!\n", ret);
func_claim_all_interface(libusb_handle, (*LibusbConfig)->bNumInterfaces);
return -1;
}
@ -835,7 +835,7 @@ static int libusb_udev_select_configuration(IUDEVICE* idev, UINT32 bConfiguratio
{
ret = libusb_get_active_config_descriptor (libusb_dev, LibusbConfig);
if (ret < 0){
fprintf(stderr, "libusb_get_config_descriptor_by_value: ERROR number %d!!\n", ret);
CLOG_ERR( "libusb_get_config_descriptor_by_value: ERROR number %d!!\n", ret);
func_claim_all_interface(libusb_handle, (*LibusbConfig)->bNumInterfaces);
return -1;
}
@ -885,7 +885,7 @@ static int libusb_udev_control_pipe_request(IUDEVICE* idev, UINT32 RequestId,
*UsbdStatus = 0;
/*
if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId))
fprintf(stderr, "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
CLOG_ERR( "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
*/
return error;
}
@ -980,12 +980,12 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ
ms_string_desc,
0x12,
Timeout);
//fprintf(stderr, "Get ms string: result number %d", error);
//CLOG_ERR( "Get ms string: result number %d", error);
if (error > 0)
{
BYTE bMS_Vendorcode;
data_read_BYTE(ms_string_desc + 16, bMS_Vendorcode);
//fprintf(stderr, "bMS_Vendorcode:0x%x", bMS_Vendorcode);
//CLOG_ERR( "bMS_Vendorcode:0x%x", bMS_Vendorcode);
/** get os descriptor */
error = libusb_control_transfer(pdev->libusb_handle,
LIBUSB_ENDPOINT_IN |LIBUSB_REQUEST_TYPE_VENDOR | Recipient,
@ -1004,7 +1004,7 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ
*UsbdStatus = USBD_STATUS_SUCCESS;
/*
if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId))
fprintf(stderr, "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
CLOG_ERR( "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
*/
return error;
}
@ -1263,7 +1263,7 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, UINT32 RequestId, UINT32 E
if (iso_transfer == NULL)
{
fprintf(stderr, "Error: libusb_alloc_transfer.\n");
CLOG_ERR( "Error: libusb_alloc_transfer.\n");
status = -1;
}
@ -1368,7 +1368,7 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request
if (!ep_desc)
{
fprintf(stderr, "func_get_ep_desc: endpoint 0x%x is not found!!\n", EndpointAddress);
CLOG_ERR( "func_get_ep_desc: endpoint 0x%x is not found!!\n", EndpointAddress);
return -1;
}
transfer_type = (ep_desc->bmAttributes) & 0x3;
@ -1494,7 +1494,7 @@ static int libusb_udev_bulk_or_interrupt_transfer(IUDEVICE* idev, UINT32 Request
if (request)
{
if(pdev->request_queue->unregister_request(pdev->request_queue, RequestId))
fprintf(stderr, "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
CLOG_ERR( "request_queue_unregister_request: not fount request 0x%x\n", RequestId);
}
libusb_free_transfer(transfer);
@ -1704,7 +1704,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
if (status < 0)
{
fprintf(stderr, "USB init: Error to get HUB handle!!\n");
CLOG_ERR( "USB init: Error to get HUB handle!!\n");
pdev->hub_handle = NULL;
}
@ -1712,7 +1712,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
if (!pdev->devDescriptor)
{
fprintf(stderr, "USB init: Error to get device descriptor!!\n");
CLOG_ERR( "USB init: Error to get device descriptor!!\n");
zfree(pdev);
return NULL;
}
@ -1723,7 +1723,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
if (status < 0)
{
fprintf(stderr, "libusb_get_descriptor: ERROR!!ret:%d\n", status);
CLOG_ERR( "libusb_get_descriptor: ERROR!!ret:%d\n", status);
zfree(pdev);
return NULL;
}
@ -1752,7 +1752,7 @@ static IUDEVICE* udev_init(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_number)
case CLASS_CONTENT_SECURITY:
//case CLASS_WIRELESS_CONTROLLER:
//case CLASS_ELSE_DEVICE:
fprintf(stderr, " Device is not supported!!\n");
CLOG_ERR( " Device is not supported!!\n");
zfree(pdev);
return NULL;
default:
@ -1818,7 +1818,7 @@ int udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE*** devArray)
ssize_t total_device;
int i, status, num = 0;
fprintf(stderr, "VID: 0x%04X PID: 0x%04X\n", idVendor, idProduct);
CLOG_ERR( "VID: 0x%04X PID: 0x%04X\n", idVendor, idProduct);
array = (UDEVICE**) malloc(16 * sizeof(UDEVICE*));
@ -1839,7 +1839,7 @@ int udev_new_by_id(UINT16 idVendor, UINT16 idProduct, IUDEVICE*** devArray)
if (status < 0)
{
fprintf(stderr, "libusb_open: (by id) error: 0x%08X (%d)\n", status, status);
CLOG_ERR( "libusb_open: (by id) error: 0x%08X (%d)\n", status, status);
zfree(descriptor);
zfree(array[num]);
continue;
@ -1876,7 +1876,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number)
if (pDev->libusb_dev == NULL)
{
fprintf(stderr, "libusb_device_new: ERROR!!\n");
CLOG_ERR( "libusb_device_new: ERROR!!\n");
zfree(pDev);
return NULL;
}
@ -1885,7 +1885,7 @@ IUDEVICE* udev_new_by_addr(int bus_number, int dev_number)
if (status < 0)
{
fprintf(stderr, "libusb_open: (by addr) ERROR!!\n");
CLOG_ERR( "libusb_open: (by addr) ERROR!!\n");
zfree(pDev);
return NULL;
}

View File

@ -206,7 +206,7 @@ static int udevman_register_udevice(IUDEVMAN* idevman, int bus_number, int dev_n
}
else
{
fprintf(stderr, "udevman_register_udevice: function error!!");
CLOG_ERR( "udevman_register_udevice: function error!!");
return 0;
}

View File

@ -100,7 +100,7 @@ TRANSFER_REQUEST* request_queue_get_request_by_endpoint(REQUEST_QUEUE* queue, BY
}
}
pthread_mutex_unlock(&queue->request_loading);
fprintf(stderr, "request_queue_get_request_by_id: ERROR!!\n");
CLOG_ERR( "request_queue_get_request_by_id: ERROR!!\n");
return NULL;
}

View File

@ -156,16 +156,16 @@ static void searchman_list_show(USB_SEARCHMAN* self)
int num = 0;
USB_SEARCHDEV* usb;
fprintf(stderr, "=========== Usb Search List ========= \n");
CLOG_ERR( "=========== Usb Search List ========= \n");
self->rewind(self);
while (self->has_next(self))
{
usb = self->get_next(self);
fprintf(stderr, " USB %d: \n", num++);
fprintf(stderr, " idVendor: 0x%04X \n", usb->idVendor);
fprintf(stderr, " idProduct: 0x%04X \n", usb->idProduct);
CLOG_ERR( " USB %d: \n", num++);
CLOG_ERR( " idVendor: 0x%04X \n", usb->idVendor);
CLOG_ERR( " idProduct: 0x%04X \n", usb->idProduct);
}
fprintf(stderr, "================= END =============== \n");
CLOG_ERR( "================= END =============== \n");
}
void searchman_free(USB_SEARCHMAN* self)
@ -202,7 +202,7 @@ USB_SEARCHMAN* searchman_new(void * urbdrc, UINT32 UsbDevice)
if (ret != 0)
{
fprintf(stderr, "searchman mutex initialization: searchman->mutex failed");
CLOG_ERR( "searchman mutex initialization: searchman->mutex failed");
exit(EXIT_FAILURE);
}

View File

@ -32,6 +32,7 @@
#include <freerdp/dvc.h>
#include <freerdp/addin.h>
#include <freerdp/channels/log.h>
#include "urbdrc_types.h"
#include "urbdrc_main.h"
@ -468,7 +469,7 @@ static void* urbdrc_search_usb_device(void* arg)
if (!udev)
{
fprintf(stderr, "Can't create udev\n");
CLOG_ERR( "Can't create udev\n");
return 0;
}
@ -652,7 +653,7 @@ static void* urbdrc_search_usb_device(void* arg)
}
else
{
fprintf(stderr, "No Device from receive_device(). An error occured.\n");
CLOG_ERR( "No Device from receive_device(). An error occured.\n");
}
}
}
@ -835,7 +836,7 @@ static int urbdrc_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
if (transfer_data == NULL)
{
fprintf(stderr, "transfer_data is NULL!!");
CLOG_ERR( "transfer_data is NULL!!");
return 0;
}
@ -1000,7 +1001,7 @@ static void urbdrc_register_udevman_addin(IWTSPlugin* pPlugin, IUDEVMAN* udevman
if (urbdrc->udevman)
{
DEBUG_WARN("existing device, abort.");
CLOG_ERR("existing device, abort.");
return;
}
@ -1025,7 +1026,7 @@ static int urbdrc_load_udevman_addin(IWTSPlugin* pPlugin, const char* name, ADDI
if (entry(&entryPoints) != 0)
{
DEBUG_WARN("%s entry returns error.", name);
CLOG_ERR("%s entry returns error.", name);
return FALSE;
}

View File

@ -27,7 +27,7 @@
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/log.h>
#include <freerdp/utils/msusb.h>
#include <uuid/uuid.h>
@ -37,9 +37,9 @@
#include <winpr/stream.h>
#ifdef WITH_DEBUG_DVC
#define DEBUG_DVC(fmt, ...) DEBUG_CLASS(DVC, fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_CLASS(DVC, fmt, ## __VA_ARGS__)
#else
#define DEBUG_DVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#define DEBUG_DVC(fmt, ...) CLOG_NULL(fmt, ## __VA_ARGS__)
#endif
#define CAPABILITIES_NEGOTIATOR 0x00000000
@ -316,10 +316,10 @@ enum device_descriptor_table
#define MAX_URB_REQUSET_NUM 0x80
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
do { if (_level < LOG_LEVEL) { printf _args ; } } while (0)
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { printf _args ; printf("\n"); } } while (0)
#define LLOG(_level, args) \
do { if (_level < LOG_LEVEL) { CLOG_DBG args ; } } while (0)
#define LLOGLN(_level, args) \
do { if (_level < LOG_LEVEL) { CLOG_DBG args ; } } while (0)
#define dummy_wait_obj(void) do{ sleep(5); } while(0)
#define dummy_wait_s_obj(_s) do{ sleep(_s); } while(0)

View File

@ -141,6 +141,7 @@ BOOL android_pre_connect(freerdp* instance)
static BOOL android_post_connect(freerdp* instance)
{
UINT32 gdi_flags;
rdpSettings *settings = instance->settings;
DEBUG_ANDROID("android_post_connect");
@ -154,9 +155,12 @@ static BOOL android_post_connect(freerdp* instance)
instance->context->cache = cache_new(settings);
gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT |
((instance->settings->ColorDepth > 16) ? CLRBUF_32BPP : CLRBUF_16BPP),
NULL);
if (instance->settings->ColorDepth > 16)
gdi_flags = CLRBUF_32BPP | CLRCONV_ALPHA | CLRCONV_INVERT;
else
gdi_flags = CLRBUF_16BPP;
gdi_init(instance, gdi_flags, NULL);
instance->update->BeginPaint = android_begin_paint;
instance->update->EndPaint = android_end_paint;
@ -270,40 +274,6 @@ static void android_process_channel_event(rdpChannels* channels, freerdp* instan
}
}
static void *jni_update_thread(void *arg)
{
int status;
wMessage message;
wMessageQueue* queue;
freerdp* instance = (freerdp*) arg;
assert( NULL != instance);
DEBUG_ANDROID("Start.");
status = 1;
queue = freerdp_get_message_queue(instance, FREERDP_UPDATE_MESSAGE_QUEUE);
while (MessageQueue_Wait(queue))
{
while (MessageQueue_Peek(queue, &message, TRUE))
{
status = freerdp_message_queue_process_message(instance, FREERDP_UPDATE_MESSAGE_QUEUE, &message);
if (!status)
break;
}
if (!status)
break;
}
DEBUG_ANDROID("Quit.");
ExitThread(0);
return NULL;
}
static void* jni_input_thread(void* arg)
{
HANDLE event[3];
@ -394,11 +364,9 @@ static int android_freerdp_run(freerdp* instance)
const rdpSettings* settings = instance->context->settings;
HANDLE update_thread;
HANDLE input_thread;
HANDLE channels_thread;
BOOL async_update = settings->AsyncUpdate;
BOOL async_input = settings->AsyncInput;
BOOL async_channels = settings->AsyncChannels;
BOOL async_transport = settings->AsyncTransport;
@ -417,12 +385,6 @@ static int android_freerdp_run(freerdp* instance)
return 0;
}
if (async_update)
{
update_thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) jni_update_thread, instance, 0, NULL);
}
if (async_input)
{
input_thread = CreateThread(NULL, 0,
@ -571,15 +533,7 @@ static int android_freerdp_run(freerdp* instance)
WaitForSingleObject(channels_thread, INFINITE);
CloseHandle(channels_thread);
}
if (async_update)
{
wMessageQueue* update_queue = freerdp_get_message_queue(instance, FREERDP_UPDATE_MESSAGE_QUEUE);
MessageQueue_PostQuit(update_queue, 0);
WaitForSingleObject(update_thread, INFINITE);
CloseHandle(update_thread);
}
if (async_input)
{
wMessageQueue* input_queue = freerdp_get_message_queue(instance, FREERDP_INPUT_MESSAGE_QUEUE);
@ -836,44 +790,15 @@ JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(
}
/* store performance settings */
if (disableWallpaper == JNI_TRUE)
settings->DisableWallpaper = TRUE;
if (disableFullWindowDrag == JNI_TRUE)
settings->DisableFullWindowDrag = TRUE;
if (disableMenuAnimations == JNI_TRUE)
settings->DisableMenuAnims = TRUE;
if (disableTheming == JNI_TRUE)
settings->DisableThemes = TRUE;
if (enableFontSmoothing == JNI_TRUE)
settings->AllowFontSmoothing = TRUE;
if(enableDesktopComposition == JNI_TRUE)
settings->AllowDesktopComposition = TRUE;
settings->DisableWallpaper = (disableWallpaper == JNI_TRUE) ? TRUE : FALSE;
settings->DisableFullWindowDrag = (disableFullWindowDrag == JNI_TRUE) ? TRUE : FALSE;
settings->DisableMenuAnims = (disableMenuAnimations == JNI_TRUE) ? TRUE : FALSE;
settings->DisableThemes = (disableTheming == JNI_TRUE) ? TRUE : FALSE;
settings->AllowFontSmoothing = (enableFontSmoothing == JNI_TRUE) ? TRUE : FALSE;
settings->AllowDesktopComposition = (enableDesktopComposition == JNI_TRUE) ? TRUE : FALSE;
/* Create performance flags from settings */
settings->PerformanceFlags = PERF_FLAG_NONE;
if (settings->AllowFontSmoothing)
settings->PerformanceFlags |= PERF_ENABLE_FONT_SMOOTHING;
if (settings->AllowDesktopComposition)
settings->PerformanceFlags |= PERF_ENABLE_DESKTOP_COMPOSITION;
if (settings->DisableWallpaper)
settings->PerformanceFlags |= PERF_DISABLE_WALLPAPER;
if (settings->DisableFullWindowDrag)
settings->PerformanceFlags |= PERF_DISABLE_FULLWINDOWDRAG;
if (settings->DisableMenuAnims)
settings->PerformanceFlags |= PERF_DISABLE_MENUANIMATIONS;
if (settings->DisableThemes)
settings->PerformanceFlags |= PERF_DISABLE_THEMING;
freerdp_performance_flags_make(settings);
DEBUG_ANDROID("performance_flags: %04X", settings->PerformanceFlags);
}
@ -1014,7 +939,7 @@ JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jin
static void copy_pixel_buffer(UINT8* dstBuf, UINT8* srcBuf, int x, int y, int width, int height, int wBuf, int hBuf, int bpp)
{
int i, j;
int i;
int length;
int scanline;
UINT8 *dstp, *srcp;
@ -1025,31 +950,11 @@ static void copy_pixel_buffer(UINT8* dstBuf, UINT8* srcBuf, int x, int y, int wi
srcp = (UINT8*) &srcBuf[(scanline * y) + (x * bpp)];
dstp = (UINT8*) &dstBuf[(scanline * y) + (x * bpp)];
if (bpp == 4)
for (i = 0; i < height; i++)
{
for (i = 0; i < height; i++)
{
for (j = 0; j < width * 4; j += 4)
{
// ARGB <-> ABGR
dstp[j + 0] = srcp[j + 2];
dstp[j + 1] = srcp[j + 1];
dstp[j + 2] = srcp[j + 0];
dstp[j + 3] = srcp[j + 3];
}
srcp += scanline;
dstp += scanline;
}
}
else
{
for (i = 0; i < height; i++)
{
memcpy(dstp, srcp, length);
srcp += scanline;
dstp += scanline;
}
memcpy(dstp, srcp, length);
srcp += scanline;
dstp += scanline;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More