channels/rdpsnd: refactoring of parameter parsing

This commit is contained in:
Marc-André Moreau 2012-11-18 17:32:18 -05:00
parent 4a472d5536
commit a5d81fcb9a
14 changed files with 271 additions and 133 deletions

View File

@ -29,6 +29,11 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-utils)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-utils)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

View File

@ -32,6 +32,11 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MODULE freerdp
MODULES freerdp-utils)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-utils)
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${ALSA_LIBRARIES})
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

View File

@ -27,6 +27,7 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <alsa/asoundlib.h>
@ -416,14 +417,50 @@ static void rdpsnd_alsa_start(rdpsndDevicePlugin* device)
snd_pcm_start(alsa->out_handle);
}
COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static void rdpsnd_alsa_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV* args)
{
int status;
DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg;
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*) device;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv, rdpsnd_alsa_args, flags, alsa, NULL, NULL);
arg = rdpsnd_alsa_args;
do
{
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
continue;
CommandLineSwitchStart(arg)
CommandLineSwitchCase(arg, "dev")
{
alsa->device_name = _strdup(arg->Value);
}
CommandLineSwitchEnd(arg)
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
}
#ifdef STATIC_CHANNELS
#define freerdp_rdpsnd_client_subsystem_entry alsa_freerdp_rdpsnd_client_subsystem_entry
#endif
int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
{
ADDIN_ARGV* args;
rdpsndAlsaPlugin* alsa;
RDP_PLUGIN_DATA* data;
alsa = xnew(rdpsndAlsaPlugin);
@ -436,17 +473,8 @@ int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pE
alsa->device.Close = rdpsnd_alsa_close;
alsa->device.Free = rdpsnd_alsa_free;
data = pEntryPoints->plugin_data;
if (data && strcmp((char*) data->data[0], "alsa") == 0)
{
alsa->device_name = _strdup((char*) data->data[1]);
}
if (alsa->device_name == NULL)
{
alsa->device_name = _strdup("default");
}
args = pEntryPoints->args;
rdpsnd_alsa_parse_addin_args((rdpsndDevicePlugin*) alsa, args);
alsa->out_handle = 0;
alsa->source_rate = 22050;

View File

@ -203,8 +203,8 @@ static void aq_playback_cb(void* user_data, AudioQueueRef aq_ref, AudioQueueBuff
int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
{
ADDIN_ARGV* args;
rdpsndAudioQPlugin* aqPlugin;
RDP_PLUGIN_DATA* data;
aqPlugin = xnew(rdpsndAudioQPlugin);
@ -217,14 +217,11 @@ int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pE
aqPlugin->device.Close = rdpsnd_audio_close;
aqPlugin->device.Free = rdpsnd_audio_free;
data = pEntryPoints->plugin_data;
args = pEntryPoints->args;
if (data && strcmp((char *)data->data[0], "macaudio") == 0)
if (args->argc > 2)
{
if(strlen((char *)data->data[1]) > 0)
aqPlugin->device_name = strdup((char *)data->data[1]);
else
aqPlugin->device_name = NULL;
/* TODO: parse device name */
}
pEntryPoints->pRegisterRdpsndDevice(pEntryPoints->rdpsnd, (rdpsndDevicePlugin*) aqPlugin);

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <pulse/pulseaudio.h>
@ -523,14 +524,51 @@ static void rdpsnd_pulse_start(rdpsndDevicePlugin* device)
pa_stream_trigger(pulse->stream, NULL, NULL);
}
COMMAND_LINE_ARGUMENT_A rdpsnd_pulse_args[] =
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static void rdpsnd_pulse_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV* args)
{
int status;
DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg;
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*) device;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
rdpsnd_pulse_args, flags, pulse, NULL, NULL);
arg = rdpsnd_pulse_args;
do
{
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
continue;
CommandLineSwitchStart(arg)
CommandLineSwitchCase(arg, "dev")
{
pulse->device_name = _strdup(arg->Value);
}
CommandLineSwitchEnd(arg)
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
}
#ifdef STATIC_CHANNELS
#define freerdp_rdpsnd_client_subsystem_entry pulse_freerdp_rdpsnd_client_subsystem_entry
#endif
int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
{
ADDIN_ARGV* args;
rdpsndPulsePlugin* pulse;
RDP_PLUGIN_DATA* data;
pulse = xnew(rdpsndPulsePlugin);
@ -543,15 +581,8 @@ int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pE
pulse->device.Close = rdpsnd_pulse_close;
pulse->device.Free = rdpsnd_pulse_free;
data = pEntryPoints->plugin_data;
if (data && strcmp((char*)data->data[0], "pulse") == 0)
{
if(data->data[1] && strlen((char*)data->data[1]) > 0)
pulse->device_name = _strdup((char*)data->data[1]);
else
pulse->device_name = NULL;
}
args = pEntryPoints->args;
rdpsnd_pulse_parse_addin_args((rdpsndDevicePlugin*) pulse, args);
pulse->dsp_context = freerdp_dsp_context_new();

View File

@ -31,6 +31,7 @@
#include <string.h>
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
@ -68,6 +69,9 @@ struct rdpsnd_plugin
UINT32 fixed_rate;
int latency;
char* subsystem;
char* device_name;
/* Device plugin */
rdpsndDevicePlugin* device;
};
@ -445,7 +449,7 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug
rdpsnd->device = device;
}
static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RDP_PLUGIN_DATA* data)
static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, ADDIN_ARGV* args)
{
PFREERDP_RDPSND_DEVICE_ENTRY entry;
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
@ -457,7 +461,7 @@ static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RD
entryPoints.rdpsnd = rdpsnd;
entryPoints.pRegisterRdpsndDevice = rdpsnd_register_device_plugin;
entryPoints.plugin_data = data;
entryPoints.args = args;
if (entry(&entryPoints) != 0)
{
@ -468,35 +472,91 @@ static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, RD
return TRUE;
}
static void rdpsnd_process_plugin_data(rdpsndPlugin* rdpsnd, RDP_PLUGIN_DATA* data)
void rdpsnd_set_subsystem(rdpsndPlugin* rdpsnd, char* subsystem)
{
if (strcmp((char*)data->data[0], "format") == 0)
if (rdpsnd->subsystem)
free(rdpsnd->subsystem);
rdpsnd->subsystem = _strdup(subsystem);
}
void rdpsnd_set_device_name(rdpsndPlugin* rdpsnd, char* device_name)
{
if (rdpsnd->device_name)
free(rdpsnd->device_name);
rdpsnd->device_name = _strdup(device_name);
}
COMMAND_LINE_ARGUMENT_A rdpsnd_args[] =
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
static void rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
{
int status;
DWORD flags;
COMMAND_LINE_ARGUMENT_A* arg;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
rdpsnd_args, flags, rdpsnd, NULL, NULL);
arg = rdpsnd_args;
do
{
rdpsnd->fixed_format = atoi(data->data[1]);
}
else if (strcmp((char*)data->data[0], "rate") == 0)
{
rdpsnd->fixed_rate = atoi(data->data[1]);
}
else if (strcmp((char*)data->data[0], "channel") == 0)
{
rdpsnd->fixed_channel = atoi(data->data[1]);
}
else if (strcmp((char*)data->data[0], "latency") == 0)
{
rdpsnd->latency = atoi(data->data[1]);
}
else
{
rdpsnd_load_device_plugin(rdpsnd, (char*) data->data[0], data);
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
continue;
CommandLineSwitchStart(arg)
CommandLineSwitchCase(arg, "sys")
{
rdpsnd_set_subsystem(rdpsnd, arg->Value);
}
CommandLineSwitchCase(arg, "dev")
{
rdpsnd_set_device_name(rdpsnd, arg->Value);
}
CommandLineSwitchCase(arg, "format")
{
rdpsnd->fixed_format = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "rate")
{
rdpsnd->fixed_rate = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "channel")
{
rdpsnd->fixed_channel = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "latency")
{
rdpsnd->latency = atoi(arg->Value);
}
CommandLineSwitchDefault(arg)
{
}
CommandLineSwitchEnd(arg)
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
}
static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
{
ADDIN_ARGV* args;
rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
RDP_PLUGIN_DATA* data;
RDP_PLUGIN_DATA default_data[2] = { { 0 }, { 0 } };
DEBUG_SVC("connecting");
@ -505,42 +565,35 @@ static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
rdpsnd->data_out_list = list_new();
rdpsnd->latency = -1;
data = (RDP_PLUGIN_DATA*) plugin->channel_entry_points.pExtendedData;
args = (ADDIN_ARGV*) plugin->channel_entry_points.pExtendedData;
while (data && data->size > 0)
if (args)
rdpsnd_process_addin_args(rdpsnd, args);
if (rdpsnd->subsystem)
rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
if (!rdpsnd->device)
{
rdpsnd_process_plugin_data(rdpsnd, data);
data = (RDP_PLUGIN_DATA*) (((BYTE*) data) + data->size);
rdpsnd_set_subsystem(rdpsnd, "pulse");
rdpsnd_set_device_name(rdpsnd, "");
rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
}
if (rdpsnd->device == NULL)
if (!rdpsnd->device)
{
default_data[0].size = sizeof(RDP_PLUGIN_DATA);
default_data[0].data[0] = "pulse";
default_data[0].data[1] = "";
if (!rdpsnd_load_device_plugin(rdpsnd, "pulse", default_data))
{
default_data[0].data[0] = "alsa";
default_data[0].data[1] = "default";
if (!rdpsnd_load_device_plugin(rdpsnd, "alsa", default_data))
{
default_data[0].data[0] = "macaudio";
default_data[0].data[1] = "default";
rdpsnd_load_device_plugin(rdpsnd, "macaudio", default_data);
}
else
{
printf("rdpsnd: successfully loaded alsa plugin\n");
}
}
else
{
printf("rdpsnd: successfully loaded pulseaudio plugin\n");
}
rdpsnd_set_subsystem(rdpsnd, "alsa");
rdpsnd_set_device_name(rdpsnd, "default");
rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
}
if (!rdpsnd->device)
{
rdpsnd_set_subsystem(rdpsnd, "macaudio");
rdpsnd_set_device_name(rdpsnd, "default");
rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
}
if (rdpsnd->device == NULL)
{
DEBUG_WARN("no sound device.");

View File

@ -55,7 +55,7 @@ struct _FREERDP_RDPSND_DEVICE_ENTRY_POINTS
{
rdpsndPlugin* rdpsnd;
PREGISTERRDPSNDDEVICE pRegisterRdpsndDevice;
RDP_PLUGIN_DATA* plugin_data;
ADDIN_ARGV* args;
};
typedef struct _FREERDP_RDPSND_DEVICE_ENTRY_POINTS FREERDP_RDPSND_DEVICE_ENTRY_POINTS;
typedef FREERDP_RDPSND_DEVICE_ENTRY_POINTS* PFREERDP_RDPSND_DEVICE_ENTRY_POINTS;

View File

@ -305,17 +305,15 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p
int freerdp_client_add_static_channel(rdpSettings* settings, int count, char** params)
{
int index;
RDP_STATIC_CHANNEL* channel;
ADDIN_ARGV* channel;
channel = (RDP_STATIC_CHANNEL*) malloc(sizeof(RDP_STATIC_CHANNEL));
channel = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
strncpy(channel->Name, params[0], 8);
channel->argc = count - 1;
channel->argc = count;
channel->argv = (char**) malloc(sizeof(char*) * channel->argc);
for (index = 0; index < channel->argc; index++)
channel->argv[index] = _strdup(params[index + 1]);
channel->argv[index] = _strdup(params[index]);
freerdp_static_channel_collection_add(settings, channel);
@ -325,17 +323,15 @@ int freerdp_client_add_static_channel(rdpSettings* settings, int count, char** p
int freerdp_client_add_dynamic_channel(rdpSettings* settings, int count, char** params)
{
int index;
RDP_DYNAMIC_CHANNEL* channel;
ADDIN_ARGV* channel;
channel = (RDP_DYNAMIC_CHANNEL*) malloc(sizeof(RDP_DYNAMIC_CHANNEL));
channel = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
strncpy(channel->Name, params[0], 8);
channel->argc = count - 1;
channel->argc = count;
channel->argv = (char**) malloc(sizeof(char*) * channel->argc);
for (index = 0; index < channel->argc; index++)
channel->argv[index] = _strdup(params[index + 1]);
channel->argv[index] = _strdup(params[index]);
freerdp_dynamic_channel_collection_add(settings, channel);
@ -355,11 +351,11 @@ char** freerdp_command_line_parse_comma_separated_values(char* list, int* count)
for (index = 0; list[index]; index++)
nCommas += (list[index] == ',') ? 1 : 0;
p = (char**) malloc(sizeof(char*) * (nCommas + 1));
ZeroMemory(p, sizeof(char*) * (nCommas + 1));
nArgs = nCommas + 1;
str = _strdup(list);
p = (char**) malloc(sizeof(char*) * (nArgs + 1));
ZeroMemory(p, sizeof(char*) * (nArgs + 1));
str = (char*) list;
p[0] = str;
@ -800,6 +796,7 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
{
int index;
void* entry = NULL;
if (settings->DeviceRedirection)
@ -813,5 +810,31 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
}
}
for (index = 0; index < settings->StaticChannelCount; index++)
{
ADDIN_ARGV* args;
args = settings->StaticChannelArray[index];
entry = freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
if (entry)
{
if (freerdp_channels_client_load(channels, settings, entry, args) == 0)
printf("loading channel %s\n", args->argv[0]);
}
}
if (settings->DynamicChannelCount)
{
entry = freerdp_load_channel_addin_entry("drdynvc", NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
if (entry)
{
if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
printf("loading channel %s\n", "drdynvc");
}
}
return 1;
}

View File

@ -316,21 +316,12 @@ struct rdp_channel
};
typedef struct rdp_channel rdpChannel;
struct _RDP_STATIC_CHANNEL
struct _ADDIN_ARGV
{
char Name[8];
int argc;
char** argv;
};
typedef struct _RDP_STATIC_CHANNEL RDP_STATIC_CHANNEL;
struct _RDP_DYNAMIC_CHANNEL
{
char Name[8];
int argc;
char** argv;
};
typedef struct _RDP_DYNAMIC_CHANNEL RDP_DYNAMIC_CHANNEL;
typedef struct _ADDIN_ARGV ADDIN_ARGV;
/* Extensions */
@ -944,7 +935,7 @@ struct rdp_settings
ALIGN64 UINT32 StaticChannelCount;
ALIGN64 UINT32 StaticChannelArraySize;
ALIGN64 RDP_STATIC_CHANNEL** StaticChannelArray;
ALIGN64 ADDIN_ARGV** StaticChannelArray;
/**
* Dynamic Virtual Channels
@ -952,7 +943,7 @@ struct rdp_settings
ALIGN64 UINT32 DynamicChannelCount;
ALIGN64 UINT32 DynamicChannelArraySize;
ALIGN64 RDP_DYNAMIC_CHANNEL** DynamicChannelArray;
ALIGN64 ADDIN_ARGV** DynamicChannelArray;
/*
* Extensions
@ -968,7 +959,7 @@ FREERDP_API rdpSettings* freerdp_settings_new(void* instance);
FREERDP_API void freerdp_settings_free(rdpSettings* settings);
FREERDP_API void freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device);
FREERDP_API void freerdp_static_channel_collection_add(rdpSettings* settings, RDP_STATIC_CHANNEL* channel);
FREERDP_API void freerdp_dynamic_channel_collection_add(rdpSettings* settings, RDP_DYNAMIC_CHANNEL* channel);
FREERDP_API void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel);
FREERDP_API void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel);
#endif /* FREERDP_SETTINGS_H */

View File

@ -130,6 +130,10 @@ void* freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPath, LPCSTR pszE
library = LoadLibraryA(pszFilePath);
free(pszAddinInstallPath);
free(pszAddinFile);
free(pszFilePath);
if (!library)
return NULL;
@ -138,10 +142,6 @@ void* freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPath, LPCSTR pszE
if (entry)
return entry;
free(pszAddinInstallPath);
free(pszAddinFile);
free(pszFilePath);
return entry;
}

View File

@ -38,24 +38,24 @@ void freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device)
settings->DeviceArray[settings->DeviceCount++] = device;
}
void freerdp_static_channel_collection_add(rdpSettings* settings, RDP_STATIC_CHANNEL* channel)
void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
{
if (settings->StaticChannelArraySize < (settings->StaticChannelCount + 1))
{
settings->StaticChannelArraySize *= 2;
settings->StaticChannelArray = (RDP_STATIC_CHANNEL**)
settings->StaticChannelArray = (ADDIN_ARGV**)
realloc(settings->StaticChannelArray, settings->StaticChannelArraySize);
}
settings->StaticChannelArray[settings->StaticChannelCount++] = channel;
}
void freerdp_dynamic_channel_collection_add(rdpSettings* settings, RDP_DYNAMIC_CHANNEL* channel)
void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
{
if (settings->DynamicChannelArraySize < (settings->DynamicChannelCount + 1))
{
settings->DynamicChannelArraySize *= 2;
settings->DynamicChannelArray = (RDP_DYNAMIC_CHANNEL**)
settings->DynamicChannelArray = (ADDIN_ARGV**)
realloc(settings->DynamicChannelArray, settings->DynamicChannelArraySize);
}

View File

@ -401,14 +401,14 @@ rdpSettings* freerdp_settings_new(void* instance)
ZeroMemory(settings->DeviceArray, sizeof(RDPDR_DEVICE*) * settings->DeviceArraySize);
settings->StaticChannelArraySize = 16;
settings->StaticChannelArray = (RDP_STATIC_CHANNEL**)
malloc(sizeof(RDP_STATIC_CHANNEL*) * settings->StaticChannelArraySize);
ZeroMemory(settings->StaticChannelArray, sizeof(RDP_STATIC_CHANNEL*) * settings->StaticChannelArraySize);
settings->StaticChannelArray = (ADDIN_ARGV**)
malloc(sizeof(ADDIN_ARGV*) * settings->StaticChannelArraySize);
ZeroMemory(settings->StaticChannelArray, sizeof(ADDIN_ARGV*) * settings->StaticChannelArraySize);
settings->DynamicChannelArraySize = 16;
settings->DynamicChannelArray = (RDP_DYNAMIC_CHANNEL**)
malloc(sizeof(RDP_DYNAMIC_CHANNEL*) * settings->DynamicChannelArraySize);
ZeroMemory(settings->DynamicChannelArray, sizeof(RDP_DYNAMIC_CHANNEL*) * settings->DynamicChannelArraySize);
settings->DynamicChannelArray = (ADDIN_ARGV**)
malloc(sizeof(ADDIN_ARGV*) * settings->DynamicChannelArraySize);
ZeroMemory(settings->DynamicChannelArray, sizeof(ADDIN_ARGV*) * settings->DynamicChannelArraySize);
freerdp_detect_paths(settings);

View File

@ -47,10 +47,11 @@
/* Command-Line Parsing Flags */
#define COMMAND_LINE_SIGIL_SLASH 0x00000001
#define COMMAND_LINE_SIGIL_DASH 0x00000002
#define COMMAND_LINE_SIGIL_DOUBLE_DASH 0x00000004
#define COMMAND_LINE_SIGIL_PLUS_MINUS 0x00000008
#define COMMAND_LINE_SIGIL_NONE 0x00000001
#define COMMAND_LINE_SIGIL_SLASH 0x00000002
#define COMMAND_LINE_SIGIL_DASH 0x00000004
#define COMMAND_LINE_SIGIL_DOUBLE_DASH 0x00000008
#define COMMAND_LINE_SIGIL_PLUS_MINUS 0x00000010
#define COMMAND_LINE_SEPARATOR_COLON 0x00000100
#define COMMAND_LINE_SEPARATOR_EQUAL 0x00000200

View File

@ -128,12 +128,16 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
{
sigil_length = 1;
}
else if (flags & COMMAND_LINE_SIGIL_NONE)
{
sigil_length = 0;
}
else
{
continue;
}
if (sigil_length > 0)
if ((sigil_length > 0) || (flags & COMMAND_LINE_SIGIL_NONE))
{
if (length < (sigil_length + 1))
return COMMAND_LINE_ERROR_NO_KEYWORD;