2012-11-06 07:11:13 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* FreeRDP Client Command-Line Interface
|
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/cmdline.h>
|
|
|
|
|
2012-11-18 07:03:04 +04:00
|
|
|
#include <freerdp/addin.h>
|
2012-11-09 23:35:21 +04:00
|
|
|
#include <freerdp/settings.h>
|
2012-11-09 04:01:52 +04:00
|
|
|
#include <freerdp/client/channels.h>
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
#include <freerdp/client/cmdline.h>
|
|
|
|
|
|
|
|
COMMAND_LINE_ARGUMENT_A args[] =
|
|
|
|
{
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "v", COMMAND_LINE_VALUE_REQUIRED, "<server>[:port]", NULL, NULL, -1, NULL, "Server hostname" },
|
|
|
|
{ "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" },
|
|
|
|
{ "w", COMMAND_LINE_VALUE_REQUIRED, "<width>", "1024", NULL, -1, NULL, "Width" },
|
|
|
|
{ "h", COMMAND_LINE_VALUE_REQUIRED, "<height>", "768", NULL, -1, NULL, "Height" },
|
|
|
|
{ "size", COMMAND_LINE_VALUE_REQUIRED, "<width>x<height>", "1024x768", NULL, -1, NULL, "Screen size" },
|
|
|
|
{ "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Fullscreen mode" },
|
|
|
|
{ "bpp", COMMAND_LINE_VALUE_REQUIRED, "<depth>", "16", NULL, -1, NULL, "Session bpp (color depth)" },
|
|
|
|
{ "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "Admin (or console) session" },
|
|
|
|
{ "multimon", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Multi-monitor" },
|
|
|
|
{ "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Work area" },
|
|
|
|
{ "t", COMMAND_LINE_VALUE_REQUIRED, "<title>", NULL, NULL, -1, "title", "Window title" },
|
|
|
|
{ "decorations", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Window decorations" },
|
|
|
|
{ "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, "addin", "Addin" },
|
|
|
|
{ "vc", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Static virtual channel" },
|
|
|
|
{ "dvc", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Dynamic virtual channel" },
|
|
|
|
{ "u", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user>", NULL, NULL, -1, NULL, "Username" },
|
|
|
|
{ "p", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Password" },
|
|
|
|
{ "d", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Domain" },
|
|
|
|
{ "g", COMMAND_LINE_VALUE_REQUIRED, "<gateway>[:port]", NULL, NULL, -1, NULL, "Gateway Hostname" },
|
|
|
|
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user>", NULL, NULL, -1, NULL, "Gateway username" },
|
|
|
|
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
|
|
|
|
{ "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Gateway domain" },
|
|
|
|
{ "app", COMMAND_LINE_VALUE_REQUIRED, "||<alias> or <executable path>", NULL, NULL, -1, NULL, "Remote application program" },
|
|
|
|
{ "app-name", COMMAND_LINE_VALUE_REQUIRED, "<app name>", NULL, NULL, -1, NULL, "Remote application name for user interface" },
|
|
|
|
{ "app-icon", COMMAND_LINE_VALUE_REQUIRED, "<icon path>", NULL, NULL, -1, NULL, "Remote application icon for user interface" },
|
|
|
|
{ "app-cmd", COMMAND_LINE_VALUE_REQUIRED, "<parameters>", NULL, NULL, -1, NULL, "Remote application command-line parameters" },
|
|
|
|
{ "app-file", COMMAND_LINE_VALUE_REQUIRED, "<file name>", NULL, NULL, -1, NULL, "File to open with remote application" },
|
|
|
|
{ "app-guid", COMMAND_LINE_VALUE_REQUIRED, "<app guid>", NULL, NULL, -1, NULL, "Remote application GUID" },
|
|
|
|
{ "z", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Compression" },
|
|
|
|
{ "shell", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Alternate shell" },
|
|
|
|
{ "shell-dir", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Shell working directory" },
|
|
|
|
{ "audio", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Audio output mode" },
|
|
|
|
{ "mic", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Audio input (microphone)" },
|
2012-11-21 04:34:52 +04:00
|
|
|
{ "clipboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect clipboard" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Smooth fonts (cleartype)" },
|
|
|
|
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Desktop composition" },
|
|
|
|
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Full window drag" },
|
|
|
|
{ "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Menu animations" },
|
|
|
|
{ "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Themes" },
|
|
|
|
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Wallpaper" },
|
2012-11-07 07:08:09 +04:00
|
|
|
{ "gdi", COMMAND_LINE_VALUE_REQUIRED, "<sw|hw>", NULL, NULL, -1, NULL, "GDI rendering" },
|
|
|
|
{ "rfx", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "RemoteFX" },
|
|
|
|
{ "rfx-mode", COMMAND_LINE_VALUE_REQUIRED, "<image|video>", NULL, NULL, -1, NULL, "RemoteFX mode" },
|
|
|
|
{ "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Frame acknowledgement" },
|
|
|
|
{ "nsc", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "NSCodec" },
|
2012-11-07 03:49:02 +04:00
|
|
|
{ "nego", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "protocol security negotiation" },
|
|
|
|
{ "sec", COMMAND_LINE_VALUE_REQUIRED, "<rdp|tls|nla|ext>", NULL, NULL, -1, NULL, "force specific protocol security" },
|
|
|
|
{ "sec-rdp", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "rdp protocol security" },
|
|
|
|
{ "sec-tls", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "tls protocol security" },
|
|
|
|
{ "sec-nla", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "nla protocol security" },
|
|
|
|
{ "sec-ext", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "nla extended protocol security" },
|
|
|
|
{ "cert-name", COMMAND_LINE_VALUE_REQUIRED, "<name>", NULL, NULL, -1, NULL, "certificate name" },
|
|
|
|
{ "cert-ignore", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "ignore certificate" },
|
2012-11-15 08:06:56 +04:00
|
|
|
{ "authentication", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "authentication (hack!)" },
|
|
|
|
{ "encryption", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "encryption (hack!)" },
|
2012-11-15 19:00:07 +04:00
|
|
|
{ "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "grab keyboard" },
|
2012-11-07 03:49:02 +04:00
|
|
|
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" },
|
|
|
|
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
|
|
|
|
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
|
2012-11-06 07:11:13 +04:00
|
|
|
};
|
|
|
|
|
2012-11-12 02:23:57 +04:00
|
|
|
BOOL freerdp_detect_new_command_line_syntax(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
|
|
|
|
for (index = 1; index < argc; index++)
|
|
|
|
{
|
|
|
|
if (argv[index][0] == '/')
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
int freerdp_client_print_version()
|
|
|
|
{
|
|
|
|
printf("This is FreeRDP version %s (git %s)\n", FREERDP_VERSION_FULL, GIT_REVISION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-11-07 03:49:02 +04:00
|
|
|
int freerdp_client_print_command_line_help()
|
|
|
|
{
|
|
|
|
char* str;
|
|
|
|
int length;
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
printf("\n");
|
|
|
|
printf("FreeRDP - A Free Remote Desktop Protocol Implementation\n");
|
|
|
|
printf("See www.freerdp.com for more information\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Usage: xfreerdp [file] [options] [/v:<server>[:port]]\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Syntax:\n");
|
|
|
|
printf(" /flag (enables flag)\n");
|
|
|
|
printf(" /option:<value> (specifies option with value)\n");
|
|
|
|
printf(" +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')\n");
|
|
|
|
printf("\n");
|
|
|
|
|
2012-11-07 03:49:02 +04:00
|
|
|
arg = args;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_FLAG)
|
|
|
|
{
|
2012-11-07 07:08:09 +04:00
|
|
|
printf(" %s", "/");
|
2012-11-07 03:49:02 +04:00
|
|
|
printf("%-20s", arg->Name);
|
|
|
|
printf("\t%s\n", arg->Text);
|
|
|
|
}
|
|
|
|
else if ((arg->Flags & COMMAND_LINE_VALUE_REQUIRED) || (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL))
|
|
|
|
{
|
2012-11-07 07:08:09 +04:00
|
|
|
printf(" %s", "/");
|
2012-11-07 03:49:02 +04:00
|
|
|
|
|
|
|
if (arg->Format)
|
|
|
|
{
|
|
|
|
length = strlen(arg->Name) + strlen(arg->Format) + 2;
|
|
|
|
str = malloc(length + 1);
|
|
|
|
sprintf_s(str, length + 1, "%s:%s", arg->Name, arg->Format);
|
|
|
|
printf("%-20s", str);
|
|
|
|
free(str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("%-20s", arg->Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\t%s\n", arg->Text);
|
|
|
|
}
|
|
|
|
else if (arg->Flags & COMMAND_LINE_VALUE_BOOL)
|
|
|
|
{
|
2012-11-07 04:04:00 +04:00
|
|
|
length = strlen(arg->Name) + 32;
|
|
|
|
str = malloc(length + 1);
|
|
|
|
sprintf_s(str, length + 1, "%s (default:%s)", arg->Name,
|
|
|
|
arg->Default ? "on" : "off");
|
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
printf(" %s", arg->Default ? "-" : "+");
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2012-11-07 04:04:00 +04:00
|
|
|
printf("%-20s", str);
|
|
|
|
free(str);
|
2012-11-07 03:49:02 +04:00
|
|
|
|
|
|
|
printf("\t%s\n", arg->Text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Examples:\n");
|
|
|
|
printf(" xfreerdp connection.rdp /p:Pwd123! /f\n");
|
|
|
|
printf(" xfreerdp /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com\n");
|
|
|
|
printf(" xfreerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-11-07 08:07:03 +04:00
|
|
|
int freerdp_client_command_line_pre_filter(void* context, int index, LPCSTR arg)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
|
|
|
if (index == 1)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
rdpSettings* settings;
|
|
|
|
|
|
|
|
length = strlen(arg);
|
|
|
|
|
|
|
|
if (length > 4)
|
|
|
|
{
|
|
|
|
if (_stricmp(&arg[length - 4], ".rdp") == 0)
|
|
|
|
{
|
|
|
|
settings = (rdpSettings*) context;
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->ConnectionFile = _strdup(arg);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-07 03:49:02 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-11-09 04:56:37 +04:00
|
|
|
int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** params)
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
|
|
|
if (strcmp(params[0], "drive") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_DRIVE* drive;
|
|
|
|
|
|
|
|
if (count < 3)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
drive = (RDPDR_DRIVE*) malloc(sizeof(RDPDR_DRIVE));
|
|
|
|
ZeroMemory(drive, sizeof(RDPDR_DRIVE));
|
|
|
|
|
|
|
|
drive->Type = RDPDR_DTYP_FILESYSTEM;
|
|
|
|
drive->Name = _strdup(params[1]);
|
|
|
|
drive->Path = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) drive);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "printer") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_PRINTER* printer;
|
|
|
|
|
|
|
|
if (count < 2)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
printer = (RDPDR_PRINTER*) malloc(sizeof(RDPDR_PRINTER));
|
|
|
|
ZeroMemory(printer, sizeof(RDPDR_PRINTER));
|
|
|
|
|
|
|
|
printer->Type = RDPDR_DTYP_PRINT;
|
|
|
|
printer->Name = _strdup(params[1]);
|
|
|
|
|
|
|
|
if (params[2])
|
|
|
|
printer->DriverName = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "smartcard") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_SMARTCARD* smartcard;
|
|
|
|
|
|
|
|
if (count < 3)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
smartcard = (RDPDR_SMARTCARD*) malloc(sizeof(RDPDR_SMARTCARD));
|
|
|
|
ZeroMemory(smartcard, sizeof(RDPDR_SMARTCARD));
|
|
|
|
|
|
|
|
smartcard->Type = RDPDR_DTYP_SMARTCARD;
|
|
|
|
smartcard->Name = _strdup(params[1]);
|
|
|
|
smartcard->Path = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "serial") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_SERIAL* serial;
|
|
|
|
|
|
|
|
if (count < 3)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
serial = (RDPDR_SERIAL*) malloc(sizeof(RDPDR_SERIAL));
|
|
|
|
ZeroMemory(serial, sizeof(RDPDR_SERIAL));
|
|
|
|
|
|
|
|
serial->Type = RDPDR_DTYP_SERIAL;
|
|
|
|
serial->Name = _strdup(params[1]);
|
|
|
|
serial->Path = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) serial);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "parallel") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_PARALLEL* parallel;
|
|
|
|
|
|
|
|
if (count < 3)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
parallel = (RDPDR_PARALLEL*) malloc(sizeof(RDPDR_PARALLEL));
|
|
|
|
ZeroMemory(parallel, sizeof(RDPDR_PARALLEL));
|
|
|
|
|
|
|
|
parallel->Type = RDPDR_DTYP_PARALLEL;
|
|
|
|
parallel->Name = _strdup(params[1]);
|
|
|
|
parallel->Path = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) parallel);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
int freerdp_client_add_static_channel(rdpSettings* settings, int count, char** params)
|
|
|
|
{
|
|
|
|
int index;
|
2012-11-19 22:26:56 +04:00
|
|
|
ADDIN_ARGV* args;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
args->argc = count;
|
|
|
|
args->argv = (char**) malloc(sizeof(char*) * args->argc);
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
for (index = 0; index < args->argc; index++)
|
|
|
|
args->argv[index] = _strdup(params[index]);
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
freerdp_static_channel_collection_add(settings, args);
|
2012-11-18 09:08:03 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_client_add_dynamic_channel(rdpSettings* settings, int count, char** params)
|
|
|
|
{
|
|
|
|
int index;
|
2012-11-19 22:26:56 +04:00
|
|
|
ADDIN_ARGV* args;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
args->argc = count;
|
|
|
|
args->argv = (char**) malloc(sizeof(char*) * args->argc);
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
for (index = 0; index < args->argc; index++)
|
|
|
|
args->argv[index] = _strdup(params[index]);
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
freerdp_dynamic_channel_collection_add(settings, args);
|
2012-11-18 09:08:03 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char** freerdp_command_line_parse_comma_separated_values(char* list, int* count)
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
char* str;
|
|
|
|
int nArgs;
|
|
|
|
int index;
|
|
|
|
int nCommas;
|
|
|
|
|
|
|
|
nArgs = nCommas = 0;
|
|
|
|
|
|
|
|
for (index = 0; list[index]; index++)
|
|
|
|
nCommas += (list[index] == ',') ? 1 : 0;
|
|
|
|
|
|
|
|
nArgs = nCommas + 1;
|
2012-11-19 02:32:18 +04:00
|
|
|
p = (char**) malloc(sizeof(char*) * (nArgs + 1));
|
|
|
|
ZeroMemory(p, sizeof(char*) * (nArgs + 1));
|
|
|
|
|
|
|
|
str = (char*) list;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
|
|
|
p[0] = str;
|
|
|
|
|
|
|
|
for (index = 1; index < nArgs; index++)
|
|
|
|
{
|
|
|
|
p[index] = strchr(p[index - 1], ',');
|
|
|
|
*p[index] = '\0';
|
|
|
|
p[index]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
p[index] = str + strlen(str);
|
|
|
|
|
|
|
|
*count = nArgs;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2012-11-07 08:07:03 +04:00
|
|
|
int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT_A* arg)
|
|
|
|
{
|
2012-11-09 04:01:52 +04:00
|
|
|
rdpSettings* settings;
|
|
|
|
|
2012-11-07 08:07:03 +04:00
|
|
|
CommandLineSwitchStart(arg)
|
|
|
|
|
|
|
|
CommandLineSwitchCase(arg, "a")
|
|
|
|
{
|
2012-11-18 09:08:03 +04:00
|
|
|
char** p;
|
|
|
|
int count;
|
2012-11-09 04:01:52 +04:00
|
|
|
settings = (rdpSettings*) context;
|
2012-11-07 08:07:03 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
if (freerdp_client_add_device_channel(settings, count, p) > 0)
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2012-11-18 09:08:03 +04:00
|
|
|
settings->DeviceRedirection = TRUE;
|
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "vc")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
settings = (rdpSettings*) context;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
freerdp_client_add_static_channel(settings, count, p);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "dvc")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
settings = (rdpSettings*) context;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
2012-11-07 08:07:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
CommandLineSwitchEnd(arg)
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettings* settings)
|
|
|
|
{
|
|
|
|
char* p;
|
2012-11-07 07:08:09 +04:00
|
|
|
char* str;
|
2012-11-07 03:49:02 +04:00
|
|
|
int length;
|
2012-11-06 07:11:13 +04:00
|
|
|
int status;
|
|
|
|
DWORD flags;
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
|
|
|
|
2012-11-18 07:03:04 +04:00
|
|
|
freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0);
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
flags = COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SIGIL_PLUS_MINUS;
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2012-11-07 08:07:03 +04:00
|
|
|
status = CommandLineParseArgumentsA(argc, (const char**) argv, args, flags, settings,
|
|
|
|
freerdp_client_command_line_pre_filter, freerdp_client_command_line_post_filter);
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-07 03:49:02 +04:00
|
|
|
if (status == COMMAND_LINE_STATUS_PRINT_HELP)
|
|
|
|
{
|
|
|
|
freerdp_client_print_command_line_help();
|
|
|
|
return COMMAND_LINE_STATUS_PRINT_HELP;
|
|
|
|
}
|
|
|
|
else if (status == COMMAND_LINE_STATUS_PRINT_VERSION)
|
|
|
|
{
|
2012-11-07 07:08:09 +04:00
|
|
|
freerdp_client_print_version();
|
2012-11-07 03:49:02 +04:00
|
|
|
return COMMAND_LINE_STATUS_PRINT_VERSION;
|
|
|
|
}
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
arg = args;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
CommandLineSwitchStart(arg)
|
|
|
|
|
|
|
|
CommandLineSwitchCase(arg, "v")
|
|
|
|
{
|
|
|
|
p = strchr(arg->Value, ':');
|
2012-11-07 03:49:02 +04:00
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
length = p - arg->Value;
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->ServerPort = atoi(&p[1]);
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->ServerHostname = (char*) malloc(length + 1);
|
|
|
|
strncpy(settings->ServerHostname, arg->Value, length);
|
|
|
|
settings->ServerHostname[length] = '\0';
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->ServerHostname = _strdup(arg->Value);
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "port")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->ServerPort = atoi(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "w")
|
|
|
|
{
|
2012-11-07 19:33:06 +04:00
|
|
|
settings->DesktopWidth = atoi(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "h")
|
|
|
|
{
|
2012-11-07 19:33:06 +04:00
|
|
|
settings->DesktopHeight = atoi(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "size")
|
|
|
|
{
|
|
|
|
str = _strdup(arg->Value);
|
|
|
|
|
|
|
|
p = strchr(str, 'x');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
*p = '\0';
|
2012-11-07 19:33:06 +04:00
|
|
|
settings->DesktopWidth = atoi(str);
|
|
|
|
settings->DesktopHeight = atoi(&p[1]);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
free(str);
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "f")
|
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->Fullscreen = TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "workarea")
|
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->Workarea = TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "t")
|
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->WindowTitle = _strdup(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "decorations")
|
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->Decorations = arg->Value ? TRUE : FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "bpp")
|
|
|
|
{
|
2012-11-07 19:33:06 +04:00
|
|
|
settings->ColorDepth = atoi(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "u")
|
|
|
|
{
|
2012-11-07 07:08:09 +04:00
|
|
|
p = strchr(arg->Value, '\\');
|
|
|
|
|
|
|
|
if (!p)
|
|
|
|
p = strchr(arg->Value, '@');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
length = p - arg->Value;
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->Domain = (char*) malloc(length + 1);
|
|
|
|
strncpy(settings->Domain, arg->Value, length);
|
|
|
|
settings->Domain[length] = '\0';
|
|
|
|
settings->Username = _strdup(&p[1]);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->Username = _strdup(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "d")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->Domain = _strdup(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "p")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->Password = _strdup(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "g")
|
|
|
|
{
|
|
|
|
p = strchr(arg->Value, ':');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
length = p - arg->Value;
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayPort = atoi(&p[1]);
|
|
|
|
settings->GatewayHostname = (char*) malloc(length + 1);
|
|
|
|
strncpy(settings->GatewayHostname, arg->Value, length);
|
|
|
|
settings->GatewayHostname[length] = '\0';
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayHostname = _strdup(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayUsageMethod = TRUE;
|
2012-11-09 04:56:37 +04:00
|
|
|
settings->GatewayUseSameCredentials = TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gu")
|
|
|
|
{
|
|
|
|
p = strchr(arg->Value, '\\');
|
|
|
|
|
|
|
|
if (!p)
|
|
|
|
p = strchr(arg->Value, '@');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
length = p - arg->Value;
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayDomain = (char*) malloc(length + 1);
|
|
|
|
strncpy(settings->GatewayDomain, arg->Value, length);
|
|
|
|
settings->GatewayDomain[length] = '\0';
|
|
|
|
settings->GatewayUsername = _strdup(&p[1]);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayUsername = _strdup(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayUseSameCredentials = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gd")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayDomain = _strdup(arg->Value);
|
|
|
|
settings->GatewayUseSameCredentials = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gp")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayPassword = _strdup(arg->Value);
|
|
|
|
settings->GatewayUseSameCredentials = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-19 22:26:56 +04:00
|
|
|
CommandLineSwitchCase(arg, "app")
|
|
|
|
{
|
|
|
|
settings->RemoteApplicationProgram = _strdup(arg->Value);
|
|
|
|
|
|
|
|
settings->RemoteApplicationMode = TRUE;
|
|
|
|
settings->RemoteAppLanguageBarSupported = TRUE;
|
|
|
|
settings->Workarea = TRUE;
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-name")
|
|
|
|
{
|
|
|
|
settings->RemoteApplicationName = _strdup(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-icon")
|
|
|
|
{
|
|
|
|
settings->RemoteApplicationIcon = _strdup(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-cmd")
|
|
|
|
{
|
|
|
|
settings->RemoteApplicationCmdLine = _strdup(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-file")
|
|
|
|
{
|
|
|
|
settings->RemoteApplicationFile = _strdup(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-guid")
|
|
|
|
{
|
|
|
|
settings->RemoteApplicationGuid = _strdup(arg->Value);
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "z")
|
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->CompressionEnabled = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-21 04:34:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "clipboard")
|
|
|
|
{
|
|
|
|
settings->RedirectClipboard = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "shell")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->AlternateShell = _strdup(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "shell-dir")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->ShellWorkingDirectory = _strdup(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "fonts")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->AllowFontSmoothing = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "wallpaper")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->DisableWallpaper = arg->Value ? FALSE : TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "window-drag")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->DisableFullWindowDrag = arg->Value ? FALSE : TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "menu-anims")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->DisableMenuAnims = arg->Value ? FALSE : TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "themes")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->DisableThemes = arg->Value ? FALSE : TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "aero")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->AllowDesktopComposition = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "gdi")
|
|
|
|
{
|
|
|
|
if (strcmp(arg->Value, "sw") == 0)
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->SoftwareGdi = TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
else if (strcmp(arg->Value, "hw") == 0)
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->SoftwareGdi = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "rfx")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->RemoteFxCodec = TRUE;
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->FastPathOutput = TRUE;
|
2012-11-07 19:33:06 +04:00
|
|
|
settings->ColorDepth = 32;
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->PerformanceFlags = PERF_FLAG_NONE;
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->LargePointerFlag = TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "rfx-mode")
|
|
|
|
{
|
|
|
|
if (strcmp(arg->Value, "video") == 0)
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->RemoteFxCodecMode = 0x00;
|
2012-11-07 07:08:09 +04:00
|
|
|
else if (strcmp(arg->Value, "image") == 0)
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->RemoteFxCodecMode = 0x02;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "frame-ack")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->FrameAcknowledge = atoi(arg->Value);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "nsc")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->NSCodec = TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "nego")
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->NegotiateSecurityLayer = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "pcid")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
|
|
|
settings->PreconnectionId = atoi(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "pcb")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
|
|
|
settings->PreconnectionBlob = _strdup(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec")
|
|
|
|
{
|
|
|
|
if (strcmp("rdp", arg->Value) == 0) /* Standard RDP */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = TRUE;
|
|
|
|
settings->TlsSecurity = FALSE;
|
|
|
|
settings->NlaSecurity = FALSE;
|
|
|
|
settings->ExtSecurity = FALSE;
|
2012-11-08 08:29:24 +04:00
|
|
|
settings->DisableEncryption = TRUE;
|
|
|
|
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("tls", arg->Value) == 0) /* TLS */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = FALSE;
|
|
|
|
settings->TlsSecurity = TRUE;
|
|
|
|
settings->NlaSecurity = FALSE;
|
|
|
|
settings->ExtSecurity = FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("nla", arg->Value) == 0) /* NLA */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = FALSE;
|
|
|
|
settings->TlsSecurity = FALSE;
|
|
|
|
settings->NlaSecurity = TRUE;
|
|
|
|
settings->ExtSecurity = FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("ext", arg->Value) == 0) /* NLA Extended */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = FALSE;
|
|
|
|
settings->TlsSecurity = FALSE;
|
|
|
|
settings->NlaSecurity = FALSE;
|
|
|
|
settings->ExtSecurity = TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("unknown protocol security: %s\n", arg->Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-rdp")
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-tls")
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->TlsSecurity = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-nla")
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->NlaSecurity = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-ext")
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->ExtSecurity = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "cert-name")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->CertificateName = _strdup(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "cert-ignore")
|
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->IgnoreCertificate = TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-15 08:06:56 +04:00
|
|
|
CommandLineSwitchCase(arg, "authentication")
|
|
|
|
{
|
|
|
|
settings->Authentication = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "encryption")
|
|
|
|
{
|
|
|
|
settings->DisableEncryption = arg->Value ? FALSE : TRUE;
|
|
|
|
}
|
2012-11-15 19:00:07 +04:00
|
|
|
CommandLineSwitchCase(arg, "grab-keyboard")
|
|
|
|
{
|
|
|
|
settings->GrabKeyboard = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchDefault(arg)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CommandLineSwitchEnd(arg)
|
|
|
|
}
|
|
|
|
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->PerformanceFlags = PERF_FLAG_NONE;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (settings->AllowFontSmoothing)
|
|
|
|
settings->PerformanceFlags |= PERF_ENABLE_FONT_SMOOTHING;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (settings->AllowDesktopComposition)
|
|
|
|
settings->PerformanceFlags |= PERF_ENABLE_DESKTOP_COMPOSITION;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (settings->DisableWallpaper)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_WALLPAPER;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (settings->DisableFullWindowDrag)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_FULLWINDOWDRAG;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (settings->DisableMenuAnims)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_MENUANIMATIONS;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
if (settings->DisableThemes)
|
|
|
|
settings->PerformanceFlags |= PERF_DISABLE_THEMING;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
|
|
|
{
|
2012-11-19 02:32:18 +04:00
|
|
|
int index;
|
2012-11-09 04:01:52 +04:00
|
|
|
void* entry = NULL;
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
for (index = 0; index < settings->StaticChannelCount; index++)
|
|
|
|
{
|
|
|
|
ADDIN_ARGV* args;
|
|
|
|
|
|
|
|
args = settings->StaticChannelArray[index];
|
|
|
|
|
2012-11-20 07:31:15 +04:00
|
|
|
entry = freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, 0);
|
2012-11-19 22:26:56 +04:00
|
|
|
|
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, args) == 0)
|
|
|
|
printf("loading channel %s\n", args->argv[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
if (settings->DeviceRedirection)
|
|
|
|
{
|
2012-11-20 07:31:15 +04:00
|
|
|
entry = freerdp_load_channel_addin_entry("rdpdr", NULL, NULL, 0);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
|
|
|
|
printf("loading channel %s\n", "rdpdr");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-21 04:34:52 +04:00
|
|
|
if (settings->RedirectClipboard)
|
|
|
|
{
|
|
|
|
entry = freerdp_load_channel_addin_entry("cliprdr", NULL, NULL, 0);
|
|
|
|
|
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
|
|
|
|
printf("loading channel %s\n", "cliprdr");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
if (settings->RemoteApplicationMode)
|
2012-11-19 02:32:18 +04:00
|
|
|
{
|
2012-11-20 07:31:15 +04:00
|
|
|
entry = freerdp_load_channel_addin_entry("rail", NULL, NULL, 0);
|
2012-11-19 02:32:18 +04:00
|
|
|
|
|
|
|
if (entry)
|
|
|
|
{
|
2012-11-19 22:26:56 +04:00
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
|
|
|
|
printf("loading channel %s\n", "rail");
|
2012-11-19 02:32:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->DynamicChannelCount)
|
|
|
|
{
|
2012-11-20 07:31:15 +04:00
|
|
|
entry = freerdp_load_channel_addin_entry("drdynvc", NULL, NULL, 0);
|
2012-11-19 02:32:18 +04:00
|
|
|
|
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
|
|
|
|
printf("loading channel %s\n", "drdynvc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
return 1;
|
|
|
|
}
|