Moved channel init code to core library.

This commit is contained in:
Armin Novak 2016-08-09 16:48:02 +02:00
parent dadc5262ae
commit d35823cf69
12 changed files with 61 additions and 194 deletions

View File

@ -401,10 +401,6 @@ static BOOL android_post_connect(freerdp* instance)
static void android_post_disconnect(freerdp* instance)
{
freerdp_callback("OnDisconnecting", "(I)V", instance);
if (instance && instance->context)
freerdp_channels_disconnect(instance->context->channels, instance);
gdi_free(instance);
}
@ -721,14 +717,8 @@ static BOOL android_client_new(freerdp* instance, rdpContext* context)
if (!instance || !context)
return FALSE;
if (!(context->channels = freerdp_channels_new(instance)))
return FALSE;
if (!android_event_queue_init(instance))
{
freerdp_channels_free(context->channels);
return FALSE;
}
instance->PreConnect = android_pre_connect;
instance->PostConnect = android_post_connect;
@ -747,13 +737,6 @@ static void android_client_free(freerdp* instance, rdpContext* context)
if (!context)
return;
if (context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
android_event_queue_uninit(instance);
}

View File

@ -51,20 +51,11 @@ struct thread_data
BOOL df_context_new(freerdp* instance, rdpContext* context)
{
if (!(context->channels = freerdp_channels_new(instance)))
return FALSE;
return TRUE;
}
void df_context_free(freerdp* instance, rdpContext* context)
{
if (context && context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
}
void df_begin_paint(rdpContext* context)
@ -402,13 +393,9 @@ int dfreerdp_run(freerdp* instance)
df_process_channel_event(channels, instance);
}
freerdp_channels_disconnect(channels, instance);
freerdp_disconnect(instance);
freerdp_channels_close(channels, instance);
freerdp_channels_free(channels);
df_free(dfi);
gdi_free(instance);
freerdp_disconnect(instance);
freerdp_free(instance);
return 0;
}

View File

@ -89,7 +89,6 @@ static BOOL mfreerdp_client_new(freerdp* instance, rdpContext* context)
context->instance->PreConnect = mac_pre_connect;
context->instance->PostConnect = mac_post_connect;
context->instance->Authenticate = mac_authenticate;
context->channels = freerdp_channels_new(instance);
settings = instance->settings;
settings->AsyncTransport = TRUE;
settings->AsyncUpdate = TRUE;

View File

