Win32 how big custom resource can be?

Viewed 813

Trying to create something similar to SFX (self extract installer), I was including the setup files in one exe using custom resource in visual c++. When the size of the setup files reached over ~900 MB, the linker cannot generate an exe with the resources embedded. Strange thing is that the linker does generate an exe without any warnings. The exe generated is an statically linked MFC App (main app of the exectuable). However, non of the resource is included. I have watched the exe size during the linking from a console. It was showing 900 MB for awhile befored dropped to the 2MB exe in the end. If I removed some of the files (say total size will be 500MB), the exe is generated all OK with all the resources embedded. Is there a pratical size limit for the custom resource? Note that the final size of the executable is about 1GB which is way less that 2GB win32 app can address. So I am wondering is this a vc++ 2010 bug or feature? BTW, I also used /expectedoutputsize trick. But it does not help except the linking is much faster with a bigger expected output size.

3 Answers

I've answered a similar answer here.

Basically append the binary + magic number (unique separator) to the end of the executable. At runtime open the executable for reading, find the offset via a magic number or another method and the rest of the file is your big data.

Related