]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
Support prameters expansion in auto install script.
[Ventoy.git] / GRUB2 / MOD_SRC / grub-2.04 / include / grub / ventoy.h
index 6c320725dfdc31060aaec4300220efe83d84ba80..9b5bb4a80e28547f0f1873a1425b36ce2d634a4d 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __VENTOY_H__
 #define __VENTOY_H__
 
-#define COMPILE_ASSERT(expr)  extern char __compile_assert[(expr) ? 1 : -1]
+#define COMPILE_ASSERT(a, expr)  extern char __compile_assert##a[(expr) ? 1 : -1]
 
 #define VENTOY_COMPATIBLE_STR      "VENTOY COMPATIBLE"
 #define VENTOY_COMPATIBLE_STR_LEN  17
@@ -40,6 +40,15 @@ typedef enum ventoy_fs_type
     ventoy_fs_max
 }ventoy_fs_type;
 
+typedef enum ventoy_chain_type
+{
+    ventoy_chain_linux = 0, /* 0: linux */
+    ventoy_chain_windows,   /* 1: windows */
+    ventoy_chain_wim,       /* 2: wim */
+
+    ventoy_chain_max
+}ventoy_chain_type;
+
 #pragma pack(1)
 
 typedef struct ventoy_guid
@@ -62,7 +71,7 @@ typedef struct ventoy_image_location
 {
     ventoy_guid  guid;
 
-    /* image sector size, currently this value is always 2048 */
+    /* image sector size, 2048/512 */
     grub_uint32_t   image_sector_size;
 
     /* disk sector size, normally the value is 512 */
@@ -109,28 +118,64 @@ typedef struct ventoy_os_param
      *
      * vtoy_reserved[0]: vtoy_break_level
      * vtoy_reserved[1]: vtoy_debug_level
-     * vtoy_reserved[2]: vtoy_chain_type     0:Linux    1:Windows
+     * vtoy_reserved[2]: vtoy_chain_type     0:Linux    1:Windows  2:wimfile
      * vtoy_reserved[3]: vtoy_iso_format     0:iso9660  1:udf
+     * vtoy_reserved[4]: vtoy_windows_cd_prompt
+     * vtoy_reserved[5]: vtoy_linux_remount
+     * vtoy_reserved[6]: vtoy_vlnk
+     * vtoy_reserved[7~10]: vtoy_disk_sig[4] used for vlnk
      *
      */
     grub_uint8_t   vtoy_reserved[32];    // Internal use by ventoy
 
-    grub_uint8_t   reserved[31];
+    grub_uint8_t   vtoy_disk_signature[4];
+
+    grub_uint8_t   reserved[27];
 }ventoy_os_param;
 
 
 typedef struct ventoy_windows_data
 {
     char auto_install_script[384];
-    grub_uint8_t reserved[128];
+    char injection_archive[384];
+    grub_uint8_t windows11_bypass_check;
+
+    grub_uint32_t auto_install_len;
+    
+    grub_uint8_t reserved[255 - 4];
+
+    /* auto_intall file buf */
+    /* ...... + auto_install_len */
 }ventoy_windows_data;
 
 
+typedef struct ventoy_secure_data
+{
+    grub_uint8_t magic1[16];     /* VENTOY_GUID */
+    grub_uint8_t diskuuid[16];   
+    grub_uint8_t Checksum[16];    
+    grub_uint8_t adminSHA256[32];
+    grub_uint8_t reserved[4000];
+    grub_uint8_t magic2[16];     /* VENTOY_GUID */
+}ventoy_secure_data;
+
+
+typedef struct ventoy_vlnk
+{
+    ventoy_guid   guid;         // VENTOY_GUID
+    grub_uint32_t crc32;        // crc32
+    grub_uint32_t disk_signature;
+    grub_uint64_t part_offset; // in bytes
+    char filepath[384];
+    grub_uint8_t reserved[96];
+}ventoy_vlnk;
 
 #pragma pack()
 
 // compile assert check : sizeof(ventoy_os_param) must be 512
-COMPILE_ASSERT(sizeof(ventoy_os_param) == 512);
+COMPILE_ASSERT(1,sizeof(ventoy_os_param) == 512);
+COMPILE_ASSERT(2,sizeof(ventoy_secure_data) == 4096);
+COMPILE_ASSERT(3,sizeof(ventoy_vlnk) == 512);
 
 
 
@@ -163,6 +208,18 @@ typedef struct ventoy_chain_head
     grub_uint32_t virt_chunk_num;
 }ventoy_chain_head;
 
+typedef struct ventoy_image_desc
+{
+    grub_uint64_t disk_size;
+    grub_uint64_t part1_size;
+    grub_uint8_t  disk_uuid[16];
+    grub_uint8_t  disk_signature[4];
+    grub_uint32_t img_chunk_count;
+    /* ventoy_img_chunk list */
+}ventoy_image_desc;
+
+
+
 typedef struct ventoy_img_chunk
 {
     grub_uint32_t img_start_sector; // sector size: 2KB
@@ -203,11 +260,14 @@ typedef struct ventoy_img_chunk_list
 
 #define ventoy_filt_register grub_file_filter_register
 
-typedef const char * (*grub_env_get_pf)(const char *name);
-
 #pragma pack(1)
 
 #define GRUB_FILE_REPLACE_MAGIC  0x1258BEEF
+#define GRUB_IMG_REPLACE_MAGIC   0x1259BEEF
+
+typedef const char * (*grub_env_get_pf)(const char *name);
+typedef int (*grub_env_set_pf)(const char *name, const char *val);
+typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
 typedef struct ventoy_grub_param_file_replace
 {
@@ -220,16 +280,18 @@ typedef struct ventoy_grub_param_file_replace
 typedef struct ventoy_grub_param
 {
     grub_env_get_pf grub_env_get;
-
+    grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
+    ventoy_grub_param_file_replace img_replace;
+    grub_env_printf_pf grub_env_printf;
 }ventoy_grub_param;
 
 #pragma pack()
 
-
 int grub_ext_get_file_chunk(grub_uint64_t part_start, grub_file_t file, ventoy_img_chunk_list *chunk_list);
 int grub_fat_get_file_chunk(grub_uint64_t part_start, grub_file_t file, ventoy_img_chunk_list *chunk_list);
 void grub_iso9660_set_nojoliet(int nojoliet);
+int grub_iso9660_is_joliet(void);
 grub_uint64_t grub_iso9660_get_last_read_pos(grub_file_t file);
 grub_uint64_t grub_iso9660_get_last_file_dirent_pos(grub_file_t file);
 grub_uint64_t grub_udf_get_file_offset(grub_file_t file);