[core] VirtualChannelChunkSize adjustments

* add CHANNEL_CHUNK_MAX_LENGTH
* remove duplicate definitions
* default to CHANNEL_CHUNK_MAX_LENGTH
This commit is contained in:
Armin Novak 2023-11-02 15:38:13 +01:00 committed by akallabeth
parent 1bb09089a7
commit 98a4eb77ef
5 changed files with 22 additions and 15 deletions

View File

@ -1723,6 +1723,7 @@ extern "C"
* rdpSettings creation flags
*/
#define FREERDP_SETTINGS_SERVER_MODE 0x00000001
#define FREERDP_SETTINGS_REMOTE_MODE 0x00000002
/** \brief creates a new setting struct
*

View File

@ -17,6 +17,7 @@
* limitations under the License.
*/
#include <winpr/wtsapi.h>
#include <freerdp/config.h>
#include "capabilities.h"
@ -29,8 +30,6 @@
#define TAG FREERDP_TAG("core.capabilities")
#define CHANNEL_CHUNK_LENGTH 1600
static const char* const CAPSET_TYPE_STRINGS[] = { "Unknown",
"General",
"Bitmap",
@ -2120,11 +2119,16 @@ static BOOL rdp_apply_virtual_channel_capability_set(rdpSettings* settings, cons
* larger than CHANNEL_CHUNK_LENGTH (1600) bytes.
* Also prevent an invalid 0 size.
*/
if (!settings->ServerMode &&
((src->VirtualChannelChunkSize > 16256) || (src->VirtualChannelChunkSize == 0)))
settings->VirtualChannelChunkSize = CHANNEL_CHUNK_LENGTH;
else if (!settings->ServerMode)
settings->VirtualChannelChunkSize = src->VirtualChannelChunkSize;
if (!settings->ServerMode)
{
if ((src->VirtualChannelChunkSize > CHANNEL_CHUNK_MAX_LENGTH) ||
(src->VirtualChannelChunkSize == 0))
settings->VirtualChannelChunkSize = CHANNEL_CHUNK_LENGTH;
else
{
settings->VirtualChannelChunkSize = src->VirtualChannelChunkSize;
}
}
return TRUE;
}

View File

@ -2220,7 +2220,6 @@ rdpRdp* rdp_new(rdpContext* context)
{
rdpRdp* rdp;
DWORD flags = 0;
DWORD remoteFlags = 0;
rdp = (rdpRdp*)calloc(1, sizeof(rdpRdp));
if (!rdp)
@ -2238,8 +2237,6 @@ rdpRdp* rdp_new(rdpContext* context)
if (context->ServerMode)
flags |= FREERDP_SETTINGS_SERVER_MODE;
else
remoteFlags |= FREERDP_SETTINGS_SERVER_MODE;
if (!context->settings)
{
@ -2679,7 +2676,7 @@ const char* rdp_security_flag_string(UINT32 securityFlags, char* buffer, size_t
static BOOL rdp_reset_remote_settings(rdpRdp* rdp)
{
UINT32 flags = 0;
UINT32 flags = FREERDP_SETTINGS_REMOTE_MODE;
WINPR_ASSERT(rdp);
freerdp_settings_free(rdp->remoteSettings);

View File

@ -29,6 +29,7 @@
#include <winpr/path.h>
#include <winpr/sysinfo.h>
#include <winpr/registry.h>
#include <winpr/wtsapi.h>
#include <freerdp/settings.h>
#include <freerdp/build-config.h>
@ -340,6 +341,8 @@ rdpSettings* freerdp_settings_new(DWORD flags)
{
char* base;
char* issuers[] = { "FreeRDP", "FreeRDP-licenser" };
const BOOL server = (flags & FREERDP_SETTINGS_SERVER_MODE) != 0 ? TRUE : FALSE;
const BOOL remote = (flags & FREERDP_SETTINGS_REMOTE_MODE) != 0 ? TRUE : FALSE;
rdpSettings* settings = (rdpSettings*)calloc(1, sizeof(rdpSettings));
if (!settings)
@ -381,8 +384,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
NEGOTIATE_ORDER_SUPPORT | ZERO_BOUNDS_DELTA_SUPPORT |
COLOR_INDEX_SUPPORT) ||
!freerdp_settings_set_bool(settings, FreeRDP_SupportHeartbeatPdu, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_ServerMode,
(flags & FREERDP_SETTINGS_SERVER_MODE) ? TRUE : FALSE) ||
!freerdp_settings_set_bool(settings, FreeRDP_ServerMode, server) ||
!freerdp_settings_set_bool(settings, FreeRDP_WaitForOutputBufferFlush, TRUE) ||
!freerdp_settings_set_uint32(settings, FreeRDP_ClusterInfoFlags, REDIRECTION_SUPPORTED) ||
!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, 1024) ||
@ -627,11 +629,12 @@ rdpSettings* freerdp_settings_new(DWORD flags)
!freerdp_settings_set_uint32(settings, FreeRDP_RemoteAppNumIconCaches, 3) ||
!freerdp_settings_set_uint32(settings, FreeRDP_RemoteAppNumIconCacheEntries, 12) ||
!freerdp_settings_set_uint32(settings, FreeRDP_VirtualChannelChunkSize,
CHANNEL_CHUNK_LENGTH) ||
(server && !remote) ? CHANNEL_CHUNK_MAX_LENGTH
: CHANNEL_CHUNK_LENGTH) ||
/* [MS-RDPBCGR] 2.2.7.2.7 Large Pointer Capability Set (TS_LARGE_POINTER_CAPABILITYSET)
requires at least this size */
!freerdp_settings_set_uint32(settings, FreeRDP_MultifragMaxRequestSize,
(flags & FREERDP_SETTINGS_SERVER_MODE) ? 0 : 608299) ||
server ? 0 : 608299) ||
!freerdp_settings_set_bool(settings, FreeRDP_GatewayUseSameCredentials, FALSE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GatewayBypassLocal, FALSE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GatewayRpcTransport, TRUE) ||

View File

@ -27,6 +27,8 @@
#include <winpr/file.h>
#define CHANNEL_CHUNK_MAX_LENGTH 16256
#ifdef _WIN32
#define CurrentTime _CurrentTime /* Workaround for X11 "CurrentTime" header conflict */