From f262b39d32a0c329eb1074c5840d5b539ac17e96 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:25:10 +0800 Subject: [PATCH 1/9] check gui obj folder is exist --- compile.bat | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compile.bat b/compile.bat index 77e20d4..f9a4d57 100644 --- a/compile.bat +++ b/compile.bat @@ -1,5 +1,14 @@ @ECHO off +set folderPath=".\gui\obj" + +if not exist %folderPath% ( + mkdir %folderPath% + echo gui obj folder created successfully. +) else ( + echo gui obj folder already exists. +) + windres -i .\gui\resources.rc -o .\gui\obj\resources.o cd setup From 56734d1b534d7ded27f368861a8949283e8624f3 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:34:21 +0800 Subject: [PATCH 2/9] add more steps to build for source --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 9092a1f..dd4dfa7 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,13 @@ Run docker command from console. ## Building for source - Install mingw https://www.mingw-w64.org/ + + ##### Library Dependency + - [curl](https://curl.se/) + - [pthreads](https://github.com/fwbuilder/pthreads4w) + ##### Tips + 1. Put all libs into `mingw64/x86_64-w64-mingw32` + - Add bin folder to path - Clone the repository - Run compile.bat From 6c35afb876097b825224a7053749c02dcd9dc29e Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:39:17 +0800 Subject: [PATCH 3/9] Do not use CA verify --- installer/src/fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/installer/src/fs.c b/installer/src/fs.c index b761a07..67cb23c 100644 --- a/installer/src/fs.c +++ b/installer/src/fs.c @@ -40,6 +40,11 @@ void get_fs(void) char errbuff[CURL_ERROR_SIZE]; curl_easy_setopt(curl, CURLOPT_URL, FS_URL); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuff); + + //Do not use CA verify + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + + #ifdef __DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); #endif From 5e8b2883c32be64ad0554345696557c685762633 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:40:59 +0800 Subject: [PATCH 4/9] fix copy commands --- installer/src/install.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer/src/install.c b/installer/src/install.c index 96b6d07..8f524cd 100644 --- a/installer/src/install.c +++ b/installer/src/install.c @@ -72,7 +72,7 @@ static int mk_folders(const char *base_path) static int copy_docker(const char *base_path) { char cp_cmd[MAX_CMD_LEN]; - sprintf(cp_cmd, "%s %s%s", "cp -r ..\\..\\init\\bin\\docker-cli-init", base_path, "\\docker-cli\\bin\\"); + sprintf(cp_cmd, "%s %s%s", "copyx ..\\..\\init\\bin", base_path, "\\docker-cli\\bin\\"); int status = DOCKERCLIE_OK; status = exec(cp_cmd); @@ -83,7 +83,7 @@ static int copy_docker(const char *base_path) static int copy_daemon(const char *base_path) { char cp_cmd[MAX_CMD_LEN]; - sprintf(cp_cmd, "%s %s%s", "cp ..\\..\\daemon\\bin\\dockerd", base_path, "\\docker-cli\\daemon\\"); + sprintf(cp_cmd, "%s %s%s", "copyx ..\\..\\daemon\\bin", base_path, "\\docker-cli\\daemon\\"); int status = DOCKERCLIE_OK; status = exec(cp_cmd); @@ -94,7 +94,7 @@ static int copy_daemon(const char *base_path) static int copy_bin_cli(const char *base_path) { char cp_cmd[MAX_CMD_LEN]; - sprintf(cp_cmd, "%s %s%s", "cp -r ..\\..\\cli\\bin\\docker", base_path, "\\docker-cli\\cli\\"); + sprintf(cp_cmd, "%s %s%s", "copyx ..\\..\\cli\\bin", base_path, "\\docker-cli\\cli\\"); int status = DOCKERCLIE_OK; status = exec(cp_cmd); @@ -105,7 +105,7 @@ static int copy_bin_cli(const char *base_path) static int copy_assets(const char *base_path) { char cp_cmd[MAX_CMD_LEN]; - sprintf(cp_cmd, "%s %s%s", "cp ..\\..\\assets\\settings.ico", base_path, "\\docker-cli\\"); + sprintf(cp_cmd, "%s %s%s", "copyx ..\\..\\assets\\settings.ico", base_path, "\\docker-cli\\"); int status = DOCKERCLIE_OK; status = exec(cp_cmd); From 9fe03e37e63d534682194c24f7fb272548a44397 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:42:54 +0800 Subject: [PATCH 5/9] fix format error --- gui/main.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/gui/main.c b/gui/main.c index f935330..7d4ea3c 100644 --- a/gui/main.c +++ b/gui/main.c @@ -1,5 +1,6 @@ #include #include +#include "./inc/thread.h" #include "gui.h" #define APPLICATION_NAME "Docker CLI" @@ -133,28 +134,29 @@ void ShowContextMenu(HWND hwnd, POINT pt) LRESULT CALLBACK windowProc(HWND hwnd, UINT u_msg, WPARAM w_param, LPARAM l_param) { + POINT pt; // = { LOWORD(w_param), HIWORD(w_param) }; switch (u_msg) { case WM_CREATE: // here should be the initialization process break; case WM_NOTIFYCALLBACK: switch (LOWORD(l_param)) { - case WM_LBUTTONDBLCLK: - ShowWindow(hwnd, SW_SHOW); - break; - case WM_CONTEXTMENU: - POINT pt; // = { LOWORD(w_param), HIWORD(w_param) }; - GetCursorPos(&pt); -#ifdef __DEBUG - printf("x: %d - y: %d\n", pt.x, pt.y); -#endif - ShowContextMenu(hwnd, pt); - break; - default: -#ifdef __DEBUG - printf("X %d\n", LOWORD(w_param)); - printf("Event %d\n", LOWORD(l_param)); -#endif + case WM_LBUTTONDBLCLK: + ShowWindow(hwnd, SW_SHOW); + break; + case WM_CONTEXTMENU: + GetCursorPos(&pt); + #ifdef __DEBUG + printf("x: %d - y: %d\n", pt.x, pt.y); + #endif + ShowContextMenu(hwnd, pt); + break; + default: + #ifdef __DEBUG + printf("X %d\n", LOWORD(w_param)); + printf("Event %d\n", LOWORD(l_param)); + #endif + break; } break; case WM_CLOSE: From 4f765b596d7ade33c3ef331f9d5a935c3ec927d0 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:44:07 +0800 Subject: [PATCH 6/9] DOCKERCLI_CODE daemon_init name error --- gui/src/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/thread.c b/gui/src/thread.c index 4b7805d..44c923e 100644 --- a/gui/src/thread.c +++ b/gui/src/thread.c @@ -11,7 +11,7 @@ void *daemon_start(void *args) return NULL; } -DOCKERCLI_CODE daemon_init(const char *path, char *args, pthread_t *tid) +DOCKERCLI_CODE init_daemon(const char *path, char *args, pthread_t *tid) { char daemon_path[MAX_PATH]; From 1e8e194e9502db7aa9d0b959ed98a3cbcc97cd1b Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:47:35 +0800 Subject: [PATCH 7/9] add define NOTIFYICON_VERSION_4 --- gui/inc/elem.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/inc/elem.h b/gui/inc/elem.h index 284db2f..c20a808 100644 --- a/gui/inc/elem.h +++ b/gui/inc/elem.h @@ -5,6 +5,7 @@ #include "../../common/common.h" #define WM_NOTIFYCALLBACK 0x8001 +#define NOTIFYICON_VERSION_4 4 HICON load_icon(HINSTANCE hinst, const char *path); HWND create_main_window(LPCSTR lpClassName, LPCSTR lpWindowName, HINSTANCE hInstance, LPVOID lpParam); From bbf34a7b27129163acdea8f717a0ba8d9ef25c45 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:48:02 +0800 Subject: [PATCH 8/9] fix nicon.uVersion error --- gui/src/elem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/src/elem.c b/gui/src/elem.c index 0a4e241..9847e16 100644 --- a/gui/src/elem.c +++ b/gui/src/elem.c @@ -73,6 +73,7 @@ DOCKERCLI_CODE create_tray_icon(HWND hwnd) return DOCKERCLIE_SYSTEM; nicon.uVersion = NOTIFYICON_VERSION_4; + // nicon.uVersion=4; status = Shell_NotifyIconA(NIM_SETVERSION, &nicon); if (!status) return DOCKERCLIE_SYSTEM; From 7bdd9f4760ac37727e96717f633c83ea1492bb21 Mon Sep 17 00:00:00 2001 From: Hsiang Date: Sun, 20 Aug 2023 13:51:53 +0800 Subject: [PATCH 9/9] skip edit_dns cause download lib faceing error --- installer/src/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/src/install.c b/installer/src/install.c index 8f524cd..bad862b 100644 --- a/installer/src/install.c +++ b/installer/src/install.c @@ -177,7 +177,7 @@ int install(const char *base_path) return DOCKERCLIE_CANNOTIFS; */ - edit_dns(); + // edit_dns(); copy_start_scripts(); /* terminate vm to set changes */