+static grub_err_t ventoy_iso_vd_id_clear(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+ (void)ctxt;
+ (void)argc;
+ (void)args;
+
+ g_iso_vd_id_publisher[0] = 0;
+ g_iso_vd_id_prepare[0] = 0;
+ g_iso_vd_id_application[0] = 0;
+
+ return 0;
+}
+
+static grub_err_t ventoy_cmd_iso_vd_id_parse(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+ int ret = 1;
+ int offset = 318;
+ grub_file_t file = NULL;
+
+ (void)ctxt;
+ (void)argc;
+
+ file = grub_file_open(args[0], VENTOY_FILE_TYPE);
+ if (!file)
+ {
+ grub_printf("Failed to open %s\n", args[0]);
+ goto out;
+ }
+
+ grub_file_seek(file, 16 * 2048 + offset);
+ grub_file_read(file, g_iso_vd_id_publisher, 128);
+
+ offset += 128;
+ grub_file_seek(file, 16 * 2048 + offset);
+ grub_file_read(file, g_iso_vd_id_prepare, 128);
+
+ offset += 128;
+ grub_file_seek(file, 16 * 2048 + offset);
+ grub_file_read(file, g_iso_vd_id_application, 128);
+
+out:
+
+ check_free(file, grub_file_close);
+ grub_errno = GRUB_ERR_NONE;
+ return ret;
+}
+
+static grub_err_t ventoy_cmd_iso_vd_id_begin(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+ int ret = 1;
+ char *id = g_iso_vd_id_publisher;
+
+ (void)ctxt;
+ (void)argc;
+
+ if (args[0][0] == '1')
+ {
+ id = g_iso_vd_id_prepare;
+ }
+ else if (args[0][0] == '2')
+ {
+ id = g_iso_vd_id_application;
+ }
+
+ if (args[1][0] == '0' && grub_strncasecmp(id, args[2], grub_strlen(args[2])) == 0)
+ {
+ ret = 0;
+ }
+
+ if (args[1][0] == '1' && grub_strncmp(id, args[2], grub_strlen(args[2])) == 0)
+ {
+ ret = 0;
+ }
+
+ grub_errno = GRUB_ERR_NONE;
+ return ret;
+}
+