Removed rdpMcs::settings

This commit is contained in:
akallabeth 2021-09-03 11:31:21 +02:00 committed by akallabeth
parent c2f1562a4b
commit 6a5070722a
3 changed files with 151 additions and 20 deletions

View File

@ -492,7 +492,15 @@ BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length)
BOOL gcc_write_client_data_blocks(wStream* s, rdpMcs* mcs) BOOL gcc_write_client_data_blocks(wStream* s, rdpMcs* mcs)
{ {
rdpSettings* settings = mcs->settings; rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (!gcc_write_client_core_data(s, mcs) || !gcc_write_client_cluster_data(s, mcs) || if (!gcc_write_client_core_data(s, mcs) || !gcc_write_client_cluster_data(s, mcs) ||
!gcc_write_client_security_data(s, mcs) || !gcc_write_client_network_data(s, mcs)) !gcc_write_client_security_data(s, mcs) || !gcc_write_client_network_data(s, mcs))
return FALSE; return FALSE;
@ -690,7 +698,14 @@ BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
UINT16 supportedColorDepths = 0; UINT16 supportedColorDepths = 0;
UINT32 serverSelectedProtocol = 0; UINT32 serverSelectedProtocol = 0;
UINT16 earlyCapabilityFlags = 0; UINT16 earlyCapabilityFlags = 0;
rdpSettings* settings = mcs->settings; rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
/* Length of all required fields, until imeFileName */ /* Length of all required fields, until imeFileName */
if (blockLength < 128) if (blockLength < 128)
@ -945,7 +960,16 @@ BOOL gcc_write_client_core_data(wStream* s, rdpMcs* mcs)
UINT16 earlyCapabilityFlags; UINT16 earlyCapabilityFlags;
WCHAR* clientDigProductId = NULL; WCHAR* clientDigProductId = NULL;
int clientDigProductIdLength; int clientDigProductIdLength;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (!gcc_write_user_data_header(s, CS_CORE, 234)) if (!gcc_write_user_data_header(s, CS_CORE, 234))
return FALSE; return FALSE;
clientNameLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientHostname, -1, &clientName, 0); clientNameLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientHostname, -1, &clientName, 0);
@ -1047,7 +1071,15 @@ BOOL gcc_read_server_core_data(wStream* s, rdpMcs* mcs)
UINT32 serverVersion; UINT32 serverVersion;
UINT32 clientRequestedProtocols; UINT32 clientRequestedProtocols;
UINT32 earlyCapabilityFlags; UINT32 earlyCapabilityFlags;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (Stream_GetRemainingLength(s) < 4) if (Stream_GetRemainingLength(s) < 4)
return FALSE; return FALSE;
@ -1071,7 +1103,14 @@ BOOL gcc_read_server_core_data(wStream* s, rdpMcs* mcs)
BOOL gcc_write_server_core_data(wStream* s, const rdpMcs* mcs) BOOL gcc_write_server_core_data(wStream* s, const rdpMcs* mcs)
{ {
UINT32 earlyCapabilityFlags = 0; UINT32 earlyCapabilityFlags = 0;
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (!gcc_write_user_data_header(s, SC_CORE, 16)) if (!gcc_write_user_data_header(s, SC_CORE, 16))
return FALSE; return FALSE;
@ -1094,7 +1133,15 @@ BOOL gcc_write_server_core_data(wStream* s, const rdpMcs* mcs)
BOOL gcc_read_client_security_data(wStream* s, rdpMcs* mcs, UINT16 blockLength) BOOL gcc_read_client_security_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{ {
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (blockLength < 8) if (blockLength < 8)
return FALSE; return FALSE;
@ -1125,7 +1172,15 @@ BOOL gcc_read_client_security_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
BOOL gcc_write_client_security_data(wStream* s, const rdpMcs* mcs) BOOL gcc_write_client_security_data(wStream* s, const rdpMcs* mcs)
{ {
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (!gcc_write_user_data_header(s, CS_SECURITY, 12)) if (!gcc_write_user_data_header(s, CS_SECURITY, 12))
return FALSE; return FALSE;
@ -1147,7 +1202,16 @@ BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs)
{ {
const BYTE* data; const BYTE* data;
UINT32 length; UINT32 length;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
BOOL validCryptoConfig = FALSE; BOOL validCryptoConfig = FALSE;
UINT32 serverEncryptionMethod; UINT32 serverEncryptionMethod;
@ -1334,7 +1398,15 @@ BOOL gcc_write_server_security_data(wStream* s, rdpMcs* mcs)
BYTE encryptedSignature[TSSK_KEY_LENGTH]; BYTE encryptedSignature[TSSK_KEY_LENGTH];
BYTE signature[sizeof(initial_signature)]; BYTE signature[sizeof(initial_signature)];
UINT32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen; UINT32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
/** /**
* Re: settings->EncryptionLevel: * Re: settings->EncryptionLevel:
@ -1709,7 +1781,15 @@ BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
{ {
UINT32 flags; UINT32 flags;
UINT32 redirectedSessionId; UINT32 redirectedSessionId;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (blockLength < 8) if (blockLength < 8)
return FALSE; return FALSE;
@ -1742,7 +1822,15 @@ BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
BOOL gcc_write_client_cluster_data(wStream* s, const rdpMcs* mcs) BOOL gcc_write_client_cluster_data(wStream* s, const rdpMcs* mcs)
{ {
UINT32 flags; UINT32 flags;
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (!gcc_write_user_data_header(s, CS_CLUSTER, 12)) if (!gcc_write_user_data_header(s, CS_CLUSTER, 12))
return FALSE; return FALSE;
flags = REDIRECTION_SUPPORTED | (REDIRECTION_VERSION4 << 2); flags = REDIRECTION_SUPPORTED | (REDIRECTION_VERSION4 << 2);
@ -1771,7 +1859,15 @@ BOOL gcc_read_client_monitor_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
UINT32 flags; UINT32 flags;
UINT32 monitorCount; UINT32 monitorCount;
UINT32 left, top, right, bottom; UINT32 left, top, right, bottom;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (blockLength < 8) if (blockLength < 8)
return FALSE; return FALSE;
@ -1831,7 +1927,14 @@ BOOL gcc_write_client_monitor_data(wStream* s, const rdpMcs* mcs)
UINT16 length; UINT16 length;
UINT32 left, top, right, bottom, flags; UINT32 left, top, right, bottom, flags;
INT32 baseX = 0, baseY = 0; INT32 baseX = 0, baseY = 0;
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (settings->MonitorCount > 1) if (settings->MonitorCount > 1)
{ {
@ -1876,7 +1979,15 @@ BOOL gcc_read_client_monitor_extended_data(wStream* s, rdpMcs* mcs, UINT16 block
UINT32 flags; UINT32 flags;
UINT32 monitorCount; UINT32 monitorCount;
UINT32 monitorAttributeSize; UINT32 monitorAttributeSize;
rdpSettings* settings = mcs->settings;
rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (blockLength < 12) if (blockLength < 12)
return FALSE; return FALSE;
@ -1918,7 +2029,14 @@ BOOL gcc_write_client_monitor_extended_data(wStream* s, const rdpMcs* mcs)
{ {
UINT32 i; UINT32 i;
UINT16 length; UINT16 length;
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (settings->HasMonitorAttributes) if (settings->HasMonitorAttributes)
{ {
@ -1975,7 +2093,14 @@ BOOL gcc_read_client_message_channel_data(wStream* s, rdpMcs* mcs, UINT16 blockL
BOOL gcc_write_client_message_channel_data(wStream* s, const rdpMcs* mcs) BOOL gcc_write_client_message_channel_data(wStream* s, const rdpMcs* mcs)
{ {
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (settings->NetworkAutoDetect || settings->SupportHeartbeatPdu || if (settings->NetworkAutoDetect || settings->SupportHeartbeatPdu ||
settings->SupportMultitransport) settings->SupportMultitransport)
@ -2039,7 +2164,14 @@ BOOL gcc_read_client_multitransport_channel_data(wStream* s, rdpMcs* mcs, UINT16
BOOL gcc_write_client_multitransport_channel_data(wStream* s, const rdpMcs* mcs) BOOL gcc_write_client_multitransport_channel_data(wStream* s, const rdpMcs* mcs)
{ {
const rdpSettings* settings = mcs->settings; const rdpSettings* settings;
WINPR_ASSERT(s);
WINPR_ASSERT(mcs);
WINPR_ASSERT(mcs->transport);
settings = mcs->transport->settings;
WINPR_ASSERT(settings);
if (!gcc_write_user_data_header(s, CS_MULTITRANSPORT, 8)) if (!gcc_write_user_data_header(s, CS_MULTITRANSPORT, 8))
return FALSE; return FALSE;

View File

@ -696,7 +696,8 @@ BOOL mcs_send_connect_initial(rdpMcs* mcs)
if (!mcs) if (!mcs)
return FALSE; return FALSE;
mcs_initialize_client_channels(mcs, mcs->settings); WINPR_ASSERT(mcs->transport);
mcs_initialize_client_channels(mcs, mcs->transport->settings);
client_data = Stream_New(NULL, 512); client_data = Stream_New(NULL, 512);
if (!client_data) if (!client_data)
@ -1288,7 +1289,6 @@ rdpMcs* mcs_new(rdpTransport* transport)
return NULL; return NULL;
mcs->transport = transport; mcs->transport = transport;
mcs->settings = transport->settings;
mcs_init_domain_parameters(&mcs->targetParameters, 34, 2, 0, 0xFFFF); mcs_init_domain_parameters(&mcs->targetParameters, 34, 2, 0, 0xFFFF);
mcs_init_domain_parameters(&mcs->minimumParameters, 1, 1, 1, 0x420); mcs_init_domain_parameters(&mcs->minimumParameters, 1, 1, 1, 0x420);
mcs_init_domain_parameters(&mcs->maximumParameters, 0xFFFF, 0xFC17, 0xFFFF, 0xFFFF); mcs_init_domain_parameters(&mcs->maximumParameters, 0xFFFF, 0xFC17, 0xFFFF, 0xFFFF);

View File

@ -130,7 +130,6 @@ typedef struct rdp_mcs_channel rdpMcsChannel;
struct rdp_mcs struct rdp_mcs
{ {
rdpTransport* transport; rdpTransport* transport;
rdpSettings* settings;
UINT16 userId; UINT16 userId;
UINT16 baseChannelId; UINT16 baseChannelId;