FreeRDP/client/X11/cli/xfreerdp.c

87 lines
2.2 KiB
C
Raw Normal View History

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>
* 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>
2013-04-02 21:22:59 +04:00
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <freerdp/streamdump.h>
2013-04-02 21:22:59 +04:00
#include <freerdp/freerdp.h>
#include <freerdp/client/cmdline.h>
#include "../xf_client.h"
#include "../xfreerdp.h"
2011-08-07 17:52:40 +04:00
int main(int argc, char* argv[])
{
int rc = 1;
int status;
HANDLE thread;
xfContext* xfc;
DWORD dwExitCode;
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 };
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);
if (!context)
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;
status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE);
if (status)
2013-06-14 05:34:46 +04: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))
xf_list_monitors(xfc);
goto out;
2013-06-14 05:34:46 +04:00
}
if (!stream_dump_register_handlers(context, CONNECTION_STATE_MCS_CREATE_REQUEST, FALSE))
goto out;
if (freerdp_client_start(context) != 0)
goto out;
2011-08-07 17:52:40 +04:00
thread = freerdp_client_get_thread(context);
2011-08-07 17:52:40 +04:00
WaitForSingleObject(thread, INFINITE);
GetExitCodeThread(thread, &dwExitCode);
rc = xf_exit_code_from_disconnect_reason(dwExitCode);
2013-06-14 06:11:23 +04:00
freerdp_client_stop(context);
out:
2013-06-14 06:11:23 +04:00
freerdp_client_context_free(context);
2011-08-07 17:52:40 +04:00
return rc;
2011-08-07 17:52:40 +04:00
}