[ Original question postetd at stackoverflow ]
maybe you have an idea how that will work under Windows >= 7 or in any case >= 10
I want to generate an executable, where an disk image is added (linked at compile time) to the exe.
Under linux, it's possible to mount an image with a certain offset
mount -o loop,offset=$((1024 * 512 * 8)) image.raw /mnt
losetup /dev/loop0 image.raw -o $((1024 * 512 * 8)) mount /dev/loop0 /mnt
I wrote a simple shell script, that demonstrates that with the efi boot partition added afterwards to a zero image with 8*512k blocks.
#!/usr/bin/bash BLOCKSIZE=`echo '512 * 1024' | bc` SEEK=8 OFFSET=$(echo "$BLOCKSIZE * $SEEK" | bc) dd if=/dev/zero of=zero.img bs=512k count=8 cp zero.img offset_disk.img dd if=/dev/nvme0n1p15 of=offset_disk.img bs=$BLOCKSIZE seek=$SEEK oflag=append mkdir -p /mnt/efi mount -o loop,offset=$OFFSET offset_disk.img /mnt/efi du -h -s *.img ; df -h | grep efi sleep 1 ; umount /mnt/efi ; rm -f zero.img offset_disk.img exit 0
The creation of the image file added to an executable would not be the problem, because I understand:
How to link a dll or dll embedded resource or image file to an executable with C++ linker
- stackoverflow.com: how to link a dll to an exe file at runtime
- learn.microsoft.com: linking an executable to a dll
and also C# .Net crossgen2 to produce a big static exe, that needs no Framework anymore
- learn.microsoft.com: cross platform targeting
- devblogs.microsoft.com: conversation about crossgen2
- flerka.github.io: ahead of time compilation
- stackoverflow.com: how to install crossgen to optimize net core library in ci cd
The only problem I have, is how to mount disk / iso9660 image files with a certain offset.