mirror of https://github.com/FreeRDP/FreeRDP
virtualChannel: removed static variable usage from
VirtualChannelApi
This commit is contained in:
parent
d29848f383
commit
7fe28a8a78
|
@ -106,7 +106,8 @@ static UINT cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = cliprdr->channelEntryPoints.pVirtualChannelWriteEx(cliprdr->InitHandle, cliprdr->OpenHandle,
|
status = cliprdr->channelEntryPoints.pVirtualChannelWriteEx(cliprdr->InitHandle,
|
||||||
|
cliprdr->OpenHandle,
|
||||||
Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
|
Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1011,7 +1012,8 @@ static UINT cliprdr_virtual_channel_event_data_received(cliprdrPlugin* cliprdr,
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle, UINT event,
|
static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
|
||||||
|
UINT event,
|
||||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
@ -1029,6 +1031,7 @@ static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam,
|
||||||
if ((error = cliprdr_virtual_channel_event_data_received(cliprdr, pData, dataLength,
|
if ((error = cliprdr_virtual_channel_event_data_received(cliprdr, pData, dataLength,
|
||||||
totalLength, dataFlags)))
|
totalLength, dataFlags)))
|
||||||
WLog_ERR(TAG, "failed with error %lu", error);
|
WLog_ERR(TAG, "failed with error %lu", error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_EVENT_WRITE_COMPLETE:
|
case CHANNEL_EVENT_WRITE_COMPLETE:
|
||||||
|
@ -1040,7 +1043,8 @@ static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error && cliprdr->context->rdpcontext)
|
if (error && cliprdr->context->rdpcontext)
|
||||||
setChannelError(cliprdr->context->rdpcontext, error, "cliprdr_virtual_channel_open_event_ex reported an error");
|
setChannelError(cliprdr->context->rdpcontext, error,
|
||||||
|
"cliprdr_virtual_channel_open_event_ex reported an error");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* cliprdr_virtual_channel_client_thread(void* arg)
|
static void* cliprdr_virtual_channel_client_thread(void* arg)
|
||||||
|
@ -1272,7 +1276,6 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
context->ClientFormatDataResponse = cliprdr_client_format_data_response;
|
context->ClientFormatDataResponse = cliprdr_client_format_data_response;
|
||||||
context->ClientFileContentsRequest = cliprdr_client_file_contents_request;
|
context->ClientFileContentsRequest = cliprdr_client_file_contents_request;
|
||||||
context->ClientFileContentsResponse = cliprdr_client_file_contents_response;
|
context->ClientFileContentsResponse = cliprdr_client_file_contents_response;
|
||||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
|
||||||
cliprdr->context = context;
|
cliprdr->context = context;
|
||||||
context->rdpcontext = pEntryPointsEx->context;
|
context->rdpcontext = pEntryPointsEx->context;
|
||||||
}
|
}
|
||||||
|
@ -1285,10 +1288,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
WLog_Print(cliprdr->log, WLOG_DEBUG, "VirtualChannelEntryEx");
|
WLog_Print(cliprdr->log, WLOG_DEBUG, "VirtualChannelEntryEx");
|
||||||
CopyMemory(&(cliprdr->channelEntryPoints), pEntryPoints,
|
CopyMemory(&(cliprdr->channelEntryPoints), pEntryPoints,
|
||||||
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
|
|
||||||
cliprdr->InitHandle = pInitHandle;
|
cliprdr->InitHandle = pInitHandle;
|
||||||
|
rc = cliprdr->channelEntryPoints.pVirtualChannelInitEx(cliprdr, context, pInitHandle,
|
||||||
rc = cliprdr->channelEntryPoints.pVirtualChannelInitEx((void*) cliprdr, pInitHandle,
|
|
||||||
&cliprdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
&cliprdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
||||||
cliprdr_virtual_channel_init_event_ex);
|
cliprdr_virtual_channel_init_event_ex);
|
||||||
|
|
||||||
|
@ -1296,19 +1297,11 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
|
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
|
||||||
WTSErrorToString(rc), rc);
|
WTSErrorToString(rc), rc);
|
||||||
|
|
||||||
if (context)
|
|
||||||
*(pEntryPointsEx->ppInterface) = NULL;
|
|
||||||
|
|
||||||
free(cliprdr->context);
|
free(cliprdr->context);
|
||||||
free(cliprdr);
|
free(cliprdr);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cliprdr->channelEntryPoints.pInterface = *
|
cliprdr->channelEntryPoints.pInterface = context;
|
||||||
(cliprdr->channelEntryPoints.ppInterface);
|
|
||||||
cliprdr->channelEntryPoints.ppInterface = &
|
|
||||||
(cliprdr->channelEntryPoints.pInterface);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -707,7 +707,7 @@ static UINT drdynvc_send(drdynvcPlugin* drdynvc, wStream* s)
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
Stream_Free(s, TRUE);
|
Stream_Free(s, TRUE);
|
||||||
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]", WTSErrorToString(status), status);
|
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08X]", WTSErrorToString(status), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -799,7 +799,7 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId,
|
||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
|
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08X]",
|
||||||
WTSErrorToString(status), status);
|
WTSErrorToString(status), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -832,7 +832,7 @@ static UINT drdynvc_send_capability_response(drdynvcPlugin* drdynvc)
|
||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
|
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08X]",
|
||||||
WTSErrorToString(status), status);
|
WTSErrorToString(status), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ static UINT drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp,
|
||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "VirtualChannelWrite failed with %s [%08X]",
|
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08X]",
|
||||||
WTSErrorToString(status), status);
|
WTSErrorToString(status), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1053,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, "VirtualChannelWrite failed with %s [%08X]",
|
WLog_ERR(TAG, "VirtualChannelWriteEx failed with %s [%08X]",
|
||||||
WTSErrorToString(error), error);
|
WTSErrorToString(error), error);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -1182,8 +1182,10 @@ static void VCAPITYPE drdynvc_virtual_channel_open_event_ex(LPVOID lpUserParam,
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case CHANNEL_EVENT_DATA_RECEIVED:
|
case CHANNEL_EVENT_DATA_RECEIVED:
|
||||||
if ((error = drdynvc_virtual_channel_event_data_received(drdynvc, pData, dataLength, totalLength, dataFlags)))
|
if ((error = drdynvc_virtual_channel_event_data_received(drdynvc, pData, dataLength, totalLength,
|
||||||
|
dataFlags)))
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_event_data_received failed with error %lu", error);
|
WLog_ERR(TAG, "drdynvc_virtual_channel_event_data_received failed with error %lu", error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_EVENT_WRITE_COMPLETE:
|
case CHANNEL_EVENT_WRITE_COMPLETE:
|
||||||
|
@ -1240,7 +1242,8 @@ static void* drdynvc_virtual_channel_client_thread(void* arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error && drdynvc->rdpcontext)
|
if (error && drdynvc->rdpcontext)
|
||||||
setChannelError(drdynvc->rdpcontext, error, "drdynvc_virtual_channel_client_thread reported an error");
|
setChannelError(drdynvc->rdpcontext, error,
|
||||||
|
"drdynvc_virtual_channel_client_thread reported an error");
|
||||||
|
|
||||||
ExitThread((DWORD) error);
|
ExitThread((DWORD) error);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1251,14 +1254,14 @@ static void* drdynvc_virtual_channel_client_thread(void* arg)
|
||||||
*
|
*
|
||||||
* @return 0 on success, otherwise a Win32 error code
|
* @return 0 on success, otherwise a Win32 error code
|
||||||
*/
|
*/
|
||||||
static UINT drdynvc_virtual_channel_event_connected(drdynvcPlugin* drdynvc, LPVOID pData, UINT32 dataLength)
|
static UINT drdynvc_virtual_channel_event_connected(drdynvcPlugin* drdynvc, LPVOID pData,
|
||||||
|
UINT32 dataLength)
|
||||||
{
|
{
|
||||||
UINT error;
|
UINT error;
|
||||||
UINT32 status;
|
UINT32 status;
|
||||||
UINT32 index;
|
UINT32 index;
|
||||||
ADDIN_ARGV* args;
|
ADDIN_ARGV* args;
|
||||||
rdpSettings* settings;
|
rdpSettings* settings;
|
||||||
|
|
||||||
status = drdynvc->channelEntryPoints.pVirtualChannelOpenEx(drdynvc->InitHandle,
|
status = drdynvc->channelEntryPoints.pVirtualChannelOpenEx(drdynvc->InitHandle,
|
||||||
&drdynvc->OpenHandle, drdynvc->channelDef.name, drdynvc_virtual_channel_open_event_ex);
|
&drdynvc->OpenHandle, drdynvc->channelDef.name, drdynvc_virtual_channel_open_event_ex);
|
||||||
|
|
||||||
|
@ -1340,8 +1343,8 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
|
||||||
CloseHandle(drdynvc->thread);
|
CloseHandle(drdynvc->thread);
|
||||||
drdynvc->queue = NULL;
|
drdynvc->queue = NULL;
|
||||||
drdynvc->thread = NULL;
|
drdynvc->thread = NULL;
|
||||||
|
status = drdynvc->channelEntryPoints.pVirtualChannelCloseEx(drdynvc->InitHandle,
|
||||||
status = drdynvc->channelEntryPoints.pVirtualChannelCloseEx(drdynvc->InitHandle, drdynvc->OpenHandle);
|
drdynvc->OpenHandle);
|
||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
{
|
{
|
||||||
|
@ -1378,7 +1381,8 @@ static UINT drdynvc_virtual_channel_event_terminated(drdynvcPlugin* drdynvc)
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID VCAPITYPE drdynvc_virtual_channel_init_event_ex(LPVOID lpUserParam, LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)
|
static VOID VCAPITYPE drdynvc_virtual_channel_init_event_ex(LPVOID lpUserParam, LPVOID pInitHandle,
|
||||||
|
UINT event, LPVOID pData, UINT dataLength)
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
drdynvcPlugin* drdynvc = (drdynvcPlugin*) lpUserParam;
|
drdynvcPlugin* drdynvc = (drdynvcPlugin*) lpUserParam;
|
||||||
|
@ -1394,21 +1398,25 @@ static VOID VCAPITYPE drdynvc_virtual_channel_init_event_ex(LPVOID lpUserParam,
|
||||||
case CHANNEL_EVENT_CONNECTED:
|
case CHANNEL_EVENT_CONNECTED:
|
||||||
if ((error = drdynvc_virtual_channel_event_connected(drdynvc, pData, dataLength)))
|
if ((error = drdynvc_virtual_channel_event_connected(drdynvc, pData, dataLength)))
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_event_connected failed with error %lu", error);
|
WLog_ERR(TAG, "drdynvc_virtual_channel_event_connected failed with error %lu", error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_EVENT_DISCONNECTED:
|
case CHANNEL_EVENT_DISCONNECTED:
|
||||||
if ((error = drdynvc_virtual_channel_event_disconnected(drdynvc)))
|
if ((error = drdynvc_virtual_channel_event_disconnected(drdynvc)))
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_event_disconnected failed with error %lu", error);
|
WLog_ERR(TAG, "drdynvc_virtual_channel_event_disconnected failed with error %lu", error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANNEL_EVENT_TERMINATED:
|
case CHANNEL_EVENT_TERMINATED:
|
||||||
if ((error = drdynvc_virtual_channel_event_terminated(drdynvc)))
|
if ((error = drdynvc_virtual_channel_event_terminated(drdynvc)))
|
||||||
WLog_ERR(TAG, "drdynvc_virtual_channel_event_terminated failed with error %lu", error);
|
WLog_ERR(TAG, "drdynvc_virtual_channel_event_terminated failed with error %lu", error);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error && drdynvc->rdpcontext)
|
if (error && drdynvc->rdpcontext)
|
||||||
setChannelError(drdynvc->rdpcontext, error, "drdynvc_virtual_channel_init_event_ex reported an error");
|
setChannelError(drdynvc->rdpcontext, error,
|
||||||
|
"drdynvc_virtual_channel_init_event_ex reported an error");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1442,10 +1450,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP;
|
CHANNEL_OPTION_COMPRESS_RDP;
|
||||||
|
|
||||||
strcpy(drdynvc->channelDef.name, "drdynvc");
|
strcpy(drdynvc->channelDef.name, "drdynvc");
|
||||||
drdynvc->state = DRDYNVC_STATE_INITIAL;
|
drdynvc->state = DRDYNVC_STATE_INITIAL;
|
||||||
|
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
||||||
|
@ -1465,37 +1471,25 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
||||||
drdynvc->context = context;
|
drdynvc->context = context;
|
||||||
context->GetVersion = drdynvc_get_version;
|
context->GetVersion = drdynvc_get_version;
|
||||||
drdynvc->rdpcontext = pEntryPointsEx->context;
|
drdynvc->rdpcontext = pEntryPointsEx->context;
|
||||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drdynvc->log = WLog_Get("com.freerdp.channels.drdynvc.client");
|
drdynvc->log = WLog_Get("com.freerdp.channels.drdynvc.client");
|
||||||
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;
|
||||||
|
rc = drdynvc->channelEntryPoints.pVirtualChannelInitEx(drdynvc, context, pInitHandle,
|
||||||
rc = drdynvc->channelEntryPoints.pVirtualChannelInitEx((void*) drdynvc, pInitHandle,
|
|
||||||
&drdynvc->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000, drdynvc_virtual_channel_init_event_ex);
|
&drdynvc->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000, drdynvc_virtual_channel_init_event_ex);
|
||||||
|
|
||||||
if (CHANNEL_RC_OK != rc)
|
if (CHANNEL_RC_OK != rc)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
|
WLog_ERR(TAG, "pVirtualChannelInit failed with %s [%08X]",
|
||||||
WTSErrorToString(rc), rc);
|
WTSErrorToString(rc), rc);
|
||||||
|
|
||||||
if (context)
|
|
||||||
*(pEntryPointsEx->ppInterface) = NULL;
|
|
||||||
|
|
||||||
free(drdynvc->context);
|
free(drdynvc->context);
|
||||||
free(drdynvc);
|
free(drdynvc);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
drdynvc->channelEntryPoints.pInterface = *
|
drdynvc->channelEntryPoints.pInterface = context;
|
||||||
(drdynvc->channelEntryPoints.ppInterface);
|
|
||||||
drdynvc->channelEntryPoints.ppInterface = &
|
|
||||||
(drdynvc->channelEntryPoints.pInterface);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,8 @@ static UINT encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s)
|
||||||
WLog_INFO(TAG, "EncomspWrite (%d)", Stream_Length(s));
|
WLog_INFO(TAG, "EncomspWrite (%d)", Stream_Length(s));
|
||||||
winpr_HexDump(Stream_Buffer(s), Stream_Length(s));
|
winpr_HexDump(Stream_Buffer(s), Stream_Length(s));
|
||||||
#endif
|
#endif
|
||||||
status = encomsp->channelEntryPoints.pVirtualChannelWriteEx(encomsp->InitHandle, encomsp->OpenHandle,
|
status = encomsp->channelEntryPoints.pVirtualChannelWriteEx(encomsp->InitHandle,
|
||||||
|
encomsp->OpenHandle,
|
||||||
Stream_Buffer(s), (UINT32) Stream_Length(s), s);
|
Stream_Buffer(s), (UINT32) Stream_Length(s), s);
|
||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
|
@ -999,7 +1000,8 @@ static UINT encomsp_virtual_channel_event_data_received(encomspPlugin* encomsp,
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID VCAPITYPE encomsp_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle, UINT event,
|
static VOID VCAPITYPE encomsp_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
|
||||||
|
UINT event,
|
||||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
@ -1041,7 +1043,6 @@ static void* encomsp_virtual_channel_client_thread(void* arg)
|
||||||
wMessage message;
|
wMessage message;
|
||||||
encomspPlugin* encomsp = (encomspPlugin*) arg;
|
encomspPlugin* encomsp = (encomspPlugin*) arg;
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
|
||||||
encomsp_process_connect(encomsp);
|
encomsp_process_connect(encomsp);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -1268,7 +1269,6 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
||||||
encomsp_send_change_participant_control_level_pdu;
|
encomsp_send_change_participant_control_level_pdu;
|
||||||
context->GraphicsStreamPaused = NULL;
|
context->GraphicsStreamPaused = NULL;
|
||||||
context->GraphicsStreamResumed = NULL;
|
context->GraphicsStreamResumed = NULL;
|
||||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
|
||||||
encomsp->context = context;
|
encomsp->context = context;
|
||||||
encomsp->rdpcontext = pEntryPointsEx->context;
|
encomsp->rdpcontext = pEntryPointsEx->context;
|
||||||
isFreerdp = TRUE;
|
isFreerdp = TRUE;
|
||||||
|
@ -1277,7 +1277,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
||||||
CopyMemory(&(encomsp->channelEntryPoints), pEntryPoints,
|
CopyMemory(&(encomsp->channelEntryPoints), pEntryPoints,
|
||||||
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
encomsp->InitHandle = pInitHandle;
|
encomsp->InitHandle = pInitHandle;
|
||||||
rc = encomsp->channelEntryPoints.pVirtualChannelInitEx((void*) encomsp, pInitHandle,
|
rc = encomsp->channelEntryPoints.pVirtualChannelInitEx(encomsp, context, pInitHandle,
|
||||||
&encomsp->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
&encomsp->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
||||||
encomsp_virtual_channel_init_event_ex);
|
encomsp_virtual_channel_init_event_ex);
|
||||||
|
|
||||||
|
@ -1288,17 +1288,10 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
encomsp->channelEntryPoints.pInterface = *
|
encomsp->channelEntryPoints.pInterface = context;
|
||||||
(encomsp->channelEntryPoints.ppInterface);
|
|
||||||
encomsp->channelEntryPoints.ppInterface = &
|
|
||||||
(encomsp->channelEntryPoints.pInterface);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
error_out:
|
error_out:
|
||||||
|
|
||||||
if (context)
|
|
||||||
*(pEntryPointsEx->ppInterface) = NULL;
|
|
||||||
|
|
||||||
if (isFreerdp)
|
if (isFreerdp)
|
||||||
free(encomsp->context);
|
free(encomsp->context);
|
||||||
|
|
||||||
|
|
|
@ -809,7 +809,6 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
context->ClientGetAppIdRequest = rail_client_get_appid_request;
|
context->ClientGetAppIdRequest = rail_client_get_appid_request;
|
||||||
context->ServerGetAppIdResponse = rail_server_get_appid_response;
|
context->ServerGetAppIdResponse = rail_server_get_appid_response;
|
||||||
rail->rdpcontext = pEntryPointsEx->context;
|
rail->rdpcontext = pEntryPointsEx->context;
|
||||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
|
||||||
rail->context = context;
|
rail->context = context;
|
||||||
isFreerdp = TRUE;
|
isFreerdp = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -819,10 +818,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
WLog_Print(rail->log, WLOG_DEBUG, "VirtualChannelEntryEx");
|
WLog_Print(rail->log, WLOG_DEBUG, "VirtualChannelEntryEx");
|
||||||
CopyMemory(&(rail->channelEntryPoints), pEntryPoints,
|
CopyMemory(&(rail->channelEntryPoints), pEntryPoints,
|
||||||
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
|
|
||||||
rail->InitHandle = pInitHandle;
|
rail->InitHandle = pInitHandle;
|
||||||
|
rc = rail->channelEntryPoints.pVirtualChannelInitEx(rail, context, pInitHandle,
|
||||||
rc = rail->channelEntryPoints.pVirtualChannelInitEx((void*) rail, pInitHandle,
|
|
||||||
&rail->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
&rail->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
||||||
rail_virtual_channel_init_event_ex);
|
rail_virtual_channel_init_event_ex);
|
||||||
|
|
||||||
|
@ -833,15 +830,10 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
rail->channelEntryPoints.pInterface = *(rail->channelEntryPoints.ppInterface);
|
rail->channelEntryPoints.pInterface = context;
|
||||||
rail->channelEntryPoints.ppInterface = &(rail->channelEntryPoints.pInterface);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
error_out:
|
error_out:
|
||||||
|
|
||||||
if (context)
|
|
||||||
*(pEntryPointsEx->ppInterface) = NULL;
|
|
||||||
|
|
||||||
if (isFreerdp)
|
if (isFreerdp)
|
||||||
free(rail->context);
|
free(rail->context);
|
||||||
|
|
||||||
|
|
|
@ -1509,7 +1509,8 @@ static UINT rdpdr_virtual_channel_event_data_received(rdpdrPlugin* rdpdr,
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle, UINT event,
|
static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
|
||||||
|
UINT event,
|
||||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
@ -1692,7 +1693,6 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr)
|
||||||
rdpdr->devman = NULL;
|
rdpdr->devman = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1769,7 +1769,6 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP;
|
CHANNEL_OPTION_COMPRESS_RDP;
|
||||||
|
|
||||||
strcpy(rdpdr->channelDef.name, "rdpdr");
|
strcpy(rdpdr->channelDef.name, "rdpdr");
|
||||||
rdpdr->sequenceId = 0;
|
rdpdr->sequenceId = 0;
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
@ -1782,10 +1781,8 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
|
|
||||||
CopyMemory(&(rdpdr->channelEntryPoints), pEntryPoints,
|
CopyMemory(&(rdpdr->channelEntryPoints), pEntryPoints,
|
||||||
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
|
|
||||||
rdpdr->InitHandle = pInitHandle;
|
rdpdr->InitHandle = pInitHandle;
|
||||||
|
rc = rdpdr->channelEntryPoints.pVirtualChannelInitEx(rdpdr, NULL, pInitHandle,
|
||||||
rc = rdpdr->channelEntryPoints.pVirtualChannelInitEx((void*) rdpdr, pInitHandle,
|
|
||||||
&rdpdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
&rdpdr->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
||||||
rdpdr_virtual_channel_init_event_ex);
|
rdpdr_virtual_channel_init_event_ex);
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,6 @@ static void* rdpsnd_schedule_thread(void* arg)
|
||||||
HANDLE events[2];
|
HANDLE events[2];
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
DWORD status;
|
DWORD status;
|
||||||
|
|
||||||
events[0] = MessageQueue_Event(rdpsnd->MsgPipe->Out);
|
events[0] = MessageQueue_Event(rdpsnd->MsgPipe->Out);
|
||||||
events[1] = rdpsnd->stopEvent;
|
events[1] = rdpsnd->stopEvent;
|
||||||
|
|
||||||
|
@ -1203,7 +1202,8 @@ static UINT rdpsnd_virtual_channel_event_data_received(rdpsndPlugin* plugin,
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle, UINT event,
|
static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
|
||||||
|
UINT event,
|
||||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
@ -1485,7 +1485,6 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
rdpsnd->channelDef.options =
|
rdpsnd->channelDef.options =
|
||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP;
|
CHANNEL_OPTION_ENCRYPT_RDP;
|
||||||
|
|
||||||
strcpy(rdpsnd->channelDef.name, "rdpsnd");
|
strcpy(rdpsnd->channelDef.name, "rdpsnd");
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ static UINT remdesk_virtual_channel_write(remdeskPlugin* remdesk, wStream* s)
|
||||||
return CHANNEL_RC_INVALID_INSTANCE;
|
return CHANNEL_RC_INVALID_INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = remdesk->channelEntryPoints.pVirtualChannelWriteEx(remdesk->InitHandle, remdesk->OpenHandle,
|
status = remdesk->channelEntryPoints.pVirtualChannelWriteEx(remdesk->InitHandle,
|
||||||
|
remdesk->OpenHandle,
|
||||||
Stream_Buffer(s), (UINT32) Stream_Length(s), s);
|
Stream_Buffer(s), (UINT32) Stream_Length(s), s);
|
||||||
|
|
||||||
if (status != CHANNEL_RC_OK)
|
if (status != CHANNEL_RC_OK)
|
||||||
|
@ -800,7 +801,8 @@ static UINT remdesk_virtual_channel_event_data_received(remdeskPlugin* remdesk,
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID VCAPITYPE remdesk_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle, UINT event,
|
static VOID VCAPITYPE remdesk_virtual_channel_open_event_ex(LPVOID lpUserParam, DWORD openHandle,
|
||||||
|
UINT event,
|
||||||
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
@ -845,7 +847,6 @@ static void* remdesk_virtual_channel_client_thread(void* arg)
|
||||||
wMessage message;
|
wMessage message;
|
||||||
remdeskPlugin* remdesk = (remdeskPlugin*) arg;
|
remdeskPlugin* remdesk = (remdeskPlugin*) arg;
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = CHANNEL_RC_OK;
|
||||||
|
|
||||||
remdesk_process_connect(remdesk);
|
remdesk_process_connect(remdesk);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -1049,7 +1050,6 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP |
|
CHANNEL_OPTION_COMPRESS_RDP |
|
||||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||||
|
|
||||||
strcpy(remdesk->channelDef.name, "remdesk");
|
strcpy(remdesk->channelDef.name, "remdesk");
|
||||||
remdesk->Version = 2;
|
remdesk->Version = 2;
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
@ -1066,17 +1066,14 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
}
|
}
|
||||||
|
|
||||||
context->handle = (void*) remdesk;
|
context->handle = (void*) remdesk;
|
||||||
*(pEntryPointsEx->ppInterface) = (void*) context;
|
|
||||||
remdesk->context = context;
|
remdesk->context = context;
|
||||||
remdesk->rdpcontext = pEntryPointsEx->context;
|
remdesk->rdpcontext = pEntryPointsEx->context;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMemory(&(remdesk->channelEntryPoints), pEntryPoints,
|
CopyMemory(&(remdesk->channelEntryPoints), pEntryPoints,
|
||||||
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
|
|
||||||
remdesk->InitHandle = pInitHandle;
|
remdesk->InitHandle = pInitHandle;
|
||||||
|
rc = remdesk->channelEntryPoints.pVirtualChannelInitEx(remdesk, context, pInitHandle,
|
||||||
rc = remdesk->channelEntryPoints.pVirtualChannelInitEx((void*) remdesk, pInitHandle,
|
|
||||||
&remdesk->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
&remdesk->channelDef, 1, VIRTUAL_CHANNEL_VERSION_WIN2000,
|
||||||
remdesk_virtual_channel_init_event_ex);
|
remdesk_virtual_channel_init_event_ex);
|
||||||
|
|
||||||
|
@ -1087,17 +1084,9 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
remdesk->channelEntryPoints.pInterface = *
|
remdesk->channelEntryPoints.pInterface = context;
|
||||||
(remdesk->channelEntryPoints.ppInterface);
|
|
||||||
remdesk->channelEntryPoints.ppInterface = &
|
|
||||||
(remdesk->channelEntryPoints.pInterface);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
error_out:
|
error_out:
|
||||||
|
|
||||||
if (context)
|
|
||||||
*(pEntryPointsEx->ppInterface) = NULL;
|
|
||||||
|
|
||||||
free(remdesk);
|
free(remdesk);
|
||||||
free(context);
|
free(context);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
static WINPR_TLS void* g_pInterface = NULL;
|
static WINPR_TLS void* g_pInterface = NULL;
|
||||||
static WINPR_TLS rdpChannels* g_channels = NULL; /* use only for VirtualChannelInit hack */
|
static WINPR_TLS rdpChannels* g_channels = NULL; /* use only for VirtualChannelInit hack */
|
||||||
|
|
||||||
static UINT32 g_OpenHandleSeq = 1; /* use global counter to ensure uniqueness across channel manager instances */
|
static UINT32 g_OpenHandleSeq =
|
||||||
|
1; /* use global counter to ensure uniqueness across channel manager instances */
|
||||||
static rdpChannelHandles g_ChannelHandles = { NULL, NULL };
|
static rdpChannelHandles g_ChannelHandles = { NULL, NULL };
|
||||||
|
|
||||||
static CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(
|
static CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(
|
||||||
|
@ -234,7 +235,6 @@ UINT freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
|
||||||
{
|
{
|
||||||
ChannelConnectedEventArgs e;
|
ChannelConnectedEventArgs e;
|
||||||
CHANNEL_OPEN_DATA* pChannelOpenData = NULL;
|
CHANNEL_OPEN_DATA* pChannelOpenData = NULL;
|
||||||
|
|
||||||
pChannelClientData = &channels->clientDataList[index];
|
pChannelClientData = &channels->clientDataList[index];
|
||||||
|
|
||||||
if (pChannelClientData->pChannelInitEventProc)
|
if (pChannelClientData->pChannelInitEventProc)
|
||||||
|
@ -252,7 +252,6 @@ UINT freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
pChannelOpenData = &channels->openDataList[index];
|
pChannelOpenData = &channels->openDataList[index];
|
||||||
|
|
||||||
name = (char*) malloc(9);
|
name = (char*) malloc(9);
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
|
@ -374,12 +373,14 @@ static int freerdp_channels_process_sync(rdpChannels* channels,
|
||||||
if (pChannelOpenData->pChannelOpenEventProc)
|
if (pChannelOpenData->pChannelOpenEventProc)
|
||||||
{
|
{
|
||||||
pChannelOpenData->pChannelOpenEventProc(
|
pChannelOpenData->pChannelOpenEventProc(
|
||||||
pChannelOpenData->OpenHandle, CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, item->DataLength, item->DataLength, 0);
|
pChannelOpenData->OpenHandle, CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, item->DataLength,
|
||||||
|
item->DataLength, 0);
|
||||||
}
|
}
|
||||||
else if (pChannelOpenData->pChannelOpenEventProcEx)
|
else if (pChannelOpenData->pChannelOpenEventProcEx)
|
||||||
{
|
{
|
||||||
pChannelOpenData->pChannelOpenEventProcEx(pChannelOpenData->lpUserParam,
|
pChannelOpenData->pChannelOpenEventProcEx(pChannelOpenData->lpUserParam,
|
||||||
pChannelOpenData->OpenHandle, CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, item->DataLength, item->DataLength, 0);
|
pChannelOpenData->OpenHandle, CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, item->DataLength,
|
||||||
|
item->DataLength, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(item);
|
free(item);
|
||||||
|
@ -538,12 +539,12 @@ void freerdp_channels_close(rdpChannels* channels, freerdp* instance)
|
||||||
MessageQueue_PostQuit(channels->queue, 0);
|
MessageQueue_PostQuit(channels->queue, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(LPVOID lpUserParam, LPVOID pInitHandle,
|
static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(LPVOID lpUserParam, LPVOID clientContext,
|
||||||
PCHANNEL_DEF pChannel, INT channelCount, ULONG versionRequested, PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx)
|
LPVOID pInitHandle,
|
||||||
|
PCHANNEL_DEF pChannel, INT channelCount, ULONG versionRequested,
|
||||||
|
PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx)
|
||||||
{
|
{
|
||||||
INT index;
|
INT index;
|
||||||
void* pInterface;
|
|
||||||
DWORD OpenHandle;
|
|
||||||
CHANNEL_DEF* channel;
|
CHANNEL_DEF* channel;
|
||||||
rdpSettings* settings;
|
rdpSettings* settings;
|
||||||
PCHANNEL_DEF pChannelDef;
|
PCHANNEL_DEF pChannelDef;
|
||||||
|
@ -558,11 +559,9 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(LPVOID lpUserParam, LPVOID pI
|
||||||
if (!pChannel || (channelCount <= 0) || !pChannelInitEventProcEx)
|
if (!pChannel || (channelCount <= 0) || !pChannelInitEventProcEx)
|
||||||
return CHANNEL_RC_INITIALIZATION_ERROR;
|
return CHANNEL_RC_INITIALIZATION_ERROR;
|
||||||
|
|
||||||
pInterface = g_pInterface;
|
|
||||||
|
|
||||||
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
||||||
channels = pChannelInitData->channels;
|
channels = pChannelInitData->channels;
|
||||||
pChannelInitData->pInterface = pInterface;
|
pChannelInitData->pInterface = clientContext;
|
||||||
|
|
||||||
if (!channels->can_call_init)
|
if (!channels->can_call_init)
|
||||||
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
|
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
|
||||||
|
@ -601,12 +600,10 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(LPVOID lpUserParam, LPVOID pI
|
||||||
{
|
{
|
||||||
pChannelDef = &pChannel[index];
|
pChannelDef = &pChannel[index];
|
||||||
pChannelOpenData = &channels->openDataList[channels->openDataCount];
|
pChannelOpenData = &channels->openDataList[channels->openDataCount];
|
||||||
OpenHandle = g_OpenHandleSeq++;
|
pChannelOpenData->OpenHandle = ++channels->openHandleSequence;
|
||||||
pChannelOpenData->OpenHandle = OpenHandle;
|
|
||||||
pChannelOpenData->channels = channels;
|
pChannelOpenData->channels = channels;
|
||||||
pChannelOpenData->lpUserParam = lpUserParam;
|
pChannelOpenData->lpUserParam = lpUserParam;
|
||||||
freerdp_channel_add_open_handle_data(&g_ChannelHandles, OpenHandle, (void*) channels);
|
HashTable_Add(channels->openHandles, (void*)(UINT_PTR) pChannelOpenData->OpenHandle,
|
||||||
HashTable_Add(channels->openHandles, (void*)(UINT_PTR) OpenHandle,
|
|
||||||
(void*) pChannelOpenData);
|
(void*) pChannelOpenData);
|
||||||
pChannelOpenData->flags = 1; /* init */
|
pChannelOpenData->flags = 1; /* init */
|
||||||
strncpy(pChannelOpenData->name, pChannelDef->name, CHANNEL_NAME_LEN);
|
strncpy(pChannelOpenData->name, pChannelDef->name, CHANNEL_NAME_LEN);
|
||||||
|
@ -723,7 +720,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelOpenEx(LPVOID pInitHandle,
|
||||||
rdpChannels* channels;
|
rdpChannels* channels;
|
||||||
CHANNEL_INIT_DATA* pChannelInitData;
|
CHANNEL_INIT_DATA* pChannelInitData;
|
||||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||||
|
|
||||||
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
||||||
channels = pChannelInitData->channels;
|
channels = pChannelInitData->channels;
|
||||||
pInterface = pChannelInitData->pInterface;
|
pInterface = pChannelInitData->pInterface;
|
||||||
|
@ -749,7 +745,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelOpenEx(LPVOID pInitHandle,
|
||||||
pChannelOpenData->pInterface = pInterface;
|
pChannelOpenData->pInterface = pInterface;
|
||||||
pChannelOpenData->pChannelOpenEventProcEx = pChannelOpenEventProcEx;
|
pChannelOpenData->pChannelOpenEventProcEx = pChannelOpenEventProcEx;
|
||||||
*pOpenHandle = pChannelOpenData->OpenHandle;
|
*pOpenHandle = pChannelOpenData->OpenHandle;
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +755,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelOpen(LPVOID pInitHandle,
|
||||||
rdpChannels* channels;
|
rdpChannels* channels;
|
||||||
CHANNEL_INIT_DATA* pChannelInitData;
|
CHANNEL_INIT_DATA* pChannelInitData;
|
||||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||||
|
|
||||||
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
||||||
channels = pChannelInitData->channels;
|
channels = pChannelInitData->channels;
|
||||||
pInterface = pChannelInitData->pInterface;
|
pInterface = pChannelInitData->pInterface;
|
||||||
|
@ -786,7 +780,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelOpen(LPVOID pInitHandle,
|
||||||
pChannelOpenData->pInterface = pInterface;
|
pChannelOpenData->pInterface = pInterface;
|
||||||
pChannelOpenData->pChannelOpenEventProc = pChannelOpenEventProc;
|
pChannelOpenData->pChannelOpenEventProc = pChannelOpenEventProc;
|
||||||
*pOpenHandle = pChannelOpenData->OpenHandle;
|
*pOpenHandle = pChannelOpenData->OpenHandle;
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,7 +807,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelCloseEx(LPVOID pInitHandle, DWORD op
|
||||||
return CHANNEL_RC_NOT_OPEN;
|
return CHANNEL_RC_NOT_OPEN;
|
||||||
|
|
||||||
pChannelOpenData->flags = 0;
|
pChannelOpenData->flags = 0;
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,7 +814,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelClose(DWORD openHandle)
|
||||||
{
|
{
|
||||||
rdpChannels* channels;
|
rdpChannels* channels;
|
||||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||||
|
|
||||||
channels = (rdpChannels*) freerdp_channel_get_open_handle_data(&g_ChannelHandles, openHandle);
|
channels = (rdpChannels*) freerdp_channel_get_open_handle_data(&g_ChannelHandles, openHandle);
|
||||||
|
|
||||||
if (!channels)
|
if (!channels)
|
||||||
|
@ -837,7 +828,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelClose(DWORD openHandle)
|
||||||
return CHANNEL_RC_NOT_OPEN;
|
return CHANNEL_RC_NOT_OPEN;
|
||||||
|
|
||||||
pChannelOpenData->flags = 0;
|
pChannelOpenData->flags = 0;
|
||||||
|
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +889,8 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle,
|
||||||
{
|
{
|
||||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||||
CHANNEL_OPEN_EVENT* pChannelOpenEvent;
|
CHANNEL_OPEN_EVENT* pChannelOpenEvent;
|
||||||
rdpChannels* channels = (rdpChannels*) freerdp_channel_get_open_handle_data(&g_ChannelHandles, openHandle);
|
rdpChannels* channels = (rdpChannels*) freerdp_channel_get_open_handle_data(&g_ChannelHandles,
|
||||||
|
openHandle);
|
||||||
|
|
||||||
if (!channels)
|
if (!channels)
|
||||||
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
|
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
|
||||||
|
@ -1044,11 +1035,9 @@ int freerdp_channels_client_load_ex(rdpChannels* channels, rdpSettings* settings
|
||||||
|
|
||||||
pChannelClientData = &channels->clientDataList[channels->clientDataCount];
|
pChannelClientData = &channels->clientDataList[channels->clientDataCount];
|
||||||
pChannelClientData->entryEx = entryEx;
|
pChannelClientData->entryEx = entryEx;
|
||||||
|
|
||||||
pChannelInitData = &(channels->initDataList[channels->initDataCount++]);
|
pChannelInitData = &(channels->initDataList[channels->initDataCount++]);
|
||||||
pInitHandle = pChannelInitData;
|
pInitHandle = pChannelInitData;
|
||||||
pChannelInitData->channels = channels;
|
pChannelInitData->channels = channels;
|
||||||
|
|
||||||
ZeroMemory(&EntryPointsEx, sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
ZeroMemory(&EntryPointsEx, sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX));
|
||||||
EntryPointsEx.cbSize = sizeof(EntryPointsEx);
|
EntryPointsEx.cbSize = sizeof(EntryPointsEx);
|
||||||
EntryPointsEx.protocolVersion = VIRTUAL_CHANNEL_VERSION_WIN2000;
|
EntryPointsEx.protocolVersion = VIRTUAL_CHANNEL_VERSION_WIN2000;
|
||||||
|
@ -1057,13 +1046,11 @@ int freerdp_channels_client_load_ex(rdpChannels* channels, rdpSettings* settings
|
||||||
EntryPointsEx.pVirtualChannelCloseEx = FreeRDP_VirtualChannelCloseEx;
|
EntryPointsEx.pVirtualChannelCloseEx = FreeRDP_VirtualChannelCloseEx;
|
||||||
EntryPointsEx.pVirtualChannelWriteEx = FreeRDP_VirtualChannelWriteEx;
|
EntryPointsEx.pVirtualChannelWriteEx = FreeRDP_VirtualChannelWriteEx;
|
||||||
EntryPointsEx.MagicNumber = FREERDP_CHANNEL_MAGIC_NUMBER;
|
EntryPointsEx.MagicNumber = FREERDP_CHANNEL_MAGIC_NUMBER;
|
||||||
EntryPointsEx.ppInterface = &g_pInterface;
|
|
||||||
EntryPointsEx.pExtendedData = data;
|
EntryPointsEx.pExtendedData = data;
|
||||||
EntryPointsEx.context = ((freerdp*) settings->instance)->context;
|
EntryPointsEx.context = ((freerdp*) settings->instance)->context;
|
||||||
/* enable VirtualChannelInit */
|
/* enable VirtualChannelInit */
|
||||||
channels->can_call_init = TRUE;
|
channels->can_call_init = TRUE;
|
||||||
EnterCriticalSection(&channels->channelsLock);
|
EnterCriticalSection(&channels->channelsLock);
|
||||||
g_pInterface = NULL;
|
|
||||||
status = pChannelClientData->entryEx((PCHANNEL_ENTRY_POINTS_EX) &EntryPointsEx, pInitHandle);
|
status = pChannelClientData->entryEx((PCHANNEL_ENTRY_POINTS_EX) &EntryPointsEx, pInitHandle);
|
||||||
LeaveCriticalSection(&channels->channelsLock);
|
LeaveCriticalSection(&channels->channelsLock);
|
||||||
/* disable MyVirtualChannelInit */
|
/* disable MyVirtualChannelInit */
|
||||||
|
@ -1082,10 +1069,10 @@ int freerdp_channels_client_load_ex(rdpChannels* channels, rdpSettings* settings
|
||||||
* this is called when processing the command line parameters
|
* this is called when processing the command line parameters
|
||||||
* called only from main thread
|
* called only from main thread
|
||||||
*/
|
*/
|
||||||
int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, const char* name, void* data)
|
int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, const char* name,
|
||||||
|
void* data)
|
||||||
{
|
{
|
||||||
PVIRTUALCHANNELENTRY entry;
|
PVIRTUALCHANNELENTRY entry;
|
||||||
|
|
||||||
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
|
|
@ -110,6 +110,8 @@ struct rdp_channels
|
||||||
|
|
||||||
DrdynvcClientContext* drdynvc;
|
DrdynvcClientContext* drdynvc;
|
||||||
CRITICAL_SECTION channelsLock;
|
CRITICAL_SECTION channelsLock;
|
||||||
|
|
||||||
|
int openHandleSequence;
|
||||||
wHashTable* openHandles;
|
wHashTable* openHandles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ typedef UINT VCAPITYPE VIRTUALCHANNELINIT(LPVOID* ppInitHandle,
|
||||||
|
|
||||||
typedef VIRTUALCHANNELINIT* PVIRTUALCHANNELINIT;
|
typedef VIRTUALCHANNELINIT* PVIRTUALCHANNELINIT;
|
||||||
|
|
||||||
typedef UINT VCAPITYPE VIRTUALCHANNELINITEX(LPVOID lpUserParam,
|
typedef UINT VCAPITYPE VIRTUALCHANNELINITEX(LPVOID lpUserParam, LPVOID clientContext,
|
||||||
LPVOID pInitHandle, PCHANNEL_DEF pChannel,
|
LPVOID pInitHandle, PCHANNEL_DEF pChannel,
|
||||||
INT channelCount, ULONG versionRequested,
|
INT channelCount, ULONG versionRequested,
|
||||||
PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx);
|
PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx);
|
||||||
|
|
Loading…
Reference in New Issue