How IMAGE_FILE_NET_RUN_FROM_SWAP in an EXE File Affects Runtime Libraries

My application sometimes starts from a network share, and some clients report an external exception C0000006 when the application starts. According to my Google research, this β€œmay” be due to the uploaded image and the inability to reboot from the network. The workaround for this is to force Windows to load the full image file into swap and run it from there by setting the IMAGE_FILE_NET_RUN_FROM_SWAP flag

My application also depends on the various .bpl and .dll libraries that load at runtime. Only some of them can be changed by me, some of them are provided by other suppliers. What happens to these libraries if exe has this flag? Are they also loaded into the swap file, or are they still unloaded and reloaded when necessary? Should this flag be included in libraries?

+8
windows winapi
source share
1 answer

The flag applies only to the PE module that sets it. Thus, setting a flag in an EXE does not mean that the modules loaded by this EXE depend on the flag. Each module (DLL, package, etc.) loaded by your EXE will be processed by the loader in accordance with the PE parameters specified in this module.

So, you need to set the PE flag for each module that is in the network share.

For what it's worth, I would recommend adding IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP .

+6
source share

All Articles