libfreerdp-core: decouple initialization of rdpSettings from freerdp* instance
This commit is contained in:
parent
53bdd952bf
commit
b70ecbbf62
@ -50,6 +50,7 @@ rdpContext* freerdp_client_context_new(RDP_CLIENT_ENTRY_POINTS* pEntryPoints)
|
||||
pEntryPoints->GlobalInit();
|
||||
|
||||
instance = freerdp_new();
|
||||
instance->settings = pEntryPoints->settings;
|
||||
instance->ContextSize = pEntryPoints->ContextSize;
|
||||
instance->ContextNew = freerdp_client_common_new;
|
||||
instance->ContextFree = freerdp_client_common_free;
|
||||
|
@ -45,6 +45,8 @@ struct rdp_client_entry_points_v1
|
||||
DWORD Size;
|
||||
DWORD Version;
|
||||
|
||||
rdpSettings* settings;
|
||||
|
||||
pRdpGlobalInit GlobalInit;
|
||||
pRdpGlobalUninit GlobalUninit;
|
||||
|
||||
|
@ -82,7 +82,9 @@ struct rdp_context
|
||||
Pointer to the client peer.
|
||||
This is set by a call to freerdp_peer_context_new() during peer initialization.
|
||||
This field is used only on the server side. */
|
||||
UINT64 paddingA[16 - 2]; /* 2 */
|
||||
ALIGN64 BOOL ServerMode; /**< (offset 2) true when context is in server mode */
|
||||
|
||||
UINT64 paddingA[16 - 3]; /* 3 */
|
||||
|
||||
ALIGN64 int argc; /**< (offset 16)
|
||||
Number of arguments given to the program at launch time.
|
||||
|
@ -1299,7 +1299,12 @@ typedef struct rdp_settings rdpSettings;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FREERDP_API rdpSettings* freerdp_settings_new(void* instance);
|
||||
/**
|
||||
* rdpSettings creation flags
|
||||
*/
|
||||
#define FREERDP_SETTINGS_SERVER_MODE 0x00000001
|
||||
|
||||
FREERDP_API rdpSettings* freerdp_settings_new(DWORD flags);
|
||||
FREERDP_API void freerdp_settings_free(rdpSettings* settings);
|
||||
|
||||
FREERDP_API int freerdp_addin_set_argument(ADDIN_ARGV* args, char* argument);
|
||||
|
@ -385,6 +385,9 @@ int freerdp_context_new(freerdp* instance)
|
||||
context = instance->context;
|
||||
context->instance = instance;
|
||||
|
||||
context->ServerMode = FALSE;
|
||||
context->settings = instance->settings;
|
||||
|
||||
context->pubSub = PubSub_New(TRUE);
|
||||
PubSub_AddEventTypes(context->pubSub, FreeRDP_Events, sizeof(FreeRDP_Events) / sizeof(wEventType));
|
||||
|
||||
|
@ -406,6 +406,8 @@ void freerdp_peer_context_new(freerdp_peer* client)
|
||||
client->context = (rdpContext*) malloc(client->ContextSize);
|
||||
ZeroMemory(client->context, client->ContextSize);
|
||||
|
||||
client->context->ServerMode = TRUE;
|
||||
|
||||
rdp = rdp_new(client->context);
|
||||
|
||||
client->input = rdp->input;
|
||||
|
@ -987,6 +987,7 @@ int rdp_check_fds(rdpRdp* rdp)
|
||||
rdpRdp* rdp_new(rdpContext* context)
|
||||
{
|
||||
rdpRdp* rdp;
|
||||
DWORD flags;
|
||||
|
||||
rdp = (rdpRdp*) malloc(sizeof(rdpRdp));
|
||||
|
||||
@ -995,9 +996,17 @@ rdpRdp* rdp_new(rdpContext* context)
|
||||
ZeroMemory(rdp, sizeof(rdpRdp));
|
||||
|
||||
rdp->context = context;
|
||||
|
||||
rdp->instance = context->instance;
|
||||
rdp->settings = freerdp_settings_new((void*) context->instance);
|
||||
|
||||
flags = 0;
|
||||
|
||||
if (context->ServerMode)
|
||||
flags |= FREERDP_SETTINGS_SERVER_MODE;
|
||||
|
||||
if (!rdp->settings)
|
||||
rdp->settings = freerdp_settings_new(flags);
|
||||
|
||||
rdp->settings->instance = context->instance;
|
||||
|
||||
if (context->instance)
|
||||
context->instance->settings = rdp->settings;
|
||||
|
@ -198,22 +198,17 @@ void settings_get_computer_name(rdpSettings* settings)
|
||||
GetComputerNameExA(ComputerNameNetBIOS, settings->ComputerName, &nSize);
|
||||
}
|
||||
|
||||
rdpSettings* freerdp_settings_new(void* instance)
|
||||
rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
{
|
||||
rdpSettings* settings;
|
||||
|
||||
settings = (rdpSettings*) malloc(sizeof(rdpSettings));
|
||||
|
||||
if (settings != NULL)
|
||||
if (settings)
|
||||
{
|
||||
ZeroMemory(settings, sizeof(rdpSettings));
|
||||
|
||||
settings->instance = instance;
|
||||
|
||||
/* Server instances are NULL */
|
||||
|
||||
if (!settings->instance)
|
||||
settings->ServerMode = TRUE;
|
||||
settings->ServerMode = (flags & FREERDP_SETTINGS_SERVER_MODE) ? TRUE : FALSE;
|
||||
|
||||
settings->DesktopWidth = 1024;
|
||||
settings->DesktopHeight = 768;
|
||||
|
@ -575,8 +575,6 @@ static void* schannel_test_server_thread(void* arg)
|
||||
int dump_test_certificate_files()
|
||||
{
|
||||
FILE* fp;
|
||||
int length;
|
||||
char* filename;
|
||||
char* fullpath;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user