2011-07-25 21:52:48 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-25 21:52:48 +04:00
|
|
|
* Activation Sequence
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-07-25 21:52:48 +04:00
|
|
|
#include "activation.h"
|
|
|
|
|
2011-11-30 05:15:50 +04:00
|
|
|
/*
|
|
|
|
static const char* const CTRLACTION_STRINGS[] =
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
|
|
|
"",
|
|
|
|
"CTRLACTION_REQUEST_CONTROL",
|
|
|
|
"CTRLACTION_GRANTED_CONTROL",
|
|
|
|
"CTRLACTION_DETACH",
|
|
|
|
"CTRLACTION_COOPERATE"
|
|
|
|
};
|
2011-11-30 05:15:50 +04:00
|
|
|
*/
|
2011-07-25 21:52:48 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rdp_write_synchronize_pdu(wStream* s, rdpSettings* settings)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, SYNCMSGTYPE_SYNC); /* messageType (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, settings->PduSource); /* targetUser (2 bytes) */
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_synchronize_pdu(rdpRdp* rdp, wStream* s)
|
2012-01-09 01:02:59 +04:00
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
if (rdp->settings->ServerMode)
|
2012-01-09 01:02:59 +04:00
|
|
|
return rdp_recv_server_synchronize_pdu(rdp, s);
|
|
|
|
else
|
|
|
|
return rdp_recv_client_synchronize_pdu(rdp, s);
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_server_synchronize_pdu(rdpRdp* rdp, wStream* s)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2011-12-19 00:15:48 +04:00
|
|
|
rdp->finalize_sc_pdus |= FINALIZE_SC_SYNCHRONIZE_PDU;
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_server_synchronize_pdu(rdpRdp* rdp)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-07-25 21:52:48 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
|
2011-08-21 17:48:42 +04:00
|
|
|
rdp_write_synchronize_pdu(s, rdp->settings);
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SYNCHRONIZE, rdp->mcs->userId);
|
2011-08-21 17:48:42 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_client_synchronize_pdu(rdpRdp* rdp, wStream* s)
|
2011-08-21 18:52:37 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 messageType;
|
2011-08-21 18:52:37 +04:00
|
|
|
|
2012-01-09 01:02:59 +04:00
|
|
|
rdp->finalize_sc_pdus |= FINALIZE_SC_SYNCHRONIZE_PDU;
|
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2011-08-21 18:52:37 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, messageType); /* messageType (2 bytes) */
|
2012-01-09 01:02:59 +04:00
|
|
|
|
2011-08-21 18:52:37 +04:00
|
|
|
if (messageType != SYNCMSGTYPE_SYNC)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2012-01-09 01:02:59 +04:00
|
|
|
|
2011-08-21 18:52:37 +04:00
|
|
|
/* targetUser (2 bytes) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s);
|
2011-08-21 18:52:37 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-08-21 18:52:37 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_client_synchronize_pdu(rdpRdp* rdp)
|
2011-08-21 17:48:42 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-21 17:48:42 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
|
|
|
|
rdp_write_synchronize_pdu(s, rdp->settings);
|
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SYNCHRONIZE, rdp->mcs->userId);
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_control_pdu(wStream* s, UINT16* action)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2011-08-21 18:52:37 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, *action); /* action (2 bytes) */
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* grantId (2 bytes) */
|
|
|
|
Stream_Seek_UINT32(s); /* controlId (4 bytes) */
|
2011-08-21 18:52:37 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rdp_write_client_control_pdu(wStream* s, UINT16 action)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, action); /* action (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* grantId (2 bytes) */
|
|
|
|
Stream_Write_UINT32(s, 0); /* controlId (4 bytes) */
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_server_control_pdu(rdpRdp* rdp, wStream* s)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 action;
|
2011-07-25 21:52:48 +04:00
|
|
|
|
2013-01-12 17:37:21 +04:00
|
|
|
if(rdp_recv_control_pdu(s, &action) == FALSE)
|
|
|
|
return FALSE;
|
2011-07-25 21:52:48 +04:00
|
|
|
|
2011-12-19 00:15:48 +04:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case CTRLACTION_COOPERATE:
|
|
|
|
rdp->finalize_sc_pdus |= FINALIZE_SC_CONTROL_COOPERATE_PDU;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CTRLACTION_GRANTED_CONTROL:
|
|
|
|
rdp->finalize_sc_pdus |= FINALIZE_SC_CONTROL_GRANTED_PDU;
|
2013-04-15 14:14:09 +04:00
|
|
|
rdp->resendFocus = TRUE;
|
2011-12-19 00:15:48 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_server_control_cooperate_pdu(rdpRdp* rdp)
|
2011-08-21 17:48:42 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-21 17:48:42 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, CTRLACTION_COOPERATE); /* action (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* grantId (2 bytes) */
|
|
|
|
Stream_Write_UINT32(s, 0); /* controlId (4 bytes) */
|
2011-08-21 17:48:42 +04:00
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->userId);
|
2011-08-21 17:48:42 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp)
|
2011-08-21 17:48:42 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-21 17:48:42 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, CTRLACTION_GRANTED_CONTROL); /* action (2 bytes) */
|
2014-02-14 02:06:33 +04:00
|
|
|
Stream_Write_UINT16(s, rdp->mcs->userId); /* grantId (2 bytes) */
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, 0x03EA); /* controlId (4 bytes) */
|
2011-08-21 17:48:42 +04:00
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->userId);
|
2011-08-21 17:48:42 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
BOOL rdp_send_client_control_pdu(rdpRdp* rdp, UINT16 action)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-07-25 21:52:48 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
rdp_write_client_control_pdu(s, action);
|
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->userId);
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rdp_write_persistent_list_entry(wStream* s, UINT32 key1, UINT32 key2)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, key1); /* key1 (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, key2); /* key2 (4 bytes) */
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rdp_write_client_persistent_key_list_pdu(wStream* s, rdpSettings* settings)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, 0); /* numEntriesCache0 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* numEntriesCache1 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* numEntriesCache2 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* numEntriesCache3 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* numEntriesCache4 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalEntriesCache0 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalEntriesCache1 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalEntriesCache2 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalEntriesCache3 (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalEntriesCache4 (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, PERSIST_FIRST_PDU | PERSIST_LAST_PDU); /* bBitMask (1 byte) */
|
|
|
|
Stream_Write_UINT8(s, 0); /* pad1 (1 byte) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* pad3 (2 bytes) */
|
2011-07-25 21:52:48 +04:00
|
|
|
|
|
|
|
/* entries */
|
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_client_persistent_key_list_pdu(rdpRdp* rdp)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-07-25 21:52:48 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
rdp_write_client_persistent_key_list_pdu(s, rdp->settings);
|
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_BITMAP_CACHE_PERSISTENT_LIST, rdp->mcs->userId);
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_client_font_list_pdu(wStream* s)
|
2011-08-21 19:20:37 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2011-08-21 19:20:37 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-08-21 19:20:37 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
void rdp_write_client_font_list_pdu(wStream* s, UINT16 flags)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, 0); /* numberFonts (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalNumFonts (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, flags); /* listFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 50); /* entrySize (2 bytes) */
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 11:01:37 +04:00
|
|
|
BOOL rdp_send_client_font_list_pdu(rdpRdp* rdp, UINT16 flags)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-07-25 21:52:48 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
rdp_write_client_font_list_pdu(s, flags);
|
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FONT_LIST, rdp->mcs->userId);
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_font_map_pdu(rdpRdp* rdp, wStream* s)
|
2012-01-09 01:02:59 +04:00
|
|
|
{
|
2012-11-08 03:23:25 +04:00
|
|
|
if (rdp->settings->ServerMode)
|
2012-01-09 01:02:59 +04:00
|
|
|
return rdp_recv_server_font_map_pdu(rdp, s);
|
|
|
|
else
|
|
|
|
return rdp_recv_client_font_map_pdu(rdp, s);
|
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_server_font_map_pdu(rdpRdp* rdp, wStream* s)
|
2011-07-25 21:52:48 +04:00
|
|
|
{
|
2011-12-19 00:15:48 +04:00
|
|
|
rdp->finalize_sc_pdus |= FINALIZE_SC_FONT_MAP_PDU;
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-25 21:52:48 +04:00
|
|
|
}
|
2011-07-29 01:44:09 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_client_font_map_pdu(rdpRdp* rdp, wStream* s)
|
2012-01-09 01:02:59 +04:00
|
|
|
{
|
|
|
|
rdp->finalize_sc_pdus |= FINALIZE_SC_FONT_MAP_PDU;
|
2013-07-20 02:24:56 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
if(Stream_GetRemainingLength(s) >= 8)
|
2013-02-11 21:30:17 +04:00
|
|
|
{
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek_UINT16(s); /* numberEntries (2 bytes) */
|
|
|
|
Stream_Seek_UINT16(s); /* totalNumEntries (2 bytes) */
|
|
|
|
Stream_Seek_UINT16(s); /* mapFlags (2 bytes) */
|
|
|
|
Stream_Seek_UINT16(s); /* entrySize (2 bytes) */
|
2013-02-11 21:30:17 +04:00
|
|
|
}
|
2012-01-09 01:02:59 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2012-01-09 01:02:59 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_server_font_map_pdu(rdpRdp* rdp)
|
2011-08-21 19:20:37 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2011-08-21 19:20:37 +04:00
|
|
|
|
|
|
|
s = rdp_data_pdu_init(rdp);
|
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT16(s, 0); /* numberEntries (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 0); /* totalNumEntries (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, FONTLIST_FIRST | FONTLIST_LAST); /* mapFlags (2 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 4); /* entrySize (2 bytes) */
|
2011-08-21 19:20:37 +04:00
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FONT_MAP, rdp->mcs->userId);
|
2011-08-21 19:20:37 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_recv_deactivate_all(rdpRdp* rdp, wStream* s)
|
2011-07-29 01:44:09 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 lengthSourceDescriptor;
|
2011-07-29 01:44:09 +04:00
|
|
|
|
2013-06-13 22:24:17 +04:00
|
|
|
if (rdp->state == CONNECTION_STATE_ACTIVE)
|
|
|
|
rdp->deactivation_reactivation = TRUE;
|
|
|
|
else
|
|
|
|
rdp->deactivation_reactivation = FALSE;
|
2013-07-20 05:52:28 +04:00
|
|
|
|
2012-02-07 01:34:16 +04:00
|
|
|
/*
|
|
|
|
* Windows XP can send short DEACTIVATE_ALL PDU that doesn't contain
|
|
|
|
* the following fields.
|
|
|
|
*/
|
2013-04-30 06:35:15 +04:00
|
|
|
if (Stream_GetRemainingLength(s) > 0)
|
2012-02-07 01:34:16 +04:00
|
|
|
{
|
2013-05-15 23:54:33 +04:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2013-01-15 02:40:34 +04:00
|
|
|
break;
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
2013-05-15 23:54:33 +04:00
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < 2)
|
2013-01-15 02:40:34 +04:00
|
|
|
break;
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */
|
2013-05-15 23:54:33 +04:00
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < lengthSourceDescriptor)
|
2013-01-15 02:40:34 +04:00
|
|
|
break;
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2013-04-30 06:35:15 +04:00
|
|
|
Stream_Seek(s, lengthSourceDescriptor); /* sourceDescriptor (should be 0x00) */
|
2013-05-15 23:54:33 +04:00
|
|
|
}
|
|
|
|
while(0);
|
2012-02-07 01:34:16 +04:00
|
|
|
}
|
2011-07-29 01:44:09 +04:00
|
|
|
|
2013-07-19 01:15:10 +04:00
|
|
|
rdp_client_transition_to_state(rdp, CONNECTION_STATE_CAPABILITIES_EXCHANGE);
|
2011-08-22 11:03:58 +04:00
|
|
|
|
2011-09-06 17:45:52 +04:00
|
|
|
while (rdp->state != CONNECTION_STATE_ACTIVE)
|
|
|
|
{
|
|
|
|
if (rdp_check_fds(rdp) < 0)
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2015-09-05 15:57:30 +03:00
|
|
|
if (freerdp_shall_disconnect(rdp->instance))
|
2012-02-07 01:37:18 +04:00
|
|
|
break;
|
2011-09-06 17:45:52 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-07-29 01:44:09 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL rdp_send_deactivate_all(rdpRdp* rdp)
|
2011-09-06 13:19:16 +04:00
|
|
|
{
|
2013-03-21 23:19:33 +04:00
|
|
|
wStream* s;
|
2013-05-15 23:54:33 +04:00
|
|
|
BOOL status;
|
2011-09-06 13:19:16 +04:00
|
|
|
|
2015-03-23 19:25:23 +03:00
|
|
|
if (!(s = Stream_New(NULL, 1024)))
|
|
|
|
return FALSE;
|
|
|
|
|
2013-05-15 23:54:33 +04:00
|
|
|
rdp_init_stream_pdu(rdp, s);
|
2011-09-06 13:19:16 +04:00
|
|
|
|
2013-05-09 00:09:16 +04:00
|
|
|
Stream_Write_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
|
|
|
Stream_Write_UINT16(s, 1); /* lengthSourceDescriptor (2 bytes) */
|
|
|
|
Stream_Write_UINT8(s, 0); /* sourceDescriptor (should be 0x00) */
|
2011-09-06 13:19:16 +04:00
|
|
|
|
2014-02-14 02:06:33 +04:00
|
|
|
status = rdp_send_pdu(rdp, s, PDU_TYPE_DEACTIVATE_ALL, rdp->mcs->userId);
|
2013-05-15 23:54:33 +04:00
|
|
|
|
|
|
|
Stream_Free(s, TRUE);
|
|
|
|
|
|
|
|
return status;
|
2011-09-06 13:19:16 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_server_accept_client_control_pdu(rdpRdp* rdp, wStream* s)
|
2011-08-21 19:20:37 +04:00
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 action;
|
2011-08-21 19:20:37 +04:00
|
|
|
|
2011-08-23 08:58:10 +04:00
|
|
|
if (!rdp_recv_control_pdu(s, &action))
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2011-08-21 19:20:37 +04:00
|
|
|
if (action == CTRLACTION_REQUEST_CONTROL)
|
|
|
|
{
|
|
|
|
if (!rdp_send_server_control_granted_pdu(rdp))
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2011-08-21 19:20:37 +04:00
|
|
|
}
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-08-21 19:20:37 +04:00
|
|
|
}
|
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, wStream* s)
|
2011-08-21 19:20:37 +04:00
|
|
|
{
|
2011-08-23 08:58:10 +04:00
|
|
|
if (!rdp_recv_client_font_list_pdu(s))
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2013-05-15 23:54:33 +04:00
|
|
|
|
2011-08-21 19:20:37 +04:00
|
|
|
if (!rdp_send_server_font_map_pdu(rdp))
|
2012-10-09 10:31:28 +04:00
|
|
|
return FALSE;
|
2011-08-21 19:20:37 +04:00
|
|
|
|
2013-12-08 23:43:11 +04:00
|
|
|
if (rdp_server_transition_to_state(rdp, CONNECTION_STATE_ACTIVE) < 0)
|
|
|
|
return FALSE;
|
2013-07-18 23:18:59 +04:00
|
|
|
|
2012-10-09 10:31:28 +04:00
|
|
|
return TRUE;
|
2011-08-21 19:20:37 +04:00
|
|
|
}
|
|
|
|
|