Could you explain more please?
Not original ISO file??? So what ISO file is it?
By virtual ISO, you mean in memory? So is there a large memory requirement or does it point to the actual file?
Does the file need to be contiguous?
Exactly how do you insert the driver and hook scripts into the ISO?
Please explain process.
For the question first,
By virtual ISO, you mean in memory? So is there a large memory requirement or does it point to the actual file?
---NO
Does the file need to be contiguous?
---NO
Take lagacy bios for example. You may be very familiar with grub4dos's map and syslinux's memdisk. They both use the int13 hook mechanism.
A virtual device with drive number 0x81 (for example) will be created. When the int13 request for the virtual device come, they response it with data from memory or
just change the drive number and sector to get the data from the original file in disk 0x80(for example)
Ventoy also use int13 hook, to be exactly some thing can be called int13 relay. Before the virtual device was created. All the sector's location of the original iso file
will be found(something like grub2's blocklist command).
So the virtual device can be mapped as follows:
VirtualCDROM Physical Disk
LBA 0 LBA 100
LBA 1 LBA 121
LBA 2 LBA 133
LBA 3 LBA 140
......
So when the int13 request for the virtual device come, Ventoy look for the map table, and re-call int13 with a new drive number and new LBA for every LBA (contiguous LBA can be merged).
All the above are the first level virtualization of Ventoy.
Take LBA0 of the VirtualCDROM for example, when the request come, I can recall int13 to get the data of LBA100 of the physical disk and response it.
On the other hand, I can also fill it with my own data and response it.
Besides, the map table is not One-to-one correspondence to the original iso file. The virtual device is bigger than the original iso file.
The extra data after the data mapped to the original iso file is virtual. When the int13 request for these virtual data come, ventoy will fill them directly and reponse it.
The extra data is just the hook. But if you just append some data after an iso file, it will not take affect. So ventoy will parse the ISO9660 or UDF file system, and find the location of
key data which corresponding to the location and length of initrd(linux) or boot.wim(windows), and modify it before response the corresponding int13 request.
Ventoy modify the location and length and point it to the extra data at the tail of the virtual iso file.