1 /******************************************************************************
4 * Copyright (c) 2020, longpanda <admin@ventoy.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef __VENTOY_DEF_H__
22 #define __VENTOY_DEF_H__
24 #define VTOY_MAX_SCRIPT_BUF (4 * 1024 * 1024)
26 #define VTOY_PART_BUF_LEN (128 * 1024)
28 #define VTOY_FILT_MIN_FILE_SIZE 32768
30 #define VTOY_SIZE_1GB 1073741824
31 #define VTOY_SIZE_1MB (1024 * 1024)
32 #define VTOY_SIZE_512KB (512 * 1024)
33 #define VTOY_SIZE_1KB 1024
35 #define JSON_SUCCESS 0
37 #define JSON_NOT_FOUND 2
39 #define ulong unsigned long
40 #define ulonglong unsigned long long
42 #define vtoy_to_upper(c) (((char)(c) >= 'a' && (char)(c) <= 'z') ? ((char)(c) - 'a' + 'A') : (char)(c))
44 #define VENTOY_CMD_RETURN(err) grub_errno = (err); return (err)
45 #define VENTOY_FILE_TYPE (GRUB_FILE_TYPE_NO_DECOMPRESS | GRUB_FILE_TYPE_LINUX_INITRD)
47 #define ventoy_env_op1(op, a) grub_env_##op(a)
48 #define ventoy_env_op2(op, a, b) grub_env_##op((a), (b))
50 #define ventoy_get_env(key) ventoy_env_op1(get, key)
51 #define ventoy_set_env(key, val) ventoy_env_op2(set, key, val)
53 #define VTOY_WARNING "!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!"
55 #define VTOY_PWD_CORRUPTED(err) \
57 grub_printf("\n\n Password corrupted, will reboot after 5 seconds.\n\n"); \
64 typedef struct ventoy_initrd_ctx
66 const char *path_prefix
;
67 const char *dir_prefix
;
70 typedef struct cmd_para
73 grub_extcmd_func_t func
;
74 grub_command_flags_t flags
;
75 const struct grub_arg_option
*parser
;
78 const char *description
;
83 #define ventoy_align_2k(value) ((value + 2047) / 2048 * 2048)
84 #define ventoy_align(value, align) (((value) + ((align) - 1)) & (~((align) - 1)))
87 typedef struct cpio_newc_header
107 #define cmd_raw_name ctxt->extcmd->cmd->name
108 #define check_free(p, func) if (p) { func(p); p = NULL; }
109 #define grub_check_free(p) if (p) { grub_free(p); p = NULL; }
111 typedef int (*grub_char_check_func
)(int c
);
112 #define ventoy_is_decimal(str) ventoy_string_check(str, grub_isdigit)
116 typedef struct ventoy_patch_vhd
118 grub_uint8_t part_offset_or_guid
[16];
119 grub_uint32_t reserved1
;
120 grub_uint32_t part_type
;
121 grub_uint8_t disk_signature_or_guid
[16];
122 grub_uint8_t reserved2
[16];
123 grub_uint8_t vhd_file_path
[1];
127 // El Torito Boot Record Volume Descriptor
129 typedef struct eltorito_descriptor
133 grub_uint8_t version
;
134 grub_uint8_t system_id
[32];
135 grub_uint8_t reserved
[32];
136 grub_uint32_t sector
;
137 }eltorito_descriptor
;
139 typedef struct ventoy_iso9660_override
141 grub_uint32_t first_sector
;
142 grub_uint32_t first_sector_be
;
144 grub_uint32_t size_be
;
145 }ventoy_iso9660_override
;
147 typedef struct ventoy_udf_override
149 grub_uint32_t length
;
150 grub_uint32_t position
;
151 }ventoy_udf_override
;
153 typedef struct ventoy_iso9660_vd
165 #define img_type_iso 0
166 #define img_type_wim 1
167 #define img_type_efi 2
168 #define img_type_img 3
169 #define img_type_vhd 4
170 #define img_type_vtoy 5
172 typedef struct img_info
180 const char *menu_prefix
;
184 int plugin_list_index
;
191 struct img_info
*next
;
192 struct img_info
*prev
;
195 typedef struct img_iterator_node
197 struct img_iterator_node
*next
;
205 int plugin_list_index
;
207 struct img_iterator_node
*parent
;
208 struct img_iterator_node
*firstchild
;
215 typedef struct initrd_info
219 grub_uint64_t offset
;
222 grub_uint8_t iso_type
; // 0: iso9660 1:udf
223 grub_uint32_t udf_start_block
;
225 grub_uint64_t override_offset
;
226 grub_uint32_t override_length
;
227 char override_data
[32];
229 struct initrd_info
*next
;
230 struct initrd_info
*prev
;
233 extern initrd_info
*g_initrd_img_list
;
234 extern initrd_info
*g_initrd_img_tail
;
235 extern int g_initrd_img_count
;
236 extern int g_valid_initrd_count
;
238 extern img_info
*g_ventoy_img_list
;
239 extern int g_ventoy_img_count
;
241 extern grub_uint8_t
*g_ventoy_cpio_buf
;
242 extern grub_uint32_t g_ventoy_cpio_size
;
243 extern cpio_newc_header
*g_ventoy_initrd_head
;
244 extern grub_uint8_t
*g_ventoy_runtime_buf
;
246 extern ventoy_guid g_ventoy_guid
;
248 extern ventoy_img_chunk_list g_img_chunk_list
;
249 extern ventoy_img_chunk_list g_wimiso_chunk_list
;
250 extern char *g_wimiso_path
;
251 extern char g_arch_mode_suffix
[64];
253 extern int g_ventoy_debug
;
254 void ventoy_debug(const char *fmt
, ...);
255 #define debug(fmt, ...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, __VA_ARGS__)
257 #define vtoy_ssprintf(buf, pos, fmt, ...) \
258 pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__)
260 #define FLAG_HEADER_RESERVED 0x00000001
261 #define FLAG_HEADER_COMPRESSION 0x00000002
262 #define FLAG_HEADER_READONLY 0x00000004
263 #define FLAG_HEADER_SPANNED 0x00000008
264 #define FLAG_HEADER_RESOURCE_ONLY 0x00000010
265 #define FLAG_HEADER_METADATA_ONLY 0x00000020
266 #define FLAG_HEADER_WRITE_IN_PROGRESS 0x00000040
267 #define FLAG_HEADER_RP_FIX 0x00000080 // reparse point fixup
268 #define FLAG_HEADER_COMPRESS_RESERVED 0x00010000
269 #define FLAG_HEADER_COMPRESS_XPRESS 0x00020000
270 #define FLAG_HEADER_COMPRESS_LZX 0x00040000
271 #define FLAG_HEADER_COMPRESS_LZMS 0x00080000
273 #define RESHDR_FLAG_FREE 0x01
274 #define RESHDR_FLAG_METADATA 0x02
275 #define RESHDR_FLAG_COMPRESSED 0x04
276 #define RESHDR_FLAG_SPANNED 0x08
280 /* A WIM resource header */
281 typedef struct wim_resource_header
283 grub_uint64_t size_in_wim
:56; /* Compressed length */
284 grub_uint64_t flags
:8; /* flags */
285 grub_uint64_t offset
; /* Offset */
286 grub_uint64_t raw_size
; /* Uncompressed length */
287 }wim_resource_header
;
289 /* WIM resource header length mask */
290 #define WIM_RESHDR_ZLEN_MASK 0x00ffffffffffffffULL
292 /* WIM resource header flags */
293 typedef enum wim_resource_header_flags
295 WIM_RESHDR_METADATA
= ( 0x02ULL
<< 56 ), /* Resource contains metadata */
296 WIM_RESHDR_COMPRESSED
= ( 0x04ULL
<< 56 ), /* Resource is compressed */
297 WIM_RESHDR_PACKED_STREAMS
= ( 0x10ULL
<< 56 ), /* Resource is compressed using packed streams */
298 }wim_resource_header_flags
;
300 #define WIM_HEAD_SIGNATURE "MSWIM\0\0"
303 typedef struct wim_header
305 grub_uint8_t signature
[8]; /* Signature */
306 grub_uint32_t header_len
; /* Header length */
307 grub_uint32_t version
; /* Verson */
308 grub_uint32_t flags
; /* Flags */
309 grub_uint32_t chunk_len
; /* Chunk length */
310 grub_uint8_t guid
[16]; /* GUID */
311 grub_uint16_t part
; /* Part number */
312 grub_uint16_t parts
; /* Total number of parts */
313 grub_uint32_t images
; /* number of images */
314 wim_resource_header lookup
; /* Lookup table */
315 wim_resource_header xml
; /* XML data */
316 wim_resource_header metadata
; /* Boot metadata */
317 grub_uint32_t boot_index
; /* Boot index */
318 wim_resource_header integrity
; /* Integrity table */
319 grub_uint8_t reserved
[60]; /* Reserved */
322 /* WIM header flags */
323 typedef enum wim_header_flags
325 WIM_HDR_XPRESS
= 0x00020000, /* WIM uses Xpress compresson */
326 WIM_HDR_LZX
= 0x00040000, /* WIM uses LZX compression */
329 /* A WIM file hash */
330 typedef struct wim_hash
333 grub_uint8_t sha1
[20];
336 /* A WIM lookup table entry */
337 typedef struct wim_lookup_entry
339 wim_resource_header resource
; /* Resource header */
340 grub_uint16_t part
; /* Part number */
341 grub_uint32_t refcnt
; /* Reference count */
342 wim_hash hash
; /* Hash */
345 /* WIM chunk length */
346 #define WIM_CHUNK_LEN 32768
348 /* A WIM chunk buffer */
349 typedef struct wim_chunk_buffer
351 grub_uint8_t data
[WIM_CHUNK_LEN
]; /*Data */
355 typedef struct wim_security_header
357 grub_uint32_t len
; /* Length */
358 grub_uint32_t count
; /* Number of entries */
359 }wim_security_header
;
361 /* Directory entry */
362 typedef struct wim_directory_entry
364 grub_uint64_t len
; /* Length */
365 grub_uint32_t attributes
; /* Attributes */
366 grub_uint32_t security
; /* Security ID */
367 grub_uint64_t subdir
; /* Subdirectory offset */
368 grub_uint8_t reserved1
[16]; /* Reserved */
369 grub_uint64_t created
; /* Creation time */
370 grub_uint64_t accessed
; /* Last access time */
371 grub_uint64_t written
; /* Last written time */
372 wim_hash hash
; /* Hash */
373 grub_uint8_t reserved2
[12]; /* Reserved */
374 grub_uint16_t streams
; /* Streams */
375 grub_uint16_t short_name_len
; /* Short name length */
376 grub_uint16_t name_len
; /* Name length */
377 }wim_directory_entry
;
380 #define WIM_ATTR_NORMAL 0x00000080UL
382 /** No security information exists for this file */
383 #define WIM_NO_SECURITY 0xffffffffUL
388 typedef struct wim_tail
390 grub_uint32_t wim_raw_size
;
391 grub_uint32_t wim_align_size
;
393 grub_uint8_t iso_type
;
394 grub_uint64_t file_offset
;
395 grub_uint32_t udf_start_block
;
396 grub_uint64_t fe_entry_size_offset
;
397 grub_uint64_t override_offset
;
398 grub_uint32_t override_len
;
399 grub_uint8_t override_data
[32];
401 wim_header wim_header
;
404 grub_uint32_t jump_exe_len
;
405 grub_uint8_t
*jump_bin_data
;
406 grub_uint32_t bin_raw_len
;
407 grub_uint32_t bin_align_len
;
409 grub_uint8_t
*new_meta_data
;
410 grub_uint32_t new_meta_len
;
411 grub_uint32_t new_meta_align_len
;
413 grub_uint8_t
*new_lookup_data
;
414 grub_uint32_t new_lookup_len
;
415 grub_uint32_t new_lookup_align_len
;
418 typedef struct wim_patch
425 wim_lookup_entry
*replace_look
;
429 struct wim_patch
*next
;
433 typedef enum _JSON_TYPE
435 JSON_TYPE_NUMBER
= 0,
445 typedef struct _VTOY_JSON
447 struct _VTOY_JSON
*pstPrev
;
448 struct _VTOY_JSON
*pstNext
;
449 struct _VTOY_JSON
*pstChild
;
451 JSON_TYPE enDataType
;
456 grub_uint64_t lValue
;
462 typedef struct _JSON_PARSE
466 grub_uint32_t uiBufSize
;
469 #define JSON_NEW_ITEM(pstJson, ret) \
471 (pstJson) = (VTOY_JSON *)grub_zalloc(sizeof(VTOY_JSON)); \
472 if (NULL == (pstJson)) \
474 json_debug("Failed to alloc memory for json.\n"); \
479 typedef int (*ventoy_plugin_entry_pf
)(VTOY_JSON
*json
, const char *isodisk
);
480 typedef int (*ventoy_plugin_check_pf
)(VTOY_JSON
*json
, const char *isodisk
);
482 typedef struct plugin_entry
485 ventoy_plugin_entry_pf entryfunc
;
486 ventoy_plugin_check_pf checkfunc
;
490 void ventoy_fill_os_param(grub_file_t file
, ventoy_os_param
*param
);
491 grub_err_t
ventoy_cmd_isolinux_initrd_collect(grub_extcmd_context_t ctxt
, int argc
, char **args
);
492 grub_err_t
ventoy_cmd_grub_initrd_collect(grub_extcmd_context_t ctxt
, int argc
, char **args
);
493 grub_err_t
ventoy_cmd_specify_initrd_file(grub_extcmd_context_t ctxt
, int argc
, char **args
);
494 grub_err_t
ventoy_cmd_dump_initrd_list(grub_extcmd_context_t ctxt
, int argc
, char **args
);
495 grub_err_t
ventoy_cmd_clear_initrd_list(grub_extcmd_context_t ctxt
, int argc
, char **args
);
496 grub_uint32_t
ventoy_get_iso_boot_catlog(grub_file_t file
);
497 int ventoy_has_efi_eltorito(grub_file_t file
, grub_uint32_t sector
);
498 grub_err_t
ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt
, int argc
, char **args
);
499 grub_err_t
ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt
, int argc
, char **args
);
500 grub_err_t
ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt
, int argc
, char **args
);
501 grub_err_t
ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt
, int argc
, char **args
);
502 grub_err_t
ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt
, int argc
, char **args
);
503 grub_err_t
ventoy_cmd_skip_svd(grub_extcmd_context_t ctxt
, int argc
, char **args
);
504 grub_err_t
ventoy_cmd_cpio_busybox_64(grub_extcmd_context_t ctxt
, int argc
, char **args
);
505 grub_err_t
ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt
, int argc
, char **args
);
506 int ventoy_cpio_newc_fill_head(void *buf
, int filesize
, const void *filedata
, const char *name
);
507 grub_file_t
ventoy_grub_file_open(enum grub_file_type type
, const char *fmt
, ...);
508 grub_uint64_t
ventoy_grub_get_file_size(const char *fmt
, ...);
509 int ventoy_is_file_exist(const char *fmt
, ...);
510 int ventoy_is_dir_exist(const char *fmt
, ...);
511 int ventoy_fill_data(grub_uint32_t buflen
, char *buffer
);
512 grub_err_t
ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt
, int argc
, char **args
);
513 grub_err_t
ventoy_cmd_wimdows_reset(grub_extcmd_context_t ctxt
, int argc
, char **args
);
514 grub_err_t
ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt
, int argc
, char **args
);
515 grub_err_t
ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt
, int argc
, char **args
);
516 grub_err_t
ventoy_cmd_wim_check_bootable(grub_extcmd_context_t ctxt
, int argc
, char **args
);
517 grub_err_t
ventoy_cmd_dump_wim_patch(grub_extcmd_context_t ctxt
, int argc
, char **args
);
519 VTOY_JSON
*vtoy_json_find_item
522 JSON_TYPE enDataType
,
525 int vtoy_json_parse_value
533 VTOY_JSON
* vtoy_json_create(void);
534 int vtoy_json_parse(VTOY_JSON
*pstJson
, const char *szJsonData
);
536 int vtoy_json_scan_parse
538 const VTOY_JSON
*pstJson
,
539 grub_uint32_t uiParseNum
,
540 JSON_PARSE
*pstJsonParse
543 int vtoy_json_scan_array
547 VTOY_JSON
**ppstArrayItem
550 int vtoy_json_scan_array_ex
554 VTOY_JSON
**ppstArrayItem
556 int vtoy_json_scan_object
560 VTOY_JSON
**ppstObjectItem
562 int vtoy_json_get_int
568 int vtoy_json_get_uint
572 grub_uint32_t
*puiValue
574 int vtoy_json_get_uint64
578 grub_uint64_t
*pui64Value
580 int vtoy_json_get_bool
584 grub_uint8_t
*pbValue
586 int vtoy_json_get_string
590 grub_uint32_t uiBufLen
,
593 const char * vtoy_json_get_string_ex(VTOY_JSON
*pstJson
, const char *szKey
);
594 int vtoy_json_destroy(VTOY_JSON
*pstJson
);
597 grub_uint32_t CalculateCrc32
600 grub_uint32_t Length
,
601 grub_uint32_t InitValue
604 static inline int ventoy_isspace (int c
)
606 return (c
== '\n' || c
== '\r' || c
== ' ' || c
== '\t');
609 static inline int ventoy_is_word_end(int c
)
611 return (c
== 0 || c
== ',' || ventoy_isspace(c
));
615 typedef struct ventoy_part_table
617 grub_uint8_t Active
; // 0x00 0x80
619 grub_uint8_t StartHead
;
620 grub_uint16_t StartSector
: 6;
621 grub_uint16_t StartCylinder
: 10;
625 grub_uint8_t EndHead
;
626 grub_uint16_t EndSector
: 6;
627 grub_uint16_t EndCylinder
: 10;
629 grub_uint32_t StartSectorId
;
630 grub_uint32_t SectorCount
;
633 typedef struct ventoy_mbr_head
635 grub_uint8_t BootCode
[446];
636 ventoy_part_table PartTbl
[4];
641 typedef struct ventoy_gpt_head
643 char Signature
[8]; /* EFI PART */
644 grub_uint8_t Version
[4];
645 grub_uint32_t Length
;
647 grub_uint8_t Reserved1
[4];
648 grub_uint64_t EfiStartLBA
;
649 grub_uint64_t EfiBackupLBA
;
650 grub_uint64_t PartAreaStartLBA
;
651 grub_uint64_t PartAreaEndLBA
;
652 grub_uint8_t DiskGuid
[16];
653 grub_uint64_t PartTblStartLBA
;
654 grub_uint32_t PartTblTotNum
;
655 grub_uint32_t PartTblEntryLen
;
656 grub_uint32_t PartTblCrc
;
657 grub_uint8_t Reserved2
[420];
660 typedef struct ventoy_gpt_part_tbl
662 grub_uint8_t PartType
[16];
663 grub_uint8_t PartGuid
[16];
664 grub_uint64_t StartLBA
;
665 grub_uint64_t LastLBA
;
667 grub_uint16_t Name
[36];
668 }ventoy_gpt_part_tbl
;
670 typedef struct ventoy_gpt_info
673 ventoy_gpt_head Head
;
674 ventoy_gpt_part_tbl PartTbl
[128];
677 typedef struct vhd_footer_t
679 char cookie
[8]; // Cookie
680 grub_uint32_t features
; // Features
681 grub_uint32_t ffversion
; // File format version
682 grub_uint32_t dataoffset
; // Data offset
683 grub_uint32_t timestamp
; // Timestamp
684 grub_uint32_t creatorapp
; // Creator application
685 grub_uint32_t creatorver
; // Creator version
686 grub_uint32_t creatorhos
; // Creator host OS
687 grub_uint32_t origsize
; // Original size
688 grub_uint32_t currsize
; // Current size
689 grub_uint32_t diskgeom
; // Disk geometry
690 grub_uint32_t disktype
; // Disk type
691 grub_uint32_t checksum
; // Checksum
692 grub_uint8_t uniqueid
[16]; // Unique ID
693 grub_uint8_t savedst
; // Saved state
696 #define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
698 /** Image signature. */
699 #define VDI_IMAGE_SIGNATURE (0xbeda107f)
701 typedef struct VDIPREHEADER
703 /** Just text info about image type, for eyes only. */
705 /** The image signature (VDI_IMAGE_SIGNATURE). */
706 grub_uint32_t u32Signature
;
707 /** The image version (VDI_IMAGE_VERSION). */
708 grub_uint32_t u32Version
;
709 } VDIPREHEADER
, *PVDIPREHEADER
;
713 typedef struct ventoy_video_mode
716 grub_uint32_t height
;
722 typedef struct file_fullpath
727 typedef struct install_template
735 file_fullpath
*templatepath
;
737 struct install_template
*next
;
740 typedef struct dudfile
752 file_fullpath
*dudpath
;
758 typedef struct persistence_config
766 file_fullpath
*backendpath
;
768 struct persistence_config
*next
;
771 #define vtoy_alias_image_file 0
772 #define vtoy_alias_directory 1
774 typedef struct menu_alias
781 struct menu_alias
*next
;
784 #define vtoy_class_image_file 0
785 #define vtoy_class_directory 1
787 typedef struct menu_class
794 struct menu_class
*next
;
797 #define vtoy_max_replace_file_size (2 * 1024 * 1024)
798 typedef struct conf_replace
805 struct conf_replace
*next
;
808 typedef struct injection_config
814 struct injection_config
*next
;
817 typedef struct auto_memdisk
822 struct auto_memdisk
*next
;
825 typedef struct image_list
830 struct image_list
*next
;
833 typedef struct vtoy_password
837 grub_uint8_t sha256
[32];
839 struct vtoy_password
*next
;
842 extern int g_ventoy_menu_esc
;
843 extern int g_ventoy_suppress_esc
;
844 extern int g_ventoy_last_entry
;
845 extern int g_ventoy_memdisk_mode
;
846 extern int g_ventoy_iso_raw
;
847 extern int g_ventoy_iso_uefi_drv
;
848 extern int g_ventoy_case_insensitive
;
849 extern grub_uint8_t g_ventoy_chain_type
;
850 extern int g_vhdboot_enable
;
851 extern int g_plugin_image_list
;
852 extern ventoy_gpt_info
*g_ventoy_part_info
;
853 extern grub_uint64_t g_conf_replace_offset
;
854 extern grub_uint64_t g_svd_replace_offset
;
855 extern conf_replace
*g_conf_replace_node
;
856 extern grub_uint8_t
*g_conf_replace_new_buf
;
857 extern int g_conf_replace_new_len
;
858 extern int g_conf_replace_new_len_align
;
860 #define ventoy_unix_fill_virt(new_data, new_len) \
862 data_secs = (new_len + 2047) / 2048; \
863 cur->mem_sector_start = sector; \
864 cur->mem_sector_end = cur->mem_sector_start + data_secs; \
865 cur->mem_sector_offset = offset; \
866 cur->remap_sector_start = 0; \
867 cur->remap_sector_end = 0; \
868 cur->org_sector_start = 0; \
869 grub_memcpy(override + offset, new_data, new_len); \
871 sector += data_secs; \
873 chain->virt_img_size_in_bytes += data_secs * 2048; \
876 char * ventoy_get_line(char *start
);
877 int ventoy_cmp_img(img_info
*img1
, img_info
*img2
);
878 void ventoy_swap_img(img_info
*img1
, img_info
*img2
);
879 char * ventoy_plugin_get_cur_install_template(const char *isopath
);
880 install_template
* ventoy_plugin_find_install_template(const char *isopath
);
881 persistence_config
* ventoy_plugin_find_persistent(const char *isopath
);
882 void ventoy_plugin_dump_injection(void);
883 void ventoy_plugin_dump_auto_install(void);
884 int ventoy_fill_windows_rtdata(void *buf
, char *isopath
);
885 int ventoy_plugin_get_persistent_chunklist(const char *isopath
, int index
, ventoy_img_chunk_list
*chunk_list
);
886 const char * ventoy_plugin_get_injection(const char *isopath
);
887 const char * ventoy_plugin_get_menu_alias(int type
, const char *isopath
);
888 const char * ventoy_plugin_get_menu_class(int type
, const char *name
);
889 int ventoy_plugin_check_memdisk(const char *isopath
);
890 int ventoy_plugin_get_image_list_index(int type
, const char *name
);
891 conf_replace
* ventoy_plugin_find_conf_replace(const char *iso
);
892 dud
* ventoy_plugin_find_dud(const char *iso
);
893 int ventoy_plugin_load_dud(dud
*node
, const char *isopart
);
894 int ventoy_get_block_list(grub_file_t file
, ventoy_img_chunk_list
*chunklist
, grub_disk_addr_t start
);
895 int ventoy_check_block_list(grub_file_t file
, ventoy_img_chunk_list
*chunklist
, grub_disk_addr_t start
);
896 void ventoy_plugin_dump_persistence(void);
897 grub_err_t
ventoy_cmd_plugin_check_json(grub_extcmd_context_t ctxt
, int argc
, char **args
);
898 grub_err_t
ventoy_cmd_check_password(grub_extcmd_context_t ctxt
, int argc
, char **args
);
899 grub_err_t
ventoy_cmd_linux_get_main_initrd_index(grub_extcmd_context_t ctxt
, int argc
, char **args
);
900 grub_err_t
ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt
, int argc
, char **args
);
901 grub_err_t
ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt
, int argc
, char **args
);
902 grub_err_t
ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt
, int argc
, char **args
);
903 grub_err_t
ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt
, int argc
, char **args
);
904 int ventoy_get_disk_guid(const char *filename
, grub_uint8_t
*guid
, grub_uint8_t
*signature
);
905 grub_err_t
ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt
, int argc
, char **args
);
906 grub_err_t
ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt
, int argc
, char **args
);
907 grub_err_t
ventoy_cmd_unix_replace_ko(grub_extcmd_context_t ctxt
, int argc
, char **args
);
908 grub_err_t
ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt
, int argc
, char **args
);
909 grub_err_t
ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt
, int argc
, char **args
);
910 int ventoy_check_device_result(int ret
);
911 int ventoy_check_device(grub_device_t dev
);
912 void ventoy_debug_dump_guid(const char *prefix
, grub_uint8_t
*guid
);
913 grub_err_t
ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt
, int argc
, char **args
);
914 grub_err_t
ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt
, int argc
, char **args
);
915 grub_err_t
ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt
, int argc
, char **args
);
916 grub_err_t
ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt
, int argc
, char **args
);
917 int ventoy_check_password(const grub_uint8_t
*pwdsha256
, int retry
);
919 #endif /* __VENTOY_DEF_H__ */