Beispiel #1
0
int main(int argc, char* argv[])
{
	int rc = -1;
	DWORD status;
	RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
	rdpContext* context;
	//if (!handle_uwac_events(NULL, g_display))
	//	exit(1);
	RdpClientEntry(&clientEntryPoints);
	context = freerdp_client_context_new(&clientEntryPoints);

	if (!context)
		goto fail;

	status = freerdp_client_settings_parse_command_line(context->settings, argc,
	         argv, FALSE);
	status = freerdp_client_settings_command_line_status_print(context->settings,
	         status, argc, argv);

	if (status)
		return 0;

	if (freerdp_client_start(context) != 0)
		goto fail;

	rc = wlfreerdp_run(context->instance);

	if (freerdp_client_stop(context) != 0)
		rc = -1;

fail:
	freerdp_client_context_free(context);
	return rc;
}
Beispiel #2
0
int win_shadow_rdp_start(winShadowSubsystem* subsystem)
{
	int status;
	shwContext* shw = subsystem->shw;
	rdpContext* context = (rdpContext*) shw;
	status = freerdp_client_start(context);
	return status;
}
Beispiel #3
0
int main(int argc, char* argv[])
{
	int status;
	HANDLE thread;
	xfContext* xfc;
	DWORD dwExitCode;
	rdpContext* context;
	rdpSettings* settings;
	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;

	RdpClientEntry(&clientEntryPoints);

	context = freerdp_client_context_new(&clientEntryPoints);

	settings = context->settings;
	xfc = (xfContext*) context;

	status = freerdp_client_settings_parse_command_line(context->settings, argc, argv);

	status = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);

	if (status)
	{
		if (settings->ListMonitors)
			xf_list_monitors(xfc);

		freerdp_client_context_free(context);
		return 0;
	}

	freerdp_client_start(context);

	thread = freerdp_client_get_thread(context);

	WaitForSingleObject(thread, INFINITE);

	GetExitCodeThread(thread, &dwExitCode);

	freerdp_client_stop(context);

	freerdp_client_context_free(context);

	return xf_exit_code_from_disconnect_reason(dwExitCode);
}
Beispiel #4
0
static void* android_thread_func(void* param)
{
	DWORD status = ERROR_BAD_ARGUMENTS;
	freerdp* instance = param;
	WLog_DBG(TAG, "Start...");

	if (!instance || !instance->context)
		goto fail;

	if (freerdp_client_start(instance->context) != CHANNEL_RC_OK)
		goto fail;

	WLog_DBG(TAG, "Connect...");

	if (!freerdp_connect(instance))
		status = GetLastError();
	else
	{
		status = android_freerdp_run(instance);
		WLog_DBG(TAG, "Disonnect...");

		if (!freerdp_disconnect(instance))
			status = GetLastError();
	}

	WLog_DBG(TAG, "Stop...");

	if (freerdp_client_stop(instance->context) != CHANNEL_RC_OK)
		goto fail;

fail:
	WLog_DBG(TAG, "Session ended with %08lX", status);

	if (status == CHANNEL_RC_OK)
		freerdp_callback("OnDisconnected", "(I)V", instance);
	else
		freerdp_callback("OnConnectionFailure", "(I)V", instance);

	WLog_DBG(TAG, "Quit.");
	ExitThread(status);
	return NULL;
}
Beispiel #5
0
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	int index;
	int status;
	HANDLE thread;
	wfContext* wfc;
	DWORD dwExitCode;
	rdpContext* context;
	rdpSettings* settings;
	RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
	int ret = 0;

	ZeroMemory(&clientEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS));
	clientEntryPoints.Size = sizeof(RDP_CLIENT_ENTRY_POINTS);
	clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;

	RdpClientEntry(&clientEntryPoints);

	context = freerdp_client_context_new(&clientEntryPoints);

	settings = context->settings;
	wfc = (wfContext*) context;

	settings->SoftwareGdi = TRUE;

	context->argc = __argc;
	context->argv = (char**) malloc(sizeof(char*) * __argc);
	if (!context->argv)
	{
		ret = 1;
		goto out;
	}

	for (index = 0; index < context->argc; index++)
	{
		context->argv[index] = _strdup(__argv[index]);
		if (!context->argv[index])
		{
			ret = 1;
			for (--index; index >= 0; --index)
				free(context->argv[index]);
			free(context->argv);
			context->argv = NULL;
			goto out;
		}

	}

	status = freerdp_client_settings_parse_command_line(settings, context->argc, context->argv, FALSE);

	status = freerdp_client_settings_command_line_status_print(settings, status, context->argc, context->argv);

	if (status)
	{
		freerdp_client_context_free(context);
		return 0;
	}

	freerdp_client_start(context);

	thread = freerdp_client_get_thread(context);

	WaitForSingleObject(thread, INFINITE);

	GetExitCodeThread(thread, &dwExitCode);

	freerdp_client_stop(context);
out:
	freerdp_client_context_free(context);

	return ret;
}
Beispiel #6
0
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	int index;
	int status;
	HANDLE thread;
	wfContext* wfc;
	DWORD dwExitCode;
	rdpContext* context;
	rdpSettings* settings;
	RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
	int ret = 0;

	ZeroMemory(&clientEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS));
	clientEntryPoints.Size = sizeof(RDP_CLIENT_ENTRY_POINTS);
	clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;

	RdpClientEntry(&clientEntryPoints);
#ifdef _CLIENT
	////zhuxn/
	TiRaChannel tira;
	int TiraStatus = tira.CreateSocket();
	if (!TiraStatus)
	{
		return ret;
	}
	TiraStatus = tira.Accept();
	if (!TiraStatus)
	{
		return ret;
	}
// 	free(lpCmdLine);
//	lpCmdLine = NULL;
	char* pdata = NULL;
	TiraStatus = tira.RecvData(pdata);
	if (TiraStatus == -1)
	{
		return ret;
	}
	///////
#endif
	context = freerdp_client_context_new(&clientEntryPoints);

	settings = context->settings;
	wfc = (wfContext*) context;

	settings->SoftwareGdi = TRUE;
	//////////////////////////////////////////////////////////////////////////
#ifdef _CLIENT
	if (InitalArguments(context, pdata) == false)
	{
		ret = 1;
		goto out;
	}
#else
/*********************/
	context->argc = __argc;
	context->argv = (char**)malloc(sizeof(char*) * __argc);
	if (!context->argv)
	{
		ret = 1;
		goto out;
	}

	for (index = 0; index < context->argc; index++)
	{
		context->argv[index] = _strdup(__argv[index]);
		if (!context->argv[index])
		{
			ret = 1;
			for (--index; index >= 0; --index)
				free(context->argv[index]);
			free(context->argv);
			context->argv = NULL;
			goto out;
		}
	}
/*********************/
#endif

	status = freerdp_client_settings_parse_command_line(settings, context->argc, context->argv, FALSE);

	status = freerdp_client_settings_command_line_status_print(settings, status, context->argc, context->argv);

	if (status)
	{
		freerdp_client_context_free(context);
		return 0;
	}

	freerdp_client_start(context);

	thread = freerdp_client_get_thread(context);

	WaitForSingleObject(thread, INFINITE);

	GetExitCodeThread(thread, &dwExitCode);

	freerdp_client_stop(context);
out:
	freerdp_client_context_free(context);

	return ret;
}