BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings) { if (~((size_t) file->Domain)) freerdp_set_param_string(settings, FreeRDP_Domain, file->Domain); if (~((size_t) file->Username)) { char* user = NULL; char* domain = NULL; freerdp_parse_username(file->Username, &user, &domain); freerdp_set_param_string(settings, FreeRDP_Username, user); if (domain) freerdp_set_param_string(settings, FreeRDP_Domain, domain); if (user) free(user); if (domain) free(domain); } if (~((size_t) file->FullAddress)) { int port = -1; char* host = NULL; freerdp_parse_hostname(file->FullAddress, &host, &port); freerdp_set_param_string(settings, FreeRDP_ServerHostname, host); if (port > 0) freerdp_set_param_uint32(settings, FreeRDP_ServerPort, (UINT32) port); free(host); } if (~file->ServerPort) freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->ServerPort); if (~file->DesktopWidth) freerdp_set_param_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth); if (~file->DesktopHeight) freerdp_set_param_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight); if (~file->SessionBpp) freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp); if (~file->ConnectToConsole) freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->ConnectToConsole); if (~file->AdministrativeSession) freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession); if (~file->NegotiateSecurityLayer) freerdp_set_param_bool(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer); if (~file->EnableCredSSPSupport) freerdp_set_param_bool(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport); if (~((size_t) file->AlternateShell)) freerdp_set_param_string(settings, FreeRDP_AlternateShell, file->AlternateShell); if (~((size_t) file->ShellWorkingDirectory)) freerdp_set_param_string(settings, FreeRDP_ShellWorkingDirectory, file->ShellWorkingDirectory); if (~file->ScreenModeId) { /** * Screen Mode Id: * http://technet.microsoft.com/en-us/library/ff393692/ * * This setting corresponds to the selection in the Display * configuration slider on the Display tab under Options in RDC. * * Values: * * 1: The remote session will appear in a window. * 2: The remote session will appear full screen. */ freerdp_set_param_bool(settings, FreeRDP_Fullscreen, (file->ScreenModeId == 2) ? TRUE : FALSE); } if (~((size_t) file->SmartSizing)) { freerdp_set_param_bool(settings, FreeRDP_SmartSizing, (file->SmartSizing == 1) ? TRUE : FALSE); } if (~((size_t) file->LoadBalanceInfo)) { settings->LoadBalanceInfo = (BYTE*) _strdup(file->LoadBalanceInfo); settings->LoadBalanceInfoLength = (int) strlen((char*) settings->LoadBalanceInfo); } if (~file->AuthenticationLevel) { /** * Authentication Level: * http://technet.microsoft.com/en-us/library/ff393709/ * * This setting corresponds to the selection in the If server authentication * fails drop-down list on the Advanced tab under Options in RDC. * * Values: * * 0: If server authentication fails, connect to the computer without warning (Connect and don’t warn me). * 1: If server authentication fails, do not establish a connection (Do not connect). * 2: If server authentication fails, show a warning and allow me to connect or refuse the connection (Warn me). * 3: No authentication requirement is specified. */ freerdp_set_param_bool(settings, FreeRDP_IgnoreCertificate, (file->AuthenticationLevel == 0) ? TRUE : FALSE); } if (~file->ConnectionType) freerdp_set_param_uint32(settings, FreeRDP_ConnectionType, file->ConnectionType); if (~file->AudioMode) { if (file->AudioMode == AUDIO_MODE_REDIRECT) { freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, TRUE); } else if (file->AudioMode == AUDIO_MODE_PLAY_ON_SERVER) { freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, TRUE); } else if (file->AudioMode == AUDIO_MODE_NONE) { freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, FALSE); freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, FALSE); } } if (~file->Compression) freerdp_set_param_bool(settings, FreeRDP_CompressionEnabled, file->Compression); if (~((size_t) file->GatewayHostname)) { int port = -1; char* host = NULL; freerdp_parse_hostname(file->GatewayHostname, &host, &port); freerdp_set_param_string(settings, FreeRDP_GatewayHostname, host); if (port > 0) freerdp_set_param_uint32(settings, FreeRDP_GatewayPort, (UINT32) port); free(host); } if (~file->GatewayUsageMethod) freerdp_set_gateway_usage_method(settings, file->GatewayUsageMethod); if (~file->PromptCredentialOnce) freerdp_set_param_bool(settings, FreeRDP_GatewayUseSameCredentials, file->PromptCredentialOnce); if (~file->RemoteApplicationMode) freerdp_set_param_bool(settings, FreeRDP_RemoteApplicationMode, file->RemoteApplicationMode); if (~((size_t) file->RemoteApplicationProgram)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationProgram, file->RemoteApplicationProgram); if (~((size_t) file->RemoteApplicationName)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationName, file->RemoteApplicationName); if (~((size_t) file->RemoteApplicationIcon)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationIcon, file->RemoteApplicationIcon); if (~((size_t) file->RemoteApplicationFile)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationGuid, file->RemoteApplicationGuid); if (~((size_t) file->RemoteApplicationCmdLine)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationCmdLine, file->RemoteApplicationCmdLine); if (~file->SpanMonitors) freerdp_set_param_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors); if (~file->UseMultiMon) freerdp_set_param_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon); if (~file->AllowFontSmoothing) freerdp_set_param_bool(settings, FreeRDP_AllowFontSmoothing, file->AllowFontSmoothing); if (~file->DisableWallpaper) freerdp_set_param_bool(settings, FreeRDP_DisableWallpaper, file->DisableWallpaper); if (~file->DisableFullWindowDrag) freerdp_set_param_bool(settings, FreeRDP_DisableFullWindowDrag, file->DisableFullWindowDrag); if (~file->DisableMenuAnims) freerdp_set_param_bool(settings, FreeRDP_DisableMenuAnims, file->DisableMenuAnims); if (~file->DisableThemes) freerdp_set_param_bool(settings, FreeRDP_DisableThemes, file->DisableThemes); if (~file->AllowDesktopComposition) freerdp_set_param_bool(settings, FreeRDP_AllowDesktopComposition, file->AllowDesktopComposition); if (~file->BitmapCachePersistEnable) freerdp_set_param_bool(settings, FreeRDP_BitmapCachePersistEnabled, file->BitmapCachePersistEnable); if (~file->DisableRemoteAppCapsCheck) freerdp_set_param_bool(settings, FreeRDP_DisableRemoteAppCapsCheck, file->DisableRemoteAppCapsCheck); if (~file->AutoReconnectionEnabled) freerdp_set_param_bool(settings, FreeRDP_AutoReconnectionEnabled, file->AutoReconnectionEnabled); if (~file->AutoReconnectMaxRetries) freerdp_set_param_uint32(settings, FreeRDP_AutoReconnectMaxRetries, file->AutoReconnectMaxRetries); if (~file->RedirectSmartCards) freerdp_set_param_bool(settings, FreeRDP_RedirectSmartCards, file->RedirectSmartCards); if (~file->RedirectClipboard) freerdp_set_param_bool(settings, FreeRDP_RedirectClipboard, file->RedirectClipboard); if (~file->RedirectPrinters) freerdp_set_param_bool(settings, FreeRDP_RedirectPrinters, file->RedirectPrinters); if (~file->RedirectDrives) freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, file->RedirectDrives); if (~file->RedirectPosDevices) { freerdp_set_param_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts); freerdp_set_param_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts); } if (~file->RedirectComPorts) { freerdp_set_param_bool(settings, FreeRDP_RedirectSerialPorts, file->RedirectComPorts); freerdp_set_param_bool(settings, FreeRDP_RedirectParallelPorts, file->RedirectComPorts); } if (~file->RedirectDirectX) { /* What is this?! */ } if (~((size_t) file->DevicesToRedirect)) { /** * Devices to redirect: * http://technet.microsoft.com/en-us/library/ff393728/ * * This setting corresponds to the selections for Other supported Plug and Play * (PnP) devices under More on the Local Resources tab under Options in RDC. * * Values: * * '*': * Redirect all supported Plug and Play devices. * * 'DynamicDevices': * Redirect any supported Plug and Play devices that are connected later. * * The hardware ID for the supported Plug and Play device: * Redirect the specified supported Plug and Play device. * * Examples: * devicestoredirect:s:* * devicestoredirect:s:DynamicDevices * devicestoredirect:s:USB\VID_04A9&PID_30C1\6&4BD985D&0&2;,DynamicDevices * */ freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, TRUE); } if (~((size_t) file->DrivesToRedirect)) { /* * Drives to redirect: * * Very similar to DevicesToRedirect, but can contain a * comma-separated list of drive letters to redirect. */ freerdp_set_param_bool(settings, FreeRDP_RedirectDrives, TRUE); } if (file->argc > 1) { char* ConnectionFile = settings->ConnectionFile; settings->ConnectionFile = NULL; freerdp_client_settings_parse_command_line(settings, file->argc, file->argv); settings->ConnectionFile = ConnectionFile; } return TRUE; }
BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings) { if (~((size_t) file->Domain)) freerdp_set_param_string(settings, FreeRDP_Domain, file->Domain); if (~((size_t) file->Username)) { char* user; char* domain; freerdp_parse_username(file->Username, &user, &domain); freerdp_set_param_string(settings, FreeRDP_Username, user); if (domain != NULL) freerdp_set_param_string(settings, FreeRDP_Domain, domain); } if (~file->ServerPort) freerdp_set_param_uint32(settings, FreeRDP_ServerPort, file->ServerPort); if (~((size_t) file->FullAddress)) freerdp_set_param_string(settings, FreeRDP_ServerHostname, file->FullAddress); if (~file->DesktopWidth) freerdp_set_param_uint32(settings, FreeRDP_DesktopWidth, file->DesktopWidth); if (~file->DesktopHeight) freerdp_set_param_uint32(settings, FreeRDP_DesktopHeight, file->DesktopHeight); if (~file->SessionBpp) freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp); if (~file->ConnectToConsole) freerdp_set_param_uint32(settings, FreeRDP_ConsoleSession, file->ConnectToConsole); if (~file->AdministrativeSession) freerdp_set_param_uint32(settings, FreeRDP_ConsoleSession, file->AdministrativeSession); if (~file->NegotiateSecurityLayer) freerdp_set_param_uint32(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer); if (~file->EnableCredSSPSupport) freerdp_set_param_uint32(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport); if (~((size_t) file->AlternateShell)) freerdp_set_param_string(settings, FreeRDP_AlternateShell, file->AlternateShell); if (~((size_t) file->ShellWorkingDirectory)) freerdp_set_param_string(settings, FreeRDP_ShellWorkingDirectory, file->ShellWorkingDirectory); if (~((size_t) file->LoadBalanceInfo)) { settings->LoadBalanceInfo = (BYTE*) _strdup(file->LoadBalanceInfo); settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo); } if (~file->ConnectionType) freerdp_set_param_uint32(settings, FreeRDP_ConnectionType, file->ConnectionType); if (~file->AudioMode) { if (file->AudioMode == AUDIO_MODE_REDIRECT) { freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, TRUE); } else if (file->AudioMode == AUDIO_MODE_PLAY_ON_SERVER) { freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, TRUE); } else if (file->AudioMode == AUDIO_MODE_NONE) { freerdp_set_param_bool(settings, FreeRDP_AudioPlayback, FALSE); freerdp_set_param_bool(settings, FreeRDP_RemoteConsoleAudio, FALSE); } } if (~((size_t) file->GatewayHostname)) freerdp_set_param_string(settings, FreeRDP_GatewayHostname, file->GatewayHostname); if (~file->GatewayUsageMethod) { 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); } if (~file->PromptCredentialOnce) freerdp_set_param_bool(settings, FreeRDP_GatewayUseSameCredentials, TRUE); if (~file->RemoteApplicationMode) freerdp_set_param_bool(settings, FreeRDP_RemoteApplicationMode, file->RemoteApplicationMode); if (~((size_t) file->RemoteApplicationProgram)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationProgram, file->RemoteApplicationProgram); if (~((size_t) file->RemoteApplicationName)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationName, file->RemoteApplicationName); if (~((size_t) file->RemoteApplicationIcon)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationIcon, file->RemoteApplicationIcon); if (~((size_t) file->RemoteApplicationFile)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationGuid, file->RemoteApplicationGuid); if (~((size_t) file->RemoteApplicationGuid)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationGuid, file->RemoteApplicationGuid); if (~((size_t) file->RemoteApplicationCmdLine)) freerdp_set_param_string(settings, FreeRDP_RemoteApplicationCmdLine, file->RemoteApplicationCmdLine); if (~file->SpanMonitors) freerdp_set_param_bool(settings, FreeRDP_SpanMonitors, file->SpanMonitors); if (~file->UseMultiMon) freerdp_set_param_bool(settings, FreeRDP_UseMultimon, file->UseMultiMon); return TRUE; }