[client,common] avd related keys to rdp file parser

This commit is contained in:
akallabeth 2023-09-20 11:38:04 +02:00 committed by Martin Fleisz
parent 7746c8f4ae
commit 635626be12
5 changed files with 253 additions and 8 deletions

View File

@ -191,6 +191,14 @@ struct rdp_file
LPSTR ResourceProvider; /* resourceprovider */
LPSTR WvdEndpointPool; /* wvd endpoint pool */
LPSTR geo; /* geo */
LPSTR armpath; /* armpath */
LPSTR aadtenantid; /* aadtenantid" */
LPSTR diagnosticserviceurl; /* diagnosticserviceurl */
LPSTR hubdiscoverygeourl; /* hubdiscoverygeourl" */
LPSTR activityhint; /* activityhint */
DWORD UseRedirectionServerName; /* use redirection server name */
LPSTR GatewayAccessToken; /* gatewayaccesstoken */
@ -235,6 +243,7 @@ static const char key_str_shell_working_directory[] = "shell working directory";
static const char key_str_gatewayhostname[] = "gatewayhostname";
static const char key_str_gatewayaccesstoken[] = "gatewayaccesstoken";
static const char key_str_resourceprovider[] = "resourceprovider";
static const char str_resourceprovider_arm[] = "arm";
static const char key_str_kdcproxyname[] = "kdcproxyname";
static const char key_str_drivestoredirect[] = "drivestoredirect";
static const char key_str_devicestoredirect[] = "devicestoredirect";
@ -242,7 +251,15 @@ static const char key_str_winposstr[] = "winposstr";
static const char key_str_pcb[] = "pcb";
static const char key_str_selectedmonitors[] = "selectedmonitors";
static const char resource_provider_arm[] = "arm";
static const char key_str_wvd[] = "wvd endpoint pool";
static const char key_str_geo[] = "geo";
static const char key_str_armpath[] = "armpath";
static const char key_str_aadtenantid[] = "aadtenantid";
static const char key_str_diagnosticserviceurl[] = "diagnosticserviceurl";
static const char key_str_hubdiscoverygeourl[] = "hubdiscoverygeourl";
static const char key_str_activityhint[] = "activityhint";
static const char key_int_rdgiskdcproxy[] = "rdgiskdcproxy";
static const char key_int_use_redirection_server_name[] = "use redirection server name";
@ -536,6 +553,20 @@ static BOOL freerdp_client_rdp_file_find_string_entry(rdpFile* file, const char*
*outValue = &file->GatewayHostname;
else if (_stricmp(name, key_str_resourceprovider) == 0)
*outValue = &file->ResourceProvider;
else if (_stricmp(name, key_str_wvd) == 0)
*outValue = &file->WvdEndpointPool;
else if (_stricmp(name, key_str_geo) == 0)
*outValue = &file->geo;
else if (_stricmp(name, key_str_armpath) == 0)
*outValue = &file->armpath;
else if (_stricmp(name, key_str_aadtenantid) == 0)
*outValue = &file->aadtenantid;
else if (_stricmp(name, key_str_diagnosticserviceurl) == 0)
*outValue = &file->diagnosticserviceurl;
else if (_stricmp(name, key_str_hubdiscoverygeourl) == 0)
*outValue = &file->hubdiscoverygeourl;
else if (_stricmp(name, key_str_activityhint) == 0)
*outValue = &file->activityhint;
else if (_stricmp(name, key_str_gatewayaccesstoken) == 0)
*outValue = &file->GatewayAccessToken;
else if (_stricmp(name, key_str_kdcproxyname) == 0)
@ -1049,6 +1080,22 @@ static char* freerdp_client_channel_args_to_string(const rdpSettings* settings,
ARRAYSIZE(filters));
}
static BOOL rdp_opt_duplicate(const rdpSettings* _settings, size_t _id, char** _key)
{
WINPR_ASSERT(_settings);
WINPR_ASSERT(_key);
const char* tmp = freerdp_settings_get_string(_settings, _id);
if (tmp)
{
*_key = _strdup(tmp);
if (!*_key)
return FALSE;
}
return TRUE;
}
BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSettings* settings)
{
size_t index;
@ -1144,7 +1191,24 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett
}
if (freerdp_settings_get_bool(settings, FreeRDP_GatewayArmTransport))
file->ResourceProvider = _strdup(resource_provider_arm);
file->ResourceProvider = _strdup(str_resourceprovider_arm);
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdWvdEndpointPool, &file->WvdEndpointPool))
return FALSE;
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdGeo, &file->geo))
return FALSE;
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdArmpath, &file->armpath))
return FALSE;
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdAadtenantid, &file->aadtenantid))
return FALSE;
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdDiagnosticserviceurl,
&file->diagnosticserviceurl))
return FALSE;
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdHubdiscoverygeourl,
&file->hubdiscoverygeourl))
return FALSE;
if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdActivityhint, &file->activityhint))
return FALSE;
file->AudioCaptureMode = freerdp_settings_get_bool(settings, FreeRDP_AudioCapture);
file->BitmapCachePersistEnable =
@ -1516,6 +1580,13 @@ size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, s
WRITE_SETTING_STR(key_str_shell_working_directory, file->ShellWorkingDirectory);
WRITE_SETTING_STR(key_str_gatewayhostname, file->GatewayHostname);
WRITE_SETTING_STR(key_str_resourceprovider, file->ResourceProvider);
WRITE_SETTING_STR(key_str_wvd, file->WvdEndpointPool);
WRITE_SETTING_STR(key_str_geo, file->geo);
WRITE_SETTING_STR(key_str_armpath, file->armpath);
WRITE_SETTING_STR(key_str_aadtenantid, file->aadtenantid);
WRITE_SETTING_STR(key_str_diagnosticserviceurl, file->diagnosticserviceurl);
WRITE_SETTING_STR(key_str_hubdiscoverygeourl, file->hubdiscoverygeourl);
WRITE_SETTING_STR(key_str_activityhint, file->activityhint);
WRITE_SETTING_STR(key_str_gatewayaccesstoken, file->GatewayAccessToken);
WRITE_SETTING_STR(key_str_kdcproxyname, file->KdcProxyName);
WRITE_SETTING_STR(key_str_drivestoredirect, file->DrivesToRedirect);
@ -1906,13 +1977,60 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett
if (~((size_t)file->ResourceProvider))
{
if (_stricmp(file->ResourceProvider, resource_provider_arm) == 0)
if (_stricmp(file->ResourceProvider, str_resourceprovider_arm) == 0)
{
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayArmTransport, TRUE))
return FALSE;
}
}
if (~((size_t)file->WvdEndpointPool))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdWvdEndpointPool,
file->WvdEndpointPool))
return FALSE;
}
if (~((size_t)file->geo))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdGeo, file->geo))
return FALSE;
}
if (~((size_t)file->armpath))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdArmpath, file->armpath))
return FALSE;
}
if (~((size_t)file->aadtenantid))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdAadtenantid,
file->aadtenantid))
return FALSE;
}
if (~((size_t)file->diagnosticserviceurl))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdDiagnosticserviceurl,
file->diagnosticserviceurl))
return FALSE;
}
if (~((size_t)file->hubdiscoverygeourl))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdHubdiscoverygeourl,
file->hubdiscoverygeourl))
return FALSE;
}
if (~((size_t)file->activityhint))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAvdActivityhint,
file->activityhint))
return FALSE;
}
if (~((size_t)file->GatewayAccessToken))
{
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAccessToken,
@ -2480,7 +2598,7 @@ rdpFile* freerdp_client_rdp_file_new(void)
rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags)
{
rdpFile* file = (rdpFile*)malloc(sizeof(rdpFile));
rdpFile* file = (rdpFile*)calloc(1, sizeof(rdpFile));
if (!file)
return NULL;
@ -2547,6 +2665,13 @@ void freerdp_client_rdp_file_free(rdpFile* file)
freerdp_client_file_string_check_free(file->DevicesToRedirect);
freerdp_client_file_string_check_free(file->WinPosStr);
freerdp_client_file_string_check_free(file->ResourceProvider);
freerdp_client_file_string_check_free(file->WvdEndpointPool);
freerdp_client_file_string_check_free(file->geo);
freerdp_client_file_string_check_free(file->armpath);
freerdp_client_file_string_check_free(file->aadtenantid);
freerdp_client_file_string_check_free(file->diagnosticserviceurl);
freerdp_client_file_string_check_free(file->hubdiscoverygeourl);
freerdp_client_file_string_check_free(file->activityhint);
free(file);
}
}

