blog.area23.at - a simple url encoder/decoder

 a simple url encoder/decoder
 https://blog.area23.at

Labels

Wirtschaft (158) Pressefreiheit (149) Österreich (127) IT (108) code (68) Staatsschulden (38) EZB (27) Pensionssystem (17) Geopolitik (10)
Posts mit dem Label IT werden angezeigt. Alle Posts anzeigen
Posts mit dem Label IT werden angezeigt. Alle Posts anzeigen

2025-08-09

Is there a way under windows to mount a in exe included disk image at runtime

[ 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

    mount -o loop,offset=$((1024 * 512 * 8)) image.raw /mnt

  • losetup

    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

Output of shell script -x (debug


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

and also C# .Net crossgen2 to produce a big static exe, that needs no Framework anymore

The only problem I have, is how to mount disk / iso9660 image files with a certain offset.