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
|
|
|
|
|
2013-10-02 11:48:25 +04:00
|
|
|
#include <assert.h>
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
#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>
|
2013-10-22 19:14:29 +04:00
|
|
|
#include <freerdp/crypto/crypto.h>
|
2012-11-27 01:49:12 +04:00
|
|
|
#include <freerdp/locale/keyboard.h>
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
#include <freerdp/client/cmdline.h>
|
2013-11-06 20:29:33 +04:00
|
|
|
#include <freerdp/version.h>
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-12-05 21:12:18 +04:00
|
|
|
#include "compatibility.h"
|
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
#include <freerdp/log.h>
|
|
|
|
#define TAG CLIENT_TAG("common.cmdline")
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
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" },
|
2014-08-06 14:19:50 +04:00
|
|
|
{ "size", COMMAND_LINE_VALUE_REQUIRED, "<width>x<height> or <percent>%", "1024x768", NULL, -1, NULL, "Screen size" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "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)" },
|
2012-11-27 01:49:12 +04:00
|
|
|
{ "kbd", COMMAND_LINE_VALUE_REQUIRED, "0x<layout id> or <layout name>", NULL, NULL, -1, NULL, "Keyboard layout" },
|
|
|
|
{ "kbd-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL, "List keyboard layouts" },
|
|
|
|
{ "kbd-type", COMMAND_LINE_VALUE_REQUIRED, "<type id>", NULL, NULL, -1, NULL, "Keyboard type" },
|
|
|
|
{ "kbd-subtype", COMMAND_LINE_VALUE_REQUIRED, "<subtype id>", NULL, NULL, -1, NULL, "Keyboard subtype" },
|
|
|
|
{ "kbd-fn-key", COMMAND_LINE_VALUE_REQUIRED, "<function key count>", NULL, NULL, -1, NULL, "Keyboard function key count" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "Admin (or console) session" },
|
2013-11-06 10:51:55 +04:00
|
|
|
{ "restricted-admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "restrictedAdmin", "Restricted admin mode" },
|
2013-11-06 19:02:58 +04:00
|
|
|
{ "pth", COMMAND_LINE_VALUE_REQUIRED, "<password hash>", NULL, NULL, -1, "pass-the-hash", "Pass the hash (restricted admin mode)" },
|
2013-11-12 04:57:44 +04:00
|
|
|
{ "client-hostname", COMMAND_LINE_VALUE_REQUIRED, "<name>", NULL, NULL, -1, NULL, "Client Hostname to send to server" },
|
2013-04-29 01:10:43 +04:00
|
|
|
{ "multimon", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Use multiple monitors" },
|
2014-03-25 22:39:21 +04:00
|
|
|
{ "span", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Span screen over multiple monitors" },
|
2013-04-29 01:10:43 +04:00
|
|
|
{ "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Use available work area" },
|
2013-04-29 02:48:27 +04:00
|
|
|
{ "monitors", COMMAND_LINE_VALUE_REQUIRED, "<0,1,2...>", NULL, NULL, -1, NULL, "Select monitors to use" },
|
2013-04-29 01:10:43 +04:00
|
|
|
{ "monitor-list", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT, NULL, NULL, NULL, -1, NULL, "List detected monitors" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "t", COMMAND_LINE_VALUE_REQUIRED, "<title>", NULL, NULL, -1, "title", "Window title" },
|
2012-12-05 23:00:49 +04:00
|
|
|
{ "decorations", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueTrue, -1, NULL, "Window decorations" },
|
2013-04-11 00:58:14 +04:00
|
|
|
{ "smart-sizing", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Scale remote desktop to window size" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "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" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "u", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user> or <user>[@<domain>]", NULL, NULL, -1, NULL, "Username" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "p", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Password" },
|
|
|
|
{ "d", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Domain" },
|
2012-11-27 11:49:44 +04:00
|
|
|
{ "g", COMMAND_LINE_VALUE_OPTIONAL, "<gateway>[:port]", NULL, NULL, -1, NULL, "Gateway Hostname" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user> or <user>[@<domain>]", NULL, NULL, -1, NULL, "Gateway username" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
|
|
|
|
{ "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Gateway domain" },
|
2014-05-30 20:31:26 +04:00
|
|
|
{ "gateway-usage-method", COMMAND_LINE_VALUE_REQUIRED, "<direct|detect>", NULL, NULL, -1, NULL, "Gateway usage method" },
|
2013-04-11 19:51:10 +04:00
|
|
|
{ "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "<info string>", NULL, NULL, -1, NULL, "Load balance info" },
|
2013-09-02 21:43:57 +04:00
|
|
|
{ "app", COMMAND_LINE_VALUE_REQUIRED, "<executable path> or <||alias>", NULL, NULL, -1, NULL, "Remote application program" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "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" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "compression", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, "z", "Compression" },
|
2014-03-10 19:16:36 +04:00
|
|
|
{ "compression-level", COMMAND_LINE_VALUE_REQUIRED, "<level>", NULL, NULL, -1, NULL, "Compression level (0,1,2)" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "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" },
|
2013-02-15 04:38:45 +04:00
|
|
|
{ "sound", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, "audio", "Audio output (sound)" },
|
|
|
|
{ "microphone", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, "mic", "Audio input (microphone)" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "audio-mode", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Audio output mode" },
|
2013-02-18 16:49:52 +04:00
|
|
|
{ "multimedia", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, "mmr", "Redirect multimedia (video)" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "network", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Network connection type" },
|
2013-02-18 16:32:15 +04:00
|
|
|
{ "drive", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect drive" },
|
2013-02-15 04:38:45 +04:00
|
|
|
{ "drives", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect all drives" },
|
|
|
|
{ "home-drive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect home drive" },
|
2012-11-21 04:34:52 +04:00
|
|
|
{ "clipboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect clipboard" },
|
2014-03-26 19:05:12 +04:00
|
|
|
{ "serial", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, "tty", "Redirect serial device" },
|
|
|
|
{ "parallel", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Redirect parallel device" },
|
2013-09-12 16:55:25 +04:00
|
|
|
{ "smartcard", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Redirect smartcard device" },
|
2013-05-20 23:50:22 +04:00
|
|
|
{ "printer", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "Redirect printer device" },
|
2013-02-18 16:32:15 +04:00
|
|
|
{ "usb", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect USB device" },
|
2013-05-09 06:14:16 +04:00
|
|
|
{ "multitouch", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect multitouch input" },
|
2013-07-12 01:59:20 +04:00
|
|
|
{ "gestures", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Consume multitouch input locally" },
|
2013-03-13 03:23:59 +04:00
|
|
|
{ "echo", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "echo", "Echo channel" },
|
2013-07-10 00:10:59 +04:00
|
|
|
{ "disp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Display control" },
|
2013-02-18 16:32:15 +04:00
|
|
|
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Smooth fonts (ClearType)" },
|
2012-11-19 22:26:56 +04:00
|
|
|
{ "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" },
|
2013-10-22 07:33:25 +04:00
|
|
|
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, NULL, NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" },
|
2014-07-03 22:35:03 +04:00
|
|
|
{ "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline thin client mode" },
|
|
|
|
{ "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline small cache mode" },
|
|
|
|
{ "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline progressive codec" },
|
|
|
|
{ "gfx-h264", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8.1 graphics pipeline H264 codec" },
|
2012-11-07 07:08:09 +04:00
|
|
|
{ "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" },
|
2013-02-13 06:25:49 +04:00
|
|
|
{ "nsc", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "nscodec", "NSCodec" },
|
2012-11-27 01:49:12 +04:00
|
|
|
{ "jpeg", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "JPEG codec" },
|
|
|
|
{ "jpeg-quality", COMMAND_LINE_VALUE_REQUIRED, "<percentage>", NULL, NULL, -1, NULL, "JPEG quality" },
|
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" },
|
2014-07-17 16:59:06 +04:00
|
|
|
{ "tls-ciphers", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "List of permitted openssl ciphers - see ciphers(1)" },
|
|
|
|
{ "tls-ciphers-netmon", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Use tls ciphers that netmon can parse" },
|
2012-11-07 03:49:02 +04:00
|
|
|
{ "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-12-22 11:39:39 +04:00
|
|
|
{ "pcb", COMMAND_LINE_VALUE_REQUIRED, "<blob>", NULL, NULL, -1, NULL, "Preconnection Blob" },
|
|
|
|
{ "pcid", COMMAND_LINE_VALUE_REQUIRED, "<id>", NULL, NULL, -1, NULL, "Preconnection Id" },
|
2014-02-12 09:43:02 +04:00
|
|
|
{ "spn-class", COMMAND_LINE_VALUE_REQUIRED, "<service class>", NULL, NULL, -1, NULL, "SPN authentication service class" },
|
2014-02-14 09:43:31 +04:00
|
|
|
{ "credentials-delegation", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Disable credentials delegation" },
|
2013-01-09 02:18:34 +04:00
|
|
|
{ "vmconnect", COMMAND_LINE_VALUE_OPTIONAL, "<vmid>", NULL, NULL, -1, NULL, "Hyper-V console (use port 2179, disable negotiation)" },
|
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" },
|
2013-02-28 20:32:46 +04:00
|
|
|
{ "toggle-fullscreen", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Alt+Ctrl+Enter toggles fullscreen" },
|
2012-11-27 01:49:12 +04:00
|
|
|
{ "mouse-motion", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "mouse-motion" },
|
|
|
|
{ "parent-window", COMMAND_LINE_VALUE_REQUIRED, "<window id>", NULL, NULL, -1, NULL, "Parent window id" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "bitmap-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "bitmap cache" },
|
|
|
|
{ "offscreen-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "offscreen bitmap cache" },
|
|
|
|
{ "glyph-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "glyph cache" },
|
2012-11-27 01:49:12 +04:00
|
|
|
{ "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "<rfx|nsc|jpeg>", NULL, NULL, -1, NULL, "bitmap codec cache" },
|
2012-11-26 23:31:31 +04:00
|
|
|
{ "fast-path", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "fast-path input/output" },
|
2013-05-14 12:24:05 +04:00
|
|
|
{ "max-fast-path-size", COMMAND_LINE_VALUE_OPTIONAL, "<size>", NULL, NULL, -1, NULL, "maximum fast-path update size" },
|
2013-01-28 03:22:46 +04:00
|
|
|
{ "async-input", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous input" },
|
|
|
|
{ "async-update", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous update" },
|
2013-03-27 21:03:41 +04:00
|
|
|
{ "async-transport", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous transport (unstable)" },
|
2013-02-19 21:29:15 +04:00
|
|
|
{ "async-channels", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous channels (unstable)" },
|
2013-03-26 18:47:39 +04:00
|
|
|
{ "wm-class", COMMAND_LINE_VALUE_REQUIRED, "<class name>", NULL, NULL, -1, NULL, "set the WM_CLASS hint for the window instance" },
|
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" },
|
2013-05-27 17:28:08 +04:00
|
|
|
{ "play-rfx", COMMAND_LINE_VALUE_REQUIRED, "<pcap file>", NULL, NULL, -1, NULL, "Replay rfx pcap file" },
|
2013-05-27 17:35:25 +04:00
|
|
|
{ "auth-only", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Authenticate only." },
|
2014-02-28 01:55:07 +04:00
|
|
|
{ "auto-reconnect", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Automatic reconnection" },
|
2013-10-22 19:14:29 +04:00
|
|
|
{ "reconnect-cookie", COMMAND_LINE_VALUE_REQUIRED, "<base64 cookie>", NULL, NULL, -1, NULL, "Pass base64 reconnect cookie to the connection" },
|
|
|
|
{ "print-reconnect-cookie", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Print base64 reconnect cookie after connecting" },
|
2014-01-30 07:53:32 +04:00
|
|
|
{ "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support heartbeat PDUs" },
|
|
|
|
{ "multitransport", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support multitransport protocol" },
|
2014-06-30 20:51:27 +04:00
|
|
|
{ "assistance", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Remote assistance password" },
|
2012-11-07 03:49:02 +04:00
|
|
|
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
|
2012-11-06 07:11:13 +04:00
|
|
|
};
|
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
int freerdp_client_print_version()
|
|
|
|
{
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("This is FreeRDP version %s (git %s)\n", FREERDP_VERSION_FULL, GIT_REVISION);
|
2012-11-07 07:08:09 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-11-22 18:06:45 +04:00
|
|
|
int freerdp_client_print_command_line_help(int argc, char** argv)
|
2012-11-07 03:49:02 +04:00
|
|
|
{
|
|
|
|
char* str;
|
|
|
|
int length;
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
2014-09-16 23:07:38 +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: %s [file] [options] [/v:<server>[:port]]\n", argv[0]);
|
|
|
|
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)
|
|
|
|
{
|
2014-09-16 23:07:38 +04:00
|
|
|
printf(" %s", "/");
|
|
|
|
printf("%-20s", arg->Name);
|
|
|
|
printf("\t%s\n", arg->Text);
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
else if ((arg->Flags & COMMAND_LINE_VALUE_REQUIRED) || (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL))
|
|
|
|
{
|
2014-09-16 23:07:38 +04:00
|
|
|
printf(" %s", "/");
|
2012-11-07 03:49:02 +04:00
|
|
|
|
|
|
|
if (arg->Format)
|
|
|
|
{
|
2014-09-12 19:13:01 +04:00
|
|
|
length = (int)(strlen(arg->Name) + strlen(arg->Format) + 2);
|
2013-02-19 04:29:50 +04:00
|
|
|
str = (char*) malloc(length + 1);
|
2012-11-07 03:49:02 +04:00
|
|
|
sprintf_s(str, length + 1, "%s:%s", arg->Name, arg->Format);
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("%-20s", str);
|
2012-11-07 03:49:02 +04:00
|
|
|
free(str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("%-20s", arg->Name);
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\t%s\n", arg->Text);
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
else if (arg->Flags & COMMAND_LINE_VALUE_BOOL)
|
|
|
|
{
|
2014-02-10 10:06:11 +04:00
|
|
|
length = (int) strlen(arg->Name) + 32;
|
2013-02-19 04:29:50 +04:00
|
|
|
str = (char*) malloc(length + 1);
|
2012-11-07 04:04:00 +04:00
|
|
|
sprintf_s(str, length + 1, "%s (default:%s)", arg->Name,
|
2014-09-16 23:07:38 +04:00
|
|
|
arg->Default ? "on" : "off");
|
|
|
|
|
|
|
|
printf(" %s", arg->Default ? "-" : "+");
|
|
|
|
|
|
|
|
printf("%-20s", str);
|
2012-11-07 04:04:00 +04:00
|
|
|
free(str);
|
2014-09-16 23:07:38 +04:00
|
|
|
|
|
|
|
printf("\t%s\n", arg->Text);
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
|
|
|
|
2014-09-16 23:07:38 +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(" xfreerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Clipboard Redirection: +clipboard\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Drive Redirection: /drive:home,/home/user\n");
|
|
|
|
printf("Smartcard Redirection: /smartcard:<device>\n");
|
|
|
|
printf("Printer Redirection: /printer:<device>,<driver>\n");
|
|
|
|
printf("Serial Port Redirection: /serial:<device>\n");
|
|
|
|
printf("Parallel Port Redirection: /parallel:<device>\n");
|
|
|
|
printf("Printer Redirection: /printer:<device>,<driver>\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Audio Output Redirection: /sound:sys:alsa\n");
|
|
|
|
printf("Audio Input Redirection: /microphone:sys:alsa\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("Multimedia Redirection: /multimedia:sys:alsa\n");
|
|
|
|
printf("USB Device Redirection: /usb:id,dev:054c:0268\n");
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("More documentation is coming, in the meantime consult source files\n");
|
|
|
|
printf("\n");
|
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-12-05 21:12:18 +04:00
|
|
|
int freerdp_client_command_line_pre_filter(void* context, int index, int argc, LPCSTR* argv)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
|
|
|
if (index == 1)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
rdpSettings* settings;
|
|
|
|
|
2014-02-10 10:06:11 +04:00
|
|
|
length = (int) strlen(argv[index]);
|
2012-11-07 07:08:09 +04:00
|
|
|
|
|
|
|
if (length > 4)
|
|
|
|
{
|
2012-12-05 21:12:18 +04:00
|
|
|
if (_stricmp(&(argv[index])[length - 4], ".rdp") == 0)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
|
|
|
settings = (rdpSettings*) context;
|
2012-12-05 21:12:18 +04:00
|
|
|
settings->ConnectionFile = _strdup(argv[index]);
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
return 1;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
}
|
2014-06-29 02:33:46 +04:00
|
|
|
|
|
|
|
if (length > 13)
|
|
|
|
{
|
|
|
|
if (_stricmp(&(argv[index])[length - 13], ".msrcIncident") == 0)
|
|
|
|
{
|
|
|
|
settings = (rdpSettings*) context;
|
|
|
|
settings->AssistanceFile = _strdup(argv[index]);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
return 0;
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->DeviceRedirection = TRUE;
|
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
drive = (RDPDR_DRIVE*) calloc(1, sizeof(RDPDR_DRIVE));
|
|
|
|
|
|
|
|
if (!drive)
|
|
|
|
return -1;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
drive->Type = RDPDR_DTYP_FILESYSTEM;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (count > 1)
|
|
|
|
drive->Name = _strdup(params[1]);
|
|
|
|
|
|
|
|
if (count > 2)
|
|
|
|
drive->Path = _strdup(params[2]);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) drive);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "printer") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_PRINTER* printer;
|
|
|
|
|
2013-05-20 23:50:22 +04:00
|
|
|
if (count < 1)
|
2012-11-09 04:01:52 +04:00
|
|
|
return -1;
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectPrinters = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (count > 1)
|
|
|
|
{
|
|
|
|
printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER));
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (!printer)
|
|
|
|
return -1;
|
2013-05-20 23:50:22 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
printer->Type = RDPDR_DTYP_PRINT;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (count > 1)
|
|
|
|
printer->Name = _strdup(params[1]);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (count > 2)
|
|
|
|
printer->DriverName = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer);
|
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "smartcard") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_SMARTCARD* smartcard;
|
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count < 1)
|
2012-11-09 04:01:52 +04:00
|
|
|
return -1;
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectSmartCards = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (count > 1)
|
|
|
|
{
|
|
|
|
smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (!smartcard)
|
|
|
|
return -1;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
smartcard->Type = RDPDR_DTYP_SMARTCARD;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (count > 1)
|
|
|
|
smartcard->Name = _strdup(params[1]);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (count > 2)
|
|
|
|
smartcard->Path = _strdup(params[2]);
|
|
|
|
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard);
|
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "serial") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_SERIAL* serial;
|
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count < 1)
|
2012-11-09 04:01:52 +04:00
|
|
|
return -1;
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectSerialPorts = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
serial = (RDPDR_SERIAL*) calloc(1, sizeof(RDPDR_SERIAL));
|
|
|
|
|
|
|
|
if (!serial)
|
|
|
|
return -1;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
serial->Type = RDPDR_DTYP_SERIAL;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count > 1)
|
|
|
|
serial->Name = _strdup(params[1]);
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count > 2)
|
|
|
|
serial->Path = _strdup(params[2]);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-06-18 20:20:21 +04:00
|
|
|
if (count > 3)
|
|
|
|
serial->Driver = _strdup(params[3]);
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) serial);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "parallel") == 0)
|
|
|
|
{
|
|
|
|
RDPDR_PARALLEL* parallel;
|
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count < 1)
|
2012-11-09 04:01:52 +04:00
|
|
|
return -1;
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectParallelPorts = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
|
|
|
|
2014-03-26 19:05:12 +04:00
|
|
|
parallel = (RDPDR_PARALLEL*) calloc(1, sizeof(RDPDR_PARALLEL));
|
|
|
|
|
|
|
|
if (!parallel)
|
|
|
|
return -1;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
parallel->Type = RDPDR_DTYP_PARALLEL;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count > 1)
|
|
|
|
parallel->Name = _strdup(params[1]);
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2014-04-08 21:23:02 +04:00
|
|
|
if (count > 2)
|
2013-09-12 14:18:35 +04:00
|
|
|
parallel->Path = _strdup(params[2]);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-10-02 11:48:25 +04:00
|
|
|
static char** freerdp_command_line_parse_comma_separated_values(char* list, int* count)
|
2012-11-18 09:08:03 +04:00
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
char* str;
|
|
|
|
int nArgs;
|
|
|
|
int index;
|
|
|
|
int nCommas;
|
|
|
|
|
|
|
|
nArgs = nCommas = 0;
|
|
|
|
|
2013-10-02 11:48:25 +04:00
|
|
|
assert(NULL != count);
|
|
|
|
|
|
|
|
*count = 0;
|
2013-09-12 16:55:25 +04:00
|
|
|
if (!list)
|
|
|
|
return NULL;
|
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-10-02 11:48:25 +04:00
|
|
|
static char** freerdp_command_line_parse_comma_separated_values_offset(char* list, int* count)
|
2013-02-18 16:32:15 +04:00
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values(list, count);
|
|
|
|
|
|
|
|
p = (char**) realloc(p, sizeof(char*) * (*count + 1));
|
|
|
|
MoveMemory(&p[1], p, sizeof(char*) * *count);
|
|
|
|
(*count)++;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2012-11-07 08:07:03 +04:00
|
|
|
int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT_A* arg)
|
|
|
|
{
|
2013-02-19 04:29:50 +04:00
|
|
|
rdpSettings* settings = (rdpSettings*) context;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
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-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;
|
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;
|
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
|
|
|
}
|
2013-02-18 16:49:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "drive")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "drive";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "serial")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "serial";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "parallel")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "parallel";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "smartcard")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "smartcard";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "printer")
|
|
|
|
{
|
2013-05-20 23:50:22 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
2013-02-18 16:49:52 +04:00
|
|
|
|
2013-05-20 23:50:22 +04:00
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "printer";
|
2013-02-18 16:49:52 +04:00
|
|
|
|
2013-05-20 23:50:22 +04:00
|
|
|
freerdp_client_add_device_channel(settings, count, p);
|
2013-02-18 16:49:52 +04:00
|
|
|
|
2013-05-20 23:50:22 +04:00
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "printer";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, count, p);
|
|
|
|
}
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "usb")
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "urbdrc";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
2013-05-09 06:14:16 +04:00
|
|
|
CommandLineSwitchCase(arg, "multitouch")
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count = 1;
|
|
|
|
|
|
|
|
settings->MultiTouchInput = TRUE;
|
|
|
|
|
|
|
|
p[0] = "rdpei";
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
}
|
2013-06-20 02:43:24 +04:00
|
|
|
CommandLineSwitchCase(arg, "gestures")
|
|
|
|
{
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("gestures\n");
|
2013-06-20 02:43:24 +04:00
|
|
|
settings->MultiTouchGestures = TRUE;
|
|
|
|
}
|
2013-03-13 03:23:59 +04:00
|
|
|
CommandLineSwitchCase(arg, "echo")
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "echo";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
}
|
2013-07-10 00:10:59 +04:00
|
|
|
CommandLineSwitchCase(arg, "disp")
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "disp";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
}
|
2013-02-18 16:49:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "sound")
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "rdpsnd";
|
|
|
|
|
|
|
|
freerdp_client_add_static_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "rdpsnd";
|
|
|
|
|
|
|
|
freerdp_client_add_static_channel(settings, count, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "microphone")
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "audin";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "audin";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "multimedia")
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values_offset(arg->Value, &count);
|
|
|
|
p[0] = "tsmf";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "tsmf";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
}
|
|
|
|
}
|
2014-01-30 07:53:32 +04:00
|
|
|
CommandLineSwitchCase(arg, "heartbeat")
|
|
|
|
{
|
|
|
|
settings->SupportHeartbeatPdu = TRUE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "multitransport")
|
|
|
|
{
|
|
|
|
settings->SupportMultitransport = TRUE;
|
|
|
|
settings->MultitransportFlags = (TRANSPORT_TYPE_UDP_FECR | TRANSPORT_TYPE_UDP_FECL | TRANSPORT_TYPE_UDP_PREFERRED);
|
|
|
|
}
|
2012-11-07 08:07:03 +04:00
|
|
|
|
|
|
|
CommandLineSwitchEnd(arg)
|
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
return 0;
|
2012-11-07 08:07:03 +04:00
|
|
|
}
|
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
int freerdp_parse_username(char* username, char** user, char** domain)
|
|
|
|
{
|
|
|
|
char* p;
|
|
|
|
int length;
|
|
|
|
|
|
|
|
p = strchr(username, '\\');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2014-02-10 10:06:11 +04:00
|
|
|
length = (int) (p - username);
|
2012-11-26 23:31:31 +04:00
|
|
|
*domain = (char*) malloc(length + 1);
|
|
|
|
strncpy(*domain, username, length);
|
|
|
|
(*domain)[length] = '\0';
|
|
|
|
*user = _strdup(&p[1]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-16 01:45:06 +04:00
|
|
|
/* Do not break up the name for '@'; both credSSP and the
|
|
|
|
* ClientInfo PDU expect 'user@corp.net' to be transmitted
|
|
|
|
* as username 'user@corp.net', domain empty.
|
|
|
|
*/
|
|
|
|
*user = _strdup(username);
|
|
|
|
*domain = NULL;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-12 18:49:29 +04:00
|
|
|
int freerdp_parse_hostname(char* hostname, char** host, int* port)
|
|
|
|
{
|
|
|
|
char* p;
|
|
|
|
int length;
|
|
|
|
|
|
|
|
p = strrchr(hostname, ':');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
length = (p - hostname);
|
|
|
|
*host = (char*) malloc(length + 1);
|
|
|
|
|
|
|
|
if (!(*host))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
CopyMemory(*host, hostname, length);
|
|
|
|
(*host)[length] = '\0';
|
|
|
|
*port = atoi(p + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*host = _strdup(hostname);
|
|
|
|
|
|
|
|
if (!(*host))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
*port = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
int freerdp_set_connection_type(rdpSettings* settings, int type)
|
|
|
|
{
|
2013-04-23 00:08:47 +04:00
|
|
|
settings->ConnectionType = type;
|
2012-11-26 23:31:31 +04:00
|
|
|
if (type == CONNECTION_TYPE_MODEM)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = FALSE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = TRUE;
|
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_BROADBAND_LOW)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = FALSE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_SATELLITE)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_BROADBAND_HIGH)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_WAN)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = FALSE;
|
|
|
|
settings->AllowFontSmoothing = TRUE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = FALSE;
|
|
|
|
settings->DisableMenuAnims = FALSE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_LAN)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = FALSE;
|
|
|
|
settings->AllowFontSmoothing = TRUE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = FALSE;
|
|
|
|
settings->DisableMenuAnims = FALSE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_AUTODETECT)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = FALSE;
|
|
|
|
settings->AllowFontSmoothing = TRUE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = FALSE;
|
|
|
|
settings->DisableMenuAnims = FALSE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
|
|
|
|
settings->NetworkAutoDetect = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
int freerdp_map_keyboard_layout_name_to_id(char* name)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int id = 0;
|
|
|
|
RDP_KEYBOARD_LAYOUT* layouts;
|
|
|
|
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_STANDARD);
|
|
|
|
for (i = 0; layouts[i].code; i++)
|
|
|
|
{
|
|
|
|
if (_stricmp(layouts[i].name, name) == 0)
|
|
|
|
id = layouts[i].code;
|
|
|
|
}
|
|
|
|
free(layouts);
|
|
|
|
|
|
|
|
if (id)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT);
|
|
|
|
for (i = 0; layouts[i].code; i++)
|
|
|
|
{
|
|
|
|
if (_stricmp(layouts[i].name, name) == 0)
|
|
|
|
id = layouts[i].code;
|
|
|
|
}
|
|
|
|
free(layouts);
|
|
|
|
|
|
|
|
if (id)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME);
|
|
|
|
for (i = 0; layouts[i].code; i++)
|
|
|
|
{
|
|
|
|
if (_stricmp(layouts[i].name, name) == 0)
|
|
|
|
id = layouts[i].code;
|
|
|
|
}
|
|
|
|
free(layouts);
|
|
|
|
|
|
|
|
if (id)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-09-18 01:03:35 +04:00
|
|
|
int freerdp_detect_command_line_pre_filter(void* context, int index, int argc, LPCSTR* argv)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
if (index == 1)
|
|
|
|
{
|
2014-02-10 10:06:11 +04:00
|
|
|
length = (int) strlen(argv[index]);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
|
|
|
if (length > 4)
|
|
|
|
{
|
|
|
|
if (_stricmp(&(argv[index])[length - 4], ".rdp") == 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-05 21:12:18 +04:00
|
|
|
int freerdp_detect_windows_style_command_line_syntax(int argc, char** argv, int* count)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
DWORD flags;
|
|
|
|
int detect_status;
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
|
|
|
|
|
|
|
flags = COMMAND_LINE_SEPARATOR_COLON;
|
|
|
|
flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
|
|
|
|
|
|
|
|
*count = 0;
|
|
|
|
detect_status = 0;
|
|
|
|
CommandLineClearArgumentsA(args);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
|
|
|
status = CommandLineParseArgumentsA(argc, (const char**) argv, args, flags,
|
|
|
|
NULL, freerdp_detect_command_line_pre_filter, NULL);
|
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
arg = args;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
(*count)++;
|
|
|
|
}
|
|
|
|
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
|
|
|
|
detect_status = -1;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
return detect_status;
|
2012-12-05 21:12:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, int* count)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
DWORD flags;
|
|
|
|
int detect_status;
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
|
|
|
|
|
|
|
flags = COMMAND_LINE_SEPARATOR_SPACE;
|
|
|
|
flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
|
|
|
flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
|
|
|
|
|
|
|
|
*count = 0;
|
|
|
|
detect_status = 0;
|
|
|
|
CommandLineClearArgumentsA(args);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
|
|
|
status = CommandLineParseArgumentsA(argc, (const char**) argv, args, flags,
|
|
|
|
NULL, freerdp_detect_command_line_pre_filter, NULL);
|
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
arg = args;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
(*count)++;
|
|
|
|
}
|
|
|
|
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
|
|
|
|
detect_status = -1;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
return detect_status;
|
2012-12-05 21:12:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* flags)
|
|
|
|
{
|
|
|
|
int old_cli_status;
|
|
|
|
int old_cli_count;
|
|
|
|
int posix_cli_status;
|
|
|
|
int posix_cli_count;
|
|
|
|
int windows_cli_status;
|
|
|
|
int windows_cli_count;
|
|
|
|
BOOL compatibility = FALSE;
|
|
|
|
|
|
|
|
windows_cli_status = freerdp_detect_windows_style_command_line_syntax(argc, argv, &windows_cli_count);
|
|
|
|
posix_cli_status = freerdp_detect_posix_style_command_line_syntax(argc, argv, &posix_cli_count);
|
|
|
|
old_cli_status = freerdp_detect_old_command_line_syntax(argc, argv, &old_cli_count);
|
|
|
|
|
|
|
|
/* Default is POSIX syntax */
|
|
|
|
*flags = COMMAND_LINE_SEPARATOR_SPACE;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
|
|
|
|
|
2014-09-17 00:51:01 +04:00
|
|
|
if (posix_cli_status <= COMMAND_LINE_STATUS_PRINT)
|
|
|
|
return compatibility;
|
|
|
|
|
2013-11-10 22:29:20 +04:00
|
|
|
if (windows_cli_count >= posix_cli_count)
|
2012-12-05 21:12:18 +04:00
|
|
|
{
|
|
|
|
*flags = COMMAND_LINE_SEPARATOR_COLON;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
|
|
|
|
}
|
2013-09-09 18:07:14 +04:00
|
|
|
else if (old_cli_status >= 0)
|
2012-12-05 21:12:18 +04:00
|
|
|
{
|
2013-09-18 01:03:35 +04:00
|
|
|
/* Ignore legacy parsing in case there is an error in the command line. */
|
|
|
|
|
2012-12-05 21:12:18 +04:00
|
|
|
if ((old_cli_status == 1) || ((old_cli_count > posix_cli_count) && (old_cli_status != -1)))
|
|
|
|
{
|
|
|
|
*flags = COMMAND_LINE_SEPARATOR_SPACE;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
|
|
|
|
|
|
|
compatibility = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-16 23:07:38 +04:00
|
|
|
WLog_DBG(TAG, "windows: %d/%d posix: %d/%d compat: %d/%d", windows_cli_status, windows_cli_count,
|
|
|
|
posix_cli_status, posix_cli_count, old_cli_status, old_cli_count);
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
return compatibility;
|
|
|
|
}
|
|
|
|
|
2013-10-13 05:07:12 +04:00
|
|
|
int freerdp_client_settings_command_line_status_print(rdpSettings* settings, int status, int argc, char** argv)
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status == COMMAND_LINE_STATUS_PRINT_VERSION)
|
2012-11-07 03:49:02 +04:00
|
|
|
{
|
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-27 01:49:12 +04:00
|
|
|
else if (status == COMMAND_LINE_STATUS_PRINT)
|
|
|
|
{
|
|
|
|
arg = CommandLineFindArgumentA(args, "kbd-list");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
RDP_KEYBOARD_LAYOUT* layouts;
|
|
|
|
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_STANDARD);
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\nKeyboard Layouts\n");
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("0x%08X\t%s\n", (int) layouts[i].code, layouts[i].name);
|
2014-09-12 19:50:42 +04:00
|
|
|
free(layouts);
|
2014-09-12 19:13:01 +04:00
|
|
|
|
2014-09-16 23:07:38 +04:00
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT);
|
|
|
|
printf("\nKeyboard Layout Variants\n");
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("0x%08X\t%s\n", (int) layouts[i].code, layouts[i].name);
|
2014-09-12 19:50:42 +04:00
|
|
|
free(layouts);
|
2014-09-12 19:13:01 +04:00
|
|
|
|
2014-09-16 23:07:38 +04:00
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME);
|
|
|
|
printf("\nKeyboard Input Method Editors (IMEs)\n");
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("0x%08X\t%s\n", (int) layouts[i].code, layouts[i].name);
|
2014-09-12 19:13:01 +04:00
|
|
|
free(layouts);
|
2014-09-16 23:07:38 +04:00
|
|
|
|
|
|
|
printf("\n");
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
|
2013-04-29 01:10:43 +04:00
|
|
|
arg = CommandLineFindArgumentA(args, "monitor-list");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
settings->ListMonitors = TRUE;
|
|
|
|
}
|
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
return COMMAND_LINE_STATUS_PRINT;
|
|
|
|
}
|
2013-09-09 18:07:14 +04:00
|
|
|
else if (status < 0)
|
|
|
|
{
|
|
|
|
freerdp_client_print_command_line_help(argc, argv);
|
|
|
|
return COMMAND_LINE_STATUS_PRINT_HELP;
|
|
|
|
}
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2013-06-15 23:13:38 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
|
2013-10-13 05:07:12 +04:00
|
|
|
int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, int argc, char** argv)
|
2013-06-15 23:13:38 +04:00
|
|
|
{
|
|
|
|
char* p;
|
|
|
|
char* str;
|
|
|
|
int length;
|
|
|
|
int status;
|
|
|
|
DWORD flags;
|
|
|
|
BOOL compatibility;
|
|
|
|
COMMAND_LINE_ARGUMENT_A* arg;
|
|
|
|
|
|
|
|
compatibility = freerdp_client_detect_command_line(argc, argv, &flags);
|
|
|
|
|
|
|
|
if (compatibility)
|
|
|
|
{
|
2014-09-15 21:50:50 +04:00
|
|
|
WLog_WARN(TAG, "Using deprecated command-line interface!");
|
2013-06-15 23:13:38 +04:00
|
|
|
return freerdp_client_parse_old_command_line_arguments(argc, argv, settings);
|
|
|
|
}
|
|
|
|
else
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
2013-06-15 23:13:38 +04:00
|
|
|
CommandLineClearArgumentsA(args);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
2013-06-15 23:13:38 +04:00
|
|
|
status = CommandLineParseArgumentsA(argc, (const char**) argv, args, flags, settings,
|
|
|
|
freerdp_client_command_line_pre_filter, freerdp_client_command_line_post_filter);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
|
2013-06-15 23:13:38 +04:00
|
|
|
arg = CommandLineFindArgumentA(args, "v");
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
arg = args;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2012-11-27 11:49:44 +04:00
|
|
|
if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
2012-11-06 07:11:13 +04:00
|
|
|
continue;
|
|
|
|
|
|
|
|
CommandLineSwitchStart(arg)
|
|
|
|
|
|
|
|
CommandLineSwitchCase(arg, "v")
|
|
|
|
{
|
|
|
|
p = strchr(arg->Value, ':');
|
2012-11-07 03:49:02 +04:00
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2014-02-10 10:06:11 +04:00
|
|
|
length = (int) (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
|
|
|
}
|
|
|
|
}
|
2014-02-12 09:43:02 +04:00
|
|
|
CommandLineSwitchCase(arg, "spn-class")
|
|
|
|
{
|
|
|
|
settings->AuthenticationServiceClass = _strdup(arg->Value);
|
|
|
|
}
|
2014-02-14 09:43:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "credentials-delegation")
|
|
|
|
{
|
|
|
|
settings->DisableCredentialsDelegation = arg->Value ? FALSE : TRUE;
|
|
|
|
}
|
2013-01-09 02:18:34 +04:00
|
|
|
CommandLineSwitchCase(arg, "vmconnect")
|
|
|
|
{
|
|
|
|
settings->ServerPort = 2179;
|
|
|
|
settings->NegotiateSecurityLayer = FALSE;
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
|
|
|
settings->PreconnectionBlob = _strdup(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
|
|
|
}
|
2014-08-06 14:19:50 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
p = strchr(str, '%');
|
|
|
|
if(p)
|
|
|
|
{
|
|
|
|
settings->PercentScreen = atoi(str);
|
|
|
|
}
|
|
|
|
}
|
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-12-13 23:38:02 +04:00
|
|
|
CommandLineSwitchCase(arg, "multimon")
|
|
|
|
{
|
|
|
|
settings->UseMultimon = TRUE;
|
2013-04-25 23:42:40 +04:00
|
|
|
|
2012-12-13 23:38:02 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
if (_stricmp(arg->Value, "force") == 0)
|
|
|
|
{
|
|
|
|
settings->ForceMultimon = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-03-25 22:39:21 +04:00
|
|
|
CommandLineSwitchCase(arg, "span")
|
|
|
|
{
|
|
|
|
settings->SpanMonitors = TRUE;
|
|
|
|
}
|
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
|
|
|
}
|
2013-04-29 02:48:27 +04:00
|
|
|
CommandLineSwitchCase(arg, "monitors")
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
2014-02-11 07:23:59 +04:00
|
|
|
UINT32 i;
|
2013-04-29 02:48:27 +04:00
|
|
|
char** p;
|
2014-02-11 07:23:59 +04:00
|
|
|
int count = 0;
|
2013-04-29 02:48:27 +04:00
|
|
|
|
|
|
|
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
|
|
|
|
|
2014-02-11 07:23:59 +04:00
|
|
|
settings->NumMonitorIds = (UINT32) count;
|
2013-04-29 02:48:27 +04:00
|
|
|
settings->MonitorIds = (UINT32*) malloc(sizeof(UINT32) * settings->NumMonitorIds);
|
|
|
|
|
|
|
|
for (i = 0; i < settings->NumMonitorIds; i++)
|
|
|
|
{
|
|
|
|
settings->MonitorIds[i] = atoi(p[i]);
|
|
|
|
}
|
2013-08-28 18:05:02 +04:00
|
|
|
|
|
|
|
free(p);
|
2013-04-29 02:48:27 +04:00
|
|
|
}
|
|
|
|
}
|
2013-04-29 01:10:43 +04:00
|
|
|
CommandLineSwitchCase(arg, "monitor-list")
|
|
|
|
{
|
|
|
|
settings->ListMonitors = 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
|
|
|
}
|
2013-04-11 00:58:14 +04:00
|
|
|
CommandLineSwitchCase(arg, "smart-sizing")
|
|
|
|
{
|
|
|
|
settings->SmartSizing = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
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
|
|
|
}
|
2012-12-13 16:39:49 +04:00
|
|
|
CommandLineSwitchCase(arg, "admin")
|
|
|
|
{
|
|
|
|
settings->ConsoleSession = TRUE;
|
|
|
|
}
|
2013-11-06 10:51:55 +04:00
|
|
|
CommandLineSwitchCase(arg, "restricted-admin")
|
|
|
|
{
|
|
|
|
settings->ConsoleSession = TRUE;
|
|
|
|
settings->RestrictedAdminModeRequired = TRUE;
|
|
|
|
}
|
2013-11-06 19:02:58 +04:00
|
|
|
CommandLineSwitchCase(arg, "pth")
|
|
|
|
{
|
|
|
|
settings->ConsoleSession = TRUE;
|
|
|
|
settings->RestrictedAdminModeRequired = TRUE;
|
|
|
|
settings->PasswordHash = _strdup(arg->Value);
|
|
|
|
}
|
2013-11-12 04:57:44 +04:00
|
|
|
CommandLineSwitchCase(arg, "client-hostname")
|
|
|
|
{
|
|
|
|
settings->ClientHostname = _strdup(arg->Value);
|
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "kbd")
|
|
|
|
{
|
2014-04-05 00:09:48 +04:00
|
|
|
unsigned long int id;
|
2012-11-27 01:49:12 +04:00
|
|
|
char* pEnd;
|
|
|
|
|
2014-04-05 00:09:48 +04:00
|
|
|
id = strtoul(arg->Value, &pEnd, 16);
|
2012-11-27 01:49:12 +04:00
|
|
|
|
|
|
|
if (pEnd != (arg->Value + strlen(arg->Value)))
|
|
|
|
id = 0;
|
|
|
|
|
|
|
|
if (id == 0)
|
|
|
|
{
|
2014-04-05 00:09:48 +04:00
|
|
|
id = (unsigned long int) freerdp_map_keyboard_layout_name_to_id(arg->Value);
|
2012-11-27 01:49:12 +04:00
|
|
|
|
|
|
|
if (!id)
|
|
|
|
{
|
2014-09-12 19:13:01 +04:00
|
|
|
WLog_ERR(TAG, "Could not identify keyboard layout: %s", arg->Value);
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-05 00:09:48 +04:00
|
|
|
settings->KeyboardLayout = (UINT32) id;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "kbd-type")
|
|
|
|
{
|
|
|
|
settings->KeyboardType = atoi(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "kbd-subtype")
|
|
|
|
{
|
|
|
|
settings->KeyboardSubType = atoi(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "kbd-fn-key")
|
|
|
|
{
|
|
|
|
settings->KeyboardFunctionKey = atoi(arg->Value);
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "u")
|
|
|
|
{
|
2012-11-26 23:31:31 +04:00
|
|
|
char* user;
|
|
|
|
char* domain;
|
2012-11-07 07:08:09 +04:00
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
freerdp_parse_username(arg->Value, &user, &domain);
|
2012-11-07 07:08:09 +04:00
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
settings->Username = user;
|
|
|
|
settings->Domain = domain;
|
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")
|
|
|
|
{
|
2012-11-27 11:49:44 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
2012-11-27 11:49:44 +04:00
|
|
|
p = strchr(arg->Value, ':');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2014-02-10 10:06:11 +04:00
|
|
|
length = (int) (p - arg->Value);
|
2012-11-27 11:49:44 +04:00
|
|
|
settings->GatewayPort = atoi(&p[1]);
|
|
|
|
settings->GatewayHostname = (char*) malloc(length + 1);
|
|
|
|
strncpy(settings->GatewayHostname, arg->Value, length);
|
|
|
|
settings->GatewayHostname[length] = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
settings->GatewayHostname = _strdup(arg->Value);
|
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-27 11:49:44 +04:00
|
|
|
settings->GatewayHostname = _strdup(settings->ServerHostname);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2014-05-30 20:31:26 +04:00
|
|
|
settings->GatewayEnabled = TRUE;
|
2012-11-09 04:56:37 +04:00
|
|
|
settings->GatewayUseSameCredentials = TRUE;
|
2014-03-24 22:44:18 +04:00
|
|
|
|
2014-05-30 20:31:26 +04:00
|
|
|
freerdp_set_gateway_usage_method(settings, TSC_PROXY_MODE_DETECT);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gu")
|
|
|
|
{
|
2012-11-26 23:31:31 +04:00
|
|
|
char* user;
|
|
|
|
char* domain;
|
2012-11-07 07:08:09 +04:00
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
freerdp_parse_username(arg->Value, &user, &domain);
|
2012-11-07 07:08:09 +04:00
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
settings->GatewayUsername = user;
|
|
|
|
settings->GatewayDomain = domain;
|
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
|
|
|
}
|
2014-05-30 20:31:26 +04:00
|
|
|
CommandLineSwitchCase(arg, "gateway-usage-method")
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
char* pEnd;
|
|
|
|
|
|
|
|
type = strtol(arg->Value, &pEnd, 10);
|
|
|
|
|
|
|
|
if (type == 0)
|
|
|
|
{
|
|
|
|
if (_stricmp(arg->Value, "none") == 0)
|
|
|
|
type = TSC_PROXY_MODE_NONE_DIRECT;
|
|
|
|
else if (_stricmp(arg->Value, "direct") == 0)
|
|
|
|
type = TSC_PROXY_MODE_DIRECT;
|
|
|
|
else if (_stricmp(arg->Value, "detect") == 0)
|
|
|
|
type = TSC_PROXY_MODE_DETECT;
|
|
|
|
else if (_stricmp(arg->Value, "default") == 0)
|
|
|
|
type = TSC_PROXY_MODE_DEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
freerdp_set_gateway_usage_method(settings, (UINT32) type);
|
|
|
|
}
|
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;
|
|
|
|
}
|
2013-04-11 19:51:10 +04:00
|
|
|
CommandLineSwitchCase(arg, "load-balance-info")
|
|
|
|
{
|
|
|
|
settings->LoadBalanceInfo = (BYTE*) _strdup(arg->Value);
|
2014-02-10 10:06:11 +04:00
|
|
|
settings->LoadBalanceInfoLength = (UINT32) strlen((char*) settings->LoadBalanceInfo);
|
2013-04-11 19:51:10 +04:00
|
|
|
}
|
2012-11-19 22:26:56 +04:00
|
|
|
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-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "compression")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->CompressionEnabled = arg->Value ? TRUE : FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2014-03-10 19:16:36 +04:00
|
|
|
CommandLineSwitchCase(arg, "compression-level")
|
|
|
|
{
|
|
|
|
settings->CompressionLevel = atoi(arg->Value);
|
|
|
|
}
|
2013-02-15 04:38:45 +04:00
|
|
|
CommandLineSwitchCase(arg, "drives")
|
|
|
|
{
|
|
|
|
settings->RedirectDrives = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "home-drive")
|
|
|
|
{
|
|
|
|
settings->RedirectHomeDrive = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
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-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "audio-mode")
|
|
|
|
{
|
|
|
|
int mode;
|
|
|
|
|
|
|
|
mode = atoi(arg->Value);
|
|
|
|
|
|
|
|
if (mode == AUDIO_MODE_REDIRECT)
|
|
|
|
{
|
|
|
|
settings->AudioPlayback = TRUE;
|
|
|
|
}
|
|
|
|
else if (mode == AUDIO_MODE_PLAY_ON_SERVER)
|
|
|
|
{
|
|
|
|
settings->RemoteConsoleAudio = TRUE;
|
|
|
|
}
|
|
|
|
else if (mode == AUDIO_MODE_NONE)
|
|
|
|
{
|
|
|
|
settings->AudioPlayback = FALSE;
|
|
|
|
settings->RemoteConsoleAudio = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "network")
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
char* pEnd;
|
|
|
|
|
|
|
|
type = strtol(arg->Value, &pEnd, 10);
|
|
|
|
|
|
|
|
if (type == 0)
|
|
|
|
{
|
|
|
|
if (_stricmp(arg->Value, "modem") == 0)
|
|
|
|
type = CONNECTION_TYPE_MODEM;
|
|
|
|
else if (_stricmp(arg->Value, "broadband") == 0)
|
|
|
|
type = CONNECTION_TYPE_BROADBAND_HIGH;
|
|
|
|
else if (_stricmp(arg->Value, "broadband-low") == 0)
|
|
|
|
type = CONNECTION_TYPE_BROADBAND_LOW;
|
|
|
|
else if (_stricmp(arg->Value, "broadband-high") == 0)
|
|
|
|
type = CONNECTION_TYPE_BROADBAND_HIGH;
|
|
|
|
else if (_stricmp(arg->Value, "wan") == 0)
|
|
|
|
type = CONNECTION_TYPE_WAN;
|
|
|
|
else if (_stricmp(arg->Value, "lan") == 0)
|
|
|
|
type = CONNECTION_TYPE_LAN;
|
|
|
|
else if (_stricmp(arg->Value, "auto") == 0)
|
|
|
|
type = CONNECTION_TYPE_AUTODETECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
freerdp_set_connection_type(settings, type);
|
|
|
|
}
|
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")
|
|
|
|
{
|
2013-12-10 21:30:25 +04:00
|
|
|
if (_stricmp(arg->Value, "sw") == 0)
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->SoftwareGdi = TRUE;
|
2013-12-10 21:30:25 +04:00
|
|
|
else if (_stricmp(arg->Value, "hw") == 0)
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->SoftwareGdi = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2013-10-22 07:33:25 +04:00
|
|
|
CommandLineSwitchCase(arg, "gfx")
|
|
|
|
{
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2014-07-03 22:35:03 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-thin-client")
|
|
|
|
{
|
|
|
|
settings->GfxThinClient = arg->Value ? TRUE : FALSE;
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-small-cache")
|
|
|
|
{
|
|
|
|
settings->GfxSmallCache = arg->Value ? TRUE : FALSE;
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-progressive")
|
|
|
|
{
|
|
|
|
settings->GfxProgressive = arg->Value ? TRUE : FALSE;
|
2014-07-30 01:37:46 +04:00
|
|
|
settings->GfxThinClient = settings->GfxProgressive ? FALSE : TRUE;
|
2014-07-03 22:35:03 +04:00
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-h264")
|
|
|
|
{
|
|
|
|
settings->GfxH264 = arg->Value ? TRUE : FALSE;
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2013-10-22 07:33:25 +04:00
|
|
|
}
|
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 03:23:25 +04:00
|
|
|
settings->LargePointerFlag = TRUE;
|
2012-12-14 08:33:24 +04:00
|
|
|
settings->FrameMarkerCommandEnabled = 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;
|
2013-10-10 21:00:04 +04:00
|
|
|
settings->FastPathOutput = TRUE;
|
2013-06-27 23:39:56 +04:00
|
|
|
settings->ColorDepth = 32;
|
2013-10-10 21:00:04 +04:00
|
|
|
settings->LargePointerFlag = TRUE;
|
|
|
|
settings->FrameMarkerCommandEnabled = TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "jpeg")
|
|
|
|
{
|
|
|
|
settings->JpegCodec = TRUE;
|
|
|
|
settings->JpegQuality = 75;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "jpeg-quality")
|
|
|
|
{
|
|
|
|
settings->JpegQuality = atoi(arg->Value) % 100;
|
|
|
|
}
|
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
|
|
|
}
|
2013-01-09 02:18:34 +04:00
|
|
|
CommandLineSwitchCase(arg, "pcb")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
2013-01-09 02:18:34 +04:00
|
|
|
settings->PreconnectionBlob = _strdup(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2013-01-09 02:18:34 +04:00
|
|
|
CommandLineSwitchCase(arg, "pcid")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
2013-01-09 02:18:34 +04:00
|
|
|
settings->PreconnectionId = atoi(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;
|
2014-04-02 16:17:39 +04:00
|
|
|
settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_56BIT| 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
|
|
|
|
{
|
2014-09-12 19:13:01 +04:00
|
|
|
WLog_ERR(TAG, "unknown protocol security: %s", arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2014-07-17 16:59:06 +04:00
|
|
|
CommandLineSwitchCase(arg, "tls-ciphers")
|
|
|
|
{
|
|
|
|
settings->PermittedTLSCiphers = _strdup(arg->Value);
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "tls-ciphers-netmon")
|
|
|
|
{
|
|
|
|
settings->PermittedTLSCiphers = arg->Value ? _strdup("ALL:!ECDH") : NULL;
|
|
|
|
}
|
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;
|
|
|
|
}
|
2013-02-28 20:32:46 +04:00
|
|
|
CommandLineSwitchCase(arg, "toggle-fullscreen")
|
|
|
|
{
|
|
|
|
settings->ToggleFullscreen = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "mouse-motion")
|
|
|
|
{
|
|
|
|
settings->MouseMotion = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "parent-window")
|
|
|
|
{
|
|
|
|
settings->ParentWindowId = strtol(arg->Value, NULL, 0);
|
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "bitmap-cache")
|
|
|
|
{
|
|
|
|
settings->BitmapCacheEnabled = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "offscreen-cache")
|
|
|
|
{
|
2012-11-27 01:49:12 +04:00
|
|
|
settings->OffscreenSupportLevel = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "glyph-cache")
|
|
|
|
{
|
|
|
|
settings->GlyphSupportLevel = arg->Value ? GLYPH_SUPPORT_FULL : GLYPH_SUPPORT_NONE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "codec-cache")
|
|
|
|
{
|
|
|
|
settings->BitmapCacheV3Enabled = TRUE;
|
|
|
|
|
|
|
|
if (strcmp(arg->Value, "rfx") == 0)
|
|
|
|
{
|
|
|
|
settings->RemoteFxCodec = TRUE;
|
|
|
|
}
|
|
|
|
else if (strcmp(arg->Value, "nsc") == 0)
|
|
|
|
{
|
|
|
|
settings->NSCodec = TRUE;
|
|
|
|
}
|
|
|
|
else if (strcmp(arg->Value, "jpeg") == 0)
|
|
|
|
{
|
|
|
|
settings->JpegCodec = TRUE;
|
|
|
|
|
|
|
|
if (settings->JpegQuality == 0)
|
|
|
|
settings->JpegQuality = 75;
|
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "fast-path")
|
|
|
|
{
|
|
|
|
settings->FastPathInput = arg->Value ? TRUE : FALSE;
|
|
|
|
settings->FastPathOutput = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2013-05-14 12:24:05 +04:00
|
|
|
CommandLineSwitchCase(arg, "max-fast-path-size")
|
|
|
|
{
|
|
|
|
settings->MultifragMaxRequestSize = atoi(arg->Value);
|
|
|
|
}
|
2013-01-28 03:22:46 +04:00
|
|
|
CommandLineSwitchCase(arg, "async-input")
|
|
|
|
{
|
|
|
|
settings->AsyncInput = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "async-update")
|
|
|
|
{
|
|
|
|
settings->AsyncUpdate = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2013-02-19 21:29:15 +04:00
|
|
|
CommandLineSwitchCase(arg, "async-channels")
|
|
|
|
{
|
|
|
|
settings->AsyncChannels = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2013-03-27 21:03:41 +04:00
|
|
|
CommandLineSwitchCase(arg, "async-transport")
|
|
|
|
{
|
|
|
|
settings->AsyncTransport = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2013-03-26 18:47:39 +04:00
|
|
|
CommandLineSwitchCase(arg, "wm-class")
|
|
|
|
{
|
|
|
|
settings->WmClass = _strdup(arg->Value);
|
|
|
|
}
|
2013-05-27 17:28:08 +04:00
|
|
|
CommandLineSwitchCase(arg, "play-rfx")
|
|
|
|
{
|
|
|
|
settings->PlayRemoteFxFile = _strdup(arg->Value);
|
|
|
|
settings->PlayRemoteFx = TRUE;
|
|
|
|
}
|
2013-05-27 17:35:25 +04:00
|
|
|
CommandLineSwitchCase(arg, "auth-only")
|
|
|
|
{
|
|
|
|
settings->AuthenticationOnly = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2014-02-28 01:55:07 +04:00
|
|
|
CommandLineSwitchCase(arg, "auto-reconnect")
|
|
|
|
{
|
|
|
|
settings->AutoReconnectionEnabled = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2013-10-22 19:14:29 +04:00
|
|
|
CommandLineSwitchCase(arg, "reconnect-cookie")
|
|
|
|
{
|
|
|
|
BYTE *base64;
|
|
|
|
int length;
|
2014-05-12 00:42:01 +04:00
|
|
|
crypto_base64_decode((const char *) (arg->Value), (int) strlen(arg->Value),
|
|
|
|
&base64, &length);
|
2013-10-22 19:14:29 +04:00
|
|
|
if ((base64 != NULL) && (length == sizeof(ARC_SC_PRIVATE_PACKET)))
|
|
|
|
{
|
|
|
|
memcpy(settings->ServerAutoReconnectCookie, base64, length);
|
|
|
|
free(base64);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-16 23:07:38 +04:00
|
|
|
WLog_ERR(TAG, "reconnect-cookie: invalid base64 '%s'", arg->Value);
|
2013-10-22 19:14:29 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "print-reconnect-cookie")
|
|
|
|
{
|
|
|
|
settings->PrintReconnectCookie = arg->Value ? TRUE : FALSE;
|
|
|
|
}
|
2014-06-29 02:33:46 +04:00
|
|
|
CommandLineSwitchCase(arg, "assistance")
|
|
|
|
{
|
2014-06-30 20:51:27 +04:00
|
|
|
settings->RemoteAssistanceMode = TRUE;
|
|
|
|
settings->RemoteAssistancePassword = _strdup(arg->Value);
|
2014-06-29 02:33:46 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchDefault(arg)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CommandLineSwitchEnd(arg)
|
|
|
|
}
|
|
|
|
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
|
|
|
|
2013-09-17 22:56:23 +04:00
|
|
|
freerdp_performance_flags_make(settings);
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2014-07-03 22:35:03 +04:00
|
|
|
if (settings->SupportGraphicsPipeline)
|
|
|
|
{
|
|
|
|
settings->FastPathOutput = TRUE;
|
|
|
|
settings->ColorDepth = 32;
|
|
|
|
settings->LargePointerFlag = TRUE;
|
|
|
|
settings->FrameMarkerCommandEnabled = TRUE;
|
|
|
|
}
|
|
|
|
|
2014-02-05 20:54:42 +04:00
|
|
|
arg = CommandLineFindArgumentA(args, "port");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
|
|
|
settings->ServerPort = atoi(arg->Value);
|
|
|
|
}
|
|
|
|
|
2012-12-06 01:04:01 +04:00
|
|
|
arg = CommandLineFindArgumentA(args, "p");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
|
|
|
FillMemory(arg->Value, strlen(arg->Value), '*');
|
|
|
|
}
|
|
|
|
|
|
|
|
arg = CommandLineFindArgumentA(args, "gp");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
|
|
|
FillMemory(arg->Value, strlen(arg->Value), '*');
|
|
|
|
}
|
|
|
|
|
2013-07-03 18:41:26 +04:00
|
|
|
return status;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-21 18:30:06 +04:00
|
|
|
int freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings* settings, char* name, void* data)
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2012-11-21 18:30:06 +04:00
|
|
|
void* entry;
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2013-11-06 22:00:10 +04:00
|
|
|
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2012-11-21 18:30:06 +04:00
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, data) == 0)
|
2012-11-19 22:26:56 +04:00
|
|
|
{
|
2014-09-16 11:37:45 +04:00
|
|
|
WLog_INFO(TAG, "loading channel %s", name);
|
2012-11-21 18:30:06 +04:00
|
|
|
return 0;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-21 18:30:06 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
|
|
|
{
|
2014-02-10 10:06:11 +04:00
|
|
|
UINT32 index;
|
2012-11-21 18:30:06 +04:00
|
|
|
ADDIN_ARGV* args;
|
|
|
|
|
2012-11-26 10:34:40 +04:00
|
|
|
if ((freerdp_static_channel_collection_find(settings, "rdpsnd")) ||
|
|
|
|
(freerdp_dynamic_channel_collection_find(settings, "tsmf")))
|
|
|
|
{
|
2013-05-11 00:39:16 +04:00
|
|
|
settings->DeviceRedirection = TRUE; /* rdpsnd requires rdpdr to be registered */
|
2012-11-26 10:34:40 +04:00
|
|
|
settings->AudioPlayback = TRUE; /* Both rdpsnd and tsmf require this flag to be set */
|
|
|
|
}
|
2012-11-26 10:15:11 +04:00
|
|
|
|
2013-05-17 17:29:53 +04:00
|
|
|
if (freerdp_dynamic_channel_collection_find(settings, "audin"))
|
|
|
|
{
|
|
|
|
settings->AudioCapture = TRUE;
|
|
|
|
}
|
|
|
|
|
2014-01-30 07:53:32 +04:00
|
|
|
if (settings->NetworkAutoDetect ||
|
|
|
|
settings->SupportHeartbeatPdu ||
|
|
|
|
settings->SupportMultitransport)
|
|
|
|
{
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->DeviceRedirection = TRUE; /* these RDP8 features require rdpdr to be registered */
|
2014-01-30 07:53:32 +04:00
|
|
|
}
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (settings->RedirectDrives || settings->RedirectHomeDrive || settings->RedirectSerialPorts
|
|
|
|
|| settings->RedirectSmartCards || settings->RedirectPrinters)
|
2013-02-15 04:38:45 +04:00
|
|
|
{
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->DeviceRedirection = TRUE; /* All of these features require rdpdr */
|
|
|
|
}
|
2013-02-15 04:38:45 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (settings->RedirectDrives)
|
|
|
|
{
|
2013-02-15 04:38:45 +04:00
|
|
|
if (!freerdp_device_collection_find(settings, "drive"))
|
|
|
|
{
|
|
|
|
char* params[3];
|
|
|
|
|
|
|
|
params[0] = "drive";
|
|
|
|
params[1] = "media";
|
|
|
|
params[2] = "*";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, 3, (char**) params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->RedirectHomeDrive)
|
|
|
|
{
|
|
|
|
if (!freerdp_device_collection_find(settings, "drive"))
|
|
|
|
{
|
|
|
|
char* params[3];
|
|
|
|
|
|
|
|
params[0] = "drive";
|
|
|
|
params[1] = "home";
|
|
|
|
params[2] = "%";
|
|
|
|
|
|
|
|
freerdp_client_add_device_channel(settings, 3, (char**) params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
if (settings->DeviceRedirection)
|
|
|
|
{
|
2012-11-21 18:30:06 +04:00
|
|
|
freerdp_client_load_static_channel_addin(channels, settings, "rdpdr", settings);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2012-11-21 18:30:06 +04:00
|
|
|
if (!freerdp_static_channel_collection_find(settings, "rdpsnd"))
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2012-11-21 18:30:06 +04:00
|
|
|
char* params[2];
|
|
|
|
|
|
|
|
params[0] = "rdpsnd";
|
|
|
|
params[1] = "sys:fake";
|
|
|
|
|
|
|
|
freerdp_client_add_static_channel(settings, 2, (char**) params);
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (settings->RedirectSmartCards)
|
|
|
|
{
|
|
|
|
RDPDR_SMARTCARD* smartcard;
|
|
|
|
|
|
|
|
smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
|
|
|
|
|
|
|
|
if (!smartcard)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
smartcard->Type = RDPDR_DTYP_SMARTCARD;
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->RedirectPrinters)
|
|
|
|
{
|
|
|
|
RDPDR_PRINTER* printer;
|
|
|
|
|
|
|
|
printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER));
|
|
|
|
|
|
|
|
if (!printer)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
printer->Type = RDPDR_DTYP_PRINT;
|
|
|
|
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer);
|
|
|
|
}
|
|
|
|
|
2012-11-21 20:56:40 +04:00
|
|
|
if (settings->RedirectClipboard)
|
2012-11-21 04:34:52 +04:00
|
|
|
{
|
2012-11-21 20:56:40 +04:00
|
|
|
if (!freerdp_static_channel_collection_find(settings, "cliprdr"))
|
|
|
|
{
|
|
|
|
char* params[1];
|
|
|
|
|
|
|
|
params[0] = "cliprdr";
|
|
|
|
|
|
|
|
freerdp_client_add_static_channel(settings, 1, (char**) params);
|
|
|
|
}
|
2012-11-21 18:30:06 +04:00
|
|
|
}
|
2012-11-21 04:34:52 +04:00
|
|
|
|
2014-06-29 02:33:46 +04:00
|
|
|
if (settings->RemoteAssistanceMode)
|
|
|
|
{
|
2014-06-30 20:51:27 +04:00
|
|
|
freerdp_client_load_static_channel_addin(channels, settings, "encomsp", settings);
|
|
|
|
freerdp_client_load_static_channel_addin(channels, settings, "remdesk", settings);
|
2014-06-29 02:33:46 +04:00
|
|
|
}
|
|
|
|
|
2012-11-21 20:56:40 +04:00
|
|
|
for (index = 0; index < settings->StaticChannelCount; index++)
|
2012-11-21 18:30:06 +04:00
|
|
|
{
|
2012-11-21 20:56:40 +04:00
|
|
|
args = settings->StaticChannelArray[index];
|
|
|
|
freerdp_client_load_static_channel_addin(channels, settings, args->argv[0], args);
|
2012-11-21 04:34:52 +04:00
|
|
|
}
|
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
if (settings->RemoteApplicationMode)
|
2012-11-19 02:32:18 +04:00
|
|
|
{
|
2012-11-21 18:30:06 +04:00
|
|
|
freerdp_client_load_static_channel_addin(channels, settings, "rail", settings);
|
2012-11-19 02:32:18 +04:00
|
|
|
}
|
|
|
|
|
2013-10-22 07:33:25 +04:00
|
|
|
if (settings->SupportGraphicsPipeline)
|
|
|
|
{
|
|
|
|
char* p[1];
|
|
|
|
int count;
|
|
|
|
|
|
|
|
count = 1;
|
|
|
|
p[0] = "rdpgfx";
|
|
|
|
|
|
|
|
freerdp_client_add_dynamic_channel(settings, count, p);
|
|
|
|
}
|
|
|
|
|
2012-11-19 02:32:18 +04:00
|
|
|
if (settings->DynamicChannelCount)
|
2014-08-15 03:23:48 +04:00
|
|
|
settings->SupportDynamicChannels = TRUE;
|
|
|
|
|
|
|
|
if (settings->SupportDynamicChannels)
|
2012-11-19 02:32:18 +04:00
|
|
|
{
|
2012-11-21 18:30:06 +04:00
|
|
|
freerdp_client_load_static_channel_addin(channels, settings, "drdynvc", settings);
|
2012-11-19 02:32:18 +04:00
|
|
|
}
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
return 1;
|
|
|
|
}
|