@ -49,20 +49,11 @@ typedef struct tf_context tfContext;
static BOOL tf_context_new(freerdp* instance, rdpContext* context)
{
if (!(context->channels = freerdp_channels_new(instance)))
return FALSE;
return TRUE;
}
static void tf_context_free(freerdp* instance, rdpContext* context)
{
if (context && context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
}
static BOOL tf_begin_paint(rdpContext* context)

View File

@ -339,7 +339,6 @@ static int wlfreerdp_run(freerdp* instance)
//}
}
freerdp_channels_disconnect(instance->context->channels, instance);
freerdp_disconnect(instance);
return 0;
}
@ -366,9 +365,6 @@ static BOOL wlf_client_new(freerdp* instance, rdpContext* context)
if (!instance || !context)
return FALSE;
if (!(context->channels = freerdp_channels_new(instance)))
return FALSE;
instance->PreConnect = wl_pre_connect;
instance->PostConnect = wl_post_connect;
instance->PostDisconnect = wl_post_disconnect;
@ -399,13 +395,6 @@ static void wlf_client_free(freerdp* instance, rdpContext* context)
if (!context)
return;
if (context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
if (wlf->display)
UwacCloseDisplay(&wlf->display);

View File

@ -784,8 +784,6 @@ static DWORD WINAPI wf_client_thread(LPVOID lpParam)
}
/* cleanup */
freerdp_channels_disconnect(channels, instance);
if (async_input)
{
wMessageQueue* input_queue;
@ -793,12 +791,14 @@ static DWORD WINAPI wf_client_thread(LPVOID lpParam)
if (MessageQueue_PostQuit(input_queue, 0))
WaitForSingleObject(input_thread, INFINITE);
CloseHandle(input_thread);
}
disconnect:
freerdp_disconnect(instance);
if (async_input)
CloseHandle(input_thread);
WLog_DBG(TAG, "Main thread exited.");
ExitThread(0);
return 0;
@ -1018,9 +1018,6 @@ static BOOL wfreerdp_client_new(freerdp* instance, rdpContext* context)
if (!(wfreerdp_client_global_init()))
return FALSE;
if (!(context->channels = freerdp_channels_new(instance)))
return FALSE;
instance->PreConnect = wf_pre_connect;
instance->PostConnect = wf_post_connect;
instance->Authenticate = wf_authenticate;
@ -1034,13 +1031,6 @@ static void wfreerdp_client_free(freerdp* instance, rdpContext* context)
{
if (!context)
return;
if (context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
}
static int wfreerdp_client_start(rdpContext* context)

View File

@ -1298,7 +1298,6 @@ static void xf_post_disconnect(freerdp* instance)
context = instance->context;
xfc = (xfContext*) context;
freerdp_channels_disconnect(context->channels, instance);
gdi_free(instance);
if (xfc->clipboard)
@ -1753,14 +1752,9 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
xfContext* xfc = (xfContext*) instance->context;
assert(context);
assert(xfc);
assert(!context->channels);
assert(!xfc->display);
assert(!xfc->mutex);
assert(!xfc->x11event);
if (!(context->channels = freerdp_channels_new(instance)))
goto fail_channels_new;
instance->PreConnect = xf_pre_connect;
instance->PostConnect = xf_post_connect;
instance->PostDisconnect = xf_post_disconnect;
@ -1898,9 +1892,6 @@ fail_create_mutex:
XCloseDisplay(xfc->display);
xfc->display = NULL;
fail_open_display:
freerdp_channels_free(context->channels);
context->channels = NULL;
fail_channels_new:
return FALSE;
}
@ -1911,13 +1902,6 @@ static void xfreerdp_client_free(freerdp* instance, rdpContext* context)
if (!context)
return;
if (context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
if (xfc->display)
{
XCloseDisplay(xfc->display);

View File

@ -280,9 +280,6 @@ static BOOL ios_post_connect(freerdp* instance)
static void ios_post_disconnect(freerdp* instance)
{
if (instance && instance->context)
freerdp_channels_disconnect(instance->context->channels, instance);
gdi_free(instance);
}
@ -435,9 +432,6 @@ static BOOL ios_client_new(freerdp* instance, rdpContext* context)
if (!instance || !context)
return FALSE;
if (!(context->channels = freerdp_channels_new(instance)))
return FALSE;
if ((ctx->mfi = calloc(1, sizeof(mfInfo))) == NULL)
return FALSE;
@ -469,13 +463,6 @@ static void ios_client_free(freerdp* instance, rdpContext* context)
mfi = ((mfContext*) context)->mfi;
if (context->channels)
{
freerdp_channels_close(context->channels, instance);
freerdp_channels_free(context->channels);
context->channels = NULL;
}
ios_events_free_pipe(mfi);
free(mfi);
}

View File

@ -32,8 +32,6 @@
extern "C" {
#endif
FREERDP_API rdpChannels* freerdp_channels_new(freerdp* instance);
FREERDP_API void freerdp_channels_free(rdpChannels* channels);
FREERDP_API int freerdp_channels_client_load(rdpChannels* channels,
rdpSettings* settings,
PVIRTUALCHANNELENTRY entry, void* data);
@ -44,15 +42,11 @@ FREERDP_API UINT freerdp_channels_pre_connect(rdpChannels* channels,
freerdp* instance);
FREERDP_API UINT freerdp_channels_post_connect(rdpChannels* channels,
freerdp* instance);
FREERDP_API UINT freerdp_channels_disconnect(rdpChannels* channels,
freerdp* instance);
FREERDP_API BOOL freerdp_channels_get_fds(rdpChannels* channels,
freerdp* instance, void** read_fds,
int* read_count, void** write_fds, int* write_count);
FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels,
freerdp* instance);
FREERDP_API void freerdp_channels_close(rdpChannels* channels,
freerdp* instance);
FREERDP_API void* freerdp_channels_get_static_channel_interface(
rdpChannels* channels, const char* name);

View File

@ -108,4 +108,11 @@ struct rdp_channels
wHashTable* openHandles;
};
rdpChannels* freerdp_channels_new(freerdp* instance);
UINT freerdp_channels_disconnect(rdpChannels* channels,
freerdp* instance);
void freerdp_channels_close(rdpChannels* channels,
freerdp* instance);
void freerdp_channels_free(rdpChannels* channels);
#endif /* FREERDP_CORE_CLIENT_H */

