diff --git a/Plugson/build.sh b/Plugson/build.sh index 095d0709..af159b90 100644 --- a/Plugson/build.sh +++ b/Plugson/build.sh @@ -8,14 +8,14 @@ build_func() { libsuffix=$2 toolDir=$3 - XXFLAG='-std=gnu99 -D_FILE_OFFSET_BITS=64' + XXFLAG='-std=gnu99 -D_FILE_OFFSET_BITS=64 -O2' XXLIB="" echo "CC=$1 libsuffix=$libsuffix toolDir=$toolDir" echo "CC civetweb.o" $1 $XXFLAG -c -Wall -Wextra -Wshadow -Wformat-security -Winit-self \ - -Wmissing-prototypes -O2 -DLINUX \ + -Wmissing-prototypes -DLINUX \ -I./src/Lib/libhttp/include \ -DNDEBUG -DNO_CGI -DNO_CACHING -DNO_SSL -DSQLITE_DISABLE_LFS -DSSL_ALREADY_INITIALIZED \ -DUSE_STACK_SIZE=102400 -DNDEBUG -fPIC \ @@ -23,7 +23,7 @@ build_func() { -o ./civetweb.o echo "CC plugson.o" - $1 $XXFLAG -O2 $exopt -Wall -Wno-unused-function -DSTATIC=static -DINIT= \ + $1 $XXFLAG $exopt -Wall -Wno-unused-function -DSTATIC=static -DINIT= \ -I./src \ -I./src/Core \ -I./src/Web \ @@ -71,7 +71,6 @@ build_func() { } build_func "gcc" '64' 'x86_64' - build_func "gcc -m32" '32' 'i386' build_func "aarch64-linux-gnu-gcc" 'aa64' 'aarch64' build_func "mips-linux-gnu-gcc -mips64r2 -mabi=64" 'm64e' 'mips64el' diff --git a/Plugson/src/Core/ventoy_disk_linux.c b/Plugson/src/Core/ventoy_disk_linux.c index 1a081592..f4ec853c 100644 --- a/Plugson/src/Core/ventoy_disk_linux.c +++ b/Plugson/src/Core/ventoy_disk_linux.c @@ -311,12 +311,24 @@ uint64_t ventoy_get_disk_size_in_byte(const char *disk) int ventoy_get_disk_vendor(const char *name, char *vendorbuf, int bufsize) { - return ventoy_get_sys_file_line(vendorbuf, bufsize, "/sys/block/%s/device/vendor", name); + if (strncmp(name, "loop", 4) == 0) + { + scnprintf(vendorbuf, bufsize, "Local"); + return 0; + } + + return ventoy_get_sys_file_line(vendorbuf, bufsize, "/sys/block/%s/device/vendor", name); } int ventoy_get_disk_model(const char *name, char *modelbuf, int bufsize) { - return ventoy_get_sys_file_line(modelbuf, bufsize, "/sys/block/%s/device/model", name); + if (strncmp(name, "loop", 4) == 0) + { + scnprintf(modelbuf, bufsize, "Loop Device"); + return 0; + } + + return ventoy_get_sys_file_line(modelbuf, bufsize, "/sys/block/%s/device/model", name); } static int fatlib_media_sector_read(uint32 sector, uint8 *buffer, uint32 sector_count) @@ -576,9 +588,9 @@ int ventoy_get_disk_info(char **argv) char model[128]; char *disk = argv[4]; - if (strncmp(argv[4], "/dev/", 4) == 0) + if (strncmp(argv[4], "/dev/", 5) == 0) { - disk += 4; + disk += 5; } ventoy_get_disk_vendor(disk, vendor, sizeof(vendor)); ventoy_get_disk_model(disk, model, sizeof(model)); diff --git a/Plugson/src/Core/ventoy_json.h b/Plugson/src/Core/ventoy_json.h index bccd3a24..ad130b97 100644 --- a/Plugson/src/Core/ventoy_json.h +++ b/Plugson/src/Core/ventoy_json.h @@ -152,6 +152,9 @@ typedef struct tagVTOY_JSON #define VTOY_JSON_FMT_ITEM_LN(P, Item) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, "%s\"%s\",\n", P, (Item)) #define VTOY_JSON_FMT_ITEM_PATH_LN(P, Item) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, "%s\"%s\",\n", P, ventoy_real_path(Item)) +#define VTOY_JSON_FMT_ITEM_INT(Item) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, "%d,", (Item)) + + #define VTOY_JSON_FMT_COMA() ssprintf(__uiCurPos, __pcBuf, __uiBufLen, ",") #define VTOY_JSON_FMT_COMA_N(cnt) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, ",\n") #define VTOY_JSON_FMT_COMA_N_CNT(cnt) if ((cnt) > 0) ssprintf(__uiCurPos, __pcBuf, __uiBufLen, ",\n") diff --git a/Plugson/src/Core/ventoy_util.c b/Plugson/src/Core/ventoy_util.c index 2a004339..6d3d9e73 100644 --- a/Plugson/src/Core/ventoy_util.c +++ b/Plugson/src/Core/ventoy_util.c @@ -257,4 +257,48 @@ if (backup) #endif } +static const char g_encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '+', '/'}; + +char * ventoy_base64_encode(const char *data, int input_length, int *output_length) +{ + int i = 0; + int j = 0; + char *encoded_data = NULL; + int mod_table[] = {0, 2, 1}; + + *output_length = 4 * ((input_length + 2) / 3); + encoded_data = malloc(*output_length + 4); + if (!encoded_data) + { + return NULL; + } + + while (i < input_length) + { + unsigned int octet_a = i < input_length ? (unsigned char)data[i++] : 0; + unsigned int octet_b = i < input_length ? (unsigned char)data[i++] : 0; + unsigned int octet_c = i < input_length ? (unsigned char)data[i++] : 0; + + unsigned int triple = (octet_a << 0x10) + (octet_b << 0x08) + octet_c; + + encoded_data[j++] = g_encoding_table[(triple >> 3 * 6) & 0x3F]; + encoded_data[j++] = g_encoding_table[(triple >> 2 * 6) & 0x3F]; + encoded_data[j++] = g_encoding_table[(triple >> 1 * 6) & 0x3F]; + encoded_data[j++] = g_encoding_table[(triple >> 0 * 6) & 0x3F]; + } + + for (i = 0; i < mod_table[input_length % 3]; i++) + { + encoded_data[*output_length - 1 - i] = '='; + } + + return encoded_data; +} diff --git a/Plugson/src/Core/ventoy_util.h b/Plugson/src/Core/ventoy_util.h index 7eadfc0a..0ca1632d 100644 --- a/Plugson/src/Core/ventoy_util.h +++ b/Plugson/src/Core/ventoy_util.h @@ -199,6 +199,7 @@ extern unsigned char *g_unxz_buffer; extern int g_unxz_len; void unxz_error(char *x); int unxz_flush(void *src, unsigned int size); +char * ventoy_base64_encode(const char *data, int input_length, int *output_length); #endif /* __VENTOY_UTIL_H__ */ diff --git a/Plugson/src/Core/ventoy_util_linux.c b/Plugson/src/Core/ventoy_util_linux.c index c432f084..c5bf838d 100644 --- a/Plugson/src/Core/ventoy_util_linux.c +++ b/Plugson/src/Core/ventoy_util_linux.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -234,30 +235,18 @@ int ventoy_write_buf_to_file(const char *FileName, void *Bufer, int BufLen) return 0; } - +static sem_t g_writeback_sem; static volatile int g_thread_stop = 0; static pthread_t g_writeback_thread; -static pthread_mutex_t g_writeback_mutex; -static pthread_cond_t g_writeback_cond; + static void * ventoy_local_thread_run(void* data) { ventoy_http_writeback_pf callback = (ventoy_http_writeback_pf)data; - while (1) + while (0 == g_thread_stop) { - pthread_mutex_lock(&g_writeback_mutex); - pthread_cond_wait(&g_writeback_cond, &g_writeback_mutex); - - if (g_thread_stop) - { - pthread_mutex_unlock(&g_writeback_mutex); - break; - } - else - { - callback(); - pthread_mutex_unlock(&g_writeback_mutex); - } + sem_wait(&g_writeback_sem); + callback(); } return NULL; @@ -265,15 +254,14 @@ static void * ventoy_local_thread_run(void* data) void ventoy_set_writeback_event(void) { - pthread_cond_signal(&g_writeback_cond); + sem_post(&g_writeback_sem); } int ventoy_start_writeback_thread(ventoy_http_writeback_pf callback) { g_thread_stop = 0; - pthread_mutex_init(&g_writeback_mutex, NULL); - pthread_cond_init(&g_writeback_cond, NULL); + sem_init(&g_writeback_sem, 0, 0); pthread_create(&g_writeback_thread, NULL, ventoy_local_thread_run, callback); return 0; @@ -282,13 +270,10 @@ int ventoy_start_writeback_thread(ventoy_http_writeback_pf callback) void ventoy_stop_writeback_thread(void) { g_thread_stop = 1; - pthread_cond_signal(&g_writeback_cond); - - pthread_join(g_writeback_thread, NULL); - - pthread_cond_destroy(&g_writeback_cond); - pthread_mutex_destroy(&g_writeback_mutex); + sem_post(&g_writeback_sem); + pthread_join(g_writeback_thread, NULL); + sem_destroy(&g_writeback_sem); } diff --git a/Plugson/src/Web/ventoy_http.c b/Plugson/src/Web/ventoy_http.c index 1fbc1c97..be963919 100644 --- a/Plugson/src/Web/ventoy_http.c +++ b/Plugson/src/Web/ventoy_http.c @@ -60,6 +60,17 @@ static const char *g_ventoy_kbd_layout[] = NULL }; +#define VTOY_DEL_ALL_PATH "4119ae33-98ea-448e-b9c0-569aafcf1fb4" + +static int g_json_exist[plugin_type_max][bios_max]; +static const char *g_plugin_name[plugin_type_max] = +{ + "control", "theme", "menu_alias", "menu_tip", + "menu_class", "auto_install", "persistence", "injection", + "conf_replace", "password", "image_list", + "auto_memdisk", "dud" +}; + static char g_ventoy_help_lang[MAX_LANGUAGE][8]; static char g_pub_path[2 * MAX_PATH]; @@ -341,7 +352,10 @@ static int ventoy_api_sysinfo(struct mg_connection *conn, VTOY_JSON *json) static int ventoy_api_handshake(struct mg_connection *conn, VTOY_JSON *json) { + int i = 0; + int j = 0; int pos = 0; + char key[128]; (void)json; @@ -350,6 +364,19 @@ static int ventoy_api_handshake(struct mg_connection *conn, VTOY_JSON *json) VTOY_JSON_FMT_SINT("status", 0); VTOY_JSON_FMT_SINT("save_error", g_sysinfo.config_save_error); g_sysinfo.config_save_error = 0; + + for (i = 0; i < plugin_type_max; i++) + { + scnprintf(key, sizeof(key), "exist_%s", g_plugin_name[i]); + VTOY_JSON_FMT_KEY(key); + VTOY_JSON_FMT_ARY_BEGIN(); + for (j = 0; j < bios_max; j++) + { + VTOY_JSON_FMT_ITEM_INT(g_json_exist[i][j]); + } + VTOY_JSON_FMT_ARY_ENDEX(); + } + VTOY_JSON_FMT_OBJ_END(); VTOY_JSON_FMT_END(pos); @@ -718,7 +745,7 @@ int ventoy_data_cmp_theme(data_theme *data1, data_theme *data2) { return 1; } - + if (ventoy_path_list_cmp(data1->fontslist, data2->fontslist)) { return 1; @@ -927,7 +954,14 @@ static int ventoy_api_theme_del_file(struct mg_connection *conn, VTOY_JSON *json path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->filelist, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(path_node, data->filelist); + } + else + { + vtoy_list_del(last, node, data->filelist, path); + } } ret = ventoy_data_save_all(); @@ -982,7 +1016,14 @@ static int ventoy_api_theme_del_font(struct mg_connection *conn, VTOY_JSON *json path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->fontslist, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(path_node, data->fontslist); + } + else + { + vtoy_list_del(last, node, data->fontslist, path); + } } ret = ventoy_data_save_all(); @@ -1179,7 +1220,14 @@ static int ventoy_api_alias_del(struct mg_connection *conn, VTOY_JSON *json) path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(data_alias_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -1417,7 +1465,14 @@ static int ventoy_api_tip_del(struct mg_connection *conn, VTOY_JSON *json) path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(data_tip_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -1620,7 +1675,14 @@ static int ventoy_api_class_del(struct mg_connection *conn, VTOY_JSON *json) path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(data_class_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -1749,7 +1811,14 @@ static int ventoy_api_auto_memdisk_del(struct mg_connection *conn, VTOY_JSON *js path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(path_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -1924,7 +1993,14 @@ static int ventoy_api_image_list_del(struct mg_connection *conn, VTOY_JSON *json path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(path_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -2175,7 +2251,14 @@ static int ventoy_api_password_del(struct mg_connection *conn, VTOY_JSON *json) path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(menu_password, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -2366,7 +2449,14 @@ static int ventoy_api_conf_replace_del(struct mg_connection *conn, VTOY_JSON *js path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(conf_replace_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -2555,6 +2645,7 @@ static int ventoy_api_dud_del(struct mg_connection *conn, VTOY_JSON *json) int ret; int index = 0; const char *path = NULL; + dud_node *next = NULL; dud_node *last = NULL; dud_node *node = NULL; data_dud *data = NULL; @@ -2565,7 +2656,20 @@ static int ventoy_api_dud_del(struct mg_connection *conn, VTOY_JSON *json) path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + for (node = data->list; node; node = next) + { + next = node->next; + ventoy_free_path_node_list(node->list); + free(node); + } + data->list = NULL; + } + else + { + vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list); + } } ret = ventoy_data_save_all(); @@ -2902,6 +3006,7 @@ static int ventoy_api_auto_install_del(struct mg_connection *conn, VTOY_JSON *js int index = 0; const char *path = NULL; auto_install_node *last = NULL; + auto_install_node *next = NULL; auto_install_node *node = NULL; data_auto_install *data = NULL; @@ -2911,7 +3016,20 @@ static int ventoy_api_auto_install_del(struct mg_connection *conn, VTOY_JSON *js path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + for (node = data->list; node; node = next) + { + next = node->next; + ventoy_free_path_node_list(node->list); + free(node); + } + data->list = NULL; + } + else + { + vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list); + } } ret = ventoy_data_save_all(); @@ -3229,6 +3347,7 @@ static int ventoy_api_persistence_del(struct mg_connection *conn, VTOY_JSON *jso int index = 0; const char *path = NULL; persistence_node *last = NULL; + persistence_node *next = NULL; persistence_node *node = NULL; data_persistence *data = NULL; @@ -3238,7 +3357,20 @@ static int ventoy_api_persistence_del(struct mg_connection *conn, VTOY_JSON *jso path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + for (node = data->list; node; node = next) + { + next = node->next; + ventoy_free_path_node_list(node->list); + free(node); + } + data->list = NULL; + } + else + { + vtoy_list_del_ex(last, node, data->list, path, ventoy_free_path_node_list); + } } ret = ventoy_data_save_all(); @@ -3515,7 +3647,14 @@ static int ventoy_api_injection_del(struct mg_connection *conn, VTOY_JSON *json) path = VTOY_JSON_STR_EX("path"); if (path) { - vtoy_list_del(last, node, data->list, path); + if (strcmp(path, VTOY_DEL_ALL_PATH) == 0) + { + vtoy_list_free(injection_node, data->list); + } + else + { + vtoy_list_del(last, node, data->list, path); + } } ret = ventoy_data_save_all(); @@ -3524,6 +3663,34 @@ static int ventoy_api_injection_del(struct mg_connection *conn, VTOY_JSON *json) return 0; } +#if 0 +#endif + +static int ventoy_api_preview_json(struct mg_connection *conn, VTOY_JSON *json) +{ + int pos = 0; + int len = 0; + int encodelen = 0; + char *encodebuf = NULL; + + (void)json; + + len = ventoy_data_real_save_all(0); + encodebuf = ventoy_base64_encode(JSON_SAVE_BUFFER, len, &encodelen); + encodebuf[encodelen] = 0; + + VTOY_JSON_FMT_BEGIN(pos, JSON_BUFFER, JSON_BUF_MAX); + VTOY_JSON_FMT_OBJ_BEGIN(); + VTOY_JSON_FMT_STRN("json", encodebuf); + VTOY_JSON_FMT_OBJ_END(); + VTOY_JSON_FMT_END(pos); + + free(encodebuf); + + ventoy_json_buffer(conn, JSON_BUFFER, pos); + return 0; +} + #if 0 #endif @@ -3534,14 +3701,17 @@ int ventoy_data_save_all(void) return 0; } -int ventoy_data_real_save_all(void) +int ventoy_data_real_save_all(int apilock) { int i = 0; int pos = 0; char title[64]; - pthread_mutex_lock(&g_api_mutex); - + if (apilock) + { + pthread_mutex_lock(&g_api_mutex); + } + ssprintf(pos, JSON_SAVE_BUFFER, JSON_BUF_MAX, "{\n"); ventoy_save_plug(control); @@ -3565,7 +3735,10 @@ int ventoy_data_real_save_all(void) } ssprintf(pos, JSON_SAVE_BUFFER, JSON_BUF_MAX, "}\n"); - pthread_mutex_unlock(&g_api_mutex); + if (apilock) + { + pthread_mutex_unlock(&g_api_mutex); + } return pos; } @@ -3578,7 +3751,7 @@ int ventoy_http_writeback(void) ventoy_get_json_path(filename, NULL); - pos = ventoy_data_real_save_all(); + pos = ventoy_data_real_save_all(1); #ifdef VENTOY_SIM printf("%s", JSON_SAVE_BUFFER); @@ -3675,11 +3848,11 @@ static JSON_CB g_ventoy_json_cb[] = { "save_injection", ventoy_api_save_injection }, { "injection_add", ventoy_api_injection_add }, { "injection_del", ventoy_api_injection_del }, - + { "preview_json", ventoy_api_preview_json }, }; -static int ventoy_json_handler(struct mg_connection *conn, VTOY_JSON *json) +static int ventoy_json_handler(struct mg_connection *conn, VTOY_JSON *json, char *jsonstr) { int i; const char *method = NULL; @@ -3696,7 +3869,7 @@ static int ventoy_json_handler(struct mg_connection *conn, VTOY_JSON *json) ventoy_api_handshake(conn, json); return 0; } - + for (i = 0; i < (int)(sizeof(g_ventoy_json_cb) / sizeof(g_ventoy_json_cb[0])); i++) { if (strcmp(method, g_ventoy_json_cb[i].method) == 0) @@ -3740,7 +3913,7 @@ static int ventoy_request_handler(struct mg_connection *conn) if (JSON_SUCCESS == vtoy_json_parse(json, post_data_buf)) { pthread_mutex_lock(&g_api_mutex); - ventoy_json_handler(conn, json->pstChild); + ventoy_json_handler(conn, json->pstChild, post_data_buf); pthread_mutex_unlock(&g_api_mutex); } else @@ -5026,7 +5199,8 @@ end: int ventoy_http_start(const char *ip, const char *port) { - int i; + int i = 0; + int ret = 0; char addr[128]; char filename[128]; char backupname[128]; @@ -5063,10 +5237,13 @@ int ventoy_http_start(const char *ip, const char *port) if (ventoy_is_file_exist("%s", filename)) { ventoy_copy_file(filename, backupname); - ventoy_load_old_json(filename); + ret = ventoy_load_old_json(filename); + if (ret == 0) + { + ventoy_data_real_save_all(0); + } } - /* option */ scnprintf(addr, sizeof(addr), "%s:%s", ip, port); options[1] = addr; diff --git a/Plugson/src/Web/ventoy_http.h b/Plugson/src/Web/ventoy_http.h index 18447c16..4a75196d 100644 --- a/Plugson/src/Web/ventoy_http.h +++ b/Plugson/src/Web/ventoy_http.h @@ -41,6 +41,24 @@ typedef enum bios_mode bios_max }bios_mode; +typedef enum plugin_type +{ + plugin_type_control = 0, + plugin_type_theme, + plugin_type_menu_alias, + plugin_type_menu_tip, + plugin_type_menu_class, + plugin_type_auto_install, + plugin_type_persistence, + plugin_type_injection, + plugin_type_conf_replace, + plugin_type_password, + plugin_type_image_list, + plugin_type_auto_memdisk, + plugin_type_dud, + + plugin_type_max +}plugin_type; typedef struct data_control { @@ -260,8 +278,10 @@ typedef struct data_persistence for (i = 0; i < bios_max; i++) \ {\ scnprintf(title, sizeof(title), "%s%s", #plug, g_json_title_postfix[i]);\ + g_json_exist[plugin_type_##plug][i] = 0;\ if (ventoy_data_cmp_##plug(g_data_##plug + i, g_data_##plug + bios_max))\ {\ + g_json_exist[plugin_type_##plug][i] = 1;\ pos += ventoy_data_save_##plug(g_data_##plug + i, title, JSON_SAVE_BUFFER + pos, JSON_BUF_MAX - pos);\ }\ }\ @@ -302,6 +322,7 @@ typedef struct data_persistence free(__node);\ __node = __next;\ }\ + (list) = NULL;\ } #define vtoy_list_del(last, node, LIST, field) \ @@ -401,6 +422,7 @@ void ventoy_http_exit(void); int ventoy_http_start(const char *ip, const char *port); int ventoy_http_stop(void); int ventoy_data_save_all(void); +int ventoy_data_real_save_all(int apilock); #endif /* __VENTOY_HTTP_H__ */ diff --git a/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe b/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe index 1aa6483f..c01dec7d 100644 Binary files a/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe and b/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe differ diff --git a/Plugson/www/buildtime b/Plugson/www/buildtime index fb13048d..e2f77da3 100644 --- a/Plugson/www/buildtime +++ b/Plugson/www/buildtime @@ -1 +1 @@ -20220921 18:42:35 \ No newline at end of file +20221021 14:42:35 \ No newline at end of file diff --git a/Plugson/www/index.html b/Plugson/www/index.html index b0cdca85..74dccdec 100644 --- a/Plugson/www/index.html +++ b/Plugson/www/index.html @@ -57,6 +57,14 @@ + + + @@ -723,7 +757,7 @@ @@ -745,8 +779,8 @@ - + @@ -760,6 +794,36 @@