2012-10-17 11:42:13 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* .rdp file
|
|
|
|
*
|
|
|
|
* 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 <freerdp/client/file.h>
|
2012-11-26 23:31:31 +04:00
|
|
|
#include <freerdp/client/cmdline.h>
|
2012-10-17 11:42:13 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remote Desktop Plus - Overview of .rdp file settings:
|
|
|
|
* http://www.donkz.nl/files/rdpsettings.html
|
|
|
|
*
|
|
|
|
* RDP Settings for Remote Desktop Services in Windows Server 2008 R2:
|
|
|
|
* http://technet.microsoft.com/en-us/library/ff393699/
|
|
|
|
*/
|
2012-10-28 04:25:11 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2012-10-28 20:12:36 +04:00
|
|
|
#define DEBUG_CLIENT_FILE 1
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
static BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
|
|
|
|
static WCHAR CR_LF_STR_W[] = { '\r', '\n', '\0' };
|
|
|
|
|
2012-10-28 05:30:08 +04:00
|
|
|
#define INVALID_INTEGER_VALUE 0xFFFFFFFF
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, char* name, int value)
|
|
|
|
{
|
2012-10-28 20:12:36 +04:00
|
|
|
#ifdef DEBUG_CLIENT_FILE
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "%s:i:%d\n", name, value);
|
2012-10-28 20:12:36 +04:00
|
|
|
#endif
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
if (_stricmp(name, "use multimon") == 0)
|
|
|
|
file->UseMultiMon = value;
|
|
|
|
else if (_stricmp(name, "screen mode id") == 0)
|
|
|
|
file->ScreenModeId = value;
|
|
|
|
else if (_stricmp(name, "span monitors") == 0)
|
|
|
|
file->SpanMonitors = value;
|
|
|
|
else if (_stricmp(name, "smartsizing") == 0)
|
|
|
|
file->SmartSizing = value;
|
|
|
|
else if (_stricmp(name, "enablesuperpan") == 0)
|
|
|
|
file->EnableSuperSpan = value;
|
|
|
|
else if (_stricmp(name, "superpanaccelerationfactor") == 0)
|
|
|
|
file->SuperSpanAccelerationFactor = value;
|
|
|
|
else if (_stricmp(name, "desktopwidth") == 0)
|
|
|
|
file->DesktopWidth = value;
|
|
|
|
else if (_stricmp(name, "desktopheight") == 0)
|
|
|
|
file->DesktopHeight = value;
|
|
|
|
else if (_stricmp(name, "desktop size id") == 0)
|
|
|
|
file->DesktopSizeId = value;
|
|
|
|
else if (_stricmp(name, "session bpp") == 0)
|
|
|
|
file->SessionBpp = value;
|
|
|
|
else if (_stricmp(name, "compression") == 0)
|
|
|
|
file->Compression = value;
|
|
|
|
else if (_stricmp(name, "keyboardhook") == 0)
|
|
|
|
file->KeyboardHook = value;
|
|
|
|
else if (_stricmp(name, "disable ctrl+alt+del") == 0)
|
|
|
|
file->DisableCtrlAltDel = value;
|
|
|
|
else if (_stricmp(name, "audiomode") == 0)
|
|
|
|
file->AudioMode = value;
|
|
|
|
else if (_stricmp(name, "audioqualitymode") == 0)
|
|
|
|
file->AudioQualityMode = value;
|
|
|
|
else if (_stricmp(name, "audiocapturemode") == 0)
|
|
|
|
file->AudioCaptureMode = value;
|
|
|
|
else if (_stricmp(name, "videoplaybackmode") == 0)
|
|
|
|
file->VideoPlaybackMode = value;
|
|
|
|
else if (_stricmp(name, "connection type") == 0)
|
|
|
|
file->ConnectionType = value;
|
|
|
|
else if (_stricmp(name, "networkautodetect") == 0)
|
|
|
|
file->NetworkAutoDetect = value;
|
|
|
|
else if (_stricmp(name, "bandwidthautodetect") == 0)
|
|
|
|
file->BandwidthAutoDetect = value;
|
|
|
|
else if (_stricmp(name, "pinconnectionbar") == 0)
|
|
|
|
file->PinConnectionBar = value;
|
|
|
|
else if (_stricmp(name, "displayconnectionbar") == 0)
|
|
|
|
file->DisplayConnectionBar = value;
|
|
|
|
else if (_stricmp(name, "workspaceid") == 0)
|
|
|
|
file->WorkspaceId = value;
|
|
|
|
else if (_stricmp(name, "enableworkspacereconnect") == 0)
|
|
|
|
file->EnableWorkspaceReconnect = value;
|
|
|
|
else if (_stricmp(name, "disable wallpaper") == 0)
|
|
|
|
file->DisableWallpaper = value;
|
|
|
|
else if (_stricmp(name, "allow font smoothing") == 0)
|
|
|
|
file->AllowFontSmoothing = value;
|
|
|
|
else if (_stricmp(name, "allow desktop composition") == 0)
|
|
|
|
file->AllowDesktopComposition = value;
|
|
|
|
else if (_stricmp(name, "disable full window drag") == 0)
|
|
|
|
file->DisableFullWindowDrag = value;
|
|
|
|
else if (_stricmp(name, "disable menu anims") == 0)
|
|
|
|
file->DisableMenuAnims = value;
|
|
|
|
else if (_stricmp(name, "disable themes") == 0)
|
|
|
|
file->DisableThemes = value;
|
|
|
|
else if (_stricmp(name, "disable cursor setting") == 0)
|
|
|
|
file->DisableCursorSetting = value;
|
|
|
|
else if (_stricmp(name, "bitmapcachesize") == 0)
|
|
|
|
file->BitmapCacheSize = value;
|
|
|
|
else if (_stricmp(name, "bitmapcachepersistenable") == 0)
|
|
|
|
file->BitmapCachePersistEnable = value;
|
|
|
|
else if (_stricmp(name, "server port") == 0)
|
|
|
|
file->ServerPort = value;
|
|
|
|
else if (_stricmp(name, "redirectdrives") == 0)
|
|
|
|
file->RedirectDrives = value;
|
|
|
|
else if (_stricmp(name, "redirectprinters") == 0)
|
|
|
|
file->RedirectPrinters = value;
|
|
|
|
else if (_stricmp(name, "redirectcomports") == 0)
|
|
|
|
file->RedirectComPorts = value;
|
|
|
|
else if (_stricmp(name, "redirectsmartcards") == 0)
|
|
|
|
file->RedirectSmartCards = value;
|
|
|
|
else if (_stricmp(name, "redirectclipboard") == 0)
|
|
|
|
file->RedirectClipboard = value;
|
|
|
|
else if (_stricmp(name, "redirectposdevices") == 0)
|
|
|
|
file->RedirectPosDevices = value;
|
|
|
|
else if (_stricmp(name, "redirectdirectx") == 0)
|
|
|
|
file->RedirectDirectX = value;
|
|
|
|
else if (_stricmp(name, "disableprinterredirection") == 0)
|
|
|
|
file->DisablePrinterRedirection = value;
|
|
|
|
else if (_stricmp(name, "disableclipboardredirection") == 0)
|
|
|
|
file->DisableClipboardRedirection = value;
|
|
|
|
else if (_stricmp(name, "connect to console") == 0)
|
|
|
|
file->ConnectToConsole = value;
|
|
|
|
else if (_stricmp(name, "administrative session") == 0)
|
|
|
|
file->AdministrativeSession = value;
|
|
|
|
else if (_stricmp(name, "autoreconnection enabled") == 0)
|
|
|
|
file->AutoReconnectionEnabled = value;
|
|
|
|
else if (_stricmp(name, "autoreconnect max retries") == 0)
|
|
|
|
file->AutoReconnectMaxRetries = value;
|
|
|
|
else if (_stricmp(name, "public mode") == 0)
|
|
|
|
file->PublicMode = value;
|
|
|
|
else if (_stricmp(name, "authentication level") == 0)
|
|
|
|
file->AuthenticationLevel = value;
|
|
|
|
else if (_stricmp(name, "promptcredentialonce") == 0)
|
|
|
|
file->PromptCredentialOnce = value;
|
|
|
|
else if (_stricmp(name, "prompt for credentials") == 0)
|
|
|
|
file->PromptForCredentials = value;
|
|
|
|
else if (_stricmp(name, "promptcredentialonce") == 0)
|
|
|
|
file->PromptForCredentialsOnce = value;
|
|
|
|
else if (_stricmp(name, "negotiate security layer") == 0)
|
|
|
|
file->NegotiateSecurityLayer = value;
|
|
|
|
else if (_stricmp(name, "enablecredsspsupport") == 0)
|
|
|
|
file->EnableCredSSPSupport = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationmode") == 0)
|
|
|
|
file->RemoteApplicationMode = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationexpandcmdline") == 0)
|
|
|
|
file->RemoteApplicationExpandCmdLine = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationexpandworkingdir") == 0)
|
|
|
|
file->RemoteApplicationExpandWorkingDir = value;
|
|
|
|
else if (_stricmp(name, "disableconnectionsharing") == 0)
|
|
|
|
file->DisableConnectionSharing = value;
|
|
|
|
else if (_stricmp(name, "disableremoteappcapscheck") == 0)
|
|
|
|
file->DisableRemoteAppCapsCheck = value;
|
|
|
|
else if (_stricmp(name, "gatewayusagemethod") == 0)
|
|
|
|
file->GatewayUsageMethod = value;
|
|
|
|
else if (_stricmp(name, "gatewayprofileusagemethod") == 0)
|
|
|
|
file->GatewayProfileUsageMethod = value;
|
|
|
|
else if (_stricmp(name, "gatewaycredentialssource") == 0)
|
|
|
|
file->GatewayCredentialsSource = value;
|
|
|
|
else if (_stricmp(name, "use redirection server name") == 0)
|
|
|
|
file->UseRedirectionServerName = value;
|
|
|
|
else if (_stricmp(name, "rdgiskdcproxy") == 0)
|
|
|
|
file->RdgIsKdcProxy = value;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void freerdp_client_parse_rdp_file_integer_unicode(rdpFile* file, WCHAR* name, WCHAR* value)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
int ivalue;
|
|
|
|
char* nameA;
|
|
|
|
char* valueA;
|
|
|
|
|
|
|
|
length = _wcslen(name);
|
|
|
|
nameA = (char*) malloc(length + 1);
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, name, length, nameA, length, NULL, NULL);
|
|
|
|
nameA[length] = '\0';
|
|
|
|
|
|
|
|
length = _wcslen(value);
|
|
|
|
valueA = (char*) malloc(length + 1);
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
|
|
|
|
valueA[length] = '\0';
|
|
|
|
|
|
|
|
ivalue = atoi(valueA);
|
|
|
|
freerdp_client_rdp_file_set_integer(file, nameA, ivalue);
|
|
|
|
|
|
|
|
free(nameA);
|
|
|
|
free(valueA);
|
|
|
|
}
|
|
|
|
|
2012-10-28 06:46:37 +04:00
|
|
|
void freerdp_client_parse_rdp_file_integer_ascii(rdpFile* file, char* name, char* value)
|
|
|
|
{
|
|
|
|
int ivalue = atoi(value);
|
|
|
|
freerdp_client_rdp_file_set_integer(file, name, ivalue);
|
|
|
|
}
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
BOOL freerdp_client_rdp_file_set_string(rdpFile* file, char* name, char* value)
|
|
|
|
{
|
2012-10-28 20:12:36 +04:00
|
|
|
#ifdef DEBUG_CLIENT_FILE
|
2013-03-29 02:06:34 +04:00
|
|
|
fprintf(stderr, "%s:s:%s\n", name, value);
|
2012-10-28 20:12:36 +04:00
|
|
|
#endif
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
if (_stricmp(name, "username") == 0)
|
|
|
|
file->Username = value;
|
|
|
|
else if (_stricmp(name, "domain") == 0)
|
|
|
|
file->Domain = value;
|
|
|
|
else if (_stricmp(name, "full address") == 0)
|
|
|
|
file->FullAddress = value;
|
|
|
|
else if (_stricmp(name, "alternate full address") == 0)
|
|
|
|
file->AlternateFullAddress = value;
|
|
|
|
else if (_stricmp(name, "usbdevicestoredirect") == 0)
|
|
|
|
file->UsbDevicesToRedirect = value;
|
|
|
|
else if (_stricmp(name, "loadbalanceinfo") == 0)
|
|
|
|
file->LoadBalanceInfo = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationname") == 0)
|
|
|
|
file->RemoteApplicationName = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationicon") == 0)
|
|
|
|
file->RemoteApplicationIcon = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationprogram") == 0)
|
|
|
|
file->RemoteApplicationProgram = value;
|
|
|
|
else if (_stricmp(name, "remoteapplicationfile") == 0)
|
|
|
|
file->RemoteApplicationFile = value;
|
2012-11-19 22:26:56 +04:00
|
|
|
else if (_stricmp(name, "remoteapplicationguid") == 0)
|
|
|
|
file->RemoteApplicationGuid = value;
|
2012-10-28 04:25:11 +04:00
|
|
|
else if (_stricmp(name, "remoteapplicationcmdline") == 0)
|
|
|
|
file->RemoteApplicationCmdLine = value;
|
|
|
|
else if (_stricmp(name, "alternate shell") == 0)
|
|
|
|
file->AlternateShell = value;
|
|
|
|
else if (_stricmp(name, "shell working directory") == 0)
|
|
|
|
file->ShellWorkingDirectory = value;
|
|
|
|
else if (_stricmp(name, "gatewayhostname") == 0)
|
|
|
|
file->GatewayHostname = value;
|
|
|
|
else if (_stricmp(name, "kdcproxyname") == 0)
|
|
|
|
file->KdcProxyName = value;
|
|
|
|
else if (_stricmp(name, "drivestoredirect") == 0)
|
|
|
|
file->DrivesToRedirect = value;
|
|
|
|
else if (_stricmp(name, "devicestoredirect") == 0)
|
|
|
|
file->DevicesToRedirect = value;
|
|
|
|
else if (_stricmp(name, "winposstr") == 0)
|
|
|
|
file->WinPosStr = value;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void freerdp_client_parse_rdp_file_string_unicode(rdpFile* file, WCHAR* name, WCHAR* value)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
char* nameA;
|
|
|
|
char* valueA;
|
|
|
|
|
|
|
|
length = _wcslen(name);
|
|
|
|
nameA = (char*) malloc(length + 1);
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, name, length, nameA, length, NULL, NULL);
|
|
|
|
nameA[length] = '\0';
|
|
|
|
|
|
|
|
length = _wcslen(value);
|
|
|
|
valueA = (char*) malloc(length + 1);
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
|
|
|
|
valueA[length] = '\0';
|
|
|
|
|
|
|
|
if (!freerdp_client_rdp_file_set_string(file, nameA, valueA))
|
|
|
|
free(valueA);
|
|
|
|
|
|
|
|
free(nameA);
|
|
|
|
}
|
|
|
|
|
2012-10-28 06:46:37 +04:00
|
|
|
void freerdp_client_parse_rdp_file_string_ascii(rdpFile* file, char* name, char* value)
|
|
|
|
{
|
|
|
|
freerdp_client_rdp_file_set_string(file, name, value);
|
|
|
|
}
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
BOOL freerdp_client_parse_rdp_file_buffer_ascii(rdpFile* file, BYTE* buffer, size_t size)
|
|
|
|
{
|
2012-10-28 06:46:37 +04:00
|
|
|
int length;
|
|
|
|
char* line;
|
|
|
|
char* type;
|
|
|
|
char* context;
|
|
|
|
char *d1, *d2;
|
|
|
|
char *beg, *end;
|
|
|
|
char *name, *value;
|
|
|
|
|
|
|
|
line = strtok_s((char*) buffer, "\r\n", &context);
|
|
|
|
|
2013-04-13 02:03:56 +04:00
|
|
|
while (line)
|
2012-10-28 06:46:37 +04:00
|
|
|
{
|
|
|
|
length = strlen(line);
|
|
|
|
|
|
|
|
if (length > 1)
|
|
|
|
{
|
|
|
|
beg = line;
|
|
|
|
end = &line[length - 1];
|
|
|
|
|
|
|
|
d1 = strchr(line, ':');
|
|
|
|
|
|
|
|
if (!d1)
|
|
|
|
goto next_line; /* not first delimiter */
|
|
|
|
|
|
|
|
type = &d1[1];
|
|
|
|
d2 = strchr(type, ':');
|
|
|
|
|
|
|
|
if (!d2)
|
|
|
|
goto next_line; /* no second delimiter */
|
|
|
|
|
|
|
|
if ((d2 - d1) != 2)
|
|
|
|
goto next_line; /* improper type length */
|
|
|
|
|
|
|
|
if (d2 == end)
|
|
|
|
goto next_line; /* no value */
|
|
|
|
|
|
|
|
*d1 = 0;
|
|
|
|
*d2 = 0;
|
|
|
|
name = beg;
|
|
|
|
value = &d2[1];
|
|
|
|
|
|
|
|
if (*type == 'i')
|
|
|
|
{
|
|
|
|
/* integer type */
|
|
|
|
freerdp_client_parse_rdp_file_integer_ascii(file, name, value);
|
|
|
|
}
|
|
|
|
else if (*type == 's')
|
|
|
|
{
|
|
|
|
/* string type */
|
|
|
|
freerdp_client_parse_rdp_file_string_ascii(file, name, value);
|
|
|
|
}
|
|
|
|
else if (*type == 'b')
|
|
|
|
{
|
|
|
|
/* binary type */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
next_line:
|
|
|
|
line = strtok_s(NULL, "\r\n", &context);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2012-10-28 04:25:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL freerdp_client_parse_rdp_file_buffer_unicode(rdpFile* file, BYTE* buffer, size_t size)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
WCHAR* line;
|
|
|
|
WCHAR* type;
|
|
|
|
WCHAR* context;
|
|
|
|
WCHAR *d1, *d2;
|
|
|
|
WCHAR *beg, *end;
|
|
|
|
WCHAR *name, *value;
|
|
|
|
|
|
|
|
line = wcstok_s((WCHAR*) buffer, CR_LF_STR_W, &context);
|
|
|
|
|
|
|
|
while (line != NULL)
|
|
|
|
{
|
|
|
|
length = _wcslen(line);
|
|
|
|
|
|
|
|
if (length > 1)
|
|
|
|
{
|
|
|
|
beg = line;
|
|
|
|
end = &line[length - 1];
|
|
|
|
|
|
|
|
d1 = _wcschr(line, ':');
|
|
|
|
|
|
|
|
if (!d1)
|
|
|
|
goto next_line; /* not first delimiter */
|
|
|
|
|
|
|
|
type = &d1[1];
|
|
|
|
d2 = _wcschr(type, ':');
|
|
|
|
|
|
|
|
if (!d2)
|
|
|
|
goto next_line; /* no second delimiter */
|
|
|
|
|
|
|
|
if ((d2 - d1) != 2)
|
|
|
|
goto next_line; /* improper type length */
|
|
|
|
|
|
|
|
if (d2 == end)
|
|
|
|
goto next_line; /* no value */
|
|
|
|
|
|
|
|
*d1 = 0;
|
|
|
|
*d2 = 0;
|
|
|
|
name = beg;
|
|
|
|
value = &d2[1];
|
|
|
|
|
|
|
|
if (*type == 'i')
|
|
|
|
{
|
|
|
|
/* integer type */
|
|
|
|
freerdp_client_parse_rdp_file_integer_unicode(file, name, value);
|
|
|
|
}
|
|
|
|
else if (*type == 's')
|
|
|
|
{
|
|
|
|
/* string type */
|
|
|
|
freerdp_client_parse_rdp_file_string_unicode(file, name, value);
|
|
|
|
}
|
|
|
|
else if (*type == 'b')
|
|
|
|
{
|
|
|
|
/* binary type */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
next_line:
|
|
|
|
line = wcstok_s(NULL, CR_LF_STR_W, &context);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t size)
|
|
|
|
{
|
|
|
|
if (size < 2)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ((buffer[0] == BOM_UTF16_LE[0]) && (buffer[1] == BOM_UTF16_LE[1]))
|
|
|
|
return freerdp_client_parse_rdp_file_buffer_unicode(file, &buffer[2], size - 2);
|
|
|
|
|
|
|
|
return freerdp_client_parse_rdp_file_buffer_ascii(file, buffer, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
|
|
|
|
{
|
|
|
|
BYTE* buffer;
|
|
|
|
FILE* fp = NULL;
|
|
|
|
size_t read_size;
|
|
|
|
long int file_size;
|
|
|
|
|
|
|
|
fp = fopen(name, "r");
|
|
|
|
|
|
|
|
if (!fp)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
fseek(fp, 0, SEEK_END);
|
|
|
|
file_size = ftell(fp);
|
|
|
|
fseek(fp, 0, SEEK_SET);
|
|
|
|
|
|
|
|
if (file_size < 1)
|
|
|
|
return FALSE;
|
|
|
|
|
2013-04-13 02:03:56 +04:00
|
|
|
buffer = (BYTE*) malloc(file_size + 2);
|
2012-10-28 04:25:11 +04:00
|
|
|
read_size = fread(buffer, file_size, 1, fp);
|
|
|
|
|
|
|
|
if (!read_size)
|
|
|
|
{
|
|
|
|
if (!ferror(fp))
|
|
|
|
read_size = file_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read_size < 1)
|
|
|
|
{
|
|
|
|
free(buffer);
|
|
|
|
buffer = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-04-13 02:03:56 +04:00
|
|
|
buffer[file_size] = '\0';
|
|
|
|
buffer[file_size + 1] = '\0';
|
|
|
|
|
2012-10-28 04:25:11 +04:00
|
|
|
return freerdp_client_parse_rdp_file_buffer(file, buffer, file_size);
|
|
|
|
}
|
2012-10-28 05:30:08 +04:00
|
|
|
|
2013-04-23 02:39:18 +04:00
|
|
|
#define SETTING_MODIFIED(_settings, _field) (_settings->settings_modified[FreeRDP_##_field])
|
|
|
|
#define SETTING_MODIFIED_SET(_target, _settings, _field) if SETTING_MODIFIED(_settings, _field) _target = _settings->_field
|
|
|
|
|
2013-04-23 00:08:47 +04:00
|
|
|
BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, rdpSettings* settings)
|
|
|
|
{
|
2013-04-23 02:39:18 +04:00
|
|
|
SETTING_MODIFIED_SET(file->Domain, settings, Domain);
|
|
|
|
SETTING_MODIFIED_SET(file->Username, settings, Username);
|
|
|
|
SETTING_MODIFIED_SET(file->ServerPort, settings, ServerPort);
|
|
|
|
SETTING_MODIFIED_SET(file->FullAddress, settings, ServerHostname);
|
|
|
|
SETTING_MODIFIED_SET(file->DesktopWidth, settings, DesktopWidth);
|
|
|
|
SETTING_MODIFIED_SET(file->DesktopHeight, settings, DesktopHeight);
|
|
|
|
SETTING_MODIFIED_SET(file->SessionBpp, settings, ColorDepth);
|
|
|
|
SETTING_MODIFIED_SET(file->ConnectToConsole, settings, ConsoleSession);
|
|
|
|
SETTING_MODIFIED_SET(file->AdministrativeSession, settings, ConsoleSession);
|
|
|
|
SETTING_MODIFIED_SET(file->NegotiateSecurityLayer, settings, NegotiateSecurityLayer);
|
|
|
|
SETTING_MODIFIED_SET(file->EnableCredSSPSupport, settings, NlaSecurity);
|
|
|
|
SETTING_MODIFIED_SET(file->AlternateShell, settings, AlternateShell);
|
|
|
|
SETTING_MODIFIED_SET(file->ShellWorkingDirectory, settings, ShellWorkingDirectory);
|
|
|
|
SETTING_MODIFIED_SET(file->ConnectionType, settings, ConnectionType);
|
|
|
|
|
|
|
|
if (SETTING_MODIFIED(settings, AudioPlayback) || SETTING_MODIFIED(settings, RemoteConsoleAudio))
|
2013-04-23 00:08:47 +04:00
|
|
|
{
|
2013-04-23 02:39:18 +04:00
|
|
|
if (settings->AudioPlayback)
|
|
|
|
file->AudioMode = AUDIO_MODE_REDIRECT;
|
|
|
|
else if (settings->RemoteConsoleAudio)
|
|
|
|
file->AudioMode = AUDIO_MODE_PLAY_ON_SERVER;
|
|
|
|
else
|
|
|
|
file->AudioMode = AUDIO_MODE_NONE;
|
2013-04-23 00:08:47 +04:00
|
|
|
}
|
|
|
|
|
2013-04-23 02:39:18 +04:00
|
|
|
SETTING_MODIFIED_SET(file->GatewayHostname, settings, GatewayHostname);
|
|
|
|
SETTING_MODIFIED_SET(file->GatewayUsageMethod, settings, GatewayUsageMethod);
|
|
|
|
SETTING_MODIFIED_SET(file->PromptCredentialOnce, settings, GatewayUseSameCredentials);
|
2013-04-23 00:08:47 +04:00
|
|
|
|
2013-04-23 02:39:18 +04:00
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationMode, settings, RemoteApplicationMode);
|
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationProgram, settings, RemoteApplicationProgram);
|
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationName, settings, RemoteApplicationName);
|
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationIcon, settings, RemoteApplicationIcon);
|
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationFile, settings, RemoteApplicationFile);
|
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationGuid, settings, RemoteApplicationGuid);
|
|
|
|
SETTING_MODIFIED_SET(file->RemoteApplicationCmdLine, settings, RemoteApplicationCmdLine);
|
2013-04-23 00:08:47 +04:00
|
|
|
|
2013-04-23 02:39:18 +04:00
|
|
|
SETTING_MODIFIED_SET(file->SpanMonitors, settings, SpanMonitors);
|
|
|
|
SETTING_MODIFIED_SET(file->UseMultiMon, settings, UseMultimon);
|
2013-04-23 00:08:47 +04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL freerdp_client_write_rdp_file(rdpFile* file, char* name, BOOL unicode)
|
|
|
|
{
|
|
|
|
BOOL success = FALSE;
|
|
|
|
char* buffer;
|
|
|
|
int len, len2;
|
|
|
|
FILE* fp = NULL;
|
|
|
|
WCHAR* unicodestr = NULL;
|
|
|
|
|
|
|
|
len = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
|
|
|
|
if (len <= 0)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "freerdp_client_write_rdp_file: Error determining buffer size.\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = (char*) malloc((len + 1) * sizeof(char));
|
|
|
|
len2 = freerdp_client_write_rdp_file_buffer(file, buffer, len + 1);
|
|
|
|
if (len2 == len)
|
|
|
|
{
|
|
|
|
fp = fopen(name, "w+b");
|
|
|
|
if (fp != NULL)
|
|
|
|
{
|
|
|
|
if (unicode)
|
|
|
|
{
|
|
|
|
ConvertToUnicode(CP_UTF8, 0, buffer, len, &unicodestr, 0);
|
|
|
|
|
|
|
|
// Write multi-byte header
|
|
|
|
fwrite(BOM_UTF16_LE, sizeof(BYTE), 2, fp);
|
|
|
|
fwrite(unicodestr, 2, len, fp);
|
|
|
|
|
|
|
|
free(unicodestr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fwrite(buffer, 1, len, fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
fflush(fp);
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buffer != NULL)
|
|
|
|
free(buffer);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2013-04-23 02:39:18 +04:00
|
|
|
#define WRITE_RDP_FILE_DECLARE(_file, _buffer, _size) \
|
|
|
|
rdpFile* __rdpFile = file; \
|
|
|
|
char* __buffer = _buffer; \
|
|
|
|
size_t __size = _size; \
|
|
|
|
size_t __required_size = 0; \
|
|
|
|
int __current = 0; \
|
|
|
|
int __count = 0;
|
|
|
|
|
2013-05-31 23:45:55 +04:00
|
|
|
#define WRITE_RDP_FILE_VALUE_INTEGER(_format, _field) \
|
2013-04-23 02:39:18 +04:00
|
|
|
if (~__rdpFile->_field) \
|
|
|
|
{ \
|
2013-05-31 23:45:55 +04:00
|
|
|
__count = sprintf_s(__buffer == NULL ? NULL : __buffer + __current, __buffer == NULL ? 0 : __size - __required_size, _format, (int) __rdpFile->_field); \
|
2013-04-23 02:39:18 +04:00
|
|
|
__required_size += __count; \
|
|
|
|
__current += __count; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define WRITE_RDP_FILE_VALUE_STRING(_format, _field) \
|
|
|
|
if (~((size_t) __rdpFile->_field) && __rdpFile->_field != NULL) \
|
|
|
|
{ \
|
2013-05-31 23:45:55 +04:00
|
|
|
__count = sprintf_s(__buffer == NULL ? NULL : __buffer + __current, __buffer == NULL ? 0 : __size - __required_size, _format, __rdpFile->_field); \
|
2013-04-23 02:39:18 +04:00
|
|
|
__required_size += __count; \
|
|
|
|
__current += __count; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define WRITE_RDP_FILE_VALUE_RETURN \
|
|
|
|
return __required_size;
|
|
|
|
|
2013-04-23 00:08:47 +04:00
|
|
|
// TODO: Optimize by only writing the fields that have a value i.e ~((size_t) file->FieldName) != 0
|
|
|
|
size_t freerdp_client_write_rdp_file_buffer(rdpFile* file, char* buffer, size_t size)
|
|
|
|
{
|
2013-04-23 02:39:18 +04:00
|
|
|
WRITE_RDP_FILE_DECLARE(file, buffer, size)
|
|
|
|
|
2013-05-31 23:45:55 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("screen mode id:i:%d\n", ScreenModeId);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("use multimon:i:%d\n", UseMultiMon);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("desktopwidth:i:%d\n", DesktopWidth);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("desktopheight:i:%d\n", DesktopHeight);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("session bpp:i:%d\n", SessionBpp);
|
2013-04-23 02:39:18 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_STRING("winposstr:s:%s\n", WinPosStr);
|
2013-05-31 23:45:55 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("compression:i:%d\n", Compression);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("keyboardhook:i:%d\n", KeyboardHook);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("audiocapturemode:i:%d\n", AudioCaptureMode);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("videoplaybackmode:i:%d\n", VideoPlaybackMode);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("connection type:i:%d\n", ConnectionType);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("networkautodetect:i:%d\n", NetworkAutoDetect);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("bandwidthautodetect:i:%d\n", BandwidthAutoDetect);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("displayconnectionbar:i:%d\n", DisplayConnectionBar);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("enableworkspacereconnect:i:%d\n", EnableWorkspaceReconnect);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("disable wallpaper:i:%d\n", DisableWallpaper);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("allow font smoothing:i:%d\n", AllowFontSmoothing);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("allow desktop composition:i:%d\n", AllowDesktopComposition);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("disable full window drag:i:%d\n", DisableFullWindowDrag);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("disable menu anims:i:%d\n", DisableMenuAnims);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("disable themes:i:%d\n", DisableThemes);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("disable cursor setting:i:%d\n", DisableCursorSetting);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("bitmapcachepersistenable:i:%d\n", BitmapCachePersistEnable);
|
2013-04-23 02:39:18 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_STRING("full address:s:%s\n", FullAddress);
|
2013-05-31 23:45:55 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("audiomode:i:%d\n", AudioMode);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("redirectprinters:i:%d\n", RedirectPrinters);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("redirectcomports:i:%d\n", RedirectComPorts);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("redirectsmartcards:i:%d\n", RedirectSmartCards);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("redirectclipboard:i:%d\n", RedirectClipboard);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("redirectposdevices:i:%d\n", RedirectPosDevices);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("autoreconnection enabled:i:%d\n", AutoReconnectionEnabled);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("authentication level:i:%d\n", AuthenticationLevel);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("prompt for credentials:i:%d\n", PromptForCredentials);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("negotiate security layer:i:%d\n", NegotiateSecurityLayer);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("remoteapplicationmode:i:%d\n", RemoteApplicationMode);
|
2013-04-23 02:39:18 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_STRING("alternate shell:s:%s\n", AlternateShell);
|
|
|
|
WRITE_RDP_FILE_VALUE_STRING("shell working directory:s:%s\n", ShellWorkingDirectory);
|
|
|
|
WRITE_RDP_FILE_VALUE_STRING("gatewayhostname:s:%s\n", GatewayHostname);
|
2013-05-31 23:45:55 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("gatewayusagemethod:i:%d\n", GatewayUsageMethod);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("gatewaycredentialssource:i:%d\n", GatewayCredentialsSource);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("gatewayprofileusagemethod:i:%d\n", GatewayProfileUsageMethod);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("promptcredentialonce:i:%d\n", PromptCredentialOnce);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("use redirection server name:i:%d\n", UseRedirectionServerName);
|
|
|
|
WRITE_RDP_FILE_VALUE_INTEGER("rdgiskdcproxy:i:%d\n", RdgIsKdcProxy);
|
2013-04-23 02:39:18 +04:00
|
|
|
WRITE_RDP_FILE_VALUE_STRING("kdcproxyname:s:%s\n", KdcProxyName);
|
|
|
|
WRITE_RDP_FILE_VALUE_STRING("drivestoredirect:s:%s\n", DrivesToRedirect);
|
|
|
|
WRITE_RDP_FILE_VALUE_STRING("username:s:%s\n", Username);
|
|
|
|
WRITE_RDP_FILE_VALUE_STRING("domain:s:%s\n", Domain);
|
|
|
|
|
|
|
|
WRITE_RDP_FILE_VALUE_RETURN
|
2013-04-23 00:08:47 +04:00
|
|
|
}
|
|
|
|
|
2013-04-23 02:39:18 +04:00
|
|
|
|
2012-10-28 05:30:08 +04:00
|
|
|
BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings)
|
|
|
|
{
|
|
|
|
if (~((size_t) file->Domain))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_Domain, file->Domain);
|
2012-10-28 05:30:08 +04:00
|
|
|
|
|
|
|
if (~((size_t) file->Username))
|
|
|
|
{
|
2012-11-26 23:31:31 +04:00
|
|
|
char* user;
|
|
|
|
char* domain;
|
2012-10-28 05:30:08 +04:00
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
freerdp_parse_username(file->Username, &user, &domain);
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_Username, user);
|
2013-04-23 00:08:47 +04:00
|
|
|
|
|
|
|
if (domain != NULL)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_Domain, domain);
|
2012-10-28 05:30:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (~file->ServerPort)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->ServerPort);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~((size_t) file->FullAddress))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_ServerHostname, file->FullAddress);
|
|
|
|
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->DesktopWidth)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->DesktopHeight)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->SessionBpp)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->ConnectToConsole)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_ConsoleSession, file->ConnectToConsole);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->AdministrativeSession)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_ConsoleSession, file->AdministrativeSession);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->NegotiateSecurityLayer)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->EnableCredSSPSupport)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~((size_t) file->AlternateShell))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_AlternateShell, file->AlternateShell);
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~((size_t) file->ShellWorkingDirectory))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_ShellWorkingDirectory, file->ShellWorkingDirectory);
|
2012-10-28 20:12:36 +04:00
|
|
|
|
2013-04-11 19:51:10 +04:00
|
|
|
if (~((size_t) file->LoadBalanceInfo))
|
|
|
|
{
|
|
|
|
settings->LoadBalanceInfo = (BYTE*) _strdup(file->LoadBalanceInfo);
|
|
|
|
settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo);
|
|
|
|
}
|
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
if (~file->ConnectionType)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_ConnectionType, file->ConnectionType);
|
2012-11-26 23:31:31 +04:00
|
|
|
|
|
|
|
if (~file->AudioMode)
|
|
|
|
{
|
|
|
|
if (file->AudioMode == AUDIO_MODE_REDIRECT)
|
|
|
|
{
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, TRUE);
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (file->AudioMode == AUDIO_MODE_PLAY_ON_SERVER)
|
|
|
|
{
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, TRUE);
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (file->AudioMode == AUDIO_MODE_NONE)
|
|
|
|
{
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, FALSE);
|
|
|
|
freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, FALSE);
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~((size_t) file->GatewayHostname))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_GatewayHostname, file->GatewayHostname);
|
2013-07-03 23:07:12 +04:00
|
|
|
|
2012-10-28 20:12:36 +04:00
|
|
|
if (~file->GatewayUsageMethod)
|
2013-07-03 23:07:12 +04:00
|
|
|
{
|
|
|
|
freerdp_set_param_uint32(settings, FreeRDP_GatewayUsageMethod, file->GatewayUsageMethod);
|
|
|
|
|
|
|
|
if (file->GatewayUsageMethod == TSC_PROXY_MODE_DIRECT)
|
|
|
|
freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, TRUE);
|
|
|
|
else if (file->GatewayUsageMethod == TSC_PROXY_MODE_NONE_DETECT)
|
|
|
|
freerdp_set_param_bool(settings, FreeRDP_GatewayEnabled, FALSE);
|
|
|
|
}
|
|
|
|
|
2012-10-28 20:12:36 +04:00
|
|
|
if (~file->PromptCredentialOnce)
|
2013-07-03 23:07:12 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_GatewayUseSameCredentials, TRUE);
|
2012-10-28 20:12:36 +04:00
|
|
|
|
2012-10-28 05:30:08 +04:00
|
|
|
if (~file->RemoteApplicationMode)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_RemoteApplicationMode, file->RemoteApplicationMode);
|
2012-11-19 22:26:56 +04:00
|
|
|
if (~((size_t) file->RemoteApplicationProgram))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_RemoteApplicationProgram, file->RemoteApplicationProgram);
|
2012-11-19 22:26:56 +04:00
|
|
|
if (~((size_t) file->RemoteApplicationName))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_RemoteApplicationName, file->RemoteApplicationName);
|
2012-11-19 22:26:56 +04:00
|
|
|
if (~((size_t) file->RemoteApplicationIcon))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_RemoteApplicationIcon, file->RemoteApplicationIcon);
|
2012-11-19 22:26:56 +04:00
|
|
|
if (~((size_t) file->RemoteApplicationFile))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_RemoteApplicationGuid, file->RemoteApplicationGuid);
|
2012-11-19 22:26:56 +04:00
|
|
|
if (~((size_t) file->RemoteApplicationGuid))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_RemoteApplicationGuid, file->RemoteApplicationGuid);
|
2012-11-19 22:26:56 +04:00
|
|
|
if (~((size_t) file->RemoteApplicationCmdLine))
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_string(settings, FreeRDP_RemoteApplicationCmdLine, file->RemoteApplicationCmdLine);
|
2012-10-28 05:30:08 +04:00
|
|
|
|
2012-12-13 23:38:02 +04:00
|
|
|
if (~file->SpanMonitors)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors);
|
2012-12-13 23:38:02 +04:00
|
|
|
if (~file->UseMultiMon)
|
2013-04-23 02:39:18 +04:00
|
|
|
freerdp_set_param_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon);
|
2012-12-13 23:38:02 +04:00
|
|
|
|
2012-10-28 05:30:08 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
rdpFile* freerdp_client_rdp_file_new()
|
|
|
|
{
|
|
|
|
rdpFile* file;
|
|
|
|
|
|
|
|
file = (rdpFile*) malloc(sizeof(rdpFile));
|
|
|
|
FillMemory(file, sizeof(rdpFile), 0xFF);
|
|
|
|
|
|
|
|
return file;
|
|
|
|
}
|
|
|
|
|
|
|
|
void freerdp_client_rdp_file_free(rdpFile* file)
|
|
|
|
{
|
|
|
|
free(file);
|
|
|
|
}
|