Proper use of rdpSettings in client
* Use getter/setter * Fix uninitialized uses
This commit is contained in:
parent
54938efc77
commit
d22ef1786b
@ -1243,7 +1243,7 @@ static BOOL xf_pre_connect(freerdp* instance)
|
||||
if (settings->AuthenticationOnly)
|
||||
{
|
||||
/* Check +auth-only has a username and password. */
|
||||
if (!settings->Password)
|
||||
if (!freerdp_settings_get_string(settings, FreeRDP_Password))
|
||||
{
|
||||
WLog_INFO(TAG, "auth-only, but no password set. Please provide one.");
|
||||
return FALSE;
|
||||
@ -1476,9 +1476,16 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
|
||||
|
||||
EventArgsInit(&timerEvent, "xfreerdp");
|
||||
instance = (freerdp*)param;
|
||||
context = instance->context;
|
||||
WINPR_ASSERT(instance);
|
||||
|
||||
status = freerdp_connect(instance);
|
||||
context = instance->context;
|
||||
WINPR_ASSERT(context);
|
||||
xfc = (xfContext*)instance->context;
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
settings = context->settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
@ -1594,7 +1601,6 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
|
||||
goto disconnect;
|
||||
}
|
||||
|
||||
settings = context->settings;
|
||||
timer = CreateWaitableTimerA(NULL, FALSE, "mainloop-periodic-timer");
|
||||
|
||||
if (!timer)
|
||||
|
@ -173,6 +173,7 @@ BOOL xf_event_action_script_init(xfContext* xfc)
|
||||
char buffer[1024] = { 0 };
|
||||
char command[1024] = { 0 };
|
||||
const rdpSettings* settings;
|
||||
const char* ActionScript;
|
||||
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
@ -186,7 +187,8 @@ BOOL xf_event_action_script_init(xfContext* xfc)
|
||||
|
||||
obj = ArrayList_Object(xfc->xevents);
|
||||
obj->fnObjectFree = free;
|
||||
sprintf_s(command, sizeof(command), "%s xevent", settings->ActionScript);
|
||||
ActionScript = freerdp_settings_get_string(settings, FreeRDP_ActionScript);
|
||||
sprintf_s(command, sizeof(command), "%s xevent", ActionScript);
|
||||
actionScript = popen(command, "r");
|
||||
|
||||
if (!actionScript)
|
||||
@ -228,6 +230,7 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
|
||||
FILE* actionScript;
|
||||
BOOL match = FALSE;
|
||||
const char* xeventName;
|
||||
const char* ActionScript;
|
||||
char buffer[1024] = { 0 };
|
||||
char command[1024] = { 0 };
|
||||
|
||||
@ -254,8 +257,8 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
|
||||
if (!match)
|
||||
return FALSE;
|
||||
|
||||
sprintf_s(command, sizeof(command), "%s xevent %s %lu",
|
||||
xfc->common.context.settings->ActionScript, xeventName,
|
||||
ActionScript = freerdp_settings_get_string(xfc->common.context.settings, FreeRDP_ActionScript);
|
||||
sprintf_s(command, sizeof(command), "%s xevent %s %lu", ActionScript, xeventName,
|
||||
(unsigned long)xfc->window->handle);
|
||||
actionScript = popen(command, "r");
|
||||
|
||||
|
@ -66,12 +66,14 @@ static BOOL xf_keyboard_action_script_init(xfContext* xfc)
|
||||
char buffer[1024] = { 0 };
|
||||
char command[1024] = { 0 };
|
||||
const rdpSettings* settings;
|
||||
const char* ActionScript;
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
settings = xfc->common.context.settings;
|
||||
WINPR_ASSERT(settings);
|
||||
|
||||
xfc->actionScriptExists = winpr_PathFileExists(settings->ActionScript);
|
||||
ActionScript = freerdp_settings_get_string(settings, FreeRDP_ActionScript);
|
||||
xfc->actionScriptExists = winpr_PathFileExists(ActionScript);
|
||||
|
||||
if (!xfc->actionScriptExists)
|
||||
return FALSE;
|
||||
@ -83,7 +85,7 @@ static BOOL xf_keyboard_action_script_init(xfContext* xfc)
|
||||
|
||||
obj = ArrayList_Object(xfc->keyCombinations);
|
||||
obj->fnObjectFree = free;
|
||||
sprintf_s(command, sizeof(command), "%s key", settings->ActionScript);
|
||||
sprintf_s(command, sizeof(command), "%s key", ActionScript);
|
||||
keyScript = popen(command, "r");
|
||||
|
||||
if (!keyScript)
|
||||
@ -455,6 +457,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
|
||||
char buffer[1024] = { 0 };
|
||||
char command[2048] = { 0 };
|
||||
char combination[1024] = { 0 };
|
||||
const char* ActionScript;
|
||||
|
||||
if (!xfc->actionScriptExists)
|
||||
return 1;
|
||||
@ -501,8 +504,8 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
|
||||
if (!match)
|
||||
return 1;
|
||||
|
||||
sprintf_s(command, sizeof(command), "%s key %s", xfc->common.context.settings->ActionScript,
|
||||
combination);
|
||||
ActionScript = freerdp_settings_get_string(xfc->common.context.settings, FreeRDP_ActionScript);
|
||||
sprintf_s(command, sizeof(command), "%s key %s", ActionScript, combination);
|
||||
keyScript = popen(command, "r");
|
||||
|
||||
if (!keyScript)
|
||||
|
@ -593,7 +593,8 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig
|
||||
XMoveWindow(xfc->display, window->handle, settings->DesktopPosX, settings->DesktopPosY);
|
||||
}
|
||||
|
||||
window->floatbar = xf_floatbar_new(xfc, window->handle, name, settings->Floatbar);
|
||||
window->floatbar = xf_floatbar_new(xfc, window->handle, name,
|
||||
freerdp_settings_get_uint32(settings, FreeRDP_Floatbar));
|
||||
|
||||
if (xfc->_XWAYLAND_MAY_GRAB_KEYBOARD)
|
||||
xf_SendClientEvent(xfc, window->handle, xfc->_XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
|
||||
|
@ -206,10 +206,11 @@ static BOOL freerdp_client_settings_post_process(rdpSettings* settings)
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
if (settings->Password)
|
||||
if (freerdp_settings_get_string(settings, FreeRDP_Password))
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayPassword,
|
||||
settings->Password))
|
||||
if (!freerdp_settings_set_string(
|
||||
settings, FreeRDP_GatewayPassword,
|
||||
freerdp_settings_get_string(settings, FreeRDP_Password)))
|
||||
goto out_error;
|
||||
}
|
||||
}
|
||||
|
@ -2577,7 +2577,8 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
ULONGLONG val;
|
||||
if (!value_to_uint(arg->Value, &val, 1, 600000))
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
settings->TcpAckTimeout = (UINT32)val;
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_TcpAckTimeout, (UINT32)val))
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "aero")
|
||||
{
|
||||
@ -3026,7 +3027,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
CommandLineSwitchCase(arg, "floatbar")
|
||||
{
|
||||
/* Defaults are enabled, visible, sticky, fullscreen */
|
||||
settings->Floatbar = 0x0017;
|
||||
UINT32 Floatbar = 0x0017;
|
||||
|
||||
if (arg->Value)
|
||||
{
|
||||
@ -3047,12 +3048,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
if (_strnicmp(cur, "sticky:", 7) == 0)
|
||||
{
|
||||
const char* val = cur + 7;
|
||||
settings->Floatbar &= ~0x02u;
|
||||
Floatbar &= ~0x02u;
|
||||
|
||||
if (_strnicmp(val, "on", 3) == 0)
|
||||
settings->Floatbar |= 0x02u;
|
||||
Floatbar |= 0x02u;
|
||||
else if (_strnicmp(val, "off", 4) == 0)
|
||||
settings->Floatbar &= ~0x02u;
|
||||
Floatbar &= ~0x02u;
|
||||
else
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
@ -3060,12 +3061,12 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
else if (_strnicmp(cur, "default:", 8) == 0)
|
||||
{
|
||||
const char* val = cur + 8;
|
||||
settings->Floatbar &= ~0x04u;
|
||||
Floatbar &= ~0x04u;
|
||||
|
||||
if (_strnicmp(val, "visible", 8) == 0)
|
||||
settings->Floatbar |= 0x04u;
|
||||
Floatbar |= 0x04u;
|
||||
else if (_strnicmp(val, "hidden", 7) == 0)
|
||||
settings->Floatbar &= ~0x04u;
|
||||
Floatbar &= ~0x04u;
|
||||
else
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
@ -3073,20 +3074,22 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
else if (_strnicmp(cur, "show:", 5) == 0)
|
||||
{
|
||||
const char* val = cur + 5;
|
||||
settings->Floatbar &= ~0x30u;
|
||||
Floatbar &= ~0x30u;
|
||||
|
||||
if (_strnicmp(val, "always", 7) == 0)
|
||||
settings->Floatbar |= 0x30u;
|
||||
Floatbar |= 0x30u;
|
||||
else if (_strnicmp(val, "fullscreen", 11) == 0)
|
||||
settings->Floatbar |= 0x10u;
|
||||
Floatbar |= 0x10u;
|
||||
else if (_strnicmp(val, "window", 7) == 0)
|
||||
settings->Floatbar |= 0x20u;
|
||||
Floatbar |= 0x20u;
|
||||
else
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
else
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
} while (start);
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_Floatbar, Floatbar))
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
}
|
||||
CommandLineSwitchCase(arg, "mouse-motion")
|
||||
@ -3967,10 +3970,13 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (settings->DynamicChannelCount)
|
||||
settings->SupportDynamicChannels = TRUE;
|
||||
if (freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount) > 0)
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_SupportDynamicChannels, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (settings->SupportDynamicChannels)
|
||||
if (freerdp_settings_get_bool(settings, FreeRDP_SupportDynamicChannels))
|
||||
{
|
||||
if (!freerdp_client_load_static_channel_addin(channels, settings, DRDYNVC_SVC_CHANNEL_NAME,
|
||||
settings))
|
||||
|
Loading…
Reference in New Issue
Block a user