Исправлены ошибки при подключении

This commit is contained in:
Alexander Zhirov 2022-07-15 18:53:03 +03:00
parent a7249dc6e4
commit ab513983d6
6 changed files with 94 additions and 11 deletions

7
db.c
View File

@ -368,18 +368,17 @@ bool dbSetUserNameCurrent(char *current)
sqlite3_bind_int(res, 3, VALUE_USERNAME);
}
if (sqlite3_step(res) == SQLITE_BUSY)
{
fprintf(stderr, "[ЗАНЯТО] %s - \"%s\"\n", text ? "установлено" : "очищено", getParameter(VALUE_USERNAME)->key);
fprintf(stderr, "[ЗАНЯТО] %s - \"%s\"\n", text ? "установлено" : "очищено", text ? getValue(VALUE_USERNAME)->current : "");
}
if (sqlite3_step(res) == SQLITE_ERROR)
{
fprintf(stderr, "[ОШИБКА] %s - \"%s\"\n", text ? "установлено" : "очищено", getParameter(VALUE_USERNAME)->key);
fprintf(stderr, "[ОШИБКА] %s - \"%s\"\n", text ? "установлено" : "очищено", text ? getValue(VALUE_USERNAME)->current : "");
}
if (sqlite3_step(res) == SQLITE_DONE)
{
fprintf(stdout, "[УСПЕШНО] %s - \"%s\"\n", text ? "установлено" : "очищено", getParameter(VALUE_USERNAME)->key);
fprintf(stdout, "[УСПЕШНО] %s - \"%s\"\n", text ? "установлено" : "очищено", text ? getValue(VALUE_USERNAME)->current : "");
}
sqlite3_finalize(res);

Binary file not shown.

14
gui.c
View File

@ -17,6 +17,7 @@
#include "address.h"
#include "db.h"
#include "xrdp.h"
static int guiExit(Ihandle *self)
{
@ -40,19 +41,18 @@ static int guiConnect(Ihandle *self)
{
printf("%s\n", args.argv[i]);
}
printf("\n");
freeArguments(&args);
if (!dbAddServer(result, IupGetAttribute(IupGetDialogChild(self, "SERVER"), "VALUE")))
{
IupSetAttribute(IupGetDialogChild(self, "SERVER"), "APPENDITEM", IupGetAttribute(IupGetDialogChild(self, "SERVER"), "VALUE"));
}
// if (free_rdp_connect(args.argc, args.argv) != XF_EXIT_DNS_NAME_NOT_FOUND)
// {
// dbSetValueCurrent(VALUE_SERVER, IupGetAttribute(IupGetDialogChild(self, "SERVER"), "LINEVALUE"));
if (!dbAddServer(result, IupGetAttribute(IupGetDialogChild(self, "SERVER"), "VALUE")))
{
IupSetAttribute(IupGetDialogChild(self, "SERVER"), "APPENDITEM", IupGetAttribute(IupGetDialogChild(self, "SERVER"), "VALUE"));
}
dbSetUserNameCurrent(IupGetAttribute(IupGetDialogChild(self, "USER"), "LINEVALUE"));
// }
freeArguments(&args);
return IUP_DEFAULT;
}

View File

71
xrdp.c Normal file
View File

@ -0,0 +1,71 @@
//#ifdef HAVE_CONFIG_H
//#include "config.h"
//#endif
//
//#include <winpr/crt.h>
//#include <winpr/synch.h>
//#include <winpr/thread.h>
//
//#include <freerdp/freerdp.h>
//#include <freerdp/client/cmdline.h>
//
//#include "../xf_client.h"
//#include "../xfreerdp.h"
//
//#include <stdlib.h>
//#include <stdio.h>
//#include <string.h>
//#include <iup.h>
//
//#include "xrdp.h"
//
//int free_rdp_connect(int argc, char **argv)
//{
// int rc = 1;
// int status;
// HANDLE thread;
// xfContext *xfc;
// DWORD dwExitCode;
// rdpContext *context;
// 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);
//
// context = freerdp_client_context_new(&clientEntryPoints);
// if (!context)
// return 1;
//
// settings = context->settings;
// xfc = (xfContext*) context;
//
// status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE);
// if (status)
// {
// rc = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
//
// if (settings->ListMonitors)
// xf_list_monitors(xfc);
//
// goto out;
// }
//
// if (freerdp_client_start(context) != 0)
// goto out;
//
// thread = freerdp_client_get_thread(context);
//
// WaitForSingleObject(thread, INFINITE);
// GetExitCodeThread(thread, &dwExitCode);
// rc = xf_exit_code_from_disconnect_reason(dwExitCode);
//
// freerdp_client_stop(context);
//
// out: freerdp_client_context_free(context);
//
// return rc;
//}

13
xrdp.h Normal file
View File

@ -0,0 +1,13 @@
/*
* xrdp.h
*
* Created on: 15 июл. 2022 г.
* Author: alexander
*/
#ifndef XRDP_H_
#define XRDP_H_
int free_rdp_connect(int argc, char **argv);
#endif /* XRDP_H_ */