Removed rdpRdp instance pointer
This commit is contained in:
parent
5b5582c9d5
commit
eebb0c59b0
@ -474,7 +474,8 @@ BOOL rdp_recv_deactivate_all(rdpRdp* rdp, wStream* s)
|
|||||||
if (rdp_check_fds(rdp) < 0)
|
if (rdp_check_fds(rdp) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (freerdp_shall_disconnect(rdp->instance))
|
WINPR_ASSERT(rdp->context);
|
||||||
|
if (freerdp_shall_disconnect(rdp->context->instance))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (rdp_get_state(rdp) == CONNECTION_STATE_ACTIVE)
|
if (rdp_get_state(rdp) == CONNECTION_STATE_ACTIVE)
|
||||||
|
@ -3872,10 +3872,13 @@ BOOL rdp_recv_get_active_header(rdpRdp* rdp, wStream* s, UINT16* pChannelId, UIN
|
|||||||
{
|
{
|
||||||
UINT16 securityFlags = 0;
|
UINT16 securityFlags = 0;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(rdp->context);
|
||||||
|
|
||||||
if (!rdp_read_header(rdp, s, length, pChannelId))
|
if (!rdp_read_header(rdp, s, length, pChannelId))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (freerdp_shall_disconnect(rdp->instance))
|
if (freerdp_shall_disconnect(rdp->context->instance))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (rdp->settings->UseRdpSecurityLayer)
|
if (rdp->settings->UseRdpSecurityLayer)
|
||||||
@ -3916,10 +3919,14 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s)
|
|||||||
UINT16 lengthSourceDescriptor;
|
UINT16 lengthSourceDescriptor;
|
||||||
UINT16 lengthCombinedCapabilities;
|
UINT16 lengthCombinedCapabilities;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(rdp->context);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
|
||||||
if (!rdp_recv_get_active_header(rdp, s, &channelId, &length))
|
if (!rdp_recv_get_active_header(rdp, s, &channelId, &length))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (freerdp_shall_disconnect(rdp->instance))
|
if (freerdp_shall_disconnect(rdp->context->instance))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!rdp_read_share_control_header(s, NULL, NULL, &pduType, &pduSource))
|
if (!rdp_read_share_control_header(s, NULL, NULL, &pduType, &pduSource))
|
||||||
|
@ -605,7 +605,9 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IFCALLRESULT(TRUE, rdp->instance->Redirect, rdp->instance))
|
WINPR_ASSERT(rdp->context);
|
||||||
|
WINPR_ASSERT(rdp->context->instance);
|
||||||
|
if (!IFCALLRESULT(TRUE, rdp->context->instance->Redirect, rdp->context->instance))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
status = rdp_client_connect(rdp);
|
status = rdp_client_connect(rdp);
|
||||||
@ -1084,7 +1086,8 @@ int rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freerdp_shall_disconnect(rdp->instance))
|
WINPR_ASSERT(rdp->context);
|
||||||
|
if (freerdp_shall_disconnect(rdp->context->instance))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!rdp_send_confirm_active(rdp))
|
if (!rdp_send_confirm_active(rdp))
|
||||||
|
@ -31,6 +31,10 @@ int rdp_recv_heartbeat_packet(rdpRdp* rdp, wStream* s)
|
|||||||
BYTE count2;
|
BYTE count2;
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(rdp->context);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 4)
|
if (Stream_GetRemainingLength(s) < 4)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -43,7 +47,8 @@ int rdp_recv_heartbeat_packet(rdpRdp* rdp, wStream* s)
|
|||||||
"received Heartbeat PDU -> period=%" PRIu8 ", count1=%" PRIu8 ", count2=%" PRIu8 "",
|
"received Heartbeat PDU -> period=%" PRIu8 ", count1=%" PRIu8 ", count2=%" PRIu8 "",
|
||||||
period, count1, count2);
|
period, count1, count2);
|
||||||
|
|
||||||
rc = IFCALLRESULT(TRUE, rdp->heartbeat->ServerHeartbeat, rdp->instance, period, count1, count2);
|
rc = IFCALLRESULT(TRUE, rdp->heartbeat->ServerHeartbeat, rdp->context->instance, period, count1,
|
||||||
|
count2);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
{
|
{
|
||||||
WLog_ERR(HEARTBEAT_TAG, "heartbeat->ServerHeartbeat callback failed!");
|
WLog_ERR(HEARTBEAT_TAG, "heartbeat->ServerHeartbeat callback failed!");
|
||||||
|
@ -1126,18 +1126,30 @@ static BOOL rdp_recv_logon_plain_notify(rdpRdp* rdp, wStream* s)
|
|||||||
|
|
||||||
static BOOL rdp_recv_logon_error_info(rdpRdp* rdp, wStream* s, logon_info_ex* info)
|
static BOOL rdp_recv_logon_error_info(rdpRdp* rdp, wStream* s, logon_info_ex* info)
|
||||||
{
|
{
|
||||||
|
freerdp* instance;
|
||||||
UINT32 errorNotificationType;
|
UINT32 errorNotificationType;
|
||||||
UINT32 errorNotificationData;
|
UINT32 errorNotificationData;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(rdp->context);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
WINPR_ASSERT(info);
|
||||||
|
|
||||||
|
instance = rdp->context->instance;
|
||||||
|
WINPR_ASSERT(instance);
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 8)
|
if (Stream_GetRemainingLength(s) < 8)
|
||||||
|
{
|
||||||
|
WLog_WARN(TAG, "received short logon error info, need 8 bytes, got %" PRIuz,
|
||||||
|
Stream_GetRemainingLength(s));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
Stream_Read_UINT32(s, errorNotificationType); /* errorNotificationType (4 bytes) */
|
Stream_Read_UINT32(s, errorNotificationType); /* errorNotificationType (4 bytes) */
|
||||||
Stream_Read_UINT32(s, errorNotificationData); /* errorNotificationData (4 bytes) */
|
Stream_Read_UINT32(s, errorNotificationData); /* errorNotificationData (4 bytes) */
|
||||||
WLog_DBG(TAG, "LogonErrorInfo: Data: 0x%08" PRIX32 " Type: 0x%08" PRIX32 "",
|
WLog_DBG(TAG, "LogonErrorInfo: Data: 0x%08" PRIX32 " Type: 0x%08" PRIX32 "",
|
||||||
errorNotificationData, errorNotificationType);
|
errorNotificationData, errorNotificationType);
|
||||||
IFCALL(rdp->instance->LogonErrorInfo, rdp->instance, errorNotificationData,
|
IFCALL(instance->LogonErrorInfo, instance, errorNotificationData, errorNotificationType);
|
||||||
errorNotificationType);
|
|
||||||
info->ErrorNotificationType = errorNotificationType;
|
info->ErrorNotificationType = errorNotificationType;
|
||||||
info->ErrorNotificationData = errorNotificationData;
|
info->ErrorNotificationData = errorNotificationData;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1149,14 +1161,27 @@ static BOOL rdp_recv_logon_info_extended(rdpRdp* rdp, wStream* s, logon_info_ex*
|
|||||||
UINT32 fieldsPresent;
|
UINT32 fieldsPresent;
|
||||||
UINT16 Length;
|
UINT16 Length;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
WINPR_ASSERT(info);
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 6)
|
if (Stream_GetRemainingLength(s) < 6)
|
||||||
|
{
|
||||||
|
WLog_WARN(TAG, "received short logon info extended, need 6 bytes, got %" PRIuz,
|
||||||
|
Stream_GetRemainingLength(s));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
Stream_Read_UINT16(s, Length); /* Length (2 bytes) */
|
Stream_Read_UINT16(s, Length); /* Length (2 bytes) */
|
||||||
Stream_Read_UINT32(s, fieldsPresent); /* fieldsPresent (4 bytes) */
|
Stream_Read_UINT32(s, fieldsPresent); /* fieldsPresent (4 bytes) */
|
||||||
|
|
||||||
if ((Length < 6) || (Stream_GetRemainingLength(s) < (Length - 6U)))
|
if ((Length < 6) || (Stream_GetRemainingLength(s) < (Length - 6U)))
|
||||||
|
{
|
||||||
|
WLog_WARN(TAG,
|
||||||
|
"received short logon info extended, need %" PRIu16 " - 6 bytes, got %" PRIuz,
|
||||||
|
Length, Stream_GetRemainingLength(s));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
WLog_DBG(TAG, "LogonInfoExtended: fieldsPresent: 0x%08" PRIX32 "", fieldsPresent);
|
WLog_DBG(TAG, "LogonInfoExtended: fieldsPresent: 0x%08" PRIX32 "", fieldsPresent);
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
rdp->inPackets++;
|
rdp->inPackets++;
|
||||||
if (freerdp_shall_disconnect(rdp->instance))
|
if (freerdp_shall_disconnect(rdp->context->instance))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (settings->UseRdpSecurityLayer)
|
if (settings->UseRdpSecurityLayer)
|
||||||
|
@ -408,6 +408,12 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
|
|||||||
UINT16 initiator;
|
UINT16 initiator;
|
||||||
DomainMCSPDU MCSPDU;
|
DomainMCSPDU MCSPDU;
|
||||||
DomainMCSPDU domainMCSPDU;
|
DomainMCSPDU domainMCSPDU;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(rdp->settings);
|
||||||
|
WINPR_ASSERT(rdp->context);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
|
||||||
MCSPDU = (rdp->settings->ServerMode) ? DomainMCSPDU_SendDataRequest
|
MCSPDU = (rdp->settings->ServerMode) ? DomainMCSPDU_SendDataRequest
|
||||||
: DomainMCSPDU_SendDataIndication;
|
: DomainMCSPDU_SendDataIndication;
|
||||||
|
|
||||||
@ -422,7 +428,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
|
|||||||
{
|
{
|
||||||
if (code == X224_TPDU_DISCONNECT_REQUEST)
|
if (code == X224_TPDU_DISCONNECT_REQUEST)
|
||||||
{
|
{
|
||||||
utils_abort_connect(rdp->instance->context);
|
utils_abort_connect(rdp->context);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,10 +476,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
|
|||||||
if (!mcs_recv_disconnect_provider_ultimatum(rdp->mcs, s, &reason))
|
if (!mcs_recv_disconnect_provider_ultimatum(rdp->mcs, s, &reason))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!rdp->instance)
|
context = rdp->context;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
context = rdp->instance->context;
|
|
||||||
context->disconnectUltimatum = reason;
|
context->disconnectUltimatum = reason;
|
||||||
|
|
||||||
if (rdp->errorInfo == ERRINFO_SUCCESS)
|
if (rdp->errorInfo == ERRINFO_SUCCESS)
|
||||||
@ -812,15 +815,20 @@ static BOOL rdp_recv_server_set_keyboard_indicators_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
{
|
{
|
||||||
UINT16 unitId;
|
UINT16 unitId;
|
||||||
UINT16 ledFlags;
|
UINT16 ledFlags;
|
||||||
rdpContext* context = rdp->instance->context;
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
|
||||||
|
rdpContext* context = rdp->context;
|
||||||
|
WINPR_ASSERT(context);
|
||||||
|
WINPR_ASSERT(context->update);
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 4)
|
if (Stream_GetRemainingLength(s) < 4)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Stream_Read_UINT16(s, unitId); /* unitId (2 bytes) */
|
Stream_Read_UINT16(s, unitId); /* unitId (2 bytes) */
|
||||||
Stream_Read_UINT16(s, ledFlags); /* ledFlags (2 bytes) */
|
Stream_Read_UINT16(s, ledFlags); /* ledFlags (2 bytes) */
|
||||||
IFCALL(context->update->SetKeyboardIndicators, context, ledFlags);
|
return IFCALLRESULT(TRUE, context->update->SetKeyboardIndicators, context, ledFlags);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL rdp_recv_server_set_keyboard_ime_status_pdu(rdpRdp* rdp, wStream* s)
|
static BOOL rdp_recv_server_set_keyboard_ime_status_pdu(rdpRdp* rdp, wStream* s)
|
||||||
@ -1343,11 +1351,19 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
UINT16 pduSource;
|
UINT16 pduSource;
|
||||||
UINT16 channelId = 0;
|
UINT16 channelId = 0;
|
||||||
UINT16 securityFlags = 0;
|
UINT16 securityFlags = 0;
|
||||||
|
freerdp* instance;
|
||||||
|
|
||||||
|
WINPR_ASSERT(rdp);
|
||||||
|
WINPR_ASSERT(rdp->context);
|
||||||
|
WINPR_ASSERT(s);
|
||||||
|
|
||||||
|
instance = rdp->context->instance;
|
||||||
|
WINPR_ASSERT(instance);
|
||||||
|
|
||||||
if (!rdp_read_header(rdp, s, &length, &channelId))
|
if (!rdp_read_header(rdp, s, &length, &channelId))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (freerdp_shall_disconnect(rdp->instance))
|
if (freerdp_shall_disconnect(instance))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (rdp->autodetect->bandwidthMeasureStarted)
|
if (rdp->autodetect->bandwidthMeasureStarted)
|
||||||
@ -1464,7 +1480,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
|
|||||||
{
|
{
|
||||||
rdp->inPackets++;
|
rdp->inPackets++;
|
||||||
|
|
||||||
if (!freerdp_channel_process(rdp->instance, s, channelId, length))
|
if (!freerdp_channel_process(instance, s, channelId, length))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1811,7 +1827,6 @@ rdpRdp* rdp_new(rdpContext* context)
|
|||||||
|
|
||||||
InitializeCriticalSection(&rdp->critical);
|
InitializeCriticalSection(&rdp->critical);
|
||||||
rdp->context = context;
|
rdp->context = context;
|
||||||
rdp->instance = context->instance;
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
if (context->ServerMode)
|
if (context->ServerMode)
|
||||||
|
@ -131,7 +131,6 @@
|
|||||||
struct rdp_rdp
|
struct rdp_rdp
|
||||||
{
|
{
|
||||||
CONNECTION_STATE state;
|
CONNECTION_STATE state;
|
||||||
freerdp* instance;
|
|
||||||
rdpContext* context;
|
rdpContext* context;
|
||||||
rdpNla* nla;
|
rdpNla* nla;
|
||||||
rdpMcs* mcs;
|
rdpMcs* mcs;
|
||||||
|
Loading…
Reference in New Issue
Block a user