Skip to content

Commit

Permalink
Merge branch 'master' of github.com:FreeRDP/FreeRDP
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed May 21, 2015
2 parents c64be49 + e6891b7 commit 5526348
Show file tree
Hide file tree
Showing 64 changed files with 1,417 additions and 461 deletions.
37 changes: 29 additions & 8 deletions channels/encomsp/client/encomsp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,16 @@ static void encomsp_process_connect(encomspPlugin* encomsp)
static wListDictionary* g_InitHandles = NULL;
static wListDictionary* g_OpenHandles = NULL;

void encomsp_add_init_handle_data(void* pInitHandle, void* pUserData)
BOOL encomsp_add_init_handle_data(void* pInitHandle, void* pUserData)
{
if (!g_InitHandles)
{
g_InitHandles = ListDictionary_New(TRUE);
if (!g_InitHandles)
return FALSE;
}

ListDictionary_Add(g_InitHandles, pInitHandle, pUserData);
return ListDictionary_Add(g_InitHandles, pInitHandle, pUserData);
}

void* encomsp_get_init_handle_data(void* pInitHandle)
Expand All @@ -687,14 +691,18 @@ void encomsp_remove_init_handle_data(void* pInitHandle)
}
}

void encomsp_add_open_handle_data(DWORD openHandle, void* pUserData)
BOOL encomsp_add_open_handle_data(DWORD openHandle, void* pUserData)
{
void* pOpenHandle = (void*) (size_t) openHandle;

if (!g_OpenHandles)
{
g_OpenHandles = ListDictionary_New(TRUE);
if (!g_OpenHandles)
return FALSE;
}

ListDictionary_Add(g_OpenHandles, pOpenHandle, pUserData);
return ListDictionary_Add(g_OpenHandles, pOpenHandle, pUserData);
}

void* encomsp_get_open_handle_data(DWORD openHandle)
Expand Down Expand Up @@ -843,7 +851,11 @@ static void encomsp_virtual_channel_event_connected(encomspPlugin* encomsp, LPVO
status = encomsp->channelEntryPoints.pVirtualChannelOpen(encomsp->InitHandle,
&encomsp->OpenHandle, encomsp->channelDef.name, encomsp_virtual_channel_open_event);

encomsp_add_open_handle_data(encomsp->OpenHandle, encomsp);
if (!encomsp_add_open_handle_data(encomsp->OpenHandle, encomsp))
{
WLog_ERR(TAG, "%s: unable to register open handle", __FUNCTION__);
return;
}

if (status != CHANNEL_RC_OK)
{
Expand All @@ -853,9 +865,20 @@ static void encomsp_virtual_channel_event_connected(encomspPlugin* encomsp, LPVO
}

encomsp->queue = MessageQueue_New(NULL);
if (!encomsp->queue)
{
WLog_ERR(TAG, "%s: unable to create message queue", __FUNCTION__);
return;
}

encomsp->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) encomsp_virtual_channel_client_thread, (void*) encomsp, 0, NULL);
if (!encomsp->thread)
{
WLog_ERR(TAG, "%s: unable to create thread", __FUNCTION__);
return;
}

}

static void encomsp_virtual_channel_event_disconnected(encomspPlugin* encomsp)
Expand Down Expand Up @@ -980,7 +1003,5 @@ BOOL VCAPITYPE VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
encomsp->channelEntryPoints.pInterface = *(encomsp->channelEntryPoints.ppInterface);
encomsp->channelEntryPoints.ppInterface = &(encomsp->channelEntryPoints.pInterface);

encomsp_add_init_handle_data(encomsp->InitHandle, (void*) encomsp);

return 1;
return encomsp_add_init_handle_data(encomsp->InitHandle, (void*) encomsp);
}
15 changes: 14 additions & 1 deletion channels/parallel/client/parallel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
if (name[0] && path[0])
{
parallel = (PARALLEL_DEVICE*) calloc(1, sizeof(PARALLEL_DEVICE));

if (!parallel)
return -1;

Expand All @@ -318,18 +317,32 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)

length = strlen(name);
parallel->device.data = Stream_New(NULL, length + 1);
if (!parallel->device.data)
goto error_device_data;

for (i = 0; i <= length; i++)
Stream_Write_UINT8(parallel->device.data, name[i] < 0 ? '_' : name[i]);

parallel->path = path;

parallel->queue = MessageQueue_New(NULL);
if (!parallel->queue)
goto error_queue;

pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) parallel);

parallel->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) parallel_thread_func, (void*) parallel, 0, NULL);
if (!parallel->thread)
goto error_thread;
}

return 0;

error_thread:
MessageQueue_Free(parallel->queue);
error_queue:
Stream_Free(parallel->device.data, TRUE);
error_device_data:
free(parallel);
return -1;
}
Loading

0 comments on commit 5526348

Please sign in to comment.