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.
*/
#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>
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 status;
HANDLE thread;
xfContext* xfc;
DWORD dwExitCode;
rdpContext* context;
2013-06-14 05:34:46 +04:00
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);
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);
status = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
if (status)
2013-06-14 05:34:46 +04:00
{
2019-10-03 17:15:52 +03:00
BOOL list = settings->ListMonitors;
if (list)
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 06:11:23 +04:00
freerdp_client_start(context);
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);
2013-06-14 06:11:23 +04:00
freerdp_client_stop(context);
2013-06-14 06:11:23 +04:00
freerdp_client_context_free(context);
2011-08-07 17:52:40 +04:00
return xf_exit_code_from_disconnect_reason(dwExitCode);
2011-08-07 17:52:40 +04:00
}