Merge pull request #3668 from bmiklautz/channel_ex
Improve and fix extended channel handling
This commit is contained in:
commit
90877f5acb
@ -305,7 +305,12 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName,
|
||||
/* channel add-in */
|
||||
|
||||
if (dwFlags & FREERDP_ADDIN_CHANNEL_STATIC)
|
||||
entry = freerdp_load_dynamic_addin(pszFileName, NULL, "VirtualChannelEntry");
|
||||
{
|
||||
if (dwFlags & FREERDP_ADDIN_CHANNEL_ENTRYEX)
|
||||
entry = freerdp_load_dynamic_addin(pszFileName, NULL, "VirtualChannelEntryEx");
|
||||
else
|
||||
entry = freerdp_load_dynamic_addin(pszFileName, NULL, "VirtualChannelEntry");
|
||||
}
|
||||
else if (dwFlags & FREERDP_ADDIN_CHANNEL_DYNAMIC)
|
||||
entry = freerdp_load_dynamic_addin(pszFileName, NULL, "DVCPluginEntry");
|
||||
else if (dwFlags & FREERDP_ADDIN_CHANNEL_DEVICE)
|
||||
@ -335,9 +340,6 @@ PVIRTUALCHANNELENTRY freerdp_load_channel_addin_entry(LPCSTR pszName,
|
||||
if (freerdp_load_static_channel_addin_entry)
|
||||
entry = freerdp_load_static_channel_addin_entry(pszName, pszSubsystem, pszType, dwFlags);
|
||||
|
||||
if (dwFlags & FREERDP_ADDIN_CHANNEL_ENTRYEX)
|
||||
return entry; /* don't warn, don't try dynamic entries for VirtualChannelEntryEx */
|
||||
|
||||
if (!entry)
|
||||
entry = freerdp_load_dynamic_channel_addin_entry(pszName, pszSubsystem, pszType, dwFlags);
|
||||
|
||||
|
@ -34,9 +34,8 @@
|
||||
static WINPR_TLS void* g_pInterface = NULL;
|
||||
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 rdpChannelHandles g_ChannelHandles = { NULL, NULL };
|
||||
static volatile LONG g_OpenHandleSeq = 1; /* use global counter to ensure uniqueness across channel manager instances */
|
||||
static WINPR_TLS rdpChannelHandles g_ChannelHandles = { NULL, NULL };
|
||||
|
||||
static CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(
|
||||
rdpChannels* channels, const char* name)
|
||||
@ -600,7 +599,7 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(LPVOID lpUserParam, LPVOID cl
|
||||
{
|
||||
pChannelDef = &pChannel[index];
|
||||
pChannelOpenData = &channels->openDataList[channels->openDataCount];
|
||||
pChannelOpenData->OpenHandle = ++channels->openHandleSequence;
|
||||
pChannelOpenData->OpenHandle = InterlockedIncrement(&g_OpenHandleSeq);
|
||||
pChannelOpenData->channels = channels;
|
||||
pChannelOpenData->lpUserParam = lpUserParam;
|
||||
HashTable_Add(channels->openHandles, (void*)(UINT_PTR) pChannelOpenData->OpenHandle,
|
||||
@ -630,7 +629,6 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle,
|
||||
{
|
||||
INT index;
|
||||
void* pInterface;
|
||||
DWORD OpenHandle;
|
||||
CHANNEL_DEF* channel;
|
||||
rdpSettings* settings;
|
||||
PCHANNEL_DEF pChannelDef;
|
||||
@ -689,11 +687,10 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle,
|
||||
{
|
||||
pChannelDef = &pChannel[index];
|
||||
pChannelOpenData = &channels->openDataList[channels->openDataCount];
|
||||
OpenHandle = g_OpenHandleSeq++;
|
||||
pChannelOpenData->OpenHandle = OpenHandle;
|
||||
pChannelOpenData->OpenHandle = InterlockedIncrement(&g_OpenHandleSeq);
|
||||
pChannelOpenData->channels = channels;
|
||||
freerdp_channel_add_open_handle_data(&g_ChannelHandles, OpenHandle, (void*) channels);
|
||||
HashTable_Add(channels->openHandles, (void*)(UINT_PTR) OpenHandle,
|
||||
freerdp_channel_add_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle, (void*) channels);
|
||||
HashTable_Add(channels->openHandles, (void*)(UINT_PTR) pChannelOpenData->OpenHandle,
|
||||
(void*) pChannelOpenData);
|
||||
pChannelOpenData->flags = 1; /* init */
|
||||
strncpy(pChannelOpenData->name, pChannelDef->name, CHANNEL_NAME_LEN);
|
||||
|
@ -111,7 +111,6 @@ struct rdp_channels
|
||||
DrdynvcClientContext* drdynvc;
|
||||
CRITICAL_SECTION channelsLock;
|
||||
|
||||
int openHandleSequence;
|
||||
wHashTable* openHandles;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user