2014-06-29 01:24:44 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* Remote Assistance Virtual Channel
|
|
|
|
*
|
|
|
|
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2015-06-22 10:12:25 +03:00
|
|
|
* Copyright 2015 Thincast Technologies GmbH
|
|
|
|
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
2014-06-29 01:24:44 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/print.h>
|
|
|
|
|
2014-06-30 20:51:27 +04:00
|
|
|
#include <freerdp/assistance.h>
|
|
|
|
|
2014-08-11 11:12:01 +04:00
|
|
|
#include <freerdp/channels/log.h>
|
2014-06-29 01:24:44 +04:00
|
|
|
#include <freerdp/client/remdesk.h>
|
|
|
|
|
|
|
|
#include "remdesk_main.h"
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_virtual_channel_write(remdeskPlugin* remdesk, wStream* s)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
UINT32 status;
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
if (!remdesk)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "remdesk was null!");
|
|
|
|
return CHANNEL_RC_INVALID_INSTANCE;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
2016-11-23 15:17:56 +03:00
|
|
|
status = remdesk->channelEntryPoints.pVirtualChannelWriteEx(remdesk->InitHandle,
|
|
|
|
remdesk->OpenHandle,
|
2016-09-26 13:12:37 +03:00
|
|
|
Stream_Buffer(s), (UINT32) Stream_Length(s), s);
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
if (status != CHANNEL_RC_OK)
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "pVirtualChannelWriteEx failed with %s [%08"PRIX32"]",
|
2016-09-26 13:12:37 +03:00
|
|
|
WTSErrorToString(status), status);
|
2014-06-29 04:22:36 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return status;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_generate_expert_blob(remdeskPlugin* remdesk)
|
2014-06-30 20:51:27 +04:00
|
|
|
{
|
|
|
|
char* name;
|
|
|
|
char* pass;
|
|
|
|
char* password;
|
|
|
|
rdpSettings* settings = remdesk->settings;
|
|
|
|
|
|
|
|
if (remdesk->ExpertBlob)
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-30 20:51:27 +04:00
|
|
|
|
|
|
|
if (settings->RemoteAssistancePassword)
|
|
|
|
password = settings->RemoteAssistancePassword;
|
|
|
|
else
|
|
|
|
password = settings->Password;
|
|
|
|
|
|
|
|
if (!password)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "password was not set!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 20:51:27 +04:00
|
|
|
|
|
|
|
name = settings->Username;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
name = "Expert";
|
|
|
|
|
|
|
|
remdesk->EncryptedPassStub = freerdp_assistance_encrypt_pass_stub(password,
|
2016-09-26 13:12:37 +03:00
|
|
|
settings->RemoteAssistancePassStub, &(remdesk->EncryptedPassStubSize));
|
2014-06-30 20:51:27 +04:00
|
|
|
|
|
|
|
if (!remdesk->EncryptedPassStub)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "freerdp_assistance_encrypt_pass_stub failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 20:51:27 +04:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
pass = freerdp_assistance_bin_to_hex_string(remdesk->EncryptedPassStub,
|
2016-09-26 13:12:37 +03:00
|
|
|
remdesk->EncryptedPassStubSize);
|
2014-06-30 20:51:27 +04:00
|
|
|
|
|
|
|
if (!pass)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "freerdp_assistance_bin_to_hex_string failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 20:51:27 +04:00
|
|
|
|
|
|
|
remdesk->ExpertBlob = freerdp_assistance_construct_expert_blob(name, pass);
|
|
|
|
|
|
|
|
if (!remdesk->ExpertBlob)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "freerdp_assistance_construct_expert_blob failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 20:51:27 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-30 20:51:27 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_read_channel_header(wStream* s,
|
2016-09-26 13:12:37 +03:00
|
|
|
REMDESK_CHANNEL_HEADER* header)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
UINT32 ChannelNameLen;
|
|
|
|
char* pChannelName = NULL;
|
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
2016-12-01 13:15:11 +03:00
|
|
|
WLog_ERR(TAG, "Not enough data!");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, ChannelNameLen); /* ChannelNameLen (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, header->DataLength); /* DataLen (4 bytes) */
|
|
|
|
|
|
|
|
if (ChannelNameLen > 64)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "ChannelNameLen > 64!");
|
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
if ((ChannelNameLen % 2) != 0)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
2016-11-25 14:40:11 +03:00
|
|
|
WLog_ERR(TAG, "ChannelNameLen %% 2) != 0 ");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < ChannelNameLen)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
2016-12-01 13:15:11 +03:00
|
|
|
WLog_ERR(TAG, "Not enough data!");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
ZeroMemory(header->ChannelName, sizeof(header->ChannelName));
|
|
|
|
pChannelName = (char*) header->ChannelName;
|
|
|
|
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s),
|
2016-09-26 13:12:37 +03:00
|
|
|
ChannelNameLen / 2, &pChannelName, 32, NULL, NULL);
|
2014-06-29 04:22:36 +04:00
|
|
|
Stream_Seek(s, ChannelNameLen);
|
|
|
|
|
|
|
|
if (status <= 0)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "ConvertFromUnicode failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_write_channel_header(wStream* s,
|
2016-09-26 13:12:37 +03:00
|
|
|
REMDESK_CHANNEL_HEADER* header)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
2014-06-30 20:51:27 +04:00
|
|
|
int index;
|
2014-06-29 04:22:36 +04:00
|
|
|
UINT32 ChannelNameLen;
|
|
|
|
WCHAR ChannelNameW[32];
|
|
|
|
ZeroMemory(ChannelNameW, sizeof(ChannelNameW));
|
|
|
|
|
2014-06-30 20:51:27 +04:00
|
|
|
for (index = 0; index < 32; index++)
|
|
|
|
{
|
|
|
|
ChannelNameW[index] = (WCHAR) header->ChannelName[index];
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
2014-06-30 21:26:11 +04:00
|
|
|
ChannelNameLen = (strlen(header->ChannelName) + 1) * 2;
|
2014-06-29 04:22:36 +04:00
|
|
|
Stream_Write_UINT32(s, ChannelNameLen); /* ChannelNameLen (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, header->DataLength); /* DataLen (4 bytes) */
|
2014-06-30 20:51:27 +04:00
|
|
|
Stream_Write(s, ChannelNameW, ChannelNameLen); /* ChannelName (variable) */
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_write_ctl_header(wStream* s, REMDESK_CTL_HEADER* ctlHeader)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
|
|
|
remdesk_write_channel_header(s, (REMDESK_CHANNEL_HEADER*) ctlHeader);
|
|
|
|
Stream_Write_UINT32(s, ctlHeader->msgType); /* msgType (4 bytes) */
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader,
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT32 msgType, UINT32 msgSize)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
2014-06-30 21:26:11 +04:00
|
|
|
ctlHeader->msgType = msgType;
|
2014-06-29 04:22:36 +04:00
|
|
|
strcpy(ctlHeader->ChannelName, REMDESK_CHANNEL_CTL_NAME);
|
|
|
|
ctlHeader->DataLength = 4 + msgSize;
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_recv_ctl_server_announce_pdu(remdeskPlugin* remdesk,
|
2016-09-26 13:12:37 +03:00
|
|
|
wStream* s, REMDESK_CHANNEL_HEADER* header)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_recv_ctl_version_info_pdu(remdeskPlugin* remdesk,
|
2016-09-26 13:12:37 +03:00
|
|
|
wStream* s, REMDESK_CHANNEL_HEADER* header)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
|
|
|
UINT32 versionMajor;
|
|
|
|
UINT32 versionMinor;
|
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < 8)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
2016-12-01 13:15:11 +03:00
|
|
|
WLog_ERR(TAG, "Not enough data!");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, versionMajor); /* versionMajor (4 bytes) */
|
|
|
|
Stream_Read_UINT32(s, versionMinor); /* versionMinor (4 bytes) */
|
2015-06-22 10:12:25 +03:00
|
|
|
remdesk->Version = versionMajor;
|
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_send_ctl_version_info_pdu(remdeskPlugin* remdesk)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
|
|
|
wStream* s;
|
|
|
|
REMDESK_CTL_VERSION_INFO_PDU pdu;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2014-06-29 04:22:36 +04:00
|
|
|
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_VERSIONINFO, 8);
|
|
|
|
pdu.versionMajor = 1;
|
|
|
|
pdu.versionMinor = 2;
|
|
|
|
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
|
|
|
|
Stream_Write_UINT32(s, pdu.versionMajor); /* versionMajor (4 bytes) */
|
|
|
|
Stream_Write_UINT32(s, pdu.versionMinor); /* versionMinor (4 bytes) */
|
|
|
|
Stream_SealLength(s);
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_virtual_channel_write(remdesk, s)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_virtual_channel_write failed with error %"PRIu32"!", error);
|
2014-06-29 04:22:36 +04:00
|
|
|
|
2015-07-29 18:32:09 +03:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
Stream_Free(s, TRUE);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_recv_ctl_result_pdu(remdeskPlugin* remdesk, wStream* s,
|
2016-09-26 13:12:37 +03:00
|
|
|
REMDESK_CHANNEL_HEADER* header, UINT32* pResult)
|
2014-06-30 03:57:46 +04:00
|
|
|
{
|
|
|
|
UINT32 result;
|
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
2016-12-01 13:15:11 +03:00
|
|
|
WLog_ERR(TAG, "Not enough data!");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, result); /* result (4 bytes) */
|
|
|
|
*pResult = result;
|
2016-12-14 00:47:08 +03:00
|
|
|
//WLog_DBG(TAG, "RemdeskRecvResult: 0x%08"PRIX32"", result);
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-30 03:57:46 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk)
|
2014-06-30 03:57:46 +04:00
|
|
|
{
|
|
|
|
int status;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2015-06-22 10:12:25 +03:00
|
|
|
wStream* s = NULL;
|
2014-06-30 03:57:46 +04:00
|
|
|
int cbExpertBlobW = 0;
|
|
|
|
WCHAR* expertBlobW = NULL;
|
|
|
|
int cbRaConnectionStringW = 0;
|
|
|
|
WCHAR* raConnectionStringW = NULL;
|
|
|
|
REMDESK_CTL_AUTHENTICATE_PDU pdu;
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_generate_expert_blob(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_generate_expert_blob failed with error %"PRIu32"", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
|
|
|
}
|
2014-06-30 20:51:27 +04:00
|
|
|
|
|
|
|
pdu.expertBlob = remdesk->ExpertBlob;
|
|
|
|
pdu.raConnectionString = remdesk->settings->RemoteAssistanceRCTicket;
|
2016-08-09 13:04:06 +03:00
|
|
|
status = ConvertToUnicode(CP_UTF8, 0, pdu.raConnectionString, -1,
|
2016-09-26 13:12:37 +03:00
|
|
|
&raConnectionStringW, 0);
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
if (status <= 0)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "ConvertToUnicode failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
cbRaConnectionStringW = status * 2;
|
|
|
|
status = ConvertToUnicode(CP_UTF8, 0, pdu.expertBlob, -1, &expertBlobW, 0);
|
|
|
|
|
|
|
|
if (status <= 0)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "ConvertToUnicode failed!");
|
|
|
|
error = ERROR_INTERNAL_ERROR;
|
|
|
|
goto out;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
cbExpertBlobW = status * 2;
|
|
|
|
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_AUTHENTICATE,
|
2016-09-26 13:12:37 +03:00
|
|
|
cbRaConnectionStringW + cbExpertBlobW);
|
2014-06-30 03:57:46 +04:00
|
|
|
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto out;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
|
|
|
|
Stream_Write(s, (BYTE*) raConnectionStringW, cbRaConnectionStringW);
|
|
|
|
Stream_Write(s, (BYTE*) expertBlobW, cbExpertBlobW);
|
|
|
|
Stream_SealLength(s);
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_virtual_channel_write(remdesk, s)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_virtual_channel_write failed with error %"PRIu32"!", error);
|
2014-06-30 03:57:46 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
out:
|
2014-06-30 03:57:46 +04:00
|
|
|
free(raConnectionStringW);
|
|
|
|
free(expertBlobW);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-07-29 18:32:09 +03:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
Stream_Free(s, TRUE);
|
2014-06-30 03:57:46 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
2014-06-30 03:57:46 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* remdesk)
|
2014-06-30 21:26:11 +04:00
|
|
|
{
|
|
|
|
int status;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2015-06-22 10:12:25 +03:00
|
|
|
wStream* s = NULL;
|
2014-06-30 21:26:11 +04:00
|
|
|
int cbRaConnectionStringW = 0;
|
|
|
|
WCHAR* raConnectionStringW = NULL;
|
|
|
|
REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu;
|
|
|
|
pdu.raConnectionString = remdesk->settings->RemoteAssistanceRCTicket;
|
2016-08-09 13:04:06 +03:00
|
|
|
status = ConvertToUnicode(CP_UTF8, 0, pdu.raConnectionString, -1,
|
2016-09-26 13:12:37 +03:00
|
|
|
&raConnectionStringW, 0);
|
2014-06-30 21:26:11 +04:00
|
|
|
|
|
|
|
if (status <= 0)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "ConvertToUnicode failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 21:26:11 +04:00
|
|
|
|
|
|
|
cbRaConnectionStringW = status * 2;
|
2016-08-09 13:04:06 +03:00
|
|
|
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_REMOTE_CONTROL_DESKTOP,
|
2016-09-26 13:12:37 +03:00
|
|
|
cbRaConnectionStringW);
|
2014-06-30 21:26:11 +04:00
|
|
|
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto out;
|
|
|
|
}
|
2014-06-30 21:26:11 +04:00
|
|
|
|
|
|
|
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
|
|
|
|
Stream_Write(s, (BYTE*) raConnectionStringW, cbRaConnectionStringW);
|
|
|
|
Stream_SealLength(s);
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_virtual_channel_write(remdesk, s)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_virtual_channel_write failed with error %"PRIu32"!", error);
|
2014-06-30 21:26:11 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
out:
|
2014-06-30 21:26:11 +04:00
|
|
|
free(raConnectionStringW);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-07-29 18:32:09 +03:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
Stream_Free(s, TRUE);
|
2014-06-30 21:26:11 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
2014-06-30 21:26:11 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_send_ctl_verify_password_pdu(remdeskPlugin* remdesk)
|
2014-06-30 03:57:46 +04:00
|
|
|
{
|
|
|
|
int status;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2014-06-30 03:57:46 +04:00
|
|
|
wStream* s;
|
|
|
|
int cbExpertBlobW = 0;
|
|
|
|
WCHAR* expertBlobW = NULL;
|
|
|
|
REMDESK_CTL_VERIFY_PASSWORD_PDU pdu;
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_generate_expert_blob(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_generate_expert_blob failed with error %"PRIu32"!", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
|
|
|
}
|
2014-06-30 21:26:11 +04:00
|
|
|
|
|
|
|
pdu.expertBlob = remdesk->ExpertBlob;
|
2014-06-30 03:57:46 +04:00
|
|
|
status = ConvertToUnicode(CP_UTF8, 0, pdu.expertBlob, -1, &expertBlobW, 0);
|
|
|
|
|
|
|
|
if (status <= 0)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "ConvertToUnicode failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
cbExpertBlobW = status * 2;
|
2016-08-09 13:04:06 +03:00
|
|
|
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_VERIFY_PASSWORD,
|
2016-09-26 13:12:37 +03:00
|
|
|
cbExpertBlobW);
|
2014-06-30 03:57:46 +04:00
|
|
|
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto out;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
|
|
|
|
Stream_Write(s, (BYTE*) expertBlobW, cbExpertBlobW);
|
|
|
|
Stream_SealLength(s);
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_virtual_channel_write(remdesk, s)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_virtual_channel_write failed with error %"PRIu32"!", error);
|
2014-06-30 03:57:46 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
out:
|
2014-06-30 03:57:46 +04:00
|
|
|
free(expertBlobW);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-07-29 18:32:09 +03:00
|
|
|
if (error != CHANNEL_RC_OK)
|
|
|
|
Stream_Free(s, TRUE);
|
2014-06-30 03:57:46 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
2014-06-30 03:57:46 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_send_ctl_expert_on_vista_pdu(remdeskPlugin* remdesk)
|
2014-06-30 03:57:46 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2014-06-30 03:57:46 +04:00
|
|
|
wStream* s;
|
|
|
|
REMDESK_CTL_EXPERT_ON_VISTA_PDU pdu;
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_generate_expert_blob(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_generate_expert_blob failed with error %"PRIu32"!", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
|
|
|
}
|
2014-06-30 21:26:11 +04:00
|
|
|
|
|
|
|
pdu.EncryptedPasswordLength = remdesk->EncryptedPassStubSize;
|
|
|
|
pdu.EncryptedPassword = remdesk->EncryptedPassStub;
|
2014-06-30 03:57:46 +04:00
|
|
|
remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_EXPERT_ON_VISTA,
|
2016-09-26 13:12:37 +03:00
|
|
|
pdu.EncryptedPasswordLength);
|
2014-06-30 03:57:46 +04:00
|
|
|
s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.DataLength);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
|
|
|
remdesk_write_ctl_header(s, &(pdu.ctlHeader));
|
|
|
|
Stream_Write(s, pdu.EncryptedPassword, pdu.EncryptedPasswordLength);
|
|
|
|
Stream_SealLength(s);
|
2015-06-22 10:12:25 +03:00
|
|
|
return remdesk_virtual_channel_write(remdesk, s);
|
2014-06-30 03:57:46 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_recv_ctl_pdu(remdeskPlugin* remdesk, wStream* s,
|
2016-09-26 13:12:37 +03:00
|
|
|
REMDESK_CHANNEL_HEADER* header)
|
2014-06-29 04:22:36 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2014-06-30 03:57:46 +04:00
|
|
|
UINT32 msgType = 0;
|
|
|
|
UINT32 result = 0;
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
if (Stream_GetRemainingLength(s) < 4)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
2016-12-01 13:15:11 +03:00
|
|
|
WLog_ERR(TAG, "Not enough data!");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INVALID_DATA;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
Stream_Read_UINT32(s, msgType); /* msgType (4 bytes) */
|
|
|
|
|
2016-12-14 00:47:08 +03:00
|
|
|
//WLog_DBG(TAG, "msgType: %"PRIu32"", msgType);
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
switch (msgType)
|
|
|
|
{
|
|
|
|
case REMDESK_CTL_REMOTE_CONTROL_DESKTOP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_RESULT:
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_recv_ctl_result_pdu(remdesk, s, header, &result)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_recv_ctl_result_pdu failed with error %"PRIu32"", error);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2014-06-29 04:22:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_AUTHENTICATE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_SERVER_ANNOUNCE:
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_recv_ctl_server_announce_pdu(remdesk, s, header)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_recv_ctl_server_announce_pdu failed with error %"PRIu32"",
|
2016-09-26 13:12:37 +03:00
|
|
|
error);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2014-06-29 04:22:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_DISCONNECT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_VERSIONINFO:
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_recv_ctl_version_info_pdu(remdesk, s, header)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_recv_ctl_version_info_pdu failed with error %"PRIu32"", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
break;
|
|
|
|
}
|
2014-06-30 03:57:46 +04:00
|
|
|
|
2014-06-30 21:26:11 +04:00
|
|
|
if (remdesk->Version == 1)
|
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_send_ctl_version_info_pdu(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_send_ctl_version_info_pdu failed with error %"PRIu32"", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((error = remdesk_send_ctl_authenticate_pdu(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_send_ctl_authenticate_pdu failed with error %"PRIu32"", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((error = remdesk_send_ctl_remote_control_desktop_pdu(remdesk)))
|
|
|
|
{
|
2016-08-09 13:04:06 +03:00
|
|
|
WLog_ERR(TAG,
|
2016-12-14 00:47:08 +03:00
|
|
|
"remdesk_send_ctl_remote_control_desktop_pdu failed with error %"PRIu32"", error);
|
2015-06-22 10:12:25 +03:00
|
|
|
break;
|
|
|
|
}
|
2014-06-30 21:26:11 +04:00
|
|
|
}
|
|
|
|
else if (remdesk->Version == 2)
|
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((error = remdesk_send_ctl_expert_on_vista_pdu(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_send_ctl_expert_on_vista_pdu failed with error %"PRIu32"",
|
2016-09-26 13:12:37 +03:00
|
|
|
error);
|
2015-06-22 10:12:25 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((error = remdesk_send_ctl_verify_password_pdu(remdesk)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_send_ctl_verify_password_pdu failed with error %"PRIu32"",
|
2016-09-26 13:12:37 +03:00
|
|
|
error);
|
2015-06-22 10:12:25 +03:00
|
|
|
break;
|
|
|
|
}
|
2014-06-30 21:26:11 +04:00
|
|
|
}
|
2014-06-30 20:51:27 +04:00
|
|
|
|
2014-06-29 04:22:36 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_ISCONNECTED:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_VERIFY_PASSWORD:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_EXPERT_ON_VISTA:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_RANOVICE_NAME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_RAEXPERT_NAME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REMDESK_CTL_TOKEN:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "unknown msgType: %"PRIu32"", msgType);
|
2015-06-22 10:12:25 +03:00
|
|
|
error = ERROR_INVALID_DATA;
|
2014-06-29 04:22:36 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return error;
|
2014-06-29 04:22:36 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_process_receive(remdeskPlugin* remdesk, wStream* s)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT status;
|
2014-06-29 04:22:36 +04:00
|
|
|
REMDESK_CHANNEL_HEADER header;
|
2014-07-01 01:17:06 +04:00
|
|
|
#if 0
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_DBG(TAG, "RemdeskReceive: %"PRIuz"", Stream_GetRemainingLength(s));
|
2014-06-29 02:33:46 +04:00
|
|
|
winpr_HexDump(Stream_Pointer(s), Stream_GetRemainingLength(s));
|
2014-07-01 01:17:06 +04:00
|
|
|
#endif
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if ((status = remdesk_read_channel_header(s, &header)))
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_read_channel_header failed with error %"PRIu32"", status);
|
2015-06-22 10:12:25 +03:00
|
|
|
return status;
|
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
|
|
|
if (strcmp(header.ChannelName, "RC_CTL") == 0)
|
|
|
|
{
|
|
|
|
status = remdesk_recv_ctl_pdu(remdesk, s, &header);
|
|
|
|
}
|
|
|
|
else if (strcmp(header.ChannelName, "70") == 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (strcmp(header.ChannelName, "71") == 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (strcmp(header.ChannelName, ".") == 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (strcmp(header.ChannelName, "1000.") == 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (strcmp(header.ChannelName, "RA_FX") == 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void remdesk_process_connect(remdeskPlugin* remdesk)
|
|
|
|
{
|
2014-06-30 20:51:27 +04:00
|
|
|
remdesk->settings = (rdpSettings*) remdesk->channelEntryPoints.pExtendedData;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_virtual_channel_event_data_received(remdeskPlugin* remdesk,
|
2016-09-26 13:12:37 +03:00
|
|
|
void* pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
|
|
|
wStream* data_in;
|
|
|
|
|
|
|
|
if ((dataFlags & CHANNEL_FLAG_SUSPEND) || (dataFlags & CHANNEL_FLAG_RESUME))
|
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dataFlags & CHANNEL_FLAG_FIRST)
|
|
|
|
{
|
|
|
|
if (remdesk->data_in)
|
|
|
|
Stream_Free(remdesk->data_in, TRUE);
|
|
|
|
|
|
|
|
remdesk->data_in = Stream_New(NULL, totalLength);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!remdesk->data_in)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_New failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
data_in = remdesk->data_in;
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength))
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
|
|
|
|
return CHANNEL_RC_NO_MEMORY;
|
|
|
|
}
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
Stream_Write(data_in, pData, dataLength);
|
|
|
|
|
|
|
|
if (dataFlags & CHANNEL_FLAG_LAST)
|
|
|
|
{
|
|
|
|
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
|
|
|
|
{
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_ERR(TAG, "read error");
|
2015-06-22 10:12:25 +03:00
|
|
|
return ERROR_INTERNAL_ERROR;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
remdesk->data_in = NULL;
|
|
|
|
Stream_SealLength(data_in);
|
|
|
|
Stream_SetPosition(data_in, 0);
|
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
if (!MessageQueue_Post(remdesk->queue, NULL, 0, (void*) data_in, NULL))
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "MessageQueue_Post failed!");
|
|
|
|
return ERROR_INTERNAL_ERROR;
|
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
2016-11-23 15:17:56 +03:00
|
|
|
static VOID VCAPITYPE remdesk_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
|
|
|
|
UINT event,
|
2016-09-26 13:12:37 +03:00
|
|
|
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2016-11-22 14:27:05 +03:00
|
|
|
remdeskPlugin* remdesk = (remdeskPlugin*) lpUserParam;
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
if (!remdesk || (remdesk->OpenHandle != openHandle))
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_ERR(TAG, "error no match");
|
2014-06-29 01:24:44 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (event)
|
|
|
|
{
|
|
|
|
case CHANNEL_EVENT_DATA_RECEIVED:
|
2016-08-09 13:04:06 +03:00
|
|
|
if ((error = remdesk_virtual_channel_event_data_received(remdesk, pData,
|
2016-09-26 13:12:37 +03:00
|
|
|
dataLength, totalLength, dataFlags)))
|
2016-08-09 13:04:06 +03:00
|
|
|
WLog_ERR(TAG,
|
2016-12-14 00:47:08 +03:00
|
|
|
"remdesk_virtual_channel_event_data_received failed with error %"PRIu32"!", error);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CHANNEL_EVENT_WRITE_COMPLETE:
|
|
|
|
Stream_Free((wStream*) pData, TRUE);
|
|
|
|
break;
|
2015-01-20 13:47:47 +03:00
|
|
|
|
|
|
|
case CHANNEL_EVENT_USER:
|
|
|
|
break;
|
2015-07-29 18:32:09 +03:00
|
|
|
|
|
|
|
default:
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "unhandled event %"PRIu32"!", event);
|
2015-07-29 18:32:09 +03:00
|
|
|
error = ERROR_INTERNAL_ERROR;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
2015-07-15 10:50:35 +03:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
if (error && remdesk->rdpcontext)
|
|
|
|
setChannelError(remdesk->rdpcontext, error,
|
2016-11-22 14:27:05 +03:00
|
|
|
"remdesk_virtual_channel_open_event_ex reported an error");
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void* remdesk_virtual_channel_client_thread(void* arg)
|
|
|
|
{
|
|
|
|
wStream* data;
|
|
|
|
wMessage message;
|
|
|
|
remdeskPlugin* remdesk = (remdeskPlugin*) arg;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2014-06-29 01:24:44 +04:00
|
|
|
remdesk_process_connect(remdesk);
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2014-12-27 23:20:29 +03:00
|
|
|
if (!MessageQueue_Wait(remdesk->queue))
|
2015-07-15 10:50:35 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "MessageQueue_Wait failed!");
|
|
|
|
error = ERROR_INTERNAL_ERROR;
|
2014-06-29 01:24:44 +04:00
|
|
|
break;
|
2015-07-15 10:50:35 +03:00
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
if (!MessageQueue_Peek(remdesk->queue, &message, TRUE))
|
|
|
|
{
|
2015-07-15 10:50:35 +03:00
|
|
|
WLog_ERR(TAG, "MessageQueue_Peek failed!");
|
|
|
|
error = ERROR_INTERNAL_ERROR;
|
|
|
|
break;
|
|
|
|
}
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
if (message.id == WMQ_QUIT)
|
|
|
|
break;
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
if (message.id == 0)
|
|
|
|
{
|
|
|
|
data = (wStream*) message.wParam;
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
if ((error = remdesk_process_receive(remdesk, data)))
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_process_receive failed with error %"PRIu32"!", error);
|
2015-07-15 10:50:35 +03:00
|
|
|
break;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
if (error && remdesk->rdpcontext)
|
2016-08-09 13:04:06 +03:00
|
|
|
setChannelError(remdesk->rdpcontext, error,
|
2016-09-26 13:12:37 +03:00
|
|
|
"remdesk_virtual_channel_client_thread reported an error");
|
2015-07-15 10:50:35 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
ExitThread((DWORD)error);
|
2014-06-29 01:24:44 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
2016-08-09 13:04:06 +03:00
|
|
|
static UINT remdesk_virtual_channel_event_connected(remdeskPlugin* remdesk,
|
2016-09-26 13:12:37 +03:00
|
|
|
LPVOID pData, UINT32 dataLength)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
|
|
|
UINT32 status;
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error;
|
2016-11-22 14:27:05 +03:00
|
|
|
status = remdesk->channelEntryPoints.pVirtualChannelOpenEx(remdesk->InitHandle,
|
2016-09-26 13:12:37 +03:00
|
|
|
&remdesk->OpenHandle, remdesk->channelDef.name,
|
2016-11-22 14:27:05 +03:00
|
|
|
remdesk_virtual_channel_open_event_ex);
|
2014-06-29 01:24:44 +04:00
|
|
|
|
|
|
|
if (status != CHANNEL_RC_OK)
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "pVirtualChannelOpenEx failed with %s [%08"PRIX32"]",
|
2016-09-26 13:12:37 +03:00
|
|
|
WTSErrorToString(status), status);
|
2015-06-22 10:12:25 +03:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2014-12-27 23:20:29 +03:00
|
|
|
remdesk->queue = MessageQueue_New(NULL);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-05-18 12:28:00 +03:00
|
|
|
if (!remdesk->queue)
|
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
WLog_ERR(TAG, "MessageQueue_New failed!");
|
|
|
|
error = CHANNEL_RC_NO_MEMORY;
|
|
|
|
goto error_out;
|
2015-05-18 12:28:00 +03:00
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
|
|
|
|
remdesk->thread = CreateThread(NULL, 0,
|
2016-09-26 13:12:37 +03:00
|
|
|
(LPTHREAD_START_ROUTINE) remdesk_virtual_channel_client_thread, (void*) remdesk,
|
|
|
|
0, NULL);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-05-18 12:28:00 +03:00
|
|
|
if (!remdesk->thread)
|
|
|
|
{
|
2015-06-22 10:12:25 +03:00
|
|
|
WLog_ERR(TAG, "CreateThread failed");
|
|
|
|
error = ERROR_INTERNAL_ERROR;
|
|
|
|
goto error_out;
|
2015-05-18 12:28:00 +03:00
|
|
|
}
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return CHANNEL_RC_OK;
|
|
|
|
error_out:
|
|
|
|
MessageQueue_Free(remdesk->queue);
|
|
|
|
remdesk->queue = NULL;
|
|
|
|
return error;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
/**
|
|
|
|
* Function description
|
|
|
|
*
|
|
|
|
* @return 0 on success, otherwise a Win32 error code
|
|
|
|
*/
|
|
|
|
static UINT remdesk_virtual_channel_event_disconnected(remdeskPlugin* remdesk)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2015-01-20 13:47:47 +03:00
|
|
|
UINT rc;
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
if (MessageQueue_PostQuit(remdesk->queue, 0)
|
|
|
|
&& (WaitForSingleObject(remdesk->thread, INFINITE) == WAIT_FAILED))
|
2016-03-07 14:54:49 +03:00
|
|
|
{
|
|
|
|
rc = GetLastError();
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"", rc);
|
2016-03-07 14:54:49 +03:00
|
|
|
return rc;
|
|
|
|
}
|
2014-12-27 23:20:29 +03:00
|
|
|
|
2015-01-20 13:47:47 +03:00
|
|
|
MessageQueue_Free(remdesk->queue);
|
|
|
|
CloseHandle(remdesk->thread);
|
|
|
|
remdesk->queue = NULL;
|
|
|
|
remdesk->thread = NULL;
|
2016-11-22 14:27:05 +03:00
|
|
|
rc = remdesk->channelEntryPoints.pVirtualChannelCloseEx(remdesk->InitHandle, remdesk->OpenHandle);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-01-20 13:47:47 +03:00
|
|
|
if (CHANNEL_RC_OK != rc)
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "pVirtualChannelCloseEx failed with %s [%08"PRIX32"]",
|
2016-09-26 13:12:37 +03:00
|
|
|
WTSErrorToString(rc), rc);
|
2015-01-20 13:47:47 +03:00
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
remdesk->OpenHandle = 0;
|
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
if (remdesk->data_in)
|
|
|
|
{
|
|
|
|
Stream_Free(remdesk->data_in, TRUE);
|
|
|
|
remdesk->data_in = NULL;
|
|
|
|
}
|
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
return rc;
|
2015-01-20 13:47:47 +03:00
|
|
|
}
|
2014-12-27 23:20:29 +03:00
|
|
|
|
2015-01-20 13:47:47 +03:00
|
|
|
static void remdesk_virtual_channel_event_terminated(remdeskPlugin* remdesk)
|
|
|
|
{
|
2016-08-09 13:04:06 +03:00
|
|
|
remdesk->InitHandle = 0;
|
2014-12-27 23:20:29 +03:00
|
|
|
free(remdesk);
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
2016-11-22 14:27:05 +03:00
|
|
|
static VOID VCAPITYPE remdesk_virtual_channel_init_event_ex(LPVOID lpUserParam, LPVOID pInitHandle,
|
2016-09-26 13:12:37 +03:00
|
|
|
UINT event, LPVOID pData,
|
|
|
|
UINT dataLength)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2015-08-27 15:25:09 +03:00
|
|
|
UINT error = CHANNEL_RC_OK;
|
2016-11-22 14:27:05 +03:00
|
|
|
remdeskPlugin* remdesk = (remdeskPlugin*) lpUserParam;
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
if (!remdesk || (remdesk->InitHandle != pInitHandle))
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2014-09-12 18:19:32 +04:00
|
|
|
WLog_ERR(TAG, "error no match");
|
2016-03-14 15:19:08 +03:00
|
|
|
return;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (event)
|
|
|
|
{
|
|
|
|
case CHANNEL_EVENT_CONNECTED:
|
2016-08-09 13:04:06 +03:00
|
|
|
if ((error = remdesk_virtual_channel_event_connected(remdesk, pData,
|
2016-09-26 13:12:37 +03:00
|
|
|
dataLength)))
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "remdesk_virtual_channel_event_connected failed with error %"PRIu32"",
|
2016-09-26 13:12:37 +03:00
|
|
|
error);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CHANNEL_EVENT_DISCONNECTED:
|
2015-07-15 10:50:35 +03:00
|
|
|
if ((error = remdesk_virtual_channel_event_disconnected(remdesk)))
|
2016-08-09 13:04:06 +03:00
|
|
|
WLog_ERR(TAG,
|
2016-12-14 00:47:08 +03:00
|
|
|
"remdesk_virtual_channel_event_disconnected failed with error %"PRIu32"", error);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CHANNEL_EVENT_TERMINATED:
|
|
|
|
remdesk_virtual_channel_event_terminated(remdesk);
|
|
|
|
break;
|
2016-12-19 19:07:01 +03:00
|
|
|
|
|
|
|
case CHANNEL_EVENT_ATTACHED:
|
|
|
|
case CHANNEL_EVENT_DETACHED:
|
|
|
|
default:
|
|
|
|
break;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-07-15 10:50:35 +03:00
|
|
|
if (error && remdesk->rdpcontext)
|
2016-08-09 13:04:06 +03:00
|
|
|
setChannelError(remdesk->rdpcontext, error,
|
2016-09-26 13:12:37 +03:00
|
|
|
"remdesk_virtual_channel_init_event reported an error");
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* remdesk is always built-in */
|
2016-11-22 14:27:05 +03:00
|
|
|
#define VirtualChannelEntryEx remdesk_VirtualChannelEntryEx
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-11-22 14:27:05 +03:00
|
|
|
BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID pInitHandle)
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
2015-01-20 13:47:47 +03:00
|
|
|
UINT rc;
|
2014-06-29 01:24:44 +04:00
|
|
|
remdeskPlugin* remdesk;
|
2015-06-22 10:12:25 +03:00
|
|
|
RemdeskClientContext* context = NULL;
|
2016-11-22 14:27:05 +03:00
|
|
|
CHANNEL_ENTRY_POINTS_FREERDP_EX* pEntryPointsEx;
|
2016-09-26 13:12:14 +03:00
|
|
|
|
|
|
|
if (!pEntryPoints)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
remdesk = (remdeskPlugin*) calloc(1, sizeof(remdeskPlugin));
|
|
|
|
|
2014-06-29 04:22:36 +04:00
|
|
|
if (!remdesk)
|
2015-06-22 10:12:25 +03:00
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
2014-06-29 04:22:36 +04:00
|
|
|
return FALSE;
|
2015-06-22 10:12:25 +03:00
|
|
|
}
|
2014-06-29 04:22:36 +04:00
|
|
|
|
2014-06-29 01:24:44 +04:00
|
|
|
remdesk->channelDef.options =
|
2016-08-09 13:04:06 +03:00
|
|
|
CHANNEL_OPTION_INITIALIZED |
|
|
|
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
|
|
|
CHANNEL_OPTION_COMPRESS_RDP |
|
|
|
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
2014-06-29 01:24:44 +04:00
|
|
|
strcpy(remdesk->channelDef.name, "remdesk");
|
2014-06-29 04:22:36 +04:00
|
|
|
remdesk->Version = 2;
|
2016-11-22 14:27:05 +03:00
|
|
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-11-22 14:27:05 +03:00
|
|
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
2016-08-09 13:04:06 +03:00
|
|
|
(pEntryPointsEx->MagicNumber == FREERDP_CHANNEL_MAGIC_NUMBER))
|
2014-06-29 01:24:44 +04:00
|
|
|
{
|
|
|
|
context = (RemdeskClientContext*) calloc(1, sizeof(RemdeskClientContext));
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-06-22 10:12:25 +03:00
|
|
|
if (!context)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "calloc failed!");
|
|
|
|
goto error_out;
|
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
|
|
|
|
context->handle = (void*) remdesk;
|
2014-12-27 23:20:29 +03:00
|
|
|
remdesk->context = context;
|
2015-07-15 10:50:35 +03:00
|
|
|
remdesk->rdpcontext = pEntryPointsEx->context;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|
|
|
|
|
2016-08-09 13:04:06 +03:00
|
|
|
CopyMemory(&(remdesk->channelEntryPoints), pEntryPoints,
|
2016-11-22 14:27:05 +03:00
|
|
|
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
|
|
|
remdesk->InitHandle = pInitHandle;
|
2016-11-23 15:17:56 +03:00
|
|
|
rc = remdesk->channelEntryPoints.pVirtualChannelInitEx(remdesk, context, pInitHandle,
|
2016-09-26 13:12:37 +03:00
|
|
|
&remdesk->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
2016-11-22 14:27:05 +03:00
|
|
|
remdesk_virtual_channel_init_event_ex);
|
2016-08-09 13:04:06 +03:00
|
|
|
|
2015-01-20 13:47:47 +03:00
|
|
|
if (CHANNEL_RC_OK != rc)
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "pVirtualChannelInitEx failed with %s [%08"PRIX32"]",
|
2016-09-26 13:12:37 +03:00
|
|
|
WTSErrorToString(rc), rc);
|
2015-06-22 10:12:25 +03:00
|
|
|
goto error_out;
|
2015-01-20 13:47:47 +03:00
|
|
|
}
|
2014-06-29 01:24:44 +04:00
|
|
|
|
2016-11-23 15:17:56 +03:00
|
|
|
remdesk->channelEntryPoints.pInterface = context;
|
2015-06-22 10:12:25 +03:00
|
|
|
return TRUE;
|
|
|
|
error_out:
|
|
|
|
free(remdesk);
|
|
|
|
free(context);
|
|
|
|
return FALSE;
|
2014-06-29 01:24:44 +04:00
|
|
|
}
|