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 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 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); 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: 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; 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]; 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 diff --git a/installer/src/install.c b/installer/src/install.c index 96b6d07..bad862b 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); @@ -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 */