View File

@ -491,6 +491,7 @@ extern "C"
* FreeRDP Settings Ids
* This is generated with a script parsing the rdpSettings data structure
*/
#define FreeRDP_instance (0)
#define FreeRDP_ServerMode (16)
#define FreeRDP_ShareId (17)
@ -771,6 +772,13 @@ extern "C"
#define FreeRDP_GatewayHttpExtAuthBearer (2002)
#define FreeRDP_GatewayUrl (2003)
#define FreeRDP_GatewayArmTransport (2004)
#define FreeRDP_GatewayAvdWvdEndpointPool (2005)
#define FreeRDP_GatewayAvdGeo (2006)
#define FreeRDP_GatewayAvdArmpath (2007)
#define FreeRDP_GatewayAvdAadtenantid (2008)
#define FreeRDP_GatewayAvdDiagnosticserviceurl (2009)
#define FreeRDP_GatewayAvdHubdiscoverygeourl (2010)
#define FreeRDP_GatewayAvdActivityhint (2011)
#define FreeRDP_ProxyType (2015)
#define FreeRDP_ProxyHostname (2016)
#define FreeRDP_ProxyPort (2017)
@ -933,9 +941,9 @@ extern "C"
#define FreeRDP_Floatbar (5196)
#define FreeRDP_TcpConnectTimeout (5197)
/**
* FreeRDP Settings Data Structure
*/
/**
* FreeRDP Settings Data Structure
*/
#define FreeRDP_Settings_StableAPI_MAX 5312
struct rdp_settings
@ -1352,7 +1360,14 @@ extern "C"
ALIGN64 char* GatewayHttpExtAuthBearer; /* 2002 */
ALIGN64 char* GatewayUrl; /* 2003 */
ALIGN64 BOOL GatewayArmTransport; /* 2004 */
UINT64 padding2015[2015 - 2005]; /* 2005 */
ALIGN64 char* GatewayAvdWvdEndpointPool; /* 2005 */
ALIGN64 char* GatewayAvdGeo; /* 2006 */
ALIGN64 char* GatewayAvdArmpath; /* 2007 */
ALIGN64 char* GatewayAvdAadtenantid; /* 2008 */
ALIGN64 char* GatewayAvdDiagnosticserviceurl; /* 2009 */
ALIGN64 char* GatewayAvdHubdiscoverygeourl; /* 2010 */
ALIGN64 char* GatewayAvdActivityhint; /* 2011 */
UINT64 padding2015[2015 - 2012]; /* 2012 */
/* Proxy */
ALIGN64 UINT32 ProxyType; /* 2015 */

