diff --git a/db.c b/db.c index d9e429e..5cacce3 100644 --- a/db.c +++ b/db.c @@ -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); diff --git a/freerdp.db b/freerdp.db index 2e53690..620b020 100644 Binary files a/freerdp.db and b/freerdp.db differ diff --git a/gui.c b/gui.c index 49ed722..fc44f50 100644 --- a/gui.c +++ b/gui.c @@ -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; } diff --git a/main.c b/xfreerdp.c similarity index 100% rename from main.c rename to xfreerdp.c diff --git a/xrdp.c b/xrdp.c new file mode 100644 index 0000000..5448459 --- /dev/null +++ b/xrdp.c @@ -0,0 +1,71 @@ +//#ifdef HAVE_CONFIG_H +//#include "config.h" +//#endif +// +//#include +//#include +//#include +// +//#include +//#include +// +//#include "../xf_client.h" +//#include "../xfreerdp.h" +// +//#include +//#include +//#include +//#include +// +//#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; +//} diff --git a/xrdp.h b/xrdp.h new file mode 100644 index 0000000..4fac1a1 --- /dev/null +++ b/xrdp.h @@ -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_ */