View File

@ -146,7 +146,7 @@ BOOL freerdp_connect(freerdp* instance)
if (instance->settings->DumpRemoteFx)
{
instance->update->pcap_rfx = pcap_open(instance->settings->DumpRemoteFxFile,
TRUE);
TRUE);
if (instance->update->pcap_rfx)
instance->update->dump_rfx = TRUE;
@ -209,7 +209,7 @@ BOOL freerdp_connect(freerdp* instance)
if (rdp->errorInfo == ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES)
freerdp_set_last_error(instance->context,
FREERDP_ERROR_INSUFFICIENT_PRIVILEGES);
FREERDP_ERROR_INSUFFICIENT_PRIVILEGES);
SetEvent(rdp->transport->connectedEvent);
freerdp_connect_finally:
@ -228,7 +228,7 @@ BOOL freerdp_abort_connect(freerdp* instance)
}
BOOL freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds,
int* wcount)
int* wcount)
{
rdpRdp* rdp = instance->context->rdp;
transport_get_fds(rdp->transport, rfds, rcount);
@ -267,7 +267,7 @@ BOOL freerdp_check_fds(freerdp* instance)
}
DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events,
DWORD count)
DWORD count)
{
DWORD nCount = 0;
nCount += transport_get_event_handles(context->rdp->transport, events, count);
@ -343,7 +343,7 @@ HANDLE freerdp_get_message_queue_event_handle(freerdp* instance, DWORD id)
}
int freerdp_message_queue_process_message(freerdp* instance, DWORD id,
wMessage* message)
wMessage* message)
{
int status = -1;
@ -380,18 +380,21 @@ int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id)
}
static int freerdp_send_channel_data(freerdp* instance, UINT16 channelId,
BYTE* data, int size)
BYTE* data, int size)
{
return rdp_send_channel_data(instance->context->rdp, channelId, data, size);
}
BOOL freerdp_disconnect(freerdp* instance)
{
BOOL rc = TRUE;
rdpRdp* rdp;
rdp = instance->context->rdp;
rdp_client_disconnect(rdp);
update_post_disconnect(instance->update);
IFCALL(instance->PostDisconnect, instance);
if (freerdp_channels_disconnect(instance->context->channels, instance) != CHANNEL_RC_OK)
rc = FALSE;
if (instance->update->pcap_rfx)
{
@ -401,7 +404,7 @@ BOOL freerdp_disconnect(freerdp* instance)
}
codecs_free(instance->context->codecs);
return TRUE;
return rc;
}
BOOL freerdp_reconnect(freerdp* instance)
@ -526,19 +529,19 @@ BOOL freerdp_context_new(freerdp* instance)
context->pubSub = PubSub_New(TRUE);
if (!context->pubSub)
goto out_error_pubsub;
goto fail;
PubSub_AddEventTypes(context->pubSub, FreeRDP_Events,
sizeof(FreeRDP_Events) / sizeof(wEventType));
sizeof(FreeRDP_Events) / sizeof(wEventType));
context->metrics = metrics_new(context);
if (!context->metrics)
goto out_error_metrics_new;
goto fail;
rdp = rdp_new(context);
if (!rdp)
goto out_error_rdp_new;
goto fail;
instance->input = rdp->input;
instance->update = rdp->update;
@ -547,7 +550,7 @@ BOOL freerdp_context_new(freerdp* instance)
context->graphics = graphics_new(context);
if (!context->graphics)
goto out_error_graphics_new;
goto fail;
context->rdp = rdp;
context->input = instance->input;
@ -565,41 +568,31 @@ BOOL freerdp_context_new(freerdp* instance)
if (!(context->errorDescription = calloc(1, 500)))
{
WLog_ERR(TAG, "calloc failed!");
goto out_error_description;
goto fail;
}
if (!(context->channelErrorEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
WLog_ERR(TAG, "CreateEvent failed!");
goto out_error_create_event;
goto fail;
}
update_register_client_callbacks(rdp->update);
instance->context->abortEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (!instance->context->abortEvent)
goto out_error_abort_event;
goto fail;
if (!(context->channels = freerdp_channels_new(instance)))
goto fail;
IFCALLRET(instance->ContextNew, ret, instance, instance->context);
if (ret)
return TRUE;
CloseHandle(context->abortEvent);
out_error_abort_event:
CloseHandle(context->channelErrorEvent);
out_error_create_event:
free(context->errorDescription);
out_error_description:
graphics_free(context->graphics);
out_error_graphics_new:
rdp_free(rdp);
out_error_rdp_new:
metrics_free(context->metrics);
out_error_metrics_new:
PubSub_Free(context->pubSub);
out_error_pubsub:
free(instance->context);
fail:
freerdp_context_free(instance);
return FALSE;
}
@ -630,6 +623,8 @@ void freerdp_context_free(freerdp* instance)
free(instance->context->errorDescription);
CloseHandle(instance->context->abortEvent);
instance->context->abortEvent = NULL;
freerdp_channels_close(instance->context->channels, instance);
freerdp_channels_free(instance->context->channels);
free(instance->context);
instance->context = NULL;
}
@ -712,7 +707,7 @@ void freerdp_set_last_error(rdpContext* context, UINT32 lastError)
{
if (lastError)
WLog_ERR(TAG, "freerdp_set_last_error %s [0x%04X]",
freerdp_get_last_error_name(lastError), lastError);
freerdp_get_last_error_name(lastError), lastError);
context->LastError = lastError;
@ -818,7 +813,7 @@ BOOL checkChannelErrorEvent(rdpContext* context)
if (WaitForSingleObject(context->channelErrorEvent, 0) == WAIT_OBJECT_0)
{
WLog_ERR(TAG, "%s. Error was %lu", context->errorDescription,
context->channelErrorNum);
context->channelErrorNum);
return FALSE;
}

