freerdp: fix core API bugs
This commit is contained in:
parent
3f25a5dea3
commit
208c9f844a
@ -40,10 +40,11 @@ struct thread_data
|
||||
};
|
||||
|
||||
|
||||
void android_context_new(freerdp* instance, rdpContext* context)
|
||||
int android_context_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
context->channels = freerdp_channels_new();
|
||||
android_event_queue_init(instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void android_context_free(freerdp* instance, rdpContext* context)
|
||||
@ -388,7 +389,7 @@ JNIEXPORT jint JNICALL jni_freerdp_new(JNIEnv *env, jclass cls)
|
||||
|
||||
|
||||
// create context
|
||||
instance->context_size = sizeof(androidContext);
|
||||
instance->ContextSize = sizeof(androidContext);
|
||||
instance->ContextNew = android_context_new;
|
||||
instance->ContextFree = android_context_free;
|
||||
freerdp_context_new(instance);
|
||||
|
@ -45,9 +45,10 @@ struct thread_data
|
||||
freerdp* instance;
|
||||
};
|
||||
|
||||
void df_context_new(freerdp* instance, rdpContext* context)
|
||||
int df_context_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
context->channels = freerdp_channels_new();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void df_context_free(freerdp* instance, rdpContext* context)
|
||||
@ -450,7 +451,7 @@ int main(int argc, char* argv[])
|
||||
instance->VerifyCertificate = df_verify_certificate;
|
||||
instance->ReceiveChannelData = df_receive_channel_data;
|
||||
|
||||
instance->context_size = sizeof(dfContext);
|
||||
instance->ContextSize = sizeof(dfContext);
|
||||
instance->ContextNew = df_context_new;
|
||||
instance->ContextFree = df_context_free;
|
||||
freerdp_context_new(instance);
|
||||
|
@ -186,7 +186,7 @@ const char* error_code_names[] =
|
||||
instance = freerdp_new();
|
||||
instance->PreConnect = mac_pre_connect;
|
||||
instance->PostConnect = mac_post_connect;
|
||||
instance->context_size = sizeof(struct mac_context);
|
||||
instance->ContextSize = sizeof(struct mac_context);
|
||||
instance->ContextNew = mac_context_new;
|
||||
instance->ContextFree = mac_context_free;
|
||||
instance->ReceiveChannelData = receive_channel_data;
|
||||
|
@ -110,7 +110,7 @@ rdpContext* freerdp_client_new(int argc, char** argv)
|
||||
// instance->LogonErrorInfo = mf_logon_error_info;
|
||||
// instance->ReceiveChannelData = mf_receive_channel_data;
|
||||
|
||||
instance->context_size = sizeof(mfContext);
|
||||
instance->ContextSize = sizeof(mfContext);
|
||||
instance->ContextNew = (pContextNew) mf_context_new;
|
||||
instance->ContextFree = (pContextFree) mf_context_free;
|
||||
freerdp_context_new(instance);
|
||||
@ -212,10 +212,11 @@ void freerdp_client_mouse_event(rdpContext* cfc, DWORD flags, int x, int y)
|
||||
input->MouseEvent(input, flags, x, y);
|
||||
}
|
||||
|
||||
void mf_context_new(freerdp* instance, cfContext* cfc)
|
||||
int mf_context_new(freerdp* instance, cfContext* cfc)
|
||||
{
|
||||
cfc->instance = instance;
|
||||
cfc->settings = instance->settings;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mf_context_free(freerdp* instance, cfContext* cfc)
|
||||
|
@ -69,9 +69,10 @@ struct thread_data
|
||||
freerdp* instance;
|
||||
};
|
||||
|
||||
void tf_context_new(freerdp* instance, rdpContext* context)
|
||||
int tf_context_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
context->channels = freerdp_channels_new();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tf_context_free(freerdp* instance, rdpContext* context)
|
||||
@ -314,7 +315,7 @@ int main(int argc, char* argv[])
|
||||
instance->PostConnect = tf_post_connect;
|
||||
instance->ReceiveChannelData = tf_receive_channel_data;
|
||||
|
||||
instance->context_size = sizeof(tfContext);
|
||||
instance->ContextSize = sizeof(tfContext);
|
||||
instance->ContextNew = tf_context_new;
|
||||
instance->ContextFree = tf_context_free;
|
||||
freerdp_context_new(instance);
|
||||
|
@ -72,7 +72,7 @@ void wf_wfi_free(wfInfo* wfi)
|
||||
free(wfi);
|
||||
}
|
||||
|
||||
void wf_context_new(freerdp* instance, rdpContext* context)
|
||||
int wf_context_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
wfInfo* wfi;
|
||||
|
||||
@ -85,6 +85,8 @@ void wf_context_new(freerdp* instance, rdpContext* context)
|
||||
|
||||
// Register callbacks
|
||||
instance->context->client->OnParamChange = wf_on_param_change;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wf_context_free(freerdp* instance, rdpContext* context)
|
||||
@ -838,7 +840,7 @@ wfInfo* freerdp_client_new(int argc, char** argv)
|
||||
instance->VerifyCertificate = wf_verify_certificate;
|
||||
instance->ReceiveChannelData = wf_receive_channel_data;
|
||||
|
||||
instance->context_size = sizeof(wfContext);
|
||||
instance->ContextSize = sizeof(wfContext);
|
||||
instance->ContextNew = wf_context_new;
|
||||
instance->ContextFree = wf_context_free;
|
||||
freerdp_context_new(instance);
|
||||
|
@ -32,22 +32,13 @@
|
||||
|
||||
#include "xfreerdp.h"
|
||||
|
||||
void client_context_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
context->channels = freerdp_channels_new();
|
||||
}
|
||||
|
||||
void client_context_free(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
xfContext* xfc;
|
||||
DWORD dwExitCode;
|
||||
freerdp* instance;
|
||||
rdpContext* context;
|
||||
rdpSettings* settings;
|
||||
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
|
||||
|
||||
ZeroMemory(&clientEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS));
|
||||
@ -59,18 +50,31 @@ int main(int argc, char* argv[])
|
||||
clientEntryPoints.GlobalInit();
|
||||
|
||||
instance = freerdp_new();
|
||||
instance->context_size = clientEntryPoints.ContextSize;
|
||||
instance->ContextNew = client_context_new;
|
||||
instance->ContextFree = client_context_free;
|
||||
instance->ContextSize = clientEntryPoints.ContextSize;
|
||||
instance->ContextNew = clientEntryPoints.ClientNew;
|
||||
instance->ContextFree = clientEntryPoints.ClientFree;
|
||||
freerdp_context_new(instance);
|
||||
|
||||
context = instance->context;
|
||||
settings = context->settings;
|
||||
xfc = (xfContext*) context;
|
||||
|
||||
context->argc = argc;
|
||||
context->argv = argv;
|
||||
if (freerdp_client_parse_command_line(context, argc, argv) < 0)
|
||||
{
|
||||
if (settings->ConnectionFile)
|
||||
{
|
||||
freerdp_client_parse_connection_file(context, settings->ConnectionFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings->ListMonitors)
|
||||
xf_list_monitors(xfc);
|
||||
|
||||
clientEntryPoints.ClientNew(context);
|
||||
freerdp_context_free(instance);
|
||||
freerdp_free(instance);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
clientEntryPoints.ClientStart(context);
|
||||
|
||||
@ -80,8 +84,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
clientEntryPoints.ClientStop(context);
|
||||
|
||||
clientEntryPoints.ClientFree(context);
|
||||
|
||||
clientEntryPoints.GlobalUninit();
|
||||
|
||||
return xf_exit_code_from_disconnect_reason(dwExitCode);
|
||||
|
@ -1036,10 +1036,13 @@ void xf_process_channel_event(rdpChannels* channels, freerdp* instance)
|
||||
|
||||
void xf_window_free(xfContext* xfc)
|
||||
{
|
||||
rdpContext* context = xfc->instance->context;
|
||||
rdpContext* context = (rdpContext*) xfc;
|
||||
|
||||
XFreeModifiermap(xfc->modifier_map);
|
||||
xfc->modifier_map = 0;
|
||||
if (xfc->modifier_map)
|
||||
{
|
||||
XFreeModifiermap(xfc->modifier_map);
|
||||
xfc->modifier_map = 0;
|
||||
}
|
||||
|
||||
if (xfc->gc)
|
||||
{
|
||||
@ -1078,11 +1081,14 @@ void xf_window_free(xfContext* xfc)
|
||||
xfc->image = NULL;
|
||||
}
|
||||
|
||||
if (context)
|
||||
if (context->cache)
|
||||
{
|
||||
cache_free(context->cache);
|
||||
context->cache = NULL;
|
||||
}
|
||||
|
||||
if (context->rail)
|
||||
{
|
||||
rail_free(context->rail);
|
||||
context->rail = NULL;
|
||||
}
|
||||
@ -1099,14 +1105,26 @@ void xf_window_free(xfContext* xfc)
|
||||
xfc->nsc_context = NULL;
|
||||
}
|
||||
|
||||
freerdp_clrconv_free(xfc->clrconv);
|
||||
xfc->clrconv = NULL;
|
||||
if (xfc->clrconv)
|
||||
{
|
||||
freerdp_clrconv_free(xfc->clrconv);
|
||||
xfc->clrconv = NULL;
|
||||
}
|
||||
|
||||
if (xfc->hdc)
|
||||
gdi_DeleteDC(xfc->hdc);
|
||||
|
||||
xf_tsmf_uninit(xfc);
|
||||
xf_cliprdr_uninit(xfc);
|
||||
if (xfc->xv_context)
|
||||
{
|
||||
xf_tsmf_uninit(xfc);
|
||||
xfc->xv_context = NULL;
|
||||
}
|
||||
|
||||
if (xfc->clipboard_context)
|
||||
{
|
||||
xf_cliprdr_uninit(xfc);
|
||||
xfc->clipboard_context = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void* xf_update_thread(void* arg)
|
||||
@ -1574,14 +1592,11 @@ void freerdp_client_reset_scale(rdpContext* context)
|
||||
xf_draw_screen_scaled(xfc);
|
||||
}
|
||||
|
||||
int freerdp_client_new(rdpContext* context)
|
||||
int freerdp_client_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
int status;
|
||||
xfContext* xfc;
|
||||
freerdp* instance;
|
||||
rdpSettings* settings;
|
||||
|
||||
instance = context->instance;
|
||||
xfc = (xfContext*) instance->context;
|
||||
|
||||
instance->PreConnect = xf_pre_connect;
|
||||
@ -1591,28 +1606,12 @@ int freerdp_client_new(rdpContext* context)
|
||||
instance->LogonErrorInfo = xf_logon_error_info;
|
||||
instance->ReceiveChannelData = xf_receive_channel_data;
|
||||
|
||||
context->channels = freerdp_channels_new();
|
||||
|
||||
settings = instance->settings;
|
||||
xfc->client = instance->context->client;
|
||||
xfc->settings = instance->context->settings;
|
||||
|
||||
status = freerdp_client_parse_command_line_arguments(context->argc, context->argv, settings);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
freerdp_context_free(xfc->instance);
|
||||
freerdp_free(xfc->instance);
|
||||
free(xfc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (settings->ConnectionFile)
|
||||
{
|
||||
rdpFile* file = freerdp_client_rdp_file_new();
|
||||
fprintf(stderr, "Using connection file: %s\n", settings->ConnectionFile);
|
||||
freerdp_client_parse_rdp_file(file, settings->ConnectionFile);
|
||||
freerdp_client_populate_settings_from_rdp_file(file, settings);
|
||||
}
|
||||
|
||||
settings->OsMajorType = OSMAJORTYPE_UNIX;
|
||||
settings->OsMinorType = OSMINORTYPE_NATIVE_XSERVER;
|
||||
|
||||
@ -1641,28 +1640,22 @@ int freerdp_client_new(rdpContext* context)
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||
|
||||
if (settings->ListMonitors)
|
||||
{
|
||||
xf_list_monitors(xfc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void freerdp_client_free(rdpContext* context)
|
||||
void freerdp_client_free(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
freerdp* instance;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
if (context)
|
||||
{
|
||||
instance = context->instance;
|
||||
|
||||
xf_window_free(xfc);
|
||||
|
||||
free(xfc->bmp_codec_none);
|
||||
if (xfc->bmp_codec_none)
|
||||
free(xfc->bmp_codec_none);
|
||||
|
||||
XCloseDisplay(xfc->display);
|
||||
if (xfc->display)
|
||||
XCloseDisplay(xfc->display);
|
||||
|
||||
freerdp_context_free(instance);
|
||||
freerdp_free(instance);
|
||||
@ -1674,11 +1667,10 @@ int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints)
|
||||
pEntryPoints->Version = 1;
|
||||
pEntryPoints->Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1);
|
||||
|
||||
pEntryPoints->ContextSize = sizeof(xfContext);
|
||||
|
||||
pEntryPoints->GlobalInit = freerdp_client_global_init;
|
||||
pEntryPoints->GlobalUninit = freerdp_client_global_uninit;
|
||||
|
||||
pEntryPoints->ContextSize = sizeof(xfContext);
|
||||
pEntryPoints->ClientNew = freerdp_client_new;
|
||||
pEntryPoints->ClientFree = freerdp_client_free;
|
||||
|
||||
|
@ -23,6 +23,9 @@
|
||||
|
||||
#include <freerdp/client.h>
|
||||
|
||||
#include <freerdp/client/file.h>
|
||||
#include <freerdp/client/cmdline.h>
|
||||
|
||||
freerdp* freerdp_client_get_instance(rdpContext* context)
|
||||
{
|
||||
return context->instance;
|
||||
@ -76,4 +79,57 @@ int freerdp_client_set_param_string(rdpContext* context, int id, char* param)
|
||||
return freerdp_set_param_string(settings, id, param);
|
||||
}
|
||||
|
||||
/* Common API */
|
||||
|
||||
int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv)
|
||||
{
|
||||
int status;
|
||||
rdpSettings* settings;
|
||||
|
||||
context->argc = argc;
|
||||
context->argv = argv;
|
||||
|
||||
if (context->argc < 1)
|
||||
return 0;
|
||||
|
||||
if (!context->argv)
|
||||
return -1;
|
||||
|
||||
settings = context->settings;
|
||||
|
||||
status = freerdp_client_parse_command_line_arguments(context->argc, context->argv, settings);
|
||||
|
||||
if (settings->ConnectionFile)
|
||||
{
|
||||
rdpFile* file = freerdp_client_rdp_file_new();
|
||||
freerdp_client_parse_rdp_file(file, settings->ConnectionFile);
|
||||
freerdp_client_populate_settings_from_rdp_file(file, settings);
|
||||
freerdp_client_rdp_file_free(file);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int freerdp_client_parse_connection_file(rdpContext* context, char* filename)
|
||||
{
|
||||
rdpFile* file;
|
||||
|
||||
file = freerdp_client_rdp_file_new();
|
||||
freerdp_client_parse_rdp_file(file, filename);
|
||||
freerdp_client_populate_settings_from_rdp_file(file, context->settings);
|
||||
freerdp_client_rdp_file_free(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int freerdp_client_parse_connection_file_buffer(rdpContext* context, BYTE* buffer, size_t size)
|
||||
{
|
||||
rdpFile* file;
|
||||
|
||||
file = freerdp_client_rdp_file_new();
|
||||
freerdp_client_parse_rdp_file_buffer(file, buffer, size);
|
||||
freerdp_client_populate_settings_from_rdp_file(file, context->settings);
|
||||
freerdp_client_rdp_file_free(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ ios_run_freerdp(freerdp * instance)
|
||||
#pragma mark -
|
||||
#pragma mark Context callbacks
|
||||
|
||||
void ios_context_new(freerdp* instance, rdpContext* context)
|
||||
int ios_context_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
mfInfo* mfi = (mfInfo*)calloc(1, sizeof(mfInfo));
|
||||
((mfContext*) context)->mfi = mfi;
|
||||
@ -260,6 +260,7 @@ void ios_context_new(freerdp* instance, rdpContext* context)
|
||||
mfi->context = (mfContext*)context;
|
||||
mfi->context->settings = instance->settings;
|
||||
mfi->instance = instance;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ios_context_free(freerdp* instance, rdpContext* context)
|
||||
@ -284,7 +285,7 @@ freerdp* ios_freerdp_new()
|
||||
inst->VerifyChangedCertificate = ios_ui_check_changed_certificate;
|
||||
inst->ReceiveChannelData = ios_receive_channel_data;
|
||||
|
||||
inst->context_size = sizeof(mfContext);
|
||||
inst->ContextSize = sizeof(mfContext);
|
||||
inst->ContextNew = ios_context_new;
|
||||
inst->ContextFree = ios_context_free;
|
||||
freerdp_context_new(inst);
|
||||
|
@ -55,8 +55,8 @@ struct rdp_client
|
||||
typedef void (*pRdpGlobalInit)(void);
|
||||
typedef void (*pRdpGlobalUninit)(void);
|
||||
|
||||
typedef int (*pRdpClientNew)(rdpContext* context);
|
||||
typedef void (*pRdpClientFree)(rdpContext* context);
|
||||
typedef int (*pRdpClientNew)(freerdp* instance, rdpContext* context);
|
||||
typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context);
|
||||
|
||||
typedef int (*pRdpClientStart)(rdpContext* context);
|
||||
typedef int (*pRdpClientStop)(rdpContext* context);
|
||||
@ -66,11 +66,10 @@ struct rdp_client_entry_points_v1
|
||||
DWORD Size;
|
||||
DWORD Version;
|
||||
|
||||
DWORD ContextSize;
|
||||
|
||||
pRdpGlobalInit GlobalInit;
|
||||
pRdpGlobalUninit GlobalUninit;
|
||||
|
||||
DWORD ContextSize;
|
||||
pRdpClientNew ClientNew;
|
||||
pRdpClientFree ClientFree;
|
||||
|
||||
@ -87,6 +86,10 @@ typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
|
||||
|
||||
/* Common client functions */
|
||||
|
||||
FREERDP_API int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv);
|
||||
FREERDP_API int freerdp_client_parse_connection_file(rdpContext* context, char* filename);
|
||||
FREERDP_API int freerdp_client_parse_connection_file_buffer(rdpContext* context, BYTE* buffer, size_t size);
|
||||
|
||||
FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
|
||||
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
|
||||
FREERDP_API rdpClient* freerdp_client_get_interface(rdpContext* context);
|
||||
|
@ -49,7 +49,7 @@ typedef struct rdp_freerdp_peer freerdp_peer;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*pContextNew)(freerdp* instance, rdpContext* context);
|
||||
typedef int (*pContextNew)(freerdp* instance, rdpContext* context);
|
||||
typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
|
||||
|
||||
typedef BOOL (*pPreConnect)(freerdp* instance);
|
||||
@ -123,7 +123,7 @@ struct rdp_freerdp
|
||||
{
|
||||
rdpContext* context; /**< (offset 0)
|
||||
Pointer to a rdpContext structure.
|
||||
Client applications can use the context_size field to register a context bigger than the rdpContext
|
||||
Client applications can use the ContextSize field to register a context bigger than the rdpContext
|
||||
structure. This allow clients to use additional context information.
|
||||
When using this capability, client application should ALWAYS declare their structure with the
|
||||
rdpContext field first, and any additional content following it.
|
||||
@ -143,7 +143,7 @@ struct rdp_freerdp
|
||||
Will be initialized by a call to freerdp_context_new() */
|
||||
UINT32 paddingB[32 - 19]; /* 19 */
|
||||
|
||||
size_t context_size; /* (offset 32)
|
||||
size_t ContextSize; /* (offset 32)
|
||||
Specifies the size of the 'context' field. freerdp_context_new() will use this size to allocate the context buffer.
|
||||
freerdp_new() sets it to sizeof(rdpContext).
|
||||
If modifying it, there should always be a minimum of sizeof(rdpContext), as the freerdp library will assume it can use the
|
||||
@ -203,7 +203,7 @@ struct rdp_freerdp
|
||||
UINT32 paddingE[80 - 66]; /* 66 */
|
||||
};
|
||||
|
||||
FREERDP_API void freerdp_context_new(freerdp* instance);
|
||||
FREERDP_API int freerdp_context_new(freerdp* instance);
|
||||
FREERDP_API void freerdp_context_free(freerdp* instance);
|
||||
|
||||
FREERDP_API BOOL freerdp_connect(freerdp* instance);
|
||||
|
@ -54,7 +54,7 @@ struct rdp_freerdp_peer
|
||||
rdpUpdate* update;
|
||||
rdpSettings* settings;
|
||||
|
||||
size_t context_size;
|
||||
size_t ContextSize;
|
||||
psPeerContextNew ContextNew;
|
||||
psPeerContextFree ContextFree;
|
||||
|
||||
|
@ -316,19 +316,18 @@ void freerdp_get_version(int* major, int* minor, int* revision)
|
||||
*
|
||||
* @param instance - Pointer to the rdp_freerdp structure that will be initialized with the new context.
|
||||
*/
|
||||
void freerdp_context_new(freerdp* instance)
|
||||
int freerdp_context_new(freerdp* instance)
|
||||
{
|
||||
rdpRdp* rdp;
|
||||
|
||||
rdp = rdp_new(instance);
|
||||
// FIXME - we're not checking where rdp_new returns NULL, and have no way to report an error to the caller
|
||||
|
||||
instance->input = rdp->input;
|
||||
instance->update = rdp->update;
|
||||
instance->settings = rdp->settings;
|
||||
|
||||
instance->context = (rdpContext*) malloc(instance->context_size);
|
||||
ZeroMemory(instance->context, instance->context_size);
|
||||
instance->context = (rdpContext*) malloc(instance->ContextSize);
|
||||
ZeroMemory(instance->context, instance->ContextSize);
|
||||
|
||||
instance->context->graphics = graphics_new(instance->context);
|
||||
instance->context->instance = instance;
|
||||
@ -352,6 +351,8 @@ void freerdp_context_new(freerdp* instance)
|
||||
update_register_client_callbacks(rdp->update);
|
||||
|
||||
IFCALL(instance->ContextNew, instance, instance->context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Deallocator function for a rdp context.
|
||||
@ -395,7 +396,7 @@ freerdp* freerdp_new()
|
||||
if (instance)
|
||||
{
|
||||
ZeroMemory(instance, sizeof(freerdp));
|
||||
instance->context_size = sizeof(rdpContext);
|
||||
instance->ContextSize = sizeof(rdpContext);
|
||||
instance->SendChannelData = freerdp_send_channel_data;
|
||||
}
|
||||
|
||||
|
@ -376,8 +376,8 @@ void freerdp_peer_context_new(freerdp_peer* client)
|
||||
client->update = rdp->update;
|
||||
client->settings = rdp->settings;
|
||||
|
||||
client->context = (rdpContext*) malloc(client->context_size);
|
||||
ZeroMemory(client->context, client->context_size);
|
||||
client->context = (rdpContext*) malloc(client->ContextSize);
|
||||
ZeroMemory(client->context, client->ContextSize);
|
||||
|
||||
client->context->rdp = rdp;
|
||||
client->context->peer = client;
|
||||
@ -416,7 +416,7 @@ freerdp_peer* freerdp_peer_new(int sockfd)
|
||||
if (client != NULL)
|
||||
{
|
||||
client->sockfd = sockfd;
|
||||
client->context_size = sizeof(rdpContext);
|
||||
client->ContextSize = sizeof(rdpContext);
|
||||
client->Initialize = freerdp_peer_initialize;
|
||||
client->GetFileDescriptor = freerdp_peer_get_fds;
|
||||
client->CheckFileDescriptor = freerdp_peer_check_fds;
|
||||
|
@ -172,7 +172,7 @@ void mf_peer_rfx_update(freerdp_peer* client)
|
||||
}
|
||||
|
||||
/* Called when we have a new peer connecting */
|
||||
void mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
|
||||
int mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
|
||||
{
|
||||
context->info = mf_info_get_instance();
|
||||
context->rfx_context = rfx_context_new();
|
||||
@ -191,6 +191,8 @@ void mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
|
||||
//#endif
|
||||
|
||||
mf_info_peer_register(context->info, context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -228,7 +230,7 @@ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context)
|
||||
/* Called when a new client connects */
|
||||
void mf_peer_init(freerdp_peer* client)
|
||||
{
|
||||
client->context_size = sizeof(mfPeerContext);
|
||||
client->ContextSize = sizeof(mfPeerContext);
|
||||
client->ContextNew = (psPeerContextNew) mf_peer_context_new;
|
||||
client->ContextFree = (psPeerContextFree) mf_peer_context_free;
|
||||
freerdp_peer_context_new(client);
|
||||
|
@ -96,7 +96,7 @@ void test_peer_context_free(freerdp_peer* client, testPeerContext* context)
|
||||
|
||||
static void test_peer_init(freerdp_peer* client)
|
||||
{
|
||||
client->context_size = sizeof(testPeerContext);
|
||||
client->ContextSize = sizeof(testPeerContext);
|
||||
client->ContextNew = (psPeerContextNew) test_peer_context_new;
|
||||
client->ContextFree = (psPeerContextFree) test_peer_context_free;
|
||||
freerdp_peer_context_new(client);
|
||||
|
@ -62,7 +62,7 @@ void wf_peer_context_free(freerdp_peer* client, wfPeerContext* context)
|
||||
|
||||
void wf_peer_init(freerdp_peer* client)
|
||||
{
|
||||
client->context_size = sizeof(wfPeerContext);
|
||||
client->ContextSize = sizeof(wfPeerContext);
|
||||
client->ContextNew = (psPeerContextNew) wf_peer_context_new;
|
||||
client->ContextFree = (psPeerContextFree) wf_peer_context_free;
|
||||
|
||||
|
@ -323,7 +323,7 @@ void xf_peer_init(freerdp_peer* client)
|
||||
xfInfo* xfi;
|
||||
xfPeerContext* xfp;
|
||||
|
||||
client->context_size = sizeof(xfPeerContext);
|
||||
client->ContextSize = sizeof(xfPeerContext);
|
||||
client->ContextNew = (psPeerContextNew) xf_peer_context_new;
|
||||
client->ContextFree = (psPeerContextFree) xf_peer_context_free;
|
||||
freerdp_peer_context_new(client);
|
||||
|
Loading…
Reference in New Issue
Block a user