Ykhwong's patch is somewhat too aggressive as it changes all fopen functions (you won't need 2gb+ for reading conf, hopefully 😀), but lacking some other fixes (while 4GB might work, 4GB+ probably won't).
Since I've been doing something similar, I merged both patches + hal's megabuild imgmake. I also added the ability to read (fixed size, not dynamic) VHD images.
I tested the following:
- created a new 8GB VHD image with imgmake c:\dosbox\dosbox.vhd -t hd_8gig (the disk will not be formatted, only images <2GB will be formatted by imgmake as it cannot handle FAT32)
- mounted the VHD using Windows 7 Disk Manager
- initialized disk, created 1 partition and formatted it FAT32
- copied almost 8GB of large files to the image and created md5sum of the files
- inside dosbox, the FAT32 volume will not be visible, but Windows can be booted off another disk and will see the FAT32 volume
- ran md5sum and checked that all files are OK
- ran scandisk and checked it was ok
Only images up to 8GB are supported (1023/255/63). More would require working IDE emulation (edit: it seems extended int13/42h would also work). So far, a larger image can be mounted but Windows will most probably return "Error reading sector" as it tries to access data beyond the 1023 cyl. Creating 8GB image takes some time, be patient.
At first, I created the VHD with Win7 Disk Manager. For the 7GB image, it used only 16 heads and some 14000+ cylinders. Such image cannot be used as it exceeds 1023 cyl limit.
What is little known is that any "raw" image (such as the ones dosbox uses) can be converted to VHD with just writing the 512b footer. I use raw2vhd program for that and the functionality is now incorporated into imgmake. Why VHD? Because it can be natively mounted by Win7 & 8...Linux users? Tough luck 😀 (altough it still a valid raw image with the 512b footer at the end, kpartx will handle it just fine 😁)