View File

@ -28,17 +28,17 @@
#define TAG SERVER_TAG("shadow.win")
void shw_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
void shw_OnChannelConnectedEventHandler(rdpContext* context,
ChannelConnectedEventArgs* e)
{
shwContext* shw = (shwContext*) context;
WLog_INFO(TAG, "OnChannelConnected: %s", e->name);
}
void shw_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnectedEventArgs* e)
void shw_OnChannelDisconnectedEventHandler(rdpContext* context,
ChannelDisconnectedEventArgs* e)
{
shwContext* shw = (shwContext*) context;
WLog_INFO(TAG, "OnChannelDisconnected: %s", e->name);
}
@ -46,9 +46,7 @@ BOOL shw_begin_paint(rdpContext* context)
{
shwContext* shw;
rdpGdi* gdi = context->gdi;
shw = (shwContext*) context;
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->ninvalid = 0;
return TRUE;
@ -89,30 +87,34 @@ BOOL shw_desktop_resize(rdpContext* context)
return TRUE;
}
BOOL shw_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surfaceFrameMarker)
BOOL shw_surface_frame_marker(rdpContext* context,
SURFACE_FRAME_MARKER* surfaceFrameMarker)
{
shwContext* shw = (shwContext*) context;
return TRUE;
}
BOOL shw_authenticate(freerdp* instance, char** username, char** password, char** domain)
BOOL shw_authenticate(freerdp* instance, char** username, char** password,
char** domain)
{
return TRUE;
}
static DWORD shw_verify_certificate(freerdp* instance, const char* common_name,
const char* subject, const char* issuer,
const char* fingerprint, BOOL host_mismatch)
const char* subject, const char* issuer,
const char* fingerprint, BOOL host_mismatch)
{
return 1;
}
int shw_verify_x509_certificate(freerdp* instance, BYTE* data, int length, const char* hostname, int port, DWORD flags)
int shw_verify_x509_certificate(freerdp* instance, BYTE* data, int length,
const char* hostname, int port, DWORD flags)
{
return 1;
}
void shw_OnConnectionResultEventHandler(rdpContext* context, ConnectionResultEventArgs* e)
void shw_OnConnectionResultEventHandler(rdpContext* context,
ConnectionResultEventArgs* e)
{
shwContext* shw = (shwContext*) context;
WLog_INFO(TAG, "OnConnectionResult: %d", e->result);
@ -122,17 +124,13 @@ BOOL shw_pre_connect(freerdp* instance)
{
shwContext* shw;
rdpContext* context = instance->context;
shw = (shwContext*) context;
PubSub_SubscribeConnectionResult(context->pubSub,
(pConnectionResultEventHandler) shw_OnConnectionResultEventHandler);
(pConnectionResultEventHandler) shw_OnConnectionResultEventHandler);
PubSub_SubscribeChannelConnected(context->pubSub,
(pChannelConnectedEventHandler) shw_OnChannelConnectedEventHandler);
(pChannelConnectedEventHandler) shw_OnChannelConnectedEventHandler);
PubSub_SubscribeChannelDisconnected(context->pubSub,
(pChannelDisconnectedEventHandler) shw_OnChannelDisconnectedEventHandler);
(pChannelDisconnectedEventHandler) shw_OnChannelDisconnectedEventHandler);
if (!freerdp_client_load_addins(context->channels, instance->settings))
return FALSE;
@ -148,7 +146,6 @@ BOOL shw_post_connect(freerdp* instance)
rdpGdi* gdi;
shwContext* shw;
rdpSettings* settings;
shw = (shwContext*) instance->context;
settings = instance->settings;
@ -156,7 +153,6 @@ BOOL shw_post_connect(freerdp* instance)
return FALSE;
gdi = instance->context->gdi;
instance->update->BeginPaint = shw_begin_paint;
instance->update->EndPaint = shw_end_paint;
instance->update->DesktopResize = shw_desktop_resize;
@ -179,15 +175,11 @@ void* shw_client_thread(void* arg)
rdpContext* context;
rdpChannels* channels;
freerdp* instance = (freerdp*) arg;
ZeroMemory(rfds, sizeof(rfds));
ZeroMemory(wfds, sizeof(wfds));
context = (rdpContext*) instance->context;
shw = (shwContext*) context;
bSuccess = freerdp_connect(instance);
WLog_INFO(TAG, "freerdp_connect: %d", bSuccess);
if (!bSuccess)
@ -216,14 +208,15 @@ void* shw_client_thread(void* arg)
}
fds_count = 0;
for (index = 0; index < rcount; index++)
fds[fds_count++] = rfds[index];
for (index = 0; index < wcount; index++)
fds[fds_count++] = wfds[index];
if (MsgWaitForMultipleObjects(fds_count, fds, FALSE, 1000, QS_ALLINPUT) == WAIT_FAILED)
if (MsgWaitForMultipleObjects(fds_count, fds, FALSE, 1000,
QS_ALLINPUT) == WAIT_FAILED)
{
WLog_ERR(TAG, "MsgWaitForMultipleObjects failure: 0x%08X", GetLastError());
break;
@ -235,7 +228,7 @@ void* shw_client_thread(void* arg)
break;
}
if (freerdp_shall_disconnect(instance))
if (freerdp_shall_disconnect(instance))
{
break;
}
@ -248,7 +241,6 @@ void* shw_client_thread(void* arg)
}
freerdp_free(instance);
ExitThread(0);
return NULL;
}
@ -264,19 +256,17 @@ BOOL shw_freerdp_client_global_init(void)
void shw_freerdp_client_global_uninit(void)
{
}
int shw_freerdp_client_start(rdpContext* context)
{
shwContext* shw;
freerdp* instance = context->instance;
shw = (shwContext*) context;
if (!(shw->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) shw_client_thread,
instance, 0, NULL)))
(LPTHREAD_START_ROUTINE) shw_client_thread,
instance, 0, NULL)))
{
WLog_ERR(TAG, "Failed to create thread");
return -1;
@ -288,9 +278,7 @@ int shw_freerdp_client_start(rdpContext* context)
int shw_freerdp_client_stop(rdpContext* context)
{
shwContext* shw = (shwContext*) context;
SetEvent(shw->StopEvent);
return 0;
}
@ -298,7 +286,6 @@ BOOL shw_freerdp_client_new(freerdp* instance, rdpContext* context)
{
shwContext* shw;
rdpSettings* settings;
shw = (shwContext*) instance->context;
if (!(shw->StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
@ -316,60 +303,47 @@ BOOL shw_freerdp_client_new(freerdp* instance, rdpContext* context)
instance->Authenticate = shw_authenticate;
instance->VerifyCertificate = shw_verify_certificate;
instance->VerifyX509Certificate = shw_verify_x509_certificate;
settings = instance->settings;
shw->settings = instance->context->settings;
settings->AsyncTransport = FALSE;
settings->AsyncChannels = FALSE;
settings->AsyncUpdate = FALSE;
settings->AsyncInput = FALSE;
settings->IgnoreCertificate = TRUE;
settings->ExternalCertificateManagement = TRUE;
settings->RdpSecurity = TRUE;
settings->TlsSecurity = TRUE;
settings->NlaSecurity = FALSE;
settings->BitmapCacheEnabled = FALSE;
settings->BitmapCacheV3Enabled = FALSE;
settings->OffscreenSupportLevel = FALSE;
settings->GlyphSupportLevel = GLYPH_SUPPORT_NONE;
settings->BrushSupportLevel = FALSE;
ZeroMemory(settings->OrderSupport, 32);
settings->FrameMarkerCommandEnabled = TRUE;
settings->SurfaceFrameMarkerEnabled = TRUE;
settings->AltSecFrameMarkerSupport = TRUE;
settings->ColorDepth = 32;
settings->NSCodec = TRUE;
settings->RemoteFxCodec = TRUE;
settings->FastPathInput = TRUE;
settings->FastPathOutput = TRUE;
settings->LargePointerFlag = TRUE;
settings->CompressionEnabled = FALSE;
settings->AutoReconnectionEnabled = FALSE;
settings->NetworkAutoDetect = FALSE;
settings->SupportHeartbeatPdu = FALSE;
settings->SupportMultitransport = FALSE;
settings->ConnectionType = CONNECTION_TYPE_LAN;
settings->AllowFontSmoothing = TRUE;
settings->AllowDesktopComposition = TRUE;
settings->DisableWallpaper = FALSE;
settings->DisableFullWindowDrag = TRUE;
settings->DisableMenuAnims = TRUE;
settings->DisableThemes = FALSE;
settings->DeviceRedirection = TRUE;
settings->RedirectClipboard = TRUE;
settings->SupportDynamicChannels = TRUE;
return TRUE;
}
@ -382,9 +356,7 @@ int shw_RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints)
{
pEntryPoints->Version = 1;
pEntryPoints->Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1);
pEntryPoints->settings = NULL;
pEntryPoints->ContextSize = sizeof(shwContext);
pEntryPoints->GlobalInit = shw_freerdp_client_global_init;
pEntryPoints->GlobalUninit = shw_freerdp_client_global_uninit;
@ -392,7 +364,6 @@ int shw_RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints)
pEntryPoints->ClientFree = shw_freerdp_client_free;
pEntryPoints->ClientStart = shw_freerdp_client_start;
pEntryPoints->ClientStop = shw_freerdp_client_stop;
return 0;
}
@ -400,11 +371,9 @@ int win_shadow_rdp_init(winShadowSubsystem* subsystem)
{
rdpContext* context;
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
ZeroMemory(&clientEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS));
clientEntryPoints.Size = sizeof(RDP_CLIENT_ENTRY_POINTS);
clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;
shw_RdpClientEntry(&clientEntryPoints);
if (!(subsystem->RdpUpdateEnterEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
@ -419,15 +388,12 @@ int win_shadow_rdp_init(winShadowSubsystem* subsystem)
subsystem->shw = (shwContext*) context;
subsystem->shw->settings = context->settings;
subsystem->shw->subsystem = subsystem;
return 1;
fail_context:
CloseHandle(subsystem->RdpUpdateLeaveEvent);
fail_leave_event:
CloseHandle(subsystem->RdpUpdateEnterEvent);
fail_enter_event:
return -1;
}
@ -436,9 +402,7 @@ int win_shadow_rdp_start(winShadowSubsystem* subsystem)
int status;
shwContext* shw = subsystem->shw;
rdpContext* context = (rdpContext*) shw;
status = freerdp_client_start(context);
return status;
}
@ -447,15 +411,12 @@ int win_shadow_rdp_stop(winShadowSubsystem* subsystem)
int status;
shwContext* shw = subsystem->shw;
rdpContext* context = (rdpContext*) shw;
status = freerdp_client_stop(context);
return status;
}
int win_shadow_rdp_uninit(winShadowSubsystem* subsystem)
{
win_shadow_rdp_stop(subsystem);
return 1;
}