View File

@ -2651,6 +2651,27 @@ const char* freerdp_settings_get_string(const rdpSettings* settings, size_t id)
case FreeRDP_GatewayAccessToken:
return settings->GatewayAccessToken;
case FreeRDP_GatewayAvdAadtenantid:
return settings->GatewayAvdAadtenantid;
case FreeRDP_GatewayAvdActivityhint:
return settings->GatewayAvdActivityhint;
case FreeRDP_GatewayAvdArmpath:
return settings->GatewayAvdArmpath;
case FreeRDP_GatewayAvdDiagnosticserviceurl:
return settings->GatewayAvdDiagnosticserviceurl;
case FreeRDP_GatewayAvdGeo:
return settings->GatewayAvdGeo;
case FreeRDP_GatewayAvdHubdiscoverygeourl:
return settings->GatewayAvdHubdiscoverygeourl;
case FreeRDP_GatewayAvdWvdEndpointPool:
return settings->GatewayAvdWvdEndpointPool;
case FreeRDP_GatewayDomain:
return settings->GatewayDomain;
@ -2932,6 +2953,27 @@ char* freerdp_settings_get_string_writable(rdpSettings* settings, size_t id)
case FreeRDP_GatewayAccessToken:
return settings->GatewayAccessToken;
case FreeRDP_GatewayAvdAadtenantid:
return settings->GatewayAvdAadtenantid;
case FreeRDP_GatewayAvdActivityhint:
return settings->GatewayAvdActivityhint;
case FreeRDP_GatewayAvdArmpath:
return settings->GatewayAvdArmpath;
case FreeRDP_GatewayAvdDiagnosticserviceurl:
return settings->GatewayAvdDiagnosticserviceurl;
case FreeRDP_GatewayAvdGeo:
return settings->GatewayAvdGeo;
case FreeRDP_GatewayAvdHubdiscoverygeourl:
return settings->GatewayAvdHubdiscoverygeourl;
case FreeRDP_GatewayAvdWvdEndpointPool:
return settings->GatewayAvdWvdEndpointPool;
case FreeRDP_GatewayDomain:
return settings->GatewayDomain;
@ -3222,6 +3264,27 @@ BOOL freerdp_settings_set_string_(rdpSettings* settings, size_t id, char* val, s
case FreeRDP_GatewayAccessToken:
return update_string_(&settings->GatewayAccessToken, cnv.c, len);
case FreeRDP_GatewayAvdAadtenantid:
return update_string_(&settings->GatewayAvdAadtenantid, cnv.c, len);
case FreeRDP_GatewayAvdActivityhint:
return update_string_(&settings->GatewayAvdActivityhint, cnv.c, len);
case FreeRDP_GatewayAvdArmpath:
return update_string_(&settings->GatewayAvdArmpath, cnv.c, len);
case FreeRDP_GatewayAvdDiagnosticserviceurl:
return update_string_(&settings->GatewayAvdDiagnosticserviceurl, cnv.c, len);
case FreeRDP_GatewayAvdGeo:
return update_string_(&settings->GatewayAvdGeo, cnv.c, len);
case FreeRDP_GatewayAvdHubdiscoverygeourl:
return update_string_(&settings->GatewayAvdHubdiscoverygeourl, cnv.c, len);
case FreeRDP_GatewayAvdWvdEndpointPool:
return update_string_(&settings->GatewayAvdWvdEndpointPool, cnv.c, len);
case FreeRDP_GatewayDomain:
return update_string_(&settings->GatewayDomain, cnv.c, len);
@ -3528,6 +3591,29 @@ BOOL freerdp_settings_set_string_copy_(rdpSettings* settings, size_t id, const c
case FreeRDP_GatewayAccessToken:
return update_string_copy_(&settings->GatewayAccessToken, cnv.cc, len, cleanup);
case FreeRDP_GatewayAvdAadtenantid:
return update_string_copy_(&settings->GatewayAvdAadtenantid, cnv.cc, len, cleanup);
case FreeRDP_GatewayAvdActivityhint:
return update_string_copy_(&settings->GatewayAvdActivityhint, cnv.cc, len, cleanup);
case FreeRDP_GatewayAvdArmpath:
return update_string_copy_(&settings->GatewayAvdArmpath, cnv.cc, len, cleanup);
case FreeRDP_GatewayAvdDiagnosticserviceurl:
return update_string_copy_(&settings->GatewayAvdDiagnosticserviceurl, cnv.cc, len,
cleanup);
case FreeRDP_GatewayAvdGeo:
return update_string_copy_(&settings->GatewayAvdGeo, cnv.cc, len, cleanup);
case FreeRDP_GatewayAvdHubdiscoverygeourl:
return update_string_copy_(&settings->GatewayAvdHubdiscoverygeourl, cnv.cc, len,
cleanup);
case FreeRDP_GatewayAvdWvdEndpointPool:
return update_string_copy_(&settings->GatewayAvdWvdEndpointPool, cnv.cc, len, cleanup);
case FreeRDP_GatewayDomain:
return update_string_copy_(&settings->GatewayDomain, cnv.cc, len, cleanup);

View File

@ -460,6 +460,18 @@ static const struct settings_str_entry settings_map[] = {
"FreeRDP_DynamicDSTTimeZoneKeyName" },
{ FreeRDP_GatewayAcceptedCert, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAcceptedCert" },
{ FreeRDP_GatewayAccessToken, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAccessToken" },
{ FreeRDP_GatewayAvdAadtenantid, FREERDP_SETTINGS_TYPE_STRING,
"FreeRDP_GatewayAvdAadtenantid" },
{ FreeRDP_GatewayAvdActivityhint, FREERDP_SETTINGS_TYPE_STRING,
"FreeRDP_GatewayAvdActivityhint" },
{ FreeRDP_GatewayAvdArmpath, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAvdArmpath" },
{ FreeRDP_GatewayAvdDiagnosticserviceurl, FREERDP_SETTINGS_TYPE_STRING,
"FreeRDP_GatewayAvdDiagnosticserviceurl" },
{ FreeRDP_GatewayAvdGeo, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayAvdGeo" },
{ FreeRDP_GatewayAvdHubdiscoverygeourl, FREERDP_SETTINGS_TYPE_STRING,
"FreeRDP_GatewayAvdHubdiscoverygeourl" },
{ FreeRDP_GatewayAvdWvdEndpointPool, FREERDP_SETTINGS_TYPE_STRING,
"FreeRDP_GatewayAvdWvdEndpointPool" },
{ FreeRDP_GatewayDomain, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayDomain" },
{ FreeRDP_GatewayHostname, FREERDP_SETTINGS_TYPE_STRING, "FreeRDP_GatewayHostname" },
{ FreeRDP_GatewayHttpExtAuthBearer, FREERDP_SETTINGS_TYPE_STRING,

View File

@ -371,6 +371,13 @@ static const size_t string_list_indices[] = {
FreeRDP_DynamicDSTTimeZoneKeyName,
FreeRDP_GatewayAcceptedCert,
FreeRDP_GatewayAccessToken,
FreeRDP_GatewayAvdAadtenantid,
FreeRDP_GatewayAvdActivityhint,
FreeRDP_GatewayAvdArmpath,
FreeRDP_GatewayAvdDiagnosticserviceurl,
FreeRDP_GatewayAvdGeo,
FreeRDP_GatewayAvdHubdiscoverygeourl,
FreeRDP_GatewayAvdWvdEndpointPool,
FreeRDP_GatewayDomain,
FreeRDP_GatewayHostname,
FreeRDP_GatewayHttpExtAuthBearer,