Merge pull request #4415 from akallabeth/drdynvc_dyn_log
Prefer dynamic logger in dynamic channel.
This commit is contained in:
commit
6283ce8a20
@ -189,7 +189,7 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
|||||||
|
|
||||||
if (!dvcman)
|
if (!dvcman)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "calloc failed!");
|
WLog_Print(plugin->log, WLOG_ERROR, "calloc failed!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
|||||||
|
|
||||||
if (!dvcman->channels)
|
if (!dvcman->channels)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "ArrayList_New failed!");
|
WLog_Print(plugin->log, WLOG_ERROR, "ArrayList_New failed!");
|
||||||
free(dvcman);
|
free(dvcman);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
|||||||
|
|
||||||
if (!dvcman->pool)
|
if (!dvcman->pool)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "StreamPool_New failed!");
|
WLog_Print(plugin->log, WLOG_ERROR, "StreamPool_New failed!");
|
||||||
ArrayList_Free(dvcman->channels);
|
ArrayList_Free(dvcman->channels);
|
||||||
free(dvcman);
|
free(dvcman);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -225,13 +225,14 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
|||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT dvcman_load_addin(IWTSVirtualChannelManager* pChannelMgr,
|
static UINT dvcman_load_addin(drdynvcPlugin* drdynvc,
|
||||||
|
IWTSVirtualChannelManager* pChannelMgr,
|
||||||
ADDIN_ARGV* args,
|
ADDIN_ARGV* args,
|
||||||
rdpSettings* settings)
|
rdpSettings* settings)
|
||||||
{
|
{
|
||||||
DVCMAN_ENTRY_POINTS entryPoints;
|
DVCMAN_ENTRY_POINTS entryPoints;
|
||||||
PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL;
|
PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL;
|
||||||
WLog_INFO(TAG, "Loading Dynamic Virtual Channel %s", args->argv[0]);
|
WLog_Print(drdynvc->log, WLOG_INFO, "Loading Dynamic Virtual Channel %s", args->argv[0]);
|
||||||
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY) freerdp_load_channel_addin_entry(
|
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY) freerdp_load_channel_addin_entry(
|
||||||
args->argv[0],
|
args->argv[0],
|
||||||
NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
|
NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
|
||||||
@ -251,15 +252,16 @@ static UINT dvcman_load_addin(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
return ERROR_INVALID_FUNCTION;
|
return ERROR_INVALID_FUNCTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DVCMAN_CHANNEL* dvcman_channel_new(IWTSVirtualChannelManager*
|
static DVCMAN_CHANNEL* dvcman_channel_new(drdynvcPlugin* drdynvc,
|
||||||
pChannelMgr,
|
IWTSVirtualChannelManager* pChannelMgr,
|
||||||
UINT32 ChannelId, const char* ChannelName)
|
UINT32 ChannelId, const char* ChannelName)
|
||||||
{
|
{
|
||||||
DVCMAN_CHANNEL* channel;
|
DVCMAN_CHANNEL* channel;
|
||||||
|
|
||||||
if (dvcman_find_channel_by_id(pChannelMgr, ChannelId))
|
if (dvcman_find_channel_by_id(pChannelMgr, ChannelId))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Protocol error: Duplicated ChannelId %"PRIu32" (%s)!", ChannelId,
|
WLog_Print(drdynvc->log, WLOG_ERROR, "Protocol error: Duplicated ChannelId %"PRIu32" (%s)!",
|
||||||
|
ChannelId,
|
||||||
ChannelName);
|
ChannelName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -268,7 +270,7 @@ static DVCMAN_CHANNEL* dvcman_channel_new(IWTSVirtualChannelManager*
|
|||||||
|
|
||||||
if (!channel)
|
if (!channel)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "calloc failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "calloc failed!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,14 +280,14 @@ static DVCMAN_CHANNEL* dvcman_channel_new(IWTSVirtualChannelManager*
|
|||||||
|
|
||||||
if (!channel->channel_name)
|
if (!channel->channel_name)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "_strdup failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "_strdup failed!");
|
||||||
free(channel);
|
free(channel);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitializeCriticalSectionEx(&(channel->lock), 0, 0))
|
if (!InitializeCriticalSectionEx(&(channel->lock), 0, 0))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "InitializeCriticalSectionEx failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "InitializeCriticalSectionEx failed!");
|
||||||
free(channel->channel_name);
|
free(channel->channel_name);
|
||||||
free(channel);
|
free(channel);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -339,7 +341,7 @@ static void dvcman_channel_free(void* arg)
|
|||||||
free(channel);
|
free(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
|
static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
IWTSPlugin* pPlugin;
|
IWTSPlugin* pPlugin;
|
||||||
@ -363,7 +365,7 @@ static void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
|
|||||||
|
|
||||||
if (pPlugin->Terminated)
|
if (pPlugin->Terminated)
|
||||||
if ((error = pPlugin->Terminated(pPlugin)))
|
if ((error = pPlugin->Terminated(pPlugin)))
|
||||||
WLog_ERR(TAG, "Terminated failed with error %"PRIu32"!", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "Terminated failed with error %"PRIu32"!", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
dvcman->num_plugins = 0;
|
dvcman->num_plugins = 0;
|
||||||
@ -376,7 +378,7 @@ static void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
|
|||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT dvcman_init(IWTSVirtualChannelManager* pChannelMgr)
|
static UINT dvcman_init(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
IWTSPlugin* pPlugin;
|
IWTSPlugin* pPlugin;
|
||||||
@ -390,7 +392,7 @@ static UINT dvcman_init(IWTSVirtualChannelManager* pChannelMgr)
|
|||||||
if (pPlugin->Initialize)
|
if (pPlugin->Initialize)
|
||||||
if ((error = pPlugin->Initialize(pPlugin, pChannelMgr)))
|
if ((error = pPlugin->Initialize(pPlugin, pChannelMgr)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Initialize failed with error %"PRIu32"!", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "Initialize failed with error %"PRIu32"!", error);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,7 +442,8 @@ static UINT dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
|
|||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr,
|
static UINT dvcman_create_channel(drdynvcPlugin* drdynvc,
|
||||||
|
IWTSVirtualChannelManager* pChannelMgr,
|
||||||
UINT32 ChannelId, const char* ChannelName)
|
UINT32 ChannelId, const char* ChannelName)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -452,9 +455,9 @@ static UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
|
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
|
||||||
UINT error;
|
UINT error;
|
||||||
|
|
||||||
if (!(channel = dvcman_channel_new(pChannelMgr, ChannelId, ChannelName)))
|
if (!(channel = dvcman_channel_new(drdynvc, pChannelMgr, ChannelId, ChannelName)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "dvcman_channel_new failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "dvcman_channel_new failed!");
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
return CHANNEL_RC_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +480,7 @@ static UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
(IWTSVirtualChannel*) channel, NULL, &bAccept, &pCallback)) == CHANNEL_RC_OK
|
(IWTSVirtualChannel*) channel, NULL, &bAccept, &pCallback)) == CHANNEL_RC_OK
|
||||||
&& bAccept)
|
&& bAccept)
|
||||||
{
|
{
|
||||||
WLog_DBG(TAG, "listener %s created new channel %"PRIu32"",
|
WLog_Print(drdynvc->log, WLOG_DEBUG, "listener %s created new channel %"PRIu32"",
|
||||||
listener->channel_name, channel->channel_id);
|
listener->channel_name, channel->channel_id);
|
||||||
channel->status = CHANNEL_RC_OK;
|
channel->status = CHANNEL_RC_OK;
|
||||||
channel->channel_callback = pCallback;
|
channel->channel_callback = pCallback;
|
||||||
@ -487,7 +490,8 @@ static UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
listener->iface.pInterface);
|
listener->iface.pInterface);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
WLog_ERR(TAG, "context.OnChannelConnected failed with error %"PRIu32"", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "context.OnChannelConnected failed with error %"PRIu32"",
|
||||||
|
error);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -495,12 +499,12 @@ static UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "OnNewChannelConnection failed with error %"PRIu32"!", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "OnNewChannelConnection failed with error %"PRIu32"!", error);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "OnNewChannelConnection returned with bAccept FALSE!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "OnNewChannelConnection returned with bAccept FALSE!");
|
||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -515,7 +519,8 @@ static UINT dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT dvcman_open_channel(IWTSVirtualChannelManager* pChannelMgr,
|
static UINT dvcman_open_channel(drdynvcPlugin* drdynvc,
|
||||||
|
IWTSVirtualChannelManager* pChannelMgr,
|
||||||
UINT32 ChannelId)
|
UINT32 ChannelId)
|
||||||
{
|
{
|
||||||
DVCMAN_CHANNEL* channel;
|
DVCMAN_CHANNEL* channel;
|
||||||
@ -525,7 +530,7 @@ static UINT dvcman_open_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
|
|
||||||
if (!channel)
|
if (!channel)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "ChannelId %"PRIu32" not found!", ChannelId);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "ChannelId %"PRIu32" not found!", ChannelId);
|
||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,11 +540,11 @@ static UINT dvcman_open_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
|
|
||||||
if ((pCallback->OnOpen) && (error = pCallback->OnOpen(pCallback)))
|
if ((pCallback->OnOpen) && (error = pCallback->OnOpen(pCallback)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "OnOpen failed with error %"PRIu32"!", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "OnOpen failed with error %"PRIu32"!", error);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
WLog_DBG(TAG, "open_channel: ChannelId %"PRIu32"", ChannelId);
|
WLog_Print(drdynvc->log, WLOG_DEBUG, "open_channel: ChannelId %"PRIu32"", ChannelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
@ -560,7 +565,7 @@ static UINT dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
|
|
||||||
if (!channel)
|
if (!channel)
|
||||||
{
|
{
|
||||||
//WLog_ERR(TAG, "ChannelId %"PRIu32" not found!", ChannelId);
|
//WLog_Print(drdynvc->log, WLOG_ERROR, "ChannelId %"PRIu32" not found!", ChannelId);
|
||||||
/**
|
/**
|
||||||
* Windows 8 / Windows Server 2012 send close requests for channels that failed to be created.
|
* Windows 8 / Windows Server 2012 send close requests for channels that failed to be created.
|
||||||
* Do not warn, simply return success here.
|
* Do not warn, simply return success here.
|
||||||
@ -577,8 +582,8 @@ static UINT dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT dvcman_receive_channel_data_first(IWTSVirtualChannelManager*
|
static UINT dvcman_receive_channel_data_first(drdynvcPlugin* drdynvc,
|
||||||
pChannelMgr,
|
IWTSVirtualChannelManager* pChannelMgr,
|
||||||
UINT32 ChannelId, UINT32 length)
|
UINT32 ChannelId, UINT32 length)
|
||||||
{
|
{
|
||||||
DVCMAN_CHANNEL* channel;
|
DVCMAN_CHANNEL* channel;
|
||||||
@ -590,7 +595,7 @@ static UINT dvcman_receive_channel_data_first(IWTSVirtualChannelManager*
|
|||||||
* Windows Server 2012 R2 can send some messages over Microsoft::Windows::RDS::Geometry::v08.01
|
* Windows Server 2012 R2 can send some messages over Microsoft::Windows::RDS::Geometry::v08.01
|
||||||
* even if the dynamic virtual channel wasn't registered on our side. Ignoring it works.
|
* even if the dynamic virtual channel wasn't registered on our side. Ignoring it works.
|
||||||
*/
|
*/
|
||||||
WLog_ERR(TAG, "ChannelId %"PRIu32" not found!", ChannelId);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "ChannelId %"PRIu32" not found!", ChannelId);
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +606,7 @@ static UINT dvcman_receive_channel_data_first(IWTSVirtualChannelManager*
|
|||||||
|
|
||||||
if (!channel->dvc_data)
|
if (!channel->dvc_data)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "StreamPool_Take failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "StreamPool_Take failed!");
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
return CHANNEL_RC_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,7 +619,8 @@ static UINT dvcman_receive_channel_data_first(IWTSVirtualChannelManager*
|
|||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr,
|
static UINT dvcman_receive_channel_data(drdynvcPlugin* drdynvc,
|
||||||
|
IWTSVirtualChannelManager* pChannelMgr,
|
||||||
UINT32 ChannelId, wStream* data)
|
UINT32 ChannelId, wStream* data)
|
||||||
{
|
{
|
||||||
UINT status = CHANNEL_RC_OK;
|
UINT status = CHANNEL_RC_OK;
|
||||||
@ -626,7 +632,7 @@ static UINT dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
{
|
{
|
||||||
/* Windows 8.1 tries to open channels not created.
|
/* Windows 8.1 tries to open channels not created.
|
||||||
* Ignore cases like this. */
|
* Ignore cases like this. */
|
||||||
WLog_ERR(TAG, "ChannelId %"PRIu32" not found!", ChannelId);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "ChannelId %"PRIu32" not found!", ChannelId);
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,7 +642,7 @@ static UINT dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
if (Stream_GetPosition(channel->dvc_data) + dataSize > (UINT32) Stream_Capacity(
|
if (Stream_GetPosition(channel->dvc_data) + dataSize > (UINT32) Stream_Capacity(
|
||||||
channel->dvc_data))
|
channel->dvc_data))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "data exceeding declared length!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "data exceeding declared length!");
|
||||||
Stream_Release(channel->dvc_data);
|
Stream_Release(channel->dvc_data);
|
||||||
channel->dvc_data = NULL;
|
channel->dvc_data = NULL;
|
||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
@ -841,7 +847,8 @@ static UINT drdynvc_send_capability_response(drdynvcPlugin* drdynvc)
|
|||||||
return CHANNEL_RC_NO_MEMORY;
|
return CHANNEL_RC_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream_Write_UINT16(s, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
Stream_Write_UINT16(s,
|
||||||
|
0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
||||||
Stream_Write_UINT16(s, drdynvc->version);
|
Stream_Write_UINT16(s, drdynvc->version);
|
||||||
status = drdynvc_send(drdynvc, s);
|
status = drdynvc_send(drdynvc, s);
|
||||||
|
|
||||||
@ -949,7 +956,8 @@ static UINT drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp,
|
|||||||
WLog_Print(drdynvc->log, WLOG_DEBUG, "process_create_request: ChannelId=%"PRIu32" ChannelName=%s",
|
WLog_Print(drdynvc->log, WLOG_DEBUG, "process_create_request: ChannelId=%"PRIu32" ChannelName=%s",
|
||||||
ChannelId,
|
ChannelId,
|
||||||
Stream_Pointer(s));
|
Stream_Pointer(s));
|
||||||
channel_status = dvcman_create_channel(drdynvc->channel_mgr, ChannelId, (char*) Stream_Pointer(s));
|
channel_status = dvcman_create_channel(drdynvc, drdynvc->channel_mgr, ChannelId,
|
||||||
|
(char*) Stream_Pointer(s));
|
||||||
data_out = Stream_New(NULL, pos + 4);
|
data_out = Stream_New(NULL, pos + 4);
|
||||||
|
|
||||||
if (!data_out)
|
if (!data_out)
|
||||||
@ -977,14 +985,14 @@ static UINT drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp,
|
|||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08"PRIX32"]",
|
WLog_Print(drdynvc->log, WLOG_ERROR, "VirtualChannelWriteEx failed with %s [%08"PRIX32"]",
|
||||||
WTSErrorToString(status), status);
|
WTSErrorToString(status), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel_status == CHANNEL_RC_OK)
|
if (channel_status == CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
if ((status = dvcman_open_channel(drdynvc->channel_mgr, ChannelId)))
|
if ((status = dvcman_open_channel(drdynvc, drdynvc->channel_mgr, ChannelId)))
|
||||||
{
|
{
|
||||||
WLog_Print(drdynvc->log, WLOG_ERROR, "dvcman_open_channel failed with error %"PRIu32"!", status);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "dvcman_open_channel failed with error %"PRIu32"!", status);
|
||||||
return status;
|
return status;
|
||||||
@ -1012,15 +1020,16 @@ static UINT drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp,
|
|||||||
UINT32 ChannelId;
|
UINT32 ChannelId;
|
||||||
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
||||||
Length = drdynvc_read_variable_uint(s, Sp);
|
Length = drdynvc_read_variable_uint(s, Sp);
|
||||||
WLog_DBG(TAG, "process_data_first: Sp=%d cbChId=%d, ChannelId=%"PRIu32" Length=%"PRIu32"", Sp,
|
WLog_Print(drdynvc->log, WLOG_DEBUG,
|
||||||
|
"process_data_first: Sp=%d cbChId=%d, ChannelId=%"PRIu32" Length=%"PRIu32"", Sp,
|
||||||
cbChId, ChannelId, Length);
|
cbChId, ChannelId, Length);
|
||||||
status = dvcman_receive_channel_data_first(drdynvc->channel_mgr, ChannelId,
|
status = dvcman_receive_channel_data_first(drdynvc, drdynvc->channel_mgr, ChannelId,
|
||||||
Length);
|
Length);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
return dvcman_receive_channel_data(drdynvc->channel_mgr, ChannelId, s);
|
return dvcman_receive_channel_data(drdynvc, drdynvc->channel_mgr, ChannelId, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1036,7 +1045,7 @@ static UINT drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId,
|
|||||||
WLog_Print(drdynvc->log, WLOG_TRACE, "process_data: Sp=%d cbChId=%d, ChannelId=%"PRIu32"", Sp,
|
WLog_Print(drdynvc->log, WLOG_TRACE, "process_data: Sp=%d cbChId=%d, ChannelId=%"PRIu32"", Sp,
|
||||||
cbChId,
|
cbChId,
|
||||||
ChannelId);
|
ChannelId);
|
||||||
return dvcman_receive_channel_data(drdynvc->channel_mgr, ChannelId, s);
|
return dvcman_receive_channel_data(drdynvc, drdynvc->channel_mgr, ChannelId, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1052,12 +1061,13 @@ static UINT drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp,
|
|||||||
UINT32 ChannelId;
|
UINT32 ChannelId;
|
||||||
wStream* data_out;
|
wStream* data_out;
|
||||||
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
ChannelId = drdynvc_read_variable_uint(s, cbChId);
|
||||||
WLog_DBG(TAG, "process_close_request: Sp=%d cbChId=%d, ChannelId=%"PRIu32"", Sp,
|
WLog_Print(drdynvc->log, WLOG_DEBUG, "process_close_request: Sp=%d cbChId=%d, ChannelId=%"PRIu32"",
|
||||||
|
Sp,
|
||||||
cbChId, ChannelId);
|
cbChId, ChannelId);
|
||||||
|
|
||||||
if ((error = dvcman_close_channel(drdynvc->channel_mgr, ChannelId)))
|
if ((error = dvcman_close_channel(drdynvc->channel_mgr, ChannelId)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "dvcman_close_channel failed with error %"PRIu32"!", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "dvcman_close_channel failed with error %"PRIu32"!", error);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,7 +1075,7 @@ static UINT drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp,
|
|||||||
|
|
||||||
if (!data_out)
|
if (!data_out)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Stream_New failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_New failed!");
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
return CHANNEL_RC_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1075,7 +1085,7 @@ static UINT drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp,
|
|||||||
error = drdynvc_send(drdynvc, data_out);
|
error = drdynvc_send(drdynvc, data_out);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08"PRIX32"]",
|
WLog_Print(drdynvc->log, WLOG_ERROR, "VirtualChannelWriteEx failed with %s [%08"PRIX32"]",
|
||||||
WTSErrorToString(error), error);
|
WTSErrorToString(error), error);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
@ -1116,7 +1126,7 @@ static UINT drdynvc_order_recv(drdynvcPlugin* drdynvc, wStream* s)
|
|||||||
return drdynvc_process_close_request(drdynvc, Sp, cbChId, s);
|
return drdynvc_process_close_request(drdynvc, Sp, cbChId, s);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WLog_ERR(TAG, "unknown drdynvc cmd 0x%x", Cmd);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "unknown drdynvc cmd 0x%x", Cmd);
|
||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1146,13 +1156,13 @@ static UINT drdynvc_virtual_channel_event_data_received(drdynvcPlugin* drdynvc,
|
|||||||
|
|
||||||
if (!(data_in = drdynvc->data_in))
|
if (!(data_in = drdynvc->data_in))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Stream_New failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_New failed!");
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
return CHANNEL_RC_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength))
|
if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "Stream_EnsureRemainingCapacity failed!");
|
||||||
Stream_Free(drdynvc->data_in, TRUE);
|
Stream_Free(drdynvc->data_in, TRUE);
|
||||||
drdynvc->data_in = NULL;
|
drdynvc->data_in = NULL;
|
||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
@ -1164,7 +1174,7 @@ static UINT drdynvc_virtual_channel_event_data_received(drdynvcPlugin* drdynvc,
|
|||||||
{
|
{
|
||||||
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
|
if (Stream_Capacity(data_in) != Stream_GetPosition(data_in))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "drdynvc_plugin_process_received: read error");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "drdynvc_plugin_process_received: read error");
|
||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1174,7 +1184,7 @@ static UINT drdynvc_virtual_channel_event_data_received(drdynvcPlugin* drdynvc,
|
|||||||
|
|
||||||
if (!MessageQueue_Post(drdynvc->queue, NULL, 0, (void*) data_in, NULL))
|
if (!MessageQueue_Post(drdynvc->queue, NULL, 0, (void*) data_in, NULL))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "MessageQueue_Post failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "MessageQueue_Post failed!");
|
||||||
return ERROR_INTERNAL_ERROR;
|
return ERROR_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1190,7 +1200,7 @@ static void VCAPITYPE drdynvc_virtual_channel_open_event_ex(LPVOID lpUserParam,
|
|||||||
|
|
||||||
if (!drdynvc || (drdynvc->OpenHandle != openHandle))
|
if (!drdynvc || (drdynvc->OpenHandle != openHandle))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_open_event: error no match");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "drdynvc_virtual_channel_open_event: error no match");
|
||||||
Stream_Free((wStream*) pData, TRUE);
|
Stream_Free((wStream*) pData, TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1200,7 +1210,8 @@ static void VCAPITYPE drdynvc_virtual_channel_open_event_ex(LPVOID lpUserParam,
|
|||||||
case CHANNEL_EVENT_DATA_RECEIVED:
|
case CHANNEL_EVENT_DATA_RECEIVED:
|
||||||
if ((error = drdynvc_virtual_channel_event_data_received(drdynvc, pData, dataLength, totalLength,
|
if ((error = drdynvc_virtual_channel_event_data_received(drdynvc, pData, dataLength, totalLength,
|
||||||
dataFlags)))
|
dataFlags)))
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_event_data_received failed with error %"PRIu32"", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR,
|
||||||
|
"drdynvc_virtual_channel_event_data_received failed with error %"PRIu32"", error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1351,13 +1362,13 @@ static UINT drdynvc_virtual_channel_event_connected(drdynvcPlugin* drdynvc, LPVO
|
|||||||
for (index = 0; index < settings->DynamicChannelCount; index++)
|
for (index = 0; index < settings->DynamicChannelCount; index++)
|
||||||
{
|
{
|
||||||
args = settings->DynamicChannelArray[index];
|
args = settings->DynamicChannelArray[index];
|
||||||
error = dvcman_load_addin(drdynvc->channel_mgr, args, settings);
|
error = dvcman_load_addin(drdynvc, drdynvc->channel_mgr, args, settings);
|
||||||
|
|
||||||
if (CHANNEL_RC_OK != error)
|
if (CHANNEL_RC_OK != error)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((error = dvcman_init(drdynvc->channel_mgr)))
|
if ((error = dvcman_init(drdynvc, drdynvc->channel_mgr)))
|
||||||
{
|
{
|
||||||
WLog_Print(drdynvc->log, WLOG_ERROR, "dvcman_init failed with error %"PRIu32"!", error);
|
WLog_Print(drdynvc->log, WLOG_ERROR, "dvcman_init failed with error %"PRIu32"!", error);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1427,7 +1438,7 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
|
|||||||
|
|
||||||
if (drdynvc->channel_mgr)
|
if (drdynvc->channel_mgr)
|
||||||
{
|
{
|
||||||
dvcman_free(drdynvc->channel_mgr);
|
dvcman_free(drdynvc, drdynvc->channel_mgr);
|
||||||
drdynvc->channel_mgr = NULL;
|
drdynvc->channel_mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1516,7 +1527,7 @@ static VOID VCAPITYPE drdynvc_virtual_channel_init_event_ex(LPVOID lpUserParam,
|
|||||||
|
|
||||||
if (!drdynvc || (drdynvc->InitHandle != pInitHandle))
|
if (!drdynvc || (drdynvc->InitHandle != pInitHandle))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_init_event: error no match");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "drdynvc_virtual_channel_init_event: error no match");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1589,7 +1600,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
|||||||
|
|
||||||
if (!drdynvc)
|
if (!drdynvc)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "calloc failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "calloc failed!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1608,7 +1619,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
|||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "calloc failed!");
|
WLog_Print(drdynvc->log, WLOG_ERROR, "calloc failed!");
|
||||||
free(drdynvc);
|
free(drdynvc);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1620,7 +1631,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
|||||||
drdynvc->rdpcontext = pEntryPointsEx->context;
|
drdynvc->rdpcontext = pEntryPointsEx->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
drdynvc->log = WLog_Get("com.freerdp.channels.drdynvc.client");
|
drdynvc->log = WLog_Get(TAG);
|
||||||
WLog_Print(drdynvc->log, WLOG_DEBUG, "VirtualChannelEntryEx");
|
WLog_Print(drdynvc->log, WLOG_DEBUG, "VirtualChannelEntryEx");
|
||||||
CopyMemory(&(drdynvc->channelEntryPoints), pEntryPoints, sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
CopyMemory(&(drdynvc->channelEntryPoints), pEntryPoints, sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
drdynvc->InitHandle = pInitHandle;
|
drdynvc->InitHandle = pInitHandle;
|
||||||
|
Loading…
Reference in New Issue
Block a user