2011-08-07 17:52:40 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-07 17:52:40 +04:00
|
|
|
* X11 Client
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2012-06-13 23:45:58 +04:00
|
|
|
* Copyright 2012 HP Development Company, LLC
|
2011-08-07 17:52:40 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:20:53 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-04-02 21:22:59 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/synch.h>
|
|
|
|
#include <winpr/thread.h>
|
2012-11-22 06:22:06 +04:00
|
|
|
|
2013-04-02 21:22:59 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2013-06-15 23:13:38 +04:00
|
|
|
#include <freerdp/client/cmdline.h>
|
2012-09-19 03:40:54 +04:00
|
|
|
|
2016-05-03 11:44:42 +03:00
|
|
|
#include "../xf_client.h"
|
|
|
|
#include "../xfreerdp.h"
|
2011-08-07 17:52:40 +04:00
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2013-06-15 23:13:38 +04:00
|
|
|
int status;
|
2013-06-14 23:07:17 +04:00
|
|
|
HANDLE thread;
|
2013-06-13 02:57:25 +04:00
|
|
|
xfContext* xfc;
|
2013-04-02 22:51:12 +04:00
|
|
|
DWORD dwExitCode;
|
2013-06-14 04:25:50 +04:00
|
|
|
rdpContext* context;
|
2013-06-14 05:34:46 +04:00
|
|
|
rdpSettings* settings;
|
2013-06-14 04:25:50 +04:00
|
|
|
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);
|
2011-08-07 17:52:40 +04:00
|
|
|
|
2013-06-14 06:11:23 +04:00
|
|
|
context = freerdp_client_context_new(&clientEntryPoints);
|
2015-03-23 19:25:23 +03:00
|
|
|
if (!context)
|
2018-04-03 13:55:17 +03:00
|
|
|
return 1;
|
2011-08-07 17:52:40 +04:00
|
|
|
|
2013-06-14 05:34:46 +04:00
|
|
|
settings = context->settings;
|
2019-11-06 17:24:51 +03:00
|
|
|
xfc = (xfContext*)context;
|
2013-04-17 05:03:31 +04:00
|
|
|
|
2015-03-16 12:15:37 +03:00
|
|
|
status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE);
|
2013-06-15 23:13:38 +04:00
|
|
|
|
2013-10-13 05:07:12 +04:00
|
|
|
status = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
|
2013-06-15 23:13:38 +04:00
|
|
|
|
|
|
|
if (status)
|
2013-06-14 05:34:46 +04:00
|
|
|
{
|
2019-10-03 17:15:52 +03:00
|
|
|
BOOL list = settings->ListMonitors;
|
|
|
|
if (list)
|
2013-06-15 23:13:38 +04:00
|
|
|
xf_list_monitors(xfc);
|
|
|
|
|
|
|
|
freerdp_client_context_free(context);
|
2019-10-03 17:15:52 +03:00
|
|
|
if (list)
|
2019-09-24 10:45:35 +03:00
|
|
|
return 0;
|
|
|
|
return status;
|
2013-06-14 05:34:46 +04:00
|
|
|
}
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2013-06-14 06:11:23 +04:00
|
|
|
freerdp_client_start(context);
|
2011-08-07 17:52:40 +04:00
|
|
|
|
2013-06-14 23:07:17 +04:00
|
|
|
thread = freerdp_client_get_thread(context);
|
2011-08-07 17:52:40 +04:00
|
|
|
|
2013-06-14 23:07:17 +04:00
|
|
|
WaitForSingleObject(thread, INFINITE);
|
|
|
|
GetExitCodeThread(thread, &dwExitCode);
|
2012-03-16 19:42:56 +04:00
|
|
|
|
2013-06-14 06:11:23 +04:00
|
|
|
freerdp_client_stop(context);
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2013-06-14 06:11:23 +04:00
|
|
|
freerdp_client_context_free(context);
|
2011-08-07 17:52:40 +04:00
|
|
|
|
2018-04-03 13:55:17 +03:00
|
|
|
return xf_exit_code_from_disconnect_reason(dwExitCode);
|
2011-08-07 17:52:40 +04:00
|
|
|
}
|