|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
Packit |
1fb8d4 |
* X11 Client
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
Packit |
1fb8d4 |
* Copyright 2012 HP Development Company, LLC
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1fb8d4 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1fb8d4 |
* You may obtain a copy of the License at
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1fb8d4 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1fb8d4 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1fb8d4 |
* See the License for the specific language governing permissions and
|
|
Packit |
1fb8d4 |
* limitations under the License.
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
1fb8d4 |
#include "config.h"
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <winpr/crt.h>
|
|
Packit |
1fb8d4 |
#include <winpr/synch.h>
|
|
Packit |
1fb8d4 |
#include <winpr/thread.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <freerdp/freerdp.h>
|
|
Packit |
1fb8d4 |
#include <freerdp/client/cmdline.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include "../xf_client.h"
|
|
Packit |
1fb8d4 |
#include "../xfreerdp.h"
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
int main(int argc, char* argv[])
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
int status;
|
|
Packit |
1fb8d4 |
HANDLE thread;
|
|
Packit |
1fb8d4 |
xfContext* xfc;
|
|
Packit |
1fb8d4 |
DWORD dwExitCode;
|
|
Packit |
1fb8d4 |
rdpContext* context;
|
|
Packit |
1fb8d4 |
rdpSettings* settings;
|
|
Packit |
1fb8d4 |
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
ZeroMemory(&clientEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS));
|
|
Packit |
1fb8d4 |
clientEntryPoints.Size = sizeof(RDP_CLIENT_ENTRY_POINTS);
|
|
Packit |
1fb8d4 |
clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
RdpClientEntry(&clientEntryPoints);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
context = freerdp_client_context_new(&clientEntryPoints);
|
|
Packit |
1fb8d4 |
if (!context)
|
|
Packit |
1fb8d4 |
return 1;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
settings = context->settings;
|
|
Packit |
1fb8d4 |
xfc = (xfContext*) context;
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
status = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
if (status)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
if (settings->ListMonitors)
|
|
Packit |
1fb8d4 |
xf_list_monitors(xfc);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
freerdp_client_context_free(context);
|
|
Packit |
1fb8d4 |
return 0;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
freerdp_client_start(context);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
thread = freerdp_client_get_thread(context);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
WaitForSingleObject(thread, INFINITE);
|
|
Packit |
1fb8d4 |
GetExitCodeThread(thread, &dwExitCode);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
freerdp_client_stop(context);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
freerdp_client_context_free(context);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return xf_exit_code_from_disconnect_reason(dwExitCode);
|
|
Packit |
1fb8d4 |
}
|