Merge pull request #10182 from akallabeth/fix_network_type_with_gfx

Fix network type with gfx
This commit is contained in:
akallabeth 2024-05-14 11:53:57 +02:00 committed by GitHub
commit e99f994933
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 74 additions and 49 deletions

View File

@ -1314,12 +1314,14 @@ static BOOL freerdp_apply_connection_type(rdpSettings* settings, UINT32 type)
{ FreeRDP_AllowDesktopComposition, { FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE } },
{ FreeRDP_DisableFullWindowDrag, { TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE } },
{ FreeRDP_DisableMenuAnims, { TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE } },
{ FreeRDP_DisableThemes, { TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE } },
{ FreeRDP_NetworkAutoDetect, { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE } }
{ FreeRDP_DisableThemes, { TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE } }
};
switch (type)
{
case CONNECTION_TYPE_INVALID:
return TRUE;
case CONNECTION_TYPE_MODEM:
case CONNECTION_TYPE_BROADBAND_LOW:
case CONNECTION_TYPE_BROADBAND_HIGH:
@ -1329,7 +1331,7 @@ static BOOL freerdp_apply_connection_type(rdpSettings* settings, UINT32 type)
case CONNECTION_TYPE_AUTODETECT:
break;
default:
WLog_WARN(TAG, "Invalid ConnectionType %" PRIu32 ", aborting", type);
WLog_WARN(TAG, "Unknown ConnectionType %" PRIu32 ", aborting", type);
return FALSE;
}
@ -1350,26 +1352,12 @@ BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type)
switch (type)
{
case CONNECTION_TYPE_INVALID:
case CONNECTION_TYPE_MODEM:
if (!freerdp_apply_connection_type(settings, type))
return FALSE;
break;
case CONNECTION_TYPE_BROADBAND_LOW:
if (!freerdp_apply_connection_type(settings, type))
return FALSE;
break;
case CONNECTION_TYPE_SATELLITE:
if (!freerdp_apply_connection_type(settings, type))
return FALSE;
break;
case CONNECTION_TYPE_BROADBAND_HIGH:
if (!freerdp_apply_connection_type(settings, type))
return FALSE;
break;
case CONNECTION_TYPE_WAN:
if (!freerdp_apply_connection_type(settings, type))
return FALSE;
break;
case CONNECTION_TYPE_LAN:
if (!freerdp_apply_connection_type(settings, type))
return FALSE;
@ -1389,6 +1377,7 @@ BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type)
return FALSE;
break;
default:
WLog_WARN(TAG, "Unknown ConnectionType %" PRIu32 ", aborting", type);
return FALSE;
}
@ -3079,9 +3068,11 @@ static int parse_network_options(rdpSettings* settings, const COMMAND_LINE_ARGUM
WINPR_ASSERT(settings);
WINPR_ASSERT(arg);
UINT32 type = 0;
UINT32 type = CONNECTION_TYPE_INVALID;
if (option_equals(arg->Value, "modem"))
if (option_equals(arg->Value, "invalid"))
type = CONNECTION_TYPE_INVALID;
else if (option_equals(arg->Value, "modem"))
type = CONNECTION_TYPE_MODEM;
else if (option_equals(arg->Value, "broadband"))
type = CONNECTION_TYPE_BROADBAND_HIGH;
@ -3102,7 +3093,7 @@ static int parse_network_options(rdpSettings* settings, const COMMAND_LINE_ARGUM
{
LONGLONG val = 0;
if (!value_to_int(arg->Value, &val, 1, 7))
if (!value_to_int(arg->Value, &val, 0, 7))
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
type = (UINT32)val;

View File

@ -341,7 +341,7 @@ static const COMMAND_LINE_ARGUMENT_A global_cmd_args[] = {
{ "nego", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
"protocol security negotiation" },
{ "network", COMMAND_LINE_VALUE_REQUIRED,
"[modem|broadband|broadband-low|broadband-high|wan|lan|auto]", NULL, NULL, -1, NULL,
"[invalid|modem|broadband|broadband-low|broadband-high|wan|lan|auto]", NULL, NULL, -1, NULL,
"Network connection type" },
{ "nsc", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "nscodec", "NSCodec support" },
#if defined(WITH_FREERDP_DEPRECATED_COMMANDLINE)

View File

@ -1253,8 +1253,10 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett
freerdp_settings_get_bool(settings, FreeRDP_DisableFullWindowDrag);
file->DisableMenuAnims = freerdp_settings_get_bool(settings, FreeRDP_DisableMenuAnims);
file->DisableThemes = freerdp_settings_get_bool(settings, FreeRDP_DisableThemes);
file->BandwidthAutoDetect =
(freerdp_settings_get_uint32(settings, FreeRDP_ConnectionType) >= 7) ? TRUE : FALSE;
file->BandwidthAutoDetect = (freerdp_settings_get_uint32(settings, FreeRDP_ConnectionType) >=
CONNECTION_TYPE_AUTODETECT)
? TRUE
: FALSE;
file->NetworkAutoDetect =
freerdp_settings_get_bool(settings, FreeRDP_NetworkAutoDetect) ? 1 : 0;
file->AutoReconnectionEnabled =

View File

@ -85,6 +85,9 @@ extern "C"
#define PERF_ENABLE_DESKTOP_COMPOSITION 0x00000100
/* Connection Types */
#define CONNECTION_TYPE_INVALID \
0x00 /* synthetic, removes RNS_UD_CS_VALID_CONNECTION_TYPE from ConnectionType in \
EarlyCapabilityFlags */
#define CONNECTION_TYPE_MODEM 0x01
#define CONNECTION_TYPE_BROADBAND_LOW 0x02
#define CONNECTION_TYPE_SATELLITE 0x03

View File

@ -812,30 +812,45 @@ state_run_t autodetect_recv_request_packet(rdpAutoDetect* autodetect, RDP_TRANSP
Stream_Read_UINT16(s, autodetectReqPdu.sequenceNumber); /* sequenceNumber (2 bytes) */
Stream_Read_UINT16(s, autodetectReqPdu.requestType); /* requestType (2 bytes) */
char rbuffer[128] = { 0 };
const char* requestTypeStr = autodetect_request_type_to_string_buffer(
autodetectReqPdu.requestType, rbuffer, sizeof(rbuffer));
if (WLog_IsLevelActive(autodetect->log, WLOG_TRACE))
{
char rbuffer[128] = { 0 };
const char* requestTypeStr = autodetect_request_type_to_string_buffer(
autodetectReqPdu.requestType, rbuffer, sizeof(rbuffer));
char hbuffer[128] = { 0 };
const char* headerStr =
autodetect_header_type_string(autodetectReqPdu.headerTypeId, hbuffer, sizeof(hbuffer));
char hbuffer[128] = { 0 };
const char* headerStr =
autodetect_header_type_string(autodetectReqPdu.headerTypeId, hbuffer, sizeof(hbuffer));
WLog_Print(autodetect->log, WLOG_TRACE,
"rdp_recv_autodetect_request_packet: headerLength=%" PRIu8
", headerTypeId=%s, sequenceNumber=%" PRIu16 ", requestType=%s",
autodetectReqPdu.headerLength, headerStr, autodetectReqPdu.sequenceNumber,
requestTypeStr);
WLog_Print(autodetect->log, WLOG_TRACE,
"rdp_recv_autodetect_request_packet: headerLength=%" PRIu8
", headerTypeId=%s, sequenceNumber=%" PRIu16 ", requestType=%s",
autodetectReqPdu.headerLength, headerStr, autodetectReqPdu.sequenceNumber,
requestTypeStr);
}
if (!freerdp_settings_get_bool(settings, FreeRDP_NetworkAutoDetect))
{
char rbuffer[128] = { 0 };
const char* requestTypeStr = autodetect_request_type_to_string_buffer(
autodetectReqPdu.requestType, rbuffer, sizeof(rbuffer));
WLog_Print(autodetect->log, WLOG_WARN,
"Received a [MS-RDPBCGR] 2.2.14.1.1 RTT Measure Request [%s] "
"message but support was not enabled",
requestTypeStr);
goto fail;
}
if (autodetectReqPdu.headerTypeId != TYPE_ID_AUTODETECT_REQUEST)
{
char rbuffer[128] = { 0 };
const char* requestTypeStr = autodetect_request_type_to_string_buffer(
autodetectReqPdu.requestType, rbuffer, sizeof(rbuffer));
char hbuffer[128] = { 0 };
const char* headerStr =
autodetect_header_type_string(autodetectReqPdu.headerTypeId, hbuffer, sizeof(hbuffer));
WLog_Print(autodetect->log, WLOG_ERROR,
"Received a [MS-RDPBCGR] 2.2.14.1.1 RTT Measure Request [%s] "
"message with invalid headerTypeId=%s",
@ -919,31 +934,44 @@ state_run_t autodetect_recv_response_packet(rdpAutoDetect* autodetect, RDP_TRANS
Stream_Read_UINT16(s, autodetectRspPdu.sequenceNumber); /* sequenceNumber (2 bytes) */
Stream_Read_UINT16(s, autodetectRspPdu.responseType); /* responseType (2 bytes) */
char rbuffer[128] = { 0 };
if (WLog_IsLevelActive(autodetect->log, WLOG_TRACE))
{
char rbuffer[128] = { 0 };
const char* requestStr = autodetect_request_type_to_string_buffer(
autodetectRspPdu.responseType, rbuffer, sizeof(rbuffer));
char hbuffer[128] = { 0 };
const char* headerStr =
autodetect_header_type_string(autodetectRspPdu.headerTypeId, hbuffer, sizeof(hbuffer));
const char* requestStr = autodetect_request_type_to_string_buffer(autodetectRspPdu.responseType,
rbuffer, sizeof(rbuffer));
char hbuffer[128] = { 0 };
const char* headerStr =
autodetect_header_type_string(autodetectRspPdu.headerTypeId, hbuffer, sizeof(hbuffer));
WLog_Print(autodetect->log, WLOG_TRACE,
"rdp_recv_autodetect_response_packet: headerLength=%" PRIu8 ", headerTypeId=%s"
", sequenceNumber=%" PRIu16 ", requestType=%s",
autodetectRspPdu.headerLength, headerStr, autodetectRspPdu.sequenceNumber,
requestStr);
WLog_Print(autodetect->log, WLOG_TRACE,
"rdp_recv_autodetect_response_packet: headerLength=%" PRIu8 ", headerTypeId=%s"
", sequenceNumber=%" PRIu16 ", requestType=%s",
autodetectRspPdu.headerLength, headerStr, autodetectRspPdu.sequenceNumber,
requestStr);
}
if (!freerdp_settings_get_bool(settings, FreeRDP_NetworkAutoDetect))
{
char rbuffer[128] = { 0 };
const char* requestStr = autodetect_request_type_to_string_buffer(
autodetectRspPdu.responseType, rbuffer, sizeof(rbuffer));
WLog_Print(autodetect->log, WLOG_WARN,
"Received a [MS-RDPBCGR] 2.2.14.2.1 RTT Measure Response [%s] "
"message but support was not enabled",
requestStr);
return STATE_RUN_FAILED;
}
if (autodetectRspPdu.headerTypeId != TYPE_ID_AUTODETECT_RESPONSE)
{
char rbuffer[128] = { 0 };
const char* requestStr = autodetect_request_type_to_string_buffer(
autodetectRspPdu.responseType, rbuffer, sizeof(rbuffer));
char hbuffer[128] = { 0 };
const char* headerStr =
autodetect_header_type_string(autodetectRspPdu.headerTypeId, hbuffer, sizeof(hbuffer));
WLog_Print(autodetect->log, WLOG_ERROR,
"Received a [MS-RDPBCGR] 2.2.14.2.1 RTT Measure Response [%s] "
"message with invalid headerTypeId=%s",

View File

@ -448,7 +448,8 @@ rdpSettings* freerdp_settings_new(DWORD flags)
!freerdp_settings_set_bool(settings, FreeRDP_DisableFullWindowDrag, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_DisableMenuAnims, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_DisableThemes, FALSE) ||
!freerdp_settings_set_uint32(settings, FreeRDP_ConnectionType, CONNECTION_TYPE_LAN) ||
!freerdp_settings_set_uint32(settings, FreeRDP_ConnectionType,
CONNECTION_TYPE_AUTODETECT) ||
!freerdp_settings_set_bool(settings, FreeRDP_NetworkAutoDetect, TRUE) ||
!freerdp_settings_set_uint32(settings, FreeRDP_EncryptionMethods, ENCRYPTION_METHOD_NONE) ||
!freerdp_settings_set_uint32(settings, FreeRDP_EncryptionLevel, ENCRYPTION_LEVEL_NONE) ||