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.
|
|
|
|
*/
|
|
|
|
|
2022-02-16 13:20:38 +03:00
|
|
|
#include <freerdp/config.h>
|
2012-08-15 01:20:53 +04:00
|
|
|
|
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
|
|
|
|
2021-09-23 15:52:03 +03:00
|
|
|
#include <freerdp/streamdump.h>
|
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[])
|
|
|
|
{
|
2021-01-22 11:44:55 +03:00
|
|
|
int rc = 1;
|
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;
|
2021-09-08 16:37:45 +03:00
|
|
|
RDP_CLIENT_ENTRY_POINTS clientEntryPoints = { 0 };
|
2013-06-14 04:25:50 +04:00
|
|
|
|
|
|
|
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
|
|
|
if (status)
|
2013-06-14 05:34:46 +04:00
|
|
|
{
|
2021-01-22 11:44:55 +03:00
|
|
|
rc = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
|
|
|
|
|
2023-10-13 10:48:44 +03:00
|
|
|
if (freerdp_settings_get_bool(settings, FreeRDP_ListMonitors))
|
2013-06-15 23:13:38 +04:00
|
|
|
xf_list_monitors(xfc);
|
|
|
|
|
2021-01-22 11:44:55 +03:00
|
|
|
goto out;
|
2013-06-14 05:34:46 +04:00
|
|
|
}
|
2013-06-14 04:25:50 +04:00
|
|
|
|
2022-10-21 11:31:14 +03:00
|
|
|
if (!stream_dump_register_handlers(context, CONNECTION_STATE_MCS_CREATE_REQUEST, FALSE))
|
2021-09-23 15:52:03 +03:00
|
|
|
goto out;
|
|
|
|
|
2021-01-22 11:44:55 +03:00
|
|
|
if (freerdp_client_start(context) != 0)
|
|
|
|
goto out;
|
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);
|
2021-01-22 11:44:55 +03:00
|
|
|
rc = xf_exit_code_from_disconnect_reason(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
|
|
|
|
2021-01-22 11:44:55 +03:00
|
|
|
out:
|
2013-06-14 06:11:23 +04:00
|
|
|
freerdp_client_context_free(context);
|
2011-08-07 17:52:40 +04:00
|
|
|
|
2021-01-22 11:44:55 +03:00
|
|
|
return rc;
|
2011-08-07 17:52:40 +04:00
|
|
|
}
|